Skip to content

Instantly share code, notes, and snippets.

@oiojin831
Last active August 4, 2021 00:27
Show Gist options
  • Save oiojin831/4805552e12ba012b5c89418d16dfec48 to your computer and use it in GitHub Desktop.
Save oiojin831/4805552e12ba012b5c89418d16dfec48 to your computer and use it in GitHub Desktop.
def add(a,b):
return a + b
def 안녕(name):
return f"안녕 {name}"
def total(nums):
sum = 0
for x in nums:
sum = sum + x
return sum
def info_with_index(list):
idx = 0
for x in list:
print(f"{idx}: {x['title']}은/는 {x['year']}년에 개봉했습니다")
idx = idx + 1
numbers = [1,3,5,7,9]
numbers2 = [1,10,100]
movies = [
{"title": "hulk", "year": 2012},
{"title": "avengers", "year": 2010},
{"title": "ironman", "year": 2022}
]
print(add(1,2))
print(add(3,4))
print(안녕("응진"))
print(안녕("영희"))
print(안녕("철수"))
print('1부터 5까지의 합은:', total([1,2,3,4,5]))
print('1,3,5,7,9를 다 더한값은', total(numbers))
print(total(numbers2))
print(total([1,2,3,4,5]))
info_with_index(movies)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment