FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
BasePythonE/TempConvert.py at master · AllenTango/BasePythonE · GitHub
AllenTango
/
BasePythonE
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
BasePythonE
/
TempConvert.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
16 lines (14 loc) · 568 Bytes
Breadcrumbs
BasePythonE
/
TempConvert.py
Copy path
File metadata and controls
16 lines (14 loc) · 568 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 简单用户输入,公式转换之温度转换
TempStr
=
input
(
"请输入带有符号的温度值[如23C]:"
)
while
True
:
if
TempStr
[
-
1
]
in
[
'f'
,
'F'
]:
C
=
(
eval
(
TempStr
[
0
:
-
1
])
-
32
)
/
1.8
print
(
"转换后的温度是:{:.2f}C"
.
format
(
C
))
break
elif
TempStr
[
-
1
]
in
[
'c'
,
'C'
]:
F
=
1.8
*
eval
(
TempStr
[
0
:
-
1
])
+
32
print
(
"转换后的温度是:{:.2f}F"
.
format
(
F
))
break
else
:
print
(
"输入格式有误,请重新输入"
)
TempStr
=
input
(
"请输入带有符号的温度值[如23C]:"
)
Back
|
FazBrowse Home
|
New Git URL