pythonç®åçå½æ°å®ä¹åç¨æ³å®ä¾
è¿ç¯æç« ä¸»è¦ä»ç»äºpythonç®åçå½æ°å®ä¹åç¨æ³,å®ä¾åæäºPythonèªå®ä¹å½æ°åå
¶ä½¿ç¨æ¹æ³,å
·æä¸å®åèåé´ä»·å¼,éè¦çæåå¯ä»¥åèä¸
å
·ä½åæå¦ä¸ï¼
è¿éå®ä¹äºä¸ä¸ªæ¸©åº¦è½¬æ¢çå½æ°åå
¶ç¨æ³ã
def convertTemp(temp, scale):
if scale == "c":
return (temp - 32.0) * (5.0/9.0)
elif scale == "f":
return temp * 9.0/5.0 + 32
temp = int(input("Enter a temperature: "))
scale = input("Enter the scale to convert to: ")
converted = convertTemp(temp, scale)
print("The converted temp is: " + str(converted))
å¸ææ¬ææ述对大家çPythonç¨åºè®¾è®¡ææ帮å©ã
温馨提示:答案为网友推荐,仅供参考