Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Hey does anyone know why this won't work it just says invalid syntax and when I look for it it says expected expression

Here’s my code:

to_do = True
If to_do == true
    Print ("done")
    else:
       Print ("to do\n","voice recognition\n","commands")

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

There are multiple reasons why this doesn’t work.

  1. You can’t put everything in one line. Each statement needs to be in a line, with proper indenting.
  2. print method should be lowercase.
  3. You need a : after an if statement
  4. if keyword should also be lowercase
  5. True boolean should always be upper-case

Here’s how it should look like:

to_do = True 
if to_do == True:
    print ("done")
else: 
    print ("to do\n","voice recognition\n","commands")
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading