if使用方法举例:
import random
#随机生成1-100的整数
n = random.randint(1, 100) if n > 50:
print(n, "> 50")
elif n == 50:
print(n, "=50")
else:
print(n, "< 50")
2023-10-14 22:49:40
if使用方法举例:
import random
#随机生成1-100的整数
n = random.randint(1, 100) if n > 50:
print(n, "> 50")
elif n == 50:
print(n, "=50")
else:
print(n, "< 50")