Basically you are asking the user to input ask_user
amount of integer numbers and then finding the max
number and min
number. Although it is not recommended to code as max=0
and min=999
, what is happening here is whenever a number greater than the current max
value is put in, it replaces the previous max
value with k
. This is the same for min
, whenever a number smaller than current min
value is put in, it replaces the current min
value with k
.
You should actually first get a list of numbers and then use python functions min()/max()
to do this. It is a much better way.
4
solved Min and Max in python? [closed]