You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a simple way to execute this function without literally going through every single parameter and saying if a > b and a > c... etc (without using a list or array)? I've been looking at this and cannot think of how to simplify the code without going into subjects we haven't covered yet. Thanks.
This is literally the extent of code I had to use to correctly run the function and I know it is very inefficient:
(with all of the correct indentation)
def greatest_parameter(a, b, c, d, e):
if a > b and a > c and a > d and a > e:
return a
else:
if b > c and b > d and b > e:
return b
else:
if c > d and c > e:
return c
else:
if d > e :
return d
else:
return e
The text was updated successfully, but these errors were encountered:
Is there a simple way to execute this function without literally going through every single parameter and saying if a > b and a > c... etc (without using a list or array)? I've been looking at this and cannot think of how to simplify the code without going into subjects we haven't covered yet. Thanks.
This is literally the extent of code I had to use to correctly run the function and I know it is very inefficient:
(with all of the correct indentation)
def greatest_parameter(a, b, c, d, e):
if a > b and a > c and a > d and a > e:
return a
else:
if b > c and b > d and b > e:
return b
else:
if c > d and c > e:
return c
else:
if d > e :
return d
else:
return e
The text was updated successfully, but these errors were encountered: