Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9077413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:21:33+00:00 2026-06-16T19:21:33+00:00

name = raw_input(Welcome soldier. What is your name? ) print(‘Ok,’, name, ‘ we need

  • 0
name = raw_input("Welcome soldier. What is your name? ")
print('Ok,', name, ' we need your help.')
print("Do you want to help us? (Yes/No) ")
ans = raw_input().lower()

while True:
    ans = raw_input().lower()("This is one of those times when only Yes/No will do!" "\n"  "So what will it be? Yes? No?")

    ans = raw_input().lower()
    if ans() == 'yes' or 'no':
        break
    if ans == "yes":
        print ("Good!")
    elif ans == "no":
        print("I guess I was wrong about you..." '\n' "Game over.")

When I answer this happens;

First a blank line, then if I press the enter key again;

  File "test.py", line 11, in <module>
    ans = raw_input().lower()("This is one of these times when only Yes/No will
do!" "\n" "So what will it be? Yes? No?")
TypeError: 'str' object is not callable

What seams to be the problem?

P.S I searched the site but it seams that all the people with the same problem had far more advanced scripts and I did not understand anything.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T19:21:35+00:00Added an answer on June 16, 2026 at 7:21 pm

    The first error is in the line

    ans = raw_input().lower()("This is one of those times when only Yes/No will do!"
                              "\n"  "So what will it be? Yes? No?")
    

    The result of lower() is a string, and parentheses after that mean that the object on the left (the string) gets called. Therefore, you get your error. You want

    ans = raw_input("This is one of those times when only Yes/No will do!\n"
                    "So what will it be? Yes? No?").lower()
    

    Also,

    if ans() == 'yes' or 'no':
    

    does not what you expect. Again, ans is a string, and parentheses mean that the object on the left (the string) gets called. Therefore, you get your error.

    Also, or is a logical operator. Even after removing the parentheses after ans, the code gets evaluated as:

    if (ans == 'yes') or ('no'):
    

    Since a non-empty string ('no') evaluates to the boolean value True, this expression is always True. You simply want

    if ans in ('yes', 'no'):
    

    Additionally, you want to unindent the last lines. All in all, try:

    name = raw_input("Welcome soldier. What is your name? ")
    print('Ok, ' + name + ' we need your help.')
    ans = raw_input("Do you want to help us? (Yes/No)").lower()
    while True:
        if ans in ('yes', 'no'):
            break
        print("This is one of those times when only Yes/No will do!\n")
        ans = raw_input("So what will it be? Yes? No?").lower()
    
    if ans == "yes":
        print("Good!")
    elif ans == "no":
        print("I guess I was wrong about you..." '\n' "Game over.")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

def ask(): global name, loca print What's your name? name = raw_input('> ') print
Which name need the sql-file in the sql folder? When I want to load
Right now, here is my code: name = raw_input(Please enter your name: ) nameList
keepProgramRunning = True while keepProgramRunning: print Welcome to the Calculator! print Please choose what
def askme(answers): question = raw_input(Do you want to see my name, age or favorite
Name: <%= Html.TextBox(txtName, 20, new { @class = hello }) %> I want that
var name = 'Mike'; var person = { name: 'John', welcome: function(){ var name
In Python 2: raw_input() In Python 3, I get an error: NameError: name 'raw_input'
I'm currently learning the basics in Python, and I need to create a name
result = raw_input(Enter results file: ) while True: try: result = get_marks_from_file(result) break except

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.