python --- if statement

#if-elif-else
# Int (input ( 'Please enter your score:'))
grade = int (input ( 'Please enter your score:'))
if grade -ge 90:
    print ( 'excellent')
Elif grade -provide 70:
    print ( 'good')
elif grade -provide 60:
    print ( 'pass')
else:
    print ( 'fail')
 
'''
    Multi-line comments '' ' ' '' 
'''
#if used to determine the input of the user login user name and password are correct
Naming variables defined in Rule #: lowercase letters and underscore _ lowercase letters

account = 'huan'
password = '123456'

print('please input account')
user_account = input()

print('please input password')
user_password = input()

if account == user_account and password == user_password:
    print('success')
else:
    print('failed')

#注意:user_password = input()
# Username and password and relationships
#account == user_account and password == user_password :
if #if can also nest, but is generally not recommended nested, nested statements suggested that if the package as a function of
# Code block, indentation

if condition:
    pass
elif expression:
    pass
else:
    pass

a = 1
b = 0 
a or b


Guess you like

Origin www.cnblogs.com/carl007/p/12013104.html