I need to enter n
multiple integer numbers on the same line in Python without using a list or any other container (set, dict, etc.) (please don't ask me why, let's say I have to, and that's the point of that question).
I know that in C++ you can write something like this:
int how_many_numbers, number;
cin >> how_many_numbers;
for (int i = 0; i < how_many_numbers; i++) {
cin >> number;
// do something with it
}
The coolest thing about cin
here is that it doesn't give a thing about how you input the numbers: you can input one number and hit the enter button, then you can input 3 numbers on the same line and hit the enter again, than another 2 or 4 and so on until you input all the numbers that you have to.
My question is: Is there anything like cin
in Python which will allow me to enter n
multiple integer numbers on the same line without using a list or any other container?
I appreciate any help.