[고1 프로그래밍] 11 - (5)

2023. 11. 30. 09:16·고1/프로그래밍
class House:
    # 매물 초기화
    def __init__(self, location, house_type, deal_type, price, completion_year):
        self.location = location
        self.house_type = house_type
        self.deal_type = deal_type
        self.price = price
        self.completion_year = completion_year

    # 매물 정보 표시
    def show_detail(self):
        print(self.location, self.house_type, self.deal_type\
                , self.price, self.completion_year)


houses = []
house1 = House("강남", "아파트", "매매", "10억", "2010년")
house2 = House("마포", "오피스텔", "전세", "5억", "2007년")
house3 = House("송파", "빌라", "월세", "500/50", "2000년")

houses.append(house1)
houses.append(house2)
houses.append(house3)

print("총 {0}대의 매물이 있습니다.".format(len(houses)))
for house in houses:
    house.show_detail()
import turtle as t
t.shape("turtle")

d=100
t.forward(d)
t.left(120)
t.forward(d)
t.left(120)
t.forward(d)
t.left(120)
t.mainloop()
import turtle
t=turtle.Pen()

t.forward(80)
t.right(90)
t.forward(40)
t.right(90)
t.forward(80)
t.lt(90)
t.forward(40)
t.lt(90)
t.forward(80)

turtle.mainloop()
import turtle

t1=turtle.Turtle()
t2=turtle.Turtle()

t1.forward(100)
t2.forward(200)

t1.lt(120)
t2.rt(120)

t1.fd(100)
t2.fd(200)

t1.lt(120)
t2.rt(120)

t1.fd(100)
t2.fd(200)

t1.lt(120)
t2.rt(120)

turtle.done()
class BigNumberError(Exception):
    def __init__(self, msg):
        self.msg = msg

    def __str__(self):
        return self.msg

try:
    print("나누기 전용 계산기입니다.")
    num1 = int(input("첫 번째 숫자를 입력하세요 : "))
    num2 = int(input("두 번째 숫자를 입력하세요 : "))
    if num1 >= 10 or num2 >= 10:
        raise BigNumberError("입력값 : {0}, {1}".format(num1, num2))
    print("{0} / {1} = {2}".format(num1, num2, int(num1/num2)))
except ValueError:
    print("잘못된 값을 입력하였습니다. 한 자리 숫자만 입력하세요.")
except BigNumberError as err:
    print("에러가 발생했습니다. 한 자리 숫자만 입력하세요.")  
    print(err)
finally:
    print("계산기를 이용해 주셔서 감사합니다.")
저작자표시 (새창열림)

'고1 > 프로그래밍' 카테고리의 다른 글

[고1 프로그래밍] 2학기 2차 지필평가  (0) 2023.12.20
[고1 프로그래밍] 12 - (1)  (0) 2023.12.04
[고1 프로그래밍] 11 - (4)  (0) 2023.11.20
[고1 프로그래밍] 11 - (3)  (0) 2023.11.15
[고1 프로그래밍] 11 - (2)  (0) 2023.11.13
'고1/프로그래밍' 카테고리의 다른 글
  • [고1 프로그래밍] 2학기 2차 지필평가
  • [고1 프로그래밍] 12 - (1)
  • [고1 프로그래밍] 11 - (4)
  • [고1 프로그래밍] 11 - (3)
백학도령
백학도령
  • 백학도령
    백학도령
  • 전체
    오늘
    어제
  • GitHub itch.io
  • 공지사항

    • 유용한 청년
    • 목록 (110)
      • 웹디자인개발기능사 (5)
      • 티스토리 (1)
      • 고3 (5)
        • 응용 프로그래밍 (2)
        • 데이터베이스 (1)
        • 성공적인 직업생활 (1)
        • 비즈니스 영어 (1)
      • 고2 (40)
        • 문학 (4)
        • 수학 (4)
        • 인공지능 수학 (1)
        • 통합사회 (4)
        • 영어 (6)
        • 한국사 (6)
        • 일본어 (4)
        • 응용 프로그래밍 (3)
        • 게임 프로그래밍 (4)
        • 자료 구조 (4)
      • 고1 (59)
        • 국어 (4)
        • 수학 (4)
        • 과학 (4)
        • 영어 (4)
        • 프로그래밍 (16)
        • 화면구현 (11)
        • 게임엔진 (15)
        • 인공지능 (1)
  • hELLO· Designed By정상우.v4.10.3
백학도령
[고1 프로그래밍] 11 - (5)
상단으로

티스토리툴바