# 대화창 만들기
"""
print("안녕하세요?")
name = input("이름을 말해주세요. ")
age = input("나이는 어떻게 되시나요? ")
print()

print("입력하신 정보는 \n이름은 {}, 나이는 {}입니다." .format(name, age))
print()

reply = input("맞으면 '예', 틀리면 '아니오'라고 입력해주세요. ")

if reply == "예":
    print("반갑습니다. {}씨 !!".format(name))
else :
    print('잘못된 정보입니다. ')
"""

# 온도 계산기
"""
celsius = int(input("섭씨 온도를 입력하세요 : "))
fahrenheit = (9/5) * celsius + 32

print("섭씨 {}도는 화씨 {:.0f}도입니다.".format(celsius, fahrenheit))
"""

# 몫과 나머지 계산
"""
print("두 개의 정수를 입력하세요.")

a = int(input())
b = int(input())

print("{} / {} 의 몫은 {}".format(a,b,a//b))
print("{} / {} 의 나머지는 {}".format(a,b,a%b))
"""

# 소금물의 농도 구하기
"""
print("소금물의 농도를 구하는 프로그램입니다.")

salt = float(input("소금의 양은 몇 g입니까? "))
water = float(input("물의 양은 몇 g입니까? "))

concentration = salt / (salt + water) * 100

print("소금물의 농도: {}".format(concentration))
"""

# BMI 구하기
"""
print("BMI를 구하는 프로그램입니다.")

a = input(" 계속하려면 아무키나 누르세요...")

height = float(input("키(cm) : "))
weight = float(input("몸무게(kg) : "))

BMI = weight/(height*0.01)**2

print("당신의 BMI : {:.2f}".format(BMI))
"""

# 성적처리 결과 출력하기
"""
name = input()
kor, math, music = int(input()),int(input()),int(input())
avg = (kor + math + music) / 3

print('\n"%s"님 성적 처리 결과입니다' % name)
print('-' * 30)
print('%s\t%s\t%s'%(" 과목","점수", "평균과의 차이"))
print('-' * 30)
print('국어 :{}  {:+5.1f}'.format(kor,kor-avg))
print('수학 :{}  {:5.1f}'.format(math,math-avg))
print('음악 :{}  {:5.1f}'.format(music,music-avg))
print('-' * 30)
print('평균 >> %5.1f' % avg)
"""

# 다항함수의 결과를 구하는 프로그램
"""
x, fx = 0, 0

x = int(input("x의 값을 입력하세요 : "))

fx = x**5-4*x**2-2*x+1/13
print("f({}) = {:.2f}".format(x, fx))
"""

# 동전 교환 프로그램
"""
w500, w100, w50, w10 = 0, 0, 0, 0

money = int(input("교환할 돈은 얼마?"))

w500 = money // 500
w100 = (money - 500*w500) // 100
w50 = (money - 500*w500 - 100*w100) // 50
w10 = (money - 500*w500 - 100*w100 - 50*w50) // 10
a = money % 10

print("500원의 개수: {}개\n100원의 개수: {}개\n50원의 개수: {}개\n10원의 개수: {}개\n바꾸지 못한 잔돈: {}원".format(w500,w100,w50,w10,a))
"""

# 윤년 계산 프로그램
"""
year = int(input("연도를 입력하세요 : "))

if year % 4 == 0 and year % 100 != 0:
    print("{}년은 윤년입니다.".format(year))

elif year % 400 == 0:
    print("{}년은 윤년입니다.".format(year))

else:
    print("{}년은 윤년이 아닙니다.".format(year))
"""

# 간단한 산술 계산기 프로그램
"""
x, y, op = 0, 0, ''

x = int(input("첫 번째 수를 입력하세요: "))
op = input("계산할 연산자를 입력하세요: ")
y = int(input("두 번째 수를 입력하세요: "))

if op == "+":
    total = x + y
    print("{} {} {} = {} 입니다.".format(x,op,y,total))

elif op == "-":
    total = x - y
    print("{} {} {} = {} 입니다.".format(x,op,y,total))

elif op == "*":
    total = x * y
    print("{} {} {} = {} 입니다.".format(x,op,y,total))

elif op == "/":
    total = x / y
    print("{} {} {} = {:.2f} 입니다.".format(x,op,y,total))
    
elif op == "%":
    total = x % y
    print("{} {} {} = {} 입니다.".format(x,op,y,total))

elif op == "//":
    total = x // y
    print("{} {} {} = {} 입니다.".format(x,op,y,total))

elif op == "**":
    total = x ** y
    print("{} {} {} = {} 입니다.".format(x,op,y,total))

else:
    print("알 수 없는 연산자입니다.")
"""

# 두 점 사이의 거리 구하기
"""
x1 = int(input("x1:"))
y1 = int(input("y1:"))
x2 = int(input("x2:"))
y2 = int(input("y2:"))

distance = ((x1-x2)**2 + (y1-y2)**2)**0.5

print("두 점 사이의 거리= {:.2f}".format(distance))
"""

# 놀이공원 입장료 구하기
"""
fee = 30000
age = int(input("나이 입력: "))

if age < 8:
    print("입장료는 무료입니다.")

elif age < 15 and age >= 8:
    print("입장료는 {}원입니다.".format(int(fee-fee*0.2)))

elif age >= 65:
    print("입장료는 {}원입니다.".format(int(fee-fee*0.5)))

else:
    print("입장료는 {}원입니다.".format(fee))
"""

# 합격 또는 불합격 표현하기
"""
first, second, interview, avg = 0, 0, 0, 0

first = int(input('1차 점수는?'))
second = int(input('2차 점수는?'))
interview = int(input('면접 점수는?'))

avg = (first + second + interview) / 3

if avg >= 80 and first >= 60 and second >= 60 and interview >= 60:
    print("축하합니다. 합격입니다.")

else:
    print('불합격입니다.')
"""

# 계절 출력하기
"""
month, season = 0, ''
month = int(input("월 입력 : "))

if month >= 3 or month <= 5:
    season = '봄'

elif month >= 6 or month <= 8:
    season = '여름'

elif month >= 9 or month <= 11:
    season = '가을'
    
elif month == 12 or month == 1 or month == 2:
    season = '겨울'

else:
    print("잘못된 월입니다.")

if month >= 1 and month < 12:
    print("{}월은 {}입니다.".format(month,season))
"""

# 자연수에서 n의 배수 출력하기
"""
cnt = 0
n = 1

while n < 100:
    if n % 7 == 0:
        print("%2d"%n, end = " ")
        n = n + 1
        cnt = cnt + 1
        if cnt % 5 == 0:
            print()

    else:
        n = n + 1
        pass

print("\n")
print("100 미만의 7의 배수는 {}개".format(cnt))
"""

# 조건이 참인 동안 반복하기
"""
count, height = 0, 0

while count != 10:
    height = float(input("키는? "))

    if height >= 140:
        count = count + 1
        print("Yes~")

    else:
        print("No~")

print("Go~ 출발합니다!")
"""

 

+ Recent posts