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.

댓글

이 블로그의 인기 게시물

Sparse encoder

To build a gRPC service with Gradle, Java, and Avro

Using venv in Python

how to delete doc of datastream in elasticsearch, 엘라스틱서치 데이터스트림 도규먼트 삭제하기

Typescript interface, 타입스크립트 인터페이스

Read a file in Java, 자바 파일 읽기

kubernetes cronjob logs

max_active_runs of Airflow

configure telnet server, 텔넷 서버 설정하기

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