TORONTO KIDS COMPUTER CLUB | Summer Camp 2021 Python Homework 15:00 – week 03
19732
post-template-default,single,single-post,postid-19732,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.10.0,vc_responsive

Summer Camp 2021 Python Homework 15:00 – week 03

25 Jul Summer Camp 2021 Python Homework 15:00 – week 03

Question 1:
Write a program to use easygui enterbox that asks for your name, then street, then city, then province, then postal code (all in easygui message boxes). The program should then display a mailing-style full address that looks something like this:

Hint:
Do not forget to import easygui in order to use enterbox and msgbox. You can type the following code to get the input from enterbox:
name = easygui.enterbox('What is your name?')

'\n' can help you create a new line
for example, if we type the following code: 

print('Kevin\nZhu')

it will show Kevin and Zhu in two different lines
Kevin
Zhu


Question 2:

Use EasyGui to write a program to convert temperatures from Fahrenheit to Celsius. The formula for that is: Celsius = 5 / 9 * (Fahrenheit – 32). Use GUI input and output. You need to create a easygui enterbox to ask Fahrenheit, then use message box to show the Celsius degree. (Hint: the input you get from the enter box is a string, so you need float() to convert it into decimal number.


Question 3:
Create a simple number checking program. The computer will ask the user to enter the first number. Then the computer will ask the user to enter the double of the first number. If the second number is the double of the first number, the program will display “Correct!” and “Thank you for playing!”, otherwise, it only shows “Thank you for playing”

Sample Input 1:
Please enter the first number: 10
What is the double of the first number: 20

Sample Output 1:
Correct!
Thank you for playing!

Sample Input 2:
Please enter the first number: 9
What is the double of the first number: 15

Sample Output 1:
Thank you for playing!


Class review and Hint:

No Comments

Sorry, the comment form is closed at this time.