SyntaxError invalid syntax print worldlists len words

0 votes

Hi Guys,

I am trying to print the output of my python code. But it is showing me the below error.

File "<ipython-input-3-8f2363e8378d>", line 10
    print worldlists[len(words)]
                   ^
SyntaxError: invalid syntax

Can anyone help me with this?

Jun 30, 2020 in Python by akhtar
• 38,170 points
190 views

1 answer to this question.

0 votes

Hi@akhtar,

This syntax will not allow in all the platforms. If you are trying to print any string you need to use double-quotes. But here you are trying to print some variable value. So you need to use parenthesis as given below. 

print (worldlists[len(words)])

I hope this will help you.

answered Jun 30, 2020 by MD
• 95,060 points

Related Questions In Python

0 votes
1 answer

Python error "SyntaxError: invalid syntax"

but i m getting this ouput: Enter the ...READ MORE

answered Mar 20, 2020 in Python by anonymous
6,354 views
0 votes
2 answers

%matplotlib inline SyntaxError: invalid syntax

I found a good solution to solve ...READ MORE

answered May 2, 2020 in Python by Edu
12,366 views
0 votes
1 answer

'Syntax Error: invalid syntax' for no apparent reason

You're missing a close paren in this ...READ MORE

answered Aug 13, 2018 in Python by Priyaj
• 58,100 points
1,046 views
0 votes
1 answer

What exactly is invalid syntax error?

please solve this error   def TakeImages():     Id=(text.get())   ...READ MORE

answered Jul 20, 2020 in Python by Prince kumar
444 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,842 views
0 votes
0 answers
+4 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,810 points
1,419 views
0 votes
1 answer

SyntaxError: invalid syntax in inline function.

Hi@akhtar, You need to write your if-else code ...READ MORE

answered Oct 4, 2020 in Python by MD
• 95,060 points
147 views
0 votes
2 answers