Accountancy, asked by kanu3804, 9 days ago

Rwite a program that finds teh smallest among the five integer inputted by the user

Answers

Answered by Equestriadash
0

Co‎de:

\tt l\ =\ list()\\for\ i\ in\ range(5):\\{\ \ \ \ \ }n\ =\ int(in put("Enter\ a\ number:\ "))\\{\ \ \ \ \ }l.append(n)\\print(min(l),\ "is\ the\ smallest\ number\ among\ the\ 5\ numbers\ entered.")

Explanation:

We create a list for the numbers that are going to be entered by the user. A \tt for loop is initiated, which will run 5 times, obtaining 5 numbers from the user. As the numbers are being entered, the numbers get added to the list earlier created for the same, using the \tt append() method. The smallest value is printed using the \tt max() function along with an appropriate \tt print() statement.

Similar questions