I want to know how to use a lists content as int | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I want to know how to use a lists content as int

How can I use a list's content as separate ints

11th Jun 2020, 9:49 PM
Divija
Divija - avatar
2 Answers
+ 1
Can you clarify your question more, lists can store any data type, if you want to somehow get all the values, then there is something called "unpacking" that should satisfy your desire our_list = [1, 2, 3, 4] print(*our_list)
11th Jun 2020, 10:05 PM
Ali Abdelhady
Ali Abdelhady - avatar
+ 2
list = [ 1, 2, 3 ]; arr = { 1, 2, 3 }; for num in list: print(str(num)); for num in arr: print(str(num));
11th Jun 2020, 10:00 PM
Sandra Meyer
Sandra Meyer - avatar