设为首页收藏本站

Crossin的编程教室

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

【Python 第27课】 list切片

[复制链接]

5

主题

0

好友

134

积分

注册会员

Rank: 2

楼主
发表于 2015-12-14 17:16:43 |显示全部楼层
代码分离再看看,先贴:
# -*-coding=utf-8 -*-
from random import choice
n=0
print('Choice one side to shoot:')
dictionary=['left','right','conter']
for i in range(5):
    print("left,conter,right")
    you=raw_input()
    print 'you kicked' + you
    com=choice(dictionary)
    if you!=com:
        print("臭脚!!")
    else:
        n+=1
        print("踢进...") and n
畏缩不前,徒伤时光,况大局无恙
回复

使用道具 举报

5

主题

0

好友

134

积分

注册会员

Rank: 2

沙发
发表于 2015-12-15 09:53:07 |显示全部楼层
crossin先生 发表于 2015-12-14 23:43
print("踢进...") and n
这里不对吧
  print("踢进...") , n

额,写出来的时候,用的是python2.7正常,也没再用3.5执行过,马马虎虎了
畏缩不前,徒伤时光,况大局无恙
回复

使用道具 举报

5

主题

0

好友

134

积分

注册会员

Rank: 2

板凳
发表于 2015-12-15 10:18:53 |显示全部楼层
我是一个小菜鸟 发表于 2015-12-14 17:16
代码分离再看看,先贴:
# -*-coding=utf-8 -*-
from random import choice

版本:python3.5
# -*-coding=utf-8 -*-
from random import choice
n=0
print('Choice one side to shoot:')
dictionary=['left','right','conter']

for i in range(5):
    print("left,conter,right")
    you=input()
    print (' you kicked ' + you)
    com=choice(dictionary)
    if you!=com:
        print("臭脚!!")
    else:
        n=n+1
        print("踢进...")
        print(n)
                  
畏缩不前,徒伤时光,况大局无恙
回复

使用道具 举报

5

主题

0

好友

134

积分

注册会员

Rank: 2

地板
发表于 2015-12-15 10:46:33 |显示全部楼层
# -*-coding=utf-8 -*-
from random import choice
n=0
print('Choice one side to shoot:')
dictionary=['left','right','conter']

for i in range(5):
    print("left,conter,right")
    you=input()
    print (' you kicked ' ,you)
    com=choice(dictionary)
    if you!=com:
        print("臭脚!!")
    else:
        n=n+1
        print("踢进,得分:",n)
畏缩不前,徒伤时光,况大局无恙
回复

使用道具 举报

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

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

GMT+8, 2024-5-19 20:02 , Processed in 0.026297 second(s), 24 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部