[Python #1] create e4.py
This commit is contained in:
parent
dc9b72cffe
commit
8127e6bc71
2 changed files with 24 additions and 0 deletions
17
kjg/python-the-hard-way/e4.py
Normal file
17
kjg/python-the-hard-way/e4.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
cars = 100
|
||||
space_in_a_car = 4.0
|
||||
drivers = 30
|
||||
passengers = 90
|
||||
cars_not_driven = cars - drivers
|
||||
cars_driven = drivers
|
||||
carpool_capacity = cars_driven * space_in_a_car
|
||||
average_passengers_per_car = passengers / cars_driven
|
||||
|
||||
|
||||
print("There are", cars, "cars available.")
|
||||
print("There are only", drivers, "drivers available.")
|
||||
print("There will be", cars_not_driven, "empty cars today.")
|
||||
print("We can transport", carpool_capacity, "people today.")
|
||||
print("We have", passengers, "to carpool today.")
|
||||
print("We need to put about", average_passengers_per_car, "in each car.")
|
||||
|
|
@ -36,3 +36,10 @@ How about some more.
|
|||
Is it greater? True
|
||||
Is it greater or equal? True
|
||||
Is it less or equal? False
|
||||
**** ex4
|
||||
There are 100 cars available.
|
||||
There are only 30 drivers available.
|
||||
There will be 70 empty cars today.
|
||||
We can transport 120.0 people today.
|
||||
We have 90 to carpool today.
|
||||
We need to put about 3.0 in each car.
|
||||
|
|
Loading…
Reference in a new issue