Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jennyonjourney/cca4f7fbda9465c55de879e040299ec5 to your computer and use it in GitHub Desktop.
Save jennyonjourney/cca4f7fbda9465c55de879e040299ec5 to your computer and use it in GitHub Desktop.
Python - function practice
rate = (0.5, 0.3, 0.2) #국어 수학 영어 점수의 반영율
def studcal(st):
jum = 0
for i in range(len(rate)):
jum+=st[i+1]*rate[i]
print(jum)
st1 = ['김고은', 77,88,91]
st2 = ['이효은', 81,92,100]
st3 = ['박장환', 91,76,82]
studcal(st1)
print(st1)
print('------------------------------')
rate = (0.5, 0.3, 0.2) #국어 수학 영어 점수의 반영율
def studcal(st):
jum = 0
for i in range(len(rate)):
jum+=st[i+1]*rate[i]
st.append(jum)
st1 = ['김고은', 77,88,91]
st2 = ['이효은', 81,92,100]
st3 = ['박장환', 91,76,82]
studcal(st2)
print(st2)
print('------------------------------')
studs = (['김고은', 77,88,91],
['이효은', 81, 92, 100],
['박장환', 91, 76, 82])
for ss in studs:
studcal(ss)
print(ss)
print('----------수우미양가------------')
rate = (0.5, 0.3, 0.2) #국어 수학 영어 점수의 반영율
def studcal(st):
jum = 0
for i in range(len(rate)):
jum+=st[i+1]*rate[i]
st.append(jum)
def gradecal(st):
print(int(st[-1]/10))
st.append('가가가가가가양미우수수'[int(st[-1]/10)])
studs = (['김고은', 77,88,91],
['이효은', 91, 92, 90],
['박장환', 71, 76, 72])
for ss in studs:
studcal(ss)
gradecal(ss)
print(ss)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment