TORONTO KIDS COMPUTER CLUB | TCMS 18:30 Python Homework 11.22
16756
post-template-default,single,single-post,postid-16756,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

TCMS 18:30 Python Homework 11.22

27 Nov TCMS 18:30 Python Homework 11.22

Question:

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.

The program should ask these questions, Input Sample:

  • How many gas in your fuel tank, in liters?
  • How many km per liter does your car get?

The output should look something like this:


Output Sample 1:

gas in tank: 24
km per liter: 10
You can go another 240 km
The next gas station is 200 km away
You can wait for the next station.


Output Sample 2:

gas in tank: 12
km per liter: 10
You can go another 120 km
The next gas station is 200 km away
You have to buy gas here

No Comments

Sorry, the comment form is closed at this time.