 Boolean Logic | Sololearn: Learn to code for FREE!

0

# Boolean Logic

Boolean Logic Given the age of a person as input, you need to output their age group. Here are the age groups you need to handle: Child: 0 to 11 Teen: 12 to 17 Adult: 18 to 64 Senior: 65+ Sample Input 42 Sample Output Adult i dont understand , pls help

+1

age = int(input()) # your code goes here if age >= 0 and age <= 11: print("Child") elif age >= 12 and age <= 17: print:("Teen") elif age >= 18 and age <= 65: print("Adult") elif age >=64: print("Senior") else: print("Invalid age") This should work, but it doesn't.

+1

a = int(input()) # your code goes here if a in range(0,11): print ('Child') elif a in range(12,17): print ('Teen') elif a in range(18,64): print ('Adult') else: print('Senior')

0

Write a code that takes input, if it is less than 12 print ‘child’ if between 12 and 17, print ‘teen’ ect. What dont you understand?

0

Well, the root cause of your misunderstanding is your lack of knowledge of two fundamental things: conditional statements, and magnitude comparison operators. Conditional statements are simply different paths your program can take, and which one it does take depends only on the result of a boolean operation, namely the result from the <, >, <=, >=, ==, and != operators. I suggest you study up on each of these topics in detail (for your language, as you do not have one listed), because this isn't an education board, this is a discussion board. You can use the courses on this site to do just that.

0

Check this out..... print("What Your Name:") name = input() print('Enter your Age:') age = int(input()) if age <= 0 or age < 11: print(" You Still A Child",name) elif age <= 12 or age < 17: print("Your Still A Teenager",name) elif age <= 18 or age < 65: print("You Are An Adult",name) elif age <= 64 or age < 150: print("You Are Senior Human",name)

0

a = int(input()) # your code goes here if a in range(0,11): print ('Child') elif a in range(12,17): print ('Teen') elif a in range(18,64): print ('Adult') else: print('Senior') done..!