jeudi 25 octobre 2018

how can I fix this syntax error in python

I'm just learning to code using Python. I am trying to write out an "if else" statement. My question, how to get my else: to the correct indentation after typing print . . . Example:

home = "America" 
if home==("America"): 
     print ("Hello, America!")  
     else: 
     print ("Hello, World!")

Now, the else is directly under print: which gives a syntax error, how do I fix this?

TIA, Mark

Aucun commentaire:

Enregistrer un commentaire