Skip to content

Instantly share code, notes, and snippets.

@jasonsperske
Created February 21, 2017 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonsperske/9d1928ffcfd942dc755c2b56d7d7d5c2 to your computer and use it in GitHub Desktop.
Save jasonsperske/9d1928ffcfd942dc755c2b56d7d7d5c2 to your computer and use it in GitHub Desktop.
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