how can I change a variable name each time in a python for loop

I have created a python program that works fine. but I want to make it more neat, I ask the user for numbers, number1, number2 etc. up to 5. I want to just do this with a for loop though, like this

for i in range(0,5):
    number(i) = int(input("what is the number"))

I realise that this code docent actually work but that is kind of what I want to do, if you can help with this It would be greatly appreciated



Read more here: https://stackoverflow.com/questions/64956344/how-can-i-change-a-variable-name-each-time-in-a-python-for-loop

Content Attribution

This content was originally published by N G at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: