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.
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
Comments
Leave a comment