老师,在
say_score里添加age属性,是不是要 say_score被调用过之后才添加成功
turtle模块没有导入成功
都是按照老师代码敲得为什么会有三个报错
老师这哪里出错了
class Student: company="尚雪堂" count=0 def __init__(self,name,score): self.name=name self.score=score Student.count=Student.count+1 def say_score(self): print("我的公司是:",Student.company) print(self.name,"我的分数是:",self.score) s1=Student("高其,80") s2=Student("张三,90") s1.say_score() print("一共创建{0}个Student对象".format(Student.count))
怎么选择D盘下载呢
想问在什么情况后面要加:== 和= 的差别?
score = int(input("请输入一个在0-100之间的数字:")) grade = "" if score>100 or score<0: score = int(input("输入错误!请重新输入一个在0-100之间的数字:")) # 这里少了一个中止语句?需要返回条件语句执行之前 else: if score>=90: grade = "A" elif score>=80: grade = 'B' elif score>=70: grade = 'C' elif score>=60: grade = 'D' else: grade = 'E' print("分数为{0},等级为{1}".format(score,grade))
老师,想问下Python中的重写和重载有什么区别呢,怎么区分呢
这里报错是啥原因
# Python中的类方法和静态方法 class Student: company = "尚学" def __init__(self, name): self.name = name # 定义类方法,cls表示类对象本身 @classmethod def print_company(cls): print("我的公司是{}".format(cls.company)) # 定义静态方法 @staticmethod def add(a, b): print("{} + {} = {}".format(a, b, a + b)) return a + b s1 = Student("小明") s1.print_company()
老师,想问下类方法的调用格式不是类名.类方法名()吗,为什么我用实例对象调类方法也能正常执行呢
为什么不能行
a = 1 b = 2 dict1 = dict(a=3, b=4) c = eval("a + b", dict1) print(c) print(dict1)
老师,想问下,dict1不应该是{"a": 3,"b": 4}吗,为什么打印后,字典里多出那么多内容
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637