摘要: def ADD(a): print(3,a,hex(id(a))) a.remove(2) print(3,a,hex(id(a))) a=a.append(10) print(3,a,hex(id(a))) return a a=[1,2,3] print(1,a,hex(id(a))) b=AD 阅读全文
posted @ 2024-04-24 18:46 Danlis 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 今天做到了一道题是这样的: 病人登记看病,编写一个程序,将登记的病人按照以下原则排出看病的先后顺序: 1.老年人(年龄≥60岁)比非老年人优先看病。 2.老年人按年龄从大到小的顺序看病,年龄相同的按登记的先后顺序排序。 3.非老年人按登记的先后顺序看病。 输入格式 第1行,输入一个小于100的正整数 阅读全文
posted @ 2024-01-21 20:13 Danlis 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 网上还有别的办法,不过我的笔记本是Windows11,按照下面这种方式处理之后,就OK了。 处理方法:修改注册表。 将注册表中HKEY_CLASSES_ROOT\Python.File\Shell\editwithidle\shell\edit35-32\command 将里面的路径复制到同级的op 阅读全文
posted @ 2023-12-17 10:15 Danlis 阅读(15) 评论(0) 推荐(0) 编辑
摘要: pygame的安装问题 (1)python -m pip install --upgrade pip (2)pip install pygame (3)更换下载网站,且赋予信任 pip install pygame -i http://pypi.douban.com/simple --trusted 阅读全文
posted @ 2023-12-17 10:12 Danlis 阅读(10) 评论(0) 推荐(0) 编辑
摘要: http可能会显示不安全。 清华:https://pypi.tuna.tsinghua.edu.cn/simple 阿里云:http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 华 阅读全文
posted @ 2023-12-17 10:09 Danlis 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 以前for循环的使用一直都是for(int i=0;i<10;i++)初始值,判断条件,变量处理这种形式用的,直到前两天看到有一个代码的写法是使用冒号,才知道原来C++还有这种写法。 #include<iostream> using namespace std; int main(){ int a[ 阅读全文
posted @ 2023-12-15 15:10 Danlis 阅读(2) 评论(0) 推荐(0) 编辑
摘要: list1 = list() for i in range(5): name = input(f'输入水果名字:') price = int(input(f'输入水果价格(整数):')) list1.append((name,price)) list1.sort(key=lambda x:x[1]) 阅读全文
posted @ 2023-12-15 14:21 Danlis 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 存储下数组拷贝 #include<iostream> using namespace std; int main(){ int a[10]={1, 2, 3, 4}, b[10], c[10]; copy(begin(a), end(a), begin(b)); for(int i=0;i<4;i+ 阅读全文
posted @ 2023-12-14 19:07 Danlis 阅读(38) 评论(0) 推荐(0) 编辑
摘要: 今天在看到O(logn)的时候,先去看了下什么是对数,有一个博主说的特别好,经过勤奋的工作之后,已经忘记了什么是对数。 参考百度百科的对数公式:对数公式是数学中的一种常见公式,如果ax=N(a>0,且a≠1),则x叫做以a为底N的对数,记做x=logaN,其中a要写于log右下。其中a叫做对数的底, 阅读全文
posted @ 2023-12-14 14:15 Danlis 阅读(50) 评论(0) 推荐(0) 编辑
摘要: 从CSDN https://blog.csdn.net/xiaoyaotan123/article/details/40159691 那边查到的一个解决方案,很好地解决了打不开Python的问题。 解决方案: 修改[Python目录]\Lib\idlelib\PyShell.py文件,我这边的位置在 阅读全文
posted @ 2023-12-13 14:43 Danlis 阅读(13) 评论(0) 推荐(0) 编辑