首頁 後端開發 Python教學 Python - 等級:詢問

Python - 等級:詢問

Dec 03, 2024 pm 09:29 PM

Python - Level : asks

1 級任務

1) 華氏度到攝氏度轉換

f=int(input("Enter the no. "))

c=5/9*(f-32)

print("Fahrenheit to celsius",round(c))
登入後複製

輸出:

Enter the no. 108
Fahrenheit to celsius 42

登入後複製

2) 攝氏度到華氏度轉換

c=int(input("Enter the no. "))
f=c*(9/5)+32

print("celsius to fahrenheit",round(f))
登入後複製

輸出:

Enter the no. 42
celsius to fahrenheit 108

登入後複製

3) 英尺到米的轉換

#1 Feet = 0.3048 meters

feet=float(input("Enter the no. "))

meter=feet*0.3048

print("feet to meters",round(meter,1))
登入後複製

輸出:

Enter the no. 15
feet to meters 4.6

登入後複製

4) 正方形的輸入側、輸出區

side=float(input("Enter the no. "))

area=side**2

print("Area of a square is ",area)
登入後複製

輸出:

Enter the no. 5
Area of a square is  25.0

登入後複製

5) 輸入-長、寬;輸出-長方形面積

#Area of a Rectangle=length*breadth

length=float(input("Enter length of the rectangle. "))
breadth=float(input("Enter breadth of the rectangle. "))

area=length*breadth

print("Area of a rectangle is ",area)
登入後複製

輸出:

Enter length of the rectangle. 5
Enter breadth of the rectangle. 10
Area of a rectangle is  50.0

登入後複製

6) 半徑 - 圓的面積

#Area of circle = πr2

r=int(input("Enter the radius of circle: "))

area=3.14*(r**2)

print("Area of the circle is ",area)
登入後複製

輸出:

Enter the radius of circle: 5
Area of the circle is  78.5

登入後複製

7) 美元 轉換為 INR

#usd=Rs. 84.56

dollar=float(input("Enter currency in dollars: "))
usd=dollar*84.56

print("Currency in rupees is =",usd)
登入後複製

輸出:

Enter currency in dollars: 500
Currency in rupees is = 42280.0

登入後複製

以上是Python - 等級:詢問的詳細內容。更多資訊請關注PHP中文網其他相關文章!

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱門文章

倉庫:如何復興隊友
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
1 週前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒險:如何獲得巨型種子
3 週前 By 尊渡假赌尊渡假赌尊渡假赌

熱門文章

倉庫:如何復興隊友
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
1 週前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒險:如何獲得巨型種子
3 週前 By 尊渡假赌尊渡假赌尊渡假赌

熱門文章標籤

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

我如何使用美麗的湯來解析HTML? 我如何使用美麗的湯來解析HTML? Mar 10, 2025 pm 06:54 PM

我如何使用美麗的湯來解析HTML?

python中的圖像過濾 python中的圖像過濾 Mar 03, 2025 am 09:44 AM

python中的圖像過濾

如何使用Python查找文本文件的ZIPF分佈 如何使用Python查找文本文件的ZIPF分佈 Mar 05, 2025 am 09:58 AM

如何使用Python查找文本文件的ZIPF分佈

如何使用Python使用PDF文檔 如何使用Python使用PDF文檔 Mar 02, 2025 am 09:54 AM

如何使用Python使用PDF文檔

如何在django應用程序中使用redis緩存 如何在django應用程序中使用redis緩存 Mar 02, 2025 am 10:10 AM

如何在django應用程序中使用redis緩存

如何使用TensorFlow或Pytorch進行深度學習? 如何使用TensorFlow或Pytorch進行深度學習? Mar 10, 2025 pm 06:52 PM

如何使用TensorFlow或Pytorch進行深度學習?

python對象的序列化和避難所化:第1部分 python對象的序列化和避難所化:第1部分 Mar 08, 2025 am 09:39 AM

python對象的序列化和避難所化:第1部分

如何在Python中實現自己的數據結構 如何在Python中實現自己的數據結構 Mar 03, 2025 am 09:28 AM

如何在Python中實現自己的數據結構

See all articles