목록파이썬 & AI 학습 (22)
A.I
주사위 n면체 만들기¶ 1. 클래스 기본 문법¶ In [2]: # Self로 자기자신을 꼭 참조시켜야함 class Car: color = 'red' category = 'sports car' def drive(self): print("I'm driving") def accel(self, speed_up, current_speed=10): self.speed_up = speed_up self.current_speed = current_speed + speed_up print("speed up", self.speed_up, "driving at", self.current_speed) In [3]: # t.run2()의 경우 b값을 찾을수 없음 class Test2: def..
In [49]: from IPython.core.display import display, HTML display(HTML("")) Scikit-Learn¶ 1. 설치¶ 최신버전 0.23을 위한 준비 Python (>= 3.6) NumPy (>= 1.13.3) SciPy (>= 0.19.1) joblib (>= 0.11) In [1]: !pip install scikit-learn #!conda install scikit-learn Requirement already satisfied: scikit-learn in ./anaconda3/envs/aiffel/lib/python3.7/site-packages (0.23.2) Requirement already satisfied: scipy>=0.19.1 i..
1. 파이썬으로 그래프 그리기¶ $ pip install matplotlib $ pip install seaborn In [10]: import matplotlib.pyplot as plt %matplotlib inline #그래프 데이터 subject = ['English', 'Math', 'Korean', 'Science', 'Computer'] points = [40, 90, 50, 60, 100] # 축 그리기 fig = plt.figure() # 도화지 펼치기 ax1 = fig.add_subplot(1,1,1) # 1행 1열로 1개 그릴수 있다는 뜻 # 그래프 그리기 ax1.bar(subject, points) # 라벨, 타..
[input] memory = {1: 1, 2: 1} def fibonacci(n): if n in memory: number = memory[n] else: number = fibonacci(n-1) + fibonacci(n-2) memory[n] = number return number print(fibonacci(100)) print(memory) if n in memory를 통해 입력값 n이라는 키가 memory 딕셔너리에 존재할 경우, 그 값 memory[n]을 바로 number로써 반환 [Output] 354224848179261915075 {1: 1, 2: 1, 3: 2, 4: 3, 5: 5, 6: 8, 7: 13, 8: 21, 9: 34, 10: 55, 11: 89, 12: 144, 13:..
blog.naver.com/keyword190/222110465823