+ 1

What will be the output ?

word ='gdhddhdh' for x in range(0,,len(word): print x*2

15th Jun 2018, 11:29 AM
Jatin Kumar
Jatin Kumar - avatar
3 Answers
0
It will throw a syntax error. There is one comma too much, you forgrt to close the parentheses for range an if you are using python3 you also need parentheses for the print statement. word ='gdhddhdh' for x in range(0,len(word)): print(x*2) This will just print: 0 2 4 6 8 10 12 14 Since the length of the string stored in word is 8. Meaning your x goes from 0 to 7. each time multiplied by 2, hence the output
15th Jun 2018, 11:37 AM
Matthias
Matthias - avatar
0
#ask_the_interpreter
15th Jun 2018, 11:39 AM
Qwertiony
Qwertiony - avatar
0
what
15th Jun 2018, 11:39 AM
Jatin Kumar
Jatin Kumar - avatar