Yashotantra Academy
AI · Blockchain · Cloud · Data
Dark mode active
Learn
Tracks
ABCD
Certification
More
▾
Dark mode active
Learn
Tracks
ABCD
Certification
Study
Theory
Code Lab
Build
Solidity IDE
Staking Sandbox
Simulation
Reference
Wallets
Gas Fees
Explorers
← Code Lab
Python
0/50 solved · 0%
All lessons
lesson
code
Collections · easy
6. Lists
Index, append, and slice.
Write `first_and_last(items)` returning a two-element list `[items[0], items[-1]]`.
Required in your answer:
def first_and_last
Reveal solution
Run & check
Reset
Runs via Pyodide
def first_and_last(items): # TODO pass
Output appears here.
← 5. for loops and range
7. Dictionaries →