#Sam Ola
#10/4/2021
#In this lesson i learned how to create a function in a boolean function
#I didnt really have any problems with this assignment besides the fact that I misplaced some variables in the beginning
# review and run code - note: fix error in the following "tasks" section
have_hat = hat_available('green')
print('hat available is', have_hat)
def hat_available(color):
hat_colors = 'black, red, blue, green, white, grey, brown, pink'
# return Boolean
return(color.lower() in hat_colors)
hat available is True
have_hat = hat_available('green')
print('hat available is', have_hat)
def hat_available(color):
hat_colors = 'black, red, blue, green, white, grey, brown, pink'
return(color.lower() in hat_colors)
NameError: name 'hat_available' is not defined
def hat_available(color):
hat_colors = 'black, red, blue, green, white, grey, brown, pink'
return(color.lower() in hat_colors)
have_hat = hat_available('green')
print('hat available is', have_hat)
hat available is True
def bird_available(bird):
bird_types = 'crow robin parrot eagle sandpiper hawk piegon'
return (bird.lower() in bird_types)
have_bird = bird_available('parrot')
print("Bird is available", have_bird)
Bird is available True
def how_many():
requested = input("enter how many you want: ")
return requested
number_needed = how_many()
print(number_needed, "will be ordered")
#at the start, i defined the function
17 will be ordered