How to get multiple integer values in a single line code in python like array in c | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to get multiple integer values in a single line code in python like array in c

Example: int a[3]={1,2,3};// in c How to code in python for the above.

7th Jul 2019, 4:33 PM
Sujithra
3 Answers
+ 4
With lists. a = [1, 2, 3]
7th Jul 2019, 4:33 PM
Airree
Airree - avatar
+ 3
In python, lists are very similar to arrays. The biggest difference might be, that you don't have to predefine its size. You access it the same way you do in c: print(a[1])
7th Jul 2019, 4:38 PM
Airree
Airree - avatar
0
Hello
13th Jul 2019, 12:28 AM
Jherzon Gt Romero
Jherzon Gt Romero - avatar