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.

댓글

이 블로그의 인기 게시물

Tomcat(톰캣) SSL 포트 설정

How to split a list into chunks of 100 items in JavaScript, 자바스크립트 리스트 쪼개기

How to catch exceptions on Future in Java, 자바 Future 에러 잡기

Using the MinIO API via curl

운영체제를 개발 방법

dagrun_timeout of Airflow

What are 5 creative things I could do with my kids' art, 아이와 함께하는 창의적 놀이

In HBase, the "memory to disk" flush operation

[OS_Linux_Ubuntu] telnet & ssh 설치와 설정 (installation / configuration)

[Ubuntu] *.deb 파일 설치 방법