设为首页收藏本站

Crossin的编程教室

 找回密码
 立即加入
楼主: crossin先生
打印 上一主题 下一主题

【Python 第26课】 操作list

[复制链接]

0

主题

2

好友

72

积分

注册会员

Rank: 2

楼主
发表于 2018-4-6 12:28:34 |显示全部楼层
暂时做成这样啦,后续完善吧~
  1. direc=['left','middle','right']
  2. import random
  3. goalkeeper=random.choice(direc)
  4. shoot=input('please choose the direction:left,middle or right:')
  5. score=0
  6. while goalkeeper!=shoot:
  7.     print('Goal')
  8.     shoot=input('try,again?')
  9.     score=score+1
  10. print('Oh,no,the goalkeeper is in the %s,and your score is %d' %(goalkeeper,score))
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即加入

QQ|手机版|Archiver|Crossin的编程教室 ( 苏ICP备15063769号  

GMT+8, 2024-5-19 15:17 , Processed in 0.031244 second(s), 24 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部