+ 1
What will be the output ?
word ='gdhddhdh' for x in range(0,,len(word): print x*2
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
0
#ask_the_interpreter
0
what



