Adding a number to a list in Python can be done using the append() method or the + operator. Here are two examples:
Example 1:
numbers = [1, 2, 3, 4, 5] numbers.append(6) print(numbers)
Output:
[1, 2, 3, 4, 5, 6]
Example 2:
numbers = [1, 2, 3, 4, 5] numbers = numbers + [6] print(numbers)
Output:
[1, 2, 3, 4, 5, 6]