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
- 튜닝
- 프로그래머스
- seaborn
- level 2
- 빅데이터 분석 기사
- pandas
- python3
- sklearn
- 오라클
- R
- Kaggle
- 파이썬
- SQL
- 데이터 분석
- level 1
- 코딩테스트
- oracle
- 빅분기
- Oracel
- 알고리즘
- Numpy
- Python
- 머신러닝
- 실기
- 카카오
- matplotlib
- 실습
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 |