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

Fundamentals of English Grammar #1

리눅스의 부팅과정 (프로세스, 서비스 관리)

How to checkout branch of remote git, 깃 리모트 브랜치 체크아웃

CDPEvents in puppeteer

In HBase, the "memory to disk" flush operation

Chromium 개발 환경 세팅, 크로미움 개발 준비하기

To switch to a specific tag in a Git repository

urllib3 with proxy settings

To download a file from MinIO using Spring Boot, 스프링부트 Minio 사용하기