Skip to content

Instantly share code, notes, and snippets.

@chrissunny94
Last active June 17, 2023 04:45
Show Gist options
  • Select an option

  • Save chrissunny94/350ecfd7a9a7c363d2c74c7acb62ac88 to your computer and use it in GitHub Desktop.

Select an option

Save chrissunny94/350ecfd7a9a7c363d2c74c7acb62ac88 to your computer and use it in GitHub Desktop.
Template for Inputing elements for Hacker rank questions [Please dont hessitate to add a comment , if you find issues .]
```
Input Format
A list of elements. An element of list to be counted.
Sample Input 0
[1,2,2,3,4,5,5,4,3,3,4,3,3,5]
```
# creating an empty list
inp_lst = ""
# number of elements as input
inp_lst = (input())
# iterating till the range
print(inp_lst)
# Converting string to list
res = inp_lst.strip('][').split(', ')
for element in res:
print(element)
```
Input Format
The first line contains an integer , i.e., number of test cases.
Next lines will contain an integer .
Sample Input
2
3
6
```
number_of_test_cases = input()
for i in range(int(number_of_test_cases)):
INPUT_VALUE = int(input())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment