python if statement with AND code example

Example 1: python if statement

usrinput = input(">> ")
if usrinput == "Hello":
  print("Hi")
elif usrinput == "Bye":
  print("Bye")
else:
  print("Okay...?")

Example 2: or statement python

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

Example 3: if statement python

x=1; y=0; z=0;
if x==1 or y==0:
  if z=0 and x=1:
    print('Useless conditions satisfed!')

Example 4: if statement python

x=1; y=0; z=0;
if 1 in {x,y,z}:
  print('At least one variable is equal to 1')

Example 5: if with && in python

def front_back(a, b):
  # +++your code here+++
  if len(a) % 2 == 0 && len(b) % 2 == 0:
    return a[:(len(a)/2)] + b[:(len(b)/2)] + a[(len(a)/2):] + b[(len(b)/2):] 
  else:
    #todo! Not yet done. :P
  return