class animal(object): pass dog = animal () cat = animal ()
2023-09-06
定义一个公共模块common.py,在common.py中,包含公共函数say_hello(name),它接受一个参数,输出:Hello 的结果。
2023-09-04
def f(list1=[]):
str=''.join(list1)
l=str.title()
list3=[]
list3.append(l)
return list3
for item in map(f, ['alice','BOB','CanDY']):
print(item)
str=''.join(list1)
l=str.title()
list3=[]
list3.append(l)
return list3
for item in map(f, ['alice','BOB','CanDY']):
print(item)
2023-07-25
# Enter a code
class Person():
pass
dog= Person()
cat = Person()
dog.name = 'xiaodog'
dog.sex = 'man'
dog.age = 2
cat.name = 'xiaocat'
cat.sex = 'man'
cat.age = 3
print(dog.name)
print(dog.sex)
print(dog.age)
print(cat.name)
print(cat.sex)
class Person():
pass
dog= Person()
cat = Person()
dog.name = 'xiaodog'
dog.sex = 'man'
dog.age = 2
cat.name = 'xiaocat'
cat.sex = 'man'
cat.age = 3
print(dog.name)
print(dog.sex)
print(dog.age)
print(cat.name)
print(cat.sex)
2023-07-15
class Animal:
def __init__(self,name,age):
self.name = name
self.age = age
def get_information(self):
print(self.name,self.age)
dog = Animal('小小',12)
cat = Animal('大大',2)
dog.get_information()
cat.get_information()
def __init__(self,name,age):
self.name = name
self.age = age
def get_information(self):
print(self.name,self.age)
dog = Animal('小小',12)
cat = Animal('大大',2)
dog.get_information()
cat.get_information()
2023-06-08
kkkkxsssa class Person(object):
def __init__(self, name, sex, age):
self.name = name
self.sex
def __init__(self, name, sex, age):
self.name = name
self.sex
2023-05-18