- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex48.py
More file actions
Latest commit
19 lines (18 loc) · 502 Bytes
/
Copy pathex48.py
File metadata and controls
19 lines (18 loc) · 502 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'''
数字比较。
'''
m=float(input("输入第一个数字:"))
n=float(input("输入第二个数字:"))
# 条件运算符
print("使用条件运算符:")
result="%.3f > %.3f"% (m, n) ifm>nelse \
("%.3f = %.3f"% (m, n) ifm==nelse"%.3f < %.3f"% (m, n))
print(result)
# if elif else结构
print("使用if elif else结构:")
ifm>n:
print("%.3f > %.3f"% (m, n))
elifm==n:
print("%.3f = %.3f"% (m, n))
else:
print("%.3f < %.3f"% (m, n))