Home
Blogs
Questions
Jobs
Monetize

Home

About Us

Blogs

Questions

Jobs

Monetize

Post Job

banner

Questions about disjunction

Read more about disjunction

python (12.9k questions)

javascript (9.2k questions)

reactjs (4.7k questions)

java (4.2k questions)

java (4.2k questions)

c# (3.5k questions)

c# (3.5k questions)

html (3.3k questions)

Questions - disjunction

Disjunction and membership in python

When I try this code: a = ['b'] if 'i' or 'j' in a: print('Yes!') else: print('No!') The output is 'Yes!'. Flake8 and python do not complain about an error or bad form. What exactly happens ...
test-img

Nils Galindo-Sjöberg

python

boolean

membership

disjunction

Votes: 0

Answers: 1

Latest Answer

The problem is that in the statement i evaluates to True, which means that the statement is then: True or 'j' in a. This is always true and your result will be always 'Yes!'. You can use something lik...
test-img

JANO

Posts

Questions

Blogs

Jobs

The ultimate platform for coders and IT specialists

About

  • Company
  • Support

  • Platform

  • Terms & Conditions
  • Privacy statement
  • Cookie policy
  • Cookie option
  • OnlyCoders © 2025  |  All rights reserved