0
Whats wrong here?
# I want to print minimum Digi in list but can't.it worked for maximum Digit. num=(10,4,8,-2,10,45) for number in num: min= num if number<min: min=number print(min)
9 Respuestas
+ 5
You are not far away. Try this:
num=(10,4,8,-2,10,45)
min = num[0]
for number in num:
if number<min:
min=number
print(min)
To get it work for max is your turn now.
+ 7
See if this answers your question :
https://code.sololearn.com/c3pAB35qDKp4/?ref=app
+ 6
I am not sure what your question means. Sorry - can you explain me? Thanks!
0
Lothar
I got it.thanks
Just a quick Q. Is there anything to do with sequence which condition u put first?
0
Lothar i mean my code looks similar to yours,you just rearranged the line! Is there anything to do with it?
0
Nuke, to start you have to set a hipothetical min(or max) value outside the loop then in each step each value is compared with the last result.