Computer Science, asked by bindushree716, 3 months ago

find the largest/smallest number in a list/tuple in python

Answers

Answered by Khadijah21
27

Answer:

Given in image.

HOPE THAT THIS HELPS YOU.

Attachments:

sakshi8334: val = eval (input ("Enter a list :"))

print("The list is :", val)

mx = max(val) =

mn = min(val)

print("Maximum number in the list :", mx) print("Minimum number in the list :", mn)
Answered by monica789412
10

Python program to find the Smallest and the largest number present inside the list.

Algorithm:

  1. Ask for the size of the list using input( ).
  2. Initialize the empty list lst=[ ].
  3. Read numbers by using for loop.
  4. Each number is append( ) into the list inside the for loop.
  5. To find the largest and smallest element present in the list use function max( ) and min( ) respectively.

Program in python:

Numlist = [ ]

n = int(input('List Size: '))

for n in range(n):

   numbers = int(input('Enter number '))

   lst.append (numbers)

print( max(Numlist))

print( min(Numlist))

Similar questions