TORONTO KIDS COMPUTER CLUB | Tuesday 17:00 Python Practice – 23.01.31.
21702
post-template-default,single,single-post,postid-21702,single-format-standard,ajax_fade,page_not_loaded,,no_animation_on_touch,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.10.0,vc_responsive

Tuesday 17:00 Python Practice – 23.01.31.

02 Feb Tuesday 17:00 Python Practice – 23.01.31.

You could do the following homework using IDLE. Please save your IDLE after finish your homework or you could copy you result to google Docs in the google classroom.

Google classroom link: https://classroom.google.com/c/NTg1ODEwNjI3Njkx?cjc=mtmyo64

Variable Questions:

Question 1

Make a variable and assign a number to it (any number you like). Then display your variable using print.


Question 2

Modify your variable, either by replacing the old value with a new value, or by adding something to the old value. Display the new value using print.


Question 3

Make another variable and assign a string (some text) to it.
Then display it using print.


Question 4

Make a variable for DaysPerWeekHoursPerDay, and MinutesPerHour (or make up your own names), and then multiply them together.


Question 5

People are always saying there’s not enough time to get everything done. How many minutes would there be in a week if there were 26 hours in a day? (Hint: Change the HoursPerDay variable.)


Question 6: (Sample Question)

Write a program to solve the following question: Three people ate dinner at a restaurant and want to split the bill. The total is $35.27, and they want to leave a 15 percent tip. How much should each person pay?

Hint: you can create three variables to start:

>>> people = 3
>>> total = 35.27
>>> tip_percent = 0.15

then you could get the result by calculating step-by-step as following:

>>> tip = total * tip_percent
>>> final_total = total + tip
>>> each = final_total / people
>>> print(each)

Data Type Questions:

Question 7.

Use float() to create a number from a string like ‘12.34’. Make sure the result is really a number!


Question 8.

Try using int() to create an integer from a decimal number like 56.78. Did the answer get rounded up or down?


Question 9.

Try using int() to create an integer from a string. Make sure the result is really an integer!

No Comments

Sorry, the comment form is closed at this time.