酷代码 AI
菜单
服务商
DeepSeek字节豆包讯飞星火
更多选项

"Unleash Randomness: How to Use Python's random.randint(0, 2) Function"

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. ######[AI写代码神器 | 117点数解答 | 2024-11-29 18:33:24]

相关提问
本站限时免费提问中
实用工具查看更多
Linux在线手册 [开发类]
Jquery在线手册 [开发类]
今日油价 [生活类]
图片互转base64 [开发类]
时间转换器 [开发类]