Search code examples
pythonreplit

I am a beginner Python learner and Im trying to do a question game


import math
import time

input = input("What is your name: ")
print(f"So, I understand you name is  {input}")
time.sleep(.5)
print("Let's start")
print("Would you like to do a Question game or a Truth or False?")
startquestion = int(input("type 1 for Questions 2 for T/F:  "))

if startquestion == 1:
  print("one")

The error is:

File "main.py", line 9, in

startquestion = int(input("type 1 for Questions 2 for T/F: "))

TypeError: 'str' object is not callable


Solution

  • You have a variable named input. You shouldn't do that. You can't both have a variable named input and then call the function input.

    As soon as you type input = input('What is your name'), it calls the input function, and then erases that function and overwrites it with a string.