Last active
March 21, 2017 01:11
-
-
Save Tarrasch/38fe96b02f87a2cfe45f30f7f7306e5e to your computer and use it in GitHub Desktop.
Python program that read stdin and put it in array line by line
This file contains hidden or 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 | |
def main(): | |
stdin_lines = [] | |
for line in sys.stdin: | |
if line.strip() != "": | |
stdin_lines.append(line.strip()) | |
# ... My code here ... | |
if __name__ == '__main__': | |
main() | |
# Note, HackerRank on the other hand uses the style below: | |
n = int(input()) | |
for i in range(n): | |
a, b = input().strip().split(' ') | |
print (int(a) + int(b)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment