# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="eESmpDgcK8t5" outputId="954d3edb-ab64-4798-ef98-01d34d758435"
# 1번 문제
print("hellow world")

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="H0PolfpELOav" outputId="a2359715-d299-44ca-bb2d-f0af8396b3f1"
#2번 문제
print("Mary's cosmetics")

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="0xu2PbGKLnR1" outputId="68954fd9-d4a8-4d01-979e-7264dd8407d9"
#3번 문제
print('신씨가 소리질렀다. "도둑이야"')

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="pObIc4yNL_bf" outputId="7dd5a1b1-9047-4e67-929c-9a0cb258de05"
#4번 문제
print("C:\windows")

# + colab={"base_uri": "https://localhost:8080/", "height": 52} colab_type="code" id="JFgqVqb7MY2d" outputId="c9eb96c3-c299-4732-8b09-3ecaad24d15e"
#5번 문제
print("안녕하세요. \n만나서\t\t반갑습니다.")

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="cbqQMb_7MySh" outputId="284667c0-293e-4e5d-ffa8-2d34307a73a6"
#6번 문제
print("오늘은", "일요일")

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="g1S40co6NOHF" outputId="f81bb307-24b3-41af-d4e5-d668be370255"
#7번 문제
print("naver", "kakao", "samsung", sep=";")

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="LnXASM_PNoNz" outputId="5a8d25b2-4673-4a5f-9e7f-4f29c7626e61"
#8번 문제
print("naver", "kakao", "samsung", sep="/")

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="TuuqfyjCOU1j" outputId="2c095217-8367-497d-9b55-d9607c1b0ca3"
#9 문제
print("first", end=""); print("second")

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="kKq3fnDAOy0z" outputId="2478a42a-0b41-49f5-8261-b00b1381887d"
#10번 문제
print(5/3)

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="TVigsPcOPIO8" outputId="9013a643-2f59-4ada-f089-d5f61d63a3e7"
#11번 문제
samsung = 60000
sum = samsung * 10
print(sum)

# + colab={"base_uri": "https://localhost:8080/", "height": 70} colab_type="code" id="Zstsx5jmPx5k" outputId="2690b4ad-2589-4116-98f5-fff963cde134"
#12번 문제
Sum = 298000000000000
Now = 50000
PER = 15.79
print(Sum, type(Sum))
print(Now, type(Now))
print(PER, type(PER))

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="k5YIn-CHQSMk" outputId="ebc1a190-694e-454b-94e3-d592f5526f1c"
#13번 문제
s = "hello"
t = "python"
print(s+"!", t)


# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="NFEhh7LjRTfR" outputId="4582b2b5-2a3f-4dc3-a9a9-806fdc917f9d"
#14번 문제
print(2 + 2 * 3)

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="vURdVOZpRvY_" outputId="81e4eb0c-8f82-44c3-eca8-14f120a183f6"
#15번 문제
a = "132"
print(type(a))

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="ddwsOZ1ZSLTF" outputId="58dfde00-7dfa-4380-cf18-9ec67a735a46"
#16번 문제
num_str = "720"
num_int = int(num_str)
print(num_int, type(num_int))

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="aPTXAnbdSzIz" outputId="b0cd95f1-b99f-45ed-efa3-3fd46a48de2b"
#17번 문제
num = 100
result = str(num)
print(result, type(result))

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="iUCyTmEjUDkU" outputId="472527cb-2ef5-460a-f2a0-51195b85ecb4"
#18번 문제
data = "15.79"
data = float(data)
print(data, type(data))

# + colab={"base_uri": "https://localhost:8080/", "height": 70} colab_type="code" id="zdmNPvwrUgHW" outputId="486a66b6-3a91-4c5e-9ed7-894bbbf37348"
#19번 문제
year = "2020"
print(int(year)-3)  # 2017
print(int(year)-2)  # 2018
print(int(year)-1)  # 2019

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="EypuooGUU3-4" outputId="eb9a5f13-1cf8-4c60-f5a1-f4adb01014d3"
#20번 문제
month_price = 48584
m = 36
totol_price = month_price
print(totol_price * m)

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="IfFHxvDZU5XC" outputId="a736d9fb-3de1-4a71-8fb7-aff764e2e30f"
#21번 문제
letters = 'python'
print(letters[0], letters[2])

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="fTcSd6YTU6iV" outputId="14245a8e-d4eb-4164-f70d-40e87dcbb7f5"
#22번 문제
license_plate = "24가 2211"
print(license_plate[-4:])

# + colab={"base_uri": "https://localhost:8080/", "height": 52} colab_type="code" id="di1EvSbRU7nF" outputId="e02cff20-d9d5-4113-e2c0-3c8c75a5613c"
#23번 문제
string = "홀짝홀짝홀짝"
print(string[::2])
print(string[0],string[2],string[4],sep="")


# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="o-1T13zZdObY" outputId="a3a47815-66a4-427c-cf6d-dceddd84a4a5"
#24번 문제
string = "PYTHON"
print(string[::-1])

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="ADul_dmkdQC-" outputId="0080f3ab-2904-47e2-d20e-136401d65570"
#25번 문제
phone_number = "010-1111-2222"
phone_numberN = phone_number.replace("-", " ")
print(phone_numberN)

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="bhgk7mO-dRcA" outputId="9183ff76-6645-4fb8-83b5-78c072a3ed84"
#26번 문제
phone_number = "010-1111-2222"
phone_number1 = phone_number.replace('-', '')
print(phone_number1)

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="1mRlxbAwdSdS" outputId="c5a3deac-0ae6-4768-d822-6394afc625c7"
#27번 문제
url = "http://sharebook.kr"
url_split = url.split('.')
print(url_split[-1])

# + colab={"base_uri": "https://localhost:8080/", "height": 241} colab_type="code" id="oNuOgvUZfknS" outputId="90e4efa6-5bfb-4414-d248-d68eee4f4974"
#28번 문제

lang = 'python'
lang[0] = 'p'
print(lang)
"""
문자열은 수정할 수 없습니다.
"""

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="8Yi-craEfl0j" outputId="87438172-9ca4-4d95-d1b1-7786069a1b93"
#29번 문제
string = 'abcdfe2a354a32a'
string = string.replace('a', 'A')
print(string)

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="3zDQ75OXfm6E" outputId="a31c8c4f-cc9e-44c7-f2c4-675a5fea2b17"
#30번 문제
string = 'abcd'
string.replace('b', 'B')
print(string)
# abcd가 그대로 출력되는 이유는!
# 문자열은 변경할 수 없는 자료형이기 때문입니다.
# replace 메서드를 사용하면 원본은 그대로 둔채로 변경된 새로운 문자열 객체를 리턴해줍니다.


# + colab={"base_uri": "https://localhost:8080/", "height": 70} colab_type="code" id="87V6ZTydfqF8" outputId="1ac1326f-cbeb-4cd6-9ab3-77c7e77f5627"
# 조건문 실습 셀 입니다.
money =True
if money:
  print("택시를")
  print("타고") # 들여쓰기가 틀리면 에러가 발생합니다.
  print("가라")

# + colab={"base_uri": "https://localhost:8080/", "height": 52} colab_type="code" id="INqRtplen3jE" outputId="4528b05b-4d66-4cfd-d425-f2a4817df01b"
people = 3
apple = 20
if people < apple /5:
  print("신나는 사과 파티! 배터지게 먹자!")
if apple % people > 0:
  print("사과 수가 맞지 않아! 몇 개는 쪼개 먹자!")
if people > apple:
  print("사람이 너무 많아! 몇 명은 못먹겠네...")

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="p0_0ofHhodwk" outputId="9ad6d7b6-44f7-40a5-ac51-66b94b402f39"
money = 2000
if money >= 3000:
  print("택시를 타고 가라")
else:
  print("걸어가라")

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="kIzmgkeKpYqF" outputId="2cfdf493-e1bc-4107-e827-d2ebb1f93488"
money = 2000
card = True
if money >= 3000 or card:
  print("택시를 타고 가라")
else:
  print("걸어가라")

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="ww8p_Gjsp4-h" outputId="bf81f62e-615f-4ae6-ed10-39ff04906106"
pocket = ['paper', 'cellphone', 'money']
if 'money' in pocket:
  print("택시를 타고 가라")
else:
  print("걸어가라")

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="VgUv3CVJquCM" outputId="199075a1-7459-47b3-8a21-594e03658319"
from datetime import datetime
hour = datetime.now().hour
if hour < 12:
  print("오전입니다.")
else:
  print("오후입니다.")

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="i9ZhkSa2r0V9" outputId="0ad7c25c-d5d8-4e80-c6b7-0e5598080f0f"
number = 15
if number % 3 == 0:
  print("{}는 3의 배수입니다.".format(number))

# + colab={} colab_type="code" id="YuwecOnusuWA"
number = 16
if number % 3 == 0:
  print("{}는 3의 배수입니다.".format(number))

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="9bSVl30EtF09" outputId="870e211f-f242-4505-d2d6-2634f9d5e621"
from datetime import datetime
hour = datetime.now().hour

if hour % 6 == 0:
  print('종이 울립니다.')


# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="EQgsOYnqtjDm" outputId="260ce760-4784-4824-a655-6ddf289cb2b3"
s = '가위'
r = '바위'
p = '보'

w = '이겼다'
d = '비겼다.'
l = '졌다'

m = '기위'
y = '바위'

if m == y:
  r = d
else:
  r = '이기거나 지거나'
print(r)

# + colab={"base_uri": "https://localhost:8080/", "height": 70} colab_type="code" id="rBVf1rtP0Mqo" outputId="517ca943-3e60-4d8b-e2f2-c1d6989ae922"
a = [(1,2), (3,4), (5,6)]
for (first, last) in a:
  print(first + last)

# + colab={"base_uri": "https://localhost:8080/", "height": 105} colab_type="code" id="suSdvwVlzmuD" outputId="583474b7-41f7-4327-f954-744a7fa3b1ff"
marks = [90, 25, 67, 45, 80]
number = 0
for mark in marks:
  number = number + 1
  if mark >= 60:
    print("%d번 학생은 합격입니다." % number)
  else:
    print("%d번 학생은 불합격입니다." % number)

# + colab={"base_uri": "https://localhost:8080/", "height": 70} colab_type="code" id="lTSs2peI1Zbe" outputId="6ec94719-cd5c-4a0e-c3d9-07142d918e20"
marks = [90, 25, 67, 45, 80]
number = 0
for mark in marks:
  number = number + 1
  if mark < 60:
    continue
  print("%d번 학생은 합격입니다." % number)
  

# + colab={"base_uri": "https://localhost:8080/", "height": 158} colab_type="code" id="_qcSQXPN2shS" outputId="03aa3e71-53a0-461a-d96d-5285b0742fc3"
for i in range(2,10):
  for j in range(1,10):
    print(i*j, end=" ")
  print('')



# + colab={"base_uri": "https://localhost:8080/", "height": 54} colab_type="code" id="2VPEJn9H1-p-" outputId="bc0114a0-db47-4710-e46c-7fb53564f57b"
result = [x*y for x in range(2,10)
              for y in range(1,10)]
print(result)

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="3q6O_cR56ALj" outputId="2f6ad7c5-86eb-47c8-ad85-b5f951516b8d"
result = 0
i = 1
while i <= 1000:
    if i % 3 == 0: # 3으로 나누어 떨어지는 수는 3의 배수
        result += i
    i += 1

print(result) 

# + colab={"base_uri": "https://localhost:8080/", "height": 105} colab_type="code" id="K9kpxVEX64WC" outputId="f88329d4-ac93-4339-d5f9-37598343741a"
i = 0
while True:
    i += 1 # while문 수행 시 1씩 증가
    if i > 5: break     # i 값이 5이상이면 while문을 벗어난다.
    print ('*' * i)     # i 값 개수만큼 *를 출력한다.

# + colab={"base_uri": "https://localhost:8080/", "height": 372} colab_type="code" id="rDcdWlwt73ml" outputId="e40baf7e-13ca-4743-d9a9-f9bc8da0f210"
for i in range(1, 21):
  print(i)

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="KdLtIudj8m0z" outputId="f7a1f781-ff58-4dd1-c6f2-ab5bb286709b"
A = [70, 60, 55, 75, 95, 90, 80, 80, 85, 100]
total = 0

for score in A:
    total += score   # A학급의 점수를 모두 더한다.

average = total / len(A) # 평균을 구하기 위해 총 점수를 총 학생수로 나눈다.
print(average) # 평균 79.0이 출력된다.

# + colab={"base_uri": "https://localhost:8080/", "height": 34} colab_type="code" id="M96TjgUE811J" outputId="f62bb493-ed59-4531-8b88-fef0181fb220"
numbers = [1, 2, 3, 4, 5]
result = [n*2 for n in numbers if n%2==1]
print(result)


# + colab={} colab_type="code" id="yNYqiXLH9vfA"


StarcoderdataJupyterScriptsDedupFiltered