Please help with this beginner code:

I am new in programming, and I am trying to learn python. I need help with this: I need to group people from 18 to 64 years old. I have written this code:

current_age = int(input("Age: "))
if current_age >= 18 and < 65:
    print("Great, you are in :)")
else:
    print("Sorry, you are out :(")			

but i get this: SyntaxError: invalid syntax

As i said before, I am rather new in programming.

Thanks in advance.

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

Please use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks are not single quotes.

markdown_Forums

1 Like

I believe that this line is your problem. When you are using an and, each side of the and needs to be a separate logical test.

For example:

if color == "blue" and number > 5:
  print("Big Blue!")
2 Likes

Thank you very much Jeremy!!!

1 Like
current_age = int(input("Age: "))
if current_age >= 18 and current_age < 65:
print(“Great, you are in :)”)
else:
print(“Sorry, you are out :(”)

This should work.You have to put valid logical operations on both side of and

1 Like

You are right, thanks man!

Really I don’t no what is python also but I have so much interested to learn. please help me friend my mail id <email removed by moderator>. send me how i can learn.[quote=“mallquimarco, post:1, topic:404503, full:true”]
I am new in programming, and I am trying to learn python. I need help with this: I need to group people from 18 to 64 years old. I have written this code:

current_age = int(input("Age: "))
if current_age >= 18 and < 65:
    print("Great, you are in :)")
else:
    print("Sorry, you are out :(")			

but i get this: SyntaxError: invalid syntax

As i said before, I am rather new in programming.

Thanks in advance.
[/quote]

Hello and welcome to the freeCodeCamp community~!

As a general best practise, you should not share personal information such as an email address on a public platform. :slight_smile:

Additionally, if you need assistance it is best to create your own forum topic so users will see it, rather than asking your question on someone else’s. :slight_smile: