- 帖子
- 85
- 精华
- 0
- 积分
- 273
- 阅读权限
- 30
- 注册时间
- 2015-12-17
- 最后登录
- 2016-5-3
|
动了一点脑筋加了循环和计数,感觉自己棒棒哒~
a=0
print 'Welcome to the Happy Time, you have 5 times to play!'
print 'Choose one side to shoot:'
print 'left, center, right'
for i in range(1,6):
from random import choice
you=raw_input()
direction=['left','center','right']
com=choice(direction)
print 'Computer saved '+ com
if you != com:
print 'Goal, you get 1 score!'
a=a+1
else:
print 'Oops...'
a=a
if a>=3:
print 'Congratulations, you scored %d!'%a
else:
print 'Oh-no, you only scored %d, better luck next time!'%a |
|