В стандартном модуле random есть две очень похожие функции
random.randint()
random.randrange()
Обе возвращают случайное значение из указанного диапазона
>>> random.randint(10, 20)
12
>>> random.randrange(10, 20)
17
В чем же отличие?
Дело в том что у randrange() есть третий параметр step.
randint() действительно возвращает случайное число из указанного диапазона.
randrange() на первый взгляд делает тоже самое если передать также два параметра.
Но есть указать еще и step то наш диапазон усложняется, то есть в него попадёт не полный ряд значений.
Например, я хочу получить случайное значение из диапазона но только чётное число. Тогда достаточно сделать так:
>>> randrange(10, 20, 2)
16
Таким образом получается что randint это частный случай randrange без указания параметра step.
Еще одно важное отличие в том, что randint() включает в диапазон второе значение а randrange() нет. То есть выражение randrange(10, 20) никогда не вернёт 20, а randint(10, 20) вернёт.
#tricks#basic
#mdx
This free interactive course teaches Product Managers to use Claude Code for daily tasks like processing notes, writing PRDs, analyzing data, and strategy planning through hands-on modules (4-6 hours). Clone the repo, run `claude`, and follow guided lessons with agents and file tools—no setup needed yet. You'll work faster, get instant multi-perspective feedback, and boost productivity without quality loss.
https://github.com/carlvellotti/claude-code-pm-course
#MDX result
1 and 2 target achieved in just 1 house 21 minutes ✅
One more huge quick profit 11%🤑💰🤑
👉 Still thinking? The more you wait more you lose profit
☎️ Contact @MichaelStrategiesVip for membership and grab next breakout signal
#MDX bounced back from the Trendline on 6H Time frame,we expect a good bullish momentum from the Green zone,send it to the moon 🚀
❄️@signals_bitcoin_crypto❄️
❄️@Shadow_support0o❄️