I have problem in the python code

I have problem in the python code
0
print("kaivan shah")


print ("HI!")

age = "12"

if age is (">12"):
    print("you cannot drink beer")

    if age is ("=12"):
        print("you cann drink beer")

        if age is ("<=20"):
            print("extra beer!")

        
            print("happy journey!")

it is not printing the values

In your code there might be type error
and there is no proper if condition have checked i guess

Are you sure if age is (">12"): is a valid comparison?

Should it not be if int(age) > 12: ?

And why is the variable “age” a string in the first place?

1 Like

Hi @shah-kaivan the solution is below:

# Make sure that you use an integer for the number 12 instead of a string
age = 12
# Your "if" expressions aren't written correctly
if age > 12:
  print("you can't drink beer")
if age == 12:
  print("You can drink beer!")
if age <= 20:
  print("You get an extra beer!")
1 Like

print ("HI!")

age = "12"

if age <  "12":
    print("you cannot drink beer")

if age == "12":
    print("you cann drink beer")

if age >= "20":
        print("extra beer!")

print("happy journey!")```