scores = [85, 70, 99]
subject_scores = ["±¹¾î",85,"¼öÇÐ",70,"¿µ¾î",99]
print(scores)
print(subject_scores)
subject_scores_dic = {"±¹¾î":85,"¼öÇÐ":70,"¿µ¾î":99}
print(subject_scores_dic["±¹¾î"])
subject_scores_dic["±¹¾î"] = 66
print(subject_scores_dic)
print(subject_scores_dic.keys())
print(subject_scores_dic.values())
print(subject_scores_dic.items())
for item in subject_scores_dic.items() :
print(item)
for subject, score in subject_scores_dic.items() :
print(subject,"°ú¸ñÀÇ Á¡¼ö´Â",score,"ÀÔ´Ï´Ù.")
sum = 0
for subject, score in subject_scores_dic.items() :
sum += score
average = sum / len(subject_scores_dic.items())
print("3°ú¸ñÀÇ ÇÕÀº",sum,"ÀÌ°í Æò±ÕÀº",average,"ÀÔ´Ï´Ù.")
print(subject_scores_dic)
subject_scores_dic["°úÇÐ"]=88
print(subject_scores_dic)
print("Á¤·Ä ÈÄ:",sorted(subject_scores_dic))
print(sorted(subject_scores_dic.items(),key=lambda x:x[0]))
print(sorted(subject_scores_dic.items(),key=lambda x:x[1]))
print(subject_scores_dic.get("°úÇÐ"))
print(subject_scores_dic.items())
print(subject_scores_dic.pop("°úÇÐ"))
print(subject_scores_dic.items())
f = open("first_making_file.txt","w")
f.write("³»°¡ pythonÀ¸·Î ¸¸µç ù¹ø° ÆÄÀÏÀÔ´Ï´Ù.")
f.close()
f = open("first_making_file.txt","r")
s = f.read()
f.close()
print("ÆÄÀϳ»¿ë:",s)