Class 10 Exam  >  Class 10 Questions  >  Write a Python program to find the maximum an... Start Learning for Free
Write a Python program to find the maximum and minimum number in a list of numbers/tuple?
Most Upvoted Answer
Write a Python program to find the maximum and minimum number in a lis...
# Python program to find the maximum and minimum number in a list of number/ tuple
# entering a list of number from user
list1=eval(input (" enter or list of number"))
length=len (list1)
# finding the maximum number and minimum number in the list
for i in range(0, length) :
maximum=max(list1)
minimum=min(list1)
# displaying maximum and minimum number
print (" the maximum number in the list is:", maximum)
print(" the minimum number in the list is:", minimum)
Community Answer
Write a Python program to find the maximum and minimum number in a lis...
Introduction:
Python is a popular programming language widely used in various domains, including data science, web development, machine learning, and artificial intelligence. In this article, we will explore how to find the maximum and minimum number in a list of numbers/tuple using Python.

Steps to find the maximum and minimum number:
To find the maximum and minimum number in a list of numbers/tuple using Python, follow the steps below:

1. Create a list/tuple of numbers.
2. Initialize two variables, one for storing the maximum number and the other for storing the minimum number.
3. Iterate over the list/tuple using a loop.
4. Compare each number in the list/tuple with the maximum and minimum number variables.
5. Update the maximum and minimum number variables accordingly.
6. Print the maximum and minimum number.

Python code to find the maximum and minimum number:
Here is the Python code to find the maximum and minimum number in a list/tuple:

```
# create a list/tuple of numbers
numbers = [1, 2, 3, 4, 5]

# initialize maximum and minimum number variables
max_number = numbers[0]
min_number = numbers[0]

# iterate over the list/tuple
for number in numbers:
# compare each number with the maximum number variable
if number > max_number:
max_number = number

# compare each number with the minimum number variable
if number < />
min_number = number

# print the maximum and minimum number
print("Maximum number:", max_number)
print("Minimum number:", min_number)
```

Conclusion:
In this article, we have learned how to find the maximum and minimum number in a list/tuple using Python. We have explained the steps involved in finding the maximum and minimum number and provided Python code for the same.
Attention Class 10 Students!
To make sure you are not studying endlessly, EduRev has designed Class 10 study material, with Structured Courses, Videos, & Test Series. Plus get personalized analysis, doubt solving and improvement plans to achieve a great score in Class 10.
Explore Courses for Class 10 exam

Top Courses for Class 10

Write a Python program to find the maximum and minimum number in a list of numbers/tuple?
Question Description
Write a Python program to find the maximum and minimum number in a list of numbers/tuple? for Class 10 2024 is part of Class 10 preparation. The Question and answers have been prepared according to the Class 10 exam syllabus. Information about Write a Python program to find the maximum and minimum number in a list of numbers/tuple? covers all topics & solutions for Class 10 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Write a Python program to find the maximum and minimum number in a list of numbers/tuple?.
Solutions for Write a Python program to find the maximum and minimum number in a list of numbers/tuple? in English & in Hindi are available as part of our courses for Class 10. Download more important topics, notes, lectures and mock test series for Class 10 Exam by signing up for free.
Here you can find the meaning of Write a Python program to find the maximum and minimum number in a list of numbers/tuple? defined & explained in the simplest way possible. Besides giving the explanation of Write a Python program to find the maximum and minimum number in a list of numbers/tuple?, a detailed solution for Write a Python program to find the maximum and minimum number in a list of numbers/tuple? has been provided alongside types of Write a Python program to find the maximum and minimum number in a list of numbers/tuple? theory, EduRev gives you an ample number of questions to practice Write a Python program to find the maximum and minimum number in a list of numbers/tuple? tests, examples and also practice Class 10 tests.
Explore Courses for Class 10 exam

Top Courses for Class 10

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev