Largest Element in List
Advanced
Find the Largest Element in a List
Hello young coders! Today, your mission is to find the largest number in a list. Imagine you have a bag of magical items, and each item has a power level (which is simply a number). Your job is to use your coding skills to identify the item with the highest power level! Isn't that exciting?
Your task is to write a function largest_element_in_list(numbers) that will take a list of numbers as an argument and return the largest number from that list.
Examples
Here is what your function should do:
# Example 1 print(largest_element_in_list([3, 41, 12, 9, 74, 15])) # Output should be: 74 # Example 2 print(largest_element_in_list([5, 17, 2, -1, 34, 0])) # Output should be: 34 # Example 3 print(largest_element_in_list([20])) # Output should be: 20
Remember, you may find helpful Python built-in functions like max() for this task. But feel free to experiment and come up with alternative solutions.
Let's use our brain power and programming skills to master this challenge! Have fun coding!
Inputs
Arg 1:
[3,41,12,9,74,15]Expected Output
74Actual Output