Notice
Recent Posts
Recent Comments
Link
250x250
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- react
- Algorithm
- mysql
- php
- data structure
- DATAPATH
- instruction
- github
- system
- openai
- DB
- Java
- Rag
- computer
- DS
- control
- AI
- python
- Class
- web
- function
- for
- html
- Linux
- Pipelining
- XML
- MIPS
- CSS
- javascript
- architecture
Archives
- Today
- Total
YYYEJI
[Python] Random 모듈 본문
728x90

모듈(module)이란?
모듈이란 함수나 변수 또는 클래스를 모아 놓은 파일입니다.
Random 모듈을 이용하기 위해서는 Random을 import 해줘야됩니다.
import random
• Random 모듈은 난수를 발생시킵니다.
import random
print(random.random()) # Floating point
print(random.randrange(1, 10)) # integer
alphabet = ['a', 'b', 'c']
random.shuffle(alphabet)
print(alphabet) # Change the order of values in a list
print(random.choice(alphabet)) # Character



◡̈
728x90
'Python' 카테고리의 다른 글
| [Python] Conda 명령어 정리 (0) | 2022.11.03 |
|---|---|
| [Python] 맥(MacOS)에서 Conda 설치하기 (0) | 2022.11.03 |
| [Python] datetime 모듈 (0) | 2022.11.03 |
| [Python] Math 모듈 (0) | 2022.11.03 |
| [Python] Pillow(PIL) 모듈 (0) | 2022.11.03 |