1 2 3 4 5 6 7 8 9 10 11 | # # µû¶óÇÏ¸ç ¹è¿ì´Â ÆÄÀ̽ã°ú µ¥ÀÌÅÍ°úÇÐ(»ý´ÉÃâÆÇ»ç 2020) # 6.6 ÇÔ¼ö¿¡ ¿©·¯ °³ÀÇ °ªÀ» ³Ñ°ÜÁÖ´Â °í±Þ ±â´É, 151ÂÊ # def get_sum(start, end): # start, end¸¦ ¸Å°³º¯¼ö·ÎÇÏ¿© ÀÎÀÚ¸¦ ¹Þ´Â´Ù s = 0 for i in range(start, end + 1): # startºÎÅÍ end±îÁö Á¤¼öÀÇ ÇÕÀ» ±¸ÇÔ s += i return s # startºÎÅÍ end±îÁö ¼öÀÇ ÇÕÀ» ¹ÝȯÇÑ´Ù print(get_sum(1, 100)) # 1¿¡¼ 100±îÁö Á¤¼öÀÇ ÇÕ 55¸¦ Ãâ·ÂÇÑ´Ù | cs |