{"id":10389,"date":"2021-09-30T16:30:19","date_gmt":"2021-09-30T11:00:19","guid":{"rendered":"https:\/\/python-programs.com\/?p=10389"},"modified":"2021-11-22T18:34:24","modified_gmt":"2021-11-22T13:04:24","slug":"python-program-to-find-the-largest-number-in-a-list","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-find-the-largest-number-in-a-list\/","title":{"rendered":"Python Program to Find the Largest Number in a List"},"content":{"rendered":"

Lists in Python:<\/strong><\/p>\n

Lists are one of Python’s most commonly used built-in data structures. You can make a list by putting all of the elements inside square brackets[ ] and separating them with commas. Lists can include any type of object, making them extremely useful and adaptable.<\/p>\n

Given a list, the task is to find the largest number in the given list in Python.<\/p>\n

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

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

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

given list =[1, 1, 2, 3, 4, 5, 7, 9, 15, 18, 18, 18, 26, 27, 34, 36, 47, 47, 52, 64, 65, 82, 82, 189, 274, 284, 467, 677,\r\n                   871, 873, 876, 947, 1838, 2954, 5123]<\/pre>\n

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

The largest element present in the given list [1, 1, 2, 3, 4, 5, 7, 9, 15, 18, 18, 18, 26, 27, 34, 36, 47, 47, 52, 64, 65, 82,\r\n82, 189, 274, 284, 467, 677, 871, 873, 876, 947, 1838, 2954, 5123] = 5123<\/pre>\n

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

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

given list =[1, 2, 4, 8, 9, 11, 12, 13, 15, 15, 17, 18, 23, 23, 25, 28, 29, 31, 34]<\/pre>\n

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

The largest element present in the given list [1, 2, 4, 8, 9, 11, 12, 13, 15, 15, 17, 18, 23, 23, 25, 28, 29, 31, 34] = 34<\/pre>\n

Program to Find the Largest Number in a List in Python<\/h2>\n

There are several ways to find the largest element\/item in the given list some of them are:<\/p>\n