student edu
student edu

Reputation: 21

python syntax error invalid syntax

I'm new to Python programing language. I purchased a book and I've been reading it. The book is called (3x) Python Programming for the absolute beginner Third Edition. I'm trying to put what I've so far learned into action. I have a problem that I don't understand I know it's simple but I'm not sure how to solve it so if somebody can tell me what my the problem is and how to correct it. I appreciate it in advance! :) To add more I also tried doing it with python 2x and I had the same message error syntax, Invalid syntax.

Python exercise

Upvotes: 2

Views: 7022

Answers (1)

unutbu
unutbu

Reputation: 879291

Whitespace is used to denote level of indention in Python.

The else: needs to be aligned (have the same indentation level) as the if jim_age ....

if jim_age > sam_age:
    print("jim is older")
else:
    print("sam is older")

Upvotes: 2

Related Questions