본문 바로가기

2022년 목표/울트라 러닝 5개 달성하기

2022년 목표 : 울트라 러닝 5개 달성하기 - 2주차(2022/1/24~2022/1/30)

2022/1/25

 맨큐의 경제학과 스튜어트 미적분학을 매일 조금씩 공부하기로 했다. 코딩의 경우는 나도코딩 강의 다시 듣기 시작하고, 추가적으로 투자프로그램 만드는 것도 들어봐야지.

2022/1/26

 나도코딩 영상 시청하려고 준비중. 좀 있다가 보려고 하는데, 인싸담당자의 1시간 공부하기 도전해야지. 일을 하면서 1시간공부가 생각보다 어렵다는 걸 요즘 느끼는데, 적어도 5시간은 공부나 독서를 하려고 노력해보자.

2022/1/27

 오늘은 나도코딩 강의에서 퀴즈9번을 풀었다. 에러처리하는 부분인데, 너무 오래전에 한 것이라 복습하면서 같이 풀어봤다. 이걸 혼자서 만들 수 있을 정도가 일단 목표다.

class SoldOutError(Exception):
    pass
chicken = 10
waiting = 1
while(True):
    try:
        print("[남은 치킨 : {0}]".format(chicken))
        order = int(input("치킨 몇 마리 주문하시겠습니까?"))
        if order > chicken: # 남은 치킨보다 주문량이 많을때
            print("재료가 부족합니다.")
        elif order <= 0:
            raise ValueError
        else:
            print("[대기번호 {0}] {1} 마리 주문이 완료되었습니다.".format(waiting, order))
            waiting += 1
            chicken -= order
        if chicken == 0:
            raise SoldOutError
    except ValueError:
        print("잘못된 값을 입력하였습니다.")
    except SoldOutError:
        print("재고가 소진되어 더 이상 주문을 받지 않습니다.")
        break
2022/01/28

 오늘은 모듈 공부를 해봤다. 간단하게 말해서 함수인데, 이건 진짜로 쓸 일이 많으니 조금 더 공부를 해보자.

theater_module.py
# 일반 가격
def price(people):
    print("{0}명 가격은 {1}원입니다.".format(people, people * 10000))
   
# 조조할인 가격
def price_morning(people):
    print("{0}명 조조 할인 가격은 {1}원 입니다.".format(people, people * 6000))

# 군인 할인 가격
def price_soldier(people):
    print("{0}명 군인 할인 가격은 {1}원 입니다.".format(people, people * 4000))
practice20220128.py
import theater_module
theater_module.price(3) # 3명이서 영화 보러 갔을 때 가격
theater_module.price_morning(4) # 4명이서 조조 할인 영화 보러 갔을 때
theater_module.price_soldier(5) # 5명의 군인이 영화 보러 갔을 때

import theater_module as mv
mv.price(3)
mv.price_morning(4)
mv.price_soldier(5)

from theater_module import *
# from random import *
price(3)
price_morning(4)
price_soldier(5)

from theater_module import price, price_morning
price(5)
price_morning(6)

from theater_module import price_soldier as price
price(6)
1주일 총평

 생각보다 공부를 많이 못했다. 수면부족도 있고, 생활패턴이 너무 엉망이 된게 가장 큰 이유다. 매일 해야될 일도 제대로 안 잡혀있고. 이제는 매일 해야될 일들을 적고서 그걸 하나하나 해가는 식으로 하려고 한다. 오늘 할 일도 적혀 있으니 열심히 해나가야지.

반응형