+ 2

What can do if I want to print the no.0 element of every equal named list ?

https://code.sololearn.com/cLCQvqe8IR3D/?ref=app

14th Aug 2020, 8:04 AM
Shubham Ingale
Shubham Ingale - avatar
3 odpowiedzi
+ 1
You can't have 2 variables with the same name.
14th Aug 2020, 8:13 AM
Seb TheS
Seb TheS - avatar
+ 1
But maybe you can use list: l = [] and append: l.append(["p", "r"]) l.append(["i", "o"]) print(l) #Output: [['p', 'r'], ['i', 'o']]
14th Aug 2020, 8:15 AM
Seb TheS
Seb TheS - avatar
+ 1
l = ["p","r"] l += ["i","o"] print(l)
14th Aug 2020, 10:02 AM
Sousou
Sousou - avatar