Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- while
- MacOS
- DoM
- XML
- instruction
- html
- python
- for
- mysql
- DB
- system
- computer
- MIPS
- function
- react
- DATAPATH
- Java
- control
- Pipelining
- CSS
- github
- Algorithm
- javascript
- architecture
- data structure
- web
- Class
- DS
- Linux
- php
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
◡̈
'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 |