Python-Minimum of 3 numbers

Write a program to find the minimum of three numbers

# Program to find the minimum of three numbers#
# Author: Mukesh N Tekwani
# prompt for and inputs three values
# input() function accepts a string 
# int() function converts that string to an integer

number1 = int(input('Enter first integer: '))   
number2 = int(input('Enter second integer: '))
number3 = int(input('Enter third integer: '))

minimum = number1   #assume the first number is the smallest

#compare the second number with minimum
if number2 < minimum:
    minimum = number2    

#compare the third number with minimum
if number3 < minimum:
    minimum = number3

print('Minimum value is', minimum)
#EndOfProgram
Advertisements