I’m python newbie and got a problem while doing some practices.
Below is the code that I’ve got so far:
def gt(nums, n):
for c in nums:
if n < c:
return True
elif c < n:
return False
else:
break
With above code, it does not return properly.
The examples of correct answers here:
gt([1,2,3],3) => False
gt([1,2,3],2) => True
A simpler and more readable solution would be the following: