给定三个数字ab和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