0
bird_names="kiwi, hawk, crow, penguin"  
count=0 
bird_guess=input("Guess the name of the bird that may be in the secret list.You will only get 3 
chances")  
while count<3:  
    if bird_guess.lower() in bird_names.lower():  
        print("Congrats! Correct guess!")  
        break  
   else:  
        count=count+1  
        ans = str(3 - count)

The statement mentioned below contains some sort of problem which I am unable to understand:

bird_guess=input("Wrong guess! Try again! Only",ans,"chances are left!")  

It shows TypeError, saying that raw_input() takes from 1 to 2 positional arguments but 4 were given.

0

1 Answer 1

1

Looks like you're trying to do string concatenation, change your input to:

bird_guess=input("Wrong guess! Try again! Only " + str(ans) + " chances are left!") 

or you can use string interpolation like so

bird_guess=input(f"Wrong guess! Try again! Only {ans} chances are left!")
Sign up to request clarification or add additional context in comments.

2 Comments

I have already tried your first suggestion but the same error keeps on displaying.
You're probably doing the same thing somewhere else in your code, check all of your inputs and their respective strings

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.