7. Predict the output of the following program:
def myfun(str1):
retr1=""
index = len(str1)
while (index > 0);
if str[index - 1) isalpha():
rstr1 + = str1[index - 1)
index = index -1
return rstr 1
I
print(myfun("1234abcd"))
Answers
Answered by
0
Answer:
I have no idea about this
Answered by
2
Answer:
1234abcd
1234abc
1234ab
1234a
1234
123
12
1
Explanation:
Basically it will print this as output! But atleast use print statement inside the If Loop to see this output!!!1234abcd
1234abc
1234ab
1234a
1234
123
12
1
when len(str1 = 1 ) while loop will get skipped! And the program ends
Similar questions