Basically, I'm asking for an input, which is going to be split(',')
however, if the person doesn't input it properly, for example they accidentally input just 5,
or don't include a comma at all, it comes up with an error that something is undefined.
Does anyone have any idea of how to check that the input is in the right sort of format?
Edit: Here's the code in question...it's to do with coordinates
def EnterCoords():
coordinates = input("Enter coordinates in the following format x,y").split(',')
x, y = Coordinates[0], Coordinates[1]
I then use the x and y values in a calculation elsewhere, which brings up the error IndexError: list index out of range
So, if the user enters them wrong, is there a way of calling the function again, for them to try again