1# Python program to find the largest number among the three input numbers
2# take three numbers from user
3num1 = float(input("Enter first number: "))
4num2 = float(input("Enter second number: "))
5num3 = float(input("Enter third number: "))
6
7if (num1 > num2) and (num1 > num3):
8 largest = num1
9elif (num2 > num1) and (num2 > num3):
10 largest = num2
11else:
12 largest = num3
13
14print("The largest number is",largest)
15
1def highest_even(li):
2 evens = []
3 for item in li:
4 if item % 2 == 0:
5 evens.append(item)
6 return max(evens)
7
8print(highest_even([10,2,3,4,8,11]))
9
10
11# Building a function to find the highest even number in a list
12
1def max_num_in_list( list ):
2 max = list[ 0 ]
3 for a in list:
4 if a > max:
5 max = a
6 return max
7print(max_num_in_list([1, 2, -8, 0]))
8
9