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

Question:

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

Answers:

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.

Answered By: Frank Yellin
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.