'Find a maximum element in this list [duplicate]
I have a Python Task for online course on Udacity although I put the right code for the task it still gives me that is wrong answer. Can any one tell me why?? You are required to complete the function maximum(no_list). the function is expected to return the maximum numbers in that list.
Example:
input : [5,20,12,6]
output: 20
no_list = [1,2,3,4]
def maximum(no_list):
#complete the function to return the highest number in the list
print(maximum(no_list))
Solution 1:[1]
Simply return the maxnum instead of printing it
Change print To return
For Example
no_list = [1,2,3,4]
def maximum(no_list):
maxnum= max(no_list)
return maxnum
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Maxwell D. Dorliea |
