Solution Exercise 5

Write a program that asks how old the user is and then tells the user if she is a teen or not.

def main():
    age = input("How old are you? ")
    #Convert age to integer
    age = int(age)
    if age > 12 and age < 20:
        print("You are a teen")
    else:
        print("You are not a teen")


if __name__ == '__main__':
    main()

You can change the if-statment to look like in the program below. It will do the same thing:

def main():
    age = input("How old are you? ")
    #Convert age to integer
    age = int(age)
    if 12 < age < 20:
        print("You are a teen")
    else:
        print("You are not a teen")


if __name__ == '__main__':
    main()