이 노트북을 주피터 노트북 뷰어(nbviewer.jupyter.org)로 보거나 구글 코랩(colab.research.google.com)에서 실행할 수 있습니다.
![]() |
![]() |
my_list = [10, 'hello list', 20]
print(my_list[1])
hello list
my_list_2 = [[10, 20, 30], [40, 50, 60]]
print(my_list_2[1][1])
50
import numpy as np
print(np.__version__)
1.19.1
my_arr = np.array([[10, 20, 30], [40, 50, 60]])
print(my_arr)
[[10 20 30] [40 50 60]]
type(my_arr)
numpy.ndarray
my_arr[0][2]
30
np.sum(my_arr)
210
<퀴즈>
my_arr
배열의 두 번째 행의 첫 번째 원소를 print()
함수로 출력해 보세요.
print(my_arr[1][0])
40
import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4, 5], [1, 4, 9, 16, 25]) # x 좌표와 y 좌표를 파이썬 리스트로 전달합니다.
plt.show()
plt.scatter([1, 2, 3, 4, 5], [1, 4, 9, 16, 25])
plt.show()
x = np.random.randn(1000) # 표준 정규 분포를 따르는 난수 1,000개를 만듭니다.
y = np.random.randn(1000) # 표준 정규 분포를 따르는 난수 1,000개를 만듭니다.
plt.scatter(x, y)
plt.show()