Answers for "how to write program in python to get the largest nuber"

2

program to find the largest of three numbers in python

# Python program to find the largest number among the three input numbers
# take three numbers from user
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
num3 = float(input("Enter third number: "))

if (num1 > num2) and (num1 > num3):
   largest = num1
elif (num2 > num1) and (num2 > num3):
   largest = num2
else:
   largest = num3

print("The largest number is",largest)
Posted by: Guest on July-24-2020
0

python how to find the highest even in a list

def highest_even(li):
  evens = []
  for item in li:
    if item % 2 == 0:
      evens.append(item)
  return max(evens)

print(highest_even([10,2,3,4,8,11]))


# Building a function to find the highest even number in a list
Posted by: Guest on June-29-2020
0

how to write program in python to get the largest nuber

def max_num_in_list( list ):
    max = list[ 0 ]
    for a in list:
        if a > max:
            max = a
    return max
print(max_num_in_list([1, 2, -8, 0]))
Posted by: Guest on January-27-2021

Code answers related to "how to write program in python to get the largest nuber"

Python Answers by Framework

Browse Popular Code Answers by Language