0
Please help!! code not understood...its dark here.
def max(x, y): if x >=y: return x else: return y print(max(4, 7)) z = max(8, 5) print(z)
1 Antwort
+ 3
it's really not hard if you analyse it. You created a function max, which returns the bigger one of two numbers. Let me break it down,
'def max(x, y)' this creates function max,
' if x >=y:
return x
else:
return y' This checks for the bigger number between the two numbers given.
'print(max(4, 7))' This calls the function max, and prints out the bigger number i.e '7'
'z = max(8, 5)' This checks for the bigger number between 8 and 5 and assigns the number to z
'print(z)' This prints out the number assigned to z