1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # # µû¶óÇÏ¸ç ¹è¿ì´Â ÆÄÀ̽ã°ú µ¥ÀÌÅÍ°úÇÐ(»ý´ÉÃâÆÇ»ç 2020) # LAB 7-2 ¸®½ºÆ®¿¡ µµ½ÃÀÇ Àα¸¸¦ ÀúÀåÇغ¸ÀÚ, 177ÂÊ # # Àα¸ Åë°è(´ÜÀ§: õ¸í) Seoul = 9765 Busan = 3441 Incheon = 2954 city_pop = [ Seoul, Busan, Incheon ] # º¯¼öµé·Î ¸®½ºÆ® »ý¼º print(city_pop) # ¸®½ºÆ® µ¥ÀÌÅ͸¦ Ãâ·Â Daejeon = 1531 city_pop.append(Daejeon) max_pop = 0 min_pop = 1000000 pop_sum = 0 n = 0 for pop in city_pop: # ¼øȯ¹®À» µ¹¸é¼ ÃÖ´ñ°ª, ÃÖ¼Ú°ªÀ» ±¸ÇÑ´Ù if pop > max_pop : max_pop = pop if pop < min_pop : min_pop = pop pop_sum += pop n += 1 print('ÃÖ´ë Àα¸:', max_pop) print('ÃÖ¼Ò Àα¸:', min_pop) print('Æò±Õ Àα¸:', pop_sum / n) | cs |