Pixeltests
0 Comments
Python Made Easy for AI – Day 2
Conditionals
Excercise – 1:
On a coin toss if it’s Heads: India Bat’s, If it’s tails: Australia Bats
Toss = “Heads”
if Toss == “Heads”:
print (“India’s Batting”)
else:
print (“Australia’s Batting”)
Excercise – 2:
Logic of Traffic Signals:
signal = “green”
if signal == “green”:
print (“Go”)
Excercise – 3:
#90 or higher should get an “A”
#65 – 89 should get a “B”
#Anything below a 65 should receive an “F”
if _____:
return “A”
elif _____:
return “B”
else:
return “F”