words = ["Hello", "world", "!"] print(words[0]) print(words[1]) print(words[2]) how todo? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

words = ["Hello", "world", "!"] print(words[0]) print(words[1]) print(words[2]) how todo?

13th Feb 2020, 5:01 PM
Satyam Mishra
Satyam Mishra - avatar
5 Answers
+ 7
I assume that you don't want to hardcode the output for each element in your list. So use a for loop to iterate over the list and print one element after the other. But therefore you need some basics from python. I recommend you to go through the python tutorial, where everything you need for this task is shown.
13th Feb 2020, 5:38 PM
Lothar
Lothar - avatar
+ 1
print(*words)
13th Feb 2020, 9:34 PM
Seb TheS
Seb TheS - avatar
0
do what ? please be clear on what you're asking.
13th Feb 2020, 5:03 PM
Taste
Taste - avatar
0
I want run this python program using a lists so, how can do this?
13th Feb 2020, 5:08 PM
Satyam Mishra
Satyam Mishra - avatar
0
in SL ? go to `{} code` tab. press + button. choose python from the list put your code there
13th Feb 2020, 5:10 PM
Taste
Taste - avatar