The third day of learning pyton

Posted by RaheimSG on Sat, 12 Oct 2019 20:54:35 +0200

Small Knowledge Points:

Gamma function
 
1. Learn to write Lo code first, and then see where it is reused.
2. Then convert the reusable code into parameters and bring them into the function.
 
Function body
 
def funcName([param]):
    Executive body
    [retrue]

# Array Writing

G = ['Instant noodles','Ham','Beer']

# Don't bother if you can't use it.

#Simple Draw Code
def zr():
a = input("Please enter a name")
    b = ['zr1']
    if a in b:
print('Congratulations')
    else:
print('I'm sorry you missed the big prize, but don't lose heart')
zr()

# Small cases are very important for commodity purchasing **********

#commodity 
'''
def Check_Goods(g):
    G = ['Instant noodles','Ham','Beer']
    if g in G:
        Address()
    else:
        return False
def Check_Information(name,phone,Addr):
    is_ok = True
    if name =="" or name ==" ":
        is_ok = False
    if len(phone) !=11:
        is_ok = False
    if Addr not in ['Beijing','Shandong']:
        is_ok = False
    return is_ok
def Address():
    name = input('Name:')
    phone = input('Phone:')
    Addr = input('Addr:')
    res = Check_Information(name,phone,Addr)
    if res:
        Note()
    return False
def Note():
    print('Deliver immediately')

def gaozhi():
    print('Welcome')
    g = input('Commodity:')
    Check_Goods(g)
gaozhi()
#User registration
def  yonghujiance(yonghuming,mi,shouji):
    is_ok = True
    if yonghuming =="" or yonghuming ==" ":
        print('The username you entered is not valid')
    if len(mi) >11:
        print('You enter less than 11 passwords')
    if len(shouji) !=11:
        print('The phone number you entered is illegal')
    return is_ok
def  yonghu():
    yonghuming = input('Name:')
    mima = input('nima:')
    shoujihao = input('phone:')
    res = Check_Information(yonghuming,mima,shoujihao)
def  yanzhengma:
    pass
def gaozhi():
    print('Welcome to')

gaozhi()'''

 

 

 

Topics: Python less