In C++ code, I can give 1 2 3 4 5 6 7 8
then press enter in console to have output like,
1 2
3 4
5 6
7 8
But in Python code when I tried to generate the same output by the inputting in the console like 1 2 3 4 5 6 7 8
and enter but it generated an error...
Rather I can give input and have output in console like this in Python:
1 2
1 2
3 4
3 4
5 6
5 6
7 8
7 8
I can see my code is not enough in Python...
I tried putting input().split()
in a loop.
/* C++ */
int x,y;
for (int i=0; i<4; i++){
cin>>x>>y;
cout<<x<<y<<endl;
}
# Python
for i in range(4):
x, y = input().split()
print(x, y)
I expected Python could take those inputs just in only one line and generate the output in the console like in C++.