+ 1
Can anyone explain!
Words=["hello","world","what's","up"] for word in words: Print(word[-1:5])
3 Risposte
+ 2
You are printing the part of each word that goes from the last letter (-1) to the 5th letter, but non-inclusive.
The last letter of "what's" is also the 5th letter, so since it's non-inclusive, nothing is printed for that one.
+ 1
Not satisfying
0
It may not satisfy you, but it's exactly what's going on in your code anyway.
What was your aim, what sort of output did you expect instead?
Maybe we can find another way to achieve it.