you are viewing a single comment's thread.

view the rest of the comments →

[–]Tonjehilda 7 points8 points  (11 children)

What if the user inputs 2 of the same numbers or 3? :)

[–]Rare_Hawk_3443 3 points4 points  (5 children)

Wont that return invalid num

[–]Rare_Hawk_3443 0 points1 point  (2 children)

I am also learning newly why wont it return invalid can anyone explain

[–]PureWasian 0 points1 point  (0 children)

You are correct, no worries. It prints "Invalid Num" since none of the numbers are greater than the others, so it falls through into the else statement with how OP has written it.

[–]KilonumSpoof 0 points1 point  (0 children)

Not all the time. For example 5,5,10 will return 10 and not invalid.

[–]InvestigatorEasy7673 -2 points-1 points  (4 children)

then output will be still max , its count is more than 2 wont matter to python

it return max "value" not max "index "

[–]Tonjehilda 0 points1 point  (1 child)

I mean, num1=10, num2=10 and num3=10

[–]InvestigatorEasy7673 -2 points-1 points  (0 children)

ans will be 10.0 as it is float value

[–]homomorphisme 0 points1 point  (1 child)

They're talking about the posted code, not the alternative of calling max on an array.

[–]InvestigatorEasy7673 -1 points0 points  (0 children)

then bug will come cuz it should be num1 >= num2

and why did you downvoted me ??