2025-08-22 12:19:39 +08:00

24 lines
647 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 判断是否成年
age = 20
if age >= 18:
print("您已经成年了!")
""" 基础编写一个if语句如果变量number大于10则打印“数字大于10”。 """
num = 15
if num > 10:
print("数字大于10")
""" 应用给定两个变量score1和score2编写一个if语句来比较它们如果score1大于score2则打印“第一个分数更高”。 """
score1 = 100
score2 = 50
if score1 > score2:
print("第一个分数更高")
""" 挑战编写一个if语句检查一个数字num是否是3的倍数且小于100。 """
num = 99
if num < 100:
if num % 3 == 0:
print(f"{num}是3的倍数且小于100")