본문 바로가기

Python_Matter/Solve

(117)
Python Learn the basics Quiz 29 Q>|\_/||q p| /}( 0 )"""\|"^"` |||_/=\\__| 강아지를 출력하는 코드를 작성하시오.(이스케이프 문자 사용) A>print('|\_/|') print('|q p| /}') print("( 0 )\"\"\"\\") print("|\"^\"` |") print('||_/=\\\__|') O>|\_/||q p| /}( 0 )"""\|"^"` |||_/=\\__| Process finished with exit code 0
Python Learn the basics Quiz 28 Q>배틀그라운드를 800시간을 한 유저가 있다.이 사람은 몇일 몇시간을 했는지 작성하는 프로그램을 만드시오. A>hours = 800 a = divmod(hours, 24) b = '800시간을 배틀그라운드를 한 유저는 {0}일 {1}시간을 한 것입니다.' print(b.format(a[0],a[1])) O>800시간을 배틀그라운드를 한 유저는 33일 8시간을 한 것입니다. Process finished with exit code 0
Python Learn the basics Quiz 27 Q>사격형의 면적과 둘레 길이를 구하는 클래스를 작성하시오. A>class Square: width = 0 height = 0 def __init__(self, width, height): self.width = width self.height = height def getArea(self): return self.width * self.height def getRound(self): return self.width * 2 + self.height * 2 O> Process finished with exit code 0
Python Learn the basics Quiz 26 Q>아래의 도표는 2016년 대전시 교통사고 월별 도표이다.이를 파이 그래프로 표현하여 각 구별 교통사고 비율을 만드시오. 시도 시군구 월 발생건수 대전 대덕구 01월 81 대전 대덕구 02월 70 대전 대덕구 03월 94 대전 대덕구 04월 91 대전 대덕구 05월 74 대전 대덕구 06월 78 대전 대덕구 07월 80 대전 대덕구 08월 81 대전 대덕구 09월 75 대전 대덕구 10월 89 대전 대덕구 11월 102 대전 대덕구 12월 110 대전 동구 01월 84 대전 동구 02월 82 대전 동구 03월 86 대전 동구 04월 89 대전 동구 05월 75 대전 동구 06월 91 대전 동구 07월 100 대전 동구 08월 88 대전 동구 09월 108 대전 동구 10월 111 대전 동구 11월 88..
Python Learn the basics Quiz 25 Q>아래에 도표는 각 년도 출생아 수를 나타낸다.이 도표를 막대그래프와 선 그래프를 사용하여 그래프를 생성하시오. 년도 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 출생아수 465892 44849 470171 471265 484550 436455 435435 438420 406243 357771 A>import matplotlib.pyplot as pyplot newborn = [465892, 444849, 470171, 471265, 484550, 436455, 435435, 438420, 406243, 357771] year = [2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017] pyplot.rcPa..
Python Learn the basics Quiz 24 Q>Window System Font 안에 설치 되어 있는 폰트를 출력하는 프로그램을 작성하시오. A>import os import sys import matplotlib as mpl from matplotlib import font_manager font_manager._rebuild() if sys.platform == 'win32': font_list = font_manager.findSystemFonts() font_list.sort() for file_path in font_list: fp = font_manager.FontProperties(fname=file_path) font_name = fp.get_name() print("%s >> %s" % (file_path, font_name)) ..
Python Learn the basics Quiz 23 Q>아래의 표는 한 학과의 성적표이다. 이를 CSV 파일 형식으로 저장하시오.그리고 위에 CSV 파일을 읽어들여서 각 학생들의 총점, 평균 점수를 계산하여 출력하는 프로그램을 작성하시오. 이름 국어 영어 수학 과학 철수 80 92 90 88 영희 82 80 77 82 민수 91 72 62 70 지현 77 64 80 64 A>grade_dic = { '이름' : ['철수', '영희', '민수', '지현'], '국어' : [80, 82, 91, 77], '영어' : [92, 80, 72, 64], '수학' : [90, 77, 62, 80], '과학' : [88, 82, 70, 64] } tpl = '{0},{1},{2},{3},{4}\n' keys = list(grade_dic.keys()) p = ',' ..
Python Learn the basics Quiz 22 Q>사용자에게 x와 y를 입력받아 사칙연산을 하는 계산기 클래스를 작성하시오. A>class Calc: def add(self, x, y): print('덧셈 결과 값') return x + y def sub(self, x, y): print('뺄셈 결과 값') return x - y def mul(self, x, y): print('곱하기 결과 값') return x * y def div(self, x, y): print('나눗셈 결과 값') return x / y num = input('x와 y를 입력하세요 : ') num_list = list(num.split()) calc = Calc() print(calc.add(int(num_list[0]), int(num_list[1]))) print(cal..