日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

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

新聞中心

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

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

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

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

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

這個(gè) Python 程序允許用戶輸入矩形的長度和寬度。通過使用長度和寬度,這個(gè)程序找到一個(gè)矩形的周長。計(jì)算矩形周長的數(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

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

這個(gè) Python 程序求矩形周長同上。但是,在這個(gè) 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)站標(biāo)題:Python程序:利用長度和寬度計(jì)算矩形周長
文章出自:http://www.dlmjj.cn/article/dpdjhjc.html