Conditional judgment 3 In the form of :
One way judgment if
Two way judgment if... else...
Multidirectional judgment :if...elif...else...
Case study 1 One way judgment :
stonenumber=6
# Assign a value to the number of gems
if stonenumber>=6:
# Conditions : If you have more than or equal to 6 individual
print(' You have the power to destroy the universe ')
# result : Show ‘ You have the power to destroy the universe ’ Result
Be careful :if Indent the next line
Case study 2 Two way judgment :
weight=int(input(' Weight of sauce ?'))
if weight>=100:
print(' Please don't eat .')
else:
print(' Don't worry , Please ')
for i in range(10):
if i == 3:
print(' Find the result ')
break
else:
print(' No results found ')
Case study 3 Multidirectional judgment :
baoshi=3
if baoshi>=6:
print(' You're so awesome ')
elif 3<baoshi<=5:
print(' Need to destroy the gem ')
else:
print(' The captain needs to reverse the future ')
summary :
# Test score evaluation rules
score=int(input(' Please enter the grade :'))
if score>60:
if score>80:
print(' good ')
else:
print(' commonly ')
else:
if score<30:
print(' Usually too careless , It belongs to learning slag ')
else:
print(' At least save ')
input() function
No matter what we type in the terminal area ,input() The input value of the function must be character string
Coercive transformation
choice = int(input(' Please enter your choice :'))