WRITE it in Python! how to Write a method named smallest largest that asks the user to enter numbers, then prints the smallest and largest of all the numbers typed in by the user. You may assume the user enters a valid number greater than 0 for the number of numbers to read. Here is an example dialogue: How many numbers do you want to enter? 4 Number 1: 5 Number 2: 11 Number 3: -2 Number 4: 3 Smallest = -2 Largest = 11
#Python program to find smallest and largest numbers from the user input numbers
n = int(input("How many numbers do you want to enter: "))#input
for number of numbers
nums =
[]
#list to store all the input numbers
for i in range(n):
print("Number {}:".format(i+1),end =
"")
nums.append(int(input()))
#store the inputs from the user in 'nums' list
print("Smallest = {}".format(min(nums)))#print the smallest
number
print("Largest = {}".format(max(nums)))#print the largest
number
// Please upvote for the answer //
Get Answers For Free
Most questions answered within 1 hours.