|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
import random
list1 = [0,0]
asd = [1,2,3]
def haha():
print('可以输入1=左,2=中,3=右')
you = input()
asf = int(you)
print("你输入的是%d"%asf)
com = random.choice(asd)
print("电脑踢得方向是%d"%com)
if asf == com:
print("你赢了")
list[0] += 1
else:
print("你输了")
list[1] += 1
for i in range(6):
print("进行第%d次"%(i+1))
haha()
while list1[0] == list1[1]:
print('平局从新开始')
haha()
if list1[0]>list1[1]:
print('you win')
else:
print("you loset")
print('你的得分是%d'%list1[0])
print('电脑的得分是%d'%list[1])
运行之后,只能运行一次haha(),问题提示是TypeError: 'type' object is not subscriptable |
|