How can integers be added to a list in Python?
To add integers to a list, you can use the append() method of the list. The append() method can accept parameters of any type and add them to the end of the list.
Here is an example:
numbers = [1, 2, 3, 4, 5]
numbers.append(6)
print(numbers) # 输出: [1, 2, 3, 4, 5, 6]
In this example, we created a list called numbers and added the integer 6 to the list using the append() method. We then printed the contents of the list using the print() function. The output is [1, 2, 3, 4, 5, 6].