Topic: Python Program Find Minimum Number From List using prefefined min() function.

# Python program to find smallest # number in a list def main(): # create empty list so that user will input at runtime number_list = [] # ask the user to input n / how many numbers? num = int(input("How many numbers you wish to Enter in list:")) # Use for loop to enter n numbers in the list for i in range(0, num): item = int(input("Enter Number "+str(i+1)+" in List: ")) number_list.append(item) # print minimum number in list using min(list) function print("The enterd List is:",number_list) print("The Minimum number in list is:", min(number_list)) main()

### Output

How many numbers you wish to Enter in list:5 Enter Number 1 in List: 134 Enter Number 2 in List: 23 Enter Number 3 in List: 45 Enter Number 4 in List: 1 Enter Number 5 in List: 7890 The enterd List is: [134, 23, 45, 1, 7890] The Minimum number in list is: 1

587 total views, 2 views today