+ 1
What's the reason for something being 'not callable'? Thanks
Not callable' error
8 ответов
+ 4
Emma Cooke
1 - There should be x < 4 since there are only 4 inputs
2 - there should be sum = sum + 10 and sum = sum - 20,
print is a function but you used as a variable, there should be sum instead of print
3 - remove sum += x
+ 1
Hi Emma!
That's because you assigned variable print = 10 & print = -20
Then you wrote print(sum).
That is interpreted as meaning a function call on the object bound to print, which is an int. And that fails.
The problem is code binds an int to the print since you used it as a variable name. You can change it as sum instead.
Also, your code needs input() function to take inputs. But you're missing it too.
+ 1
Seems like your problem isn't solved yet. You can understand your mistakes from here.
This should work
sum = 100
x = 0
while x < 4:
a = input()
if a == ("hit"):
sum += 10
elif a == ("miss"):
sum -= 20
x += 1
print(sum)
+ 1
Thank you! Yes that worked.
0
Yes
0
This is my code.
sum = 100
x = 0
while x <= 4:
sum += x
if x == ("hit"):
print = 10
elif x == ("miss"):
print = -20
x += 1
print(sum)
Where do you want me to put the print(x())? I've tried double brackets with the sum. Is that what you meant?
0
The error is on line 11 (last line). I don't know how to make my code public or DM someone. Thanks for all the advice so far.
- 2
LIKE ,SHARE AND REPLY 😊🤗 https://code.sololearn.com/WxA7X279c8yM/?ref=app