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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | # # µû¶óÇÏ¸ç ¹è¿ì´Â ÆÄÀ̽ã°ú µ¥ÀÌÅÍ°úÇÐ(»ý´ÉÃâÆÇ»ç 2020) # LAB 4-3 °ÅºÏÀÌ Á¦¾îÇϱâ, 102ÂÊ # import turtle t = turtle.Turtle() # Ä¿¼ÀÇ ¸ð¾çÀ» °ÅºÏÀÌ·Î ÇÑ´Ù. t.shape("turtle") # °ÅºÏÀÌ°¡ ±×¸®´Â ¼±ÀÇ µÎ²²¸¦ 3À¸·Î ÇÑ´Ù. t.width(3) # °ÅºÏÀ̸¦ 3¹è È®´ëÇÑ´Ù. t.shapesize(3, 3) # ¹«ÇÑ ·çÇÁ·Î ÁøÀÔÇÑ´Ù. ÀÌ ·çÇÁ´Â Ctrl+C¸¦ ÀÔ·Â¹Þ¾Æ Á¾·áµÈ´Ù. while True: command = input("¸í·ÉÀ» ÀÔ·ÂÇϽÿÀ: ") if command == "l": # »ç¿ëÀÚ°¡ "l"À» ÀÔ·ÂÇÏ¿´À¸¸é t.left(90) # ¿ÞÂÊÀ¸·Î 90µµ ȸÀü t.forward(100) if command == "r": # »ç¿ëÀÚ°¡ "r"À» ÀÔ·ÂÇÏ¿´À¸¸é t.right(90) # ¿À¸¥ÂÊÀ¸·Î 90µµ ȸÀü t.forward(100) if command == "f": # »ç¿ëÀÚ°¡ "f"À» ÀÔ·ÂÇÏ¿´À¸¸é t.forward(100) # # µû¶óÇÏ¸ç ¹è¿ì´Â ÆÄÀ̽ã°ú µ¥ÀÌÅÍ°úÇÐ(»ý´ÉÃâÆÇ»ç 2020) # LAB 4-3 °ÅºÏÀÌ Á¦¾îÇϱâ, 102ÂÊ # import turtle t = turtle.Turtle() # Ä¿¼ÀÇ ¸ð¾çÀ» °ÅºÏÀÌ·Î ÇÑ´Ù. t.shape("turtle") # °ÅºÏÀÌ°¡ ±×¸®´Â ¼±ÀÇ µÎ²²¸¦ 3À¸·Î ÇÑ´Ù. t.width(3) # °ÅºÏÀ̸¦ 3¹è È®´ëÇÑ´Ù. t.shapesize(3, 3) # ¹«ÇÑ ·çÇÁ·Î ÁøÀÔÇÑ´Ù. ÀÌ ·çÇÁ´Â Ctrl+C¸¦ ÀÔ·Â¹Þ¾Æ Á¾·áµÈ´Ù. while True: command = input("¸í·ÉÀ» ÀÔ·ÂÇϽÿÀ: ") if command == "l": # »ç¿ëÀÚ°¡ "l"À» ÀÔ·ÂÇÏ¿´À¸¸é t.left(90) # ¿ÞÂÊÀ¸·Î 90µµ ȸÀü t.forward(100) if command == "r": # »ç¿ëÀÚ°¡ "r"À» ÀÔ·ÂÇÏ¿´À¸¸é t.right(90) # ¿À¸¥ÂÊÀ¸·Î 90µµ ȸÀü t.forward(100) if command == "f": # »ç¿ëÀÚ°¡ "f"À» ÀÔ·ÂÇÏ¿´À¸¸é t.forward(100) if command == "h": # »ç¿ëÀÚ°¡ "h"À» ÀÔ·ÂÇÏ¿´À¸¸é t.shapesize(10, 10) if command == "n": # »ç¿ëÀÚ°¡ "n"À» ÀÔ·ÂÇÏ¿´À¸¸é t.shapesize(3, 3) # # µû¶óÇÏ¸ç ¹è¿ì´Â ÆÄÀ̽ã°ú µ¥ÀÌÅÍ°úÇÐ(»ý´ÉÃâÆÇ»ç 2020) # LAB 4-3 °ÅºÏÀÌ Á¦¾îÇϱâ, 102ÂÊ # import turtle t = turtle.Turtle() # Ä¿¼ÀÇ ¸ð¾çÀ» °ÅºÏÀÌ·Î ÇÑ´Ù. t.shape("turtle") # °ÅºÏÀÌ°¡ ±×¸®´Â ¼±ÀÇ µÎ²²¸¦ 3À¸·Î ÇÑ´Ù. t.width(3) # °ÅºÏÀ̸¦ 3¹è È®´ëÇÑ´Ù. t.shapesize(3, 3) # ¹«ÇÑ ·çÇÁ·Î ÁøÀÔÇÑ´Ù. ÀÌ ·çÇÁ´Â Ctrl+C¸¦ ÀÔ·Â¹Þ¾Æ Á¾·áµÈ´Ù. while True: command = input("¸í·ÉÀ» ÀÔ·ÂÇϽÿÀ: ") if command == "l": # »ç¿ëÀÚ°¡ "l"À» ÀÔ·ÂÇÏ¿´À¸¸é t.left(90) # ¿ÞÂÊÀ¸·Î 90µµ ȸÀü t.forward(100) if command == "r": # »ç¿ëÀÚ°¡ "r"À» ÀÔ·ÂÇÏ¿´À¸¸é t.right(90) # ¿À¸¥ÂÊÀ¸·Î 90µµ ȸÀü t.forward(100) if command == "f": # »ç¿ëÀÚ°¡ "f"À» ÀÔ·ÂÇÏ¿´À¸¸é t.forward(100) if command == "h": # »ç¿ëÀÚ°¡ "h"À» ÀÔ·ÂÇÏ¿´À¸¸é size = int(input("1 ~ 9 »çÀÌÀÇ Á¤¼ö¸¦ ÀÔ·ÂÇϽÿÀ: ")) t.shapesize(size, size) if command == "n": # »ç¿ëÀÚ°¡ "n"À» ÀÔ·ÂÇÏ¿´À¸¸é t.shapesize(3, 3) | cs |