Answers for "find 3rd largest number in array in python"

1

python find in largest 3 numbers in an array

array = [1, 2, 3, 4, 5, 6, 7, 8, 9, ]
result = []
num = int(input('Enter N: '))

for x in range(0, num):
    largeNum = 0
    for y in range(len(array)):
        if array[y] > largeNum:
            largeNum = array[y]
    array.remove(largeNum)
    result.append(largeNum)

print(result)
Posted by: Guest on October-31-2020
0

find the largest and smallest numbers in a list

thislist = [677,8765,8765,876,470,754,6784,56789,7658,]
thislist.sort()
print ("The smallest number is: " + str(thislist[0]))
print ("The largest number is: " + str(thislist[-1]))
Posted by: Guest on June-03-2021

Code answers related to "find 3rd largest number in array in python"

Python Answers by Framework

Browse Popular Code Answers by Language