Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

or statement python

if x==1 or y==1:
  print(x,y)
Comment

python or

x = 1
y = 10

if x%2 == 0 or y%2 == 0:
  print(x%2)
  
#Output#
#1
Comment

python or

# If a is truthy,
# returns a, otherwise b

# Use bool(<value>) to know whether a value
# is truthy or falsy

#  a  b | True | False
# -------+------+-------
#  True  | a    | a
# -------+------+-------
#  False | b    | b

print(True or True) # True
print(True or False) # True
print(False or False) # False

print(1 or 0) # 1 is truthy -> 1
print([] or {}) # [] is falsy -> {}
print([] or {} or ()) # "([] or {}) or ()" -> "{} or ()" -> "()"
print([1, 2] or (3, 4)) # [1, 2] is true -> [1, 2]
Comment

If or Python

x = 1; y = 1

if x == 1 or y == 1:
  print(x, y)
# 1 1
Comment

PREVIOUS NEXT
Code Example
Python :: python possible combinations 
Python :: python add one month to a date 
Python :: read clipboard python 
Python :: AttributeError: ‘numpy.ndarray’ object has no attribute ‘append’ 
Python :: make a condition statement on column pandas 
Python :: create panda dataframe 
Python :: Program to Compute LCM 
Python :: how to calculate fibonacci numbers in python 
Python :: django meta attributes 
Python :: beautiful soap python get the link online 
Python :: make widget span window width tkinter 
Python :: select python 
Python :: graph a line from dataframe values over a bar plot in python 
Python :: how to make a nice login django form 
Python :: split stringg to columns python 
Python :: python @property 
Python :: python command as an administrator 
Python :: how to have player input in python 
Python :: python cv2 write to video 
Python :: exclude serializer 
Python :: save model pytorch 
Python :: Simple Splash screen in pyqt5 
Python :: time df.apply() python 
Python :: python get 2d array output as matrix 
Python :: beautifulsoup usage 
Python :: python bytes 
Python :: find length of string in python 
Python :: split and only grab first part of string 
Python :: record audio with processing python 
Python :: taille du liste python 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =