This commit is contained in:
2025-08-05 09:19:34 +08:00
commit 584548d006
1696 changed files with 53855 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
# 布尔类型
# result = "dog"
# result1 = "cat"
# print(f"{result == result1}")
# print(result >= result1)#只比较首字母ascii值,不比较后续的值
# # if语句
# age=30
# if age >= 18:
# print("我已经成年了\n即将步入大学生活")
# if elif else多条件判断
# height=int(input("请输入你的身高(cm"))
# VIP_level=int(input("请输入您的VIP等级(1-5"))
#
# if height < 120:
# print("您的身高小于120cm,可以免费")
# elif VIP_level > 3:
# print("您的vip等级大于3,可以免费")
# else:
# print("需要请买票10元")
# 单次输入一行写法
# if int(input("请输入你的身高(cm"))<120:
# print("您的身高小于120cm,可以免费")
# elif int(input("请输入您的VIP等级(1-5"))>3:
# print("您的vip等级大于3,可以免费")
# else:
# print("需要请买票10元")
#嵌套方式
if int(input("请输入你的身高(cm"))>120:
print("身高超出限制,不可以免费")
print("如果vip大于3则可以免费")
if int(input("请输入您的VIP等级(1-5"))>3:
print("您的vip等级大于3,可以免费")
else:
print("对不起,您不能免费")
else:
print("身高未超出限制,可以免费")