About 5,750,000 results
Open links in new tab
  1. Python Program to Find Largest among N numbers

    Learn about python program to find largest among N numbers with examples using sorted(), max() and reduce() methods to find maximum number

  2. Python program to find N largest elements from a list

    May 17, 2023 · Given a list of integers, the task is to find N largest elements assuming size of list is greater than or equal o N. Examples : N = 2. N = 3. A simple solution traverse the given list N times. In every traversal, find the maximum, add it to result, and remove it from the list. Below is the implementation : Output :

  3. Python Program to Find Largest Number in a List

    Oct 21, 2024 · Python provides a built-in max () function that returns the largest item in a list or any iterable. The time complexity of this approach is O (n) as it traverses through all elements of an iterable. Explanation: max (a): This function takes the list ‘a’ …

  4. python - Find the greatest (largest, maximum) number in a list of ...

    Mar 8, 2023 · Direct approach by using function max () max () function returns the item with the highest value, or the item with the highest value in an iterable. Example: when you have to find max on integers/numbers. Example: when you have string. It basically returns the name with the highest value, ordered alphabetically.

  5. Python Program to Find Largest/Maximum of n Numbers

    Nov 3, 2022 · Python program to find largest of n numbers without using built-in function. Take input number for the length of the list using python input() function. Initialize an empty list lst = []. Read each number in your python program using a for …

  6. find the largest of n numbers using a user defined functions largest

    Jan 13, 2023 · In the above python program to find the largest of n numbers using a user defined functions largest () we have defined a user defined function largest(n, nums) which takes two arguments, first one is the number of elements n and second is a list nums of numbers.

  7. Python Program to Find Smallest and Largest Number - PYnative

    Mar 31, 2025 · Explanation. We have defined two functions, find_smallest() function to find the minimum value and find_largest() function to find the maximum value. find_smallest() function: Compares num1 with num2 and num3.; If num1 is the smallest, it is returned.; Otherwise, it checks if num2 is smaller than num3, then num2 is returned.; If neither of those conditions is met, num3 is the smallest.

  8. Find Largest Number in List Using While Loop In Python

    Now we are going to find the largest number in a list using a while loop in Python: if my_list[i] > largest_num: largest_num = my_list[i] i += 1. # check if the current element is greater than the largest_num variable. if my_list[i] > largest_num: # update the largest_num variable to the current element. largest_num = my_list[i]

  9. Python program to find largest of n numbers using for loop

    Dec 17, 2021 · Using any one method either max() function or for loop, you can write a program to find the largest of n numbers in Python.

  10. Python Program to find N largest numbers in a list

    This tutorial will show you how to find the ‘n’ largest numbers in a list using Python. We are taking inputs from the user. But if you wish to do this without taking input from the user, you can also do this.

  11. Some results have been removed
Refresh