Create a gist now

Instantly share code, notes, and snippets.

A simple answer to a quoar question
#include <iostream>
using namespace std;
int main() {
int x;
int y;
while(cin >> x >> y) {
cout << "x:" << x << " y:" << y << "\n";
}
return 0;
}
import sys
x = None
y = None
while True:
line = sys.stdin.readline()
for i in line.split(' '):
if x is None:
try:
x = int(i)
except ValueError:
sys.exit(0);
elif y is None:
try:
y = int(i)
except ValueError:
sys.exit(0);
else:
break
if x is not None and y is not None:
print("x:{} y:{}".format(x, y))
x = None
y = None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment