日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Python程序:利用長度和寬度計算矩形周長

創(chuàng)新互聯(lián)Python教程:

創(chuàng)新互聯(lián)是一家成都網(wǎng)站設(shè)計、成都網(wǎng)站建設(shè),提供網(wǎng)頁設(shè)計,網(wǎng)站設(shè)計,網(wǎng)站制作,建網(wǎng)站,按需求定制設(shè)計,網(wǎng)站開發(fā)公司,于2013年成立是互聯(lián)行業(yè)建設(shè)者,服務(wù)者。以提升客戶品牌價值為核心業(yè)務(wù),全程參與項目的網(wǎng)站策劃設(shè)計制作,前端開發(fā),后臺程序制作以及后期項目運營并提出專業(yè)建議和思路。

編寫 Python 程序,通過一個實際例子,利用長度和寬度找到矩形的周長。

使用長度和寬度查找矩形周長的 Python 程序示例 1

這個 Python 程序允許用戶輸入矩形的長度和寬度。通過使用長度和寬度,這個程序找到一個矩形的周長。計算矩形周長的數(shù)學(xué)公式:周長= 2 *(長度+寬度)。如果我們知道長度和寬度。

# Python Program to find Perimeter of a Rectangle using length and width

length = float(input('Please Enter the Length of a Triangle: '))
width = float(input('Please Enter the Width of a Triangle: '))

# calculate the perimeter
perimeter = 2 * (length + width)

print("Perimeter of a Rectangle using", length, "and", width, " = ", perimeter)
Please Enter the Length of a Triangle: 35
Please Enter the Width of a Triangle: 88
Perimeter of a Rectangle using 35.0 and 88.0  =  246.0

使用長度和寬度計算矩形周長的 Python 程序示例 2

這個 Python 程序求矩形周長同上。但是,在這個 python 程序中,我們使用 Python 函數(shù)來分隔矩形邏輯的周長。

# Python Program to find Perimeter of a Rectangle using length and width

def perimeter_of_Rectangle(length, width):
    return 2 * (length + width)

length = float(input('Please Enter the Length of a Triangle: '))
width = float(input('Please Enter the Width of a Triangle: '))

# calculate the perimeter
perimeter = perimeter_of_Rectangle(length, width)
print("Perimeter of a Rectangle using", length, "and", width, " = ", perimeter)


網(wǎng)頁題目:Python程序:利用長度和寬度計算矩形周長
本文路徑:http://m.5511xx.com/article/dpdjhjc.html