Answers for "how to find largest number in list python without max"

5

Write a function that returns the largest element in a list

def return_largest_element(array):
    largest = 0
    for x in range(0, len(array)):
        if(array[x] > largest):
            largest = array[x]
    return largest
Posted by: Guest on May-31-2020
4

how to find highest number in list without using max function python

Numbers = [90,78,34,50,100,99]
higest_number = 0
for number in Numbers:
    if number > higest_number:
        higest_number = number
Posted by: Guest on August-01-2021
4

find max value in list python

mylist = [1, 7, 3, 12, 5]

min_value = min(mylist)
max_value = max(mylist)
Posted by: Guest on April-22-2021
0

how to find largest number in list python without max

l=[]
n=int(input("enter the upper limit"))
for i in range(0,n):
  a=int(input("enter the numbers"))
  l.append(a)
maxno=l[0]
i=0
while i<n:
    if l[i]>maxno:
        a=l[i]
        i=i+1
    elif l[i]>maxno:
        b=l[i]
        i=i+1
        print("max no is :",b)
        break
    else:
        print("max no is",a)
        break
#without using function i am just a beginner
#need improvement to shorten the code but plz without any function
Posted by: Guest on July-05-2021
0

how to find largest number in list python without max

n = int(input("Enter number of elements : "))
l = []
new=[]
dope = 0
for i in range(n):
    l.append(int(input("Enter a number: ")))
print(l)
for i in l :
    first = i
    count=0
    for x in l:
        if x == first:
            count+=1

    new.append(count)
k=new[0]
print(new)
for i in new:

    if i >=k:
        dope = l[i]



print(dope)
Posted by: Guest on August-13-2021

Code answers related to "how to find largest number in list python without max"

Python Answers by Framework

Browse Popular Code Answers by Language