# ÄÚµå·Î Çü½Ä ÁöÁ¤µÊ
x = 100
if x > 1:
print("x´Â 1º¸´Ù Å®´Ï´Ù.")
score = int(input("Á¡¼ö¸¦ ÀÔ·ÂÇϽÿÀ: "))
if score >= 90 : # Á¶°ÇÀÌ ÂüÀÏ °æ¿ì µé¿©¾²±â ºí·ÏÀÌ ¸ðµÎ ½ÇÇàµÊ
print("ÃàÇÏÇÕ´Ï´Ù.")
print("ÇÕ°ÝÀÔ´Ï´Ù.")
print("ÀåÇбݵµ ¹ÞÀ» ¼ö ÀÖ½À´Ï´Ù.")
score = int(input("Á¡¼ö¸¦ ÀÔ·ÂÇϽÿÀ: "))
if score >= 90 : # ÁÖÀÇ : µé¿©¾²±âÀÇ Å©±â°¡ ´Ù¸¦ °æ¿ì ¿À·ù°¡ Ãâ·ÂµÊ
print("ÃàÇÏÇÕ´Ï´Ù.")
print("ÇÕ°ÝÀÔ´Ï´Ù.")
print("ÀåÇбݵµ ¹ÞÀ» ¼ö ÀÖ½À´Ï´Ù.")
if score >= 60:
print("ÇÕ°ÝÀÔ´Ï´Ù.")
else:
print("ºÒÇÕ°ÝÀÔ´Ï´Ù.")
hour = 10
if hour < 12:
print('¿ÀÀüÀÔ´Ï´Ù.')
else:
print('¿ÀÈÄÀÔ´Ï´Ù.')
score = int(input("¼ºÀûÀ» ÀÔ·ÂÇϽÿÀ: "))
if score >= 60:
print("ÇÕ°ÝÀÔ´Ï´Ù.")
else:
print("ºÒÇÕ°ÝÀÔ´Ï´Ù.")
num = int(input("Á¤¼ö¸¦ ÀÔ·ÂÇϽÿÀ: "))
if num % 2 == 0 :
print("¦¼öÀÔ´Ï´Ù.")
else:
print("Ȧ¼öÀÔ´Ï´Ù.")
import turtle
t = turtle.Turtle()
t.shape("turtle")
t.penup() # ÆæÀ» ¿Ã·Á¼ ±×¸²ÀÌ ±×·ÁÁöÁö ¾Ê°Ô ÇÑ´Ù.
t.goto(100, 100) # °ÅºÏÀ̸¦ (100, 100)À¸·Î À̵¿½ÃŲ´Ù.
t.write("°ÅºÏÀÌ°¡ ¿©±â·Î ¿À¸é ¾ç¼öÀÔ´Ï´Ù.")
t.goto(100, 0)
t.write("°ÅºÏÀÌ°¡ ¿©±â·Î ¿À¸é 0ÀÔ´Ï´Ù.")
t.goto(100, -100)
t.write("°ÅºÏÀÌ°¡ ¿©±â·Î ¿À¸é À½¼öÀÔ´Ï´Ù.")
t.goto(0, 0) # (0, 0) À§Ä¡·Î °ÅºÏÀ̸¦ À̵¿½ÃŲ´Ù.
t.pendown() # ÆæÀ» ³»·Á¼ ±×¸²ÀÌ ±×·ÁÁö°Ô ÇÑ´Ù.
s = turtle.textinput("", "¼ýÀÚ¸¦ ÀÔ·ÂÇϽÿÀ: ")
n = int(s)
if n > 0 :
t.goto(100, 100)
if n == 0 :
t.goto(100, 0)
if n < 0 :
t.goto(100, -100)
turtle.done()
try:
turtle.bye()
except:
print("bye")
age = int(input("³ªÀ̸¦ ÀÔ·ÂÇϽÿÀ: "))
if age >= 15:
print("º» ¿µÈ¸¦ º¸½Ç ¼ö ÀÖ½À´Ï´Ù.")
else:
print("º» ¿µÈ¸¦ º¸½Ç ¼ö ¾ø½À´Ï´Ù.")
import turtle
t = turtle.Turtle()
t.shape("turtle")
# °ÅºÏÀÌ°¡ ±×¸®´Â ¼±ÀÇ µÎ²²¸¦ 3À¸·Î ÇÑ´Ù.
t.width(3)
# °ÅºÏÀ̸¦ 3¹è È®´ëÇÑ´Ù.
t.shapesize(3, 3)
i=0
# ¹«ÇÑ ·çÇÁ·Î ÁøÀÔÇÑ´Ù. ÀÌ ·çÇÁ´Â 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)
i+=1
if(i > 4) :
break
turtle.done()
try:
turtle.bye()
except:
print("bye")
year = int(input("¿¬µµ¸¦ ÀÔ·ÂÇϽÿÀ: "))
if ( (year % 4 ==0 and year % 100 != 0) or year % 400 == 0):
print(year, "³âÀº À±³âÀÔ´Ï´Ù.")
else :
print(year, "³âÀº À±³âÀÌ ¾Æ´Õ´Ï´Ù.")
import random
print("µ¿Àü ´øÁö±â °ÔÀÓÀ» ½ÃÀÛÇÕ´Ï´Ù.")
coin = random.randrange(2) # randrange(2)´Â 0 ¶Ç´Â 1À» ¹ÝȯÇÔ
if coin == 0 :
print("¾Õ¸éÀÔ´Ï´Ù.")
else :
print("µÞ¸éÀÔ´Ï´Ù.")
print("°ÔÀÓÀÌ Á¾·áµÇ¾ú½À´Ï´Ù.")
x, y = input('Á¡ÀÇ ÁÂÇ¥ x, y¸¦ ÀÔ·ÂÇϽÿÀ :').split()
x, y = float(x), float(y)
if x*x + y*y > 25 :
print('¿øÀÇ ¿ÜºÎ¿¡ ÀÖÀ½')
else :
print('¿øÀÇ ³»ºÎ¿¡ ÀÖÀ½')
num = int(input("Á¤¼ö¸¦ ÀÔ·ÂÇϽÿÀ: "))
if num > 0:
print("¾ç¼öÀÔ´Ï´Ù.")
elif num == 0:
print("0ÀÔ´Ï´Ù.")
else:
print("À½¼öÀÔ´Ï´Ù.")
num = int(input("Á¤¼ö¸¦ ÀÔ·ÂÇϽÿÀ: "))
if num >= 0: # ¹Ýµå½Ã µé¿©¾²±â¸¦ ÇÏ¿© ºí·°À» »ý¼º
if num == 0: # ºí·°³»¿¡¼ ¼¼ºÎÀûÀÎ Á¶°ÇÀ» ÇÑ ¹ø ´õ °Ë»ç
print("0ÀÔ´Ï´Ù.")
else:
print("¾ç¼öÀÔ´Ï´Ù.")
else:
print("À½¼öÀÔ´Ï´Ù.")
id = "ilovepython"
s = input("¾ÆÀ̵𸦠ÀÔ·ÂÇϽÿÀ: ")
if s == id:
print("ȯ¿µÇÕ´Ï´Ù.")
else:
print("¾ÆÀ̵𸦠ãÀ» ¼ö ¾ø½À´Ï´Ù.")
import random
n = random.randint(1, 3) # ·£´ýÇÏ°Ô 1, 2, 3 Áß ÇϳªÀÇ °ªÀ» »ý¼º
if n == 1:
computer_choice = "¿ÞÂÊ"
elif n == 2:
computer_choice = "Áß¾Ó"
else:
computer_choice = "¿À¸¥ÂÊ"
user_choice = input("¾îµð¸¦ °ø°ÝÇϽðھî¿ä?(¿ÞÂÊ, Áß¾Ó, ¿À¸¥ÂÊ) : ")
if computer_choice == user_choice:
print("°ø°Ý¿¡ ½ÇÆÐÇϼ̽À´Ï´Ù.")
else :
print("ÃàÇÏÇÕ´Ï´Ù!! °ø°Ý¿¡ ¼º°øÇÏ¿´½À´Ï´Ù.")
print('ÄÄÇ»ÅÍÀÇ ¼öºñÀ§Ä¡ :', computer_choice)
# µµÀü¹®Á¦ 4.12 ¹ø Ç®À̹æ½Ä
options=["¿ÞÂÊ","Áß¾Ó","¿À¸¥ÂÊ"]
computer_choice = random.choice(options)
user_choice = input("¾îµð¸¦ ¼öºñÇϽðھî¿ä?(¿ÞÂÊ, Áß¾Ó, ¿À¸¥ÂÊ)")
if computer_choice == user_choice:
print("¼öºñ¿¡ ¼º°øÇϼ̽À´Ï´Ù.")
else:
print("¼öºñ¿¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù.")
import turtle
t = turtle.Turtle()
s = turtle.textinput("", "µµÇüÀ» ÀÔ·ÂÇϽÿÀ: ")
if s == "»ç°¢Çü" :
s = turtle.textinput("","°¡·Î: ")
w = int(s)
s = turtle.textinput("","¼¼·Î: ")
h = int(s)
t.forward(w)
t.left(90)
t.forward(h)
t.left(90)
t.forward(w)
t.left(90)
t.forward(h)
turtle.done()
try:
turtle.bye()
except:
print("bye")