小编use*_*951的帖子

有人可以向我解释一些简单的python概念吗?

我一直在努力学习"以艰难的方式学习Python",到目前为止它已经很顺利,但我有几个问题:

the_count = [1, 2, 3, 4, 5]
fruits = ['apples', 'oranges', 'pears', 'apricots']
change = [1, 'pennies', 2, 'dimes', 3, 'quarters']

# this first kind of for-loop goes through a list
for number in the_count:
    print "This is count %d" % number

# same as above
for fruit in fruits:
    print "A fruit of type: %s" % fruit

# also we can go through mixed lists too
# notice we have to use %r since we don't know what's …
Run Code Online (Sandbox Code Playgroud)

python

4
推荐指数
1
解决办法
127
查看次数

标签 统计

python ×1