Work out distance (fill in the blanks)


/ Published in: Python
Save to your folder(s)

Students work out the code by filling in the blanks.

They must work out how far a vehicle has travelled based on speed and time.
Students will fill in the blanks


Copy this code and paste it in your HTML
  1. %%%%("this programme will work out how far someone has travelled in miles if you enter speed and time time travelled.")
  2.  
  3. speed = int(%%%%("please enter the speed the vehicle was driving at"))
  4.  
  5. time_hours = int(input("enter hours travelled"))
  6. time_mins = int(input("Enter minutes travelled"))/60
  7. time_sec = int(input("Enter seconds travelled"))/3600
  8.  
  9. totaltime = time_hours+time_mins+time_sec
  10.  
  11. distance = %%%%
  12. distance = round(distance,1)
  13.  
  14. print("distance travelled by the vehicle is %%%% miles)

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.