<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>h_jein.log</title>
        <link>https://velog.io/</link>
        <description>늦깎이 DA/DS 취준생, 이곳은 스터디노트 겸 성장기록장(소통환영이요💜)</description>
        <lastBuildDate>Tue, 16 May 2023 16:09:21 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <image>
            <title>h_jein.log</title>
            <url>https://velog.velcdn.com/images/h_jein/profile/935cbe6d-d7f4-406b-8e88-598f1648e934/image.jpg</url>
            <link>https://velog.io/</link>
        </image>
        <copyright>Copyright (C) 2019. h_jein.log. All rights reserved.</copyright>
        <atom:link href="https://v2.velog.io/rss/h_jein" rel="self" type="application/rss+xml"/>
        <item>
            <title><![CDATA[오늘의 공부 / 230517]]></title>
            <link>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230517</link>
            <guid>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230517</guid>
            <pubDate>Tue, 16 May 2023 16:09:21 GMT</pubDate>
            <description><![CDATA[<h3 id="💬-오늘의-공부시간-pm-1000-am-0230">💬 오늘의 공부시간 PM 10:00~ AM 02:30</h3>
<p>12시 30분이 고비다.
감기는 다 나은것 같은데 기침은 오지게 나온다.
요즘 회사에서 에너지드링크 없음 못버틸 정도로 몸이 무겁다.
요번주는 사실 너므너므 딴짓만 하고싶다. ㅠㅠㅠ
<br/></p>
<h3 id="🔥-3주차-todo-리스트-515521">🔥 3주차 todo 리스트 (5/15~5/21)</h3>
<p><del>파이썬 (중급문풀 5)
파이썬 (중급문풀 6</del>7)
파이썬 (중급문풀 8)
기초수학 (기초 1<del>2)
기초수학 (기초 3)
기초수학 (기초 4)
기초수학 (기초 5</del>6)<del>~
<br/>
기초수학 (기초 7)
기초수학 (기초 1)
기초수학 (기초 2)
기초수학 (기초문풀 1)
기초수학 (기초문풀 2</del>3)
자료구조/알고리즘 (자료구조 1~2)
자료구조/알고리즘 (자료구조 3)
자료구조/알고리즘 (자료구조 4)
<br/></p>
<p><del>📝 weekly 데이터 사이언스 스쿨 퀴즈
📝 재복습weekly 데이터 사이언스 스쿨 퀴즈</del>
<br/></p>
<h3 id="💻-핵심-내용-정리">💻 핵심 내용 정리</h3>
<h4 id="📝-진법이란">📝 진법이란?</h4>
<ul>
<li>특정 숫자 몇개를 사용하여 수를 표시하는 방법<br/>

</li>
</ul>
<p>10진수 → </p>
<p><code>binary : bin() → 2진수</code> </p>
<pre><code class="language-python">print(&#39;2진수: {}&#39;.format(bin(dNum)))</code></pre>
<br/>

<p><code>octal : oct() → 8진수</code> </p>
<pre><code class="language-python">print(&#39;8진수: {}&#39;.format(oct(dNum)))</code></pre>
<br/>

<p><code>Haxadecimal : hex() → 16진수</code> </p>
<pre><code class="language-python">print(&#39;16진수: {}&#39;.format(hex(dNum)))</code></pre>
<br/>

<ul>
<li>10진수를 X진수로 변환 : format()함수<pre><code class="language-python">print(&#39;2진수: {}&#39;.format(format(dNum,&#39;#b&#39;)))
print(&#39;8진수: {}&#39;.format(format(dNum, &#39;#o&#39;)))
print(&#39;16진수: {}&#39;.format(format(dNum, &#39;#x&#39;)))
</code></pre>
</li>
</ul>
<p>print(&#39;Type of bin(dNum): {}&#39;.format(type(format(dNum,&#39;#b&#39;))))
print(&#39;Type of oct(dNum): {}&#39;.format(type(format(dNum,&#39;#o&#39;))))
print(&#39;Type of hex(dNum): {}&#39;.format(type(format(dNum,&#39;#x&#39;))))</p>
<pre><code>&lt;br/&gt;

- X진수를 10진수로 변환 : format()함수
```python
print(&#39;2진수(0b11110) -&gt; 10진수({})&#39;.format(int(&#39;0b11110&#39;,2)))
print(&#39;8진수(0o36) -&gt; 10진수({})&#39;.format(int(&#39;0o36&#39;,8)))
print(&#39;16진수(0x1e) -&gt; 10진수({})&#39;.format(int(&#39;0x1e&#39;,16)))</code></pre><br/>

<ul>
<li>X진수를 X진수로 변환 : format()함수<pre><code class="language-python">print(&#39;2진수(0b11110) -&gt; 8진수({})&#39;.format(oct(0b11110)))
print(&#39;2진수(0b11110) -&gt; 10진수({})&#39;.format(int(0b11110)))
print(&#39;2진수(0b11110) -&gt; 16진수({})&#39;.format(hex(0b11110)))
</code></pre>
</li>
</ul>
<p>print(&#39;8진수(0o36) -&gt; 2진수({})&#39;.format(bin(0o36)))
print(&#39;8진수(0o36) -&gt; 10진수({})&#39;.format(int(0o36)))
print(&#39;8진수(0o36) -&gt; 16진수({})&#39;.format(hex(0o36)))</p>
<p>print(&#39;16진수(0x1e) -&gt; 2진수({})&#39;.format(bin(0x1e)))
print(&#39;16진수(0x1e) -&gt; 8진수({})&#39;.format(oct(0x1e)))
print(&#39;16진수(0x1e) -&gt; 10진수({})&#39;.format(int(0x1e)))</p>
<pre><code>&lt;br/&gt;

#### 📝 수열이란?
- 규칙성을 가지고 나열되어 있는 수들.

&gt; an = 일반항

&lt;br/&gt;

#### 📝 항들의 합과 항의 관계
- 특정항은 특정항까지의 합에서 특정항 이전의 항까지의 합과 같다

&gt; an = sn -s(n-1)
`단, n &gt;= 2 / a1 = s1`

&lt;br/&gt;

#### 📝 등차수열
- 연속된 두 항의 차이가 일정한 수열

&gt; 등차수열 ( 일반항 ) 공식
an = a1 + (n-1) * d 
`d = 공차`

&gt; 등차수열 ( 합 ) 공식
sn = n (a1+an) / 2

&lt;br/&gt;

#### 📝 등차중항
- 연속된 세 항에서 가운데 항
&lt;br/&gt;

#### 📝 등비수열
- 연속된 두 항의 비가 일정한 수열
- 등비수열 규칙성을 이용해서 일반항을 구할 수 있다.

&gt; 등비수열 (일반항) 공식
an = a1 * r^(n-1)
`r = 공비`

&gt; 등비수열 (합) 공식
sn = a1 * (1-(r^n) / (1-r)

&lt;br/&gt;

#### 📝 등차중항
- 연속된 세 항에서 가운데 항
- 연속되는 세 항 중 가운데 항은 가운데 항의 거듭제곱과 앞, 뒤로 나란한 항 두개를 곱한 것과 같다.
&lt;br/&gt;

`실습_02`
```python
# 등비수열

# n번째까지 항의 값을 출력 : 일반항
inputN1 = int(input(&#39;a1 입력: &#39;))
inputR = int(input(&#39;공비 입력: &#39;))
inputN = int(input(&#39;n 입력: &#39;))

valueN = 0

n = 1    # 무한루프 방지
while n &lt;= inputN:

    if n ==1:
        valueN = inputN1
        print(&#39;{}번째 항의 값: {}&#39;.format(n, valueN))
        n += 1       # 무한루프 방지
        continue

    valueN *= inputR
    print(&#39;{}번째 항의 값: {}&#39;.format(n, valueN))
    n += 1


# n번째 항의 값을 출력 : 일반항(공식이용)
inputN1 = int(input(&#39;a1 입력: &#39;))
inputR = int(input(&#39;공비 입력: &#39;))
inputN = int(input(&#39;n 입력: &#39;))

# an = a1 * r^(n-1)
valueN = inputN1 * (inputR ** (inputN - 1))
print(&#39;{}번째 항의 값: {}&#39;.format(inputN, valueN))

# n번째까지 항의 값의 합을 출력 : 항들의 합(반복문)
inputN1 = int(input(&#39;a1 입력: &#39;))
inputR = int(input(&#39;공비 입력: &#39;))
inputN = int(input(&#39;n 입력: &#39;))

valueN = 0  # n번째까지의 값을 모르기 때문에 0
sumN = 0    # n번째까지의 합도 모르기 때문에 0
n = 1   # while문 이용으로 무한루프 방지
while n &lt;= inputN:

    if n == 1:
        valueN = inputN1
        sumN += valueN
        # print(&#39;{}번째 항까지의 합 : {}&#39;.format(n, sumN))
        n += 1    # 무한 루프 방지
        continue   # 계속실행 : 처음으로 돌아가기

    valueN = valueN * inputR   # a1(첫항) * 사용자가 입력한 공비 = a2항
    sumN = sumN + valueN    # a2항까지의 합
    # print(&#39;{}번째 항까지의 합 : {}&#39;.format(n, sumN))
    n += 1

print(&#39;{}번째 항까지의 합 : {}&#39;.format(inputN, sumN))


# n번째 항까지의 값의 합을 출력  : 항들의 합(공식)
inputN1 = int(input(&#39;a1 입력: &#39;))
inputR = int(input(&#39;공비 입력: &#39;))
inputN = int(input(&#39;n 입력: &#39;))

# sn = a1 * (1 - r^n) / (1-r)
sumN = inputN1 * (1 - (inputR ** inputN)) / (1 - inputR)
print(&#39;{}번째 항까지의 합 : {}&#39;.format(inputN, int(sumN)))</code></pre><br/>

<h4 id="📝-계차수열">📝 계차수열</h4>
<ul>
<li>어떤 수열의 인접하는 두 항의 차로 이루어진 또 다른 수열<br/>

</li>
</ul>
<p><code>실습_03</code></p>
<pre><code class="language-python"># 계차수열
# an = {3, 7, 13, 21, 31, 43, 57}
# bn = {4, 6, 8, 10, 12, 14}

inputAN1 = int(input(&#39;a1 입력: &#39;))
inputAN = int(input(&#39;an 공차 입력: &#39;))

inputBN1 = int(input(&#39;b1 입력: &#39;))
inputBN = int(input(&#39;bn 공차 입력: &#39;))

valueAN = 0
valueBN = 0

n = 1
while n &lt;= inputAN:
    if n == 1:
        valueAN = inputAN1
        valueBN = inputBN1
        print(&#39;an의 {}번째의 항의 값: {}&#39;.format(n,valueAN))
        print(&#39;bn의 {}번째의 항의 값: {}&#39;.format(n,valueBN))
        n += 1
        continue

    valueAN = valueAN + valueBN
    valueBN = valueBN + inputBN
    print(&#39;an의 {}번째의 항의 값: {}&#39;.format(n, valueAN))
    print(&#39;bn의 {}번째의 항의 값: {}&#39;.format(n, valueBN))
    n += 1

print(&#39;an의 {}번째의 항의 값: {}&#39;.format(inputAN, valueAN))
print(&#39;bn의 {}번째의 항의 값: {}&#39;.format(inputAN, valueBN))


# n^2 + n + 1 = an
valueAN = inputAN ** 2 + inputAN + 1
print(&#39;an의 {}번째 항의 값: {}&#39;.format(inputAN, valueAN))</code></pre>
<h4 id="📝-피보나치-수열">📝 피보나치 수열</h4>
<ul>
<li>세번째 항은 두번째 항과 첫번째 항을 더한 합이다.<br/>

</li>
</ul>
<p><code>실습_04</code></p>
<pre><code class="language-python">inputN = int(input(&#39;n 입력: &#39;))

valueN = 0
sumN = 0

valuePreN2 = 0
valuePreN1 = 0

n = 1
while n &lt;= inputN:
    if n == 1 or n == 2:
        valueN = 1
        valuePreN2 = valueN
        valuePreN1 = valueN
        sumN += valueN
        n += 1

    else:
        valueN = valuePreN2 + valuePreN1
        valuePreN2 = valuePreN1
        valuePreN1 = valueN
        sumN += valueN
        n += 1

print(&#39;{}번째 항의 값: {}&#39;.format(inputN, valueN))
print(&#39;{}번째 항까지의 합: {}&#39;.format(inputN, sumN))</code></pre>
<br/>

<h4 id="📝-팩토리얼">📝 팩토리얼</h4>
<ul>
<li>1부터 양의 정수 n까지의 정수를 모두 곱한것<br/>

</li>
</ul>
<p><code>실습_05</code></p>
<pre><code class="language-python">inputN = int(input(&#39;n 입력: &#39;))

result = 1
for n in range(1, inputN+1):
    result *= n

print(&#39;{} 팩토리얼: {}&#39;.format(inputN, result))


result = 1
n = 1
while n &lt;= inputN:
    result *= n
    n += 1

print(&#39;{} 팩토리얼: {}&#39;.format(inputN, result))



def factorialFun(n):
    if n == 1: return 1

    return n * factorialFun(n - 1)

print(&#39;{} 팩토리얼: {}&#39;.format(inputN, factorialFun(inputN)))



import math
math.factorial(inputN)

print(&#39;{} 팩토리얼: {}&#39;.format(inputN, math.factorial(inputN)))</code></pre>
<br/>

<h3 id="💡-오늘을-마무리하면서-">💡 오늘을 마무리하면서 ...</h3>
<p>나 진짜 수학 못하는데 무조건 이해 할때까지 들어봐야겠다
이쯤되면 컴퓨터 과목도 어느 정도는 외우는 암기과목인것 같은 느낌적인 느낌....
<br/></p>
<h4 id="😃-busy-study-_-새벽반-pm-1000--am-230">😃 Busy Study _ 새벽반 PM 10:00 ~ AM 2:30</h4>
<h4 id="여러분-화이팅-우리-모두-다-잘-될거예요">여러분 화이팅!! 우리 모두 다 잘 될거예요!</h4>
]]></description>
        </item>
        <item>
            <title><![CDATA[오늘의 공부 / 230516]]></title>
            <link>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230516</link>
            <guid>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230516</guid>
            <pubDate>Tue, 16 May 2023 12:31:07 GMT</pubDate>
            <description><![CDATA[<h3 id="💬-오늘의-공부시간-pm-1100-am-0200">💬 오늘의 공부시간 PM 11:00~ AM 02:00</h3>
<br/>

<h3 id="🔥-3주차-todo-리스트-515521">🔥 3주차 todo 리스트 (5/15~5/21)</h3>
<p><del>파이썬 (중급문풀 5)
파이썬 (중급문풀 6</del>7)
파이썬 (중급문풀 8)
기초수학 (기초 1<del>2)</del>
<br/>
기초수학 (기초 3)
기초수학 (기초 4)
기초수학 (기초 5<del>6)
기초수학 (기초 7)
기초수학 (기초 1)
기초수학 (기초 2)
기초수학 (기초문풀 1)
기초수학 (기초문풀 2</del>3)
자료구조/알고리즘 (자료구조 1~2)
자료구조/알고리즘 (자료구조 3)
자료구조/알고리즘 (자료구조 4)
<br/></p>
<p><del>📝 weekly 데이터 사이언스 스쿨 퀴즈</del>
<del>📝 재복습weekly 데이터 사이언스 스쿨 퀴즈</del>
<br/></p>
<h3 id="💻-핵심-내용-정리">💻 핵심 내용 정리</h3>
<h4 id="📝-약수">📝 약수</h4>
<ul>
<li>어떤 수를 나누어 떨어지게 하는 수
나머지가 나오면 약수가 아니다.</li>
</ul>
<br/>

<p><code>실습_01</code></p>
<pre><code class="language-python">파이썬을 이용해서 사용자가 입력한 숫자의 약수를 출력해보자.

inputNumber = int(input(&#39;0보다 큰 정수 입력: &#39;))

for number in range(1, inputNumber + 1):
    if inputNumber % number == 0:
        print(&#39;{}의 약수: {}&#39;.format(inputNumber, number))</code></pre>
<br/>

<h4 id="📝-소수">📝 소수</h4>
<ul>
<li>1과 자신만을 약수로 가지는 수
1과 본인 자신의 수 밖에 없다.<br/>

</li>
</ul>
<p><code>실습_02</code></p>
<pre><code class="language-python">파이썬을 이용해서 사용자가 입력한 숫자까지의 소수를 출력해보자.

inputNumber = int(input(&#39;0보다 큰 정수 입력: &#39;))

for number in range(2, inputNumber + 1):
    flag = True

    for n in range(2, number):
        if number % n == 0:
            flag = False
            break

    if flag:
        print(&#39;{} : 소수!!&#39;.format(number))
    else:
        print(&#39;{} : \t\t 합성수!!&#39;.format(number))</code></pre>
<br/>

<h4 id="📝-소인수">📝 소인수</h4>
<ul>
<li>약수(인수)중에서 소수인 숫자를 소인수라고 한다.</li>
</ul>
<blockquote>
<p>12의 소인수?
1, 2, 3, 4, 6, 12</p>
</blockquote>
<br/>

<h4 id="📝-소인수분해">📝 소인수분해</h4>
<ul>
<li>1보다 큰 정수를 소인수의 곱으로 나타낸 것을 소인수 분해라고 한다.</li>
</ul>
<blockquote>
<p>20의 소인수 분해?
2^2 x 5 = ( 2 x 2 x 5)</p>
</blockquote>
<br/>

<h4 id="📝-소인수분해와-약수">📝 소인수분해와 약수</h4>
<ul>
<li>소인수 분해를 이용해서 약수를 정확하고 쉽게 구할 수 있다.</li>
</ul>
<blockquote>
<p>20의 소인수 분해?
1, 2, 4, 5, 10, 20</p>
</blockquote>
<br/>

<p><code>실습_03</code></p>
<pre><code class="language-python">파이썬을 이용해서 사용자가 입력한 수를 소인수분해하자.

inputNumber = int(input(&#39;1보다 큰 정수 입력: &#39;))

n = 2
while n &lt;= inputNumber:
    if inputNumber % n ==0:
        print(&#39;소인수: {}&#39;.format(n))
        inputNumber /= n
    else:
        n += 1</code></pre>
<br/>

<h4 id="📝-최대공약수">📝 최대공약수</h4>
<ul>
<li>두개 이상의 수에서 공통괸 약수를 공약수라고 한다.</li>
<li>소인수분해를 이용하면 최대공약수 및 공약수를 구할 수 있다.
공통인 소인수의 거듭제곱에서 지수가 작은 수를 모두 곱한다.</li>
<li>좀더 편리하게 최대공약수를 구하는 방법 → 소수로 나눗셈을 하자!
나눠지지 않을때까지 나누기</li>
</ul>
<blockquote>
<p>12와 20의 공약수?
1,2,4 (4의 약수)</p>
</blockquote>
<br/>

<p><code>실습_04</code></p>
<pre><code class="language-python">두개의 수를 입력하면 공약수와 최대공약수를 출력하는 코드를 작성하자.

num1 = int(input(&#39;1보다 큰 정수 입력: &#39;))
num2 = int(input(&#39;1보다 큰 정수 입력: &#39;))
maxNum = 0

for i in range(1, (num1 +1)):
    if num1 % i == 0 and num2 % i == 0:
        print(&#39;공약수: {}&#39;.format(i))
    maxNum = i

print(&#39;최대공약수: {}&#39;.format(maxNum))</code></pre>
<br/>

<h4 id="📝-유클리드-호제법">📝 유클리드 호제법</h4>
<ul>
<li>유클리드 호제법을 이용해서 최대공약수를 구할 수 있다.
<code>x, y의 최대공약수는 y, r(x % y)</code>
나머지가 0 일때까지 나눗셈한다.<br/>

</li>
</ul>
<p><code>실습_05</code></p>
<pre><code class="language-python">유클리드 호제법을 이용해서 최대공약수를 구할수 있다.

num1 = int(input(&#39;1보다 큰 정수 입력: &#39;))
num2 = int(input(&#39;1보다 큰 정수 입력: &#39;))

temp1 = num1; temp2 = num2

while temp2 &gt; 0:
    temp = temp2
    temp2 = temp1 % temp2
    temp1 = temp

print(&#39;{}, {}의 = 최대공약수: {}&#39;.format(num1, num2, temp1))

for n in range(1, (temp1 + 1)):
    if temp1 % n == 0:
        print(&#39;{}, {}의 공약수: {}&#39;.format(num1, num2, n))</code></pre>
<br/>

<h4 id="📝-공배수">📝 공배수</h4>
<ul>
<li>두개 이상의 수에서 공통된 배수를 공배수라고 한다.</li>
</ul>
<blockquote>
<p>3, 5의 배수
15,30....</p>
</blockquote>
<br/>

<h4 id="📝-최소공배수">📝 최소공배수</h4>
<ul>
<li>공배수 중 가장 작은 수를 최소공배수라고 한다.</li>
<li>소인수분해를 이용하면 최소공배수 및 공배수를 구할 수 있다.</li>
<li>좀 더 편리하게 최소공배수 구하는 방법 → 소수로 나눗셈하자.<br/>

</li>
</ul>
<p><code>실습_06</code></p>
<pre><code class="language-python">두개의 수를 입력하면 최소공배수를 출력하는 코드를 작성하자.

num1 = int(input(&#39;1보다 큰 정수 입력: &#39;))
num2 = int(input(&#39;1보다 큰 정수 입력: &#39;))
maxNum = 0

for i in range(1, (num1 + 1)):
    if num1 % i == 0 and num2 % i ==0:
        print(&#39;공약수: {}&#39;.format(i))
        maxNum = i

print(&#39;최대공약수: {}&#39;.format(maxNum))

minNum = (num1 * num2) // maxNum
print(&#39;최소공배수: {}&#39;.format(minNum))</code></pre>
<br/>

<p><code>실습_07</code></p>
<pre><code class="language-python">세개의 수를 입력하면 최소공배수를 출력하는 코드를 작성하자.

num1 = int(input(&#39;1보다 큰 정수 입력: &#39;))
num2 = int(input(&#39;1보다 큰 정수 입력: &#39;))
num3 = int(input(&#39;1보다 큰 정수 입력: &#39;))
maxNum = 0

for i in range(1, (num1 + 1)):
    if num1 % i == 0 and num2 % i ==0:
        print(&#39;공약수: {}&#39;.format(i))
        maxNum = i

print(&#39;최대공약수: {}&#39;.format(maxNum))

minNum = (num1 * num2) // maxNum
print(&#39;최소공배수: {}&#39;.format(minNum))

newNum =minNum
for i in range(1, (newNum + 1)):
    if newNum % i == 0 and num3 % i == 0:
        maxNum

print(&#39;최대공약수: {}&#39;.format(maxNum))

minNum = (newNum * num3) // maxNum
print(&#39;{}, {}, {}의 최소공배수: {}&#39;.format(num1, num2, num3, minNum))</code></pre>
<br/>

<p><code>실습_08</code></p>
<pre><code class="language-python">섬마을에 과일, 생선, 야채를 판매하는 배가 다음 주기로 입할한다고 할떄, 모든 배가 입항하는 날짜를 계산해보자.

과일 선박: 3일주기
생선 선박: 4일주기
야채 선박: 5일주기

ship1 = 3; ship2 = 4; ship3 = 5
maxDay = 0

for i in range(1, (ship1 + 1)):
    if ship1 % i == 0 and ship2 % i == 0:
        maxDay = i

print(&#39;최대공약수: {}&#39;.format(maxDay))

minDay = (ship1 * ship2) // maxDay
print(&#39;{}, {}의 최소공배수: {}&#39;.format(ship1, ship2, minDay))


newDay = minDay
for i in range(1, (newDay + 1)):
    if newDay % i == 0 and ship3 % i == 0:
        maxDay = i

print(&#39;최대공약수: {}&#39;.format(maxDay))

minDay = (newDay * ship3) // maxDay
print(&#39;{}, {}, {}의 최소공배수: {}&#39;.format(ship1, ship2, ship3, minDay))

print(&#39;{}일마다 모든 선박이 입항합니다.&#39;.format(minDay))</code></pre>
<br/>


<h3 id="💡-오늘을-마무리하면서-">💡 오늘을 마무리하면서 ...</h3>
<p>진짜 인풋이 제대로 되고 있는건지 모르곘다 ㅠㅠ 머리 터질 것만 같아</p>
<br/>


<h4 id="😃-busy-study-_-새벽반-pm-1000--am-230">😃 Busy Study _ 새벽반 PM 10:00 ~ AM 2:30</h4>
<h4 id="여러분-화이팅-우리-모두-다-잘-될거예요">여러분 화이팅!! 우리 모두 다 잘 될거예요!</h4>
]]></description>
        </item>
        <item>
            <title><![CDATA[오늘의 공부 / 230515]]></title>
            <link>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230515</link>
            <guid>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230515</guid>
            <pubDate>Mon, 15 May 2023 09:27:41 GMT</pubDate>
            <description><![CDATA[<h3 id="💬-오늘의-공부시간-pm-0900-am-1250">💬 오늘의 공부시간 PM 09:00~ AM 12:50</h3>
<br/>

<h3 id="🔥-3주차-todo-리스트-515521">🔥 3주차 todo 리스트 (5/15~5/21)</h3>
<p><del>파이썬 (중급문풀 5)
파이썬 (중급문풀 6</del>7)
파이썬 (중급문풀 8)<del>~
<br/>
기초수학 (기초 1</del>2)
기초수학 (기초 3)
기초수학 (기초 4)
기초수학 (기초 5<del>6)
기초수학 (기초 7)
기초수학 (기초 1)
기초수학 (기초 2)
기초수학 (기초문풀 1)
기초수학 (기초문풀 2</del>3)
자료구조/알고리즘 (자료구조 1~2)
자료구조/알고리즘 (자료구조 3)
자료구조/알고리즘 (자료구조 4)
<br/>
📝 weekly 데이터 사이언스 스쿨 퀴즈
📝 재복습weekly 데이터 사이언스 스쿨 퀴즈
<br/></p>
<h3 id="💡-오늘을-마무리하면서-">💡 오늘을 마무리하면서 ...</h3>
<p>오늘은 중급문풀 나머지를 공부했다.
예외처리도 쉽지 않고 머릿속에 잘 들어오는것 같지도 않고 ㅠㅠ
미쳐버리겠다. ㅠㅠ
코드를 따라 쓰는건 좋은데 일단 내가 영타속도가 어엄청 느리니까 진짜 수업진도가 너무너무 느려서 공부방법을 바꿧다.
종이에다가 코딩한다 생각하고 노트 필기로 바꿨더니 진짜 세상편하다.
(마음이 편한건가?? ㅠㅠ)
그동안 문제 풀이 밀려서 너무 기억이 잘 안나서 강좌 다시 듣기 하면서 마무리 수업을 들었다.
아직 나는 부족하다. 마의 코딩테스트가 두려워졌다. ㅠㅠ
<br/></p>
<h4 id="😃-busy-study-_-새벽반-pm-1000--am-230">😃 Busy Study _ 새벽반 PM 10:00 ~ AM 2:30</h4>
<h4 id="여러분-화이팅-우리-모두-다-잘-될거예요">여러분 화이팅!! 우리 모두 다 잘 될거예요!</h4>
]]></description>
        </item>
        <item>
            <title><![CDATA[오늘의 공부 / 230514]]></title>
            <link>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230514</link>
            <guid>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230514</guid>
            <pubDate>Mon, 15 May 2023 09:25:52 GMT</pubDate>
            <description><![CDATA[<h3 id="💬-오늘의-공부시간-pm-1600-am-0100">💬 오늘의 공부시간 PM 16:00~ AM 01:00</h3>
<br/>

<h3 id="🔥-2주차-todo-리스트-57514">🔥 2주차 todo 리스트 (5/7~5/14)</h3>
<p><del>파이썬 기초문풀4</del>
<del>파이썬 기초문풀5
파이썬 중급1
파이썬 중급2
파이썬 중급3
파이썬 중급4
파이썬 중급5</del>6
파이썬 중급7
파이썬 중급8<del>9
파이썬 중급문풀1</del>2
파이썬 중급문풀3
파이썬 중급문풀4~~
<br/></p>
<p><del>📝 weekly 데이터 사이언스 스쿨 퀴즈</del>
<del>📝 재복습weekly 데이터 사이언스 스쿨 퀴즈</del>
<br/></p>
<h3 id="💻-핵심-내용-정리">💻 핵심 내용 정리</h3>
<h4 id="🏅-문제풀이">🏅 문제풀이</h4>
<p><code>실습_01</code></p>
<pre><code class="language-python">수입과  공과금을  입력하면  공과금  총액과  수입  대비  공과금  비율을  계산하는 
모듈을  만들어보자.

# 모듈파일
income = 0
waterPrice = 0; electricPrice = 0; gasPrice = 0

def setIncome(ic):
    global income
    income = ic

def getIncome():
    return income

def setWaterPrice(wp):
    global waterPrice
    waterPrice = wp

def setElectricPrice(ep):
    global electricPrice
    electricPrice = ep

def setGasPrice(gp):
    global gasPrice
    gasPrice = gp

def getUtilityBill():
    result = waterPrice + electricPrice + gasPrice
    return result

def getUtilityBillRate():
    result = getUtilityBill() / getIncome() * 100
    return round(result, 2)

def formatedNumber(n):
    return format(n, &#39;,&#39;)

# 실행파일
import utilityBill as ub

inputIncome = int(input(&#39;수입 입력: &#39;))
ub.setIncome(inputIncome)

inputWaterPrice = int(input(&#39;수도요금 입력: &#39;))
ub.setWaterPrice(inputWaterPrice)

inputElectricPrice = int(input(&#39;전기요금 입력: &#39;))
ub.setElectricPrice(inputElectricPrice)

inputGasPrice = int(input(&#39;가스요금 입력: &#39;))
ub.setGasPrice(inputGasPrice)

print(f&#39;공과금: {ub.formatedNumber(ub.getUtilityBill())}원&#39;)
print(f&#39;수입 대비 공과금 비율: {ub.getUtilityBillRate()}%&#39;)
</code></pre>
<br/>

<p><code>실습_02</code></p>
<pre><code class="language-python">회원가입 클래스와 회원정보를 관리하는 클래스를 만들고 회원가입 로그인 기능을 구현해보자.

# 클래스
class Member:
    def __init__(self, i, p):
        self.id = i
        self.pw = p


class MemberRepository:

    def __init__(self):
        self.members = {}

    def addMember(self, m):
        self.members[m.id] = m.pw

    def loginMember(self, i, p):
        isMember = i in self.members

        if isMember and self.members[i] == p:
            print(f&#39;{i}: Log-in success!!&#39;)

        else:
            print(f&#39;{i}: Log-in fail!!&#39;)

    def removeMember(self, i, p):
        del self.members[i]

    def printMembers(self):
        for mk in self.members.keys():
            print(f&#39;ID: {mk}&#39;)
            print(f&#39;PW: {self.members[mk]}&#39;)


# 실행파일
import member as mb

mems = mb.MemberRepository()

for i in range(3):
    mId = input(&#39;아이디 입력: &#39;)
    mPw = input(&#39;비밀번호 입력: &#39;)
    mem = mb.Member(mId, mPw)
    mems.addMember(mem)

mems.printMembers()


mems.loginMember(&#39;abc@gmail.com&#39;, &#39;1234&#39;)
mems.loginMember(&#39;def@gmail.com&#39;, &#39;5678&#39;)
mems.loginMember(&#39;ghi@gmail.com&#39;, &#39;9012&#39;)

mems.removeMember(&#39;abc@gmail.com&#39;, &#39;1234&#39;)

mems.printMembers()</code></pre>
<br/>

<p><code>실습_03</code></p>
<pre><code class="language-python">TV클래스를 다음과 같은 상속구조로 만들고 객체를 생성해보자.

# 클래스
class NormalTv:

    def __init__(self, i=32, c=&#39;black&#39;, r=&#39;full-HD&#39;):
        self.inch = i
        self.color = c
        self.resolution = r
        self.smartTv = &#39;off&#39;
        self.aiTv = &#39;off&#39;

    def turnOn(self):
        print(&#39;TV power on!!&#39;)

    def turnOff(self):
        print(&#39;TV power off!!&#39;)

    def printTvInfo(self):
        print(f&#39;inch: {self.inch}inch&#39;)
        print(f&#39;color: {self.color}&#39;)
        print(f&#39;resolution: {self.resolution}&#39;)
        print(f&#39;smartTv: {self.smartTv}&#39;)
        print(f&#39;aiTv: {self.aiTv}&#39;)


class Tv4k(NormalTv):

    def __init__(self, i, c, r=&#39;4k&#39;):
        super().__init__(i, c, r)

    def setSmartTv(self, s):
        self.smartTv = s


class Tv8k(NormalTv):

    def __init__(self, i, c, r=&#39;8k&#39;):
        super().__init__(i, c, r)

    def setSmartTv(self, s):
        self.smartTv = s

    def setAiTv(self, a):
        self.aiTv = a


if __name__ == &#39;__main__&#39;:
    my4KTv = Tv4k(&#39;65&#39;, &#39;silver&#39;, &#39;4K&#39;)
    my4KTv.setSmartTv(&#39;on&#39;)
    my4KTv.turnOn()
    my4KTv.printTvInfo()
    my4KTv.turnOff()

    my8KTv = Tv8k(&#39;75&#39;, &#39;black&#39;, &#39;8K&#39;)
    my8KTv.setSmartTv(&#39;on&#39;)
    my8KTv.setAiTv(&#39;on&#39;)
    my8KTv.turnOn()
    my8KTv.printTvInfo()
    my8KTv.turnOff()

# 실행파일
import smartTv as st

my4KTv = st.Tv4k(&#39;65&#39;, &#39;silver&#39;, &#39;4K&#39;)
my4KTv.setSmartTv(&#39;on&#39;)
my4KTv.turnOn()
my4KTv.printTvInfo()
my4KTv.turnOff()


friend4KTv = st.Tv4k(&#39;55&#39;, &#39;white&#39;, &#39;4K&#39;)
friend4KTv.setSmartTv(&#39;off&#39;)
friend4KTv.turnOn()
friend4KTv.printTvInfo()
friend4KTv.turnOff()



my8KTv = st.Tv8k(&#39;75&#39;, &#39;black&#39;, &#39;8K&#39;)
my8KTv.setSmartTv(&#39;on&#39;)
my8KTv.setAiTv(&#39;on&#39;)
my8KTv.turnOn()
my8KTv.printTvInfo()
my8KTv.turnOff()


friend8KTv = st.Tv8k(&#39;86&#39;, &#39;red&#39;, &#39;8K&#39;)
friend8KTv.setSmartTv(&#39;on&#39;)
friend8KTv.setAiTv(&#39;off&#39;)
friend8KTv.turnOn()
friend8KTv.printTvInfo()
friend8KTv.turnOff()
</code></pre>
<br/>


<p><code>실습_04</code></p>
<pre><code class="language-python">명세서를 참고해서 도서관리 프로그램을 만들어 보자.

# 클래스
class Book:

    def __init__(self, name, price, isbn):
        self.bName = name
        self.bPrice = price
        self.bIsbn = isbn


class BookRepository:

    def __init__(self):
        self.bDic = {}

    def registBook(self, b):
        self.bDic[b.bIsbn] = b

    def removeBook(self, isbn):
        del self.bDic[isbn]

    def printBooksInfo(self):
        for isbn in self.bDic.keys():
            b = self.bDic[isbn]
            print(f&#39;{b.bName}, {b.bPrice}, {b.bIsbn}&#39;)

    def printBookInfo(self, isbn):
        if isbn in self.bDic:
            b = self.bDic[isbn]
            print(f&#39;{b.bName}, {b.bPrice}, {b.bIsbn}&#39;)

        else:
            print(&#39;Lookup result does not exist&#39;)


if __name__ == &#39;__main__&#39;:
    br = BookRepository()

    br.registBook(Book(&#39;python&#39;, 20000, &#39;1234567890&#39;))
    br.registBook(Book(&#39;java&#39;, 25000, &#39;852147963&#39;))
    br.registBook(Book(&#39;c/c++&#39;, 27000, &#39;951378624&#39;))
    br.registBook(Book(&#39;javascript&#39;, 15000, &#39;9874563254&#39;))

    br.printBooksInfo()
    br.printBookInfo(&#39;1234567890&#39;)
    br.removeBook(&#39;1234567890&#39;)
    br.printBooksInfo()

 # 실행파일
 import book as bk

myBReposit = bk.BookRepository()

myBReposit.registBook(bk.Book(&#39;python&#39;, 20000, &#39;1234567890&#39;))
myBReposit.registBook(bk.Book(&#39;java&#39;, 25000, &#39;852147963&#39;))
myBReposit.registBook(bk.Book(&#39;c/c++&#39;, 27000, &#39;951378624&#39;))
myBReposit.registBook(bk.Book(&#39;javascript&#39;, 15000, &#39;9874563254&#39;))

myBReposit.printBooksInfo()
myBReposit.printBookInfo(&#39;1234567890&#39;)
myBReposit.removeBook(&#39;1234567890&#39;)
myBReposit.printBooksInfo()



friendBReposit = bk.BookRepository()

friendBReposit.registBook(bk.Book(&#39;python&#39;, 10000, &#39;1234567890&#39;))
friendBReposit.registBook(bk.Book(&#39;java&#39;, 15000, &#39;852147963&#39;))
friendBReposit.registBook(bk.Book(&#39;c/c++&#39;, 17000, &#39;951378624&#39;))
friendBReposit.registBook(bk.Book(&#39;javascript&#39;, 5000, &#39;9874563254&#39;))

friendBReposit.printBooksInfo()
friendBReposit.printBookInfo(&#39;1234567890&#39;)
friendBReposit.removeBook(&#39;1234567890&#39;)
friendBReposit.printBooksInfo()
</code></pre>
<br/>


<p><code>실습_05</code></p>
<pre><code class="language-python">추상 클래스를 이용해서 한/영, 영/한 사전클래스를 만들어보자.

#클래스
from abc import ABCMeta
from abc import abstractmethod

class AbsDictionary(metaclass=ABCMeta):

    def __init__(self):
        self.wordDic = {}

    @abstractmethod
    def registWord(self, w1, w2):
        pass

    @abstractmethod
    def removeWord(self, w1):
        pass

    @abstractmethod
    def updateWord(self, w1, w2):
        pass

    @abstractmethod
    def searchWord(self, w1):
        pass


class KorToEng(AbsDictionary):

    def __init__(self):
        super().__init__()

    def registWord(self, w1, w2):
        print(f&#39;[KorToEng] registWord() : {w1} to {w2}&#39;)
        self.wordDic[w1] = w2

    def removeWord(self, w1):
        print(f&#39;[KorToEng] removeWord() : {w1}&#39;)
        del self.wordDic[w1]

    def updateWord(self, w1, w2):
        print(f&#39;[KorToEng] updateWord() : {w1} to {w2}&#39;)
        self.wordDic[w1] = w2

    def searchWord(self, w1):
        print(f&#39;[KorToEng] searchWord() : {w1}&#39;)
        return self.wordDic[w1]

    def printWords(self):
        for k in self.wordDic:
            print(f&#39;{k} : {self.wordDic[k]}&#39;)


class KorToJpa(AbsDictionary):

    def __init__(self):
        super().__init__()

    def registWord(self, w1, w2):
        print(f&#39;[KorToJpa] registWord() : {w1} to {w2}&#39;)
        self.wordDic[w1] = w2

    def removeWord(self, w1):
        print(f&#39;[KorToJpa] removeWord() : {w1}&#39;)
        del self.wordDic[w1]

    def updateWord(self, w1, w2):
        print(f&#39;[KorToJpa] updateWord() : {w1} to {w2}&#39;)
        self.wordDic[w1] = w2

    def searchWord(self, w1):
        print(f&#39;[KorToJpa] searchWord() : {w1}&#39;)
        return self.wordDic[w1]

    def printWords(self):
        for k in self.wordDic:
            print(f&#39;{k} : {self.wordDic[k]}&#39;)


if __name__ == &#39;__main__&#39;:
    kTe = KorToEng()

    # 단어 등록
    kTe.registWord(&#39;책&#39;, &#39;bok&#39;)
    kTe.registWord(&#39;나비&#39;, &#39;butterfly&#39;)
    kTe.registWord(&#39;연필&#39;, &#39;pencil&#39;)
    kTe.registWord(&#39;학생&#39;, &#39;studen&#39;)
    kTe.registWord(&#39;선생님&#39;, &#39;teacher&#39;)

    # 단어 수정
    kTe.updateWord(&#39;책&#39;, &#39;book&#39;)
    kTe.updateWord(&#39;학생&#39;, &#39;student&#39;)

    # 단어 검색
    print(f&#39;책 : {kTe.searchWord(&quot;책&quot;)}&#39;)
    print(f&#39;나비 : {kTe.searchWord(&quot;나비&quot;)}&#39;)
    print(f&#39;연필 : {kTe.searchWord(&quot;연필&quot;)}&#39;)
    print(f&#39;학생 : {kTe.searchWord(&quot;학생&quot;)}&#39;)
    print(f&#39;선생님 : {kTe.searchWord(&quot;선생님&quot;)}&#39;)

    # 단어 삭제
    kTe.removeWord(&#39;책&#39;)

    # 사전 출력
    kTe.printWords()


# 실행파일
import ADictionary as dic

kTe = dic.KorToEng()

# 단어 등록
kTe.registWord(&#39;책&#39;, &#39;bok&#39;)
kTe.registWord(&#39;나비&#39;, &#39;butterfly&#39;)
kTe.registWord(&#39;연필&#39;, &#39;pencil&#39;)
kTe.registWord(&#39;학생&#39;, &#39;studen&#39;)
kTe.registWord(&#39;선생님&#39;, &#39;teacher&#39;)

# 단어 수정
kTe.updateWord(&#39;책&#39;, &#39;book&#39;)
kTe.updateWord(&#39;학생&#39;, &#39;student&#39;)

# 단어 검색
print(f&#39;책 : {kTe.searchWord(&quot;책&quot;)}&#39;)
print(f&#39;나비 : {kTe.searchWord(&quot;나비&quot;)}&#39;)
print(f&#39;연필 : {kTe.searchWord(&quot;연필&quot;)}&#39;)
print(f&#39;학생 : {kTe.searchWord(&quot;학생&quot;)}&#39;)
print(f&#39;선생님 : {kTe.searchWord(&quot;선생님&quot;)}&#39;)

# 단어 삭제
kTe.removeWord(&#39;책&#39;)

# 사전 출력
kTe.printWords()


kTj = dic.KorToJpa()

# 단어 등록
kTj.registWord(&#39;책&#39;, &#39;本&#39;)
kTj.registWord(&#39;나비&#39;, &#39;蝶&#39;)
kTj.registWord(&#39;연필&#39;, &#39;鉛筆&#39;)
kTj.registWord(&#39;학생&#39;, &#39;学生&#39;)
kTj.registWord(&#39;선생님&#39;, &#39;先生&#39;)

# 단어 수정
kTj.updateWord(&#39;책&#39;, &#39;蝶&#39;)
kTj.updateWord(&#39;학생&#39;, &#39;学生&#39;)

# 단어 검색
print(f&#39;책 : {kTj.searchWord(&quot;책&quot;)}&#39;)
print(f&#39;나비 : {kTj.searchWord(&quot;나비&quot;)}&#39;)
print(f&#39;연필 : {kTj.searchWord(&quot;연필&quot;)}&#39;)
print(f&#39;학생 : {kTj.searchWord(&quot;학생&quot;)}&#39;)
print(f&#39;선생님 : {kTj.searchWord(&quot;선생님&quot;)}&#39;)

# 단어 삭제
kTj.removeWord(&#39;책&#39;)

# 사전 출력
kTj.printWords()</code></pre>
<br/>


<p><code>실습_06</code></p>
<pre><code class="language-python">주사위 게임 클래스를 만들고 컴퓨터와 사용자의 게임결과를 출력해보자.

#클래스
import random as rd

class Dice:

    def __init__(self):
        self.cNum = 0
        self.uNum = 0

    def setCnum(self):
        print(&#39;[Dice] setCnum()&#39;)
        self.cNum = rd.randint(1, 6)

    def setUnum(self):
        print(&#39;[Dice] setUnum()&#39;)
        self.uNum = rd.randint(1, 6)

    def startGame(self):
        print(&#39;[Dice] startGame()&#39;)
        self.setCnum()
        self.setUnum()

    def printResult(self):
        print(&#39;[Dice] printResult()&#39;)

        if self.cNum == 0 or self.uNum == 0:
            print(&#39;주사위 숫자 설정 전 입니다.&#39;)

        else:
            if self.cNum &gt; self.uNum:
                print(f&#39;컴퓨터 vs 유저 : {self.cNum} vs {self.uNum} &gt;&gt; 컴퓨터 승!!&#39;)

            elif self.cNum &lt; self.uNum:
                print(f&#39;컴퓨터 vs 유저 : {self.cNum} vs {self.uNum} &gt;&gt; 유저 승!!&#39;)

            elif self.cNum == self.uNum:
                print(f&#39;컴퓨터 vs 유저 : {self.cNum} vs {self.uNum} &gt;&gt; 무승부!!&#39;)


if __name__ == &#39;__main__&#39;:
    dc = Dice()
    dc.startGame()
    dc.printResult()


#실행파일
import dice

dc = dice.Dice()
dc.startGame()
dc.printResult()</code></pre>
<br/>


<h3 id="💡-오늘을-마무리하면서-">💡 오늘을 마무리하면서 ...</h3>
<p>정리가 정말 오래 걸렸고 이해 하기 까지가 엄청 오래 걸렸다.
근데 하나도 이해 안감 ㅠㅠ
소스하나하나 쪼개봐야할듯요 ㅠㅠ
<br/></p>
<h4 id="😃-busy-study-_-새벽반-pm-1000--am-230">😃 Busy Study _ 새벽반 PM 10:00 ~ AM 2:30</h4>
<h4 id="여러분-화이팅-우리-모두-다-잘-될거예요">여러분 화이팅!! 우리 모두 다 잘 될거예요!</h4>
]]></description>
        </item>
        <item>
            <title><![CDATA[오늘의 공부 / 230513]]></title>
            <link>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230513</link>
            <guid>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230513</guid>
            <pubDate>Sat, 13 May 2023 18:23:54 GMT</pubDate>
            <description><![CDATA[<h3 id="💬-오늘의-공부시간-pm-1100-am-0105">💬 오늘의 공부시간 PM 11:00~ AM 01:05</h3>
<p>몸이 아직 회복중인지 정말이지 집중하기가 힘들다.
머리에 안들어오는 중급파이썬도 내 건강에 영향을 미치는 것인지
머리랑 어깨가 엄청 무겁다. ㅠㅠ</p>
<br/>

<h3 id="🔥-2주차-todo-리스트-57514">🔥 2주차 todo 리스트 (5/7~5/14)</h3>
<p><del>파이썬 기초문풀4</del>
<del>파이썬 기초문풀5</del>
<del>파이썬 중급1</del>
<del>파이썬 중급2</del>
<del>파이썬 중급3</del>
<del>파이썬 중급4</del>
<del>파이썬 중급5</del>6<del>~
~</del>파이썬 중급7<del>~
~</del>파이썬 중급8<del>9</del>
<del>파이썬 중급문풀1</del>2~~
파이썬 중급문풀3
파이썬 중급문풀4
<br/></p>
<p><del>📝 weekly 데이터 사이언스 스쿨 퀴즈</del>
<del>📝 재복습weekly 데이터 사이언스 스쿨 퀴즈</del>
<br/></p>
<h3 id="💻-핵심-내용-정리">💻 핵심 내용 정리</h3>
<h4 id="🏅-문제풀이">🏅 문제풀이</h4>
<p><code>실습_01</code></p>
<pre><code class="language-python">다음과 같이 출력될수 있도록 이동거리와 이동시간을 반환하는 함수를 만들어보자.

def getDistance(speed, hour, minute):
    ditance = speed * (hour + minute / 60)
    return ditance

#100:75 = 60:x  --&gt;  75*60 /100
def getTime(speed, distence):
    time = distence / speed
    print(f&#39;time: {time}&#39;)
    h = int(time)
    m = int((time - h) * 100 * 60 / 100)

    return [h, m]


print(&#39;-&#39; * 60)
s = float(input(&#39;속도(km/h) 입력: &#39;))
h = float(input(&#39;시간(h) 입력: &#39;))
m = float(input(&#39;시간(m) 입력: &#39;))
d = getDistance(s, h, m)
print(f&#39;{s}(km/h)속도로 {h}(h)시간 {m}(m)분 동안 이동한 거리: {d}(km)&#39;)
print(&#39;-&#39; * 60)


print(&#39;-&#39; * 60)
s = float(input(&#39;속도(km/h) 입력: &#39;))
d = float(input(&#39;거리(km) 입력: &#39;))
t = getTime(s, d)
print(f&#39;{s}(km/h)속도로 {d}(km) 이동한 시간: {t[0]}(h)시간{t[1]}(m)분&#39;)
print(&#39;-&#39; * 60)</code></pre>
<br/>

<p><code>실습2</code></p>
<pre><code class="language-python">다음과  같이  출력  될  수  있도록  비행기  티켓  영수증  출력  함수를  만들어  보자.

childPrice = 18000
infantPrice = 25000
adultPrice = 50000
specialDC = 50


def formatedNumber(n):
    return format(n, &#39;,&#39;)

def printAirPlaneReceipt(c1, c2, i1, i2, a1, a2):

    cp = c1 * childPrice
    cp_dc = int(c2 * childPrice * 0.5)
    print(f&#39;유아{c1}명 요금 : {formatedNumber(cp)}원&#39;)
    print(f&#39;유아 할인 대상 {c2}명 요금: {formatedNumber(cp_dc)}원&#39;)

    ip = i1 * infantPrice
    ip_dc = int(i2 * infantPrice * 0.5)
    print(f&#39;소아{i1}명 요금 : {formatedNumber(ip)}원&#39;)
    print(f&#39;소아 할인 대상 {i1}명 요금: {formatedNumber(ip_dc)}원&#39;)

    ap = a1 * adultPrice
    ap_dc = int(a2 * adultPrice * 0.5)
    print(f&#39;성인{a1}명 요금 : {formatedNumber(ap)}원&#39;)
    print(f&#39;성인 할인 대상 {a2}명 요금: {formatedNumber(ap_dc)}원&#39;)

    print(f&#39;total: {formatedNumber(c1 + c2 + i1 + i2 + a1 + a2)}명&#39;)
    print(f&#39;TotalPrice: {formatedNumber(cp + cp_dc + ip + ip_dc + ap + ap_dc)}원&#39;)

childCnt = int(input(&#39;유아 입력: &#39;))
specialDCChildCnt = int(input(&#39;할인 대상 유아 입력: &#39;))

infantCnt = int(input(&#39;소아 입력: &#39;))
specialDCInfanCnt = int(input(&#39;할인 대상 소아 입력: &#39;))

adultCnt = int(input(&#39;성인 입력: &#39;))
specialDCadultCnt = int(input(&#39;할인 대상 성인 입력: &#39;))

printAirPlaneReceipt(childCnt, specialDCChildCnt,
                     infantCnt, specialDCInfanCnt, adultCnt,
        specialDCadultCnt )</code></pre>
<br/>

<p><code>실습_03</code></p>
<pre><code class="language-python">다음과  같이  출력  될  수  있도록  재귀함수를  이용해서  팩토리얼    함수를  만들어보자.

def formatedNumber(n):
    return format(n,&#39;,&#39;)

def recursionFun(n):

    if n == 1:
        return n

    return n * recursionFun(n-1)

inputNumber = int(input(&#39;input number: &#39;))
print(formatedNumber(recursionFun(inputNumber)))</code></pre>
<br/>


<p><code>실습_04</code></p>
<pre><code class="language-python">다음과  같이  출력  될  수  있도록  단리/월복리  계산기  함수를  만들어보자.

def formatedNumber(n):
    return format(n,&#39;,&#39;)

def singleRatecalculator(m, t, r):

    totalMoney = 0
    totalRateMoney = 0

    for i in range(t):
        totalRateMoney += m * (r * 0.01)

    totalMoney = m + totalRateMoney
    return int(totalMoney)

def multiRateCalculator(m, t, r):
    y = t * 12
    rpm = (r / 12) * 0.01

    totalMoney = m

    for i in range(t):
        totalMoney += totalMoney * rpm

    return int(totalMoney)

money = int(input(&#39;예치금(원): &#39;))
term = int(input(&#39;기간(년): &#39;))
rate = int(input(&#39;연 이율(%): &#39;))

print(&#39;[단리 계산기]&#39;)
print(f&#39;{term}년 후 총 수령액 : {formatedNumber(singleRatecalculator(money, term, rate))}&#39;)

print(&#39;[월복리 계산기]&#39;)
print(f&#39;{term}년 후 총 수령액 : {formatedNumber(multiRateCalculator(money, term, rate))}&#39;)
</code></pre>
<br/>


<p><code>실습_05</code></p>
<pre><code class="language-python">다음과  같이  출력  될  수  있도록  등차  수열의  n번째  값과  합을  출력하는  함수를 
만들어보자.

def sequencecal(n1, d, n):

    valueN = 0; sumN = 0;
    i = 1
    while i &lt;= n:

        if i == 1:
            valueN = n1
            sumN += valueN
            print(f&#39;{i}번째 항의 값: {valueN}&#39;)
            print(f&#39;{i}번째 항까지의 합: {sumN}&#39;)

            i += 1
            continue

        valueN += d
        sumN += valueN
        print(f&#39;{i}번째 항의 값: {valueN}&#39;)
        print(f&#39;{i}번째 항까지의 합: {sumN}&#39;)

        i += 1


inputN1 = int(input(&#39;a1 입력: &#39;))
inputD = int(input(&#39;공차 입력: &#39;))
inputN = int(input(&#39;n 입력: &#39;))

sequencecal(inputN1, inputD, inputN)</code></pre>
<br/>


<p><code>실습_06</code></p>
<pre><code class="language-python">다음과  같이  출력  될  수  있도록  등비  수열의  n번째  값과  합을  출력하는  함수를 
만들어보자

def sequencecal(n1, r, n):

    valueN = 0; sumN = 0;

    i = 1
    while i &lt;= n:

        if i == 1:
            valueN = n1
            sumN += valueN
            print(f&#39;{i}번째 항의 값: {valueN}&#39;)
            print(f&#39;{i}번째 항까지의 합: {sumN}&#39;)

            i += 1
            continue

        valueN *= r
        sumN += valueN
        print(f&#39;{i}번째 항의 값: {valueN}&#39;)
        print(f&#39;{i}번째 항까지의 합: {sumN}&#39;)

        i += 1


inputN1 = int(input(&#39;a1 입력: &#39;))
inputR = int(input(&#39;공비 입력: &#39;))
inputN = int(input(&#39;n 입력: &#39;))

sequencecal(inputN1, inputR, inputN)</code></pre>
<br/>


<p><code>실습_07</code></p>
<pre><code class="language-python">과목별  점수를  입력하면  합격  여부를  출력하는  모듈을  만들어보자. 
(평균  60이상  합격, 과락  40으로  한다.)

# 모듈파일
def exampleResult(s1, s2, s3, s4, s5):

    passAvgScore = 60; limitScore = 40

    def getTotal():
        totalScore = s1 + s2 + s3 + s4 + s5
        print(f&#39;총점: {totalScore}&#39;)
        return totalScore

    def getAverage():
        avg = getTotal() / 5
        print(f&#39;평균: {avg}&#39;)
        return avg

    def printPassOrFail():
        print(f&#39;{s1}: pass&#39;) if s1 &gt;= limitScore else print(f&#39;{s1}: fail&#39;)
        print(f&#39;{s2}: pass&#39;) if s2 &gt;= limitScore else print(f&#39;{s2}: fail&#39;)
        print(f&#39;{s3}: pass&#39;) if s3 &gt;= limitScore else print(f&#39;{s3}: fail&#39;)
        print(f&#39;{s4}: pass&#39;) if s4 &gt;= limitScore else print(f&#39;{s4}: fail&#39;)
        print(f&#39;{s5}: pass&#39;) if s5 &gt;= limitScore else print(f&#39;{s5}: fail&#39;)

    def printFinalPassOrFail():

        if getAverage() &gt;= passAvgScore:
            if s1 &gt;= limitScore and s2 &gt;= limitScore and s3 &gt;= limitScore and s4 &gt;= limitScore and s5 &gt;= limitScore:
                print(&#39;Final pass!!&#39;)
            else:
                print(&#39;Final Fail!!&#39;)

        else:
            print(&#39;Final Fail!!&#39;)

    getAverage()
    printPassOrFail()
    printFinalPassOrFail()


#실행파일
import passOrfail as pf
if __name__ == &#39;__main__&#39;:
    sub1 = int(input(&#39;과목1 점수 입력: &#39;))
    sub2 = int(input(&#39;과목2 점수 입력: &#39;))
    sub3 = int(input(&#39;과목3 점수 입력: &#39;))
    sub4 = int(input(&#39;과목4 점수 입력: &#39;))
    sub5 = int(input(&#39;과목5 점수 입력: &#39;))

    pf.exampleResult(sub1, sub2, sub3, sub4, sub5)</code></pre>
<br/>


<p><code>실습_08</code></p>
<pre><code class="language-python">상품  구매  개수에  따라  할인율이  결정되는  모듈을  만들고, 다음과  같이  계산  결과가 
출력되는  프로그램을  만들어보자.

# 모듈파일
def calculartorTotalPrice(gs):

    if len(gs) &lt;= 0:
        print(&#39;구매 상품이 없습니다.&#39;)
        return

    rate = 25
    totalPrice = 0

    rates = {1:5, 2:10, 3:15, 4:20}
    if len(gs) in rates:
        rate = rates[len(gs)]

    for g in gs:
        totalPrice += g * (1 - rate * 0.01)

    return [rate, int(totalPrice)]

def formatedNumber(n):
    return format(n, &#39;,&#39;)


# 실행파일
import discount as dc

if __name__ == &#39;__main__&#39;:

    flag = True
    gs = []

    while flag:

        selectNumber = int(input(&#39;1.구매, 2.종료&#39;))

        if selectNumber == 1:
            goods_price = int(input(&#39;상품 가격 입력: &#39;))
            gs.append(goods_price)

        elif selectNumber == 2:
            result = dc.calculartorTotalPrice(gs)
            flag = False

    print(f&#39;할인율: {result[0]}%&#39;)
    print(f&#39;합계: {dc.formatedNumber(result[1])}원&#39;)</code></pre>
<br/>


<p><code>실습_09</code></p>
<pre><code class="language-python">로또  모듈을  만들고  다음과  같이  로또  결과가  출력될  수  있도록  프로그램을 
만들어보자.


# 모듈파일
import random

userNums = []; randNums = []; collNums = []
randNums = 0

def setUserNums(ns):
    global userNums
    userNums = ns

def getUserNums():
    return randNums
    randNums = random.sample(range(1, 46), 6)

def getRandNum():
    return randNums

def setBonuNum():
    global randBonuNum

    while True:
        randBonuNum = random.randint(1, 45)
        if randBonuNum not in randNums:
            break

def getBonuNum():
    return randBounNum

def lottoResult():
    global userNums
    global randNums
    global collNums

    collNums = []
    for un in userNums:
        collNums.append(un)

    if len(collNums) == 6:
        print(&#39;1등 당첨!!&#39;)
        print(f&#39;번호: {collNums}&#39;)

    elif (len(collNums) == 5) and (randBounNum in userNums):
        print(&#39;2등 당첨!!&#39;)
    print(f&#39;번호: {collNums}, 보너스 번호: {randNums}&#39;)

    elif len(collNums) == 5:
    print(&#39;3등 당첨!!&#39;)
    print(f&#39; 번호: {collNums}&#39;)

    elif len(collNums) == 4:
    print(&#39;4등 당첨!!&#39;)
    print(f&#39; 번호: {collNums}&#39;)

    elif len(collNums) == 3:
    print(&#39;5등 당첨!!&#39;)
    print(f&#39; 번호: {collNums}&#39;)

    else:
    print(&#39;아쉽습니다. 다음 기회에~&#39;)
    print(f&#39;기계 번호 : {randNums}&#39;)
    print(f&#39;보너스 번호: {randBonuNums}&#39;)
    print(f&#39;선택 번호: {userNums}&#39;)
    print(f&#39;일치 번호: {collNums}&#39;)


def startLotto():
    n1 = int(input(&#39;번호(`1~46 입력: &#39;))
    n2 = int(input(&#39;번호(`1~46 입력: &#39;))
    n3 = int(input(&#39;번호(`1~46 입력: &#39;))
    n4 = int(input(&#39;번호(`1~46 입력: &#39;))
    n5 = int(input(&#39;번호(`1~46 입력: &#39;))
    n6 = int(input(&#39;번호(`1~46 입력: &#39;))
    selectNums = [n1, n2, n3, n4, n5, n6]

    setUserNums(selectNums)
    setRandNums()
    setBonuNum()

    lottoResult()


#실행파일
import lotto as lt

lt.startLotto()
</code></pre>
<br/>


<p><code>실습_10</code></p>
<pre><code class="language-python">순열  계산  모듈을  만들고  다음  순열  계산  결과를  출력해  보자.
#모듈파일
def getPermutaionCnt(n, r):

    result = 1
    for n in range(n, (n-r), -1):
        print(&#39;n:{}&#39;.format(n))
        result = result * n

    return result

#실행파일

import permutation as pt

numN = int(input(&#39;numN 입력: &#39;))
numR = int(input(&#39;numR 입력: &#39;))

print(f&#39;{numN}P{numR}: {pt.getPermutaionCnt(numN,numR)}&#39;)


#모듈파일
def getPermutaionCnt(n, r, logPrint = True):

    result = 1
    for n in range(n, (n-r), -1):
        if logPrint:print(&#39;n:{}&#39;.format(n))
        result = result * n

    return result


#실행파일
import permutation as pt

numN = int(input(&#39;numN 입력: &#39;))
numR = int(input(&#39;numR 입력: &#39;))

print(f&#39;{numN}P{numR}: {pt.getPermutaionCnt(numN,numR, logPrint = False)}&#39;)

</code></pre>
<br/>


<p><code>실습_11</code></p>
<pre><code class="language-python">   조합  계산  모듈을  만들고  다음  조합  계산  결과를  출력해  보자.

#모듈파일
def getCombinationCnt(n, r):

    resultP = 1
    resultR = 1
    resultC = 1

    for n in range(n, (n - r), -1):
        resultP = resultP * n


    for n in range(r, 0, -1):
        resultR = resultR * n

    resultC = int(resultP / resultR)

    return resultC

#실행파일
import combination as ct

numN = int(input(&#39;numN 입력: &#39;))
numR = int(input(&#39;numR 입력: &#39;))

print(f&#39;{numN}C{numR}: {ct.getCombinationCnt(numN, numR)}&#39;)</code></pre>
<br/>



<h3 id="💡-오늘을-마무리하면서-">💡 오늘을 마무리하면서 ...</h3>
<p>몸이 무리데쓰네..
이해는 도무지 안된다. 정상이라는 걸 강조 하니까 열심히 걍 외우는데 맞는가 모르겠다.
<br/></p>
<h4 id="😃-busy-study-_-새벽반-pm-1000--am-230">😃 Busy Study _ 새벽반 PM 10:00 ~ AM 2:30</h4>
<h4 id="여러분-화이팅-우리-모두-다-잘-될거예요">여러분 화이팅!! 우리 모두 다 잘 될거예요!</h4>
]]></description>
        </item>
        <item>
            <title><![CDATA[오늘의 공부 / 230512]]></title>
            <link>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230512</link>
            <guid>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230512</guid>
            <pubDate>Thu, 11 May 2023 19:25:17 GMT</pubDate>
            <description><![CDATA[<h3 id="💬-오늘의-공부시간-pm-1100-am-0300">💬 오늘의 공부시간 PM 11:00~ AM 03:00</h3>
<blockquote>
<p>단기간에 뛰어난 프로그래머가 되려고 하면 절대 성공할 수 없느니라.
웹서핑하다가 본 글...</p>
</blockquote>
<p>저질체력인 나에게는 너무 힘든 싸움이다 ㅠㅠ
몸이 아프니까 노트북도 느릿느릿 버벅이고 아픈것 같은 느낌</p>
<p>그럼에도 불구하고...</p>
<p>오늘도 힘내자 !!
<br/></p>
<h3 id="🔥-2주차-todo-리스트-58514">🔥 2주차 todo 리스트 (5/8~5/14)</h3>
<p><del>파이썬 기초문풀4</del>
<del>파이썬 기초문풀5</del>
<del>파이썬 중급1</del>
<del>파이썬 중급2</del>
<del>파이썬 중급3</del>
<del>파이썬 중급4</del>
<del>파이썬 중급5</del>6<del>~
~</del>파이썬 중급7<del>~
예외처리
try</del>except<del>else
finally
Excepption 클래스
~</del>파이썬 중급8<del>9</del>
사용자 Exception 클래스
텍스트 파일 쓰기
텍스트 파일 읽기
텍스트 파일 열기
with ~as문
writelines()
readlines(), readline()
<br/></p>
<p>파이썬 중급문풀1~2
파이썬 중급문풀3
파이썬 중급문풀4
<br/></p>
<p><del>📝 weekly 데이터 사이언스 스쿨 퀴즈</del>
<del>📝 재복습weekly 데이터 사이언스 스쿨 퀴즈</del>
<br/></p>
<h3 id="💻-핵심-내용-정리">💻 핵심 내용 정리</h3>
<h4 id="📝-예외란">📝 예외란?</h4>
<ul>
<li>문법적인 문제는 없으나 실행 중 발생하는 예상치 못한 문제이다.</li>
<li>예외 관련 클래스는 <code>인셉션 (Excepion)</code> 클래스를 상속한다.<br/>

</li>
</ul>
<h4 id="📝-예외처리">📝 예외처리</h4>
<ul>
<li>예상하지 못한 예외가 프로그램 전체에 영향이 없도록 처리하는 것</li>
<li>발생한 예외에 대해서 별도 처리한다.</li>
<li>예외 발생 예상 구문을 <code>try ~ except</code> 로 감싼다.</li>
<li>예외가 발생 하지 않은 경우에는<code>try ~ except ~ else</code>로 마무리 한다.<br/>

</li>
</ul>
<p><code>실습_01</code></p>
<pre><code class="language-python">사용자로 부터 숫자 5개를 입력 받을때, 숫자가 아닌 자료형이 입력되면 예외처리하는 프로그램을 만들어 보자.

# 예외가 발생 할 것 같은 구문

nums = []

n = 1
while n &lt; 6:
    try:
        num = int(input(&#39;input number: &#39;))
    except:
        print(&#39;예외 발생!!&#39;)
        continue

    nums.append(num)
    n += 1

print(f&#39;nums: {nums}&#39;)



# 예외가 발생하지 않은 경우 실행하는 경우

nums = []

n = 1
while n &lt; 6:
    try:
        num = int(input(&#39;input number: &#39;))
    except:
        print(&#39;예외 발생!!&#39;)
        continue
    else:
        if num % 2 == 0:
         nums.append(num)
         n += 1

        else:
            print(&#39;입력한 숫자는 홀수 입니다.&#39;, end=&#39;&#39;)
            print(&#39;다시 입력 하세요.&#39;)
            continue

print(f&#39;nums: {nums}&#39;)
</code></pre>
<h4 id="📝-finally">📝 Finally()</h4>
<ul>
<li>예외 발생과 상관없이 무조건 실행할때 항상 실행한다.
외부자원을 가지고 작업을 할때, 자원 해제를 하는 경우<br/>

</li>
</ul>
<p><code>예시</code></p>
<pre><code class="language-python">try:
    inputData = input(&#39;input number: &#39;)
    numInt = int(inputData)
except:
    print(&#39;excception raise!!&#39;)
    print(&#39;not number!!&#39;)
else:
    if numInt % 2 == 0:
        print(&#39;even number!!&#39;)
    else:
        print(&#39;odd number&#39;)
finally:
    print(f&#39;putData: {inputData}&#39;)</code></pre>
<br/>

<p><code>실습_02</code></p>
<pre><code class="language-python">사용자로부터 숫자 5개를 입력받아 짝수, 홀수, 실수와  입력한 모든 데이터를 각각 출력하는 프로그램을 만들어보자.

evenList = []; oddList = []; floatList = []; dataList = []

n = 1
while n &lt; 6:

    try:
        data = input(&#39;input number:&#39;)
        floatNum = float(data)
    except:
        print(&#39;exception raise!!&#39;)
        print(&#39;not number!!&#39;)
        continue
    else:
        if floatNum - int(floatNum) != 0:  # 실수
            print(&#39;float number!!&#39;)
            floatList.append(int(floatNum))
        else:
            if floatNum % 2 == 0:  # 짝수
                print(&#39;even number!!&#39;)
                evenList.append(int(floatNum)
            else:    # 홀수
                print(&#39;odd number!!&#39;)
                oddList.append(floatNum)

        n += 1

    finally:
        dataList.append(data)


print(f&#39;evenList: {evenList}&#39;)
print(f&#39;oddList: {oddList}&#39;)
print(f&#39;floatList: {floatList}&#39;)
print(f&#39;dataList: {dataList}&#39;)</code></pre>
<br/>

<h4 id="📝-exception-인셉션-클래스">📝 Exception (인셉션) 클래스</h4>
<ul>
<li>예외담당 클래스라고 이해하자.</li>
<li>Exception 클래스를 상속해서 <code>사용자 Exception (인셉션) 클래스</code>를 만들 수 있다</li>
</ul>
<br/>

<p><code>예시</code></p>
<pre><code class="language-python">num1 = int(input(&#39;input number1:&#39;))
num2 = int(input(&#39;input number2:&#39;))

try:
    print(f&#39;num1 / num2 = {num1 / num2}&#39;)
except :
    print(&#39;0으로 나눌 수 없습니다.&#39;)

print(f&#39;num1 * num2 = {num1 * num2}&#39;)
print(f&#39;num1 - num2 = {num1 - num2}&#39;)
print(f&#39;num1 + num2 = {num1 + num2}&#39;)</code></pre>
<pre><code class="language-python">num1 = int(input(&#39;input number1:&#39;))
num2 = int(input(&#39;input number2:&#39;))

try:
    print(f&#39;num1 / num2 = {num1 / num2}&#39;)
except Exception  as e:
    print(&#39;0으로 나눌 수 없습니다.&#39;)
    print(f&#39;exception: {e}&#39;)

print(f&#39;num1 * num2 = {num1 * num2}&#39;)
print(f&#39;num1 - num2 = {num1 - num2}&#39;)
print(f&#39;num1 + num2 = {num1 + num2}&#39;)</code></pre>
<br/>

<h4 id="📝-raise-키워드">📝 raise 키워드</h4>
<ul>
<li><code>raise</code> 키워드를 이용하면 강제로 예외를 발생시킬 수 있다<br/>

</li>
</ul>
<p><code>예시</code></p>
<pre><code class="language-python">def divcalculator(n1, n2):

    if n2 != 0:
        print(f&#39;{n1} / {n2} = {n1 / n2}&#39;)
    else:
        raise Exception(&#39;0으로 나눌 수 없습니다.&#39;)

num1 = int(input(&#39;input number1:&#39;))
num2 = int(input(&#39;input number2:&#39;))
divcalculator(num1, num2)</code></pre>
<pre><code class="language-python">def divcalculator(n1, n2):

    if n2 != 0:
        print(f&#39;{n1} / {n2} = {n1 / n2}&#39;)
    else:
        raise Exception(&#39;0으로 나눌 수 없습니다.&#39;)

num1 = int(input(&#39;input number1:&#39;))
num2 = int(input(&#39;input number2:&#39;))

try:
    divcalculator(num1, num2)
except Exception as e:
    print(f&#39;Exception: {e}&#39;)</code></pre>
<br/>

<p><code>실습_03</code></p>
<pre><code class="language-python">사용자가 문자메세지를 보낼대 10글자 이하면 SMS로 발송하고, 10글자를 초과하면 MMS로 발송하는 프로그램을 예외 처리를 이용해서 만들어 보자.

def sendSMS(msg):

    if len(msg) &gt; 10:
        raise Exception(&#39;길이초과!! MMS전환 후 발송!!&#39;, 1)
    else:
        print(&#39;SMS 발송!!&#39;)

def sendMMS(msg):
    if len(msg) &lt;= 10:
        raise Exception(&#39;길이 미달!! SMS전환 후 발송!!&#39;, 2)
    else:
        print(&#39;MMS 발송!!&#39;)

msg = input(&#39;input message: &#39;)

try:
    sendSMS(msg)
except Exception as e:
    print(f&#39;e: {e.args[0]}&#39;)
    print(f&#39;e: {e.args[1]}&#39;)

    if e.args[1] == 1:
        sendMMS(msg)
    elif e.args[1] == 2:
        sendSMS(msg)</code></pre>
<br/>

<h4 id="📝-텍스트-파일">📝 텍스트 파일</h4>
<ul>
<li>open() 파일 열기</li>
<li>read() 읽기</li>
<li>write() 쓰기</li>
<li>close() 파일 닫기<br/>

</li>
</ul>
<pre><code class="language-python"># 쓰기모드 : write()   /  W
- 기존의 문자는 없애고, 새로운 문자로 대치한다.
- 해당하는 파일이 없으면 새로 생성, 있으면 열린다.

file = open(&#39;c:pythonTxt/test.txt&#39;, &#39;w&#39;)

strCcnt = file.write(&#39;Hello world!&#39;)
print(f&#39;strCnt: {strCnt}&#39;)

fille.close()</code></pre>
<pre><code class="language-python"># 읽기모드 : read() 읽기  /  R 
- 숫자로 읽던 문자로 읽던 무조건 문자열로 불러온다.

file = open(&#39;c:pythonTxt/test.txt&#39;, &#39;r&#39;)

strCcnt = file.read()
print(f&#39;str: {str}&#39;)

fille.close()</code></pre>
<br/>


<p><code>실습_04</code></p>
<pre><code class="language-python">다음과 같이 시스템 시간과 일정을 텍스트 파일에 작성해보자.

import time

lt = time.localtime()
# dateStr = &#39;[&#39; + str(lt.tm_year) + &#39;년&#39; + \
#           str(lt.tm_mon) + &#39;월&#39; + str(lt.tm_mday) + &#39;일]&#39;

dateStr = &#39;[&#39; + time.strftime(&#39;%Y-%m-%d %I:%M:%S %p&#39;) + &#39;]&#39;
todaySchedule = input(&#39;오늘 일정: &#39;)

file = open(&#39;C:/pythonTxt/test.txt&#39;, &#39;w&#39;)
file.write(dateStr + todaySchedule)
file.close()
</code></pre>
<p><code>실습_05</code></p>
<pre><code class="language-python">file = open(&#39;C:/pythonTxt/about_python.txt&#39;, &#39;r&#39;, encoding=&#39;UTF8&#39;)

str = file.read()
print(f&#39;str: {str})
file.close()

str = str.replace(&#39;Python&#39;, &#39;파이썬&#39;, 2)  # 영문을 한글로 바꿈: 총 3개의 영문에서 2개만 바꾼다.
print(f&#39;str: {str})

file = open(&#39;C:/pythonTxt/about_python.txt&#39;, &#39;w&#39;)
file.write(str)
file.close()</code></pre>
<br/>

<h4 id="📝-파일모드">📝 파일모드</h4>
<p>파일 모드는 파일을 어떤 목적으로 open할지 정한다</p>
<ul>
<li>W : 쓰기 전용(파일이 있으면 덮어씌움/삭제됨)</li>
<li>a : 쓰기 전용(파일이 있으면 덧붙임/삭제안됨)</li>
<li>x : 쓰기 전용(파일이 잇으면 에러발생)</li>
<li>r : 읽기 전용(파일이 없으면 에러발생)<br/>

</li>
</ul>
<p><code>실습_06</code></p>
<pre><code class="language-python">uri =&#39;C:/pythonTxt/&#39;

def writePrimeNumber(n):
    file = open(uri + &#39;prime_number.txt&#39;, &quot;a&quot;)
    file.write(str(n))
    file.write(&#39;\n&#39;)

    file.close()

inputNumber = int(input(&#39;0보다 큰 정수 입력: &#39;))
for number in range(2, (inputNumber + 1)):
    flag = True
    for n in range(2, number):
        if number % n == 0:
            flag = False
            break

    if (flag):
        writePrimeNumber(number)</code></pre>
<br/>

<h4 id="📝-텍스트파일-with--as문">📝 텍스트파일: with ~ as문</h4>
<ul>
<li><code>file.close()</code>라는 구문이 없어도 자동으로 파일을 닫아준다.</li>
<li>파일 닫기를 생략 할 수 있다.</li>
</ul>
<p><code>예시</code></p>
<pre><code class="language-python">uri = &#39;C:/pythonTxt/&#39;

file = open(uri + &#39;5_037.txt&#39;, &#39;a&#39;)
file.write(&#39;python study!!&#39;)
file.close()

file = open(uri + &#39;5_037.txt&#39;, &#39;r&#39;)
print(file.read())
file.close()</code></pre>
<pre><code class="language-python">uri = &#39;C:/pythonTxt/&#39;

with.open(uri + &#39;5_037.txt&#39;, &#39;a&#39;) as f:
    f.write(&#39;python study!!&#39;)

with.open(uri + &#39;5_037.txt&#39;, &#39;r&#39;) as f:
     print(f.read())</code></pre>
<br/>

<p><code>실습_07</code></p>
<pre><code class="language-python">로또번호 생성기 프로그램을 만들고 파일에 번호를 출력해보자.

import random

uri = &#39;C:/pythonTxt/&#39;

def writeNumber(nums):
    for idx, num in enumerate(nums):
        with open(uri + &#39;lotto.txt&#39;, &#39;a&#39;) as f:
            if idx &lt; (len(nums) - 2):
                f.write(str(nums) + &#39;, &#39;)
            elif idx == (len(nums) - 2):
                f.write(str(num))
            elif idx == (len(nums) - 1):
                f.write(&#39;\n&#39;)
                f.write(&#39;bonus: &#39; + str(num))
                f.write(&#39;\n&#39;)

rNums = random.sample(range(1,46), 7)
print(f&#39;rNums: {rNums}&#39;)

writeNumber(rNums)</code></pre>
<h4 id="📝-텍스트파일-_writelines">📝 텍스트파일: _writelines()</h4>
<ul>
<li>반복 가능한 자료형의 데이터를 파일에 쓸수 있다.</li>
<li><code>리스트(list)</code> 또는 <code>튜플</code> 데이터를 파일에 쓰기 위한 함수<br/>

</li>
</ul>
<p><code>예시</code></p>
<pre><code class="language-python">languages = [&#39;C/C++&#39;, &#39;java&#39;, &#39;c#&#39;, &#39;python&#39;, &#39;javascript&#39;]

uri = &#39;C:/pythonTxt/&#39;

for item in languages:
    with open(uri + &#39;languages.txt&#39;, &#39;a&#39;) as f:
    f.write(item)
    f.write(&#39;\n&#39;)</code></pre>
<pre><code class="language-python">languages = [&#39;C/C++&#39;, &#39;java&#39;, &#39;c#&#39;, &#39;python&#39;, &#39;javascript&#39;]

uri = &#39;C:/pythonTxt/&#39;

with open(uri + &#39;languages.txt&#39;, &#39;a&#39;) as f:
    f.writelines(item + &#39;\n&#39; for item in languages) # 중요 _ 반복문을 사용

with open(uri + &#39;languages.txt&#39;, &#39;r&#39;) as f:
    print(f.read()) # 콘솔창에서 읽기</code></pre>
<br/>

<p><code>실습_08</code></p>
<pre><code class="language-python">딕셔너리에 저장된 과목별 점수를 파일에 저장하는 코드를 작성하자.

uri = &#39;C:/pythonTxt/&#39;

scoreDic = {&#39;kor&#39;: 85, &#39;eng&#39;: 90, &#39;mat&#39;:92, &#39;sci&#39;: 79, &#39;his&#39;: 82}
for key in scoreDic.keys():
    with open(uri + &#39;scoreDic.txt&#39;, &#39;a&#39;) as f:
        f.write(key + &#39;\t: &#39; + str(scoreDic[key]) + &#39;\n&#39;)


print(scoreDic, file=f)  # 입력된 리스트 통째로 가져오는 코드</code></pre>
<h4 id="📝-텍스트파일-_readlines-readline">📝 텍스트파일: _readlines(), readline()</h4>
<blockquote>
<p><code>readlines()</code>
파일의 모든 데이터를 읽어서 리스트 형태로 반환한다.
<code>readline()</code>
한 행을 읽어서 문자열로 반환한다.</p>
</blockquote>
<br/>

<h3 id="💡-오늘을-마무리하면서-">💡 오늘을 마무리하면서 ...</h3>
<p>와 진짜 거짓말 안하고 5번은 본 것 같은 왜케 구조가 헷갈리는지 모르겟다.
더 천천히 쪼개 봐야하나보다.
아니면 아직 내가 아파서 약먹고 몽롱해서 머리에 안들어오는 것일지도...
교수님 정말로 꼼꼼히 설명해주시는것 같은데 머리에 안들어와 ㅠㅠ
<br/></p>
<h4 id="😃-busy-study-_-새벽반-pm-1000--am-230">😃 Busy Study _ 새벽반 PM 10:00 ~ AM 2:30</h4>
<h4 id="여러분-화이팅-우리-모두-다-잘-될거예요">여러분 화이팅!! 우리 모두 다 잘 될거예요!</h4>
]]></description>
        </item>
        <item>
            <title><![CDATA[오늘의 공부 / 230511]]></title>
            <link>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230511</link>
            <guid>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230511</guid>
            <pubDate>Wed, 10 May 2023 15:44:11 GMT</pubDate>
            <description><![CDATA[<h3 id="💬-오늘의-공부시간-am0300-am-630">💬 오늘의 공부시간 AM03:00 ~AM 6:30</h3>
<p>다들 감기 조심하세요. 진짜 요즘 감기는 낫기가 어렵네 ㅠㅠ
미친 기침감기.. 몸살로 오는 것 같아 힘드네 ㅠ
<br/></p>
<h3 id="🔥-2주차-todo-리스트-58514">🔥 2주차 todo 리스트 (5/8~5/14)</h3>
<p><del>파이썬 기초문풀4</del>
<del>파이썬 기초문풀5</del>
<del>파이썬 중급1</del>
<del>파이썬 중급2</del>
<del>파이썬 중급3</del>
<del>파이썬 중급4</del>
<del>파이썬 중급5</del>6<del>~
객체와 메모리
얕은 복사와 깊은 복사
클래스상속
생성자(01)
생성자(02)
다중 상속
오버라이딩
추상클래스
예외란?
<br/>
파이썬 중급7
파이썬 중급8</del>9
파이썬 중급문풀1<del>2
파이썬 중급문풀3
파이썬 중급문풀4
<br/>
~</del>📝 weekly 데이터 사이언스 스쿨 퀴즈<del>~
~</del>📝 재복습weekly 데이터 사이언스 스쿨 퀴즈~~
<br/></p>
<h3 id="💻-핵심-내용-정리">💻 핵심 내용 정리</h3>
<h4 id="📝-얕은복사와-깊은복사">📝 얕은복사와 깊은복사</h4>
<blockquote>
<p>얕은복사
객체주소를 복사하는 것으로 객체 자체가 복사되지 않는다.</p>
</blockquote>
<ul>
<li>객체 주소만 복사 (객체는 하나)</li>
<li>출력값이 같다.</li>
</ul>
<blockquote>
<p>깊은 복사
객체자체를 복사하는 것으로 또 하나의 객체가 만들어 진다.</p>
</blockquote>
<ul>
<li>객체 자체를 복사 (객체가 둘)</li>
<li>출력값이 다르다.</li>
</ul>
<br/>

<p><code>예시</code></p>
<pre><code class="language-python">class TemCls:
    def __inti__ (self, n , s) :
        self.number = n
        self.str = s

    def printClsInfo(self):
        print(f&#39;self.number: {self.number}&#39;)
        print(f&#39;self.str: {self.str}&#39;)

#얕은 복사
tc1 = TemCls(10, &#39;Hello&#39;)
tc2 = tc1

tc1.printClsInfo()
tc2.printClsInfo()

tc2.number = 3.14
tc2.str = &#39;Bye&#39;

tc1.printClsInfo()
tc2.printClsInfo()

#깊은 복사
import copy

tc1 = TemCls(10,&#39;Hello&#39;)
tc2 = copy.copy(tc1)

tc1.printClsInfo()
tc2.printClsInfo()

tc2.number = 3.14
tc2.str = &#39;Bye&#39;

tc1.printClsInfo()
tc2.printClsInfo()</code></pre>
<br/>

<p><code>예시</code></p>
<pre><code class="language-python"># 리스트를 이용한 복사
import copy

scores = [9, 8, 5, 7, 6, 10]
scoresCopy = []

scoresCopy = scores  # 얕은 복사
print(f&#39;id(scores): {id(scores)}&#39;)
print(f&#39;id(scoresCopy): {id(scoresCopy)}&#39;)

for s in scores:   #깊은 복사 _ 값은 똑같지만 개체값이 다르다
    scoresCopy.append(s)

print(f&#39;id(scores): {id(scores)}&#39;)
print(f&#39;id(scoresCopy): {id(scoresCopy)}&#39;)

scoresCopy.extend(scores)     #깊은 복사
print(f&#39;id(scores): {id(scores)}&#39;)
print(f&#39;id(scoresCopy): {id(scoresCopy)}&#39;)

scoresCopy = scores.copy()   # 깊은 복사
print(f&#39;id(scores): {id(scores)}&#39;)
print(f&#39;id(scoresCopy): {id(scoresCopy)}&#39;)

scoresCopy = scores[:]      # 깊은복사 _슬라이싱
print(f&#39;id(scores): {id(scores)}&#39;)
print(f&#39;id(scoresCopy): {id(scoresCopy)}&#39;)</code></pre>
<br/>

<p><code>실습_01</code></p>
<pre><code class="language-python"></code></pre>
<h4 id="📝-상속이란">📝 상속이란?</h4>
<ul>
<li>클래스는  또 다른 클래스를 상속해서 내 것처럼 사용할수 있다.</li>
</ul>
<blockquote>
<p>class1 → (class1) + class2 → (class1 + class2) + class3</p>
</blockquote>
<ul>
<li>상위 클래스로 갈수록 이전 클래스는 상속되어진다</li>
</ul>
<p><code>예시</code></p>
<pre><code class="language-python">class NormalCar:

    def drive(self):
        print(&#39;[NomalCar] drive() called!!&#39;)

    def back(self):
        print(&#39;[NomalCar] back() called!!&#39;)

class  TurboCar(NormalCar):

    def turbo(self):
        print(&#39;[TurboCar] turbo() called!!&#39;)

myTurboCar = TurboCar()

myTurboCar.turbo()
myTurboCar.drive()
myTurboCar.back()</code></pre>
<br/>

<p><code>실습_02</code></p>
<pre><code class="language-python">뎃셈, 뺄셈 기능이 있는 클래스를 만들고,, 이를 상속하는 클래스를 만들어서 곱세과 나눗 기능을 추가해보자.

class CalculatorSuper:

    def add(self, n1 , n2):
        return n1 + n2

    def sub(self, n1, n2):
        return n1 - n2

class CalculatorChild(CalculatorSuper):

    def mul(self, n1 , n2):
        return n1 * n2

    def div(self, n1, n2):
        return n1 / n2

myCalculator = CalculatorChild()

print(myCalculator.add(10, 20))
print(myCalculator.sub(10, 20))
print(myCalculator.mul(10, 20))
print(myCalculator.div(10, 20))</code></pre>
<br/>

<h4 id="📝-생성자">📝 생성자</h4>
<ul>
<li>객체가 생성될 때 생성자를 호출하면 <code>__init__()</code> 가 자동 호출된다.</li>
<li><code>__init__()</code> 가 속성을 초기화 한다.</li>
<li>상위클래스의 속성을 초기화 하기 위해서 <code>super()</code>를 이용한다.
<code>class.__init__()(self)</code> 강제적으로 출력해서 상위 클래스의 속성를 초기화 할수 있다.<br/>

</li>
</ul>
<p><code>예시_01</code></p>
<pre><code class="language-python">class Calculator:

    def __init__(self):
        print(&#39;[Calculator] __init__() called!!&#39;)

cal = Calculator()</code></pre>
<br/>

<p><code>예시_02</code></p>
<pre><code class="language-python">class Calculator:

    def __init__(self, n1, n2):
        print(&#39;[Calculator] __init__() called!!&#39;)
        self.num1 = n1
        self.num2 = n2

cal = Calculator(10, 20)
print(f&#39;cal.num1: {cal.num1}&#39;)
print(f&#39;cal.num2: {cal.num2}&#39;)</code></pre>
<br/>

<h4 id="📝-다중상속">📝 다중상속</h4>
<ul>
<li>2개 이상의 클래스를 상속한다.<br/>

</li>
</ul>
<h4 id="📝-오버라이딩">📝 오버라이딩</h4>
<ul>
<li>하위클래스에서 상위 클래스의 메서드를 재정의(override) 한다.<br/>

</li>
</ul>
<h4 id="📝-추상클래스">📝 추상클래스</h4>
<ul>
<li>상위 클래스에서 하위 클래스에 메서드 구현을 강요한다.<br/>

</li>
</ul>
<h3 id="💡-오늘을-마무리하면서-">💡 오늘을 마무리하면서 ...</h3>
<p>너무 힘들어서 어떻게 했는지 모르겠다.
약을  먹음 약을 먹어서 헤롱헤롱~
퇴근하고 와서 어떻게 잤는지 기억이 안나고 일찍 일어나서 공부한것도 진짜 놀라움
깊은복사 한번 복습해야지..
스터디노트도 마물하고 공개처리 해야지,, 할고많으당.</p>
<br/>

<h4 id="😃-busy-study-_-새벽반-pm-1000--am-230">😃 Busy Study _ 새벽반 PM 10:00 ~ AM 2:30</h4>
<h4 id="여러분-화이팅-우리-모두-다-잘-될거예요">여러분 화이팅!! 우리 모두 다 잘 될거예요!</h4>
]]></description>
        </item>
        <item>
            <title><![CDATA[오늘의 공부 / 230510]]></title>
            <link>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230510</link>
            <guid>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230510</guid>
            <pubDate>Wed, 10 May 2023 15:31:20 GMT</pubDate>
            <description><![CDATA[<h3 id="💬-오늘의-공부시간">💬 오늘의 공부시간</h3>
<br/>


<h3 id="🔥-2주차-todo-리스트-58514">🔥 2주차 todo 리스트 (5/8~5/14)</h3>
<p><del>파이썬 기초문풀4</del>
<del>파이썬 기초문풀5</del>
<del>파이썬 중급1</del>
<del>파이썬 중급2</del>
<del>파이썬 중급3</del>
모듈
모듈제작
모듈사용
실행(메인)파일(01)
실행(메인)파일(02)
패키지
site-packages
<del>파이썬 중급4</del>
자주 사용하는 외부 모듈
객체지향 프로그래밍
클래스와 객체 생성
객체 속성 변경
객체와 메모리
<br/>
파이썬 중급5<del>6
파이썬 중급7
파이썬 중급8</del>9
파이썬 중급문풀1<del>2
파이썬 중급문풀3
파이썬 중급문풀4
<br/>
~</del>📝 weekly 데이터 사이언스 스쿨 퀴즈<del>~
~</del>📝 재복습weekly 데이터 사이언스 스쿨 퀴즈~~
<br/></p>
<h3 id="💻-핵심-내용-정리">💻 핵심 내용 정리</h3>
<h4 id="📝-모듈">📝 모듈</h4>
<ul>
<li>이미 만들어진 훌륭한 기능으로 사용자는 쉽게 사용할 수 있다.</li>
<li>내부모듈, 외부모듈 그리고 사용자 모듈로 구분할 수 있다.</li>
</ul>
<blockquote>
<p><code>내부모듈</code>
파이썬 설치시 기본적으로 사용할 수 있는 모듈
<code>외부모듈</code>
별도 설치 후 사용할 수 있는 모듈
<code>사용자 모듈</code>
사용자가 직접 만든 모듈</p>
</blockquote>
<p><code>실습_01</code></p>
<pre><code class="language-python">ramdom 모듈을 이용해서 1부터 10까지의 정수 중 난수 1개를 발생시켜보자.

import random

rNum = random.randint(1, 10)
print(f&#39;rNum: {rNum}&#39;)</code></pre>
<p><code>실습_02</code></p>
<pre><code class="language-python">ramdom 모듈을 이용해서 1부터 100사이의 난수 10개를 발생시켜보자.

import random

rNums = random.sample(range(1, 101), 10)
print(f&#39;rNum: {rNum}&#39;)</code></pre>
<br/>

<h4 id="📝-모듈만들기">📝 모듈만들기</h4>
<ul>
<li>특정 기능을 가지고 있는 파이썬 파일을 말한다.</li>
</ul>
<p><code>실습_03</code></p>
<pre><code class="language-python">로또번호(6개)를 출력하는 모듈을 만들어 보자.

`모듈파일`
import random

def getLottoNumbers():
    result = random.sample(range(1, 46), 6)

    return result

`실행파일`
import lottoMachine

lottoNumbers = lottoMachine.getLottoNumbers()
print(f&#39;lottoNumbers: {lottoNumbers}&#39;)</code></pre>
<br/>

<h4 id="📝-모듈-사용">📝 모듈 사용</h4>
<blockquote>
<p><code>import</code>
import 키워드를 이용해서 모듈을 임포트 한다.</p>
</blockquote>
<blockquote>
<p><code>as</code>
as 키워드를 이용해서 모듈 이름을 단축시킬수 있다.</p>
</blockquote>
<blockquote>
<p><code>from ~ as</code>
from ~ as 키워드를 이용해서 모듈의 특정 기능만 사용할수 있다.</p>
</blockquote>
<p><code>실습_04</code></p>
<pre><code class="language-python">국어, 영어, 수학점수를 입력하면, 총점 평군을 출력하는 모듈을 만들어보자.

`모듈파일`
scores = []

def addscore(s):
    scores.append(s)

def getScore():
    return scores

def getTotalScore():
    total = 0
    for s in scores:
        total += 0

    return total

def getAvgScore():
    avg = getTotalScore() / len(scores)

    return avg

&#39;실행파일&#39;</code></pre>
<br/>


<h4 id="📝-실행파일--전역변수기본변수">📝 실행파일 : 전역변수(기본변수)</h4>
<ul>
<li><code>_name_</code> 에는 모듈 이름이 저장되거나 <code>_main_</code> 이 저장된다.</li>
</ul>
<blockquote>
<p><code>예시</code>
addModule.py   →   <em>name</em> = &#39;addModule&#39;
subModule.py   →   <em>name</em> = &#39;subModule&#39;
mulModule.py   →   <em>name</em> = &#39;mulModule&#39;
divModule.py   →   <em>name</em> = &#39;divModule&#39;
<br/>
module.py   →   <em>name</em> = &#39;main&#39;  # 실행파일</p>
</blockquote>
<br/>

<h4 id="📝-패키지">📝 패키지</h4>
<ul>
<li>패키지를 이용하면 관련 있는 모듈을  그룹으로 관리 할수 있다.</li>
<li><code>site-packages</code> 에 있는 모듈은 어디서나 사용할 수 있다.<pre><code class="language-python">import sys
</code></pre>
</li>
</ul>
<p>for path in sys.path:
    print(path)</p>
<p>```
<br/></p>
<h4 id="📝-자주-사용하는-모듈">📝 자주 사용하는 모듈</h4>
<blockquote>
<p><code>math 모듈</code>        수학 관련 모듈
<code>random 모듈</code>    난수 관련 모듈
<code>time 모듈</code>        시간 관련 모듈</p>
</blockquote>
<br/>

<h4 id="📝-객체-지향-프로그래밍">📝 객체 지향 프로그래밍</h4>
<ul>
<li>객체를 이용한 프로그램으로 객체는 속성과 기능으로 구성된다.</li>
<li>객체는 클래스에서 생성된다.
메모리에 생선된 개체를 내가 원하는 만큼 사용한다.</li>
<li>코드 재사용, 모듈화에 좋다.
언제든지 교체가 가능하다.</li>
</ul>
<blockquote>
<p>객체(Object) = 속성(Attribute) + 기능(Function)</p>
</blockquote>
<br/>

<h4 id="📝-class클래스">📝 class(클래스)</h4>
<ul>
<li>클래스는 <code>class</code> 키워드와 속성(변수) 그리고 기능(함수)를 이용해서 만든다.</li>
<li>객체는 클래스의 생성자를 호출한다. <code>_init_</code></li>
<li>객체 속성은 변경할 수 있다.</li>
<li>변수는 객체의 메모리 주소를 저장하고 이를 이용해서 객체를 참조한다.<br/>

</li>
</ul>
<h4 id="📝-얕은-복사와-깊은-복사">📝 얕은 복사와 깊은 복사</h4>
<blockquote>
<p><code>얕은 복사</code>
객체 주소를 복사하는 것으로 객체 자체가 복사되지 않는다.
<code>깊은 복사</code>
객체 자체를 복사하는 것으로 또 하나의 객체가 만들어진다.
<br/></p>
</blockquote>
<h4 id="📝-class클래스-상속">📝 class(클래스) 상속</h4>
<ul>
<li>클래스는 또 다른 클래스를 상속해서 내 것처럼 사용 할 수 있다.</li>
</ul>
<br/>

<h4 id="📝-생성자">📝 생성자</h4>
<ul>
<li>객체가 생성 될때 생성자를 호출하면 <code>_init_()</code> 가 자동 호출된다.</li>
<li><code>_init_()</code> 가 속성을 초기화 한다.</li>
<li>상위클래스의 속성을 초기화 하기 위해서 <code>super()</code> 를 이용한다.<br/>

</li>
</ul>
<h4 id="📝-다중상속">📝 다중상속</h4>
<ul>
<li>2개 이상의 클래스를 상속하다.
자주 사용하지 말자!!<br/>

</li>
</ul>
<h4 id="📝-오버라이딩">📝 오버라이딩</h4>
<ul>
<li>하위클래스에서 상위 클래스의 메서드를 재정의(override)한다.<br/>

</li>
</ul>
<h4 id="📝-추상클래스">📝 추상클래스</h4>
<ul>
<li>상위클래스에서 하위클래스에 메서드 구현을 강요한다.</li>
</ul>
<br/>

<h3 id="💡-오늘을-마무리하면서-">💡 오늘을 마무리하면서 ...</h3>
<p>목감기는 나았지만 기침감기가 심해지고 있다.
체력적으로 버티기 점점 힘이들지만 강의는 열심히 이해할때까지 반복수강중이다.
나중에 더 나노단위로 쪼개서 봐야할것 같다.
<br/></p>
<h4 id="😃-busy-study-_-새벽반-pm-1000--am-230">😃 Busy Study _ 새벽반 PM 10:00 ~ AM 2:30</h4>
<h4 id="여러분-화이팅-우리-모두-다-잘-될거예요">여러분 화이팅!! 우리 모두 다 잘 될거예요!</h4>
]]></description>
        </item>
        <item>
            <title><![CDATA[오늘의 공부 /  230509]]></title>
            <link>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230509</link>
            <guid>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230509</guid>
            <pubDate>Mon, 08 May 2023 14:54:25 GMT</pubDate>
            <description><![CDATA[<h3 id="💬-오늘의-공부시간-pm-1000--am-100">💬 오늘의 공부시간 PM 10:00 ~ AM 1:00</h3>
<p>기초를 이해를 다 하기도 전에 중급이라니... 
정말이지 이해하면서 강의 듣는 건 무리일까?
더 나를 악착같이 몰아야하나...</p>
<hr>
<p>♥ 좋은말
애매한 재능을 뛰어 넘는 유일한 방법은 꾸준히, 주구장창, 질리더라도 계속, 
멈추지 않고 그냥 계속 하는 것.
<br/></p>
<h3 id="🔥-2주차-todo-리스트-58514">🔥 2주차 todo 리스트 (5/8~5/14)</h3>
<p>파이썬 기초문풀4
파이썬 기초문풀5
<del>파이썬 중급1</del>
함수란
함수선언과 호출
함수내에서 또 다른 함수 호출
인수와 매개 변수
데이터변환
<del>파이썬 중급2</del>
지역변수와 전역변수
중첩함수
lambda함수
모듈
모듈제작
파이썬 중급3
파이썬 중급5<del>6
파이썬 중급7
파이썬 중급8</del>9
파이썬 중급문풀1~2
파이썬 중급문풀3
파이썬 중급문풀4
<br/></p>
<h3 id="💻-핵심-내용-정리">💻 핵심 내용 정리</h3>
<h4 id="📝-함수는-기능이라고-생각하자">📝 함수는 기능이라고 생각하자.</h4>
<ul>
<li>파이썬의 함수는 수학의 함수와 동일하다.</li>
<li>기본으로 제공하는 내장함수, 사용자가 직접 선언하는 사용자 함수가 있다.</li>
<li>함수의 특정 기능을 반복 사용하기 위해서 사용한다. </li>
<li>함수의 입력은 한 개가 아니라 여러 개가 되어도 상관없다. </li>
<li>입력 변수가 여러개이면 쉼표, 영어로 comma 를 사용하여 함수를 정의한다.</li>
<li>입력 변수는 원하는 만큼 얼마든지 만들 수 있다.</li>
<li>힘수내에서 또 다른 함수를 호출 할 수 있다.</li>
<li><code>pass</code>를 이용해서 실행문을 생략 할 수 있다.<br/>

</li>
</ul>
<p><code>함수 선언</code></p>
<blockquote>
<pre><code class="language-python">def 함수이름 (입력변수이름):
    출력변수를 만드는 명령
      return 출력변수이름</code></pre>
</blockquote>
<pre><code>```python
def 함수이름(입력변수1, 입력변수2, 입력변수3):
   출력변수를 만드는 명령
   return 출력변수이름</code></pre><br/>

<p><code>함수 호출</code></p>
<blockquote>
<pre><code class="language-python">함수이름 (입력변수이름)</code></pre>
</blockquote>
<pre><code>```python
함수이름(입력변수1, 입력변수2, 입력변수3):</code></pre><br/>

<p><code>예시</code></p>
<pre><code class="language-python"># 오늘 날씨를 출력하는 함수를 선언하고 3번 호출하자.
def printWeatherInfo():
    print(&#39;오늘 날씨는 맑습니다. 기온은 25도 입니다.&#39;)

printWeatherInfo()
printWeatherInfo()
printWeatherInfo()


# 정수 두개를 입력하면 곱세과 나눗셈 연산 결과를 출력하는 함수를 만들고 호출해보자.
def calfun():
    n1 = int(input(&#39;n1 입력: &#39;))
    n2 = int(input(&#39;n2 입력: &#39;))

    print(f&#39;n1 * n2 = {n1 * n2}&#39;)
    print(f&#39;n1 / n2 = {round(n1 / n2, 2)}&#39;)

calfun()</code></pre>
<br/>

<h4 id="📝-인수와-매개변수">📝 인수와 매개변수</h4>
<ul>
<li>함수 호출시 함수에 데이터를 전달 할 수 있다.</li>
<li>함수에 대입할 데이터 → 인수(파라미터)</li>
<li>함수 선언문에서 호출문으로 갈때 필요한 만큼 연결(관계)해주는 함수 → 매개변수</li>
<li>인수와 매개변수 개수는 일치해야한다.</li>
<li>매개변수 개수가 정해지지않은 경우 &#39;*&#39;를 이용한다.</li>
<li><code>return</code> 키워드를 이용하면 함수 실행 결과를 호출부로 반환 할수 있다.</li>
<li>함수가 <code>return</code>를 만나면 실행을 종료한다.<br/>

</li>
</ul>
<h4 id="📝-전역변수">📝 전역변수</h4>
<ul>
<li>함수 밖에 선언된 변수</li>
<li>어디에서나 사용은 가능 하지만 함수 안에서 수정 할 수 는 없다.</li>
<li>바깥의 변수와 같은 이름의 변수를 함수 안에 만들면 안 된다.</li>
<li>함수 안에서는 함수 바깥에 있는 변수의 값을 바꿀 수 없다.</li>
<li>함수 안에서 함수 바깥에 있는 변수의 값을 꼭 바꿔야만 한다면 함수 이름 앞에 <code>global</code> 키워드를 선언해 주면 된다.</li>
</ul>
<p><code>예시</code></p>
<pre><code class="language-python">z = 3

def f2(x):
    y = z * x
    print(&quot;y =&quot;, y)
    print(&quot;z =&quot;, z)
    return y</code></pre>
<pre><code class="language-python">z = 3

def f4(x):
    global z
    z = 99
    y = z * x
    print(&quot;y =&quot;, y)
    print(&quot;z =&quot;, z)
    return y</code></pre>
<br/>

<h4 id="📝-지역변수">📝 지역변수</h4>
<ul>
<li>함수 안에 선언된 변수</li>
<li>함수 안에서만 사용가능하다.</li>
<li>이름이 같은 변수가 있다고 하더라도 별개의 변수가 된다.</li>
<li>함수 바깥에 혹시라도 y라는 변수가 있으면 <code>del</code> 명령으로 지운다.
만약 기존에 y라는 변수가 있었으면 오류가 출력되지 않고 지워지기만 한다.<br/>

</li>
</ul>
<h4 id="📝-중첩함수">📝 중첩함수</h4>
<ul>
<li>함수 안에 또다른 함수가 있는 형태이다.</li>
<li>내부함수를 함수 밖에서 호출 할 수 없다.<br/>

</li>
</ul>
<h4 id="📝-중첩함수-1">📝 중첩함수</h4>
<ul>
<li>함수 안에 또다른 함수가 있는 형태이다.</li>
<li>내부함수를 함수 밖에서 호출 할 수 없다.<br/>

</li>
</ul>
<h4 id="📝-lambda함수">📝 lambda함수</h4>
<ul>
<li>함수 선언을 보다 간단하게 할 수 있다.<br/>

</li>
</ul>
<p><code>예시</code></p>
<pre><code class="language-python">def calculator(n1, n2):
    return n1 + n2
returnValue =calculator(10, 20)
print(f&#39;returnValue: {returnValue}&#39;)


calculator = lambda n1, n2: n1 + n2
returnValue = calculator(10,20)
print(f&#39;returnValue: {returnValue}&#39;)</code></pre>
<br/>

<p><code>문제풀이_01</code></p>
<pre><code class="language-python">다음과 같이 출력 될수 있도록 이동거리와 이동시간을 반환하는 함수를 만들어 보자.
 산술연산 계산기를 함수를 이용해서 만들어보자

def add(n1, n2) :
    return n1 + n2
def sub(n1, n2) :
    return n1 - n2
def mul(n1, n2) :
    return n1 % n2
def div(n1, n2) :
    return n1 / n2
def mod(n1, n2) :
    return n1 * n2
def flo(n1, n2) :
    return n1 // n2
def exp(n1, n2) :
    return n1 ** n2

while True:
    print(&#39;-&#39; * 60)
    selectNum = int(input(&#39;1.덧셈, 2. 뺼셈, 3.곱셈, 4.나눗샘, 5.나머지, 6.몫, 7.재곱승, 8.종료&#39;))
    if selectNum == 8:
        print(&#39;Bye~~&#39;)
        break

    num1 = float(input(&#39;첫번째 숫자 입력 : &#39;))
    num2 = float(input(&#39;두번째 숫자 입력 : &#39;))

    if selectNum == 1:
        print(f&#39;{num1} + {num2} = {add(num1, num2)}&#39;)

    elif selectNum == 2:
        print(f&#39;{num1} - {num2} = {sub(num1, num2)}&#39;)

    elif selectNum == 3:
        print(f&#39;{num1} * {num2} = {mul(num1, num2)}&#39;)

    elif selectNum == 4:
        print(f&#39;{num1} / {num2} = {div(num1, num2)}&#39;)

    elif selectNum == 5:
        print(f&#39;{num1} % {num2} = {mod(num1, num2)}&#39;)

    elif selectNum == 6:
        print(f&#39;{num1} // {num2} = {flo(num1, num2)}&#39;)

    elif selectNum == 7:
        print(f&#39;{num1} ** {num2} = {exp(num1, num2)}&#39;)

    else:
        print(&#39;잘못 입력했습니다. 다시 입력해주세요!&#39;)

print(&#39;-&#39; * 60)</code></pre>
<h3 id="💡-오늘을-마무리하면서-">💡 오늘을 마무리하면서 ...</h3>
<p>건강상태가 안좋아서 집중이 잘 안된다 ㅠㅠ
이겨내야해 제인아 ㅠ
<br/></p>
<h4 id="😃-busy-study-_-새벽반-pm-1000--am-230">😃 Busy Study _ 새벽반 PM 10:00 ~ AM 2:30</h4>
<h4 id="여러분-화이팅-우리-모두-다-잘-될거예요">여러분 화이팅!! 우리 모두 다 잘 될거예요!</h4>
]]></description>
        </item>
        <item>
            <title><![CDATA[오늘의 공부 / 230507]]></title>
            <link>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230507</link>
            <guid>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230507</guid>
            <pubDate>Sun, 07 May 2023 12:06:04 GMT</pubDate>
            <description><![CDATA[<h3 id="💬-오늘의-공부시간-pm-1030--am-230">💬 오늘의 공부시간 PM 10:30 ~ AM 2:30</h3>
<p>오늘 감기때문인지 몸이 무거웠다.
공부는 왜 이리 하기 어려운건지.. 책상 앞에서 3시간이 지나도록 시작을 못했다.
오늘 분량을 해치우고 빨리 자자
<br/></p>
<h3 id="🔥-1주차-todo-리스트-5357">🔥 1주차 todo 리스트 (5/3~5/7)</h3>
<p><del>파이썬 기초1</del>
<del>파이썬 기초2</del>3<del>~
~</del>파이썬 기초4<del>~ 
~</del>파이썬 기초5<del>~
~</del>파이썬 기초6<del>~
~</del>파이썬 기초7<del>~
~</del>파이썬 기초8<del>~
~</del>파이썬 기초9<del>10</del>
<del>파이썬 기초문풀1</del>
<del>파이썬 기초문풀2</del>
<del>파이썬 기초문풀3</del>
<del>📝 weekly 데이터 사이언스 스쿨 퀴즈</del>
<br/></p>
<h3 id="💻-핵심-내용-정리">💻 핵심 내용 정리</h3>
<h4 id="🏅-기초-문제풀이">🏅 기초 문제풀이</h4>
<p><code>실습_01</code></p>
<pre><code class="language-python">체중(g)과 신장(cm)을 입력하면 BMI지수가 출력되는 프로그램을 만들어보자.

weight: 체중입력(g)
height: 신장입력(cm)
weight가 숫자라면 kg으로 환산
height가 숫자라면 m로 환산
BMI계산 (몸무게(kg) / 신장(m) * 신장(m)

weight = input(&#39;체중 입력(g): &#39;)
height = input(&#39;신장 입력(cm): &#39;)

if weight.isdigit():
    weight = int(weight) / 10

if height.isdigit():
    height = int(height) / 100

print(&#39;체중 : {}kg&#39;.format(weight))
print(&#39;신장 : {}m&#39;.format(height))

bmi = weight / (height * height)
print(&#39;BMI : %.2f&#39; % bmi )</code></pre>
<p><code>실습_02</code></p>
<pre><code class="language-python">다음 코드에서 num1과 num2의  값을 서로 바꾸고 각각 출력해보자.

num1 = 10
num2 = 20
print(&#39;num1: {}, num2: {}&#39;.format(num1, num2))

tempNum = num1
num1 = num2
num2 = tempNum
print(&#39;num1: {}, num2: {}&#39;.format(num1, num2))</code></pre>
<p><code>실습_03</code></p>
<pre><code class="language-python">중간, 기말고사 점수를 입력하면 총점과 평균이 출력되는 프로그램을 만들어보자.

score1 = input(&#39;중간 고사 점수 : &#39;)
score2 = input(&#39;기말 고사 점수 : &#39;)

if score1.isdigit() and score2.isdigit():   # 형변환체크(숫자)_ .isdigit()함수
    score1 = int(score1)
    score2 = int(score2)

    totalScore = score1 + score2
    avgScore = totalScore / 2

    print(&#39;총점: {}, 평균: {}&#39;.format(totalScore, avgScore))

else:
    print(&#39;잘 못 입력했습니다.&#39;)</code></pre>
<p><code>실습_04</code></p>
<pre><code class="language-python">키오스크에서 사용 하는 언어 선택 프로그램을 만들어 보자.

selectNum = input(&#39;언어선택(choose your language) : 1.한국어 \t 2.English \t&#39;)

if selectNum == &#39;1&#39;:
    menu =&#39;1.샌드위치 \t 2.햄버거 \t 3. 쥬스 \t 4.커피 \t 5.아이스크림&#39;
if selectNum == &#39;2&#39;:
    menu =&#39;1.Sandwich \t 2.Hamburger \t 3. Juice \t 4.Coffe \t 5.Ice cream&#39;

print(menu)</code></pre>
<p><code>실습_05</code></p>
<pre><code class="language-python">나의 나이가 100살이 되는 해의 연도를 구하는 프로그램을 만들어보자.

import datetime

today = datetime.datetime.today()  # 년,월,일,시 출력함수

myAge = input(&#39;나이 입력 : &#39;)
if myAge.isdigit():

    afterAge = 100 - int(myAge)
    my100 = today.year + afterAge

    print(&#39;{}년({}년후)에 100살!&#39;.format(my100, afterAge))
else:
    print(&#39;잘 못 입력했습니다.&#39;)</code></pre>
<p><code>실습_06</code></p>
<pre><code class="language-python">상품 가격과 지불금액을 입혁하면 거스름 돈을 계산하는 프로그램을 만들어보자.
단, 거스름돈은 제폐와 동전의 개수를 최소로 하고, 1원 단위를 절사한다.

money50000 = 50000; money10000 = 10000; money5000 = 5000; money1000 = 1000;
money500 = 500; money100 = 100; money10 = 10

money50000Cnt = 0; money10000Cnt = 0; money5000Cnt = 0; money1000Cnt = 0;
money500Cnt = 0; money100Cnt = 0; money10Cnt = 0

productPrice = int(input(&#39;상품 가격 입력: &#39;))
payPrice = int(input(&#39;지불 금액 입력: &#39;))

if payPrice &gt; productPrice:
    changeMoney = payPrice - productPrice
    changeMoney = (changeMoney // 10) * 10

print(&#39;거스름 돈 : {}(원단위 절사)&#39;.format(changeMoney))

if changeMoney &gt; money50000:
    money50000Cnt = changeMoney // money50000
    changeMoney %= money50000

if changeMoney &gt; money10000:
    money10000Cnt = changeMoney // money10000
    changeMoney %= money10000

if changeMoney &gt; money5000:
    money5000Cnt = changeMoney // money5000
    changeMoney %= money5000

if changeMoney &gt; money1000:
    money50000Cnt = changeMoney // money1000
    changeMoney %= money1000

if changeMoney &gt; money500:
    money500Cnt = changeMoney // money500
    changeMoney %= money500

if changeMoney &gt; money100:
    money100Cnt = changeMoney // money100
    changeMoney %= money100

print(&#39;-&#39; * 36)
print(&#39;50,000 {}장&#39;.format(money50000Cnt))
print(&#39;10,000 {}장&#39;.format(money10000Cnt))
print(&#39;5,000 {}장&#39;.format(money5000Cnt))
print(&#39;1,000 {}장&#39;.format(money1000Cnt))
print(&#39;500 {}개&#39;.format(money500Cnt))
print(&#39;100 {}개&#39;.format(money100Cnt))
print(&#39;10 {}개&#39;.format(money10Cnt))
print(&#39;-&#39; * 36)</code></pre>
<p><code>실습_07</code></p>
<pre><code class="language-python">국어, 영어, 수학 점수 입력후, 총점, 평균, 최고점수 과목/최저점수 과목 그리고 최고점수와 최저 점수의 차이를 각각 출력해보자.

korScore= int(input(&#39;국어 점수 입력 : &#39;))
engScore= int(input(&#39;영어 점수 입력 : &#39;))
matScore= int(input(&#39;수학 점수 입력 : &#39;))

totalScore = korScore + engScore + matScore
avgScore = totalScore / 3

maxScore = korScore
maxSubject = &#39;국어&#39;
if engScore &gt; maxScore:
    maxScore = engScore
    maxSubject = &#39;영어&#39;

if matScore &gt; maxScore:
    maxScore = matScore
    maxSubject = &#39;수학&#39;

minScore = korScore
minSubject = &#39;국어&#39;
if engScore &lt; minScore:
    minScore = engScore
    minSubject = &#39;영어&#39;

if matScore &lt; minScore:
    minScore = matScore
    minSubject = &#39;수학&#39;

difScore =  maxScore - minScore

print(f&#39;총점: {totalScore}&#39;)
print(&#39;평균: %.2f&#39; % avgScore)
print(&#39;-&#39; * 36)
print(f&#39;최저 점수 과목(점수): {maxSubject}({maxScore})&#39;)
print(f&#39;최저 점수 과목(점수): {minSubject}({minScore})&#39;)
print(f&#39;최고, 최저 점수 차이: {difScore}&#39;)
print(&#39;-&#39; * 36)</code></pre>
<p><code>실습_08</code></p>
<pre><code class="language-python">시, 분, 초를 입력하면 초로 호나산하는 프로그램을 만들어 보자.

hou = int(input(&#39;시간 입력 : &#39;))
min = int(input(&#39;분 입력 : &#39;))
sec = int(input(&#39;초 입력 : &#39;))

print(&#39;{}초&#39;.format(format(hou * 60 * 60 + min * 60 + sec, &#39;,&#39;)))</code></pre>
<p><code>실습_09</code></p>
<pre><code class="language-python">금액, 이율, 거치기간을 입력하면 복리ㅣ계산하는 복리계산기 프로그램을 만들어 보자.

money = int(input(&#39;금액 입력 : &#39;))
rate = float(input(&#39;이율 입력 : &#39;))  # 4.3 %
term = int(input(&#39;기간 입력 : &#39;))

targetMoney = money

for i in range(term):
    targetMoney+= (targetMoney * rate * 0.01)

targetMoneyFormated = format(int(targetMoney), &#39;,&#39;)  # 원단위 콤마찍기
moneyformated = format(int(money), &#39;,&#39;)  # 원단위 콤마찍기

print(&#39;-&#39; * 36)
print(f&#39;이율: {rate}&#39;)
print(f&#39;원금: {moneyformated}&#39;)
print(f&#39;{term}년 후 금액: {targetMoneyFormated}원&#39;)
print(&#39;-&#39; * 36)</code></pre>
<p><code>실습_10</code></p>
<pre><code class="language-python">고도가 60m 올라갈때마다 기온이 0.8도 내려간다고 할때 고도를 입력하면 기온이 출력되는 프로그램을 만들어보자.(지면온도:29도)

baseTemp = 29
step = 60
stepTemp = 0.8

height = int(input(&#39;고도 입력 : &#39;))

targetTemp = baseTemp -((height // step) * 0.8)
if height % step != 0:
    targetTemp -= stepTemp

print(f&#39;지면온도: {baseTemp}&#39;)
print(f&#39;고도 {height}m의 기온: {targetTemp}&#39;)</code></pre>
<p><code>실습_11</code></p>
<pre><code class="language-python">백신 접종 대상자를 구분하기 위한 프로그램을 만들어 보자.

inputAge = int(input(&#39;나이 입력: &#39;))

if inputAge &lt;= 19 or inputAge &gt;= 65:
    endNum = int(input(&#39;출생연도 끝자리 입력: &#39;))

    if endNum == 1 or endNum == 6:
        print(&#39;월요일 접종 가능!&#39;)
    elif endNum == 2 or endNum == 7:
        print(&#39;화요일 접종 가능!&#39;)
    elif endNum == 3 or endNum == 8:
        print(&#39;수요일 접종 가능!&#39;)
    if endNum == 4 or endNum == 9:
        print(&#39;목요일 접종 가능!&#39;)
    elif endNum == 5 or endNum == 0:
        print(&#39;금요일 접종 가능!&#39;)
else:
    print(&#39;하반기 일정을 확인하세요.&#39;)</code></pre>
<p><code>실습_12</code></p>
<pre><code class="language-python">길이(mm)를 입력하면 inch로 환산하는 프로그램을 만들어보자.

1mm = 0.039inch

byInch = 0.039
lengthmm = int(input(&#39;길이(mm) 입력 :&#39;))
lengthInch = lengthmm * byInch

print(f&#39;{lengthmm}mm -&gt; {lengthInch}inch&#39;)</code></pre>
<p><code>실습_13</code></p>
<pre><code class="language-python">교통  과속  위반  프로그램을  만들어보자.
시속  50km이하    안전속도  준수!!
시속 50km초과  안전속도 위반!! 과태표 50,000원 부과 대상!!!

carSpeed = int(input(&#39;속도 입력: &#39;))
limitSpeed = 50

if carSpeed &gt; 50:
    print(&#39;안전속도 위반!! 과태료 50,000원 부과 대상!!!&#39;)

else:
    print(&#39;안전속도 준수!!&#39;)</code></pre>
<p><code>실습_14</code></p>
<pre><code class="language-python">문자  메시지  길이에  따라  문자  요금이  결정되는  프로그램을  만들어보자
문자  길이  50이하   SMS발송(50원  부과)
문자 길이 50초과  MMS발송(100원 부과)

message = input(&#39;메세지 입력:&#39;)
lenMessage = len(message)
msgPrice = 50

if lenMessage &lt;= 50:
    msgPrice = 50
    print(&#39;SMS 발송!!&#39;)

else:
    msgPrice = 100
    print(&#39;MMS 발송!!&#39;)

print(f&#39;메세지 길이 : {lenMessage}&#39;)
print(f&#39;메세지 발송 요금: {msgPrice}원&#39;)</code></pre>
<p><code>실습_15</code></p>
<pre><code class="language-python">국어, 영어, 수학, 과학, 국사  점수를  입력하면  총점을  비롯한  각종  데이터가  출력되는 프로그램을  만들어보자.
목별  점수를  입력하면  총점, 평균, 편차를  출력한다. 평균은  다음과  같다.
(국어: 85, 영어: 82, 수학: 89, 과학: 75, 국사: 94)
각종  편차  데이터는  막대그래프로  시각화한다.

korAvg = 85; engAvg = 82; matAvg = 89
sciAvg = 75; hisAvg = 94
totalAvg= korAvg + engAvg + matAvg + sciAvg + hisAvg
avgAvg = int(totalAvg / 5)

korScore = int(input(&#39;국어 점수 : &#39;))
engScore = int(input(&#39;영어 점수 : &#39;))
matScore = int(input(&#39;수학 점수 : &#39;))
sciScore = int(input(&#39;과학 점수 : &#39;))
hisScore = int(input(&#39;국사 점수 : &#39;))

totalScore = korScore + engScore + matScore + sciScore + hisScore
avgSCore = int(totalScore / 5)

korGap = korScore - korAvg
engGap = engScore - engAvg
matGap = matScore - matAvg
sciGap = sciScore - sciAvg
hisGap = hisScore - hisAvg

totalGap = totalScore - totalAvg
avgGap = avgSCore - avgAvg

print(&#39;-&#39; * 80)
print(f&#39;총점: {totalScore}({totalGap}), 평균: {avgSCore}({avgGap})&#39;)
print(f&#39;국어: {korScore}({korGap}), 영어: {engScore}({engGap}), 수학: {matScore}({matGap}),&#39;
      f&#39;과학: {sciScore}({sciGap}), 국사: {hisScore}({hisGap})&#39;)

str = &#39;+&#39; if korGap &gt; 0 else &#39;-&#39;
print(&#39;국어 편차: {}({})&#39;.format(str * abs(korGap), korGap))
str = &#39;+&#39; if engGap &gt; 0 else &#39;-&#39;
print(&#39;영어 편차: {}({})&#39;.format(str * abs(engGap), engGap))
str = &#39;+&#39; if matGap &gt; 0 else &#39;-&#39;
print(&#39;수학 편차: {}({})&#39;.format(str * abs(matGap), matGap))
str = &#39;+&#39; if sciGap &gt; 0 else &#39;-&#39;
print(&#39;과학 편차: {}({})&#39;.format(str * abs(sciGap), sciGap))
str = &#39;+&#39; if hisGap &gt; 0 else &#39;-&#39;
print(&#39;국사 편차: {}({})&#39;.format(str * abs(hisGap), hisGap))
str = &#39;+&#39; if totalGap &gt; 0 else &#39;-&#39;
print(&#39;총점 편차: {}({})&#39;.format(str * abs(totalGap), totalGap))
str = &#39;+&#39; if avgGap &gt; 0 else &#39;-&#39;
print(&#39;평균 편차: {}({})&#39;.format(str * abs(avgGap), avgGap))
print(&#39;-&#39; * 80)</code></pre>
<h3 id="💡-오늘을-마무리하면서-">💡 오늘을 마무리하면서 ...</h3>
<p>언능 끝내고 쉬고 싶다...
컨디션 조절을 잘 해야 롱런 할수 있다.
<br/></p>
<h4 id="😃-busy-study-_-새벽반-pm-1000--am-230">😃 Busy Study _ 새벽반 PM 10:00 ~ AM 2:30</h4>
<h4 id="여러분-화이팅-우리-모두-다-잘-될거예요">여러분 화이팅!! 우리 모두 다 잘 될거예요!</h4>
]]></description>
        </item>
        <item>
            <title><![CDATA[오늘의 공부 / 230508]]></title>
            <link>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230508</link>
            <guid>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230508</guid>
            <pubDate>Sat, 06 May 2023 16:26:50 GMT</pubDate>
            <description><![CDATA[<h3 id="💬-오늘의-공부시간-pm-1020--am-200">💬 오늘의 공부시간 PM 10:20 ~ AM 2:00</h3>
<p>문제풀이를 하고 나면 조금 지치는 느낌이 들면서도 뭔가 조금씩 퍼즐이 짜맞춰져 지는 그런 느낌이 들어서 하고 나면 뿌듯하다
근데 왜 오지게 이해 안가는 건 안가냐고 ㅠㅠ
언어의 문제인지, 수학의 문제인지 고것이 알고싶다...
<br/></p>
<h3 id="🔥-2주차-todo-리스트-58514">🔥 2주차 todo 리스트 (5/8~5/14)</h3>
<p><del>파이썬 기초문풀4</del>
<del>파이썬 기초문풀5</del>
<br/>
파이썬 중급1
파이썬 중급2
파이썬 중급3
파이썬 중급5<del>6
파이썬 중급7
파이썬 중급8</del>9
파이썬 중급문풀1~2
파이썬 중급문풀3
파이썬 중급문풀4
📝 weekly 데이터 사이언스 스쿨 퀴즈
<br/></p>
<h3 id="💻-핵심-내용-정리">💻 핵심 내용 정리</h3>
<h4 id="🏅-기초문제풀이">🏅 기초문제풀이</h4>
<p><code>실습_01</code></p>
<pre><code class="language-python">난수를  이용해서  홀/짝  게임을  만들어보자.

import random

comNum = random.randint(1, 2)
userSelect = int(input(&#39;홀/짝 선택: 1,홀 \t 2.짝&#39;))

if comNum == 1 and userSelect == 1:
    print(&#39;빙고!! 홀수&#39;)
elif comNum == 2 and userSelect == 2:
    print(&#39;빙고!! 짝수&#39;)
elif comNum == 1 and userSelect == 2:
    print(&#39;실패!! 홀수!!&#39;)
elif comNum == 2 and userSelect == 1:
    print(&#39;실패!! 짝수!!&#39;)</code></pre>
<br/>

<p><code>실습_02</code></p>
<pre><code class="language-python">난수를  이용해서  가위, 바위, 보  게임을  만들어보자.

import random

comNumber = random.randint(1, 3)
userNumber = int(input(&#39;가위, 바위, 보 선택 : 1.가위 \t 2.바위 \t 3.보&#39;))

if (comNumber == 1 and userNumber == 2) or (comNumber == 2 and userNumber == 3) or \
        (comNumber == 3 and userNumber == 1):
    print(&#39;컴퓨터ㅣ 패, 유저: 승&#39;)
elif comNumber == userNumber:
    print(&#39;무승부&#39;)
else:
    print(&#39;컴퓨터: 승, 유저: 패&#39;)


print(&#39;컴퓨터: {}, 유저: {}&#39;.format(comNumber, userNumber))</code></pre>
<br/>

<p><code>실습_03</code></p>
<pre><code class="language-python">아래  요금표를  참고해서  상수도  요금  계산기를  만들어보자.

part = int(input(&#39;업종 선택(1.가정용 2.대중탕용 3.공업용) : &#39;))
userWater = int(input(&#39;사용량 입력: &#39;))
unitPrice = 0

if part == 1:
    unitPrice = 540

elif part == 2:
    if userWater &lt;= 50:
        unitPrice = 820
    elif userWater &gt; 50 and userWater &lt;= 300:
        unitPrice = 1920
    elif userWater &gt; 300:
        unitPrice = 2400
elif part == 3:
    if userWater &lt;= 500:
        unitPrice = 240
    else:
        unitPrice = 470

userPrice = userWater * unitPrice
userPriceFormated = format(int(userPrice), &#39;,&#39;)  # 원단위 콤마찍기

print(&#39;=&#39; * 36)
print(&#39;상수도 요금표&#39;)
print(&#39;-&#39; * 36)
print(&#39;사용량 \t : \t 요금&#39;)
userPrice = userWater * unitPrice
print(&#39;{} \t : \t {}원&#39;.format(userWater, userPriceFormated))
print(&#39;=&#39; * 36)</code></pre>
<br/>

<p><code>실습_04</code></p>
<pre><code class="language-python">미세먼지  비상저감조치로  차량  운행제한  프로그램을  다음  내용에  맞게  만들어  보자.

미세먼지  측정  수치가  150이하면  차량  5부제  실시
미세먼지  측정  수치가  150을  초과하면  차량  2부제  실시
차량  2부제를  실시하더라도  영업용차량은  5부제  실시
미세먼지 수치, 차량 종류, 차량 번호를 입력하면 운행 가능 여부 출력

import datetime

today = datetime.datetime.today()
day = today.day

limitDust = 150
dustNum = int(input(&#39;미세먼지 수치 입력: &#39;))
carType = int(input(&#39;차량 종류 선택 : 1,승용차 2. 영업용차&#39;))
carNumber = int(input(&#39;차량 번호 입력 : &#39;))

print(&#39;-&#39; * 36)
print(today)
print(&#39;-&#39; * 36)

if dustNum &gt; limitDust and carType == 1:
    if (day % 2) ==(carNumber % 2):
        print(&#39;차량 2부제 적용&#39;)
        print(&#39;차량 2부제로 금일 운행제한 대상 차량입니다.&#39;)
    else:
        print(&#39;금일 운행 가능합니다.&#39;)
if dustNum &gt; limitDust and carType == 2:
    if (day % 5) ==(carNumber % 5):
        print(&#39;차량 5부제 적용&#39;)
        print(&#39;차량 5부제로 금일 운행제한 대상 차량입니다.&#39;)
    else:
        print(&#39;금일 운행 가능합니다.&#39;)

if dustNum &lt;= limitDust:
    if (day % 5) == (carNumber % 5):
        print(&#39;차량 5부제 적용&#39;)
        print(&#39;차량 5부제로 금일 운행제한 대상 차량입니다.&#39;)
    else:
        print(&#39;금일 운행 가능합니다.&#39;)
print(&#39;-&#39; * 36)</code></pre>
<br/>

<p><code>실습_05</code></p>
<pre><code class="language-python">PC에서  난수를  발생하면  사용자가  맞추는  게임을  만들어보자.
PC가 난수(1~1000)를 발생하면 사용자가 숫자(정수)를 입력한다.
사용자가  난수를  맞추면  게임이  종료된다.
만약, 못  맞추게  되면  난수와  사용자  숫자의  크고  작음을  출력한  후 사용자한테  다시  기회를  준다.
최종적으로  사용자가  시도한  횟수를  출력한다.

import random

rNum = random.randint(1, 100)
tryCount = 0
gameFlag = True

while gameFlag:
    tryCount += 1
    pNum = int(input(&#39;1에서 1,000까지의 정수 입력 : &#39;))

    if rNum == pNum:
        print(&#39;빙고!!&#39;)
        gameFlag = False
    else:
        if rNum &gt; pNum:
            print(&#39;난수가 크다!&#39;)
        else:
            print(&#39;난수가 작다!&#39;)

print(&#39;난수: {}, 시도 횟수: {}&#39;.format(rNum, tryCount))</code></pre>
<br/>

<p><code>실습_06</code></p>
<pre><code class="language-python">실내온도를  입력하면  스마트에어컨  상태가  자동으로  설정되는  프로그램을  만들어보자

innerTemp = int(input(&#39;실내온도 입력 : &#39;))

if innerTemp &lt;= 18:
    print(&#39;에어컨 상태 : off&#39;)
elif innerTemp &gt; 18 and innerTemp &lt;= 22:
    print(&#39;에어컨 상태 : 매우 약&#39;)
elif innerTemp &gt; 22 and innerTemp &lt;= 24:
    print(&#39;에어컨 상태 : 약&#39;)
elif innerTemp &gt; 24 and innerTemp &lt;= 26:
    print(&#39;에어컨 상태 : 중&#39;)
elif innerTemp &gt; 26 and innerTemp &lt;= 28:
    print(&#39;에어컨 상태 : 강&#39;)
elif innerTemp &gt; 28:
    print(&#39;에어컨 상태 : 매우 강&#39;)</code></pre>
<br/>

<p><code>실습_07</code></p>
<pre><code class="language-python">1부터  100까지  정수  중  십의자리와  일의자리에  대해  각각  홀/짝수를 
구분하는 프로그램을  만들어보자.

for i in range(1, 101):
    if i &lt;= 9:
        if i % 2 == 0:
            print(&#39;[{}]: 짝수!&#39;.format(i))
        else:
            print(&#39;[{}]: 홀수!&#39;.format(i))
    else:
        num10 = i // 10
        num1 = i % 10

        result10 = &#39;&#39;
        if num10 % 2 == 0:
            result10 = &#39;짝수&#39;
        else:
            result10 = &#39;홀수&#39;

        result1 = &#39;0&#39;
        if num1 != 0:
            if num1 % 2 == 0:
                result1 = &#39;짝수&#39;
            else:
                result1 = &#39;홀수&#39;

        print(&#39;[{}] 십의 자리: {}, 일의 자리: {}&#39;.format(i, result10, result1))</code></pre>
<br/>

<p><code>실습_08</code></p>
<pre><code class="language-python">1부터  사용자가  입력한  정수까지의  합, 홀수의  합, 짝수의  합 
그리고  팩토리얼을 출력하는  프로그램을  만들어보자

fNum = int(input(&#39;정수 입력 : &#39;))

addSum = 0   # 합
for i in range(1, (fNum + 1)):
    addSum += i

addSumformated = format(addSum, &#39;,&#39;) # 3자리마다 콤마찍기
print(&#39;합 결과 : {}&#39;.format(addSumformated))

oddSum = 0   # 홀수
for i in range(1, (fNum + 1)):
    if i % 2 != 0:
        oddSum += i

oddSumformated = format(oddSum, &#39;,&#39;) # 3자리마다 콤마찍기
print(&#39;홀수 합 결과 : {}&#39;.format(oddSumformated))

evenSum = 0   # 짝수
for i in range(1, (fNum + 1)):
    if i % 2 == 0:
        evenSum += i

evenSumformated = format(evenSum, &#39;,&#39;) # 3자리마다 콤마찍기
print(&#39;짝수 합 결과 : {}&#39;.format(evenSumformated))

factorialResult = 1   # 팩토리얼
for i in range(1, (fNum + 1)):
    factorialResult *= i

factorialResultformated = format(factorialResult, &#39;,&#39;) # 3자리마다 콤마찍기
print(&#39;팩토리얼 결과 : {}&#39;.format(factorialResultformated))
</code></pre>
<br/>

<p><code>실습_09</code></p>
<pre><code class="language-python">‘*’를  이용해서  다음과  같이  다양한  모양을  출력해보자.

# 01 좌측정렬
for i in range(1,6):
    for j in range(i):
        print(&#39;*&#39;, end=&#39;&#39;)
    print()

# 02 우측정렬
for i1 in range(1,6):
    for i2 in range(6 - i1 - 1):
        print(&#39; &#39;, end=&#39;&#39;)
    for i3 in range(i1):
        print(&#39;*&#39;, end=&#39;&#39;)
    print()

# 03 반전 좌측 정렬
for i in range(5, 0, -1):
    for j in range(i):
        print(&#39;*&#39;, end=&#39;&#39;)
    print()

# 03 반전 우측 정렬
for i in range(5, 0, -1):
    for j in range(5 - i):
        print(&#39; &#39;, end=&#39;&#39;)
    for j in range(i):
        print(&#39;*&#39;, end=&#39;&#39;)
    print()

# 04 ▶
for i in range(1, 10):
    if i &lt; 5:
        for j in range(i):
            print(&#39;*&#39;, end=&#39;&#39;)
    else:
        for j in range(10 - i):
                print(&#39;*&#39;, end=&#39;&#39;)
    print()

# 05 \
for i in range(1, 6):         # 행
    for j in range(1, 6):    # 열
        if j == i:
            print(&#39;*&#39;, end=&#39;&#39;)
        else:
            print(&#39; &#39;, end=&#39;&#39;)

    print()</code></pre>
<br/>

<p><code>실습_10</code></p>
<pre><code class="language-python">집  앞  버스  정류장에서  학교까지  가는  버스  A, B, C 의  운행정보가  다음과  같을  때, 2대  이상의  버스가  정차하는  시간대를  출력해보자.
• 버스  A, B 운행  정보
- 오전  6시  첫차  : 오후  23시  운행  종료 
- 버스A : 15분  간격  운행
- 버스B : 13분  간격  운영

• 버스  C 운행  정보
- 6시  20분  첫차  : 오후  22시  운행  종료 
- 버스C : 8분  간격  운행


busA = 15
busB = 13
busC = 8

totalMin = 60 * 17
for i in range(totalMin +1):
    if i &lt; 20 or i &gt; (totalMin - 60):
        if i % busA == 0 and i % busB == 0:
            print(&#39;버스A와 버스B 동시 정차!&#39;, end=&#39;&#39;)
            hour = 6 + i // 60
            min = i % 60
            print(&#39;\t{}:{}&#39;.format(hour, min))
    else:
        if i % busA == 0 and i % busB == 0:
            print(&#39;버스A와 버스B 동시 정차!&#39;, end=&#39;&#39;)
            hour = 6 + i // 60
            min = i % 60
            print(&#39;\t{}:{}&#39;.format(hour, min))
        elif i % busA == 0 and i % busC== 0:
            print(&#39;버스A와 버스C 동시 정차!&#39;, end=&#39;&#39;)
            hour = 6 + i // 60
            min = i % 60
            print(&#39;\t{}:{}&#39;.format(hour, min))
        elif i % busB == 0 and i % busC == 0:
            print(&#39;버스B와 버스C 동시 정차!&#39;, end=&#39;&#39;)
            hour = 6 + i // 60
            min = i % 60
            print(&#39;\t{}:{}&#39;.format(hour, min))</code></pre>
<br/>

<p><code>실습_11</code></p>
<pre><code class="language-python">톱니가  각각  n1개와  n2개의  톱니바퀴가  서로  맞물려  회전할  때, 회전을  시작한  후  처음 맞물린  톱니가  최초로  다시  만나게  될  때까지의  톱니의  수와  각각의  바퀴  회전수를 출력해보자.(단, n2는  n1보다  크다.)

gearATCnt = int(input(&#39;GearA 톱니수 입력 : &#39;))
gearBTCnt = int(input(&#39;GearB 톱니수 입력 : &#39;))

gearA = 0
gearB = 0
leastNum = 0

flag = True
while flag:

    if gearA != 0:
        if gearA != leastNum:
            gearA += gearATCnt
        else:
            flag = False
    else:
        gearA += gearATCnt

    if gearB != 0 and gearB % gearATCnt == 0:   # 최소공배수
        leastNum = gearB
    else:
        gearB += gearBTCnt

print(&#39;최초 만나는 톱니수(최소공배수): {}톱니&#39;.format(leastNum))
print(&#39;gearA 회전수: {}회전&#39;.format(int(leastNum / gearATCnt)))
print(&#39;gearB 회전수: {}회전&#39;.format(int(leastNum / gearBTCnt)))</code></pre>
<br/>

<p><code>실습_12</code></p>
<pre><code class="language-python">윤년  계산기를  만들어보자.
윤년  조건
- 연도가  4로  나누어떨어지고  100으로  나누어떨어지지  않으면  윤년이다. - 또는  연도가  400으로  나누어떨어지면  윤년이다.

year = int(input(&#39;연도 입력 : &#39;))

if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):
    print(&#39;{}년 : 윤년!!&#39;.format(year))
else:
    print(&#39;{}년 : 평년!!&#39;.format(year))


# 자동 계산 출력
for year in range(2021, (2021+101)):
    if (year % 4 == 0 and year % 100 != 0) or (year % 400  == 0 ):
        print(&#39;{}년 : 윤년!!&#39;.format(year))
else:
    print(&#39;{}년 : 평년!!&#39;.format(year))    </code></pre>
<br/>


<h3 id="💡-오늘을-마무리하면서-">💡 오늘을 마무리하면서 ...</h3>
<p>오늘 하루도 지켰다!!
내일도 열심히 하잣!!
근데 나는 언제 아웃풋하냐 ㅠㅠ
응용1도 못해 ㅠㅠ</p>
<br/>

<h4 id="😃-busy-study-_-새벽반-pm-1000--am-230">😃 Busy Study _ 새벽반 PM 10:00 ~ AM 2:30</h4>
<h4 id="여러분-화이팅-우리-모두-다-잘-될거예요">여러분 화이팅!! 우리 모두 다 잘 될거예요!</h4>
]]></description>
        </item>
        <item>
            <title><![CDATA[오늘의 공부 / 230506]]></title>
            <link>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230506</link>
            <guid>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230506</guid>
            <pubDate>Fri, 05 May 2023 18:13:33 GMT</pubDate>
            <description><![CDATA[<h3 id="💬-오늘의-공부시간-pm-1130--200">💬 오늘의 공부시간 PM 11:30 ~ 2:00</h3>
<p>오늘은 꼭 목표까지 공부하자!!
아자 아자!!
<br/></p>
<h3 id="🔥-1주차-todo-리스트-5357">🔥 1주차 todo 리스트 (5/3~5/7)</h3>
<p><del>파이썬 기초1</del>
<del>파이썬 기초2</del>3<del>~
~</del>파이썬 기초4<del>~ 
~</del>파이썬 기초5<del>~
~</del>파이썬 기초6<del>~
~</del>파이썬 기초7<del>~
~</del>파이썬 기초8<del>~
~</del>파이썬 기초9<del>10</del>
반복문
횟수에 의한 반복문(for문)
반복 범위 설정(range()함수)
조건에 의한 반복(while문)
for문과 while문 비교
무한루프
반복문 제어(continue)
반복문 제어(break)
중첩반복문</p>
<p><del>파이썬 기초문풀1</del></p>
<p>파이썬 기초문풀2
파이썬 기초문풀3
<br/></p>
<p><del>📝 weekly 데이터 사이언스 스쿨 퀴즈</del>
<br/></p>
<h3 id="💻-핵심-내용-정리">💻 핵심 내용 정리</h3>
<h4 id="📝-반복문">📝 반복문</h4>
<ul>
<li>특정 실행을 반복하는것.</li>
<li>반목문을 사용하면 프로그래밍이 간결하고 유지 보수가 쉽다.</li>
<li>간단하게 손쉽게 만들어 효율적이다.<br/>

</li>
</ul>
<h4 id="📝-반복문의-종류">📝 반복문의 종류</h4>
<ul>
<li>횟수에 의한 반복
횟수 지정 → 횟수만틈 반복 실행</li>
<li>조건에 의한 반복
조건 지정 → 조건에 만족할때까지 반복실행<br/>

</li>
</ul>
<h4 id="📝-횟수에-의한-반복문for문">📝 횟수에 의한 반복문(for문)</h4>
<ul>
<li>정해놓은 반복 횟수에 따라 반복 실행한다.
(대량메일또는 문자발송, 인사말 반복, mp3반복재생)</li>
<li>횟수의 의한 반복은 for문이 주로 사용된다.
<code>for문 : 쉽고 직관적이다.</code> 
<code>while문 : 조건에 의한 반복문을 사용할때 사용한다.</code></li>
</ul>
<h4 id="📝-for문-사용-방법">📝 for문 사용 방법</h4>
<blockquote>
<p><code>for i in range(n): 조건문</code>
<code>[들여쓰기] print( ) : 실행문</code></p>
</blockquote>
<pre><code class="language-python">구구단 출력해보기

for i in range(10):    # 변수_i / 실행횟수_n
    print(&#39;{} * {} = {}&#39;.format(7, i, (7 * i)))</code></pre>
<blockquote>
<p><code>pass : 아직 실행문이 정해지지않음, 반복하되 실행하지 않겠다.(실행문 대신에 사용)</code>
<code>:(코드블록), 들여쓰기 : 동일하게 들여쓰기를 하자.</code></p>
</blockquote>
<p><code>실습_01</code></p>
<pre><code class="language-python">&#39;Hello python&#39;문자열을 5번 출력하는 코드를 작성하자

for num in range(5):
    print(&#39;Hello python&#39;)</code></pre>
<br/>

<h4 id="📝-반복-범위-설정range함수">📝 반복 범위 설정(range()함수)</h4>
<blockquote>
<p><code>range()함수 : 반복이 가능한 개체만 넣어준다.</code>
for i in range (시작, 끝, 단계)</p>
</blockquote>
<ul>
<li>매개변수의 단계가 1인 경우에만 생략이 가능하다.</li>
<li>매개변수의 시작이 0인 경우에만 생략이 가능하다.<br/>

</li>
</ul>
<p><code>실습_02</code></p>
<pre><code class="language-python">사용자가 반복의 시작과 끝으 ㄹ입력하면 1씩 증가하는 반복문을 만들어 보자.

startNum = int(input(&#39;반복의 시작 입력 : &#39;))
endNum = int(input(&#39;반복의 끝 입력 : &#39;))

for i in range(startNum, (endNum+1)):
    print(i)

위에서 작성한 반복문을 이용해서 2씩 증가하는 반복문을 만들어 보자.

for i in range(startNum, (endNum+1), 2):
    print(i)</code></pre>
<p><code>실습_03</code></p>
<pre><code class="language-python">1에서 100까지의 정수중 3의 배수에 해당하는 정수만 출력하는 코드를 작성하자.

for i in range(1, 101):
    if i % 3 == 0:
        print(i)</code></pre>
<br/>

<h4 id="📝-조건에-의한-반복while문">📝 조건에 의한 반복(while문)</h4>
<ul>
<li>조건에 만족하면 반복실행한다. 그렇지 않으면 반복을 중단한다.
(매일아침기상알람, 게임반복실행, 타이머)</li>
<li>조건에 의한 반복은 while문이 주로 사용된다.<br/>

</li>
</ul>
<h4 id="📝-while문-사용-방법">📝 while문 사용 방법</h4>
<blockquote>
<p><code>while 조건식 : 조건문</code>
<code>[들여쓰기] print( ) : 실행문</code>
<code>[들여쓰기] n += 1  / 무한루프를 방지</code></p>
</blockquote>
<blockquote>
<p><code>pass : 아직 실행문이 정해지지않음, 반복하되 실행하지 않겠다.(실행문 대신에 사용)</code>
<code>:(코드블록), 들여쓰기 : 동일하게 들여쓰기를 하자.</code></p>
</blockquote>
<p><code>실습_04</code></p>
<pre><code class="language-python">1에서 100까지의 정수중 2의 배수와 3의 배수를 구분해서 출력하자.

n = 1
while n &lt; 101 :
    if n % 2 == 0:
        print(&#39;{}은 2의 배수이다.&#39;.format(n))
    if n % 3 == 0:
        print(&#39;{}은 3의 배수이다.&#39;.format(n))
    n += 1</code></pre>
<p><code>실습_05</code></p>
<pre><code class="language-python">while문을 이용해서 사용자가 입력한 구구단을 출력하자.

gugudanNum = int(input(&#39;희망구구단을 입력하세요 : &#39;))

n = 1

while n &lt; 10 :
    result = gugudanNum * n
    print(&#39;{} * {} = {}&#39;.format(gugudanNum, n, result))
    n += 1</code></pre>
<br/>

<h4 id="📝-for문과-while문-비교">📝 for문과 while문 비교</h4>
<ul>
<li><p>for문이 적합한 경우
횟수의 의한 반복이라면 for문이 while문보다 적합하다.</p>
</li>
<li><p>while문이 적합한 경우
조건의 의한 반복이라면 while문이 for문이 보다 적합하다.</p>
</li>
</ul>
<p><code>실습_05</code></p>
<pre><code class="language-python">자동차 바퀴가 한번 구를때마다 0.5mm씩 마모 된다고 한다.
현재의 바퀴두께가 30mm이고 최소 운행 가능 바퀴 두께가 20mm라고 할 때
앞으로 구를수 잇는 횟수를 구해보자.
- 휫수를 알수 없으니, 조건문에 적합한 whlie문을 이용한다.

currentThickness = 30
rotationCount = 0
removeThickness = 0.15

while currentThickness &gt;= 20:
    rotationCount += 1
    currentThickness -= removeThickness

safeRotationCount = rotationCount - 1  # 20이하로 내려가지 않게 올림 해줌
print(&#39;운행가능 횟수 : {}&#39;.format(safeRotationCount))</code></pre>
<br/>

<h4 id="📝-무한루프">📝 무한루프</h4>
<ul>
<li>반복문을 빠져나올수 없는 경우를 무한 루프라고 한다.
<code>while문에서 조건식의 결과가 항상 True인 경우</code></li>
<li>조건식에 논리형 데이터를 사용해서 무한 반복 실행할 수 있다.
<code>if문을 사용하여 무한루프를 빠져나올수 있다.</code><br/>

</li>
</ul>
<p><code>실습_06</code></p>
<pre><code class="language-python">하루에 독감으로 병원에 내방하는 환자수가 50명에서 100명사이일 때,
누적 독감 환자수가 최초 10,000명을 넘는 날짜를 구해보자.

import random

sum = 0
date = 1
flag = True

while flag:
    patienCount = random.randint(50,100)
    sum += patienCount
    print(&#39;날짜: {}, \t 오늘 환자수: {}, \t 누적 환자수: {}&#39;.format(date, patienCount, sum))
    if sum &gt;= 10000:
        flag = False</code></pre>
<br/>

<h4 id="📝-continue-키워드">📝 continue 키워드</h4>
<blockquote>
<p>반복 실행 중 continue를 만나면 실행을 생략하고, 다음 반복 실행문으로 넘어간다.</p>
</blockquote>
<p><code>예시</code></p>
<pre><code class="language-python">for i in range(100):
    if i % 7 != 0:
        continue

print(&#39;{}는 7의 배수입니다.&#39;.format(i))</code></pre>
<h4 id="📝-else-키워드">📝 else 키워드</h4>
<blockquote>
<p>else의 실행문은 for문의 반복문(반복작업)이 종료된 후 실행된다.</p>
</blockquote>
<p><code>예시</code></p>
<pre><code class="language-python">cnt = 0
for i in range(100):  # 0~99까지 진행하면서 7의 배수만 실행
    if i % 7 != 0:
        continue

    print(&#39;{}는 7의 배수입니다.&#39;.format(i))
    cnt += 1

else:
    print(&quot;99까지의 정수 중 7의 배수는 {}개입니다.&quot;. format(cnt))</code></pre>
<br/>

<p><code>실습_07</code></p>
<pre><code class="language-python">1부터 100까지의 정수 중 3과 7의 공배수와 최소공배수를 출력하자.

minNum = 0
for i in range(1,101):
    if i % 3 != 0 or i % 7 != 0:
        continue

    print(&#39;공배수: {}&#39;.format(i))

    if minNum == 0:
        minNum = i

else:
    print(&#39;최소 공배수: {}&#39;. format(minNum))</code></pre>
<br/>

<h4 id="📝-break-키워드">📝 break 키워드</h4>
<blockquote>
<p>반복 실행 중 break를 만나면 반복문을 빠져 나온다.</p>
</blockquote>
<p><code>실습_08</code></p>
<pre><code class="language-python">10의 팩토리얼(10!)을 계산하는 과장에서 결과값이 50을 넘을떄의 숫자를 구하자.

result = 1  # 결과값
num = 0

for i in range(1, 11):
    result *= i

    if result &gt; 50:
        num = i
        break

print(&#39;num: {}, result: {}&#39;.format(num, result))</code></pre>
<p><code>실습_09</code></p>
<pre><code class="language-python">새끼 강아지의 체중이 2.2kg가 넘으면 이유식을 중단하려고 한다.
한번 이유식을 먹을떄ㅖ 체중이 70g 증가한다고 할때,
예상되는 이유식 날짜를 구하자.(현재 체중은 800g이다.)

limitWeight = 2200    # 결과값
currentWeight = 800   # 현재값
date = 1    # 변수

while True:
    if currentWeight &gt;= 2200:
        break

    date += 1
    currentWeight += 70  # 한번 먹을때 70g증가 _조건식

print(&#39;이유식 중단 날짜 : {}일&#39;.format(date))</code></pre>
<br/>

<h4 id="📝-중첩반복문">📝 중첩반복문</h4>
<ul>
<li>반복문 안에 또 다른 반복문을 선언한다.</li>
<li>너무 많은 반복문은 복잡하고 계산하기 어렵다.</li>
</ul>
<p><code>예시</code></p>
<pre><code class="language-python">for i in range(10, 0, -1):
    for j in range(i):
        print(&#39;*&#39;, end=&#39;&#39;)
    print()</code></pre>
<br/>

<p><code>실습_10</code></p>
<pre><code class="language-python">구구단 전체를 출력하자.

for i in range(1, 10):
    for j in range(2, 10):
        result = j * i
        print(&#39;{} * {} = {}\t&#39;.format(j, i, result), end=&#39;&#39;)

    print()</code></pre>
<br/>


<h4 id="🏅-기초-문제풀이-_-01">🏅 기초 문제풀이 _ 01</h4>
<pre><code class="language-python">주문확인서 템플릿 만들기

name = &#39;홍길동&#39;
product = &#39;야구글러브&#39;
orderNo = 2568956
payMethod = &#39;신용카드&#39;
productPrice = 110000
payPrice = 100000
usePoint = 10000
payDate = &#39;2021/08/03 21:50:12&#39;
payDiv = 6
payDivCategory = &#39;무&#39;
phone = &#39;02-1234-5678&#39;

print(&#39;-&#39; * 50)
print(name, &#39;고객님 안녕하세요.&#39;)
print(name, &#39;고객님의 주문이 완료되었습니다.&#39;)
print(&#39;다음의 주문건에 대한 상세 내역입니다.&#39;)
print(&#39;-&#39; * 50)
print(&#39;상품명 : {}&#39;.format(product))
print(&#39;주문번호 : {}&#39;.format(orderNo))
print(&#39;결재방법 : {}&#39;.format(payMethod))
print(&#39;상품금액 : {}원&#39;.format(productPrice))
print(&#39;결재금액 : {}원&#39;.format(payPrice))
print(&#39;포인트 : {}&#39;.format(usePoint))
print(&#39;결제일시 : {}&#39;.format(payDate))
print(&#39;할부 : {}개월&#39;.format(payDiv))
print(&#39;할부유형 : {}&#39;.format(payDivCategory))
print(&#39;문의 : {}&#39;.format(phone))
print(&#39;-&#39; * 50)
print(&#39;저희 사이트를 이용해 주셔서 감사합니다.&#39;)</code></pre>
<p><code>len() 함수 : 문자 길이 반환</code></p>
<pre><code class="language-python">사용자가 입력한 데이터의 길이를 출력하는 프로그램을 만들어보자.

userMsg = input(&#39;메세지 입력 : &#39;)
print(&#39;메세지 문자열 길이 : {}&#39;.format(len(userMsg)))</code></pre>
<p><code>find() 함수 :</code></p>
<pre><code class="language-python">객체지향 문자열(0부터 특정문자의 위치를 찾는다.)을 찾아 보자.

article = &#39;모든 함수가 일단 클래스 안에 있어야 하며, 전역 함수는 static 함수를 사용하는 형태로 짜야 한다. \
그나마 객체지향이라는 직관성은 C#이 Python보다 더 좋은 편이다. \
두 언어는 서로 다른 용도로 사용되는 경우가 많지만 OpenCV와 같은 곳에서는 둘 다 사용할 수 있기도 하다.&#39;

strIdx = article.find(&#39;객체지향&#39;)
print(&#39;객체지향 문자열 위치 : {}&#39;.format(strIdx))</code></pre>
<pre><code class="language-python">사용자가 입력한 데이터를 모두 실수로 변경한후 사각현, 삼각형의 넓이를 출력해보자.

width = float(input(&#39;가로 길이 입력 : &#39;))
height = float(input(&#39;세로 길이 입력 : &#39;))

triangleArea = width * height /2
squareArea = width * height

print(&#39;-&#39; * 13, &#39;Result&#39;, &#39;-&#39; * 13)
print(&#39;삼각형 넓이 : %f&#39; % triangleArea)
print(&#39;사각형 넓이 : %f&#39; % squareArea)
print(&#39;삼각형 넓이 : %.2f&#39; % triangleArea)
print(&#39;사각형 넓이 : %.2f&#39; % squareArea)
print(&#39;-&#39; * 34)</code></pre>
<pre><code class="language-python">원의 반지르을 입력하면 원의 넓이와 둘레 길이를 출력하되,
아래의 형식으로 출력해보자.

정수
소수점 한자리
소수점 셋째자리

r = int(input(&#39;반지름(cm) 입력 : &#39;))
pi = 3.14

area = pi * r * r
cir = 2 * r * pi

print(&#39;원의 넓이 : %dcm&#39; % area)
print(&#39;원의 둘레 : %dcm&#39; % cir)
print(&#39;원의 넓이 : %.1fcm&#39; % area)
print(&#39;원의 둘레 : %.1fcm&#39; % cir)
print(&#39;원의 넓이 : %.3fcm&#39; % area)
print(&#39;원의 둘레 : %.3fcm&#39; % cir)</code></pre>
<pre><code class="language-python">사용자로 부터 입력받은 개인정보를 포맷 문자열을 이용해서 다음과 같이 출력해보자.

name = input(&#39;이름 입력 : &#39;)
mail = input(&#39;메일 입력 : &#39;)
id = input(&#39;아이디 입력 : &#39;)
pw = input(&#39;비밀번호 입력 : &#39;)
privateNumber1 = input(&#39;주민번호 앞자리 입력 : &#39;)
privateNumber2 = input(&#39;주민번호 뒷자리 입력 : &#39;)
address = input(&#39;주소 입력 : &#39;)

pwStar = &#39;*&#39; * len(pw)
privateNumberStar = privateNumber2[0] + (&#39;*&#39; * 6)

print(&#39;-&#39; * 36)
print(f&#39;이름 : {name}&#39;)
print(f&#39;메일 : {mail}&#39;)
print(f&#39;아이디 : {id}&#39;)
print(f&#39;비밀번호 : {pwStar}&#39;)
print(f&#39;주민번호 : {privateNumber1} - {privateNumberStar}&#39;)
print(f&#39;주소 : {address}&#39;)
print(&#39;-&#39; * 36)</code></pre>
<p><code>srt() 함수 : str에 저장된 문자열에서 첫번째 문자를 반환함</code>
<br/></p>
<h3 id="💡-오늘을-마무리하면서-">💡 오늘을 마무리하면서 ...</h3>
<p>컨디션이 안좋아졌다.
포항 다녀오면서 너무 무리를 했나 보다.
역시 시집살이 힘들어 ㅠ (동동이 이거 보지마!)
파이썬 코드 쓸때 &#39;-&#39; * 이거 귀여운것 같음</p>
<pre><code class="language-python">print(&#39;-&#39; * 36)</code></pre>
<p>역시 힘들때엔 귀여운거 보는게 힐링이 됨 ㅎㅎㅎ
<br/></p>
<h4 id="😃-busy-study-_-새벽반-pm-1000--am-230">😃 Busy Study _ 새벽반 PM 10:00 ~ AM 2:30</h4>
<h4 id="여러분-화이팅-우리-모두-다-잘-될거예요">여러분 화이팅!! 우리 모두 다 잘 될거예요!</h4>
]]></description>
        </item>
        <item>
            <title><![CDATA[오늘의 공부 / 230505
]]></title>
            <link>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230505</link>
            <guid>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230505</guid>
            <pubDate>Fri, 05 May 2023 18:13:13 GMT</pubDate>
            <description><![CDATA[<h3 id="💬-오늘의-공부시간-am-1030--ㅠㅠ">💬 오늘의 공부시간 AM 10:30 ~ ㅠㅠ</h3>
<p>밀린 스터디 노트 임당ㅠㅠ
어제부터 줌 독서실 안되는 이유가 뭐지??? 자꾸 딴짓하고 싶다. 
<br/></p>
<h3 id="🔥-1주차-todo-리스트-5357">🔥 1주차 todo 리스트 (5/3~5/7)</h3>
<p><del>파이썬 기초1</del>
<del>파이썬 기초2</del>3<del>~
~</del>파이썬 기초4<del>~ 
~</del>파이썬 기초5<del>~
~</del>파이썬 기초6<del>~
~</del>파이썬 기초7<del>~
조건식
조건문(if문)
양자택일 조건문(if</del>else문)
if<del>else문과 조건식
~</del>파이썬 기초8<del>~
다자택일 조건문(if</del>elif문)
다자택일 조건문 사용시 주의할 점
중첩조건문
<br/></p>
<p>파이썬 기초9~10
파이썬 기초문풀1
파이썬 기초문풀2
파이썬 기초문풀3
<br/></p>
<p><del>📝 weekly 데이터 사이언스 스쿨 퀴즈</del>
<br/></p>
<h3 id="💻-핵심-내용-정리">💻 핵심 내용 정리</h3>
<h4 id="📝-조건식">📝 조건식</h4>
<ul>
<li>어떤 조건에 따라 실행이 분기되는 식.</li>
</ul>
<p><code>A if 조건식 else B → 조건식의 결과가 True 이면 A실행, 그렇지 않으면 B 실행</code></p>
<pre><code class="language-python">num1 = 10
num2 = 100

numResult = True if num1 &gt; num2 else False

print(&#39;num1 &gt; num2 : {}&#39;.format(numResult))
print(&#39;num1은 num2보다 크다.&#39;)</code></pre>
<hr>
<p>num1 &gt; num2 : False
num1은 num2보다 크다.</p>
<hr>
<br/>

<p><code>실습_01</code></p>
<pre><code class="language-python">적설량을 입력하고 적석량이 30mm 이상이면  대설경보를 발령하고
그렇지 않으면 대설 경보를 해제하는 코드를 작성해 보자.

limitSnowAmount = 30
snowAmount = int(input(&#39;적설량 입력(mm)  : &#39;))

print(&#39;적설량 : {}mm, {}&#39;.format(snowAmount, &#39;대설 경보 발령!!&#39;)) if snowAmount &gt;= limitSnowAmount else \
    print(&#39;적설량 : {}mm, {}&#39;.format(snowAmount, &#39;대설 경보 해제~~&#39;))</code></pre>
<hr>
<p>적설량 입력(mm)  : 59
적설량 : 59mm, 대설 경보 발령!!
적설량 입력(mm)  : 18
적설량 : 18mm, 대설 경보 해제~~</p>
<hr>
<br/>

<p><code>실습_02</code></p>
<pre><code class="language-python">국어, 영어, 수학 점수를 입력하면 조건식을 이용해서 과목별 결과와 전체 결과를 출력하는 코드를 작성해 보자.

import operator

passScore1 = 60
passScore2 = 70

kor = int(input(&#39;국어 점수 : &#39;))
eng = int(input(&#39;영어 점수 : &#39;))
mat = int(input(&#39;수학 점수 : &#39;))

totalScore = kor + eng + mat
avgScore = totalScore / 3

print(&#39;국어  : PASS&#39;) if operator.ge(kor, passScore1) else print(&#39;국어 : FAIL&#39;)
print(&#39;영어  : PASS&#39;) if operator.ge(eng, passScore1) else print(&#39;영어 : FAIL&#39;)
print(&#39;수학  : PASS&#39;) if operator.ge(mat, passScore1) else print(&#39;수학 : FAIL&#39;)

print(&#39;총점 : %d, 평균 : %.2f&#39; % (totalScore, avgScore))</code></pre>
<br/>

<h4 id="📝-조건문if문">📝 조건문(if문)</h4>
<ul>
<li>특정조건에 따라 프로그램을 분기한다.</li>
<li>조건문의 종류
if문 → 단일조건
if ~ else문 → 양자택일
if ~ elif문 → 다자택일 (다중조건)<br/>

</li>
</ul>
<blockquote>
<p><code>if문</code>
if 조건식 :
____실행문</p>
</blockquote>
<ul>
<li>False 일때,  아무런 반응이 없다.<br/>

</li>
</ul>
<p><code>조건문 기본</code></p>
<pre><code class="language-python">if 10 &gt; 5 :
    print(&#39;10은 5보다 크다.&#39;)

num1 = 10
num2 = 20

if num1 &gt;= num2 :
    print(&#39;num1은 num2보다 작거나 같다.&#39;)</code></pre>
<hr>
<p>10은 5보다 크다.</p>
<hr>
<br/>

<p><code>실습_03</code></p>
<pre><code class="language-python">국어, 영어, 수학점수를 입력하고 평균이 90점 이상이면 참 잘했어요.를 출력하는 코드를 작성하자.

kor = int(input(&#39;국어 점수 입력 : &#39;))
eng = int(input(&#39;영어 점수 입력 : &#39;))
mat = int(input(&#39;수학 점수 입력 : &#39;))

avgScore = (kor + eng + mat) / 3
print(&#39;평균 : {}&#39;.format(avgScore))

if avgScore &gt;= 90:
    print(&#39;참 잘 했어요~~&#39;)</code></pre>
<hr>
<p>국어 점수 입력 : 90
영어 점수 입력 : 93
수학 점수 입력 : 100
평균 : 94.33333333333333
참 잘 했어요~~</p>
<hr>
<br/>


<p><code>실습_04</code></p>
<pre><code class="language-python">highTemperature = 28
lowTemperature = 20

innerTemperaute = int(input(&#39;실내온도 입력 : &#39;))

if innerTemperaute &gt;= highTemperature:
    print(&#39;냉방 작동!&#39;)

if innerTemperaute &lt;= lowTemperature:
    print(&#39;난방 작동!&#39;)</code></pre>
<hr>
<p>실내온도 입력 : 14
난방 작동!</p>
<hr>
<br/>

<h4 id="📝-양자택일-조건문ifelse문">📝 양자택일 조건문(if~else문)</h4>
<ul>
<li>if ~ else문 : 조건식 결과에 따라 둘 중에 하나가 실행됨</li>
</ul>
<blockquote>
<p><code>if ~ else문</code>
if 조건식:
<strong>__실행문
else:
__</strong>실행문</p>
</blockquote>
<blockquote>
<p><code>pass</code> 키워드
실행문이 없을때, 나중에 작성하겠다.</p>
</blockquote>
<blockquote>
<p><code>len() 함수</code>
= 문자열의 길이
<br/></p>
</blockquote>
<p><code>실습_05</code></p>
<pre><code class="language-python">나이가 65세 이상이면 교통요금 무료를 적용하는 프로그램을 만들어 보자.

seniorAge = 65

passAge = int(input(&#39;나이 입력 : &#39;))
if passAge &gt;= seniorAge:
    print(&#39;무료 대상 승객 입니다.&#39;)
else:
    print(&#39;유료 대상 승객 입니다.&#39;)</code></pre>
<hr>
<p>나이 입력 : 43
유료 대상 승객 입니다.
나이 입력 : 68
무료 대상 승객 입니다.</p>
<hr>
<br/>

<p><code>실습_06</code></p>
<pre><code class="language-python">소수점 첫번째 자리에서 반올림하는 프로그램을 만들어 보자.

floatNum = float(input(&#39;소수 입력 : &#39;))

if floatNum - int(floatNum) &gt;= 0.5:
    print(&#39;올림 : {}&#39;.format(int(floatNum) + 1))
else:
    print(&#39;버림 : {}&#39;.format(int(floatNum)))</code></pre>
<p><code>조건식(삼항연산자)의 두가지 사용법</code></p>
<ul>
<li><p>조건식 결과에 따른 <code>실행</code>만 하는 경우</p>
<pre><code class="language-python">print(&#39;포인트 사용 가능&#39;) if userPoint &gt;= minAblePoint else print(&#39;포인트 사용 불가능&#39;)</code></pre>
</li>
<li><p>조건식 결과를 <code>변수에 할당</code>하는 경우</p>
<pre><code class="language-python">result = &#39;가능&#39; if userPoint &gt;= minAblePoint else &#39;불가능&#39;
print(&#39;포인트 사용 가능 여부 : {}&#39;.format(result))</code></pre>
</li>
<li><p>조건식 → if ~ else문 : 모든 조건식(삼항연산자)은 if~ else문으로 변경할 수 있다.</p>
</li>
</ul>
<p><code>양자택일</code></p>
<pre><code class="language-python">print(&#39;포인트 사용 가능&#39;) if userPoint &gt;= minAblePoint else print(&#39;포인트 사용 불가능&#39;)
    ↓    ↓    ↓
if userPoint &gt;= minAblePoint:
    print(&#39;포인트 사용 가능&#39;)
else:
    print(&#39;포인트 사용 불가능&#39;)</code></pre>
<p><code>결과를 참(True)/거짓(False)으로 할당한다.</code></p>
<pre><code class="language-python">result = &#39;가능&#39; if userPoint &gt;= minAblePoint else &#39;불가능&#39;
print(&#39;포인트 사용 가능 여부 : {}&#39;.format(result))
    ↓    ↓    ↓
if userPoint &gt;= minAblePoint:
    result = &#39;가능&#39;
else:
    result = &#39;불가능&#39;
print(&#39;포인트 사용 가능 여부 : {}&#39;.format(result))</code></pre>
<ul>
<li>if ~ else문 → 조건식 : 모든 if~ else문을 조건식(삼항연산자)은 변경할 수 있는 것이 아니다.
조건식으로 코딩하기 어렵다.    </li>
</ul>
<p><code>실습_07</code></p>
<pre><code class="language-python">비올 확률을 입력하고 비올 확률이 55%이상이면 &#39;우산을 챙기세요&#39;를 
그렇지 않음&#39;양산을 챙기세요&#39; 출력하는 코드를 작성하자.

rainPercentage = int(input(&#39;비올 확률 입력 : &#39;))
minRainpercentage = 55

if rainPercentage &gt;= minRainpercentage:
    print(&#39;우산을 챙기세요.&#39;)
else:
    print(&#39;양산을 챙기세요.&#39;)</code></pre>
<blockquote>
<p>입력 → 기준자 → 조건식 →  실행문</p>
</blockquote>
<br/>

<p><code>실습_08</code></p>
<pre><code class="language-python">다음의 요구 사항을 해결하기 위해서 조건식과 if ~ else문 중 알맞은 구문을 사용해보자.

todayTemper = int(input(&#39;오늘의 온도 입력 : &#39;))
standardTemper = 11

print(&#39;산책하기 좋은 날씨입니다.&#39;) if todayTemper &gt;= standardTemper else print(&#39;감기 조심하세요.&#39;)

if todayTemper &gt;= standardTemper:
    print(&#39;산책하기 좋은 날씨입니다.&#39;)
else:
    print(&#39;감기 조심하세요.&#39;)</code></pre>
<br/>

<h4 id="📝-다자택일-조건문ifelif문">📝 다자택일 조건문(if~elif문)</h4>
<ul>
<li>if ~ elif문 : 여러가지 조건식 결과에 따라 실행문이 결정됨.</li>
</ul>
<blockquote>
<p>입력 → 기준자 → 조건식 →  실행문</p>
</blockquote>
<p><code>예시</code></p>
<pre><code class="language-python">exampleScore = int(input(&#39;시험 성적 입력 : &#39;))
grades = &#39;&#39;

if exampleScore &gt;= 90:
    grades = &#39;A&#39;
elif exampleScore &gt;= 80:
    grades = &#39;B&#39;
elif exampleScore &gt;= 70:
    grades = &#39;C&#39;
elif exampleScore &gt;= 60:
    grades =&#39;D&#39;
else:                # 생략 가능
    grades = &#39;F&#39;

print(&#39;성적 : {} \t 학점 : {}&#39;.format(exampleScore, grades))</code></pre>
<hr>
<p>시험 성적 입력 : 89
성적 : 89      학점 : B</p>
<hr>
<p><code>실습_09</code></p>
<pre><code class="language-python">계절을 입력하면 영어로 번역되는 프로그램을 만들어 보자.

print(&#39;계절 : 봄, 여름, 가을, 겨울&#39;)
seasonstr = input(&#39;계절 입력 : &#39;)

if seasonstr == &#39;봄&#39;:
    print(&#39;{} : {}&#39;.format(&#39;봄&#39;, &#39;Spring&#39;))
elif seasonstr == &#39;여름&#39;:
    print(&#39;{} : {}&#39;.format(&#39;여름&#39;, &#39;Summer&#39;))
elif seasonstr == &#39;가을&#39;:
    print(&#39;{} : {}&#39;.format(&#39;가을&#39;, &#39;Fall&#39;))
elif seasonstr == &#39;겨울&#39;:
    print(&#39;{} : {}&#39;.format(&#39;겨울&#39;, &#39;Winter&#39;))
else:                # 생략 가능
    print(&#39;검색 할 수 없습니다.&#39;)</code></pre>
<hr>
<p>계절 : 봄, 여름, 가을, 겨울
계절 입력 : 가을
가을 : Fall</p>
<hr>
<br/>

<p><code>실습_10</code></p>
<pre><code class="language-python">키오스크에서 메뉴를 선택하면 영수증이 출력되는 프로그램을 만들어 보자.

print(&#39;1.카페라떼(3.5) \t 2.에스프레소(3.0) \t 3.아메리카노(2.0) \t 4.곡물라떼(4.0) \t 5.밀크티(4.3)&#39;)
userSelectNumber = input(&#39;메뉴 선택 : &#39;)

print(&#39;-&#39; * 30)
if userSelectNumber == &#39;1&#39;:
    print(&#39;메뉴 : {} \n가격 : {}&#39;.format(&#39;카페라떼&#39;, &#39;3,500원&#39;))
elif userSelectNumber == &#39;2&#39;:
    print(&#39;메뉴 : {} \n가격 : {}&#39;.format(&#39;에스포레소&#39;, &#39;3,000원&#39;))
elif userSelectNumber == &#39;3&#39;:
    print(&#39;메뉴 : {} \n가격 : {}&#39;.format(&#39;아메리카노&#39;, &#39;2,000원&#39;))
elif userSelectNumber == &#39;4&#39;:
    print(&#39;메뉴 : {} \n가격 : {}&#39;.format(&#39;곡물라떼&#39;, &#39;4,000원&#39;))
elif userSelectNumber == &#39;5&#39;:
    print(&#39;메뉴 : {} \n가격 : {}&#39;.format(&#39;밀크티&#39;, &#39;4,300원&#39;))
print(&#39;-&#39; * 30)</code></pre>
<br/>

<h4 id="📝-다자택일-조건문-사용시-주의할-점">📝 다자택일 조건문 사용시 주의할 점</h4>
<ul>
<li>조건식 순서가 중요하다. →  순서대로 나열한다.</li>
<li>조건범위를 명시한다.</li>
</ul>
<p><code>실습_11</code></p>
<pre><code class="language-python">자동차 배기량에 따라 세금을 부과한다고  할 때, 
다음 표를 보고 배기량을 입력하면 세금이 출력 되는 프로그램을 만들어보자.

배기량 5000cc 이상            세금 600,000원
배기량 5000cc 미만 4000cc 이상 세금 500,000원
배기량 4000cc 미만 3000cc 이상 세금 400,000원
배기량 3000cc 미만 2000cc 이상 세금 300,000원
배기량 2000cc 미만 1000cc 이상 세금 200,000원
배기량 1000cc 미만            세금 100,000원</code></pre>
<blockquote>
<p>입력 → 숫자변환 → 조건식 : 양자택일 → 실행문</p>
</blockquote>
<pre><code class="language-python">carDisplacement = int(input(&#39;자동차 배기량 입력 : &#39;))

if carDisplacement &lt; 1000:
    print(&#39;세금 : 100,000원&#39;)
elif carDisplacement &lt; 2000 and carDisplacement &gt;= 1000:
    print(&#39;세금 : 200,000원&#39;)
elif carDisplacement &lt; 3000 and carDisplacement &gt;= 2000:
    print(&#39;세금 : 300,000원&#39;)
elif carDisplacement &lt; 4000 and carDisplacement &gt;= 3000:
    print(&#39;세금 : 400,000원&#39;)
elif carDisplacement &lt; 5000 and carDisplacement &gt;= 4000:
    print(&#39;세금 : 500,000원&#39;)
elif carDisplacement &gt;= 5000:
    print(&#39;세금 : 600,000원&#39;)</code></pre>
<h4 id="📝-중첩조건문">📝 중첩조건문</h4>
<ul>
<li>조건문 안에 또 다른 조건문이 있을 수 있다.
3, 4단계 이상의 조건문은 사용하지 않는다. <br/>

</li>
</ul>
<p><code>실습_11</code></p>
<pre><code class="language-python">출퇴근시 이용하는 교통수단에 따라 세금을 감면해 주는 정책를 세우려고 한다.
다음 내용에 맞게 프로그램을 만들어 보자.

selectNum = int(input(&#39;출퇴근 대상자 인가요? \t 1.Yes \t 2.No&#39;))

if selectNum == 1:
    print(&#39;교통수단을 선택하세요.&#39;)
    trans = int(input(&#39;1.도보,자전거 \t 2.버스,지하철 \t 3.자가용&#39;))

    if trans == 1:
        print(&#39;세금 감면 5%&#39;)
    elif trans == 2:
        print(&#39;세금 감면 3%&#39;)
    elif trans == 3:
        print(&#39;세금 감면 1%&#39;)
elif selectNum == 2:
    print(&#39;세금 변동 없습니다.&#39;)
else:
    print(&#39;잘못 입력했습니다.&#39;)</code></pre>
<br/>

<h3 id="💡-오늘을-마무리하면서-">💡 오늘을 마무리하면서 ...</h3>
<p>할말많지만 하지않겠어..
<br/></p>
<h4 id="😃-busy-study-_-새벽반-pm-1000--am-230">😃 Busy Study _ 새벽반 PM 10:00 ~ AM 2:30</h4>
<h4 id="여러분-화이팅-우리-모두-다-잘-될거예요">여러분 화이팅!! 우리 모두 다 잘 될거예요!</h4>
]]></description>
        </item>
        <item>
            <title><![CDATA[오늘의 공부 / 230504]]></title>
            <link>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230504</link>
            <guid>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230504</guid>
            <pubDate>Thu, 04 May 2023 02:50:16 GMT</pubDate>
            <description><![CDATA[<h3 id="💬-오늘의-공부시간-pm-900--am-0310">💬 오늘의 공부시간 PM 9:00 ~ AM 03:10</h3>
<p>어제 저녁 시할아버지 제사로 포항을 급하게 다녀왔다.
포항가는 KTX 안에서 강의를 들었는데 아직 디지털기기 쪼렙이라 패드로 키보드를 치는건 무리더라 ㅠㅠ
내가 아직 기계치일수도 있는 것이기도 하고, 늦은 공부를 시작해 보련다.
정리 할 공부량이 많지만 요번주 시간이 너무 빠르다 ㅠㅠ
화이팅!!
<br/></p>
<h3 id="🔥-1주차-todo-리스트-5357">🔥 1주차 todo 리스트 (5/3~5/7)</h3>
<p><del>파이썬 기초1</del>
<del>파이썬 기초2</del>3<del>~
~</del>파이썬 기초4<del>~ 
~</del>파이썬 기초5<del>~
산술연산자(덧셈,뺄셈&gt;
산술연산자&lt;곱셈과 나눗셈&gt;
산술연산자&lt;나머지와 몫&gt;
산술연산자&lt;거듭제곱&gt;
복합연산자
~</del>파이썬 기초6~~
비교연산자&lt;숫자비교&gt;
비교연산자&lt;문자비교&gt;
논리연산자
operator모듈
<br/></p>
<p>파이썬 기초7
파이썬 기초8
파이썬 기초9~10
파이썬 기초문풀1
파이썬 기초문풀2
파이썬 기초문풀3
<br/></p>
<p><del>📝 weekly 데이터 사이언스 스쿨 퀴즈</del>
<br/></p>
<h3 id="💻-핵심-내용-정리">💻 핵심 내용 정리</h3>
<h4 id="📝-연산자란">📝 연산자란?</h4>
<p><code>result = data1 + data2</code></p>
<ul>
<li>피연산자(data1, data2)를 연산자로 계산<br/>

</li>
</ul>
<h4 id="📝-연산자종류">📝 연산자종류</h4>
<ul>
<li>산술 연산자 : +, -, <em>, /, %, //, *</em></li>
<li>할당 연산자 : =, +=, -=, *=, /=, %=, //=</li>
<li>비교 연산자 : &gt;, &gt;=, &lt;, &lt;=, ==, !=
(== 같다/ != 같지않다/다르다)<br/>

</li>
</ul>
<h4 id="📝-산술-연산자-덧셈">📝 산술 연산자 &lt;덧셈&gt;</h4>
<pre><code class="language-python"># 정수를 이용한 덧셈
num1 = 9
num2 = 3
result = num1 +num2
print(f&#39;result = {result}&#39;)

# 실수를 이용한 덧셈
fNum1 = 3.14
fNum2 = 0.12
result = fNum1 + fNum2
print(f&#39;result : {result}&#39;)
print(&quot;result : %.2f&quot; % result)

# 정수와 실수를 이용한 덧셈
result = num1 + fNum2
print(f&#39;result : {result}&#39;)

# 문자를 이용한 덧셈
str1 = &#39;Good&#39;
str2 = &#39; &#39;
str3 = &#39;morning&#39;
result = str1 + str2 + str3
print(f&#39;result : {result}&#39;)

# 숫자와 문자를 이용한 덧셈
result = num1 + str1
print(f&#39;result : {result}&#39;)</code></pre>
<hr>
<p>result = 12
result : 3.2600000000000002
result : 3.26
result : 9.12
result : Good morning
TypeError: unsupported operand type(s) for +: &#39;int&#39; and &#39;str&#39;</p>
<hr>
<br/>  

<p><code>실습_01</code></p>
<pre><code class="language-python">#  국어, 영어, 수학 점수를 입력하고 합계를 출력해보자.
kor = int(input(&#39;국어 점수 : &#39;))
eng = int(input(&#39;영어 점수 : &#39;))
mat = int(input(&#39;수학 점수 : &#39;))
total = kor + eng + mat

print(&#39;국어 점수 {}&#39;.format(kor))
print(&#39;영어 점수 {}&#39;.format(eng))
print(&#39;수학 점수 {}&#39;.format(mat))
print(&#39;합계 {}&#39;.format(total))</code></pre>
<hr>
<p>국어 점수 : 85
영어 점수 : 90
수학 점수 : 95
국어 점수 85
영어 점수 90
수학 점수 95
합계 270</p>
<hr>
<br/>


<h4 id="📝-산술-연산자-뺄셈">📝 산술 연산자 &lt;뺄셈&gt;</h4>
<pre><code class="language-python"># 정수를 이용한 뺄셈
num1 = 10
num2 = 29
result = num1 - num2
print(f&#39;num1 : {num1}&#39;)
print(f&#39;num2 : {num2}&#39;)
print(f&#39;result : {result}&#39;)

# 실수를 이용한 뺼셈
fNum1 = 3.14
fNum2 = 0.14
result = fNum1 - fNum2
print(f&#39;fNum1 : {fNum1}&#39;)
print(f&#39;fNum2 : {fNum2}&#39;)
print(f&#39;result : {result}&#39;)
print(f&#39;type of result : {type(result)}&#39;)

# 정수와 실수를 이용한 뺄셈
result = num1 - fNum1
print(f&#39;Num1 : {num1}&#39;)
print(f&#39;fNum1 : {fNum1}&#39;)
print(f&#39;result : {result}&#39;)
print(f&#39;type of result : {type(result)}&#39;)

# 문자(열)을 이용한 뺄셈
str1 = &#39;Good&#39;
str2 = &#39; &#39;
str3 = &#39;afternoon&#39;
result = str1 - str2 - str3
print(&#39;result : {}&#39;.format(result))</code></pre>
<hr>
<p>num1 : 10
num2 : 29
result : -19
fNum1 : 3.14
fNum2 : 0.14
result : 3.0
type of result : &lt;class &#39;float&#39;&gt;
Num1 : 10
fNum1 : 3.14
result : 6.859999999999999
type of result : &lt;class &#39;float&#39;&gt;
TypeError: unsupported operand type(s) for -: &#39;str&#39; and &#39;str&#39;</p>
<hr>
<br/>

<p><code>실습_02</code></p>
<pre><code class="language-python"># 이번달 알바비와 카드값을 입력하고, 남은 금액이 얼마인지 출력해 보자.
partTimePay = int(input(&#39;알바비 입력 : &#39;))
cardMoney = int(input(&#39;카드값 입력 : &#39;))
result = partTimePay - cardMoney

print(&#39;알비비 : {}원&#39;.format(partTimePay))
print(&#39;카드값 : {}원&#39;.format(cardMoney))
print(&#39;남는 금액 : {}원&#39;.format(result))</code></pre>
<hr>
<p>알바비 입력 : 800000
카드값 입력 : 453000
알비비 : 800000원
카드값 : 453000원
남는 금액 : 347000원</p>
<hr>
<br/>

<h4 id="📝-산술-연산자-곱셈과-나눗셈">📝 산술 연산자 &lt;곱셈과 나눗셈&gt;</h4>
<pre><code class="language-python"># 숫자(정수, 실수)를 이용한 곱셈
num1 = 20
fNum1 = 3.14
result = num1 * fNum1
print(&#39;result : {}&#39;.format(result))
print(&#39;result : %.2f&#39; % result)

# 문자(열)을 이용한 곱셈
str1 = &#39;Hi &#39;
result = str1 * 7
print(&#39;result : {}&#39;.format(result))

# 숫자(정수, 실수)를 이용한 나눗셈
num1 = 10
num2 = 3
result = num1 / num2
print(&#39;num1 : {}, num2 : {}&#39;.format(num1, num2))
print(&#39;result :{}&#39;.format(result))
print(&#39;result : %.2f&#39; % result)

# 0을 나눗셈 하는 경우
num1 = 0
num2 = 3
result = num1 / num2
print(&#39;result : {}&#39;.format(result))

# 0으로 나누는 경우
result = num2 / num1
print(&#39;result :{}&#39;.format(result))</code></pre>
<hr>
<p>result : 62.800000000000004
result : 62.80
result : Hi Hi Hi Hi Hi Hi Hi 
num1 : 10, num2 : 3
result :3.3333333333333335
result : 3.33
result : 0.0
ZeroDivisionError: division by zero</p>
<hr>
<ul>
<li>0으로는 나눌 수 없다.</li>
<li>0을 나눗셈하는 경우엔 항상 결과는 0이다.</li>
<li>나눗셈의 결과는 항상 실수(float)이다.</li>
</ul>
<pre><code class="language-python"># 나눗셈의 결과는 항상 실수(float)이다.
num1 = 20
num2 = 10
result = num1 / num2
print(&#39;result :{}&#39;.format(result))
print(&#39;type of result : {}&#39;.format(type(result)))</code></pre>
<hr>
<p>result :2.0
type of result : &lt;class &#39;float&#39;&gt;</p>
<hr>
<br/>

<p><code>실습_03</code></p>
<pre><code class="language-python"># 국어, 영어, 수학 점수를 입력하고 합계와 평균을 출력해 보자.
kor = int(input(&#39;국어 점수 : &#39;))
eng = int(input(&#39;영어 점수 : &#39;))
mat = int(input(&#39;수학 점수 : &#39;))
total = kor + eng + mat

print(&#39;국어 점수 {}&#39;.format(kor))
print(&#39;영어 점수 {}&#39;.format(eng))
print(&#39;수학 점수 {}&#39;.format(mat))
print(&#39;합계 {}&#39;.format(total))
print(&#39;평균 {}&#39;.format(total / 3))
print(&#39;평균 %.2f&#39; % (total / 3))</code></pre>
<hr>
<p>국어 점수 : 85
영어 점수 : 90
수학 점수 : 85
국어 점수 85
영어 점수 90
수학 점수 85
합계 260
평균 86.66666666666667
평균 86.67</p>
<hr>
<p><code>실습_04</code></p>
<pre><code class="language-python"># 학급 전체 학생수 입력
# 한 모둠에 속하는 학생수 입력
# 전체 모둠 수 입력

everyOne = int(input(&#39;전체 학생수 : &#39;))
stuCntOfGroup = int(input(&#39;한 모둠 학생 수 : &#39;))
allGroupCnt = everyOne / stuCntOfGroup

print(&#39;전체 학생 수 : {}&#39;.format(everyOne))
print(&#39;한 모둠 학생 수 : {}&#39;.format(stuCntOfGroup))
print(&#39;모둠 수 : {}&#39;.format(allGroupCnt))
print(&#39;모둠 수 : {}&#39;.format(int(allGroupCnt)))</code></pre>
<hr>
<p>전체 학생수 : 25
한 모둠 학생 수 : 4
전체 학생 수 : 25
한 모둠 학생 수 : 4
모둠 수 : 6.25
모둠 수 : 6</p>
<hr>
<br/>

<h4 id="📝-산술-연산자-나머지와-몫">📝 산술 연산자 &lt;나머지와 몫&gt;</h4>
<pre><code class="language-python"># 예시 _ / 나눗셈
num1 = 10
num2 = 3
result = num1 / num2
print(&#39;num1: {}, num2: {}, result: {}&#39;.format(num1, num2, result))

# 나눗셈 결과 나머지 만 구함 _ % 나머지
num1 = 10
num2 = 3
result = num1 % num2

print(&#39;num1: {}, num2: {}, result: {}&#39;.format(num1, num2, result))

# 나눗셈 결과 몫 만 구함 _ // 몫
num1 = 10
num2 = 3
result = num1 // num2

print(&#39;num1: {}, num2: {}, result: {}&#39;.format(num1, num2, result))</code></pre>
<hr>
<p>num1: 10, num2: 3, result: 3.3333333333333335
num1: 10, num2: 3, result: 1
num1: 10, num2: 3, result: 3</p>
<hr>
<br/>

<h4 id="📝-divmod-함수">📝 divmod() 함수</h4>
<ul>
<li>나머지와 몫을 한번에 구하기</li>
</ul>
<pre><code class="language-python">num1 = 10
num2 = 3

result = divmod(num1, num2)          # 인덱스 개념 [3, 1]
print(&#39;result: {}&#39;.format(result))
print(&#39;몫 : {}&#39;.format(result[0]))
print(&#39;나머지 : {}&#39;.format(result[1]))</code></pre>
<hr>
<p>result: (3, 1)
몫 : 3
나머지 : 1</p>
<hr>
<br/>

<p><code>실습_05</code></p>
<pre><code class="language-python"># 학급 전체 학생수 입력
# 한 모둠에 속하는 학생수 입력
# 전체 모둠 수과 남는 학생수 입력

everyOne = int(input(&#39;전체 학생수 : &#39;))
stuCntOfGroup = int(input(&#39;한 모둠 학생 수 : &#39;))
allGroupCnt = everyOne // stuCntOfGroup
overGroupCnt = everyOne % stuCntOfGroup

print(&#39;전체 학생 수 : {}&#39;.format(everyOne))
print(&#39;한 모둠 학생 수 : {}&#39;.format(stuCntOfGroup))
print(&#39;모둠 수 : {}&#39;.format(allGroupCnt))
print(&#39;남는 학생 수 :{}&#39;.format(overGroupCnt))

# divmod() 함수를 이용
result = divmod(everyOne, stuCntOfGroup)
print(&#39;result : {}&#39;.format(result))
print(&#39;모둠 수 : {}&#39;.format(result[0]))
print(&#39;남는 학생 수 : {}&#39;.format(result[1]))</code></pre>
<hr>
<p>전체 학생수 : 25
한 모둠 학생 수 : 4
전체 학생 수 : 25
한 모둠 학생 수 : 4
모둠 수 : 6
남는 학생 수 :1
result : (6, 1)
모둠 수 : 6
남는 학생 수 : 1</p>
<hr>
<p><code>실습_06</code></p>
<pre><code class="language-python"># 123개의 사과를 4개씩 직원들한테 나누어 주려고 한다.
# 최대 나누어 줄수 있는 직원수와 남는 사과 개수를 출력해 보자.

emploree = 123
apple = 4
result = divmod(emploree, apple)

print(&#39;사과를 나누어 줄 수 있는 최대 직원 수 : {}명&#39;.format(result[0]))
print(&#39;남는 사과의 갯수 : {}명&#39;.format(result[1]))</code></pre>
<hr>
<p>사과를 나누어 줄 수 있는 최대 직원 수 : 30명
남는 사과의 갯수 : 3명</p>
<hr>
<br/>

<h4 id="📝-산술-연산자-거듭제곱">📝 산술 연산자 &lt;거듭제곱&gt;</h4>
<ul>
<li>같은 수를 여러 번 곱한 값을 구한다.</li>
</ul>
<pre><code class="language-python">num1 = 2
num2 = 3
result = num1 ** num2

print(&#39;num1 : {}&#39;.format(num1))
print(&#39;num2 : {}&#39;.format(num2))
print(&#39;result : {}&#39;.format(result))</code></pre>
<hr>
<p>num1 : 2
num2 : 3
result : 8</p>
<hr>
<br/>

<h4 id="📝-n의-m-제곱근의-공식-_-n--1m">📝 n의 m 제곱근의 공식 _ n ** (1/m)</h4>
<pre><code class="language-python"># 2의 제곱근 구하기
result = 2 ** (1/2)
print(&#39;2의 제곱급 %f&#39; % result)
print(&#39;2의 제곱급 %.2f&#39; % result)

# 2의 3제곱근 구하기
result = 2 ** (1/3)
print(&#39;2의 3제곱급 %f&#39; % result)
print(&#39;2의 3제곱급 %.2f&#39; % result)

# 2의 4제곱근 구하기
result = 2 ** (1/4)
print(&#39;2의 4제곱급 %f&#39; % result)
print(&#39;2의 4제곱급 %.2f&#39; % result)</code></pre>
<hr>
<p>2의 제곱급 1.414214
2의 제곱급 1.41
2의 3제곱급 1.259921
2의 3제곱급 1.26
2의 4제곱급 1.189207
2의 4제곱급 1.19</p>
<hr>
<br/>

<h4 id="📝-math모듈의-sqrt와-pow함수">📝 math모듈의 sqrt()와 pow()함수</h4>
<p><code>sqrt()함수를 이용한 제곱근 구하기</code>
<code>→ 항상 제곱근 만 구한다.</code></p>
<pre><code class="language-python">import math

print(&#39;2의 제곱근 %f&#39; % math.sqrt(2))
print(&#39;2의 제곱근 %.2f&#39; % math.sqrt(2))

print(&#39;3의 제곱근 %f&#39; % math.sqrt(3))
print(&#39;3의 제곱근 %.2f&#39; % math.sqrt(3))

print(&#39;4의 제곱근 %f&#39; % math.sqrt(4))
print(&#39;4의 제곱근 %.2f&#39; % math.sqrt(4))</code></pre>
<p><code>pow()함수를 이용한 제곱근 구하기</code>
<code>→ [0]의 [1] 제곱근을 구하는 함수.</code></p>
<pre><code class="language-python">import math

print(&#39;2의 3제곱근 %f&#39; % math.pow(2, 3))
print(&#39;3의 4제곱근 %f&#39; % math.pow(3, 4))</code></pre>
<hr>
<p>2의 3제곱근 8.000000
3의 4제곱근 81.000000</p>
<hr>
<br/>

<p><code>실습_07</code></p>
<pre><code class="language-python">아들이 엄마한테 용돈을 받는데, 첫 달에는  200원을 받고 매월 이전 달의 2배씩 인상하기로 했다.
12개월째 되는 달에는 얼마를 받을 수 있는 지 계산해 보자.

firstMonthMoney = 200
after12Month = ((firstMonthMoney * 0.01) ** 12) * 100
print(&#39;12개월 후 용돈 : %.f 원&#39; % after12Month)

after12Month =int(after12Month)
strResult = format(after12Month, &#39;,&#39;)
print(&#39;12개월 후 용돈 : %s원&#39; % strResult)

print(strResult, &#39;원&#39;)</code></pre>
<hr>
<p>12개월 후 용돈 : 409600 원
12개월 후 용돈 : 409,600원
409,600 원</p>
<hr>
<br/>

<h4 id="📝-복합-연산자">📝 복합 연산자</h4>
<ul>
<li>할당(대입) 연산자
= (오른쪽의 값을 왼쪽에 할당/대입한다.)<pre><code class="language-python">num1 = 10
num2 = 20
result = num1 + num2</code></pre>
<blockquote>
<p>복합연산자</p>
</blockquote>
</li>
<li>+=
덧셈 연산 후 할당</li>
<li>-=
뺄셈 연산 후 할당</li>
<li>*=
곱셈 연산 후 할당</li>
<li>/=
나눗셈 연산 후 할당</li>
<li>%=
나머지 연산 후 할당</li>
<li>//=
몫 연산후 할당</li>
<li>**=
거듭제곱 연산후  할당</li>
</ul>
<p><code>예시</code></p>
<pre><code class="language-python">num = 10

num1 = num + 6
num1 += 1

print(&#39;num1 : {}&#39;.format(num1))</code></pre>
<hr>
<p>num1 : 17</p>
<hr>
<br/>

<p><code>실습_08</code></p>
<pre><code class="language-python">다음 표를 참고해서 연간 누적 강수량을 출력해보자.
|월| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12|
|강수량| 30| 45| 47| 55| 65| 100| 128| 209| 204| 186| 67| 25|

rain = 0
totalRainAmount = 0


totalRainAmount += 30
print(&#39;1월 누적 강수량 : {}mm &#39;.format(totalRainAmount))

totalRainAmount += 45
print(&#39;2월 누적 강수량 : {}mm &#39;.format(totalRainAmount))

totalRainAmount += 47
print(&#39;3월 누적 강수량 : {}mm &#39;.format(totalRainAmount))

totalRainAmount += 55
print(&#39;4월 누적 강수량 : {}mm &#39;.format(totalRainAmount))

totalRainAmount += 65
print(&#39;5월 누적 강수량 : {}mm &#39;.format(totalRainAmount))

totalRainAmount += 100
print(&#39;6월 누적 강수량 : {}mm &#39;.format(totalRainAmount))

totalRainAmount += 128
print(&#39;7월 누적 강수량 : {}mm &#39;.format(totalRainAmount))

totalRainAmount += 209
print(&#39;8월 누적 강수량 : {}mm &#39;.format(totalRainAmount))

totalRainAmount += 204
print(&#39;9월 누적 강수량 : {}mm &#39;.format(totalRainAmount))

totalRainAmount += 186
print(&#39;10월 누적 강수량 : {}mm &#39;.format(format(totalRainAmount,&#39;,&#39;)))

totalRainAmount += 67
print(&#39;11월 누적 강수량 : {}mm &#39;.format(format(totalRainAmount,&#39;,&#39;)))

totalRainAmount += 25
print(&#39;12월 누적 강수량 : {}mm &#39;.format(format(totalRainAmount,&#39;,&#39;)))


avgRainAmount = totalRainAmount / 12


print(&#39;-&#39; * 30)
print(&#39;연간 누적 강수량 : {}mm &#39;.format(format(totalRainAmount,&#39;,&#39;)))
print(&#39;연간 평균 강수량 : {}mm &#39;.format(avgRainAmount))
print(&#39;-&#39; * 30)</code></pre>
<hr>
<p>1월 누적 강수량 : 30mm 
2월 누적 강수량 : 75mm 
3월 누적 강수량 : 122mm 
4월 누적 강수량 : 177mm 
5월 누적 강수량 : 242mm 
6월 누적 강수량 : 342mm 
7월 누적 강수량 : 470mm 
8월 누적 강수량 : 679mm 
9월 누적 강수량 : 883mm 
10월 누적 강수량 : 1,069mm 
11월 누적 강수량 : 1,136mm 
12월 누적 강수량 : 1,161mm </p>
<p>연간 누적 강수량 : 1,161mm 
연간 평균 강수량 : 96.75mm </p>
<hr>
<br/>

<h4 id="📝-비교-연산자-숫자비교">📝 비교 연산자 &lt;숫자비교&gt;</h4>
<ul>
<li>연산결과는 bool(논리형)이다.</li>
</ul>
<pre><code class="language-python">num1 = 10
num2 = 5

result = num1 &gt; num2   # True
print(&#39;num1 &gt; num2 : {}&#39;.format(result))

result = num1 &gt;= num2   # True
print(&#39;num1 &gt;= num2 : {}&#39;.format(result))

result = num1 &lt; num2   # False
print(&#39;num1 &lt; num2 : {}&#39;.format(result))

result = num1 &lt;= num2   # False
print(&#39;num1 &lt;= num2 : {}&#39;.format(result))

result = num1 == num2   # False
print(&#39;num1 == num2 : {}&#39;.format(result))

result = num1 != num2   # True
print(&#39;num1 != num2 : {}&#39;.format(result))</code></pre>
<br/>

<p><code>실습_09</code></p>
<pre><code class="language-python">숫자 두개를 입력한 후 비교연산 결과를 출력하는 코드를 작성하자.

userInputNumber1 = int(input(&#39;첫번째 숫자 입력 : &#39;))
userInputNumber2 = int(input(&#39;두번째 숫자 입력 : &#39;))

print(&#39;{} &gt; {} : {}&#39;.format(userInputNumber1, userInputNumber2, (userInputNumber1 &gt; userInputNumber2)))
print(&#39;{} &gt;= {} : {}&#39;.format(userInputNumber1, userInputNumber2, (userInputNumber1 &gt;= userInputNumber2)))
print(&#39;{} &lt; {} : {}&#39;.format(userInputNumber1, userInputNumber2, (userInputNumber1 &lt; userInputNumber2)))
print(&#39;{} &lt;= {} : {}&#39;.format(userInputNumber1, userInputNumber2, (userInputNumber1 &lt;= userInputNumber2)))
print(&#39;{} == {} : {}&#39;.format(userInputNumber1, userInputNumber2, (userInputNumber1 == userInputNumber2)))
print(&#39;{} != {} : {}&#39;.format(userInputNumber1, userInputNumber2, (userInputNumber1 != userInputNumber2)))</code></pre>
<hr>
<p>첫번째 숫자 입력 : 2
두번째 숫자 입력 : 15
2 &gt; 15 : False
2 &gt;= 15 : False
2 &lt; 15 : True
2 &lt;= 15 : True
2 == 15 : False
2 != 15 : True</p>
<hr>
<br/>

<p><code>실습_10</code></p>
<pre><code class="language-python">자동차의 전장과 전폭을 입력하면 자동차 기계 세차 가능여부를 출력하는 코드를 작성해 보자.
(최대 전장길이 : 5200mm, 최대 전폭길이 : 1985mm)
maxLength = 5200
maxWidth = 1985

myCarLength = int(input(&#39;전장 길이 입력 : &#39;))
myCarWidth = int(input(&#39;전폭 길이 입력 : &#39;))

print(&#39;전장 가능 여부 : {}&#39;.format(myCarLength &lt;= maxLength))
print(&#39;전폭 가능 여부 : {}&#39;.format(myCarWidth &lt;= maxWidth))</code></pre>
<hr>
<p>전장 길이 입력 : 5201
전폭 길이 입력 : 1985
전장 가능 여부 : False
전폭 가능 여부 : True</p>
<hr>
<br/>

<h4 id="📝-비교-연산자-문자비교">📝 비교 연산자 &lt;문자비교&gt;</h4>
<ul>
<li>문자 비교 : 아스키 코드를 이용한 비교연산
아스키코드는 구글링하여 찾는다.</li>
</ul>
<pre><code class="language-python"># 문자와 아스키 코드 변환
cha1 = &#39;A&#39;    # 65
cha2 = &#39;S&#39;    # 83

print(&#39;\&#39;{}\&#39; &gt; \&#39;{}\&#39; : {}&#39;.format(cha1, cha2, (cha1 &gt; cha2)))
print(&#39;\&#39;{}\&#39; &gt;= \&#39;{}\&#39; : {}&#39;.format(cha1, cha2, (cha1 &gt;= cha2)))
print(&#39;\&#39;{}\&#39; &lt; \&#39;{}\&#39; : {}&#39;.format(cha1, cha2, (cha1 &lt; cha2)))
print(&#39;\&#39;{}\&#39; &lt;= \&#39;{}\&#39; : {}&#39;.format(cha1, cha2, (cha1 &lt;= cha2)))
print(&#39;\&#39;{}\&#39; == \&#39;{}\&#39; : {}&#39;.format(cha1, cha2, (cha1 == cha2)))
print(&#39;\&#39;{}\&#39; != \&#39;{}\&#39; : {}&#39;.format(cha1, cha2, (cha1 != cha2)))</code></pre>
<hr>
<p>&#39;A&#39; &gt; &#39;S&#39; : False
&#39;A&#39; &gt;= &#39;S&#39; : False
&#39;A&#39; &lt; &#39;S&#39; : True
&#39;A&#39; &lt;= &#39;S&#39; : True
&#39;A&#39; == &#39;S&#39; : False
&#39;A&#39; != &#39;S&#39; : True</p>
<hr>
<br/>

<blockquote>
<p><code>ord() 함수 _ 알파벳(문자)을 입력하면 아스키 코드(숫자)로 출력(10진법)</code></p>
</blockquote>
<pre><code class="language-python">print(&#39;\&#39;A\&#39; -&gt; {}&#39;.format(ord(&#39;A&#39;)))
print(&#39;\&#39;S\&#39; -&gt; {}&#39;.format(ord(&#39;S&#39;)))</code></pre>
<p><code>chr() 함수 _ 아스키 코드(숫자)를 입력하면 알파벳(문자)로 출력</code></p>
<pre><code class="language-python">print(&#39;65 -&gt; {}&#39;.format(chr(65)))
print(&#39;83 -&gt; {}&#39;.format(chr(83)))</code></pre>
<br/>

<ul>
<li>문자열 비교 : 문자열 자체를 비교한다. (True / False)
같다/같지않다 두개만 가능하다. (문자열은 크다/작다로 비교 할 수 없다.)
한글자만 틀려도 틀리다.</li>
</ul>
<pre><code class="language-python">str1 = &#39;Hello&#39;
str2 = &#39;hello&#39;

print(&#39;{} == {} : {}&#39;.format(str1, str2, (str1 == str2)))
print(&#39;{} != {} : {}&#39;.format(str1, str2, (str1 != str2)))</code></pre>
<hr>
<p>Hello == hello : False
Hello != hello : True</p>
<hr>
<br/>

<p><code>실습_11</code></p>
<pre><code class="language-python">아이디와 패스워드를 입력한 후 비교결과을 출력하자.
systemID = &#39;administrator@gmail.com&#39;
systemPW = &#39;!@#$%qwertyQWERTY&#39;

userInputID = input(&#39;아이디 입력 : &#39;)
userInputPW = input(&#39;비밀번호 입력 : &#39;)

print(&#39;아이디 비교 결과 : {}&#39;.format(systemID == userInputID))
print(&#39;비밀번호 비교 결과 : {}&#39;.format(systemPW == userInputPW))</code></pre>
<hr>
<p>아이디 입력 : <a href="mailto:administrator@gmail.com">administrator@gmail.com</a>
비밀번호 입력 : 12345qwerQWERTY
아이디 비교 결과 : True
비밀번호 비교 결과 : False</p>
<hr>
<br/>

<h4 id="📝-논리-연산자">📝 논리 연산자</h4>
<ul>
<li><p>피연산자의 논리(True/False)를 이용한 연산
논리 연산자 종류 : and, or, not</p>
</li>
<li><p>and 연산
<code>A and B</code>
A와 B모두 True인 경우만 결과값으로 True이다.</p>
</li>
<li><p>or 연산
<code>A or B</code>
A와 B중 어느하나만 True이면 결과값은 True이다.</p>
</li>
<li><p>not 연산 (부정연산자)
<code>not A</code>
A의 상태를 부정하는 결과를 나타낸다.</p>
<br/>

</li>
</ul>
<p><code>예시</code></p>
<pre><code class="language-python">백신 접종 대상자는 20세 미만 또는 65세이상자에 한합니다.
논리연산자를 이용해서 코딩해보자.

age = int(input(&#39;나이 입력 : &#39;))
vaccine = (age &lt; 20) or (age &gt;= 65)
print(&#39;age: {}, result: {}&#39;.format(age, vaccine))</code></pre>
<hr>
<p>나이 입력 : 38
age: 38, result: False</p>
<p>나이 입력 : 66
age: 66, result: True</p>
<hr>
<br/>

<p><code>실습_12</code></p>
<pre><code class="language-python">국어, 영어, 수학 점수를 입력하고 평균이 10점 이상이면 True를 출력하는 코드를 작성해보자.
(단, 과목별 점수가 최소 60이상인 경우에 True를 출력한다.)

passScore1 = 60
passScore2 = 70

kor = int(input(&#39;국어 점수 입력 : &#39;))
eng = int(input(&#39;영어 점수 입력 : &#39;))
mat = int(input(&#39;수학 점수 입력 : &#39;))

avgScore = (kor + eng + mat) / 3
passScoreResult = avgScore &gt;= passScore2

korResult = kor &gt;= passScore1
engResult = eng &gt;= passScore1
matrResult = mat &gt;= passScore1

subjectResult = korResult and engResult and matrResult

print(&#39;평균 : {}, 결과 : {}&#39;.format(avgScore, passScoreResult))

print(&#39;국어 : {}, 결과 : {}&#39;.format(kor,korResult))
print(&#39;영어 : {}, 결과 : {}&#39;.format(eng,engResult))
print(&#39;수학 : {}, 결과 : {}&#39;.format(mat,matrResult))


print(&#39;과락 결과 : {}&#39;.format(subjectResult))
print(&#39;최종 결과 : {}&#39;.format(avgScore and subjectResult))</code></pre>
<hr>
<p>국어 점수 입력 : 89
영어 점수 입력 : 70
수학 점수 입력 : 60
평균 : 73.0, 결과 : True
국어 : 89, 결과 : True
영어 : 70, 결과 : True
수학 : 60, 결과 : True
과락 결과 : True
최종 결과 : True</p>
<hr>
<br/>

<h4 id="📝-operator모듈">📝 operator모듈</h4>
<blockquote>
<p><code>모듈이란?</code>
누군가 이미 만들어 놓은 훌륭한 기능
<br/></p>
</blockquote>
<ul>
<li>산술연산자 관련 함수<pre><code class="language-python">num1 = 8
num2 = 3
</code></pre>
</li>
</ul>
<p>import operator</p>
<p>print(&#39;{} + {} : {}&#39;.format(num1, num2, operator.add(num1,num2)))
print(&#39;{} - {} : {}&#39;.format(num1, num2, operator.sub(num1,num2)))
print(&#39;{} * {} : {}&#39;.format(num1, num2, operator.mul(num1,num2)))
print(&#39;{} / {} : {}&#39;.format(num1, num2, operator.truediv(num1,num2)))
print(&#39;{} % {} : {}&#39;.format(num1, num2, operator.mod(num1,num2)))
print(&#39;{} // {} : {}&#39;.format(num1, num2, operator.floordiv(num1,num2)))
print(&#39;{} ** {} : {}&#39;.format(num1, num2, operator.pow(num1,num2)))</p>
<pre><code>***
8 + 3 : 11
8 - 3 : 5
8 * 3 : 24
8 / 3 : 2.6666666666666665
8 % 3 : 2
8 // 3 : 2
8 ** 3 : 512
***
&lt;br/&gt;

- 비교 연산자 관련 함수
```python
num1 = 8
num2 = 3

import operator

print(&#39;{} &gt; {} : {}&#39;.format(num1, num2, operator.gt(num1,num2)))
print(&#39;{} &gt;= {} : {}&#39;.format(num1, num2, operator.ge(num1,num2)))
print(&#39;{} &lt; {} : {}&#39;.format(num1, num2, operator.lt(num1,num2)))
print(&#39;{} &lt;= {} : {}&#39;.format(num1, num2, operator.le(num1,num2)))
print(&#39;{} == {} : {}&#39;.format(num1, num2, operator.eq(num1,num2)))
print(&#39;{} != {} : {}&#39;.format(num1, num2, operator.ne(num1,num2)))</code></pre><hr>
<p>8 &gt; 3 : True
8 &gt;= 3 : True
8 &lt; 3 : False
8 &lt;= 3 : False
8 == 3 : False
8 != 3 : True</p>
<hr>
<br/>

<ul>
<li>논리 연산자 관련 함수<pre><code class="language-python">flag1 = True
flag2 = False
</code></pre>
</li>
</ul>
<p>import operator</p>
<p>print(&#39;{} and {} : {}&#39;.format(flag1, flag2, operator.and_(flag1,flag2)))
print(&#39;{} or {} : {}&#39;.format(flag1, flag2, operator.or_(flag1,flag2)))
print(&#39;{} not {} : {}&#39;.format(flag1, flag2, operator.not_(flag1)))</p>
<pre><code>***
True and False : False
True or False : True
True not False : False
***
&lt;br/&gt;

`실습_13`
```python
이전 시간에 실습했던 백신 접종 대상자 출력코드를 operator 모듈을 이용해서 변경해 보자.
[이전 실습]
백신접종 대상자는 20세 미만 또는 65세 이상자에 한합니다.를 논리연산자를 이용해서 코딩해보자.

age = int(input(&#39;나이 입력 : &#39;))

import operator
vaccine =operator.or_(operator.lt(age, 20), operator.ge(age, 65))
print(&#39;age : {}, result : {}&#39;.format(age, vaccine))</code></pre><hr>
<p>나이 입력 : 48
age : 48, result : False
나이 입력 : 7
age : 7, result : True</p>
<hr>
<br/>

<p><code>실습_13</code></p>
<pre><code class="language-python">import operator

import random
rInt = random.randint(10, 100)

num10 = operator.floordiv(rInt, 10)   # 몫
num1 = operator.mod(rInt, 10)       # 나머지

print(&#39;난수 : {}&#39;.format(rInt))
print(&#39;십의 자리 : {}&#39;.format(num10))
print(&#39;일의 자리 : {}&#39;.format(num1))
print(&#39;십의 자리는 3의 배수이다. : {}&#39;.format(operator.mod(num10, 3) == 0))   # 나머지
print(&#39;일의 자리는 3의 배수이다. : {}&#39;.format(operator.mod(num1, 3) == 0))    # 나머지</code></pre>
<hr>
<p>난수 : 23
십의 자리 : 2
일의 자리 : 3
십의 자리는 3의 배수이다. : False
일의 자리는 3의 배수이다. : True</p>
<hr>
<br/>

<h3 id="💡-오늘을-마무리하면서-">💡 오늘을 마무리하면서 ...</h3>
<p>와아.. 진짜 하루 스터디 노트 놓치니까 답이 없네ㅠㅠ
부지런히 해도 힘들구나... 영상강의도 중요한데 매일 하는 스터디 노트도 중요함
안 중요한게 하나도 없는 것 같은데..  점점 많아지는 과제랑 수업을 잘 할수 있을까?
게을러 지면 낙오다. 하루의 귀찮아하면 다음은 없는거야!! ㅠ
힘들다 진짜... 벌서 이렇게 힘들면 안되는데 사람들은 어떻게 공부하고 있을까???
<br/></p>
<h4 id="😃-busy-study-_-새벽반-pm-1000--am-230">😃 Busy Study _ 새벽반 PM 10:00 ~ AM 2:30</h4>
<h4 id="여러분-화이팅-우리-모두-다-잘-될거예요">여러분 화이팅!! 우리 모두 다 잘 될거예요!</h4>
]]></description>
        </item>
        <item>
            <title><![CDATA[오늘의 공부 / 230503]]></title>
            <link>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230503</link>
            <guid>https://velog.io/@h_jein/%EC%98%A4%EB%8A%98%EC%9D%98-%EA%B3%B5%EB%B6%80-230503</guid>
            <pubDate>Wed, 03 May 2023 16:17:37 GMT</pubDate>
            <description><![CDATA[<h3 id="💬-오늘의-공부시간-pm-1000--am-315">💬 오늘의 공부시간 PM 10:00 ~ AM 3:15</h3>
<p>공식적 스터디노트 첫번째
블로그 만들고 OT글 쓰느라 시간을 뺏어 먹었다.
벨로그 쓰는 것도 어려워.. 점점 익숙해지겠지, 휴 =33
이걸 쓰고 있다는게 놀라움 ㅎ_ㅎ
<br/></p>
<h3 id="🔥-1주차-todo-리스트-5357">🔥 1주차 todo 리스트 (5/3~5/7)</h3>
<p> <del>파이썬 기초1</del>
 기본 프로그램에 관한 설명과 실행방법 (01<del>03)
~</del>파이썬 기초2<del>3</del>
 파이참(pycham) 설치
 데이터와 메모리 그리고 데이터 출력
 변수와 자료형, 자료형 변환
 <del>파이썬 기초4</del>
 데이터입력/출력
 format()와 형식문자
 산술연산자(+/-)
 <br/></p>
<p>파이썬 기초5
파이썬 기초6
파이썬 기초7
파이썬 기초8
파이썬 기초9~10
파이썬 기초문풀1
파이썬 기초문풀2
파이썬 기초문풀3</p>
<p><del>📝 weekly 데이터 사이언스 스쿨 퀴즈</del>
<br/></p>
<h3 id="💻-핵심-내용-정리">💻 핵심 내용 정리</h3>
<h4 id="📝-파이썬이란">📝 파이썬이란?</h4>
<ul>
<li>1991년 네덜란드 개발자 귀로 반 로섬이 만듦.</li>
<li>처음 소규모로 프로젝트에 사용하기 위해서 만듦.
이후 주변 사람들로부터 인기를 얻어 완성도가 높은 파이썬이 탄생함.</li>
<li>구글은 자바와 함께 파이썬을 메인 언어로 사용하고 있음.</li>
<li>&#39;python&#39; 이라는 이름은 귀로 반 로섬이 좋아하는 프로그램에서 유래됨.<br/>

</li>
</ul>
<h4 id="📝-파이썬의-특징">📝 파이썬의 특징</h4>
<ul>
<li>무한 정수를 처리할 수 있다. (다른 언어는 불가능 파이썬만 가능)</li>
<li>문법 구조가 쉽다</li>
<li>다양하고 뛰어난 모듈이 많다.
(모듈이란 이미 다른 사람들이 만들어놓은 코딩, 우리가 가져다 써서 코딩을 좀 더 쉽게 할수있음 )<br/>

</li>
</ul>
<h4 id="📝-변수란">📝 변수란?</h4>
<ul>
<li>데이터가 저장되어 있는 메모리 공간.</li>
<li>수학에서는 &#39;=&#39;는 같다는 의미지만, 파이썬에서는 할당한다고 한다.</li>
<li>파이썬에서 &#39;==&#39;는 같다라는 의미로 쓰인다.
예) ● = ♥ 오른쪽에 있는 하트를 원에 할당한다.(대입한다)
  ● == ♥ 원과 하트는 같다.</li>
<li>변수를 정의할 때 반듯이 &#39;초기화&#39; 하도록 한다.    <br/>

</li>
</ul>
<h4 id="📝-변수를-사용하는-이유">📝 변수를 사용하는 이유</h4>
<ul>
<li>주로 데이타를 재사룔 하기 위한 목적으로 사용한다.</li>
<li>프로그램을 보다 효율적으로 관리할 수 있다.</li>
</ul>
<p><code>실습_01</code></p>
<pre><code class="language-python">변수사용
숫자2개를 변수에 저장하고 이를 이룔해서 덧셈, 뺄셈, 곱셈, 나눗셈을 화면에 출력해보자.

a = 3
b = 12

# 덧셈
print(a + b)

# 뺄셈
print(a - b)

# 곱셈
print(a * b)

# 나눗셈
print(a / b)</code></pre>
<p><code>실습_02</code></p>
<pre><code class="language-python">다음의 문구를 출력한다고 할 때 반복회는 데이터를 변수로 정의 해보자.

name = &#39;박찬호&#39;

print(name, &#39;고객님께&#39;)
print(name, &#39;고객님 안녕하세요.&#39;)
print(&#39;고객님께서 접수하신 A/S건에 대해서 연락을 드렸으나 연락이 어려워 메일 드립니다.&#39;)
print(&#39;--- 중략 ---&#39;)
print(&#39;A/S 접수 내용&#39;)
print(&#39;성함 :&#39;, name)
print(&#39;내용 : 에어컨고장&#39;)</code></pre>
<h4 id="📝-변수-작명법">📝 변수 작명법</h4>
<ul>
<li>영문을 사용</li>
<li>첫 번째는 소문자로</li>
<li>가급적 데이터의 의미를 파악할 수 있는 명사 사용</li>
<li>카멜표기법(customerBankAccount)또는 스네이크표기법(customer_bank_account) 사용</li>
<li>예약어(파이썬에서 이미 예약된 단어) 사용금지 → 내장함수</li>
</ul>
<p><code>&lt; 파이썬에서 사용하고 있는 예약어 불러오기 명령어 &gt;</code></p>
<pre><code class="language-python">import keyword
print(keyword.kwlist)</code></pre>
<p>[&#39;False&#39;, &#39;None&#39;, &#39;True&#39;, &#39;and&#39;, &#39;as&#39;, &#39;assert&#39;, &#39;async&#39;, &#39;await&#39;, &#39;break&#39;, &#39;class&#39;, &#39;continue&#39;, &#39;def&#39;, &#39;del&#39;, &#39;elif&#39;, &#39;else&#39;, &#39;except&#39;, &#39;finally&#39;, &#39;for&#39;, &#39;from&#39;, &#39;global&#39;, &#39;if&#39;, &#39;import&#39;, &#39;in&#39;, &#39;is&#39;, &#39;lambda&#39;, &#39;nonlocal&#39;, &#39;not&#39;, &#39;or&#39;, &#39;pass&#39;, &#39;raise&#39;, &#39;return&#39;, &#39;try&#39;, &#39;while&#39;, &#39;with&#39;, &#39;yield&#39;]</p>
<ul>
<li>특수문자 사용금지(단, 언더바(_)는 사용가능</li>
<li>공백문자 사용금지</li>
<li>숫자는 사용해도 되지만 첫 번째 사용 금지</li>
</ul>
<p><code>실습_03</code></p>
<pre><code class="language-python">변수 정의 (선언 및 초기화)와 사용
삼각형의 넓이를 계산하기 위한 가로, 세로의 (20cm,15cm) 변수를 정의 하고 계산 결과를 출력해 보자.
width = 20
height = 15

print(width * height / 2)
print(width * height)
</code></pre>
<h4 id="📝-자료형data-type이란">📝 자료형(data type)이란?</h4>
<ul>
<li><p>효율적인 메모리 사용을 위해서 데이터를 정수현, 실수형, 문자(열)형, 논리형으로 구분한것.
정수 = int
실수 = float
문자(열) = str
논리형 = bool
문자(열)형은 작음따옴표 또는 큰따옴표를 사용할 수 있으나, 혼용해서 사용할 수는 없다.</p>
</li>
<li><p>정수는 메모리가 허용되는 한 무한 사용가능.</p>
</li>
<li><p>실수 는 대략 소수점 이하 17~18번째에서 데이터 손실이 일어남.</p>
</li>
<li><p>숫자(정수, 실수)도 따옴표로 묶으면 문자(열)로 인식함.</p>
</li>
<li><p>논리형인 True(참), False(거짓)을 구분하기 위한 자료형</p>
<br/>

</li>
</ul>
<h4 id="📝-자료형-변환type-casting이란">📝 자료형 변환(type casting)이란?</h4>
<ul>
<li>데이터 타입을 변환하는 것으로 파이썬에서 제공하는 함수를 이용한다.</li>
</ul>
<p><code>실습_04</code></p>
<pre><code class="language-python"># 소수에서 정수로
print(int(3.8))

# 정수에서 소수로
print(float(3))

# 문자열을 숫자로 변환
print(int(&quot;2&quot;) + int(&quot;5&quot;))
print(float(1.1) + float(5.2))

# 숫자를 문자열로 변환
print(str(2) + str(5))

age = 7
print(&quot;제 나이는 &quot; + str(age) + &quot;살 입니다.&quot;)</code></pre>
<p>3
3.0
7
6.300000000000001
25
제 나이는 7살 입니다.</p>
<ul>
<li>논리형 변환할때에 정수는 True=1, 실수는 False=0 를 의미한다.</li>
<li>문자(열) 변환할때에 빈문자는 &#39;&#39;=데이터없음(False), 공백문자는 &#39; &#39;=데이터있음(True)
공백도 엄연한 문자로 취급한다. → 빈문자 논리형</li>
</ul>
<p><code>실습_05</code></p>
<pre><code class="language-python">var1 = &#39;True&#39;
var2 = &#39;False&#39;
print(type(var1))   # str
print(type(var2))   # str

var1 = bool(var1)
var2 = bool(var2)
print(type(var1))   # bool
print(type(var2))   # bool

print(var1 + var2)        # 2
print(type(var1 + var2))  # int</code></pre>
<p>&lt;class &#39;str&#39;&gt;
&lt;class &#39;str&#39;&gt;
&lt;class &#39;bool&#39;&gt;
&lt;class &#39;bool&#39;&gt;
2
&lt;class &#39;int&#39;&gt;
<br/></p>
<h4 id="📝-데이터입력">📝 데이터입력</h4>
<ul>
<li>input()함수를 이용한 데이터 입력</li>
</ul>
<p><code>실습_06</code></p>
<pre><code class="language-python">print(&#39;키보드를 통해서 데이터를 입력하세요.&#39;)

usrInputData = input()
print(usrInputData)</code></pre>
<ul>
<li>입력가이드 문구 사용하기
input()함수에 입력가이드 문구 명시. (문자열을 입력 받는 함수)</li>
</ul>
<p><code>실습_07</code></p>
<pre><code class="language-python">usrInputData = input(&#39;키보드를 통해서 데이터를 입력하세요.&#39;)
print(usrInputData)</code></pre>
<ul>
<li>input()함수를 이용해서 입력한 데이터는 항상 문자(열) 자료형</li>
<li>형 변환 함수를 이용한 형 변환
= input(&#39;문자형을 입력하세요.&#39;)
= int(input(&#39;문자형을 입력하세요.&#39;))
= float(input(&#39;문자형을 입력하세요.&#39;))
= bool(input(&#39;문자형을 입력하세요.&#39;))<br/>

</li>
</ul>
<h4 id="📝-데이터출력">📝 데이터출력</h4>
<ul>
<li>print()함수를 이용한 기본적인 데이터 출력</li>
<li>콤마(,)를 이용한 데이터 연속출력(2개 이상)</li>
<li>.format() 문자열을 이용한 데이터 출력</li>
</ul>
<p><code>실습_08</code></p>
<pre><code class="language-python">오늘은 2019년 10월 29일 입니다.
year = 2019
month = 10
day = 29
print(&quot;오늘은 &quot; + str(year) + &quot;년 &quot; + str(month) + &quot;월 &quot; + str(day) + &quot;일 입니다.&quot;)
print(&quot;오늘은 {}년 {}월 {}일 입니다.&quot;.format(year, month,day))

date_string = &quot;오늘은 {}년 {}월 {}일 입니다.&quot;
print(date_string.format(year, month, day + 1))

#format 다루기 : 인덱스를 이용한 출력
print(&quot;저는 {1}, {0}, {2}를 좋아합니다!&quot;.format(&quot;박지성&quot;, &quot;유재석&quot;, &quot;빌 게이츠&quot;))

# 문자열은 따옴표 안에 작성, 중괄호 안에 변수명 넣기, 뒤에 .format()괄호 안헤 중괄호 안에 들어갈 변수 작성
num_1 = 1
num_2 = 3
print(&quot;{0} 나누기 {1}은 {2:.2f}입니다.&quot;.format(num_1, num_2, num_1 / num_2))</code></pre>
<p>오늘은 2019년 10월 29일 입니다.
오늘은 2019년 10월 29일 입니다.
오늘은 2019년 10월 30일 입니다.
저는 유재석, 박지성, 빌 게이츠를 좋아합니다!
1 나누기 3은 0.33입니다.</p>
<p><code>실습_09</code></p>
<pre><code class="language-python">새로운 방식 (f-string)
포맷의 약자인 f를 앞에 사용후 문자열은 따옴표 안에 작성, 변수는 중괄호에 넣어쓰기
name = &quot;최지웅&quot;
age = 32
print(f&quot;제 이름은 {name}이고 {age}살 입니다.&quot;)</code></pre>
<p>제 이름은 최지웅이고 32살 입니다.
<br/></p>
<h4 id="📝-특수문자를-이용한-데이터-출력">📝 특수문자를 이용한 데이터 출력</h4>
<ul>
<li>\t 들여쓰기(tab)</li>
<li>\n 한줄 띄어쓰기(계행)</li>
<li>,end = &#39;&#39; 자동 계행 막기<br/>

</li>
</ul>
<h4 id="📝-형식문자를-이용한-데이터-출력">📝 형식문자를 이용한 데이터 출력</h4>
<ul>
<li>%s 문자열</li>
<li>%d 정수</li>
<li>%f 실수<br/>

</li>
</ul>
<h4 id="📝-소수점-자릿수-정하기">📝 소수점 자릿수 정하기</h4>
<ul>
<li>%.nf : 소수점 n자리 표현
실수라 실수로 받아야한다. (아닐 시 에러 발생)<br/>

</li>
</ul>
<h3 id="💡-오늘을-마무리하면서-">💡 오늘을 마무리하면서 ...</h3>
<p>진짜 스트레스 받는데.. 
스터디 노트를 적으면서 하는건 좋은데 생각보다 시간을 엄청 잡아 먹는다.
오늘 사실 이것 저것 하느라 시간이 뺏겼는데, 진짜 이러다가는 가랑이 찢어지겠다.
4시간 30분도 택도 없어... 😵
2시 30분까지 공부 하자는 목표는 지켰는데, 오늘 처럼 오바됬을 땐 낼 어쩔티비 ..
스터디 노트 쓰는 게 일이 될 줄이야.
이렇게 디지털로 하는 수업이 진짜 적응이 어렵다는 것을 다시 한번 느낀다.
졸려서 오타가 있더래도 양해를 부탁드리며, 내일은 포항을 가야하는데 스터디 노트는 무리겠지??
공부는 목표할당량 열심히 채우는 걸로...
<br/></p>
<h4 id="😃-busy-study-_-새벽반-pm-1000--am-230">😃 Busy Study _ 새벽반 PM 10:00 ~ AM 2:30</h4>
<h4 id="여러분-화이팅-우리-모두-다-잘-될거예요">여러분 화이팅!! 우리 모두 다 잘 될거예요!</h4>
]]></description>
        </item>
        <item>
            <title><![CDATA[데이터 취업스쿨 15기 개강 및 OT후기]]></title>
            <link>https://velog.io/@h_jein/01</link>
            <guid>https://velog.io/@h_jein/01</guid>
            <pubDate>Wed, 03 May 2023 13:57:02 GMT</pubDate>
            <description><![CDATA[<p>23년 5월1일 드디어 개강! 이예요~</p>
<p>5월 2일 어제 OT가 있었습니다.</p>
<h3 id="🤗반가워요">🤗반가워요!</h3>
<p>늦깎이 DA/DS 취준생, 제로베이스 데이터 취업스쿨 15기 허제인입니다. (쪼매 쑥쓰럽네요 ㅎㅎㅎ)
저는 현재 직장인이고, 전공 조차 회계전공으로 컴퓨터에 대해선 잘 모르는 데
&quot;잘 할 수 있을까? 내가 정말 배울수 있을까?&quot; 라는 걱정이 컷는데, 옆에서 응원해주는 남편이 있어서 마음을 다시 다 잡은 것 같아요. 
기초를 탄탄히 해야한다고 해서 눈물 콧물 쏟을 각오를 하고 공부 시작했습니다.
저는 끝까지 공부해서 졸업하는 게 목표예요!! 취업은 ... 😭
같이 공부할 친구 있으면 좋겠는데, 모르는 거 있을때 함께 얘기나눌 분이 있으시다면 언제든지 댓글이나 슬랙으로 챗주세요.</p>
<blockquote>
<p>OT후기
새로운 분야 사람들과 만나 무언가를 한다는것 자체가 설레였는데, 뭔가 해야할 것이 많아서 우왕좌왕 ㅠㅠ (절대 무너지지 않을꺼야!!!)
한달을 1년 처럼~ (ㄹㅇ명언!!) 다시 되새김질 하며 다시 마음을 붙잡아 공부 해야겠어요.</p>
</blockquote>
<blockquote>
<p>앞으로의 다짐
지금의 간절함을 잊지말고 다시는 못올 기회를 가진 것에 항상 감사하며,
나 스스로에게 실망하지 않도록 할 수 있는 최선을 다해 끝까지 공부 해 볼 것.
결과는 어찌되든 후회하지 않게 끝까지 부딧혀 볼 것.</p>
</blockquote>
<h4 id="😃-busy-study-_-새벽반-pm-1000--am-230">😃 Busy Study _ 새벽반 PM 10:00 ~ AM 2:30</h4>
<h4 id="여러분-화이팅-우리-모두-다-잘-될거예요">여러분 화이팅!! 우리 모두 다 잘 될거예요!</h4>
]]></description>
        </item>
    </channel>
</rss>