Python Forum

Full Version: Getting syntax error, no clue why
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I dont know if I am just dumb and not seeing what is going on but I am so confused.....

the issue I am having is
 birthday = input("Have you had your birthday this year? ")
and getting a syntax error pointing at the variable name. What is going on? the two lines previous look exactly the same and are not having any issues.
Often with the SyntaxError the error is indeed on the line before where it is indicated.
Post the full code or at least couple of lines before and after that one
its not a very long script, and it is fairly simple so i will just post all of it.
import time
from datetime import date

name = input("What is your name? ")
age = int(input("How old are you? ")
birthday = input("Have you had a birthday this year? ")

if birthday == "yes" and age != "":
    oldAge = (date.today().year - age) + 100
elif birthday == "no" and age != "":
    oldAge = (date.today().year - (age + 1)) + 100
else:
    print("Your age must be a number!")

output = f"Your name is {name}, and you will be 100 years old in {oldAge}!"
print(output)

repeat = input("Pick a number between 1 and 100: ")
count = 0

if int(repeat) > 0:
    for num in range(int(repeat)):
        print(output + "\n")
yep, there is missing closing bracket on line 5
Oh my gosh, thank you.... simple mistakes amiright. lol. This makes me sad as I have been coding in python everyday for over a month and this is probably the simplest thing I have done in a few weeks and it was just driving me nuts. Thank you.