Cant get the code to work

Question:
So i am following allong the Python beginner Full Course on freeCodeCamp, and it came to the part where he showed 2 ways to check if an age is > than 18, it return value are true and false.
I wanted to use the input-Function to type in the age through the console, sadly it always gave me an error at the print part and sadly i seem to not be able to find the issue.
It´s like 13 lines of code.
i first tried to it with age = input(), to use age as the variable for the two check functions is_adult() and is_adult2(), that didin´t work so i made a function alter_eing(), for it that returns the variable age.
I am a total noob at it D:
Repl link:
https://replit.com/@CA4334/SubduedAjarRobodoc#main.py

print(is_adult(alter_eing()), is_adult(alter_eing())

Hi there @CA4334! There’s 2 things going wrong here:

  1. You’re missing a closing bracket on that last line
  2. You need to convert the inputted text into an int so that you can compare it with other numbers. To do this simply use the int() function, i.e. int(input())
1 Like

Also, a little code tip, you can actually just return age > 19 from your function, rather than having if statements as age > 19 will evaluate to a boolean. :slightly_smiling_face:

e.g.

def is_adult(age):
  return age > 19

Thank you very much :smiley:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.