摘要: 6.1 定义函数 def greet_user(): """显示简单的问候语""" print('Hello!') greet_user() # 调用函数 6.1.1 向函数传递信息 def greet_user(username): "“显示简单的问候语"” print(f"Hello,{user 阅读全文
posted @ 2024-07-27 17:53 鹤比纷恆红 阅读(29) 评论(0) 推荐(0)
摘要: 5.1 函数input()工作原理 # 变量=input(参数:说明/提示) message input("Tell me something,and I will repeat it back to you:" print(message) prompt ="If you tell us who 阅读全文
posted @ 2024-07-27 16:17 鹤比纷恆红 阅读(38) 评论(0) 推荐(0)
摘要: 4.1 一个简单的字典(键值对) # 外星人颜色(绿色)+分数(5) alien_0 = {'color':'green','points':5} print(alien_0['color']) #想要获取值(green),指定字典名(alie_0)+键(color) print(alien_0[' 阅读全文
posted @ 2024-07-27 15:06 鹤比纷恆红 阅读(45) 评论(0) 推荐(0)