today I think I might have an easy question. I have some code that ask the user to select a number from 1 to 10 which refers to a list. If the user makes an incorrect input ie 55 I what the code to loop back and ask them to make another selection. so far I have the following code but im unsure how to make it loop. thanks in advance
print 'Choose a Base Weather Station'
print 'Enter the corresponding station number'
selection = int(raw_input('Enter a number from: 1 to 10'))
if selection == 1:
print 'You have selected Karratha Aero as your Base Station'
elif selection == 2:
print 'You have selected Dampier Salt as your Base Station'
elif selection == 3:
print 'You have selected Karratha Station as your Base Station'
elif selection == 4:
print 'You have selected Roebourne Aero as your Base Station'
elif selection == 5:
print 'You have selected Roebourne as your Base Station'
elif selection == 6:
print 'You have selected Cossack as your Base Station'
elif selection == 7:
print 'You have selected Warambie as your Base Station'
elif selection == 8:
print 'You have selected Pyramid Station as your Base Station'
elif selection == 9:
print 'You have selected Eramurra Pool as your Base Station'
elif selection == 10:
print 'You have selected Sherlock as your Base Station'
else:
print 'You have made an error. Please chose a number from 1 to 10'