三元表达式 在以前,在诸如比较两个数大小的时候,通常的写法都是下面的样子 if x > y:print("the max is x")
else:print("the max is y") 三元表达式的语法为: True if expression else False 现在可以个体三元表达式…
while True:a int(input(摄氏度转换为华氏温度请按1\n华氏温度转化为摄氏温度请按2\n))if a 1:celsius float(input(输入摄氏温度:))fahreaheit (celsius 1.8) 32 # f c9/532print({:.2f}摄氏温度转为华氏温度为{:.2f}.format(celsius, fahreaheit))elif a …