Answer to Question #250850 in Python for Meg

Question #250850

Write a Python program which collects and prints the stations of InterCity trains. 

The output should display the departure time and then name of the train separated by a semi colon. Eg: "8.29; Zuglo". It should be displayed one after the other.

1
Expert's answer
2021-10-13T20:38:35-0400

Source code

n=int(input("Enter number of trains: "))


train_names=[]
departure_time=[]


for i in range(n):
    print("Enter the name of train ",i+1," : ")
    train_name=input()
    train_names.append(train_name)
    print("Enter the departure time of train ",i+1," : ")
    dept_time=input()
    departure_time.append(dept_time)


for i in range(n):
    print(departure_time[i],";",train_names[i])


Output


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS