This kata is about multiplying a given number by eight if it is an even number and by nine otherwise.

Difficulty: introductory

Starter code:

def simple_multiplication(number) :
	

Solutions:
def simple_multiplication(number) :
    return number * 9 if number % 2 else number * 8

def simple_multiplication(n) :
    return n * (8 + n%2)

def simple_multiplication(number) :
    return number * (8 if number % 2 == 0 else 9)

simple_multiplication = lambda a : a * (8 + (a & 1))

simple_multiplication = lambda n: n.__mul__(n.__and__(bool(n)).__add__(len(__name__)))

def simple_multiplication(n) :
    return n * 8 if n % 2 == 0 else n * 9

def simple_multiplication(number) :
    return number * 8 if number % 2 == 0 else number * 9

def simple_multiplication(number):
    return number * (9 if number % 2 else 8) 

def simple_multiplication(number) :
    if number % 2 == 0:
        return number * 8
    return number*9

simple_multiplication = lambda n: n*(8+(n&1))

def simple_multiplication(n):
    return n * [8, 9][n % 2]

def simple_multiplication(number) :
    if number % 2 == 0:
        n = 8
    else:
        n = 9
    return number * n


simple_multiplication = lambda num: num * (8 + num%2)

def simple_multiplication(x) :
    if x%2==0:
        return x*8
    else:
        return x*9

simple_multiplication = lambda n : n*8 if n%2==0 else n*9


simple_multiplication=lambda Q:Q*(8+(1&Q))

def simple_multiplication(number) :
    return number*(9 if number % 2 else 8)

def simple_multiplication(number) :
    return number*(9 if number & 1 else 8)

def simple_multiplication(number) :
    return number*(8 + (number & 1))


def simple_multiplication(number) :
    return number * (8 + (number % 2))

def simple_multiplication(number: int) -> int:
    """ Multiply a given number by eight if it is an even number and by nine otherwise. """
    return number * 9 if number % 2 else number * 8

def simple_multiplication(number) :
    if number % 2 == 0 :
        num = number * 8
    else :
        num = number * 9
    return num

def simple_multiplication(number) :
#    return number*8 if number % 2 ==0 else number*9
    return number*[9,8][number % 2 == 0]

def simple_multiplication(number) :
    return (8 + (number % 2)) * number

def simple_multiplication(number) :
    return number * (8 + (number & 1))

def simple_multiplication(number) :
    return number << 3 if number % 2 == 0 else 9*number

def simple_multiplication(num):
    return num << 3 if not num % 2 else num * 9

def simple_multiplication(number) :
    number *= 8 + (number % 2)
    return(number)


def simple_multiplication(number) :
    return (number << 3) + number * (number & 1)

simple_multiplication = lambda n: ((n&1)+8)*n

def simple_multiplication(number) :
    return number * [8, 9][number % 2]

def simple_multiplication(number) :
    if number % 2 == 0:
       return number *8
    else:
       return number *9

simple_multiplication = lambda num: num * 9 if num % 2 else num * 8

def simple_multiplication(number) :
    # Your code goes here
    if 0 == number%2:
        return number*8
    return number*9

def simple_multiplication(number) :
#     return number * 8 if number%2 == 0 else number * 9 
    return number * (9,8)[number%2 == 0]

simple_multiplication=lambda n:8*n+n%2*n

def simple_multiplication(number) :
    if number%2:
        return 9*number
    else:        
        return 8*number


def simple_multiplication(n):
    return (n << 3) + (n & 1) * n

def simple_multiplication(number) :
    print(number)
    if number % 2 == 0:
        simple_multiplication = number * 8
    elif number % 2 == 1:
        simple_multiplication = number * 9
    return(simple_multiplication)

def simple_multiplication(number):
    # Non-branching solution
    return (number % 2 and number * 9) or number * 8

def simple_multiplication(number) :
    if number % 2 == 0:
        return number * 8
    if number % 2 == 1:
        return number * 9
    else:
        return 0

def simple_multiplication(number) :
    x = []
    if (number % 2) == 0:
        x = number * 8
    else:
        x = number * 9
        
    return x

def simple_multiplication(number: int) -> int:
    return number * 8 if number % 2 == 0 else number * 9

simple_multiplication = lambda n: n * 8 if n % 2 is 0 else n * 9

def simple_multiplication(num) :
    divided = (num % 2)
    if divided == 0:
        return (num * 8)
    else:
        return (num * 9)


def simple_multiplication(number) :
    if number%2 ==0:
        number*=8
        return number
    else:
        number*=9
        return number
simple_multiplication(10)

def simple_multiplication(number) :
    ans = 0
    if number % 2 == 0:
        ans = number * 8
    else:
        ans = number * 9
    return ans

def simple_multiplication(n):
    return n * (8 + (n & 1))

def simple_multiplication(number) :
    '''we will use an if else situation to differentiate the circumstance'''
    return number*8 if number%2==0 else number*9

def simple_multiplication(number) :
    total = number * 9
    if number % 2 == 0:
        total = total - number
    return total

def simple_multiplication(number) :
    if int(number) % 2 == 0:
        return int(number) * 8
    elif int(number) % 2 != 0:
        return int(number) * 9


def simple_multiplication(n) :
    return 8*n if n%2==0 else 9*n

def simple_multiplication(n) :
    return n * 9 if n % 2 == 1 else n * 8

def simple_multiplication(n):
    return n * 8 + n * (n % 2)

def simple_multiplication(number) :
    if number % 2 == 0:
        new_number = number * 8
    else:
        new_number = number *9
    return new_number


def simple_multiplication(n) :
    return n * ((n%2) * 9 + (n-1)%2 * 8)

def simple_multiplication(number: int) -> int:
    """Multiplying a given number by eight if it is an even number and by nine otherwise."""
    return number * (8 if number % 2 == 0 else 9)


from math import *
def simple_multiplication(number) :
    if fmod(int(number), 2) == 0:
        even = True
    else:
        even = False

    if even == True:
        return int(number) * 8
    else:
        return int(number) * 9

def simple_multiplication(n):
    return (lambda n : n * 8 if n % 2 == 0 else n * 9)(n)

def simple_multiplication(number) :
    if number % 2 == int():
        return number * 8
    else:
        return number * 9


def simple_multiplication(number):
    if number % 2 == 0:
        return number * 8
    else:
        return number * 9
simple_multiplication(2)

def simple_multiplication(n) :
    return [n*8, n*9][n % 2]

def simple_multiplication(number):
    return number * 8 + (0 if number % 2 == 0 else number)

simple_multiplication = lambda num: num * (8 if num % 2 == 0 else 9 )

def simple_multiplication(number) :
    mult = 9 if number % 2 else 8
    return number * mult

def simple_multiplication(number) :
    if number % 2 == 0:
        return number*8
    elif number % 1 == 0:
        return number*9

def simple_multiplication(number) :
    return int("".join(str(number * 8) if number % 2 == 0 else str(number * 9)))


#function simple_multiplaction takes a number argument
def simple_multiplication(number):
   #if number is even
       #multiple by 8
    #if number is odd
        #multiply by 9
    if number % 2 == 0:
        return number * 8
    else:
        return number * 9

def simple_multiplication(number) :
    if number % 2 == 0:
        multi = number * 8
        return multi
    else:
        multi = number * 9
        return multi
simple_multiplication(3)

simple_multiplication = lambda n: (8 + n % 2) * n

def simple_multiplication(number) :
    return number * 8 if number and number % 2 == 0 else number * 9

def simple_multiplication(number) :
    if number % 2 == 0:
        return number * 8
    else:
        return number * 9
print(simple_multiplication(5))

def simple_multiplication(a) :
        for i in range(a):
            if a % 2 != 0:
                b = a * 9;
            else:
                b = a  * 8;
        return(b)

def simple_multiplication(number) :
    if number % 2 == 0:
      c = number * 8
      return c
    else:
      f = number * 9
      return f

def simple_multiplication(number) :
    return (number*9, number*8) [number%2==0]

def simple_multiplication(number) :
    if number % 2 == 0:
        return number * 8
    else:
        return number * 9
        
        
simple_multiplication(5)

def simple_multiplication(number) :
    format_number = int(number)
    result = format_number * 8 if format_number % 2 == 0 else format_number * 9
    return result

def simple_multiplication(number) :
    x = number*8 if number%2==0 else number*9 
    return x 

def simple_multiplication(number) :
     even = 8 
     odd = 9
     if number % 2 == 0:
        return(number * even)
     else:
        return(number * odd)
        


def simple_multiplication(number) :
    return number * (8 + (number%2 != 0) * 1)

def simple_multiplication(number) :
    
    return number * 8 + (number % 2 == 1) * number

def simple_multiplication(number) :
    if number%2 == 0:
        even_multiply = number*8
        return even_multiply
    else:
        odd_multiply = number*9
        return odd_multiply

def simple_multiplication(number) :
    if (number % 2) == 0:
        x=number*8
        return x
    else:
        y=number*9
        return y

def simple_multiplication(number) :
    return 8 * number + number * (number % 2 == 1)

def simple_multiplication(number) :
    # Your code goes here
    x = number % 2 
    if x == 0:
        return (number * 8)
    else:
        return (number * 9)


def simple_multiplication(number) :
    return number*(9 - int(number%2==0))

def simple_multiplication(number) :
    return number * 9 if number & 1 else number * 8

def simple_multiplication(number) :
    num = number % 2 
    if num == 0:
        return number *8;
    else:
        return number *9;
    
    # Your code goes here


def simple_multiplication(number) :
    # Your code goes here
    if number%2 == 0:
        return number*8
    else:
        return number*9
print(simple_multiplication)


def simple_multiplication(number) :
    if number%2:
        answer = number*9
    else:
        answer = number * 8
    return answer


simple_multiplication = lambda n: n * 9 if n % 2 else n * 8

def simple_multiplication(number) :
    x=number/2
    if x == round(x,0):
        return number * 8
    else:
        return number * 9

def simple_multiplication(number) :
    return (9 if number%2 else 8) * number

def simple_multiplication(number) :
    return (int(number) * 8 if number % 2 == 0 else int(number) * 9)

def simple_multiplication(number) :
    res = 0
    if number % 2 == 0:
        res = number * 8
    else:
        res = number * 9
    return res

simple_multiplication=lambda x: (x<<3) + x*(x&1)

def simple_multiplication(number) :
    Temp = number % 2
    if Temp == 0:
        TempMul = number * 8
        return TempMul
    if Temp != 0:
        TempMul = number * 9
        return TempMul

def simple_multiplication(num) :
    # Your code goes here
    if num % 2 == 0:
        return num * 8
    if num% 2 ==1  :
        return num *9
print(simple_multiplication(9))

def simple_multiplication(n) :
    if n % 2 == 0:
        n *= 8
    else:
        n *= 9
    return n

def simple_multiplication(number) :
    if number % 2 == 0 or number == 0:
        return number * 8
    elif number % 2 != 0 or number == 1:
        return number * 9

def simple_multiplication(number) :
    even = number * 8
    odd = number * 9
    if number % 2 == 0 :
        return even
    else:
        return odd

def simple_multiplication(number) :
    if number%2==0: return number<<3
    else: return number*9