Write and execute a PYTHON program to perform separate files for each of the tasks
1.Write a program in Python to enter three numbers and find the largest among the three
def findLargest(num1, num2, num3): #user-defined function
# find largest numbers
if (num1 >= num2) and (num1 >= num3):
largest = num1
elif (num2 >= num1) and (num2 >= num3):
largest = num2
else:
largest = num3
return largest #return value
# take inputs
num1 = float(input('Enter first number: '))
num2 = float(input('Enter second number: '))
num3 = float(input('Enter third number: '))
# function call
maximum = findLargest(num1, num2, num3)
# display result
print('The largest number = ',maximum)
Comments
Leave a comment