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 in Python by Arvind
• 2,960 points
16 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 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 in Python by rajesh
• 1,210 points
83 views
0 votes
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 in Python by Mohammad
• 3,060 points
31 views
0 votes
1 answer
+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 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 236 views
+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 in Python by Neel
• 3,010 points
40 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 in Python by Neel
• 3,010 points
24 views