made a calculator

작성자

카테고리:

← 피드로
DEV Community · Mashad-pixel · 2026-06-30 개발(SW)

Mashad-pixel

num1 = float(input(“enter a number :”))
symb = input(“enter (+,-,*,/) :”)
num2 = float(input(“enter a number :”))

if symb == “+”:
print(“Answer =”,num1+num2)
elif symb == “-“:
print(“Answer =”,num1-num2)
elif symb == “*”:
print(“Answer =”,num1*num2)
elif symb == “/”:
if num2 != 0: #not to get an infinite loop as anything divided by zero is not defined
print(“Answer =”,num1/num2)
else:
print(“Not defined as the num1 is divided by zero”)
else:
print(“invalid symb”)

print()
print(“Calculate anything else, I’m thee for you”)

Top comments (0)

Subscribe

Code of ConductReport abuse

For further actions, you may consider blocking this person and/or reporting abuse

원문에서 계속 ↗

추출 본문 · 출처: dev.to · https://dev.to/mashadpixel/made-a-calculator-512

코멘트

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다