Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

number 1 = int ( input ( Enter first integer ) ) number 2 = int ( input ( Enter second integer )

number1= int(input("Enter first integer"))
number2= int(input("Enter second integer"))
operator = input("Enter operator (+-*/)")
if (operator =='+'):
result = number1+ number2
print(f'{number1}{operator}{number2}={result}')
elif (operator =='-'):
result = number1- number2
print(f'{number1}{operator}{number2}={result}')
elif (operator =='*'):
result = number1* number2
print(f'{number1}{operator}{number2}={result}')
elif (operator =='/'):
result = number1/ number2
if number2!=0:
print('ERROR: Cannot divide by zero')
else:
print(f'{number1}{operator}{number2}={result}')
else:
print(f'{number1}{operator}{number2}= ERROR: Illegal Operation') i keep getting syntax error for else under cannot divide by zero

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

Students also viewed these Databases questions

Question

1.. Describe the building blocks for managing capacity and demand.

Answered: 1 week ago

Question

Problem: Evaluate the integral: I = 1- 1 dx 9

Answered: 1 week ago

Question

Describe the Indian constitution and political system.

Answered: 1 week ago

Question

Explain in detail the developing and developed economy of India

Answered: 1 week ago

Question

Problem: Evaluate the integral: I = X 52+7 - 1)(x+2) dx

Answered: 1 week ago