0

Here is an function to return the maximum value among three positive integers.

Here is an function to return the maximum value among three positive integers. There is an error in this function. Provide an input triple (n1,n2,n3), where n1, n2 and n3 are all positive integers, for which max3bad produces an incorrect output. def max3bad(x,y,z): maximum = 0 if x >= y: if x >= z: maximum = x elif y >= z: maximum = y else: maximum = z return(maximum)

30th Nov 2020, 5:55 AM
srinithi subramanian
srinithi subramanian - avatar
4 Respostas
+ 3
Lothar I think he already did work out something. It is complicated though 😅
30th Nov 2020, 4:21 PM
Tomiwa Joseph
Tomiwa Joseph - avatar
+ 2
srinithi subramanian , please show us your code as it was used to run. In your description, we cannot see indentation. Best way would be to put it in playground and then link it here. Thanks!
30th Nov 2020, 6:06 AM
Lothar
Lothar - avatar
+ 2
What is the issue here? You could also just... def max3bad(a,b,c): return max(a,b,c)
30th Nov 2020, 6:08 AM
Tomiwa Joseph
Tomiwa Joseph - avatar
+ 2
Tomiwa Joseph , nice code from you. But we still do not know the real issue that srinithi subramanian had with his code. I try to get people to work out something on their own.
30th Nov 2020, 9:17 AM
Lothar
Lothar - avatar