What is the reason from different output generate using logical 'and' and 'or' operator in Python 3.10.8

Exam Guide Publishers examguidepub at gmail.com
Thu Nov 10 10:23:42 EST 2022


On Tuesday, 8 November 2022 at 05:36:49 UTC+5:30, David wrote:
> On Tue, 8 Nov 2022 at 03:08, ICT Ezy <ict... at gmail.com> wrote: 
> 
> > Please explain how to generate different output in following logical operations 
> 
> > >>> 0 and True 
> > 0 
> > >>> 0 or True 
> > True 
> > >>> 1 and True 
> > True 
> > >>> 1 or True 
> > 1
> Hi, 
> 
> The exact explanation of how 'and' and 'or' behave can be read here: 
> https://docs.python.org/3/library/stdtypes.html#boolean-operations-and-or-not 
> The "Notes" there explain what you see.
Thank you very much, I understood Cleary.
Before I have doubt, but now clear.


More information about the Python-list mailing list