Computer Science, asked by Shubh1510, 9 months ago

What is the error in this python syntax:

x=int(input('Enter the First number - '))
y=int(input('Enter the Second number - '))
z=input('Enter the operator - ')

if (z==+):
print(x+y)

elif(z==-):
print(x-y)

elif(z==*):
print(x*y)

elif(z==/):
print(x/y)

elif(y==0 and z==/):
print('Enter a number other than 0 when using "/" operator')

else:
print('Error')
x=int(input('Enter the First number - '))
y=int(input('Enter the Second number - '))
z=input('Enter the operator - ')

if z==+:
print(x+y)

elif(z==-):
print(x-y)

elif(z==*):
print(x*y)

elif(z==/):
print(x/y)

elif(y==0 and z==/):
print('Enter a number other than 0 when using "/" operator')

else:
print('Error')

Answers

Answered by Anonymous
4

Answer:

x=int(input('Enter the First number - '))

y=int(input('Enter the Second number - '))

z=input('Enter the operator - ')

if (z == '+'):

 print(x+y)

elif(z == '-'):

 print(x-y)

elif(z == '*'):

 print(x*y)

elif(z == '/' and y != 0):

 print(x/y)

elif(y == 0):

 print('divide by zero!')

else:

 print('Error')

Explanation:

Answered by sharmilasalunkhe6068
0

Explanation:

What is the error in this python syntax:

x=int(input('Enter the First number - '))

y=int(input('Enter the Second number - '))

z=input('Enter the operator - ')

if (z==+):

print(x+y)

elif(z==-):

print(x-y)

elif(z==*):

print(x*y)

elif(z==/):

print(x/y)

elif(y==0 and z==/):

print('Enter a number other than 0 when using "/" operator')

else:

print('Error')

x=int(input('Enter the First number - '))

y=int(input('Enter the Second number - '))

z=input('Enter the operator - ')

if z==+:

print(x+y)

elif(z==-):

print(x-y)

elif(z==*):

print(x*y)

elif(z==/):

print(x/y)

elif(y==0 and z==/):

print('Enter a number other than 0 when using "/" operator')

else:

print('Error')

Similar questions