The `random.randint(0, 2)` function in Python generates a random integer between 0 and 2, inclusive. Here's how you can use it: ```python import random # Generate a random integer between 0 and 2 random_number = random.randint(0, 2) print(random_number) ``` Each time you run this code, `random_number` will be assigned a value of either 0, 1, or 2. [2024-11-29 18:33:24 | 酷代码 | 117字解答]