学习 Python
1. 变量 ❎ 变量是用于存储值(字符串、整数、浮点数、布尔值)的容器。 变量的行为就像它包含的值一样。 # 字符串 first_name = "Bro" food = "pizza" email = "Bro123@gmail.com" print(f"你好 {first_name}") print(f"你喜欢 {food}") print(f"你的邮箱是: {email}") # 整数 age = 25 quantity = 3 num_of_students =30 print(f"你 {age} 岁了") print(f"你购买了 {quantity} 件商品") print(f"你的班级有 {num_of_students} 名学生") # 浮点数 price = 10.99 gpa = 3.2 distance = 5.5 print(f"价格是 ${price}") print(f"你的 GPA 是: {gpa}") print(f"你跑了 {distance} 公里") # 布尔值 is_student = False for_sale = False is_online = True if is_online: print("你在线") else: print("你离线") 变量赋值 ...