• Register
1 vote
52 views

Problem:

I am begginer in python programming language and I am doing a course in it. I was doing some code to practice python programing. I wrote this code while doing my practice

from __future__ import division

x = 66
y = 99
z = 33

round((x/y)*0.8*z)

But it shows an error message 

Traceback (most recent call last):
TypeError: 'int' object is not callable

Is there any problem in my code. I am using python 2.7 as my default python version . I am new so please help me.

10 7 2
6,060 points

Please log in or register to answer this question.

1 Answer

1 vote

Answer:

"TypeError 'int' or 'float' object is not callable" It probably means that you are trying to call a method when a property with the same name is available. If this is indeed the problem, the solution is easy. Simply change the method call into a property access.

In your case you may change the things

return <variable>

with

return str(<variable>)


So you should program like

from __future__ import division

x = 66
y = 99
z = 33

str(round((x/y)*0.8*z))

Hope you understand. Happy coding.

11 6 4
34,950 points

Related questions

0 votes
1 answer 18 views
18 views
Problem: Could any of you please shed some light on this: python typeerror: 'list' object is not callable .
asked Mar 15 Wafa Abu Yousef 6.1k points
2 votes
1 answer 74 views
74 views
Problem: What is TypeError: 'list' object is not callable error in python programming? Why does it happen? I was trying to working with a list in python. Suddenly, I got this error while I was trying run this below code list = [1, 2, 3] myrange = list(range(1, 10)) for num in list: if num in myrange: print(num, 'is between 1 and 10') Could any of you please shed some light on this?
asked Apr 7, 2020 Gavin 15.3k points
1 vote
1 answer 88 views
88 views
Problem: I am very noob in python programming language. To develope my skills I have been doing some coding prcatice. So, I wrote some which gives me error. The code I wrote is: for_test = "hiihihiiiiihhhi" print("The string you give is : " + str(for_test)) res = ... ')('%temp%', 'i') TypeError: 'str' object is not callable Why this error message is appearing can anyone explain.Please help me out.
asked Apr 7, 2020 LizzyM 6.1k points
1 vote
1 answer 91 views
91 views
Problem: I have a python project located at C:\Users\ASUS\Documents\OPO\aoi.py But when I try to run this project: C:\Users\ASUS\Documents\OPO\aoi.py, line 55, in __init__ self.serv = socket(AF_INET,SOCK_STREAM) TypeError: 'module' object is not callable Why am I getting this type of error message. Can anyone explain me this thing.
asked Apr 4, 2020 LizzyM 6.1k points
1 vote
2 answers 404 views
404 views
Problem: I am begginer in python programming language and I am doing a course in it. I was doing some code to practice python programing. I wrote this code while doing my practice from __future__ import division x = 6.86 y = 9.79 z = 3.03 round((x/y)*0.88*z) But it ... is not callable Is there any problem in my code. I am using python 2.7 as my default python version . I am new so please help me.
asked Apr 4, 2020 LizzyM 6.1k points
0 votes
1 answer 7 views
7 views
Problem: Getting a type error, 'tuple' object is not callable. Any idea what it could be?
asked Mar 16 ummesalma 29.2k points
0 votes
1 answer 10 views
10 views
Problem: How to fix this error: Typeerror: 'tuple' object is not callable
asked Mar 16 ummesalma 29.2k points
0 votes
1 answer 21 views
21 views
Problem: I am looking to make a loop so that for each element in the list, it will get broken down into each of it's characters. For example, say the number 137 was in the list then it would be turned into [1,3,7]. Then I want to add these numbers together (I ... it). However, I keep getting the error message TypeError: 'int' object is not iterable when I try and run this. What am I doing wrong?
asked Feb 23 Mashhoodch 13k points
0 votes
1 answer 26 views
26 views
Problem: I&rsquo;m working on the count problem, and have come up with the following code: def count(sequence, item): found = 0 for i in len(sequence): if sequence[i] == item: found = found + 1 return found
asked Jan 22 Mashhoodch 13k points
1 vote
1 answer 167 views
167 views
Problem: I am doing a course on python programming language. As a begginer I have to do a lot of programming practice and some of them are very confusing. Today I wrote a code to do some counting problems in python. The code I wrote is: def count(serial, totals): ... is not iterable What is the problem in my programm and what should I do now. Can anyone explain me this error. Thanks in advance.
asked Apr 4, 2020 LizzyM 6.1k points