### Age Advanced TEST ##
months = age * 12
weeks = months * 4
days = age - 365
unit = input("Choose you Format age (Months, Days, Weeks}").strip().lower()
age = int((input("How old Are u? ")).strip()
if unit == "months" or m :
print(f"{months}")
elif unit == "weeks" or "w" :
print(f"{weeks}")
elif unit == "days" or "d" :
print(f"{days}")
That is because of mismatched parentheses on the line before. 4 opens and only 3 close
sry i didnt get it here's the whole code:
### Age Advanced TEST ##
months = age * 12
weeks = months * 4
days = age - 365
unit = input("Choose you Format age (Months, Days, Weeks}").strip().lower()
age = int((input("How old Are u? ")).strip()
if unit == "months" or "m":
print(f"{months}")
elif unit == "weeks" or "w":
print(f"{weeks}")
elif unit == "days" or "d":
print(f"{days}")
(Apr-28-2020, 05:39 PM)jefsummers Wrote: [ -> ]That is because of mismatched parentheses on the line before. 4 opens and only 3 close
I suggest you insert this in your code just above the if/elif statement:
print(unit == "months" or "m")
I don't think it is going to print True or False.
also on line 7:
age = int((input("How old Are u? ")).strip()
check the number of opening and closing brackets and fix it accordingly
I Solved it thanks a lot
### Age Advanced TEST ##
unit = input("Choose you Format age (Months, Days, Weeks}").strip().lower()
age = input("How old Are u? ")
months = age * 12
weeks = months * 4
days = age * 365
if unit == "months" or "m":
print(f"{months}")
elif unit == "weeks" or "w":
print(f"{weeks}")
elif unit == "days" or "d":
print(f"{days}")
You didn't fix the or statement, the first if will always be True.
You didn't fix the multiplication of a string.