Created
February 21, 2017 22:10
-
-
Save jasonsperske/9d1928ffcfd942dc755c2b56d7d7d5c2 to your computer and use it in GitHub Desktop.
A simple answer to a quoar question
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
int x; | |
int y; | |
while(cin >> x >> y) { | |
cout << "x:" << x << " y:" << y << "\n"; | |
} | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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