# setting item cars to 100 cars = 100 # setting the amount of spaces in the car space_in_a_car = 4.0 # setting value for drivers drivers = 30 # setting value for passengers passengers = 90 # setting function for cars not driven cars_not_driven = cars - drivers # setting function for cars driven cars_driven = drivers # setting function for carpool carpool_capacity = cars_driven * space_in_a_car #setting function for avg passengers average_passenger_per_car = passengers / cars_driven # # # # print results for data in line 2 print "There are", cars, "cars available." # print results for data in line 6 print "There are only", drivers, "drivers available." # print unused cars print "There are only", cars_not_driven, "empty cars today." # print the max people print "We can transport", carpool_capacity, "people today." # print passengers for the day print "We have", passengers, "to carpool today." # print avg people in each car print "We need to put about", average_passenger_per_car, "in each car."
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question