ไม่สามารถเล่นวิดีโอนี้
ขออภัยในความไม่สะดวก
Input a List using Loops in Python
ความคิดเห็น • 23
ต่อไป
เล่นอัตโนมัติ
Input a List using split() Method in PythonNeso Academy
มุมมอง 34K
While loops in Python are easy ♾️Bro Code
มุมมอง 340K
Changing List Items in PythonNeso Academy
มุมมอง 14K
บุกบ้านเซเลปชื่อดัง ปิดซอยเลี้ยงทำบุญบ้าน | BeamOil Family | EP. 238Beam-Oil Channel
มุมมอง 235K
ถือของห้ามปล่อย 10 นาที ได้ 500 บาท #aum_ccp #shortsAUM_CCP
มุมมอง 155K
Try the #NewWomanChallenge now! Brought to you by YouTube Shorts #LISAxNewWomanLLOUD Official
มุมมอง 13M
Python: While Loops (Reading User Input Indefinitely?!!)Afternerd
มุมมอง 12K
Python Tutorial for Beginners 7: Loops and Iterations - For/While LoopsCorey Schafer
มุมมอง 881K
Solve any Star Pattern program in PythonSimply Coding
มุมมอง 917K
Introduction to For Loops in Python (Python Tutorial #5)CS Dojo
มุมมอง 1.6M
input() Method in PythonNeso Academy
มุมมอง 20K
For loops in Python are easy 🔁Bro Code
มุมมอง 284K
10 Python Comprehensions You SHOULD Be UsingTech With Tim
มุมมอง 139K
While Loops in Python | Python for BeginnersAlex The Analyst
มุมมอง 52K
[LIVE] : ONE ลุมพินี 75 | คู่เอก "คมเพชร vs โอมาร์"Ch7HD
มุมมอง 572K
女孩妒忌小丑女? #小丑#shorts好人小丑
มุมมอง 27M
พระบิดา ส่ง “ธิดาลุยไฟ” ว่าที่นายกฯ ใหม่ “แพทองธาร” ต้องเผชิญ “วิบาก” อะไร ? #ถกไม่เถียงterodigital
มุมมอง 646K
แพทองธาร แถลงครั้งแรก หลังรับตำแหน่งนายกฯ | THE STANDARD (LIVE)THE STANDARD
มุมมอง 817K
"อุ๊งอิ๊ง" ถึงเวลาแตกหัก "ลุงป้อม-อาเหลิม"! | DAILYNEWSTODAY 17/08/67Dailynews Online
มุมมอง 366K
Great video sir.
@Neso academy Great video , it helps me a lot as usual but what about if we want a list which is a collection of different types of items ? because with the example in the course all the items of our list must be an integer
Sir, instead of using for loop to input a list we can use split function...
numbers = input().split()
It was really helpful
Thank you
This can also be achieved using below code for storing items as string not int.
items = input("Enter multiple items: ")
list = items.split()
print(list)
Tems??
No its still a string..
Python3IDE(Python 3.7) running!
enter the 3 digit number234
['234']
Pytho3IDE run end!
You are a life saver. Thanks ❤
Thank you for your class sir
Clear explanation.
n=int(input("enter the number of elements of your list: ")) #input data from the user and convert it to integer type
numbers=[] #create an empty list
for i in range(n): #iterate my list from index 0 to n-1 and repeat the block of instructions below for each i
x = int(input(f"enter the elements for numbers {[i]}: ")) #store the elements of the list from user in x variable
numbers.append(x) #add each element at the end of the list numbers
print(numbers) #output the new list
I don't get where the i came from in for loop
@@user-ev5fj1rm3ywe just take a variable i to loop thru.. in this case for loop
sir i have a doubt
can't we directly use eval function for entering the list
sir i had tried it and also work so why to use loop method
what about this code ?
numbers = [ ]
for i in range(3):
x = input('Enter the element: ')
numbers.append(x)
print(numbers)
The input function always returns a value as a string. If we are to obtain numbers then we'll have to convert the type of the obtained item to integer (int) or float.
we can also do,
numbers = [ ]
for i in range (3):
x = input()
y = int(x)
numbers.append(y)
The method in the video is for getting numbers as input and type is being converted in the same line in which input is being taken.
Thanks for the vid. Just a suggestion… what if you need to input hundreds of numbers? The user is not going to want take a count of each number and possibly miscount.
Might be better just to input numbers and type END when finished.
I guess using while loop would be better then
NICE!!
Please use an ide... Command prompt sucks
We started using VS Code after covering the basics.
❤❤❤🎉