Random numbers ranged 1 to 10 in Python

To get a random number between 1 and 10 in Python, you can use the randint function from the random module:

import random

# Generate a random integer between 1 and 10 (inclusive)
random_number = random.randint(1, 10)

print(random_number)

Explanation

  • random.randint(1, 10) returns a random integer in the range [1, 10], where both 1 and 10 are inclusive.

This will generate a new random number each time you run the code.

댓글

이 블로그의 인기 게시물

Using the MinIO API via curl

max_active_runs of Airflow

Create fixed rounded button by Tailwind

DEFAULT_KEY_SERDE_CLASS_CONFIG in Kafka

Install and run an FTP server using Docker

Getting start with Puppeteer

Chromium development gclient

[Ubuntu] Apache2.4.x 설치

Python program to convert an .xlsx file to JSON using the openpyxl library

Spring Boot with Kafka Streams