๐Ÿ‘ฉ‍๐Ÿ’ป ์•Œ๊ณ ๋ฆฌ์ฆ˜/๐Ÿข PYTHON

์˜จ๋„ ๋ณ€ํ™˜

์˜ค๋ธŒ ๐Ÿง™‍โ™‚๏ธ 2023. 9. 16. 16:57
# ํ™”์”จ ์˜จ๋„์—์„œ ์„ญ์”จ ์˜จ๋„๋กœ ๋ฐ”๊ฟ” ์ฃผ๋Š” ํ•จ์ˆ˜
def fahrenheit_to_celsius(fahrenheit):
    return (fahrenheit-32)*5 / 9

temperature_list = [40, 15, 32, 64, -4, 11]

cles = [round(fahrenheit_to_celsius(i),1) for i in temperature_list]
 
    

print("ํ™”์”จ ์˜จ๋„ ๋ฆฌ์ŠคํŠธ: {}".format(temperature_list)) 
# ํ™”์”จ ์˜จ๋„ ์ถœ๋ ฅ
    
# ๋ฆฌ์ŠคํŠธ์˜ ๊ฐ’๋“ค์„ ํ™”์”จ์—์„œ ์„ญ์”จ๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ์ฝ”๋“œ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”
print("์„ญ์”จ ์˜จ๋„ ๋ฆฌ์ŠคํŠธ: {}".format(cles))