菜单
  • 字节-豆包AI
  • 阿里-通义AI
  • 讯飞-星火AI
  • 百度-文心AI
  • GPT-代码AI
  • 写作助手
  • 论文助手

random.randint(0,2)

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字解答]

相关提问