How do you determine the highest number in lists.. Like for example: for a in [55,6,7,32,12]… need to print the largest only | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do you determine the highest number in lists.. Like for example: for a in [55,6,7,32,12]… need to print the largest only

for loop pin python 3

14th Mar 2018, 8:57 AM
sam navalta
sam navalta - avatar
6 Answers
+ 4
You can use min & max to get least and largest value off a list, as follows: a=[3,9,45,72,1] print("Max value: ", max(a)) print("Min value: ", min(a)) Hth, cmiiw
14th Mar 2018, 9:04 AM
Ipang
+ 2
is it the same with the command for a in[5,76,87,8,]: ? ?? its in our ass hahaha...
14th Mar 2018, 9:08 AM
sam navalta
sam navalta - avatar
+ 1
You're welcome mate, glad if it helps : )
14th Mar 2018, 9:09 AM
Ipang
+ 1
@sam what u do with for loops... its same as that.. the max min function.. difference is its already implemented in py-package.... use it.. but first do on ur own using loops..
14th Mar 2018, 1:31 PM
sayan chandra
sayan chandra - avatar
0
i already got it thank you guys
15th Mar 2018, 4:29 AM
sam navalta
sam navalta - avatar
0
by max(a)
15th Mar 2018, 8:53 AM
md zubair
md zubair - avatar