K
K
khusgsksbml2020-05-14 14:25:37
Python
khusgsksbml, 2020-05-14 14:25:37

Why is there an error and how to fix it?

x=float(input())
y=float(input())
c=input()
if c == '+':
    print (float(x+y))
if c == '-':
    print(float(x-y))
if c == '/':
    print (float(x/y)
if c == 'mod'and y!=0
    print(x%y)
          elif: 
    print ('Деление на 0!')
if c == 'pow':
    print(float(x**y))
if c == 'div':
    print(float(x//y))
else c == "*":
    print(float(x*y))


Failed test #1 of 37. Runtime error

  File "jailed_code", line 11
    print(x%y)
        ^
SyntaxError: invalid syntax

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2020-05-14
@khusgsksbml

The colon in the conditional expression is missing, the indentation is wrong.

N
Nazar Tropanets, 2020-05-14
@nazartropanets

what's with the code? it is not readable

x=float(input())
y=float(input())
c=input()
if c == '+':
    print (float(x+y))
if c == '-':
    print(float(x-y))
if c == '/':
    print (float(x/y)
if c == 'mod' and y!=0:
    print(x%y)
else: 
    print('Деление на 0!')
if c == 'pow':
    print(float(x**y))
if c == 'div':
    print(float(x//y))
else c == "*":
    print(float(x*y))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question