Completed 5-1 Conditional Tests
This commit is contained in:
parent
42adeb835e
commit
a189b3ed0c
37
Chapter_05/5-1_conditionalTests.py
Normal file
37
Chapter_05/5-1_conditionalTests.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# Exercise 5-1 Conditional Tests
|
||||||
|
# Learning Objective: Write 10 conditional tests.
|
||||||
|
|
||||||
|
coin = 'heads'
|
||||||
|
print("Is coin == 'heads'? I think so.")
|
||||||
|
print(coin == 'heads')
|
||||||
|
|
||||||
|
print("\nIs coin == 'tails'? I don't believe so.")
|
||||||
|
print(coin == 'tails')
|
||||||
|
|
||||||
|
color = 'black'
|
||||||
|
print("\nIs the color black?")
|
||||||
|
print(color == 'black')
|
||||||
|
|
||||||
|
print("\nIs the color 'white'?")
|
||||||
|
print(color == 'white')
|
||||||
|
|
||||||
|
coin = 'tails'
|
||||||
|
print("\nIs coin == 'heads'? I don't think so.")
|
||||||
|
print(coin == 'heads')
|
||||||
|
|
||||||
|
print("\nIs coin == 'tails'? I believe so.")
|
||||||
|
print(coin == 'tails')
|
||||||
|
|
||||||
|
color = 'white'
|
||||||
|
print("\nIs the color black?")
|
||||||
|
print(color == 'black')
|
||||||
|
|
||||||
|
print("\nIs the color 'white'?")
|
||||||
|
print(color == 'white')
|
||||||
|
|
||||||
|
lightSwitch = 'on'
|
||||||
|
print("\nIs the light on or off? I think its on.")
|
||||||
|
print(lightSwitch == 'on')
|
||||||
|
|
||||||
|
print("\nIs the light off? I don't think it is.")
|
||||||
|
print(lightSwitch == 'off')
|
||||||
Loading…
x
Reference in New Issue
Block a user