Commit 5c281dc3 by BellCodeEditor

save project

parent cd6ca711
Showing with 54 additions and 16 deletions
# 玩家出拳
player=input("请出拳(石头/剪刀/布):")
print("玩家出拳:"+player)
import random
list=["石头","剪刀","布"]
computer=random.choice(list)
print("电脑出拳:"+computer)
if player in list:
if player==computer:
print("平局")
elif(player=="石头" and computer=="剪刀") or (player=="剪刀" and computer=="布") or (player=="布" and computer=="石头"):
print("恭喜,你赢了")
def new_input():
total = []
while True:
unit=input('请输入单价(q退出):')
if unit=='q':
break
else:
print("很遗憾,你输了")
else:
print("输入错误")
\ No newline at end of file
try:
unit= int(unit)
except:
print("请重新输入")
else:
total.append(unit)
finally:
print("-"*30)
print(total)
def sum(money):
count=0
for i in money:
count=count+i
return count
print=new_input
pay=sum_price
print("一共消费了"+str(pay))
\ No newline at end of file
import func
data=func.new_input()
score=func.sum(data)
print("选手分数是+str(score)")
\ No newline at end of file
def new_input():
total = []
while True:
unit=input('请输入单价(q退出):')
if unit=='q':
break
else:
try:
unit= int(unit)
except:
print("请重新输入")
else:
total.append(unit)
finally:
print("-"*30)
print(total)
def sum(money):
count=0
for i in money:
count=count+i
return count
print=new_input
pay=sum_price
print("一共消费了"+str(pay))
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment