av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

Python程序:計算數(shù)字立方

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

寫一個 Python 程序,用算術運算符和函數(shù)計算一個數(shù)的立方,并舉例說明。

尋找數(shù)字立方體的 Python 程序

這個 Python 程序允許用戶輸入任何數(shù)值。接下來,Python 使用算術運算符找到該數(shù)字的立方體。

# Python Program to Calculate Cube of a Number

number = float(input(" Please Enter any numeric Value : "))

cube = number * number * number

print("The Cube of a Given Number {0}  = {1}".format(number, cube))

一個數(shù)字輸出的 Python 立方體

 Please Enter any numeric Value : 5
The Cube of a Given Number 5.0  = 125.0

計算數(shù)字立方的 Python 程序示例 2

這個 Python 立方數(shù)的例子同上,但是在這里,我們使用的是指數(shù)算子。

# Python Program to Calculate Cube of a Number

number = float(input(" Please Enter any numeric Value : "))

cube = number ** 3

print("The Cube of a Given Number {0}  = {1}".format(number, cube))
 Please Enter any numeric Value : 10
The Cube of a Given Number 10.0  = 1000.0

用函數(shù)求數(shù)字立方體的 Python 程序

在這個 Python 程序的立方體編號代碼片段中,我們定義了一個函數(shù),它可以找到給定數(shù)字的立方體。

# Python Program to Calculate Cube of a Number

def cube(num):
    return num * num * num

number = float(input(" Please Enter any numeric Value : "))

cub = cube(number)

print("The Cube of a Given Number {0}  = {1}".format(number, cub))


網(wǎng)站標題:Python程序:計算數(shù)字立方
當前地址:http://uogjgqi.cn/article/dhdejgd.html
掃二維碼與項目經(jīng)理溝通

我們在微信上24小時期待你的聲音

解答本文疑問/技術咨詢/運營咨詢/技術建議/互聯(lián)網(wǎng)交流