Python 程序三个数的最大值。
给定三个数 a b 和 c,我们的任务是找出给定数中的最大元素。
实例
Input: a = 2, b = 4, c = 3 Output: 4
算法
Step 1: input three user input number. Step2: Add three numbers to list. Step 3: Using max() function to find the greatest number max(lst). Step 4: And finally we will print maximum number.
示例代码
def maximum(a, b, c): list = [a, b, c] return max(list) # Driven code x = int(input("Enter First number")) y = int(input("Enter Second number")) z = int(input("Enter Third number")) print("Maximum Number is ::>",maximum(x, y, z))
输出
Enter First number 56 Enter Second number 90 Enter Third number 67 Maximum Number Is ::> 90
广告