TORONTO KIDS COMPUTER CLUB | Aurora Tuesday 18:30 Python Practice – 18 20.12.15.
18847
post-template-default,single,single-post,postid-18847,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

Aurora Tuesday 18:30 Python Practice – 18 20.12.15.

21 Dec Aurora Tuesday 18:30 Python Practice – 18 20.12.15.

Question 1: (please use function that return a value)

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 2:(please use function that return a value)

You know a family with three children. Their ages form an arithmetic sequence: the difference in ages between the middle child and youngest child is the same as the difference in ages between the oldest child and the middle child. For example, their ages could be 5, 10 and 15, since both adjacent pairs have a difference of 5 years.

Given the ages of the youngest and middle children, what is the age of the oldest child?

The input consists of two integers, each on a separate line. The first line is the age Y of the youngest child. The second line is the age M of the middle child . The output will be the age of the oldest child.


Sample Input 1:
Age Y: 12
Age M: 15

Sample output 1:
Age O: 18

Sample Input 2:
Age Y: 10
AgeM: 10

Sample output 2:
Age O: 10

Class review:

No Comments

Sorry, the comment form is closed at this time.