How to find the greatest number in a list in Python?

0 votes
Is there any easy way or a builtin function to determine the greatest number in a python list? Can we find it without using builtin functions?
Aug 21, 2019 in Python by Arvind
• 2,980 points
90 views

1 answer to this question.

0 votes

1. By using max function - 

highest = max(11, 21, 31) 
print(highest) # prints 31

2. Without using max function

a=[11,22,33,44,66,77,99,88,999]
max= 0
for i in a:
    if i > max:
        max=i
print(max) # prints 999
answered Aug 21, 2019 by Neel
• 3,010 points

Related Questions In Python

–1 vote
2 answers

How to find the size of a string in Python?

following way to find length of string  x ...READ MORE

answered Mar 29, 2019 in Python by rajesh
• 1,230 points
255 views
+1 vote
1 answer
0 votes
1 answer

How can I find the square of a number in python?

You can use the exponentiation operator or ...READ MORE

answered May 20, 2019 in Python by Mohammad
• 3,210 points
110 views
0 votes
1 answer

How to find the value of a row in a csv file in python?

If you want to find the value ...READ MORE

answered May 20, 2019 in Python by Sanam
187 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,192 views
0 votes
0 answers
+4 votes
6 answers
0 votes
1 answer

How to get permutations of list or a set in Python?

Permutation is an arrangement of objects in ...READ MORE

answered Jul 11, 2019 in Python by Neel
• 3,010 points
2,421 views
0 votes
1 answer

How to add elements to a list in Python?

To initialize an empty list do this: new_list ...READ MORE

answered Jul 23, 2019 in Python by Neel
• 3,010 points
55 views