新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Python程序:兩個數(shù)相乘
創(chuàng)新互聯(lián)Python教程:

站在用戶的角度思考問題,與客戶深入溝通,找到龍山網(wǎng)站設計與龍山網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗,讓設計與互聯(lián)網(wǎng)技術結(jié)合,創(chuàng)造個性化、用戶體驗好的作品,建站類型包括:網(wǎng)站設計制作、網(wǎng)站設計、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣、域名注冊、虛擬空間、企業(yè)郵箱。業(yè)務覆蓋龍山地區(qū)。
寫一個 Python 程序?qū)蓚€數(shù)字相乘。這個 Python 示例接受兩個整數(shù)值,并計算這兩個數(shù)字的乘積。
num1 = int(input("Please Enter the First Number to Multiply = "))
num2 = int(input("Please Enter the second Number to Multiply = "))
mul = num1 * num2
print('The Result of Multipling {0} and {1} = {2}'.format(num1, num2, mul))
兩個浮點數(shù)相乘的 Python 程序。
num1 = float(input("Please Enter the First Number to Multiply = "))
num2 = float(input("Please Enter the second Number to Multiply = "))
mul = num1 * num2
print('The Result of Multipling {0} and {1} = {2}'.format(num1, num2, mul))
Please Enter the First Number to Multiply = 17.89
Please Enter the second Number to Multiply = 28.56
The Result of Multipling 17.89 and 28.56 = 510.9384Python 程序使用函數(shù)將兩個數(shù)字相乘
def multiplyTwoNum(a, b):
return a * b
num1 = int(input("Please Enter the First Number to Multiply = "))
num2 = int(input("Please Enter the second Number to Multiply = "))
mul = multiplyTwoNum(num1, num2)
print('The Result of Multipling {0} and {1} = {2}'.format(num1, num2, mul))
Please Enter the First Number to Multiply = 12
Please Enter the second Number to Multiply = 19
The Result of Multipling 12 and 19 = 228 本文名稱:Python程序:兩個數(shù)相乘
標題URL:http://fisionsoft.com.cn/article/djcgdos.html


咨詢
建站咨詢
