TORONTO KIDS COMPUTER CLUB | Saturday 16:30 Python Practice – 22.08.20.
20988
post-template-default,single,single-post,postid-20988,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

Saturday 16:30 Python Practice – 22.08.20.

20 Aug Saturday 16:30 Python Practice – 22.08.20.

Question 1:
Make a function that will allow you to print any name, address, street, city, state or province, zip or postal code, and country in the world. (Hint: It needs seven arguments. You can pass them as individual arguments or as a list.)


Question 2:

Write a function to calculate the total value of some change—quarters, dimes and nickels. The function should return the total value of the coins. Then write a program that calls the function. The output should look like this when it runs:

Sample input:
quarters: 3
dimes: 6
nickels: 7

Sample output:
total is $1.70

Question 3(Challenge Yourself):

Santa Claus is playing card game with his reindeer to decide which route he’s going to take to send out the gifts. He is going to play six games. There are no ties. The gift route will be decided based on the results of games as follows:

  • if Santa wins 5 or 6 games, he’s going to take Route 1;
  • if Santa wins 3 or 4 games, he’s going to take Route 2;
  • if Santa wins 1 or 2 games, he’s going to take Route 3;
  • if Santa does not win any games, he will stay at home.

Write a program to determine which route Santa will going to take.

The input consists of six lines, each with one of two possible letters: W (to indicate a win) or L (to indicate a loss).


Sample Input 1:
W
L
W
W
L
W

Sample output 1:
Route 2

Class review:

No Comments

Sorry, the comment form is closed at this time.