Question

Write a Python program that does the following (You do not need to write functions): •...

Write a Python program that does the following (You do not need to write functions): • The goal is to calculate the time it will take to go a certain distance • The program will get two inputs from the user o The first input is the speed in miles per hour (floating point number) o The second input is the number of miles that you need to travel (floating point number) • Calculate the time it will take (in hours) to go the number of miles entered as the 2nd input o # of hours = # of Miles / speed • Write the following three lines to a text file. Make sure to include the values where the underlines are. Each sentence should be on a different line. o The speed is ________ o The number of miles is _________ o It will take _______ hours to get to the destination

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

Explanation::

  • Code in PYTHON is given below
  • Screenshots of the Code is also provided
  • Screenshots of the OUTPUT are given at the end of the code


Code in PYTHON::

speed = float(input("Enter speed in miles per hour : "))
miles = float(input("Enter number of miles to travel : "))

time = miles/speed

file = open("output.txt","w")
file.write("The speed is "+str(speed)+"\n")
file.write("The number of miles is "+str(miles)+"\n")
file.write("It will take "+str(time)+" hours to get to the destination\n")

Screenshot of the CODE:

OUTPUT::


Please provide the feedback!!

Thank You!!

Add a comment
Know the answer?
Add Answer to:
Write a Python program that does the following (You do not need to write functions): •...
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
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