Python

13-21장 심사 문제 풀이

충 민 2022. 7. 27. 00:58

13.7

price = int(input())
discount = input()
if discount == 'Cash3000':
    print(price-3000)
elif discount == 'Cash5000':
    print(price-5000)

 

14.7

kor,eng,mat,sci = map(int,input().split())
avg=(kor+eng+mat+sci)/4
if kor<=100 and eng<= 100 and mat<=100 and sci<=100:
    if avg>=80:
        print('합격')
    elif avg<80:
        print('불합격')
else:
    print('잘못된 점수')

15.4

mywallet = 9000
age = int(input())
if 7<=age<=12:
    print(mywallet-650)
elif 13<=age<=18:
    print(mywallet-1050)
elif age>=19:
    print(mywallet-1250)
else:
    print('7세 이하는 입력이 안됩니다')

16.6

num = int(input())
for i in range(1,10):
    print(num,'*',i,'=',num*i)

17.6

mywallet = int(input())
while mywallet>0:
    print(mywallet)
    mywallet-=1350

18.6

start, stop = map(int, input().split())
i=start
while True:
    if 10<=i<200 and 10<=stop<200 and i>stop: break
    if (i-3)%10 == 0:
        i+=1
        continue   
    print(i,end=' ')
    i+=1

19.6

n=int(input())

for i in range(1,n+1):
    for j in range(n,i,-1):
        print(' ', end='')
    for k in range(0,i*2-1):
        print('*', end='')
    print()

20.8

num1,num2 = map(int, input().split())
for i in range(num1,num2+1):
    if i%5==0 and i%7!=0:
        print('Fizz')
    elif i%7==0 and i%5!=0:
        print('Buzz')
    elif i%5==0 and i%7==0:
        print('FizzBuzz')
    else:
        print(i)

21.6

import turtle as t

n=5
t.shape('turtle')
for i in range(n):
    t.forward(100)
    t.right(144)
    t.forward(100)
    t.left(72)
t.mainloop()