Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple math Q
#1
// 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
Reply
#2
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?
Reply
#3
There is no operator betweec b and (c so you must be trying to call a function named b.
Reply
#4
Wall Yes, missing the '*' Wall Wall
Thank you.
Reply
#5
It is a common mistake for students. In mathematics the juxtaposition of two terms means multiplication. An explicit operator is needed in programming languages.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  math.log versus math.log10 stevendaprano 10 2,314 May-23-2022, 08:59 PM
Last Post: jefsummers
  Why getting ValueError : Math domain error in trig. function, math.asin() ? jahuja73 3 3,707 Feb-24-2021, 05:09 PM
Last Post: bowlofred

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020