I trying to use a try statement in Python to check in 4 variables are numbers, if a variable contains something other than a number I have got it to ask the user to input try again, but then I want to have it call a function with those 4 variables (which could include a variable which the user has a entered a number for). The issue I am having is that I can't get the output of the for statement to order itself in a 1, 2, 3, 4 pattern. Any help would be greatly appreciated.
def checkNumbersCompound(p, r, n, t):
valuesDictionary = [p, r, n, t]
for v in valuesDictionary:
try:
v = int(v)
except:
v = input(v + " is not a number, please enter a number to replace " + v + " (Don't include any symbols): ")
print (v)
checkNumbersCompound(v[1], v[2], v[3], v[4])
Thanks