Skip to content

Instantly share code, notes, and snippets.

@Tarrasch
Last active March 21, 2017 01:11
Show Gist options
  • Save Tarrasch/38fe96b02f87a2cfe45f30f7f7306e5e to your computer and use it in GitHub Desktop.
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
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