Last active
June 17, 2023 04:45
-
-
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 .]
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
| ``` | |
| 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) |
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
| ``` | |
| 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