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

PMCA Sunday 12:00 Python Homework 20.10.04.

07 Oct PMCA Sunday 12:00 Python Homework 20.10.04.

Question 1:

You’re on a long car trip and arrive at a gas station. It’s 200 km to the next station. Write a program to figure out if you need to buy gas here, or if you can wait for the next station.

Input Specification:
The program should ask these questions, and waiting for your input:

How big is your tank, in liters?
How full is your tank (in percent—for example, half full = 50)?
How many km per liter does your car get?

Output Specification:
should look something like this:

You can go another …… km
The next gas station is 200 km away
You can wait for the next station or You have buy gas here


Input Sample 1:
Size of tank: 60
percent full: 40
km per liter: 10

Output Sample 1:
You can go another 240 km
The next gas station is 200 km away
You can wait for the next station.

Input Sample 2:
Size of tank: 40
percent full: 30
km per liter: 10

Output Sample 2:
You can go another 120 km
The next gas station is 200 km away
You have buy gas here


Question 2
Write a method that reads in three angles (in degrees). State the type of the triangle based on the conditions below:

  • If all three angles are 60, output Equilateral.
  • If the three angles add up to 180 and exactly two of the angles are the same, output Isosceles.
  • If the three angles add up to 180 and no two angles are the same, output Scalene.
  • If the three angles do not add up to 180, output Error.
No Comments

Sorry, the comment form is closed at this time.