Python Forum
Simple math Q - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Simple math Q (/thread-31198.html)



Simple math Q - ebolisa - Nov-27-2020

// answer = 60/5(7-5) =?6 ?24
a = 60
b = 5
c = 7
d = 5

res = a / b (c - d)

print(res)
Quote:Traceback (most recent call last):
File "C:/SharedFiles/Python/practice/temp.py", line 6, in <module>
res = a / b (c - d)
TypeError: 'int' object is not callable

What's up with this simple ecuation?
TIA


RE: Simple math Q - ndc85430 - Nov-27-2020

Well, what you've written suggests you're trying to useb as a function, i.e b(c - d) is interpreted as a function call. Did you mean to do a multiplication?


RE: Simple math Q - deanhystad - Nov-27-2020

There is no operator betweec b and (c so you must be trying to call a function named b.


RE: Simple math Q - ebolisa - Nov-27-2020

Wall Yes, missing the '*' Wall Wall
Thank you.


RE: Simple math Q - Gribouillis - Nov-27-2020

It is a common mistake for students. In mathematics the juxtaposition of two terms means multiplication. An explicit operator is needed in programming languages.