¹øÈ£ | ¹®Á¦ | ½ÇÇà°á°ú | ¼Ò½º ÄÚµå |
1 | print ÇÔ¼ö¸¦ ÇÑ ¹ø¸¸ »ç¿ëÇÏ¿© "Python", "is", "awesome!" ¼¼ ´Ü¾î¸¦ °¢°¢ ´Ù¸¥ ÁÙ¿¡ Ãâ·ÂÇϼ¼¿ä. | | print("Python\nis\nawesome!") |
2 | º¯¼ö name¿¡ ´ç½ÅÀÇ À̸§À» ÀúÀåÇÑ ÈÄ, "My name is [name]." Çü½ÄÀ¸·Î Ãâ·ÂÇϼ¼¿ä. ¿©±â¼ [name]Àº º¯¼ö¿¡ ÀúÀåµÈ °ªÀ¸·Î ´ëüµÇ¾î¾ß ÇÕ´Ï´Ù. | | name = "È«±æµ¿" print(f"My name is {name}.") print("My name is", name) print("My name is %s"%(name)) print("My name is {}".format(name)) |
3 | print ÇÔ¼ö¸¦ »ç¿ëÇÏ¿© 7°ú 8À» °öÇÑ °á°ú¸¦ Ãâ·ÂÇϼ¼¿ä. | | print(7 * 8) |
4 | print ÇÔ¼ö¸¦ »ç¿ëÇÏ¿© "7 + 8 ="°ú 7 + 8ÀÇ °è»ê °á°ú¸¦ °°Àº ÁÙ¿¡ Ãâ·ÂÇϼ¼¿ä. | | print("7 + 8 =", 7 + 8) |
5 | print ÇÔ¼ö¿Í ÁÙ¹Ù²Þ ¹®ÀÚ(\n)¸¦ »ç¿ëÇÏ¿© "First Line"°ú "Second Line"À» °¢°¢ ´Ù¸¥ ÁÙ¿¡ Ãâ·ÂÇϼ¼¿ä. | | print("First Line\nSecond Line") |
6 | "Name", "Age", "Country"¸¦ °¢°¢ ÅÇ °£°ÝÀ¸·Î ºÐ¸®ÇÏ¿© ÇÑ ÁÙ¿¡ Ãâ·ÂÇϼ¼¿ä. | | print("Name\tAge\tCountry") |
7 | print ÇÔ¼ö¸¦ »ç¿ëÇÏ¿© ´ÙÀ½ ¹®ÀåÀ» Ãâ·ÂÇϼ¼¿ä: She said, "Python is my favorite language!" | | print('She said, "Python is my favorite language!"') |
8 | print ÇÔ¼ö¸¦ »ç¿ëÇÏ¿© PythonÀÇ ¿©·¯ ÁÙ ¹®ÀÚ¿(""" ¶Ç´Â ''' »ç¿ë)À» È°¿ëÇØ ´ÙÀ½ÀÇ 3ÁÙÂ¥¸® ½Ã¸¦ Ãâ·ÂÇϼ¼¿ä. Roses are red, Violets are blue, I love Python | | print("""Roses are red, Violets are blue, I love Python""") |
9 | º¯¼ö fruit¿¡ "apple", number¿¡ 10À» ÀúÀåÇÑ ÈÄ, "I have 10 apples." Çü½ÄÀ¸·Î Ãâ·ÂÇϼ¼¿ä. ¿©±â¼ ¼ýÀÚ¿Í °úÀÏÀÇ À̸§Àº º¯¼ö¸¦ »ç¿ëÇÏ¿© Ãâ·ÂÇØ¾ß ÇÕ´Ï´Ù. | | fruit = "apple" number = 10 print(f"I have {number} {fruit}s.") |
10 | turtle ±×·¡ÇÈ ¶óÀ̺귯¸®¸¦ import ÇÏ°í ÅÍƲ °´Ã¼¸¦ »ý¼ºÇÕ´Ï´Ù. | | import turtle t = turtle.Turtle() turtle.done() try: turtle.bye() except: print("bye") |