+ 1

# Problems python3 with multiplication sign

I am in the first basic step of python and when I write this code: print(-7)*(-4) which as far as I understand would give the answer -28 I get this: -7 Traceback (most recent call last): File "./Playground/file0.py", line 1, in <module> print(-7)*(-4) TypeError: unsupported operand type(s) for *: 'NoneType' and 'int' What rookie mistake am I making trying to use the symbol for multiplication? I have tried both * at numbers and at the keyboard.

5 Answers

+ 3

print((-7)*(-4))
I printed the above statement..and it did not gave any error..and ans is also correct i.e. 28

+ 3

print((-7)*(-4))
Output:28
As negative number * negative number = positive number

+ 2

Ok first try to know that print is a function in python 3 so it need parenthesis print() like this but in python 2 no parenthesis was required and if you are using IDE for python3 then you must write it like print((-7)*(-4)).

+ 1

You're missing an enclosing parenthesis to bind what you want to print

0

negative*negative=positive
positiv*positive=positive
negative*positive=negative
positive*negative=negative