728x90
반응형

 

6.

year = int(input("연도를 입력 ==> "))

if year % 4 == 0 :  
    if year % 100 == 0 : 
        if year % 400 == 0 : 
            print("윤년", end='')
        else :
            print("평년", end='')
    else :
        print("윤년", end='')
else :
    print("평년",end='')

print(" 입니다")

 

 

7.

score = int(input("뽑힌 점수 : "))

if (score >= 0 and score <= 100) :
    if score >= 90 :
        print("장학생입입니다")
    elif score >= 60 :
        print("합격입니다")
    else :
        print("불합격입니다")
else :
    print("0~100점 사이를 입력해주세요")

 

 

8.

import turtle
import random

turtle.shape('turtle')
turtle.pensize(5)

turtle.screensize(300,300)
turtle.setup(330,330)
turtle.pencolor("blue")
cnt = 0

while True :
    angle = random.randint(0,360)
    distance = random.randint(10,100)
    turtle.right(angle)
    turtle.forward(distance)

    curX = turtle.xcor()
    curY = turtle.ycor()

    if (curX <= 150 and curX >= -150 and curY <= 150 and curY >= -150) :
        print("GOOD")
    else :
        cnt += 1
        if cnt == 0 :
            turtle.pencolor("blue")
        elif cnt == 1 :
            turtle.pencolor("green")
        elif cnt == 2 :
            turtle.pencolor("orange")
        elif cnt >= 3 :
            turtle.pencolor("red")

        turtle.goto(0,0)

turtle.done()
728x90
반응형

+ Recent posts