class
Class
์ถ์ํ
students = [ { "name": "์ค์ธ์ฑ", "korean": 87, "math": 98, "english": 88, "science": 95 }, { "name": "์ฐํ์ง", "korean": 92, "math": 98, "english": 96, "science": 98 }, { "name": "๊ตฌ์ง์ฐ", "korean": 76, "math": 96, "english": 94, "science": 90 }, { "name": "๋์ ์ฃผ", "korean": 98, "math": 92, "english": 96, "science": 92 }, { "name": "์ค์๋ฆฐ", "korean": 95, "math": 98, "english": 98, "science": 98 }, { "name": "์ค๋ช ์", "korean": 64, "math": 88, "english": 92, "science": 92 } ] print("์ด๋ฆ", "์ด์ ", "ํ๊ท ", sep="\t") for student in students: score_sum = student["korean"] + student["math"] +\ student["english"] + student["science"] score_average = score_sum / 4 print(student["name"], score_sum, score_average, sep="\t")
๊ฐ์ฒด๋ฅผ ๋ง๋๋ ํจ์ (1)
๊ฐ์ฒด๋ฅผ ์ฒ๋ฆฌํ๋ ํจ์ (2)
ํด๋์ค
์ธ์คํด์ค
์์ฑ์
์๋ฉธ์
๋ฉ์๋
์ด๋ค ํด๋์ค์ ์ธ์คํด์ค์ธ์ง ํ์ธํ๊ธฐ : isinstance
ํน์ํ ์ด๋ฆ์ ๋ฉ์๋ : str() ํจ์
ํน์ํ ์ด๋ฆ์ ๋ฉ์๋ : ๋น๊ตํจ์
ํด๋์ค ๋ณ์์ ๋ฉ์๋
Last updated