a=str(input('Write integers, separatrd by a comma: ')) #ask user to write integers
b=a.split(',') # change the string to list of numbers
c=[0]*len(b) # list contans nulls
d=['first', 'second', 'third', 'fourth', 'fifth', 'first'] #list contains names of sities
for i in range(len(b)):
c[i]=int(b[i]) # change nulls to distances between the sities
print('distance between the ' + d[i] + ' and the ' + d[i+1] + ' sities: ', c[i]) # output
Comments
Leave a comment