???

Answered

My code:

import random
k = random .randint(1,100)
while True:
n = int(input('Make a guess: '))
if n == k:
'#count(#Make a guess'
print("Bravo! You did it in" (print('#Numbers of ("Make a guess")')))
break
elif n < k:
print('Too small')
else:
print('Too large')

Error:
Traceback (most recent call last):
File "C:/Users/Xudong/Desktop/python/guess_number.py", line 7, in <module>
print("Bravo! You did it in" (print('#Numbers of ("Make a guess")')))
TypeError: 'str' object is not callable

2 comments

Don't  know how to solve it :(

-1

Hi,

If you run this code in the system terminal (outside of PyCharm), you will see the same error. It means that it is not related to PyCharm.

Tip: functions are callable, strings are not

1

Please sign in to leave a comment.