0
words = ["hello", "world", "spam", "egg"]
How to print first 3 words
6 odpowiedzi
+ 7
And if you just want the words,
print(*words[:3])
+ 5
Er, Serval Toukap Nono, did you notice Shadoff posted the same answer an hour previously? 😄
+ 2
print(words[:3])
+ 1
Hello,
You can use while loop and len function to print element for array
x=0
while(x<=(len(words)-2)):
print(words[x])
x +=1
Refer following code:
https://code.sololearn.com/cZ7Uyy16rRkY/#py
+ 1
David Ashton oups
Sorry 😅
0
a = [1,2,3,4]
[print(i) for i in a[:3]]
out:
1
2
3