Timmy & Sarah think they are in love, but around where they live, they will only know once they pick a flower each. If one of the flowers has an even number of petals and the other has an odd number of petals it means they are in love. 

Write a function that will take the number of petals of each flower and return true if they are in love and false if they aren't.

Difficulty: introductory

Starter code:

def lovefunc( flower1, flower2 ):
	

Solutions:
def lovefunc( flower1, flower2 ):
    return (flower1+flower2)%2

def lovefunc(flower1, flower2):
    return flower1 % 2 != flower2 % 2

def lovefunc( flower1, flower2 ):
    return (flower1 + flower2) % 2 == 1

def lovefunc(a, b):
    if a % 2 == 0 and b % 2 == 0:
        return False
    elif a % 2 != 0 and b % 2 == 0:
        return True
    elif a % 2 == 0 and b % 2 != 0:
        return True
    else:
        return False

lovefunc=lambda a,b:(a+b)%2

def lovefunc( flower1, flower2 ):
    return bool((flower1+flower2)%2)

def lovefunc(f1, f2):
    return True if (f1 % 2 == 0 and f2 % 2 != 0) or (f2 % 2 == 0 and f1 % 2 != 0) else False

def lovefunc( flower1, flower2 ):
    if all([isinstance(i, int) for i in [flower1,flower2]]):
        return not ((flower1+flower2)%2 == 0) # only the sum of odd and even can be odd, that is love:)
    else:
        print('both of the numbers must be integers!')

def lovefunc( flower1, flower2 ):
    if (flower1 % 2 == 0 and flower2 % 2) or (flower1 % 2 and flower2 % 2 == 0):
        return True
    else:
        return False

def lovefunc( flower1, flower2 ):
    return True if (flower1 % 2 == 0 and flower2 % 2 != 0) or (flower2 % 2 == 0 and flower1 % 2 != 0) else False

def lovefunc( flower1, flower2 ):
    return (flower1 + flower2)%2 != 0

def lovefunc( flower1, flower2 ):
    if flower1%2 != flower2%2:
        return True
    else:
        return False

def lovefunc(a, b):
    return a % 2 ^ b % 2

def lovefunc( flower1, flower2 ):
  return ((flower1 ^ flower2) & 1) == 1

def lovefunc( flower1, flower2 ):
    return (flower1 - flower2) % 2 == 1

lovefunc = lambda f, s: (f + s) % 2

lovefunc = lambda a,b: bool((a+b)%2)

def lovefunc(*arg):
    return sum(arg)%2

lovefunc = lambda a, b: a % 2 ^ b % 2

lovefunc = lambda a, b: (a ^ b) & 1

def lovefunc( flower1, flower2 ):
    return (flower1 ^ flower2)%2

from typing import Tuple

def lovefunc(*flowers: Tuple[int]) -> bool:
    """ Are Timmy & Sarah in love? """
    return len(list(filter(lambda _it: _it % 2, flowers))) == 1

lovefunc = lambda x, y: x&1^y&1

def lovefunc(seq, elem):
    return( (seq%2==0 and elem%2!=0) or (seq%2!=0 and elem%2==0))

def lovefunc( flower1, flower2 ):
    return False if flower1 and flower2 == 0 or (flower1+flower2)%2 == 0 else True

lovefunc = lambda x, y: x % 2 != y % 2

def lovefunc( flower1, flower2 ):
    return (flower1 + flower2) & 1# ...

def lovefunc( flower1, flower2 ):
    return False if (flower1 + flower2) % 2 == 0 else True


def lovefunc( flower1, flower2 ):
    # ...
    if(flower1%2!=0 or flower2%2!=0):
        return True
    elif(flower1%2!=0 and flower2%2!=0):
        return False
    else:
        return False

def lovefunc( flower1, flower2 ):
    
    if flower1 % 2 == 0 and flower2 % 2 != 0:
        return True
    elif flower2 % 2 == 0 and flower1 % 2 != 0:
        return True
    elif flower1 % 2 == 0 and flower2 % 2 == 0:
        return False
    else:
        return False

def lovefunc( flower1, flower2 ):
    even_odd = []
    if flower1 % 2 == 0:
        even_odd.append("even")
    else:
        even_odd.append("odd")
    if flower2 % 2 == 0:
        even_odd.append("even")
    else:
        even_odd.append("odd")
    
    return even_odd.count("odd") == 1

def lovefunc( flower1, flower2 ):
    a = lambda x, y: True if (x%2 == 0 and y%2 == 1) or (x%2==1 and y%2==0) else False
    return a(flower1, flower2)

def lovefunc(f,f1):
     if f%2==0 and f1%2!=0:
        return True  
     return True if f%2!=0 and f1%2==0 else False


def lovefunc( flower1, flower2 ):
    if flower1 %2==1 and flower2 %2==1:
        return False
    elif flower1 %2==0 and flower2 %2==0:
        return False
    else:
        return True

def lovefunc( flower1, flower2 ):
    if flower1 % 2 == 0 and flower2 % 2:
        return True
    elif flower1 % 2 and flower2 % 2 == 0:
        return True
    else:
        return False


def lovefunc( flower1, flower2 ):
    x = flower1 % 2
    y = flower2 % 2
    return True if x + y == 1 else False

lovefunc = lambda a,b:(b-a)&1

def lovefunc( flower1, flower2 ):
    return flower1%2!=0 and flower2%2==0 or flower2%2!=0 and flower1%2==0

def lovefunc( flower1, flower2 ):
    petal1 = flower1 % 2
    petal2 = flower2 % 2
    if petal1 == 0 and petal2 > 0:
        return True
    if petal1 > 0 and petal2 == 0:
        return True
    if petal1 == 0 and petal2 == 0:
        return False
    if petal1 > 0 and petal2 > 0:
        return False

def lovefunc( flower1, flower2 ):
    if flower1%2==flower2%2==0:
        return False
    elif flower1%2==flower2%2==1:
        return False
    else:
        return True

def lovefunc( flower1, flower2 ):
    return not ((flower1 % 2 == 0 and flower2 % 2 == 0) or \
        (flower1 % 2 != 0 and flower2 % 2 != 0))

def lovefunc( flower1, flower2 ):
    if flower1 % 2 == 0:
        return True if flower2 % 2 > 0 else False
    else:
        return True if flower2 % 2 == 0 else False

def lovefunc( flower1, flower2 ):
    def even(x):
        return x % 2 == 0
    
    a = even(flower1)
    b = even(flower2)
    return (a and not b) or (b and not a)

def lovefunc( f1, f2 ):
    return not(f1 % 2 == 0 and f2 % 2 == 0 or  f1 % 2 != 0 and f2 % 2 != 0)

def lovefunc( flower1, flower2 ):
    if (flower1 %2 ==1 and flower2 %2 ==0) or (flower2 %2 ==1 and flower1 %2 ==0):
        return True
    return False

def lovefunc( flower1, flower2 ):
    if flower1%2>0 and flower2%2==0:
        return True
    elif flower1%2==0 and flower2%2>0:
        return True
    else:
        return False

def lovefunc( flower1, flower2 ):
    if flower1%2==flower2%2==0:
        return False
    elif flower1%2!=0 and flower2%2!=0:
        return False
    else: 
        return True# ...

def lovefunc( flower1, flower2 ):
    if flower1 % 2 == 1 and flower2 %2 == 1 or flower1 % 2 == 0 and flower2 % 2 == 0:
        return False
    return True


def lovefunc( flower1, flower2 ):
    flower_1 = flower1 / 2
    flower_2 = flower2 / 2
    if flower1 == flower2:
        return False
    elif flower_1 + flower_2 == int(flower_1 + flower_2):
        return False
    else:
        return True

def lovefunc( flower1, flower2 ):
    return (flower1%2==0) == (flower2%2!=0)


def lovefunc( flower1, flower2 ):
    if flower1 == flower2 or flower1 % 2 == 0 and flower2 % 2 == 0 or flower1 % 2 != 0 and flower2 % 2 != 0:
        return False
    else:
        return True

def lovefunc(f1, f2):
    return (f1 % 2 + f2 % 2) % 2 == 1

def lovefunc(f1,f2):
    return True if abs(f1-f2) % 2 == 1 else False 

def lovefunc( flower1, flower2 ):
    if flower1 % 2 and not flower2 % 2 or not flower1 % 2 and flower2 % 2:
        return True
    else:
        return False

def lovefunc( flower1, flower2 ):
    count1 =0
    count2 = 0
    for i in range(flower1):
        count1+=1
    for j in range(flower2):
        count2+=1
    if count1 % 2 == 1 and count2 % 2 == 0 or count1 % 2 == 0 and count2 % 2 == 1:
        return True
    else:
        return False
    


def lovefunc( f1, f2 ):
    return (abs(f1-f2))%2 != 0

def lovefunc( flower1, flower2 ):
    print(flower1, flower2)
    if flower1 % 2 == 0 and flower2 % 2 != 0:
        return True
    if flower1 % 2 != 0 and flower2 % 2 == 0:
        return True
    return False

def lovefunc( flower1, flower2 ):
    if flower1 == 0 and flower2 == 0:
        return False
    elif flower1 % 2 == 0 and flower2 % 2 != 0:
        return True
    elif flower2 % 2 == 0 and flower1 % 2 != 0:
        return True
    else:
        return False

def lovefunc( flower1, flower2 ):
    if (flower2 - flower1) % 2 == 0:
        return False
    else:
        return True

def lovefunc( flower1, flower2 ):
    '''
    Write a function that will take the number of petals of each flower
    and return true if they are in love and false if they aren't.
    '''
    return flower1 % 2 != flower2 % 2

def lovefunc( flower1, flower2 ):
    if (flower2%2) == 0 and (flower1%2) == 1:
        return True
    elif (flower1%2) == 0 and (flower2%2) == 1:
        return True
    else:
        return False

def lovefunc( flower1, flower2 ):
    return all([any([flower1 % 2 == 0, flower2 % 2 == 0]), any([flower1 % 2 == 1, flower2 % 2 == 1])])

def lovefunc( flower1, flower2 ):
    remainder1 = flower1 % 2
    remainder2 = flower2 % 2
    if remainder1 != remainder2:
        return True
    else:
        return False


def lovefunc( flower1, flower2 ):
    odd = False
    even = False
    
    if flower1%2 == 0:
        even = True
    elif flower1%2 != 0:
        odd = True
        
    if flower2%2 == 0:
        even = True
    elif flower2%2 != 0:
        odd = True
    
    if odd is True and even is True:
        return True
    return False

def lovefunc( flower1, flower2 ):
    if abs(flower1 - flower2) % 2 != 0:
        return True
    return False

def lovefunc(x,s):
    return x%2!=s%2

def lovefunc( flower1, flower2 ):
    odd1 = flower1 % 2
    odd2 = flower2 % 2
    
    if (odd1 or odd2) and not (odd1 and odd2):
        return True
    else:
        return False

def lovefunc( flower1, flower2 ):
    return bool(flower1 % 2 and not flower2 % 2 or flower2 % 2 and not flower1 % 2)

def lovefunc( flower1, flower2 ):
    # ...
    if flower1%2==1 and flower2%2==1:
        return True
    elif flower1%2==0 and flower2%2==0:
        return False
    else:
        return True

def lovefunc(f1, f2):
    i = f1 + f2
    if i % 2 == 0:
        return False
    else:
        return True

def lovefunc( flower1, flower2 ):
    """ Straight Up Now Tell Me"""
    return ( flower1 + flower2 ) % 2

def lovefunc( flower1, flower2 ):
      if flower1%2 and not flower2%2: return True
      elif not flower1%2 and flower2%2 : return True
      return False

def lovefunc( flower1, flower2 ):
    if (flower1 + flower2) % 2 != 0:
        return True
    elif (flower1 + flower2) % 2 == 0 or flower1 + flower2 == 0:
        return False

def lovefunc( flower1, flower2 ):
    if flower1 % 2 == 0 and flower2 % 2 != 0 or \
    flower1 % 2 != 0 and flower2 % 2 == 0:
        return True
    return False

def lovefunc( flower1, flower2 ):
    f1 = int(flower1)
    f2 = int(flower2)
    if f1 % 2 == 0 and f2 % 2 == 0:
        return False
    elif f1 % 2 != 0 and f2 % 2 != 0:
        return False
    else: 
        return True

def lovefunc( flower1, flower2 ):
    if (flower1 - flower2) % 2 == 1:
        return True
    else:
        return False

def lovefunc( flowers1, flowers2 ):
    return (flowers1 + flowers2) % 2 != 0

# codewars 

def lovefunc( flower1, flower2 ):
    if flower1 % 2 == 0 and flower2 % 2 != 0 or flower2 % 2 == 0 and flower1 % 2 != 0 :
        return True
    else:
        return False


def lovefunc( f1, f2 ):
    return sum([f1,f2]) % 2

def lovefunc( flower1, flower2 ):
    if flower1 % 2 ==0 and flower2 % 2 !=0 :
        return True
    elif flower1 % 2 ==0 and flower2 % 2 ==0 :
        return False
    elif flower1 % 2 !=0 and flower2 % 2 !=0:
        return False
    return True

def lovefunc( f1, f2 ):
    if f1 % 2 == 0 and f2 % 2 != 0:
        return True
    if f2 % 2 == 0 and f1 % 2 != 0:
        return True
    else:
        return False


#since 1 is truthy and 0 is falsey
#sample data - (1,4)
#1+4 = 5
#5%2 = 1 = true
def lovefunc( flower1, flower2 ):
    return (flower1+flower2)%2

#sample data (2,2)
#flower1 % 2 = even
#flower2 % 2 = even
#even != even is false

#(1,4)
#flower1 % 2 = odd
#flower2 % 2 = even
#odd != even is true

def lovefunc(flower1, flower2):
    return flower1 % 2 != flower2 % 2

#input - two integers represting flower petals
#output - boolean
#edge cases - string given, no input given, decimals/flaots given
#assumptions - solve by comparing first integer to second integer, same number is False
#data types - integers
#end goal - function returns True if one of the flowers has an odd number of petals
#and the other has an even number, else False

#sample data (1,4) = True
#(6,8) = False
#("4",7) = False
#(3.4,8) = True

#function takes flower1 and flower2
def lovefunc(flower1, flower2):
#check if flower1 and flower2 are both even
  if flower1 % 2 == 0 and flower2 % 2 == 0:
#if they are even, return false
      return False
#check if both flowers are odd
  elif flower1 % 2 != 0 and flower2 % 2 != 0:
#if they are odd, return false
      return False
#return True if you have one odd and one even 
  else:
      return True


def lovefunc( flower1, flower2 ):
    return (flower1 + flower2) % 2 == 1 if (flower1 + flower2) != 0 else False

lovefunc = lambda flower1, flower2: (flower1 + flower2) % 2

def lovefunc( flower1, flower2 ):
    x = flower1 % 2 == 0 and flower2 % 2 == 1
    y = flower2 % 2 == 0 and flower1 % 2 == 1
    return True if x or y else False

def lovefunc( flower1, flower2 ):
    # ...
      if (flower1%2!=0 and flower2%2==0) or(flower1%2==0 and flower2%2!=0):  return True
      if (flower1%2==0 and flower2%2==0)or (flower1%2!=0 and flower2%2!=0):return False

def lovefunc( flower1, flower2 ):
    return flower1 % 2 == 0 and flower2 % 2 == 1 or flower2 % 2 == 0 and flower1 % 2

lovefunc = lambda flower1, flower2: not((flower1 % 2) ^ (not flower2 % 2))

def lovefunc( f, ff ):
    return True if (f+ff)%2==1 else False

def lovefunc(f1, f2):
    return f1%2==0 and f2%2!=0 or f2%2==0 and f1%2!=0

def lovefunc( flower1, flower2 ):
    return  (flower1 % 2 and not flower2 % 2) or \
            (flower2 % 2 and not flower1 % 2)

def lovefunc( flower1, flower2 ):
    c = 0
    if flower1 % 2 == 0 and flower2 % 2 != 0:
        c = c + 1
    elif flower2 % 2 == 0 and flower1 % 2 != 0:
        c = c + 1
    else:
        return False
    return c > 0

def lovefunc( flower1, flower2 ):
    if flower1%2 == 0:
        return not flower2%2 == 0
    else:
        return flower2%2 == 0

def lovefunc( f1, f2 ):
    if f1%2==0 and f2%2==0:
        return False
    if f1&2==1 and f%2==1: 
        return False
    else:
        return True

def lovefunc(*a):
    return sum(a) % 2

def lovefunc( flower1, flower2 ):
    return not (flower1 & 1) == (flower2 & 1)

lovefunc = lambda a, b: (a - b) & 1

def lovefunc( flower1, flower2 ):
    return True in [i % 2 != 0 for i in [flower1, flower2]]