New course! Every coder should learn Generative AI!
Try a free lesson+ 5
For i in range(1,5):
Input("enter number {0}". format(i))
+ 5
I would also recommend to convert the numbers from input to int or float. I have taken the 2 mentioned for loops and did it with a comprehension:
inp = []
[inp.append(int(input(f'Enter {x + 1}. number: '))) for x in range(4)]
print(inp)
+ 5
OK - here is a more simple code. It takes the 4 inputs and stores them in a list:
inp = []
for x in range(4):
inp.append(int(input(f'Enter {x + 1}. number: ')))
print(inp)
+ 4
[Input() for i in range(4)]
+ 1
for i in range(4):
a=input("enter number"+str (i+1))