List input in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

List input in python

i want to take input of a list from user in a simplest way.i dont want to mention the size of the list to the user.User can insert as many elements as user wants.plzz help!!

25th Oct 2017, 5:15 PM
sarthak tyagi
sarthak tyagi - avatar
3 Answers
- 1
def lst(*elements): print(list(elements)) lst(input().split(",")) ### copy amd paste the code in playground..and see ## input like this.. ### 5,6,7,89,asdf,****
25th Oct 2017, 5:50 PM
sayan chandra
sayan chandra - avatar
0
but i want to take input of the list elements from user
25th Oct 2017, 5:36 PM
sarthak tyagi
sarthak tyagi - avatar
- 1
def lst(*elements): print(list(elements)) lst(9,9,9) lst(3,5,67,89,100) lst("yoyo",567,"***") ### copy amd paste the code in playground..and see
25th Oct 2017, 5:30 PM
sayan chandra
sayan chandra - avatar