So I have this code where I'm trying to get the user to enter a number and the output will be "Line (whichever line it is), Hello World" and will repeat this however many times the number the user inputted is.
The code works fine, however, the code breaks whenever someone enters something that's not a number. How should I make it so when someone enters an invalid input, the code says "Please enter a number only" and makes them try again until they enter an integer?
print ('Enter an integer')
print ('')
for loops in range(int(input())):
print("Line ", loops+1)
print ('Hello World')