User Input for a List | Python Programming language Tutorial
HTML-код
- Опубликовано: 29 окт 2020
- In this tutorial, you will learn to take user input for list in Python Programming language.
Here we are using the append method / function to the values to the list. In the end we will also display the contents of the list.
our Social Media Pages
/ exampleprogram
/ exampleprogram
/ example_program
Our Website
www.ExampleProgram.com
#ExampleProgram
Damn, this was exactly what I needed. Thanks! You saved me from quite a sob-fest this afternoon. 😁
glad this video helped you :)
Great video just what I was looking for. Nothing better than finnaly finding exactly what you needed lol.
Great to hear :)
Is the "casefold" method to avoid errors caused by "wrong" input from the user?
Thank you sooo muchhh for the tutorial!
You're so welcome!
Awesome. Thank you.
You're welcome!
what if i want to add more details such as location
really really nice ....thank you
Most welcome 😊
How to give heterogeneous values as user input for list
I want to restrict the user to enter only numbers between 1-100..
I created a loop for it everything is good.. but i am not able to restrict it.. can you please help me? I am new learner!
Excellent, thank you!
You are welcome!
this was awesome, thank you good sir.
Very welcome
Thank you, very helpfull 😀
You're welcome!
Thx, btw if it doesn't work replace casefold with lower
How to show terminal on Python notebook please?
valeu, de verdade
Very nice tutorial! But when I tested it, It asked me the 2 questions then it kept REPEATING and it didn't show me the list😅 I think its because in python replit while means loop, can you help?
Much helpful my guy
glad my video helped you :)
Thanks for the video
Our pleasure!
Thank you very much
You are welcome
THANK YOU so much
You're welcome!
thanks for the video, what if I want to ask the user to type a name to remove it?
user = input("would you like to remove a mistake? ")
if user.lower() == 'yes' :
state = input("What state would you like to remove? ")
if state in stateList:
stateList.remove(state)
print("removed", state)
else:
print("Sorry, that item is not in the list.")
Thank you sir.
Most welcome
Good Explanation
thanks
What if intead of name, i want to add numbers?
convert your user input to int or float and then add to the list
@@ExampleProgram yes do that. 👍
good work
Thank you
@@ExampleProgram can you do a video like this for nested list
thanks bro :D
No problem
@@ExampleProgram 🥰
how to try it with a for loop
print('How many values do you want to enter? ')
num = int(input())
a = []
for i in range(1,num+1):
print('Enter value ',i)
b = input()
a.append(b)
print(a)
numbers=[]
e=1
while e!=0:
numbers.append(int(input("enter the numbers=")))
e=int(input("enter 0 to stop="))
def chintu(p):
return p%2==0
even=list(filter(chintu,numbers))
for element in even:
print(even)
above code is to filter the even numbers inthe list
y does it say it has no name type?
Bhai Hindi ko bhi Zara vapro
Hi I am trying to solve a question
Example input data:
4 0 5 0 3 0 0 5
Example result:
4 5 3 5 0 0 0 0
I ask a number for input from user and make all non zero numbers on the left (in order) and all zeros right. Could you help me?