Question

in python create a program to display the cost of renting a smart car. the user...

in python create a program to display the cost of renting a smart car. the user must be able to enter the number of days he/she rents the cat and the number of miles driven. use constants for the flat rate per day and the flat rate per mile. the program will display the flat rate per day, flat rate per mile, and the total cost of the car rental.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Program:

flat_rate_per_day = 100
flat_rate_per_mile = 2

no_of_days = int(input("\nEnter the number of days : "))
no_of_miles = int(input("Enter the number of miles driven : "))

total = no_of_days*flat_rate_per_day + no_of_miles*flat_rate_per_mile

print("\nFlat rate per day : $"+str(flat_rate_per_day))
print("Flat rate per mile : $"+str(flat_rate_per_mile))
print("\nTotal cost of car rental : $"+str(total)+"\n")


Screenshot: ( for reference )

Output:


Note: If you have any doubts please comment.

It will be great help If you like.

Add a comment
Know the answer?
Add Answer to:
in python create a program to display the cost of renting a smart car. the user...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • in Python The program will compute and display information for a company which rents vehicles to...

    in Python The program will compute and display information for a company which rents vehicles to its customers. For a specified customer, the program will compute and display the amount of money charged for that customer’s vehicle rental. 1. The program will repeatedly prompt the user to enter the following four items for a given customer (in the specified order): a. The customer's classification code (a character) b. The number of days the vehicle was rented (a number) c. The...

  • 1. Write a python script that will compute and display information for a company which rents...

    1. Write a python script that will compute and display information for a company which rents vehicles to its customers. For a specified customer, the program will compute and display the amount of money charged for that customer’s vehicle rental after prompting the user to enter the following four items for a given customer (in the specified order)  The car type (a character either C (compact), M (mid-size), L (luxury), S (SUV), or V (Van) )  The number...

  • The price for renting a car at a car rental company is according to the following...

    The price for renting a car at a car rental company is according to the following schedule: Write a MATLAB program in a script file that calculates the cost of renting a car based on the shown price schedule. The program must ask the user to enter the type of car (Sedan or SUV), the number of days, and the number of miles driven. The program then displays the cost (rounded to cents) for the rent in a sentence that...

  • i need the answe clear in mat lab, i need the in put and out put...

    i need the answe clear in mat lab, i need the in put and out put please 6 29. Write a program in a script file that calculates the cost of renting a according to the following price schedule: 217 Sedan Duration of rent Daily SUV Free Cost of miles additional (per day) mile Daily Free miles Cost of additional (per day) mile rate rate 1-6 days $79 80 $0.69 $84 80 $0.74 7-29 days $69 100 $0.59 $74 100...

  • I need trying to figure out how I can make create a code in Python with this exercise for I am having trouble doing so. Miles Per Gallon Calculator Write a GUI program that calculates a car's gas...

    I need trying to figure out how I can make create a code in Python with this exercise for I am having trouble doing so. Miles Per Gallon Calculator Write a GUI program that calculates a car's gas mileage. The program's window should have Entry widgets that let the user enter the number of gallons of gas the car holds, and the number of miles it can be driven on a full tank. When a Calculate MPG button is clicked,...

  • Create a Python program that asks the user how many miles they think they may run....

    Create a Python program that asks the user how many miles they think they may run. The program should also ask them how much they weight. The program should then use a loop to calculate and print the number of calories burnt while running each mile. o Assume that a person burns 1 calorie per pound during each mile of running

  • A truck rental company rents a moving truck for one day by charging $30 plus $0.08...

    A truck rental company rents a moving truck for one day by charging $30 plus $0.08 per mile. Write a linear equation that relates the cost C, in dollars, of renting the truck to the number x of miles driven. What is the cost of renting the truck if the truck is driven 151 miles? 447 miles? Type the linear equation that relates the cost C, in dollars, of renting the truck to the number of x miles driven. (Use...

  • Travel Expenses Create a GUI in C# Visual Studios application that calculates and displays the total...

    Travel Expenses Create a GUI in C# Visual Studios application that calculates and displays the total travel expenses of a business person on a trip. Here is the information that the user must provide: • Number of days on the trip • Amount of airfare, if any • Amount of car rental fees, if any • Number of miles driven, if a private vehicle was used • Amount of parking fees, if any • Amount of taxi charges, if any...

  • Python please Create a menu-driven modular program so user can take a 10-question math quiz, Addition...

    Python please Create a menu-driven modular program so user can take a 10-question math quiz, Addition or subtraction, at specified difficulty level. Easy(1-digit), Intermediate(2-digit), and Hard(3-digit). After a quiz, display the quiz type and level, and number of correct questions user answered.

  • Write a Python program that does the following: Obtains the following input from a user: Mileage...

    Write a Python program that does the following: Obtains the following input from a user: Mileage at beginning of measurement period Mileage at end of measurement period Gallons of fuel consumed Calculates and displays: Miles driven Miles per gallon Kilometers driven Liters of fuel consumed Kilometers per liter Incorporate some Selection structure logic into it: If a vehicle gets less than 15 miles per gallon, display the message:       "Your vehicle has criminally low fuel efficiency." If it gets 15...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT