Python Assignment

python

#1

I have a class assignment requiring me to create a program that says if you are 25 or younger then you are an teenager. If you are 65+ you are a senior. If you are between 25-65, then you are an adult.


#2

Pseudocode for the task:

If age is less than or equal to 25:
  Handle teenager
else if age is greater than or equal to 65:
  Handle senior
else:
  Handle adult

When we translate this to Python…

if(age<=25):
  print("You are a teenager!")
elif(age>=65):
  print("You are a senior!")
else:
 print("You are an adult!")

Take a look at this page on conditional statements.


#3

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