5-2
str1 = 'abc'
str2 = 'ABC'
print(str1 == str2)
print(str1.upper() == str2)
print("\n")
print(str1 == str2.lower())
print("\n")
number1 = 2
number2 = 3
print(number1 == number2)
print(number1 != number2)
print(number1 > number2)
print(number1 < number2)
print(number1 >= number2)
print(number1 <= number2)
print("\n")
print(number1 > 1 and number2 > 1)
print(number1 > 4 or number2 > 4)
print("\n")
nums = [1, 2, 3, 4, 5]
print(1 in nums)
print(6 in nums)
print("\n")
5-3
alien_color = 'green'
if(alien_color == 'green'):
print("You just earned 5 points!\n")
alien_color = 'red'
if(alien_color == 'green'):
print('You just earned 5 points!\n')
print("\n")
5-4
alien_color = 'green'
if(alien_color == 'green'):
print("You just earned 5 points for killing that alien!\n")
else:
print('You just earned 10 points!\n')
alien_color = 'red'
if(alien_color == 'green'):
print("You just earned 5 points for killing that alien!\n")
else:
print('You just earned 10 points!\n')
5-5
alien_colors = ['green', 'yellow', 'red']
for alien_color in alien_colors:
if(alien_color == 'green'):
print("You just earned 5 points!\n")
elif(alien_color == 'yellow'):
print('You just earned 10 points!\n')
elif(alien_color == 'red'):
print("You just earned 15 points\n")
5-6
for age in ages:
if(age < 2):
print("He/She is a baby~\n")
elif(age >= 2 and age < 4):
print("He/She is a toddler.\n")
elif(age >= 4 and age < 13):
print("He/She is a child.\n")
elif(age >= 13 and age < 20):
print("He/She is a teenager!\n")
elif(age >= 20 and age < 65):
print("He/She is a adult.\n")
elif(age >=65):
print("He/She is an old man/woman.\n")
5-7
favorite_fruits = ['banana', 'apple', 'strawberry']
if 'banana' in favorite_fruits:
print("You really like banana!\n")
if 'pear' in favorite_fruits:
print("You really like pear!\n")
if 'apple' in favorite_fruits:
print("You really like apple!\n")
if 'peach' in favorite_fruits:
print("You really like peach!\n")
if 'strawberry' in favorite_fruits:
print("You really like strawberry!\n")