- 博客(5)
- 收藏
- 关注
原创 4
class Dog(object):def init(self,name,age):self.name=nameself.age=agedef sit(self):print(self.name.title()+“is now sitting.”)def roll_over(self):print(self.name.title()+“rolled over!”)my_dog=Dog(‘whillie’,6)print(“My dog’s name is “+my_dog.name.tit
2021-05-24 21:40:29
53
原创 2021-04-05
#第四章(循环遍历)‘’‘magicians=[‘alice’,‘david’,‘carolina’]for magician in magicians: #将magicians中的元素存入变量magician中,然后输出print(magician)print(magician.title()+",that was a great trick!")print(“I can’t wait to see your next trick,”+magician.title()+".\n"
2021-04-05 21:44:33
179
原创 2021-03-27
‘’’bicycles=[‘trek’,‘cannondale’,‘redline’,‘specialized’]print(bicycles[0])print(bicycles[0].title())print(bicycles[-1]) #输出-1位置的元素(位置可变)message=“My first bicycle was a “+bicycles[0].upper()+”.”print(message)‘’’motorcycles=[‘honha’,
2021-03-27 00:41:03
104
原创 2021-03-21
alist=[3,5,7]blist=alist[:]alist==blisttruealist is blistfalseblist
2021-03-21 16:49:57
74
原创 python第一周
h=eval(input(“input height:”))print(type(h))w=eval(input(“input width:”))s=h*wprint(s)eval()print(“4+5/6”)print(12%5)print(“圆周率为%.2f%3.1415926”)#format()print(“my name is {1},my age is {0}”.format(18,“tom”))print(f"my name is {‘tom’},my age is {
2021-03-14 15:58:17
51
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人