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 | 29 | 30 | 31 |
Tags
- python3
- SQL
- sklearn
- 실기
- 오라클
- 데이터 분석
- 머신러닝
- R
- 카카오
- 튜닝
- Oracel
- Python
- level 1
- seaborn
- 파이썬
- level 2
- 코딩테스트
- 실습
- 알고리즘
- 빅데이터 분석 기사
- Kaggle
- pandas
- 빅분기
- 프로그래머스
- matplotlib
- Numpy
- oracle
Archives
- Today
- Total
라일락 꽃이 피는 날
[Python] random 본문
728x90
1. random
from random import random
random() # 0.0~1.0 미만
random() * 10 # 0.0~10.0 미만
int(random()*10) # 0~10 미만
int(random()*10)+1 # 1~11 미만
2. randint
from random import randint
randint(1, 10) # 1~10 이하
chr(randint(65, 90)) # 대문자 A~Z
chr(randint(97, 122)) # 소문자 a~z
3. randrange
from random import randrange
randrange(1, 10) # 1~10 미만
randrange(2, 10, 2) # 2~10 미만 짝수
randrange(1, 10, 2) # 1~10 미만 홀수728x90
'프로그래밍 > Python' 카테고리의 다른 글
| [Python] 반복문 (0) | 2021.05.21 |
|---|---|
| [Python] 조건문 (0) | 2021.05.21 |
| [Python] 연산자 (0) | 2021.04.23 |
| [Python] 입력 함수 input() (0) | 2021.04.23 |
| [Python] 자료형 (0) | 2021.04.23 |