[Tutor] unknown syntax error
robertvstepp at gmail.com
Thu Dec 15 11:34:00 EST 2016
On Sun, Dec 11, 2016 at 10:30 AM, oliver patterson <
oliverjamespatterson at hotmail.com> wrote:
> hey i dont know if this is the right place but i was just coding in idle
and kept getting this syntax error and i can not see m to fix it here is my
bit of code:
Yes, this is the right place. Welcome to Tutor
When you get some form of error, please copy and paste the full error
message in your email. It is also usually helpful to state your version of
Python and operating system you are using.
> age=input("How old are you?:")
> print("type start()")
> def start():
> if age == my_age:
> if age < 14:
> print(" i'm older that you i'm",my_age,":)")
> print("your older than me i'm",my_age,":(")
When you use an if ... elif ... else construct, all of these need to be at
the same level of indentation and line up with each other. That is:
if condition 1:
insert condition 1 lines of code here
elif condition 2:
condition 2 code here ...
code for else ...
In your given code, your "else" keyword should line up with the "if"
keyword above it. Do you know about "elif"? You might want to look that
up. It would prove helpful in your example.
I'm curious as to how you will call your start() function. Judging from
the "print("type start()")" line, I am wondering if you might have a
misconception. But go ahead and plow forward and see what happens. That
is how we learn.
More information about the Tutor