+ 1

Find the errors (There are 2 errors).Assuming words is a valid list of words, the program below tries to print the list in rever

for i in range(len(words),0,-1): print(words[i], end=' ')

23rd Dec 2020, 6:57 AM
Kashish Juneja
Kashish Juneja - avatar
3 Answers
+ 2
List have len(list) - 1 elements So starting value for range should be len(words)-1 And range don't include last parameter So second value should be (-1) so to get numbers till 0(index of first element in list) So right code: for i in range(len(words)-1,-1,-1): print(words[i], end=' ') Hope It Helps You 😊
23rd Dec 2020, 8:05 AM
Hacker Badshah
Hacker Badshah - avatar
0
Show your attempt please.
23rd Dec 2020, 7:06 AM
Dino Wun (Use the search bar plz!)
Dino Wun (Use the search bar plz!) - avatar