hmao
今天比昨天好,明天就有希望!
hmao的日记

20211218

# 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)
赞赏
20211218》中出现的部分内容可能已经过时,您可以按需阅读。
除特殊声明本站均采用署名-相同方式共享 4.0 国际 (CC BY-SA 4.0)
切勿相信验证码内的任何广告

hmao

文章作者

茫茫人海中…遇见你,真是幸运!

发表回复

textsms
account_circle
email

hmao的日记

20211218
# coding:utf-8 ''' ------------------------------------------------------------------------ fruits=['apple','banana','pear','orange'] index=0 while index<len(fruits): …
扫描二维码继续阅读
2021-12-18