Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ___________________________________________ USER INPUT
- print("Welcome to our ridesharing app!")
- class_sessions = int(input("How many days per week does your class at (Smith Hall) meet?"))
- weeks_left = int(input("How many weeks are left in the semester?"))
- gas_price = input("What is the current price of gas per gallon in US dollars?")
- mpg = input("What is the average mileage in miles per gallon for your car?")
- distance = input("What is the one-way distance from your home or dormitory to (Smith Hall) in miles?")
- # ______________________________________ CONSTANT VALUES
- price_per_mile = 0.25
- # _________________________________________ CALCULATIONS
- #___________________ FYI RESULTS
- round_trips = int(class_sessions) * int(weeks_left)
- miles_per_semester = float(distance) * float(round_trips) * 2
- gas_total = ((float(distance) / float(mpg)) * float(gas_price) * 2)
- roundtrip_total = (float(price_per_mile) * float(distance)) * 2 + float(gas_total)
- # ________ COST FOR THE SEMESTER
- one_person = float(roundtrip_total) * float(round_trips)
- two_people = float(one_person) / 2
- three_people = float(one_person / 3
- # _____________________________________ DISPLAYED RESULT
- print("******** RIDE SHARING APP **********")
- print()
- print("DATA YOU PROVIDED")
- print("Gas costs $", gas_price, " per gallon")
- print("Car averages ", mpg, " miles per gallon")
- print("Class meets ", class_sessions, " days/week, ", weeks_left, " weeks/semester")
- print("Distance to (Smith Hall): ", distance, " miles one-way")
- print()
- print("FIXED GENERIC COST")
- print("$0.25 per mile")
- print()
- print("FYI RESULTS")
- print(round_trips, " round trips/semester")
- print(miles_per_semester, " total miles/semester")
- print("$", roundtrip_total, " total for 1 round trip ($", gas_total, " for gas)")
- print()
- print("COST FOR THE SEMESTER")
- print("1 person alone: $", one_person)
- print("2 people sharing: $", two_people, " per person")
- print("3 people sharing: $", three_people, " per person")
- print("*************** THE END ***************")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement