PythonHackingBook1
PythonHackingBook1 copied to clipboard
1.5函数
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__)