0

str="HELLO" find the output if print(str[::4]) ?

Pls anyone answer this question with explanation?

20th Apr 2022, 2:47 PM
M.F. Muznath
M.F. Muznath - avatar
3 Answers
+ 4
It's about slicing. What can't you understand? Start, end values for slicing are not specified so defaults are 0, len(str) and 4 is step count. So starts from index 0 , value at index 0 and 0+4 value will be printed output is : HO Next 4+4 is out of range. Hope it clears...
20th Apr 2022, 3:05 PM
Jayakrishna šŸ‡®šŸ‡³
+ 2
Thank you so much JayakrishnašŸ‡®šŸ‡³ I was a bit confused regarding the answer now everything is clear ... Thank you for your great help buddy
20th Apr 2022, 3:12 PM
M.F. Muznath
M.F. Muznath - avatar
0
You're welcome...
20th Apr 2022, 3:19 PM
Jayakrishna šŸ‡®šŸ‡³