Python syntax error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Python syntax error

How can I fix it without syntax error ??? https://code.sololearn.com/cFB689ThM9xK/?ref=app

14th Jul 2019, 6:04 AM
Razan
Razan - avatar
3 Answers
+ 1
There was a syntax error because the program already knew the data type of the variable so it was confused by the str. You also didn’t need the brackets around pi_string when you were declaring it. pi_string wasn’t actually a string because 3.1415926 wasn’t inbetween quotation marks (you made it an integer) to make it an actually string you would do this- pi_string="3.1415926"
31st Jul 2019, 9:03 AM
Elle
+ 4
pi_string = str(3.1415926)
14th Jul 2019, 6:11 AM
Mert Yazıcı
Mert Yazıcı - avatar
0
pi_string="3.1415926"
28th Jul 2019, 6:42 PM
Tema
Tema - avatar