python练习题

python练习题

银行流程
account = ‘wangyundong’
password = ‘123456’
money = 10000
userAccount = input(‘请输入账号:’)
userPsw = input(‘请输入密码:’)
if account == userAccount and password == userPsw:
userMoney = int( input(‘请输入取款金额:’) )
if userMoney <= money:
money -= userMoney#money = money - userMoney
print(‘您取现%d元,余额%d元’%(userMoney,money))
else:
print(‘余额不足’)
else:
print(‘账号或密码错误’)
剪刀石头布游戏
石头1剪刀2布3
computer = random.randint(1,3)
print(‘电脑出拳:%d’%computer)
person = int(input(‘请出拳:’))
if ( person == 1 and computer == 2 ) or (person == 2 and computer == 3) or ( person == 3 and computer == 1):
print(‘人赢’)
elif person == computer:
print(‘平局’)
else:
print(‘电脑赢’)
computer = random.randint(12,20)

你可能感兴趣的:(python练习题)