Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Solve the Two Trains Problem.")
- first_train_speed = int(input("Enter First Speed:\n"))
- first_place = input("Enter First Place:\n")
- second_train_speed = int(input("Enter Second Speed:\n"))
- second_place = input("Enter Second Place:\n")
- total_distance = int(input("Enter total distance:\n"))
- distance_from_place_one = time*first_train_speed
- distance_from_place_second = time*second_train_speed
- print(time,distance_from_place_one,distance_from_place_second)
- print("Word Problem")
- 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?")
- print("They meet after", str(time),"hours.")
- print("Train A is",str(distance_from_place_one),"miles from",str(first_place))
- print("Train B is", str(distance_from_place_second),"miles from", str(second_place))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement