We often encounter a situation when we need to take number/string as input from user. In this article, we will see how to get as input a list from the user.
Input : n = 4, ele = 1 2 3 4 Output : [1, 2, 3, 4] Input : n = 6, ele = 3 4 1 7 9 6 Output : [3, 4, 1, 7, 9, 6]
Code #1: Basic example
Code #2: With handling exception
Code #3: Using
Code #4: List of lists as input
- How to input multiple values from user in one line in Python?
- Python | Find all close matches of input string from a list
- User-defined Exceptions in Python with Examples
- Taking multiple inputs from user in Python
- Fetch top 10 starred repositories of user on GitHub | Python
- Python | User groups with Custom permissions in Django
- Taking input in Python
- Taking input from console in Python
- Vulnerability in input() function – Python 2.x
- Python Input Methods for Competitive Programming
- Python | Convert list of string to list of list
- Generate two output strings depending upon occurrence of character in input string in Python
- Python program to create a list of tuples from given list having number and its cube in each tuple
- Python List Comprehension | Segregate 0's and 1's in an array list
- Python | Remove all values from a list present in other list
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.