✏️ 본 포스팅은 코드잇 대학생 코딩캠프 1기 활동 기록 입니다.
📌random 모듈
- randint(a, b): a 이상 b 이하를 만족하는 랜덤한 정수 리턴
- uniform(a, b): a 이상 b 이하를 만족하는 랜덤한 소수 리턴
📌datetime 모듈
import datetime
# 날짜 타입으로 출력
pi_day = datetime.datetime(2020, 3, 14)
print(pi_day) # 2020-03-14 00:00:00
# 오늘 날짜
today = datetime.datetime.now()
print(today) # 2020-04-05 17:49:12.360266
# 두 날짜 사이의 기간 timedelta
today = datetime.datetime.now()
pi_day = datetime.datetime(2020, 3, 14, 13, 6, 15)
print(today - pi_day) # 22 days, 4:42:57.360266
# datetime의 구조
today = datetime.datetime.now()
print(today) # 2020-04-05 17:59:21.709817
print(today.year) # 연도 2020
print(today.month) # 월 4
print(today.day) # 일 5
print(today.hour) # 시 17
print(today.minute) # 분 59
print(today.second) # 초 21
print(today.microsecond) # 마이크로초 709817
# datetime 포맷팅
today = datetime.datetime.now()
print(today) # 2020-04-05 18:09:55.233501
print(today.strftime("%A, %B %dth %Y")) # Sunday, April 05th 2020
📌 Project: 로또 시뮬레이션
![](https://blog.kakaocdn.net/dn/be6C6f/btrgBmf5Rrz/qMe4b2lppm8kW97ZXNucPK/img.png)
✅ 토픽4를 끝으로 프로그래밍 in Python 코스를 수료했다.
![](https://blog.kakaocdn.net/dn/clViIf/btqXXkOSxn0/DUFSj8xijFsLQGB2eKgYmK/img.png)
'Programming > 코드잇 Codeit' 카테고리의 다른 글
코드잇 알고리즘의 정석 :: 재귀함수 (0) | 2021.02.26 |
---|---|
코드잇 데이터 사이언스 입문 :: 데이터 사이언스란? (0) | 2021.02.25 |
코드잇 프로그래밍 in Python :: 토픽3. 프로그래밍과 데이터 (0) | 2021.02.23 |
코드잇 프로그래밍 기초 in Python (0) | 2021.02.22 |
코드잇 컴퓨터 개론 :: 토픽4. 소프트웨어 이해하기 (0) | 2021.02.21 |