Why don't we use double quotation in print statement while iterating a list using for loop? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why don't we use double quotation in print statement while iterating a list using for loop?

For ex: mylist = ["this", "that", "learner", "curious", 23] for item in mylist: print(item)

10th Jul 2020, 12:40 PM
Sarfira
Sarfira - avatar
5 Answers
+ 4
Because then output would be: item item item item item
10th Jul 2020, 1:09 PM
Seb TheS
Seb TheS - avatar
+ 3
Do you mean like why its not like this: print("item") ? Cause "item" is a string and item is a variable containing a value.
10th Jul 2020, 1:01 PM
Slick
Slick - avatar
+ 3
Learner🎯 Because we would print "item", which is a string, for each item in the list, which has 5 items.
10th Jul 2020, 1:15 PM
Seb TheS
Seb TheS - avatar
+ 1
Slick thank you always help me. God bless you bro
10th Jul 2020, 1:12 PM
Sarfira
Sarfira - avatar
0
Seb TheS why does this happen bro?
10th Jul 2020, 1:13 PM
Sarfira
Sarfira - avatar