From 8127e6bc71d26c5ac8377be2b0863a417e36cebf Mon Sep 17 00:00:00 2001 From: kjg Date: Mon, 18 May 2020 23:01:21 +0900 Subject: [PATCH] [Python #1] create e4.py --- kjg/python-the-hard-way/e4.py | 17 +++++++++++++++++ kjg/python.org | 7 +++++++ 2 files changed, 24 insertions(+) create mode 100644 kjg/python-the-hard-way/e4.py diff --git a/kjg/python-the-hard-way/e4.py b/kjg/python-the-hard-way/e4.py new file mode 100644 index 0000000..edec0a3 --- /dev/null +++ b/kjg/python-the-hard-way/e4.py @@ -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.") + diff --git a/kjg/python.org b/kjg/python.org index 4dea597..885fb90 100644 --- a/kjg/python.org +++ b/kjg/python.org @@ -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.