TORONTO KIDS COMPUTER CLUB | PMCA Sunday 14:00 Python Homework 21.05.23.
19496
post-template-default,single,single-post,postid-19496,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.8.0,vc_responsive

PMCA Sunday 14:00 Python Homework 21.05.23.

25 May PMCA Sunday 14:00 Python Homework 21.05.23.

Question 1:

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


Sample Input 2:
L
L
L
L
L
L

Sample output 2:
Stay home



Question 2:
Santa Claus is wondering which extra gift(s) he’s going to send out for each kids. Eventually, he is going to use his reindeer to determine which gift(s) to give. There are only 3 types of gifts to give:
• Nerf Guns if the reindeer shook its tail at least 3 times and nodded its head at most 4 times;
• Spinners if the reindeer shook its tail at most 6 times and nodded its head at least 2 times;
• LEGOs if the reindeer shook its tail at most 2 times and nodded its head at most 3 times.

Input Specification
The user will be prompted to enter two numbers. First, the user will be prompted to enter the number of times the reindeer shook its tail. Second, the user will be prompted to enter the number of times the reindeer nodded its head.

Output Specification
The output will be the gifts given out match the signals given by the reindeer. If no gift match the signals, there is no output.

Sample 1 (with output shown in text, user input in italics)
How many times did reindeer shake its tail?
4
How many times did reindeer nod its head?
5
Spinners

Sample 2
How many times did reindeer shake its tail?
2
How many times did reindeer nod its head?
3
Spinners
LEGOs

Sample 3
How many times did reindeer shake its tail?
8
How many times did reindeer nod its head?
6

No Comments

Sorry, the comment form is closed at this time.