01 2024 档案
摘要:def fib(n): a, b = 0, 1 for _ in range(n): a, b = b, a + b return a
阅读全文
摘要:class pers(): def __init__(self,hp): self._hp=hp @property def hp(self): return self._hp @hp.setter def hp(self,hp): self._hp=gp if hp>=0 else 0 a=per
阅读全文
摘要:class test(): aaa = 111 bbb = 222 ccc = 333 @classmethod def cm(cls): cls.aaa="***" def im(self): self.aaa="iii" aa = test() print(aa.aaa,aa.bbb,aa.cc
阅读全文
摘要:t = ([1,2,3],[2,3,4],3) print(t) t[0][1]=9 print(t) # ~ t[2]=9#TypeError: 'tuple' object does not support item assignment # ~ print(t) ''' ([1, 2, 3],
阅读全文
摘要:m = 10 a = 10 print(id(m)) print(id(a)) '''输出 140713874176728 140713874176728 ''' print() a = 1 b = 2 c = 3 d = a+b print('a(1)\t'+str(id(a))) print('
阅读全文
摘要:def f(x,li=[1]): print(id(li)) li.append(x) print(li) f('a')#第一次调用函数 print() f('b')#第二次调用函数 print() f('a',[])#第三次调用函数 print() f('b',[2,2])#第四次调用函数 pri
阅读全文
摘要:#include <stdio.h> int main() { float a; scanf("%.3f", &a);//输入1234 printf("%f", a);//输出123.000000 printf("%d", (4,3));//3 printf("%d",(3,4));//4 }
阅读全文