PythonHackingBook1 icon indicating copy to clipboard operation
PythonHackingBook1 copied to clipboard

1.5函数

Open request101 opened this issue 5 years ago • 0 comments

def printRight(Username,Passwords):
Prints the usernames and passwords.
    The two valuse should be right.'''
    if(Username=='seven'):
        if(Passwords==123):
            print("登陆成功!")
        else:
            print("登陆失败!")
printRight('seven',123)
printRight('seven',1234)
print(printRight.__doc__)

def printList(i,sum):
    '''Prints the two numbers.
    The if the one of number is odd ,it should be sub.other number is even,it should be  sum.'''
    while(i<=100):
        if(i%2==0):
            sum+=i
        else:
            sum-=i
        i+=1
    print(sum)
printList(3,0)
printList(2,0)
print(printList.__doc__)

request101 avatar Jun 03 '19 09:06 request101