Command & Development/Python

Python - 2

Richard.Ryu 2022. 5. 10. 09:03
반응형

1. 사칙연산

계산기 만들어 보기(if ~ elif 문)

print("*"*50)
print("1. Plus")
print("2. Minus")
print("3. Multiple")
print("4. Division")

sel=input("Press Number : ")

num1=int(input("First Number : "))

num2=int(input("Second Number : "))

print("*"*50)

if sel == "1" : print("Plus Function :%d + %d = %d" % (num1, num2, num1+num2))

elif sel == "2" : print("MinusFunction :%d - %d = %d" % (num1, num2, num1-num2))

elif sel == "3" : print("Multiple Function :%d * %d = %d" % (num1, num2, num1*num2))

elif sel == "4" : print("Division Function :%d / %d = %d" % (num1, num2, num1/num2))

else : print("Function Error")

print("="*30)
반응형

'Command & Development > Python' 카테고리의 다른 글

[Python] Lotto 번호 생성  (0) 2023.03.29
Python - 4  (0) 2022.05.12
Python - 3  (0) 2022.05.11
Python - 1  (0) 2022.05.09
Python Installation  (0) 2022.02.11