Last active
April 25, 2017 21:18
-
-
Save sytrus-in-github/43c7d91230a591f306a5784d67e1746b to your computer and use it in GitHub Desktop.
template to get input from HackerRank problems for Python
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
# get number of tests and iterate through each tests | |
## Python 3 | |
t = int(input().strip()) | |
for _ in range(t): | |
## Python 2 | |
t = int(input().strip()) | |
for _ in range(t): | |
# get 1 integer | |
n = int(input().strip()) | |
# get 2 integers in a line | |
n,k = [int(s) for s in input().strip().split()] | |
# get a list of integers from a line | |
arr = [int(s) for s in input().strip().split()] | |
# get a string(= a list of "char"s) from a line | |
s = input().strip() | |
# get a list of string from a line | |
arr = [s for s in input().strip().split()] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment