Warning: count(): Parameter must be an array or an object that implements Countable in /www/wwwroot/blog.hsmao.cn/usr/plugins/AMP/Action.php on line 388
20211218

20211218

2021-12-18T17:21:02

# coding:utf-8
'''
------------------------------------------------------------------------
fruits=['apple','banana','pear','orange']
index=0
while index<len(fruits):
	print(fruits[index])
	index +=1
------------------------------------------------------------------------
for i in fruits:
	print(1)
------------------------------------------------------------------------
n=[1,2,3,4,5,6]
for i in n:
	print(i*6)
------------------------------------------------------------------------
heroes=['提莫队长','蛮族之王','战争女神','疾风剑豪']
for heroes in n:
	print(i*4)
------------------------------------------------------------------------
#用列表存储cf神奇对象
------------------------------------------------------------------------
1.单词
------------------------------------------------------------------------
gun枪
price
------------------------------------------------------------------------
2.代码部分
------------------------------------------------------------------------
class Gun():
    def __init__(self,name,type,price):
        self.name=name
        self.type=type
        self.price=price
        
guns=[Gun('修罗','服务器','666'),Gun('激光','狙击枪','999'),Gun('青龙','突击步枪','888')]
for gun in guns:
    print(gun.name+'是'+gun.type+'价格为:'+gun.price)
------------------------------------------------------------------------
class Gun():
    def __init__(self,name,type,price):
        self.name=name
        self.type=type
        self.price=price

guns=[Gun('修罗','服务器','666'),Gun('激光','狙击枪','999'),Gun('青龙','突击步枪','888')]
for gun in guns:
    print(gun.name+'是'+gun.type+'价格为:'+gun.price)
-------------------------------------------------------------------
price=[23,43,18,77]
for i in price:
    if i < 30:
        print(i)
-------------------------------------------------------------------
'''
class Dog():
    def __init__(self,name):
        self.name=name

dogs=[Dog('二哈'),Dog('金毛'),Dog('泰迪')]
for dog in dogs:
    print(dog.name)

当前页面是本站的「Baidu MIP」版。发表评论请点击:完整版 »
因本文不是用Markdown格式的编辑器书写的,转换的页面可能不符合MIP标准。