Skip to content
Sign upLog in
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
3

How to fix type error in python?

727Nerd
727Nerd

A part of my code is: def TcKTcKTcK():

print(TcK)
TcKTcKTcK = input("Say yes")

if TcKTcKTcK == "yes":
print("Congratulations! You followed my instruction!")

if TcKTcKTcK == "Yes":
print("Congratulations! You followed my instruction!")

if TcKTcKTcK != "yes" and TcKTcKTcK != "Yes":
print("You failed to follow my instruction!")
print("Try again!")
TcKTcKTcK()

TcKTcKTcK()

and, when someone said no the result was...
TypeError: 'str' object is not callable.

My question is how do I fix this?

By the way, TcK is a variable from previous questions in this code.

3 years ago

Voters

Comments

TopNew
3
CodeLongAndPros
CodeLongAndPros

You are saying:
TcKTckTck is a function
TcKTckTck is now a string
Use TcKTckTck as a function, although it is a string.

3 years ago
2
SixBeeps
SixBeeps

TcKTcKTcK is a variable, not a method, so you can't put () next to it.

3 years ago
1
727Nerd
727Nerd

@SixBeeps
Thanks

3 years ago
1
PYer
PYer

Could you link a repl rather than the code? Or put the code in a code block? This will make it easier to read and test. Thank You!

3 years ago
Load more