老师 ,不好意思 ,刚才提的问题图没有截完整,既然C=i*1000 可以定义,那么直接定义两个是不是更快,例如再定义一个 n=m*100,是不是我逻辑本来就存在问题呢
老师,为什么a的位置写错了就会有这么多结果
老师 谢谢
我的程序这里好像没有崩溃啊,视频里说会崩溃
老师帮我看一下我这里为什么没有返回'hello'
老师,为什么输入两个负数后,程序就结束了?
简单来说
类方法和静态方法不能调用实例方法
实例方法可以调用类方法和静态方法
因为类方法和静态方法一定是在类创建的时候就已经包含在里面的
实例方法是需要进行初始化对象,或者调用的时候才出现
老师好,请问集合如果类似字典中的键,是否意味着键的性质字典也适用于集合的元素?即:
(1)集合元素不能修改,如果要修改,需要先删除这个元素,再增加一个新元素
(2)集合中不能有列表的存在:如{[1,2],3,4}
(3)集合中不能存在字典:如{{'a':1},2,3}
(4)结合中不能存在集合,即不存在类似二维列表一样的二维集合一说:如{{1,2,3},4,5,6}
为什么它创建新项目就要下python到那个文件夹里面,怎么让它找到我原先下好的python解释器
Parson: (): () (): () (): () Parson.play = play_game Parson.work = work2 p = Parson p.play() p.work()
为什么我运行会报错,显示
TypeError: play_game() missing 1 required positional argument: 's'
a=dict(age=18,name='zhang')
上面这种创建方式的键是不是不能为整数浮点数,为什么呢
class Student: def __init__(self,name,score): self.name = name self.score = score def say_score(self): print("{0}的分数是{1}".format(self.name,self.score)) s1 = Student("张三",80) print(s1.name,s1.score) s1.say_score() s2 = Student("李四",90) print(s2.name,s2.score)
import turtle a=input("请输入一个x:") b=input("请输入一个y:") c=input("请输入一个width:") d=input("请输入一个height:") class MyRectangle: def __init__(self,x,y,width,height): self.x=x self.y=y self.width=width self.height=height if self.x=="": self.x=0 if self.x!="": self.x=float(x) if self.y=="": self.y=0 if self.y!="": self.y=float(y) if self.width == "": self.width = 100 if self.width!="": self.width=float(width) if self.height == "": self.height = 100 if self.height!="": self.height=float(height) def getArea(self): return self.width*self.height def getPerimeter(self): return 2*(self.height+self.width) def draw(self): turtle.color("red") turtle.penup() turtle.goto(self.x,self.y) turtle.pendown() turtle.right(90) turtle.forward(self.width) turtle.right(90) turtle.forward(self.height) turtle.right(90) turtle.forward(self.width) turtle.right(90) turtle.forward(self.height) turtle.done m1=MyRectangle(a,b,c,d) print(m1.getArea()) print(m1.getPerimeter()) m1.draw()
老师,为什么我在调用draw方法的之后海龟作图不显示?
老师,我想问一下,字典不是无序的吗,那么序列解包得到的内容也是无序的,如果想获取指定值,那么序列解包不是没用了吗,我想知道序列解包在实际应用中有啥用啊,不是太理解,谢谢老师
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637