← Back to challenges

Return the First Element in a List

PythonMediumarrayslanguage_fundamentals

Instructions

Create a function that takes a list containing only numbers and return the first element.

Examples

get_first_value([1, 2, 3]) ➞ 1

get_first_value([80, 5, 100]) ➞ 80

get_first_value([-500, 0, 50]) ➞ -500

Notes

The first element in a list always has an index of 0.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Football Points