For/In Loop Help

Hello! According to the provided solution for the following question, I could use a series of if statements within my function to solve. However, I was wondering if it were possible to shorten the solution with a For/In loop? This is what I have so far:

Am I on the right track? If so, how might I go about finishing it this way?

I ran into another problem where I feel I might be on the right track:

I appreciate any feedback! Thanks :slight_smile:

In Python, break and continue statements can alter the flow of a normal loop. You don’t have a loop, so you can’t use break

also, keep in mind that the list can be of any length.

return does literally what it says: returning/handing back data, which signals that the function is done executing. So the if condition and break code are currently unreachable

2 Likes

For the first question, perhaps value comparisons could be used to find the largest number of the three?

https://docs.python.org/3/reference/expressions.html#comparisons

Ex:

if (num1 > num2) and (num1 > num3): return num1
etc, etc.

1 Like