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 8833095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:41:48+00:00 2026-06-14T08:41:48+00:00

In the multiple choice question I’m stucked in, there are three options. Here goes

  • 0

In the multiple choice question I’m stucked in, there are three options.
Here goes the question:

Which of the following is a definition of the _str_method?

1. def __str__(self):
      print "(%s, %s, %s)" % (self._n, self._p, self._b)

2. def __str__(self):
      return "(%s, %s, %s)" % (self._n, self._p, self._b)

3. Both

I tested both of them, and both worked, but it is said that (2) is the answer.

The answers of all other similar questions also say that the function with ‘print’ is not the right one.

Is the answer wrong?

Thanks

  • 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-14T08:41:50+00:00Added an answer on June 14, 2026 at 8:41 am

    From the official documentation (emphasis mine):

    object.__str__(self)

    Called by the str() built-in function and by the print statement to compute the “informal” string representation of an object. This differs from __repr__() in that it does not have to be a valid Python expression: a more convenient or concise representation may be used instead. The return value must be a string object.

    As the first version does not return a string object, it must be wrong.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The question is to consider the following function definition: def read_value_type(prompt='Enter a Boolean> ',
i have created a multiple choice question .it hav 3 options in a custom
I'm creating a simple JavaScript multiple choice game. Here is a sample question: p
I have a multiple choice question about memory allocation C, but I'm sure which
Take for example a multiple choice question game. You have a MathQuestion and WordQuestion
I have a little multiple choice application. There are 4 green check marks and
I am building a multiple choice exam, which is better, to store each choice
I'm trying to create a single multiple choice question. In the example below, I
I have a webapp where my employees take quizes(Multiple choice question) .I have to
I really need an immediate with Javascript. I created a multiple choice question quiz

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.