Home / Python Tutorial / Day 4
Day 4 — Python lists explained
A list is Python holding many values under one name. It is the closest thing to an Excel column.
Making a list
Getting items out
Changing a list
Sorting
sorted() vs .sort()
sorted(x) gives you a new list and leaves the original alone. x.sort() rearranges the original and returns nothing. Mixing these up is a classic bug.The numbers you actually want
That block is a complete summary report in six lines. It is why Python is worth learning for MIS work.
Checking membership
Lists can hold anything
Try these yourself
- Make a list of five numbers and print the total and average.
- Add a city to a list, then remove a different one.
- Print the highest and lowest of [12, 45, 3, 78, 22].
- Sort ["Ravi", "Amit", "Neha"] alphabetically.
Ready for pandas and real projects?
This tutorial covers core Python. Our Data Analytics course takes you into pandas, NumPy, real files and visualisation, with mentor support and portfolio projects.
See the course →