What is the difference between append() and extend() in Python lists?

Gihin Oha
Membro
Iscritto: 2025-02-16 08:26:47
2025-02-16 09:15:48

I’ve been using Python lists for a while, but I’m confused about the difference between the append() and extend() methods. I know both modify the list, but when should I use one over the other? Can someone explain the difference with a simple example?