Find the largest/smallest number in a list/tuple in Python

Class 11 term 2 Computer Science ( Python) Practical Exercise 1 according to the CBSE Syllabus .Here is to Find the largest/smallest number in a list/tuple. With a simple format of lab practical file we are providing the best in class Knowledge about computer science with Python. Do not write this paragraph the practical starts from below para. I hope the simplicity and knowledge of the website will help you through out class 11.

EXERCISE 1: Find the largest/smallest number in a list/tuple.

List

  • Lists are used to store multiple items in a single variable.
  • Lists are one of 4 built-in data types in Python used to store collections of data, the other 3 are Tuple, Set, and Dictionary, all with different qualities and usage.
  • Lists are created using square brackets.
  • List items are ordered, changeable, and allow duplicate values.
  • List items are indexed, the first item has index [0], the second item has index [1] etc.

Tuple

  • Tuples are used to store multiple items in a single variable.
  • Tuple is one of 4 built-in data types in Python .
  • A tuple is a collection which is ordered and unchangeable.
  • Tuples are written with round brackets.
  • Tuple items are ordered, unchangeable, and allow duplicate values.

Python Code to find the largest/smallest number in a list/tuple.

lst = []
num = int(input('How many numbers: '))
for n in range(num):
    numbers = int(input('Enter number '))
    lst.append(numbers)
print("Maximum element in the list is :", max(lst), "\nMinimum element in the list is :", min(lst))

This code take list of integers.
With the help of loop fills the list.
With the inbuilt command of minimum and maximum prints the numbers.

output/Result

Find the largest/smallest number in a list/tuple in Python

Thank you for visiting and learning. Find the largest/smallest number in a list/tuple is a must program for computer science with Python exam. Python is one of the most powerful language and due to its power it is used widely in Artificial and data analytics. Python is becoming the world most used to language as it has simple syntax and commands. Many of the programs here are been answered by Python Experts.

Computer Science with Python Practical Book Solutions Class 11 Term -2 – CS Study

Leave a Comment

Your email address will not be published.