# Pavan Kumpatla
# December 10, 2021.
# I learned about boolean operators and how to use them.
# No difficulties.

# not operator
print("not True = ", not True)
# prints not True (False)
print("not False = ", not False)
# prints Not False (True)

# and operator
print("False and False = ", False and False)
# False and False = False
print("False and True = ", False and True)
# False and True = False
print("True and False = ", True and False)
# True and False = False
print("True and True = ", True and True)
# True and True = True

# or operator
print("False or False = ", False or False)
# False or False = False
print("False or True = ", False or True)
# False or True = True
print("True or False = ", True or False)
# True or False = True
print("True or True = ", True or True)
# True or True = True

print("True and not False =", True and not False)
# prints, 1) Not False = True, 2) True 3) "= True"
print("False or not True = ", False or not True)
# prints, 1) Not True = False, 2) False, 3) "= False"

# [ ] Use relational and/or arithmetic operators with the variables x and y to write:
# 3 expressions that evaluate to True (i.e. x >= y)
# 3 expressions that evaluate to False (i.e. x <= y)
x = 84
y = 17
# 3 expressions generating True
print("True:- ")
# prints
print(x > y)
# prints True or False (True)
print(x >= y)
# prints True or False (True)
print(x == 84)
# prints True or False (True)
# 3 expressions generating False
print("\n")
# prints
print("False:- ")
# prints
print(x < y)
# prints True or False (False)
print(x <= y)
# prints True or False (False)
print(x == "chocolate")
# prints True or False (False)

# [ ] Use the basic Boolean operators with the variables x and y to write:
# 3 expressions that evaluate to True (i.e. not y)
# 3 expressions that evaluate to False (i.e. x and y)
x = True
y = False
# 3 expressions generating True
# True:-
print(x and not y)
# prints
print(not y and x)
# prints
print(x or not y)
# prints
# 3 expressions generating False
# False:-
print("\n")
# prints absolutely nothing, just a filter for space.
print(x and y)
# prints
print(not y and not x)
# prints
print(not x and y)
# prints

# Testing if x is outside the range [10, 20]
x = 11
# stores value
(x < 10) or (x > 20)
# x is lesser than 10 or x is greater than 20, prints

# Testing if x is outside the range [10, 20]
x = 50
# stores value
(x < 10) or (x > 20)
# x is lesser than 10 or x is greater than 20, prints

# Testing if x is a positive and odd number
x = 11
# stores value
(x > 0) and (x % 2 != 0)
# x is greater and the remainder of x divided by 2 does not equal to 0, prints

# Testing if x is a positive and odd number
x = -11
# stores value
(x > 0) and (x % 2 != 0)
# x is greater than 0 and the remainder of x divided by 2 does not equal to 0, prints

# Testing if x is a positive and odd number
x = 22
# stores value in list
(x > 0) and (x % 2 != 0)
# x is greater than 0 and the remainder of x divided by 2 does not equal to 0, prints

# Driver information
name = 'Colette'
# stores value
age = 17
# stores value
# Testing if name starts with `C` and the age is 18 or less
(name.startswith('C')) and (age <= 18)
# name starts with C and age is lesser than or equal to 18

# Driver information
name = 'John'
# stores value
age = 17
# stores value
# Testing if name starts with `C` and the age is 18 or less
(name.startswith('C')) and (age <= 18)
# name starts with C and age is lesser than or equal to 18

# [ ] Write an expression to test if x is an even number outside the range [-100, 100]
# Test your expression with:
# x = 104 (True)
# x = 115 (False)
# x = -106 (True)
# x = -99 (False)
x = int(input("Type in a value for x:- "))
(x % 2 == 0) and ((x > 100) or (x < -100))

# [ ] Write an expression to test if a string s starts and ends with a capital letter
# HINT: You might find the function `str.isupper()` useful
# Test your expression with
# s = "CapitaL" (True)
# s = "Not Capital" (False)
string = input("Enter String:- ")
# stores user input
string[-1].isupper() and string[0].isupper()
# prints True or False if index 0 and -1 and is in uppercase

# [ ] Write an expression to test if a string s contains a numerical value
# then test if the value is greater than the value stored in x
# HINT: Use the functions `s.isnumeric()` and `float(s)`
# Test your expression with
# s = "39"
# x = 24
# Expression should yield True
# s = "a39"
# x = 24
# Expression should yield False
x = 24
# stores value in x
s = input("Enter Number:- ")
# stores user input
if s.isnumeric():
# if s is numeric
if float(s) > x:
# if s, that is in float form, is greater than x
print("Your number is greater than x!")
# print this
elif float(s) == x:
# else if s, that is in float form, is equal to x
print("Your number is the same as x!")
# print this
else:
# else
print("Your number is lesser than x.")
# print this
else:
# else
print("Please type in a number!")
# print this

x = 11
# stores value
(x >= 10) and (x <= 20)
# x is greater than or equal to 10
# and
# x is lesser than or equal to 20
# prints

x = 30
# stores value
(x >= 10) and (x <= 20)
# x is greater than or equal to 10
# and
# x is lesser than or equal to x
# prints

x = 11
# stores value
not((x < 10) or (x > 20))
# x is lesser than 10
# or
# x is greater than 20
# reverses whatever the final answer is
# prints

x = 30
# stores value
not((x < 10) or (x > 20))
# x is lesser than 10
# or
# x is greater than 20
# reverses whatever the final answer is
# prints

# [ ] Write an expression equivalent to the one below to
# test if x is outside the range [10, 20] (seen in a previous example)
# (x < 10) or (x > 20)
# Test your expression with
# x = 11 (False)
# x = 50 (True)
x = int(input("Type in a numerical value for x:- "))
# stores user input in int form
not ((x > 10) and (x < 20))
# x is greater than 10
# and
# x is lesser than 20
# reverses final answer
# prints

# [ ] Write a second expression to test if x is an even number outside the range [-100, 100]
# Do NOT use the expression you wrote for a previous exercise
# Test your expression with:
# x = 104 (True)
# x = 115 (False)
# x = -106 (True)
# x = -99 (False)
x = int(input("Type in a numerical value for x:- "))
# stores user input in int form
((x % 2 == 0) or ((x < -100) and (x > 100)))
# there should be no remainder of x/2
# or
# x is lesser than -100
# and
# x is greater than 100

# Solicit user input
x = input("Enter an odd positive number: ")
# stores user input
# Convert the string input into int
x = int(x)
# converts x to int form, stores
# Test number for validity
if ((x > 0) and (x % 2 != 0)):
# if x is greater than 0 and the remainder of x/2 is not 0
print(x, "is a valid number")
# print this
else:
# else
print(x, "is NOT a valid number")
# print this

# Solicit user input
y = input("Enter your birth year: ")
# stores user input
# Convert the string input into int
y = int(y)
# converts to int form, stores
# Check the decade membership
if (y < 1970):
# if y is lesser than 1970
print("You were born before 1970!")
# print this
elif (y >= 1970 and y < 1980):
# else if y is greater than or equal to 1970 and is lesser than 1980
print("You were born in the 70s!")
# print this
elif (y >= 1980 and y < 1990):
# else if y is greater than or equal to 1980 and y is lesser than 1990
print("You were born in the 80s!")
# print this
elif (y >= 1990 and y < 2000):
# else if y is greater than or equal to 1990 and y is lesser than 2000
print("You were born in the 90s!")
# print this
elif (y >= 2000 and y < 2010):
# else if y is greater than or equal to 2000 and y is lesser than 2010
print("You were born in early 2000s!")
# print this
else:
# else
print("You were born in the current decade!")
# print this

# [ ] Write a program to validate that user input is outside the range [0, 100]
x = int(input("Type in a number between 0-100:- "))
# stores user input in int form
if x > 100 or x < 0:
# if x is greater than 100 or x is lesser than 0
print("You have entered a number not within 0-100")
# print this
else:
# else
print("You have entered a number within 0-100")
# print this

# [ ] Write a program to ask a user for her/his BMI index, then display the user's BMI category
bmi = float(input("Enter your BMI Index:- "))
# stores user input in float form
if bmi < 18.5:
# if bmi is lesser than 18.5
print("Underweight")
# print this
elif bmi <= 24.9 and bmi >= 18.5:
# else if bmi is lesser than 24.9 and is greater than 18.5
print("Normal Weight")
# print this
elif bmi <= 29.9 and bmi >= 25:
# else if bmi is lesser than 29.9 and is greater than 25
print("Overweight")
# print this
elif bmi >= 30:
# else if bmi is greater than or equal to 30
print("Obese")
# print this
else:
# else
print("Please Try Again!")
# print this