老师,箭头可以收吗?怎样才能和图片一模一样。
def __new__(cls, *args, **kwargs): if cls.__obj == None: cls.__obj = object.__new__(cls) return cls.__obj
我对这段代码不理解
##老师你好,麻烦问下前面构造函数讲的类下面的方法传入参数第一个必须是self,而play_game方法传入的是s没有self ##那为什么Person.play = play_game 缺少self不应该报错吗 Person.play = play_game p = Person() p.work() p.play()
1.判断下列逻辑语句的True,False.
1)1 > 1 or 3 < 4 or 4 > 5 and 2 > 1 and 9 > 8 or 7 < 6 True
2)not 2 > 1 and 3 < 4 or 4 > 5 and 2 > 1 and 9 > 8 or 7 < 6 Flase
2.求出下列逻辑语句的值。
1)、6 or 2 > 1 6
2)、3 or 2 > 1 3
3)、0 or 5 < 4 False
6)、3 and 2 > 1 True
7)、0 and 3 > 1 0
8)、2 > 1 and 3 3
9)、3 > 1 and 0 0
这些是怎么运算 不能理解 求完整的判断、计算方法过程
老师, a.reverse()和a.sort(reverse=True)区别在哪里
>>>a='I\nLOVE\nU'
>>> a
'I\nLOVE\nU'
>>> print(a)
I
LOVE
U
>>> b='I\'m a teacher'
>>> b
"I'm a teacher"
老师,为什么在命令运行中,直接输入a,出来的是字符串,其中的换行符\n不表现,必须用print()
而输入b,其中的 \' 可以直接运行出来 '
老师,您说的#不在标识符里,不能使用,那我这个#如果是作用于注释呢,又该怎么去区分呢
为什么最后面那儿{}这个里面只能用0,用其他的会报错 empNum=0 salaryNum=0 salary=[] while True: s=input("请输入员工工资(输入Q退出): ") if s.upper()=="Q": print("录入完成,退出") break if float(s)<0: continue empNum+=1 salary.append(float(s)) salaryNum+=float(s) print("员工人数: {0}".format(empNum)) print("薪资总和: {1}".format(salaryNum)) print("平均薪资: {2}".format(salaryNum/empNum))
扩容的时候,是简单的拷贝,还是根据新的数组重新将键放进去呀(因为扩容后偏移量计算的数字 位数 会改变)
老师,我想问下,如上a列表中每一个值存储占用的空间是320个字符,这320个字符是怎么分配的,是怎么存储地址,数值类型,以及相应的值的?
老师,我在敲代码过程中发现的问题是 turtle.penup 但是运行时没有笔抬起来,后来检查加上了()就运行处我想要的结果了
第一问: 为什么没有() 运行笔没有抬起来 我想从语法上知道为什么要加上()
第二问 : 既然没有加上() 为什么他不会报错 而又能成功运行但是笔又为什么不抬起来呢
为什么键入了,制图的箭头都出来了,为什么他不自己画呢?画不了
老师这里运行函数为什么 inner()和outer()都要写呢? 只写一个为什么不能运行
#测试LEGB
s = "global"
def outer():
s = "outer"
def inner():
s = "inner"
print(s)
inner()
outer()
# coding=utf-8 class Employee: id = 1001 # 类属性 def __init__(self, name, salary): self.name = name # 实例属性 self.salary = salary Employee.id = Employee.id + 1 def __add__(self, other): if isinstance(other, Employee): return "员工数为:{0}两人的薪水之和为:{1}" \ .format(Employee.id, (self.salary + other.salary)) @property def get_Salary(self): return "月薪为:{0}".format(self.salary) @get_Salary.setter def get_salary(self, salary): if 1000 < salary < 50000: self.salary = salary else: print("薪水录入错误,薪水应在1000-50000") emp1 = Employee("Tom", 5000) emp2 = Employee("Bob", 5000) emp = emp1 + emp2 print(emp)
老师,我想问一下为什么@property没有标黄,但@setter会标黄
老师请问,bucket最长是8对应数字是7,如果全部存满,扩容是扩到新的一组bucket里边吗
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637