Hey i cant understand a multiple choice qs It's like this x= "abcd" for i in range(len(x)): print(i) Question: what | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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

14th Apr 2020, 6:15 AM
Sukanya Bag
Sukanya Bag - avatar
4 Respostas
+ 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.
14th Apr 2020, 6:30 AM
Prabhat Ranjan
Prabhat Ranjan - avatar
+ 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.)
23rd Apr 2020, 9:46 AM
Sukanya Bag
Sukanya Bag - avatar
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
14th Apr 2020, 6:20 AM
sarada lakshmi
sarada lakshmi - avatar
0
Just use str[::-1]
27th Apr 2020, 5:52 AM
sarada lakshmi
sarada lakshmi - avatar