today review rink
Today the class content is If statement!
> ex) patient_age = 25
> if patient_age == 18:
> print('he has become an adult')
> ex) is_emergency = False
> if is_emergency:
> print('It is an emergency')
> ex) blood_sugar = 180
> is_diabetes = blood_sugar >= 150
> print(is_diabetes)
-if the condition is true, the code executes.
temp = 38.2
if temp >= 37.5:
print('checked fever')
else:
print('no fever')
-if 'a' is false
patient_age=16
if patient_age>=18:
print('prescribe an adult's med')
else:
print('prescribe a children's med')
비교 연산자 - ex) >, >=, <, <=, ==, !=
포함 연산자 - ex) in , not in
-> A in B : If 'B' contains 'A', That's true.
-> A not in B : If 'B' does not contains 'A', That's true.
and : If all conditions are true,That's true.
or : If at least one condition is true, That's true
not: Inverts the value
If - else -> result'A' if condition else result'B'
-if condition is true, result'A' is returned
-if condition is false, result'B' is returned