{"id":16152,"date":"2021-08-12T09:36:55","date_gmt":"2021-08-12T04:06:55","guid":{"rendered":"https:\/\/python-programs.com\/?p=16152"},"modified":"2021-11-22T18:38:26","modified_gmt":"2021-11-22T13:08:26","slug":"python-program-to-get-the-position-of-max-value-in-a-list","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-get-the-position-of-max-value-in-a-list\/","title":{"rendered":"Python Program to Get the Position of Max Value in a List"},"content":{"rendered":"

In the previous article, we have discussed Python Program to Find Vertex, Focus and Directrix of Parabola<\/a>
\nmax() function :<\/strong><\/p>\n

max() is a built-in function that returns the maximum value in a list.<\/p>\n

index() function:<\/strong><\/p>\n

This function searches the lists. It returns the index where the value is found when we pass it as an argument that matches the value in the list. If no value is found, Value Error is returned.<\/p>\n

Given a list, the task is to Get the position of Max Value in a List.<\/p>\n

Examples:<\/strong><\/p>\n

Example 1 :<\/strong><\/p>\n

Input :<\/strong><\/p>\n

Given List = [1, 5, 9, 2, 7, 3, 8]<\/pre>\n

Output:<\/strong><\/p>\n

Maximum Value in the above Given list = 9\r\nPosition of Maximum value of the above Given List = 3<\/pre>\n

Example 2 :<\/strong><\/p>\n

Input :\u00a0<\/strong><\/p>\n

Given List = [4, 3, 7, 1, 2, 8, 9]<\/pre>\n

Output:<\/strong><\/p>\n

Maximum Value in the above Given list = 9\r\nPosition of Maximum value of the above Given List = 7<\/pre>\n

Program to Get the Position of Max Value in a List<\/h2>\n

Below are the ways to Get the Position of Max value in a List.<\/p>\n