ÇÁ·Î±×·¥À» ½ÃÀÛÇÏÀÚ ¸¶ÀÚ, ¿ì¸®´Â ³î¶ø°Ôµµ ¿ì¸®°¡ »ý°¢Çß´ø´ë·ÎÀÇ ÇÁ·Î±×·¥À» °¡Áö´Â °ÍÀÌ ½±Áö ¾Ê´Ù´Â °ÍÀ» ±ú´Ý´Â´Ù. µð¹ö±ëÀº Ž±¸µÇ¾îÁ®¾ß¸¸ ÇÏ´Â °ÍÀÌ´Ù. ³ª´Â ¹Ù·Î ±× ¶§¸¦ »ý»ýÇÏ°Ô ±â¾ïÇÑ´Ù. ³»°¡ ±ú´Ý´Â ±× ¼ø°£ºÎÅÍ ³ª´Â ³ªÀÇ ÀλýÀÇ ´ëºÎºÐÀ» ³ªÀÇ ÇÁ·Î±×·¥¿¡¼ ½Ç¼ö¸¦ ã¾Æ ³»´Âµ¥¿¡ »ç¿ëÇÏ°í ÀÖ¾ú´Ù.
- Maurice Wilkes discovers debugging, 1949
Áö±Ý±îÁö ¿©·¯ºÐÀÌ ÇÁ·Î±×·¥À» °¡Áö°í À̸®Àú¸® ³î´Ùº¸¸é ÇÁ·Î±×·¥ÀÌ ¶§¶§·Î ¿©·¯ºÐÀÌ ¿øÇÏÁö ¾Ê¾Ò´ø ÇൿÀ» ÇÑ´Ù´Â °ÍÀ» ¾Æ¸¶µµ ¿©·¯ºÐÀº ¹ß°ß ÇÒ °ÍÀÌ´Ù. ÀÌ°ÍÀº ´ë´ÜÈ÷ ÈçÇÑ ÀÏÀÌ´Ù. µð¹ö±ëÀº ÄÄÇ»ÅÍ°¡ ¹«¾ùÀ» ÇÏ´ÂÁö ¾Ë¾Æ³»´Â 󸮰úÁ¤ÀÌ¸ç ±×¸®°í ¿©·¯ºÐÀÌ ¿øÇϴ´ë·Î ÇÁ·Î±×·¥ÀÌ ½ÇÇàµÇµµ·Ï ÇÏ´Â °úÁ¤ÀÌ´Ù. ÀÌ°ÍÀ» ±â¼úÀûÀϼöµµ ÀÖ´Ù. ÇѶ§ ³ª´Â °ÅÀÇ ÀÏÁÖÀÏÀ̳ª ¼ÒºñÇؼ ¹ö±×¸¦ ÃßÀûÇÏ°í °íÄ£ÀûÀÌ ÀÖ¾ú´Âµ¥ ¾î¶² »ç¶÷ÀÌ y°¡ ÀÖ¾î¾ßÇÒ ÀÚ¸®¿¡ x¸¦ ³Ö¾î ³õ¾Æ¼ ¹ß»ýÇÑ °ÍÀ̾ú´Ù.
ÀÌ ÀåÀº Àü À庸´Ùµµ ´õ¿í Ãß»óÀûÀÌ µÉ °ÍÀÌ´Ù. À¯¿ëÇÏ´Ù¸é ¿¬¶ôÁÖ¼¼¿ä
°¡Àå ¸ÕÀú ÇؾßÇÒ ÀÏÀº(ÀÌ°ÍÀº ´ç¿¬ÇÏ°Ô º¸ÀδÙ) ÇÁ·Î±×·¥ÀÌ Á¤È®È÷ µ¿ÀÛÇÏÁö ¾ÊÀ» ¶§ ±× ÇÁ·Î±×·¥ÀÌ ¹«¾ùÀ» ÇؾßÇÏ´ÂÁö¸¦ Ãß»êÇØ º¸´Â °ÍÀÌ´Ù. ¾à°£ÀÇ Å×½ºÆ®¿ë »óȲµéÀ» °í¾ÈÇØ º¸°í ¹«½¼ÀÏÀÌ ÀϾ´ÂÁö »ìÆ캸¶ó. ¿¹¸¦ µé¾î ³»°¡ »ç°¢ÇüÀÇ ±æÀÌ( ¸ðµç º¯ÀÇ ±æÀÌÀÇ ÇÕ)¸¦ °è»êÇÏ´Â ÇÁ·Î±×·¥ÀÌ ÀÖ´Ù°í ÇÏÀÚ. ³ª´Â ´ÙÀ½°ú °°Àº Å×½ºÆ® »óȲÀ» °¡Áø´Ù :
width | height | perimeter |
3 | 4 | 14 |
2 | 3 | 10 |
4 | 4 | 16 |
2 | 2 | 8 |
5 | 1 | 12 |
ÀÌÁ¦ ³ª´Â ÇÁ·Î±×·¥À» ¸ðµç ÄÉÀ̽º¿¡ ´ëÇÏ¿© ½ÇÇà½ÃÄѼ ±× ÇÁ·Î±×·¥ÀÌ ³»°¡ ¿¹»óÇѹٸ¦ ±×´ë·Î ½ÇÇàÇÏ°í ÀÖ´ÂÁö »ìÆ캻´Ù. ¸¸¾à ±×·¸Áö ¸øÇÏ´Ù¸é ³ª´Â ÄÄÇ»ÅÍ°¡ ¹«¾ùÀ» ÇÏ°í ÀÖ´ÂÁö ¾Ë ÇÊ¿ä°¡ ÀÖ´Ù.
¸¹Àº °ËÁõÄÉÀ̽ºµéÀÌ Àß ÀÛµ¿ÇÏÁö¸¸ ¾î¶² °ÍµéÀº ±×·¸Áö ¾Ê´Ù. ¸¸¾à ±×·¸´Ù¸é ¿©·¯ºÐÀº Àß ÀÛµ¿ÇÏ´Â ÇÁ·Î±×·¥µéÀÇ °øÅëÁ¡ÀÌ ¹«¾ùÀÎÁö ¾Ëµµ·Ï ³ë·ÂÇØ¾ß ÇÑ´Ù. ¿¹¸¦ µé¾î ¿©±â¿¡ º¯ÀÇ ±æÀ̸¦ °è»êÇÏ´Â ÇÁ·Î±×·¥ÀÌ ÀÖ´Ù.(Àá½ÃÈÄ¿¡ º¸°Ô µÉ°Ì´Ï´Ù.):
Height: 3 Width: 4 perimeter = 15
Height: 2 Width: 3 perimeter = 11
Height: 4 Width: 4 perimeter = 16
Height: 2 Width: 2 perimeter = 8
Height: 5 Width: 1 perimeter = 8
ùÀ½ÀÇ µÎ °³ÀÇ ÀԷ¿¡ ´ëÇÏ¿©´Â ÀÛµ¿ÇÏÁö ¾Ê¾ÒÀ½À» ÁÖ¸ñÇ϶ó, ´ÙÀ½ÀÇ µÎ°³¿¡´Â Àß ÀÛµ¿ÇÏ°í ¸¶Áö¸· ÇÑ°³¿¡´Â ÀÛµ¿ÇÏÁö ¾Ê¾Ò´Ù. ¹®Á¦°¡ ¹«¾ùÀÎÁö ¿©·¯ºÐÀÌ ¾Ë±â¸¸ ÇÑ´Ù¸é ¿øÀÎÀ» ã¾Æ³»´Â °ÍÀº ´õ¿í ½±´Ù. ¿©·¯ºÐÀÇ ÇÁ·Î±×·¥À» °¡Áö°í ÇÊ¿äÇÏ´Ù¸é ´õ ¸¹Àº °ËÁõÄÉÀ̽ºµéÀ» ¿©·¯ºÐÀº ½ÃµµÇØ º¸¾Æ¾ß¸¸ ÇÑ´Ù.
´ÙÀ½À¸·Î ÇؾßÇÒ ÀÏÀº ¼Ò½ºÄڵ带 »ìÆ캸´Â ÀÏÀÌ´Ù. ÇÁ·Î±×·¡¹ÖÀ» ÇÏ¸é¼ ÇؾßÇÒ °¡Àå Áß¿äÇÑ ÀÏÀº ¼Ò½º¸¦ Àд °ÍÀÌ´Ù. ¼Ò½º¸¦ Àд °¡Àå ÁÁÀº ¹æ¹ýÀº Äڵ带 Äf¾îº¸´Â °ÍÀÌ´Ù.
ÄÚµå Äf¾îº¸±â´Â ù ¹ø° ÁÙ¿¡¼ ½ÃÀÛÇؼ, ÇÁ·Î±×·¥ÀÌ ³¡³¯ ¶§±îÁö ¾Æ·¡·Î ÁøÇàµÈ´Ù. While ·çÇÁ¿Í if ¼¼ú¹®ÀÌ ¶æÇÏ´Â ¹Ù´Â ¾î¶² ¶óÀεéÀº ½ÇÇàµÇÁö ¾ÊÀ» °ÍÀÌ°í ¾î¶² ¶óÀεéÀº ¿©·¯¹ø ½ÇÇàµÉ °ÍÀ̶ó´Â °ÍÀ» ¶æÇÑ´Ù. °¢ ¶óÀο¡¼ ¿©·¯ºÐÀº ÆÄÀ̽ãÀÌ ¹«¾ùÀ» ÇÏ¿´´ÂÁö¸¦ ÀÌÇØÇÑ´Ù.
º¯ÀÇ ±æÀ̸¦ °è»êÇÏ´Â ÀÌ ´Ü¼øÇÑ ÇÁ·Î±×·¥À¸·Î ½ÃÀÛÇØ º¸ÀÚ. ŸÀÌÇÁÇØ ³ÖÁö ¸¶½Ã°í Àб⸸ Ç϶ó. ½ÇÇàÇÏÁö ¸¶¶ó. ¼Ò½º ÄÚµå´Â ÀÌ·¸´Ù :
height = input("Height: ") width = input("Width: ") print "perimeter = ",width+height+width+width
Question: ÆÄÀ̽ãÀÌ Ã³À½À¸·Î ½ÇÇàÇÏ´Â ¶óÀÎÀº ¹«¾ùÀΰ¡?
Answer: ù ¹ø° ¶óÀÎÀÌ Ç×»ó ¸ÕÀú ½ÇÇàµÈ´Ù. ÀÌ°æ¿ì¿¡´Â : height = input("Height: ")
ÀÌ´Ù.
Question: ±× ¶óÀÎÀº ¹«¾ùÀ» Çϴ°¡?
Answer: Height: ¸¦ Ãâ·ÂÇÏ°í, »ç¿ëÀÚ°¡ ¼ýÀÚ Çϳª¸¦ ÀÔ·ÂÇϱ⸦ ±â´Ù¸°´Ù, ±×¸®°í ±×°ÍÀ» º¯¼ö height¿¡ Áý¾î ³Ö´Â´Ù.
Question: ´ÙÀ½À¸·Î ½ÇÇàµÇ´Â ¶óÀÎÀº ¹«¾ùÀΰ¡?
Answer: ÀϹÝÀûÀ¸·Î, 'width = input("Width: ")
' ¾Æ·¡ÀÇ ¶óÀÎÀÌ´Ù.
Question: ±× ¶óÀÎÀº ¹«¾ùÀ» Çϴ°¡?
Answer: Width: ¸¦ Ãâ·ÂÇÏ°í, »ç¿ëÀÚ°¡ ¼ýÀÚ Çϳª¸¦ ÀÔ·ÂÇϱ⸦ ±â´Ù·Á¼, ±×°ÍÀ» º¯¼ö width¿¡ Áý¾î ³Ö´Â´Ù.
Question: ´ÙÀ½À¸·Î ½ÇÇàµÇ´Â ¶óÀÎÀº ¹«¾ùÀΰ¡?
Answer: ´ÙÀ½ÀÇ ¶óÀÎÀÌ ÇöÀçÀÇ ¶óÀκ¸´Ù µé¿©¾²±â ȤÀº ³»¾î¾²±â µÇ¾î ÀÖÁö¸¸ ¾Ê´Ù¸é, ±×°ÍÀº ¹Ù·Î ´ÙÀ½ÀÇ ¶óÀÎÀÌ´Ù.
±×·¯¹Ç·Î ´ÙÀ½ ¶óÀÎÀº : 'print "perimeter = ",width+height+width+width
' ÀÌ´Ù
(±×°ÍÀº ¶ÇÇÑ ÇöÀç¶óÀο¡ ÀÖ´Â ÇÔ¼ö¸¦ ½ÇÇàÇÒÁöµµ ¸ð¸£Áö¸¸, ±×°ÍÀº ¾ÕÀ¸·ÎÀÇ Àå¿¡¼ ´Ù·ç°Ú´Ù.)
Question: ±× ¶óÀÎÀº ¹«¾ùÀ» Çϴ°¡?
Answer: ¸ÕÀú perimeter = ¸¦ Ãâ·ÂÇÏ°í, ±×¸®°í ³ª¼ width+height+width+width ¸¦ Ãâ·ÂÇÑ´Ù.
Question: width+height+width+width´Â ±æÀ̸¦ ÀûÀýÈ÷ °è»êÇϴ°¡?
Answer: ¾îµð º¸ÀÚ, »ç°¢ÇüÀÇ º¯ÀÇ ±æÀÌÀÇ ÇÕÀº ¾Æ·§º¯ÀÇ ³Êºñ ´õÇϱâ Áº¯ÀÇ ³ôÀÌ ´õÇϱâ Àº¯ÀÇ ³Êºñ ´õÇϱ⠿캯ÀÇ (È÷?) ÇÕÀÌ´Ù. °¡Àå ¸¶Áö¸· Ç׸ñÀº ¿ìº¯ÀÇ ±æÀÌ, ȤÀº ³ôÀÌ°¡ µÇ¾î¾ß ÇÑ´Ù.
Question: ¿Ö ¾î¶² ¶§´Â ±æÀÌ°¡ 'Á¤È®ÇÏ°Ô' °è»êµÇ¾ú´ÂÁö ÀÌÇØÇϴ°¡?
Answer: ³Êºñ¿Í ³ôÀÌ°¡ °°À» ¶§´Â Á¤È®ÇÏ°Ô °è»êµÇ¾ú´Ù.
¿ì¸®°¡ °Å´Ò¾î º¼ ´ÙÀ½ ÇÁ·Î±×·¥Àº 5°³ÀÇ Á¡À» ȸ鿡 Ãâ·ÂÇÏ´Â ÇÁ·Î±×·¥ÀÌ´Ù. ±×·¸Áö¸¸, ÀÌ°ÍÀÌ ±× ÇÁ·Î±×·¥ÀÌ Ãâ·Â ÇÑ°ÍÀε¥ :
. . . .
±×¸®°í ÀÌ°ÍÀÌ ±× ÇÁ·Î±×·¥ÀÌ´Ù:
number = 5 while number > 1: print ".", number = number - 1 print
ÀÌ ÇÁ·Î±×·¥Àº ÀÌÁ¦ µé¿©¾²±âµÈ ºÎºÐ(¶Ç´Â Á¦¾î ±¸Á¶)À» °¡Áö¹Ç·Î »ìÆ캸±â¿¡ ´õ¿í º¹ÀâÇÒ °ÍÀÌ´Ù. ÀÌÁ¦ ½ÃÀÛÇغ¸ÀÚ
Question: ½ÇÇàµÇ¾î¾ß ÇÒ Ã¹ ¹ø° ¶óÀÎÀº ¹«¾ùÀΰ¡?
Answer: ÀÌ ÆÄÀÏ¿¡¼ ù¹ø° ¶óÀÎÀº: number = 5 ÀÌ´Ù.
Question: ±×°ÍÀº ¹«¾ùÀ» Çϴ°¡?
Answer: ¼ýÀÚ 5¸¦ numberº¯¼ö¿¡ ³Ö´Â´Ù.
Question: ´ÙÀ½ ¶óÀÎÀº ¹«¾ùÀΰ¡?
Answer: ´ÙÀ½ ¶óÀÎÀº: while number > 1: ÀÌ´Ù
Question: ±×°ÍÀº ¹«¾ùÀ» Çϴ°¡?
Answer: ¿¡ , while ¼¼ú¹®Àº ÀϹÝÀûÀ¸·Î ÀÚ½ÅÀÇ ¼¼ú¹®À» »ìÆì º¸°í¼, ¸¸¾à ÂüÀ̶ó¸é ´ÙÀ½ÀÇ µé¿©¾²±âµÈ Äڵ带 ½ÇÇàÇÏ°í, ±×·¸Áö ¾ÊÀ¸¸é ±× Äڵ带 °Ç³Ê ¶Ú´Ù.
Question: ±×·¯¸é ±×°ÍÀº Áö±Ý ¹«¾ùÀ» Çϴ°¡?
Answer: ¸¸¾à 'number > 1' ÀÌ ÂüÀ̶ó¸é ´ÙÀ½ÀÇ µÎ ¶óÀÎÀÌ ½ÇÇàµÉ °ÍÀÌ´Ù.
Question: ±×·¯¸é number > 1 Àΰ¡?
Answer: number¿¡ ³Ö¾îÁø ¸¶Áö¸· °ªÀÌ 5 ÀÌ°í '5 > 1' À̹ǷΠ±×·¸´Ù.
Question: ±×·³ ´ÙÀ½ ¶óÀÎÀº ¹«¾ùÀΰ¡?
Answer: while ÀÌ ÂüÀ̹ǷΠ´ÙÀ½ ¶óÀÎÀº : 'print ".",
' ÀÌ´Ù
Question: ±× ¶óÀÎÀº ¹«¾ùÀ» Çϴ°¡?
Answer: ÇÑ °³ÀÇ Á¡À» Âï´Â´Ù. ±×¸®°í ¼¼ú¹®ÀÌ , ·Î ³¡³ª¹Ç·Î ´ÙÀ½ÀÇ print¼¼ú¹®Àº ´ÙÀ½ ¶óÀο¡ Ãâ·ÂµÇÁö ¾ÊÀ» °ÍÀÌ´Ù.
Question: ´ÙÀ½ ¶óÀÎÀº ¹«¾ùÀΰ¡?
Answer: number = number - 1
ÀÌ´Ù ¿Ö³ÄÇÏ¸é ±×°ÍÀÌ ´ÙÀ½ ¶óÀÎÀÌ¸ç ¾Æ¹«·± µé¿©¾²±â º¯Èµµ ¾ø±â ¶§¹®ÀÌ´Ù.
Question: ±×°ÍÀº ¹«¾ùÀ» Çϴ°¡?
Answer: ±×°ÍÀº number - 1 À» °è»êÇÑ´Ù,
±×°ÍÀº numberÀÇ ÇöÀç°ª (5)ÀÌ°í °Å±â¿¡¼ 1À» »©¼, ±×°ÍÀ» numberº¯¼öÀÇ »õ·Î¿î °ªÀ¸·Î ÇÑ´Ù.
±×·¡¼ ±âº»ÀûÀ¸·Î ±×°ÍÀº numberÀÇ °ªÀ» 5 ¿¡¼ 4 ·Î º¯°æÇÑ´Ù.
Question: ´ÙÀ½ ¶óÀÎÀº ¹«¾ùÀΰ¡?
Answer: À½, µé¿©¾²±â°¡ µÇ¾úÀ¸¹Ç·Î ¿ì¸®´Â ¾î¶² Á¾·ùÀÇ Á¦¾î ±¸Á¶ÀÎÁö¸¦ »ìÆ캸¾Æ¾ß ÇÑ´Ù. ±×°ÍÀº while ȸµ¹ÀÌ´Ù, ±×·¡¼ ¿ì¸®´Â while Àý·Î µÇµ¹¾Æ °¡¾ßÇÑ´Ù. ±× ±¸¹®Àº while number > 1:
ÀÌ´Ù.
Question: ±×°ÍÀº ¹«¾ùÀ» Çϴ°¡?
Answer: number º¯¼öÀÇ °ªÀ» »ìÆ캸°í, ±× °ªÀº 4 Àε¥, ±×°Í°ú 1 À» ºñ±³Çغ»´Ù. '4 >
' À̹ǷΠwhile ·çÇÁ´Â °è¼ÓµÈ´Ù.
Question: ´ÙÀ½ ¶óÀÎÀº ¹«¾ùÀΰ¡?
Answer: while ·çÇÁ°¡ ÂüÀ̾úÀ¸¹Ç·Î, ´ÙÀ½ ¶óÀÎÀº : 'print ".",
' ÀÌ´Ù
Question: ±×°ÍÀº ¹«¾ùÀ» Çϴ°¡?
Answer: ±× ¶óÀο¡ µÎ ¹ø° Á¡ Çϳª¸¦ Ãâ·ÂÇÑ´Ù.
Question: ´ÙÀ½ ¶óÀÎÀº ¹«¾ùÀΰ¡?
Answer: µé¿©¾²±â°¡ º¯ÇÏÁö ¾Ê¾ÒÀ¸¹Ç·Î ´ÙÀ½ ¶óÀÎÀº: 'number = number - 1
' ÀÌ´Ù
Question: ±×·¯¸é ±×°ÍÀº ¹«¾ùÀ» Çϴ°¡?
Answer: ±×°ÍÀº ÇöÀçÀÇ number °ª(4)À» º¸¿©ÁÖ°í, 1À» number¿¡¼ »«´Ù, ±×·³ 3ÀÌ µÇ°í ±×·¯¸é °á±¹¿¡ 3ÀÌ »õ·Î¿î numberÀÇ °ªÀÌ µÈ´Ù.
Question: ´ÙÀ½ ¶óÀÎÀº ¹«¾ùÀΰ¡?
Answer:
while ȸµ¹ÀÌÀÇ ¸¶Áö¸·¿¡ ÀÇÇؼ µé¿©¾²±â¿¡ º¯È°¡ ÀÖÀ¸¹Ç·Î,
´ÙÀ½ ¶óÀÎÀº : while number > 1:
ÀÌ´Ù.
Question: ±×°ÍÀº ¹«¾ùÀ» Çϴ°¡?
Answer: ±×°ÍÀº numberÀÇ ÇöÀç °ª(3)À» 1°ú ºñ±³ÇÑ´Ù. 3 > 1
À̹ǷΠwhile ȸµ¹ÀÌ´Â °è¼ÓµÈ´Ù.
Question: ´ÙÀ½ ¶óÀÎÀº ¹«¾ùÀΰ¡?
Answer: while ȸµ¹ÀÌ Á¶°ÇÀÌ ÂüÀ̹ǷΠ´ÙÀ½ ¶óÀÎÀº : print ".",
ÀÌ´Ù.
Question: ±×¸®°í ±×°ÍÀÌ ÇÏ´Â ¹Ù´Â?
Answer: ¼¼ ¹ø°ÀÇ Á¡ÀÌ ±× ¶óÀο¡ Ãâ·ÂµÈ´Ù.
Question: ´ÙÀ½ ¶óÀÎÀº ¹«¾ùÀΰ¡?
Answer: ±×°ÍÀº : number = number - 1
ÀÌ´Ù
Question: ±×°ÍÀº ¹«¾ùÀ» Çϳª?
Answer: ±×°ÍÀº ÇöÀçÀÇ number °ª(3)À» ÃëÇؼ °Å±â¿¡¼ 1À» »©°í 2¸¦ »õ·Î¿î numberÀÇ °ªÀ¸·Î ¸¸µç´Ù.
Question: ´ÙÀ½ ¶óÀÎÀº ¹«¾ùÀΰ¡?
Answer: while ȸµ¹ÀÌÀÇ ½ÃÀۺκÐÀ¸·Î µÇµ¹¾Æ °£´Ù: while number > 1:
Question: ±×°ÍÀº ¹«¾ùÀ» Çϴ°¡?
Answer: ±×°ÍÀº ÇöÀçÀÇ number °ª(2)¿Í 1À» ºñ±³ÇÑ´Ù. 2 > 1
À̹ǷΠwhile ȸµ¹ÀÌ´Â °è¼ÓµÈ´Ù.
Question: ´ÙÀ½ ¶óÀÎÀº ¹«¾ùÀΰ¡?
Answer: while ȸµ¹ÀÌ°¡ °è¼ÓµÇ¹Ç·Î : print ".",
ÀÌ´Ù
Question: ±×°ÍÀº ¹«¾ùÀ» Çϴ°¡?
Answer: ±×°ÍÀº »îÀÇ Àǹ̿Í, ¿ìÁÖ¿Í ±×¸®°í ¸ðµç °ÍµéÀ» Ž±¸ÇÑ´Ù. ³ó´ãÀÔ´Ï´Ù. (¿©·¯ºÐÀ» ȯ±â½ÃÅ°·Á°í ÈåÈå~)
±× ¶óÀÎÀº ȸ鿡 ³× ¹ø° Á¡À» Ãâ·ÂÇÑ´Ù.
Question: ´ÙÀ½ ¶óÀÎÀº ¹«¾ùÀΰ¡?
Answer: ±×°ÍÀº: number = number - 1
ÀÌ´Ù.
Question: ±×°ÍÀº ¹«¾ùÀ» Çϴ°¡?
Answer: ÇöÀçÀÇ number °ª(2)¸¦ ÃëÇؼ °Å±â¿¡¼ 1 À» »©°í 1 À» »õ·Î¿î numberÀÇ °ªÀ¸·Î ¸¸µç´Ù.
Question: ´ÙÀ½ ¶óÀÎÀº ¹«¾ùÀΰ¡?
Answer: while ȸµ¹ÀÌ·Î ´Ù½Ã µÇµ¹¾Æ °£´Ù: while number > 1:
Question: ±× ¶óÀÎÀº ¹«¾ùÀ» Çϴ°¡?
Answer: ±×°ÍÀº ÇöÀçÀÇ number °ª(1)À» 1°ú ºñ±³ÇÑ´Ù. 1 > 1
Àº °ÅÁþÀ̹ǷΠ(ÀÏÀº ÀϺ¸´Ù Å©Áö ¾Ê´Ù), whileȸµ¹À̸¦ Å»ÃâÇÑ´Ù.
Question: ´ÙÀ½ ¶óÀÎÀº ¹«¾ùÀΰ¡?
Answer: while ȸµ¹ÀÌÀÇ Á¶°ÇÀÌ °ÅÁþÀ̹ǷΠ´ÙÀ½ ¶óÀÎÀº while ȸµ¹ÀÌ°¡ ºüÁ® ³ª¿Â ÀÌÈÄÀÇ ¶óÀÎÀÌ´Ù, ¶Ç´Â: print
Question: ±× ¶óÀÎÀº ¹«¾ùÀ» Çϴ°¡?
Answer: ȸ鿡¼ ´ÙÀ½ ¶óÀÎÀ¸·Î À̵¿½ÃŲ´Ù.
Question: ¿Ö ±× ÇÁ·Î±×·¥ÀÌ Á¡ 5°³¸¦ ÂïÁö ¾Ê´Â°¡?
Answer: ȸµ¹ÀÌ°¡ 1 Á¡ ºü¸£°Ô Å»ÃâÇÑ´Ù.
Question: ¾î¶»°Ô ¿ì¸®´Â ±×°ÍÀ» °íÄ¥ ¼ö ÀÖ³ª?
Answer: ȸµ¹À̸¦ 1Á¡ ³ªÁß¿¡ Å»Ãâ½ÃŲ´Ù.
Question: ±×·³ ¾î¶»°Ô ¿ì¸®´Â ±×°ÍÀ» Çϳª?
Answer: ¿©·¯°¡Áö ¹æ¹ýÀÌ ÀÖ´Ù. ÇϳªÀÇ ¹æ¹ýÀº while ȸµ¹À̸¦ ´ÙÀ½°ú °°ÀÌ ¹Ù²Ù´Â °ÍÀÌ´Ù :
while number > 0:
¶Ç ´Ù¸¥ ¹æ¹ýÀº Á¶°ÇÀ» ´ÙÀ½°ú °°ÀÌ ¹Ù²Ù´Â °ÍÀÌ´Ù : number >= 1
´Ù¸¥ ¹æ¹ýµµ ¸¹ÀÌ ÀÖ´Ù.
¿©·¯ºÐÀº ÇÁ·Î±×·¥ÀÌ ¹«¾ùÀ» ÇÏ´ÂÁö¸¦ ÀÌÇØÇÒ ÇÊ¿ä°¡ ÀÖ´Ù. ¿©·¯ºÐÀº ÇÁ·Î±×·¥ÀÌ ¹«¾ùÀ» ÇؾßÇÏ´ÂÁö¸¦ ÀÌÇØÇÒ ÇÊ¿ä°¡ ÀÖ´Ù. ¾çÀÚ°£ÀÇ Â÷ÀÌÁ¡ÀÌ ¹«¾ùÀÎÁö¸¦ ÀÌÇØÇØ º¸¶ó. µð¹ö±ëÀº ¹Ýµå½Ã ¹è¿ö¾ß¸¸ ÇÏ´Â ±â¼úÀÌ´Ù. ¿©·¯ºÐÀÌ Çѽð£ÀÌ Áö³ªµµ ÀÌÇØÇÒ ¼ö°¡ ¾ø¾î¼ Àá½Ã ½¬°í ÀÖ´Ù¸é, ±× ¹®Á¦¿¡ °üÇÏ¿© ´©±º°¡¿Í »óÀÇ Çغ¸°Å³ª °í°³¸¦ Ç« ¼÷ÀÌ°í ¼÷°íÇØ º¸¶ó. Àá½Ã ÈÄ¿¡ µ¹¾Æ¿À¸é ¿©·¯ºÐÀº ¾Æ¸¶µµ ±× ¹®Á¦¿¡ °üÇÏ¿© »õ·Î¿î »ý°¢À» °¡Áö°Ô µÉ °ÍÀÌ´Ù. Çà¿îÀ» ºó´Ù.