0

When i wrote it in run.py it have unexpected indent but when i wrote it in python console its working

from pip._vendor.distlib.compat import raw_input


def hello(a, b):
    if b != 0:
        wynik = a/b
        return wynik
    else:
        wynik = "No result"
        return wynik



a = raw_input('Number A:')
b = raw_input("Number B:")

    if not a is None and not b is None:
    print(hello(float(a),float(b)))
    else:
    print("A or B must be filled")

raw_input()

This is log:

C:\Users\Student\PycharmProjects\untitled>run.py
  File "C:\Users\Student\PycharmProjects\untitled\run.py", line 17
    if not a is None and not b is None:
    ^
IndentationError: unexpected indent

2 Answers2

0

Invalid indentation, replace this:

    if not a is None and not b is None:
    print(hello(float(a),float(b)))
    else:
    print("A or B must be filled")

with this:

if not a is None and not b is None:
    print(hello(float(a),float(b)))
else:
    print("A or B must be filled")
Elad Cohen
  • 453
  • 3
  • 16
0

try this way

rom pip._vendor.distlib.compat import raw_input


def hello(a, b):
    if b != 0:
        wynik = a/b
        return wynik
    else:
        wynik = "No result"
        return wynik


a = raw_input('Number A:')
b = raw_input("Number B:")

if not a is None and not b is None:
    print(hello(float(a),float(b)))
else:
    print("A or B must be filled")

raw_input()
juancarlos
  • 593
  • 3
  • 9