+ 3
Hey i cant understand a multiple choice qs It's like this x= "abcd" for i in range(len(x)): print(i) Question: what
Choose the correct option
4 Réponses
+ 2
Output:
0
1
2
3
Explanation:
len(x)=4
i in range(len(x)) means loop will run from i=0 to i=4 "excluding 4".
Every value of i will be printed on screen by using print(i) statement by changing line everytime.
+ 1
Ask the user for a string and print out whether this string is a palindrome or not. (A palindrome is a string that reads the same forwards and backwards.)
0
Ans is...
0
1
2
3
Explanation : upto the length of given string printing the index... If you write like print(x[i]) then the output be like...
a
b
c
d
0
Just use str[::-1]