摘要: 以前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 阅读(5) 评论(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:20 Danlis 阅读(10) 评论(0) 推荐(0) 编辑