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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:29:25+00:00 2026-06-06T10:29:25+00:00

I had a doubt on comparision operator in python. I would like to know

  • 0

I had a doubt on comparision operator in python. I would like to know if it’s right or wrong.

I have certain output that is assigned to a variable. So let’s say:

result1, result2, result3

Now I do a comparison like

if result1 == 0 and result2 == 0 and result3 == 0: 
    print "Success "
else:
    print "failure"

My doubt is can this comparison done in this format

if 0 in (result1 , result2 ,result3):
    print "Success"
else :
    print "failure"

Is this right using Python? If not, then what’s the reason?

  • 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-06T10:29:26+00:00Added an answer on June 6, 2026 at 10:29 am
    if 0 in (result1, result2, result3):
    

    is equivalent to:

    if result1==0 or result2==0 or result3==0:
    

    What you want is this:

    if (0,0,0) == (result1, result2, result3):
    

    Which is equivalent to:

    if result1==0 and result2==0 and result3==0:
    

    You could actually even do this:

    if result1==result2==result3==0:
    

    since you’re checking to see if all 3 variables equal the same thing.

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

Sidebar

Related Questions

I have a little doubt, I want to create a table that had a
I had a doubt that can we have Checkbox in Dropdown in Oracle Forms?
I doubt this is possible but what I would like to do is have
I had this doubt for sometime now, some people say that there's no such
Had a problem with the recursive conflictCheck() method. That seems fine now. I have
This is a simple and basics but I had a doubt that if it
I have had this doubt for a long time . I download a project
I heard that AJAX use xml concept. But I had some doubt that whether
I have a general doubt about how to design Android apps that use a
I have a website that started with ASP.NET and over time has had some

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.