TORONTO KIDS COMPUTER CLUB | PMCA Sunday 14:00 Python Homework 20.08.16.
18159
post-template-default,single,single-post,postid-18159,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 20.08.16.

19 Aug PMCA Sunday 14:00 Python Homework 20.08.16.

Question 1

Mike, Cindy and Terry went to the orchard to pick apples. After a whole day of work, everyone picked a lot of apples. Please write a program ask how many apples each person has picked, then print the total apples all three of them have picked.

Sample Input:
Mike: 310
Cindy: 344
Terry: 260

Sample Output:
There are 904 apples in total

Hint:
You could use m = int(input(‘Mike: ‘)) to ask question. The answer you give to the question as a value will be assigned to the variable m.


Question 2.

The scientists just created a spaceship for travelling between planets. You could use the formula distance = speed * time to calculate the distance the spaceship can travel during a period of time. Write a program ask user the speed(km/hour) and travel time(hour) to display the distance the spaceship have traveled.

Sample Input 1:
What is the speed: 40000
How many hours: 2

Sample Output 1:
The spaceship has traveled 80000 km in 2 hours


Sample Input 2:
What is the speed: 30000
How many hours: 12

Sample Output 2:
The spaceship has traveled 360000 km in 12 hours

No Comments

Sorry, the comment form is closed at this time.