[Python Examples] Matplotlib 예제코드: Horizontal Bar Chart(수평 막대 그래프) 데이터 시각화
Matplotlib 예제코드: Horizontal Bar Chart(수평 막대그래프) 데이터 시각화 포스트 난이도: HOO_Junior # Example Codes import matplotlib.pyplot as plt import numpy as np fig, ax = plt.subplots() locationName = ('Gangwon-do', 'Gyeonggi-do', 'Gyeongsangnam-do', 'Gyeongsangbuk-do', 'Busan-si') y_hd = np.arange(len(locationName)) values = [13, 1, 19, 14, 3] error = 0 ax.barh(y_hd, values, xerr=error, align='center') ax.set_yt..
2023. 2. 15.
[C Examples] 총 지불액 계산기(팁, 세금 포함): float, scanf, %.f
총 지불액 계산기(팁, 세금 포함): float, scanf, %.f 포스트 난이도: HOO_Intern # Example codes #include #include int main() { int numPeople; float bill, tips, tax, billAfter, amountPerson, tipPerson; printf("총 액수를 입력하세요.\n"); scanf("%f",&bill); printf("총 사람 수를 입력하세요.\n"); scanf("%d",&numPeople); printf("Tip percentage를 입력하세요.\n"); scanf("%f",&tips); tax = bill*0.05; printf("Tax: %.2f $\n", tax); billAfter=bill+tax;..
2023. 1. 30.
[Statistical Machine Learning] Regression Function: f(x), irreducible error, reducible error, Bias, Variance
Regression Function: f(x), irreducible error, reducible error, Bias, Variance 포스트 난이도: HOO_Senior # Irreducible Error 이전 포스트에서 Regression function과 Mean-squared prediction error(MSE)에 대해서 알아보았다. https://whoishoo.tistory.com/565 [Statistical Machine Learning] Regression Function: f(x), expected value, Mean-squared Prediction Error Regression Function: f(x), expected value, Mean-squared Prediction..
2023. 1. 25.
[Python Examples] 리스트 예제 코드: 리스트에서 int와 string 구분하여 출력하기, #isinstance()
리스트 예제 코드: 리스트에서 int와 string 구분하여 출력하기 포스트 난이도: HOO_Junior # Example codes 이전 "리스트 예제 코드" 포스트에서 int인 원소(elements)를 구분하여 산출해 내는 코드를 살펴보았다. https://whoishoo.tistory.com/554 [Python Examples] 리스트 예제 코드: 리스트에서 int만 골라서 출력하기 리스트 예제 코드: 리스트에서 int만 골라서 출력하기 포스트 난이도: HOO_Junior # Example codes LIST = [5,26,33,"5",115,120,9,"0",88,1] for x in LIST: if type(x) == int: print("number", x) number 5 number 26..
2023. 1. 13.
[Python Examples] 파이썬 랜덤 예제 코드: np.random.choice()
파이썬 랜덤 예제 코드: np.random.choice() 포스트 난이도: HOO_Junior # Example codes import numpy as np colors = ['black', 'white'] np.random.choice(colors, p=[0.75,0.25], size=10) array(['black', 'black', 'black', 'white', 'black', 'black', 'white', 'black', 'white', 'white'], dtype='
2023. 1. 13.
[Python Examples] 리스트 예제 코드: 리스트에서 int만 골라서 출력하기
리스트 예제 코드: 리스트에서 int만 골라서 출력하기 포스트 난이도: HOO_Junior # Example codes LIST = [5,26,33,"5",115,120,9,"0",88,1] for x in LIST: if type(x) == int: print("number", x) number 5 number 26 number 33 number 115 number 120 number 9 number 88 number 1 리스트(List)의 경우에는 int와 string 타입을 모두 하나의 리스트에 저장할 수 있다. 따라서 특정 타입에 해당하는 원소(elements)들만 골라서 출력하거나 별도로 산출해내고 싶다면 위의 예제 코드를 참고하면 된다. 위의 예제코드를 살펴보면 for문과 if문을 사용하여 간..
2023. 1. 13.