Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Python Tutorial
  • Interview Questions
  • Python Quiz
  • Python Glossary
  • Python Projects
  • Practice Python
  • Data Science With Python
  • Python Web Dev
  • DSA with Python
  • Python OOPs
Open In App
Next Article:
Python min() Function
Next article icon

Python List max() Method

Last Updated : 17 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

max() function in Python is a built-in function that finds and returns the largest element from the list. Let's understand it better with an example:

Python
a = [2,3,6,1,8,4,9,0] print(max(a)) 

Output
9 

Syntax

max(listname)

Parameter:

  • listname : Name of list in which we have to find the maximum value.

Return Type: It return the maximum value present in the list.

Python List max() Method Example

Lets look at some examples to find max element in Python list:

Example 1: Finding Maximum in a List of Integers

In this example, we will find the maximum value from a list containing integers using Python's max() method.

Python
a = [4, -4, 8, -9, 1] res = max(a)  print(res) 

Output
8 

Explanation: The max() function is used to find the largest value in the list a. It compares all elements and returns the highest value. The result is stored in the variable res, which is then printed.

Example 2: Finding Maximum in a List of Characters

In this example, we are going to find the maximum value from the list of characters. This is done by following same procedure as in example 1.

Python
a = ['a', '$', 'e', 'E'] res = max(a) print(res) 

Output
e 

Explanation: In this case of character values the max value is determined on the basis of their ASCII values. For example ASCII value of 'e' is 101 and 'E' is 69 therefore 'e' is larger.

Example 3: Finding Maximum in a List with Mixed Data Types

In this example, we are going to try to find the maximum value from the list of mixed values such as integers and strings.

Python
a = ['!', '$', '/', '3', '61'] res = max(a) print(res) 

Output
61 

Explanation: In the ASCII table, digits '0' to '9' have values from 48 to 57. Since all elements in the list are strings, max() compares them based on the first character's ASCII value. For example, '61' starts with '6', which has a higher value than '3' or '1'. If the list had '16' instead of '61', then '3' would be the maximum, because '1' (from '16') has a lower ASCII value than '3'.

Related Articles:

  • ASCII Values Alphabets
  • Python String
  • Python Numbers
  • Python Tutorial

Next Article
Python min() Function

K

kamalsagar
Improve
Article Tags :
  • Python
  • python-list
  • python-list-functions
Practice Tags :
  • python
  • python-list

Similar Reads

  • Python List methods
    Python list methods are built-in functions that allow us to perform various operations on lists, such as adding, removing, or modifying elements. In this article, we’ll explore all Python list methods with a simple example. List MethodsLet's look at different list methods in Python: append(): Adds a
    3 min read
  • Python List append() Method
    append() method in Python is used to add a single item to the end of list. This method modifies the original list and does not return a new list. Let's look at an example to better understand this. [GFGTABS] Python a = [2, 5, 6, 7] # Use append() to add the element 8 to the end of the list a.append(
    3 min read
  • Python List extend() Method
    In Python, extend() method is used to add items from one list to the end of another list. This method modifies the original list by appending all items from the given iterable. Using extend() method is easy and efficient way to merge two lists or add multiple elements at once. Let’s look at a simple
    2 min read
  • Python List index() - Find Index of Item
    index() method in Python is a helpful tool when you want to find the position of a specific item in a list. It works by searching through the list from the beginning and returning the index (position) of the first occurrence of the element you're looking for. Example: [GFGTABS] Python a = ["cat
    3 min read
  • Python List max() Method
    max() function in Python is a built-in function that finds and returns the largest element from the list. Let's understand it better with an example: [GFGTABS] Python a = [2,3,6,1,8,4,9,0] print(max(a)) [/GFGTABS]Output9 Syntaxmax(listname) Parameter: listname : Name of list in which we have to find
    4 min read
  • Python min() Function
    Python min() function returns the smallest value from a set of values or the smallest item in an iterable passed as its parameter. It's useful when you need to quickly determine the minimum value from a group of numbers or objects. For example: [GFGTABS] Python a = [23,25,65,21,98] print(min(a)) b =
    4 min read
  • How To Find the Length of a List in Python
    The length of a list refers to the number of elements in the list. There are several methods to determine the length of a list in Python. For example, consider a list l = [1, 2, 3, 4, 5], length of this list is 5 as it contains 5 elements in it. Let's explore different methods to find the length of
    2 min read
  • Python List pop() Method
    The pop() method is used to remove an element from a list at a specified index and return that element. If no index is provided, it will remove and return the last element by default. This method is particularly useful when we need to manipulate a list dynamically, as it directly modifies the origin
    2 min read
  • Python List remove() Method
    Python list remove() function removes the first occurrence of a given item from list. It make changes to the current list. It only takes one argument, element we want to remove and if that element is not present in the list, it gives ValueError. Example: [GFGTABS] Python a = ['a', 'b
    3 min read
  • Python List Reverse()
    The reverse() method is an inbuilt method in Python that reverses the order of elements in a list. This method modifies the original list and does not return a new list, which makes it an efficient way to perform the reversal without unnecessary memory uses. Let's see an example to reverse a list us
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences