Advertisement
Fidd1ez

Untitled

Jan 22nd, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. print("Solve the Two Trains Problem.")
  2. first_train_speed = int(input("Enter First Speed:\n"))
  3. first_place = input("Enter First Place:\n")
  4. second_train_speed = int(input("Enter Second Speed:\n"))
  5. second_place = input("Enter Second Place:\n")
  6. total_distance = int(input("Enter total distance:\n"))
  7. distance_from_place_one = time*first_train_speed
  8. distance_from_place_second = time*second_train_speed
  9. print(time,distance_from_place_one,distance_from_place_second)
  10. print("Word Problem")
  11. print("Train A, traveling",str(first_train_speed), "miles per hour, leaves", str(first_place), "heading toward" ,str(second_place),"," , str(total_distance),"miles away. At the same time Train B, traveling",str(second_train_speed) , "mph, leaves", str(second_place), "heading toward" , str(first_place), ". When do the two trains meet? How far are they from each city?")
  12. print("They meet after", str(time),"hours.")
  13. print("Train A is",str(distance_from_place_one),"miles from",str(first_place))
  14. print("Train B is", str(distance_from_place_second),"miles from", str(second_place))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement