To add the value 25
to a list, we code the list name followed by a period .
, then the instruction append(25)
.
scores = [24, 23]
scores.append(25)
print(scores)
Adding a value with .append()
places it at the end of the list. We can see the result here by coding print(users)
.
users = ["john", "hannah", "marco"]
users.append("julian")
print(users)