摘要: 函数是具有某种特定功能的代码块,可以重复使用。 函数的定义 def max(a, b): if a > b: print(a) else: print(b) max(1, 2) max(20, 10) 运行该程序,输出如下: 2 20 函数的返回 return 语句 Python 提供了 retur 阅读全文
posted @ 2022-06-18 20:26 tiansz 阅读(26) 评论(0) 推荐(0) 编辑
摘要: # 创建一个全局列表容器来存储联系人字典 persons = [] while True: # 程序菜单 print('1. 创建联系人') print('2. 列出所有联系人') print('3. 查询联系人') print('4. 删除联系人') print('5. 退出程序') choice 阅读全文
posted @ 2022-06-18 20:12 tiansz 阅读(26) 评论(0) 推荐(0) 编辑
摘要: 如果需要生成一个长度为 100、内容为 0 的列表,需要在括号中书写 100 个 0,既繁琐又容易出错,显然是不合适的。可以使用动态的方式完成这项任务: list = [] for i in range(100): list.append(0) 如果需要生成一个包含 0 到 100 之间(不包括 1 阅读全文
posted @ 2022-06-18 19:44 tiansz 阅读(43) 评论(0) 推荐(0) 编辑
摘要: while循环语句 number = 1 while number <= 3: print(number) number = number + 1 print('END') 输出结果为: 1 2 3 END for 循环语句 遍历列表 for item in ['www', 'imooc', 'co 阅读全文
posted @ 2022-06-18 18:39 tiansz 阅读(36) 评论(0) 推荐(0) 编辑
摘要: 快捷键:CTRL + TAB 阅读全文
posted @ 2022-06-18 15:07 tiansz 阅读(271) 评论(0) 推荐(0) 编辑
摘要: 安装pip sudo apt install python3-pip 更换pip源 mkdir ~/.pip vi ~/.pip/pip.conf 使用阿里云镜像,写入以下内容: [global] index-url = https://mirrors.aliyun.com/pypi/simple 阅读全文
posted @ 2022-06-18 15:01 tiansz 阅读(349) 评论(0) 推荐(0) 编辑
摘要: 打开wps 2019,注意不是打开表格、演示那些分程序 之后在右上方有一个衣服样式的图标 点击之后即可更换 阅读全文
posted @ 2022-06-18 14:52 tiansz 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 打开github后点击头像——“setting”——左侧的“appearance” 之后即可修改颜色主题 阅读全文
posted @ 2022-06-18 14:49 tiansz 阅读(692) 评论(0) 推荐(0) 编辑