34 - Write a program in Python to Input a list of numbers and find the smallest number in a list.
L=[]
c='y'
while
c=='y' or c=='Y':
a=int(input("Enter an integer number to append in the list:
"))
L.append(a)
c=input("Do you want to add more elements in the list (Y/N):
")
print("List
is: \n", L)
print("Minimum(Smallest) number of the list = ",min(L))
Output:
Enter an integer number to append in the list: 5
Do you want to add more elements in the list (Y/N): y
Enter an integer number to append in the list: 8
Do you want to add more elements in the list (Y/N): y
Enter an integer number to append in the list: 2
Do you want to add more elements in the list (Y/N): y
Enter an integer number to append in the list: 9
Do you want to add more elements in the list (Y/N): y
Enter an integer number to append in the list: 4
Do you want to add more elements in the list (Y/N): n
List is:
[5, 8, 2, 9, 4]
Minimum(Smallest) number of the list = 2
No comments:
Post a Comment