Ad
def division(a, b):
    return a / b

Write a function that subtracts two random inputs.

Code
Diff
  • def s(a,b):
        return a-b
    • def s(a, b):
    • def s(a,b):
    • return a-b
Code
Diff
  • def s(a, b):
        return a-b
    • def su(a, b):
    • def s(a, b):
    • return a-b
Code
Diff
  • def su(a, b):
        return a-b
    • def sub(a, b):
    • def su(a, b):
    • return a-b
Code
Diff
  • def sub(a, b):
        return a-b
    • def subt(a, b):
    • def sub(a, b):
    • return a-b
Code
Diff
  • def subt(a, b):
        return a-b
    • def subtra(a, b):
    • def subt(a, b):
    • return a-b
Test Cases
Diff
  • import codewars_test as test
    import random
    
    # Random test cases
    @test.describe("Random tests")
    def random_tests():
        @test.it("Random tests")
        def random_test_cases():
            for _ in range(100):
                a = random.randint(-1000, 1000)
                b = random.randint(-1000, 1000)
                expected = a - b
                test.assert_equals(subt(a, b), expected)
    • import codewars_test as test
    • import random
    • # Random test cases
    • @test.describe("Random tests")
    • def random_tests():
    • @test.it("Random tests")
    • def random_test_cases():
    • for _ in range(100):
    • a = random.randint(-1000, 1000)
    • b = random.randint(-1000, 1000)
    • expected = a - b
    • test.assert_equals(subtra(a, b), expected)
    • test.assert_equals(subt(a, b), expected)
Code
Diff
  • def subtra(a, b):
        return a-b
    • def subtrac(a, b):
    • def subtra(a, b):
    • return a-b
Test Cases
Diff
  • import codewars_test as test
    import random
    
    # Random test cases
    @test.describe("Random tests")
    def random_tests():
        @test.it("Random tests")
        def random_test_cases():
            for _ in range(100):
                a = random.randint(-1000, 1000)
                b = random.randint(-1000, 1000)
                expected = a - b
                test.assert_equals(subtra(a, b), expected)
    • import codewars_test as test
    • import random
    • # Random test cases
    • @test.describe("Random tests")
    • def random_tests():
    • @test.it("Random tests")
    • def random_test_cases():
    • for _ in range(100):
    • a = random.randint(-1000, 1000)
    • b = random.randint(-1000, 1000)
    • expected = a - b
    • test.assert_equals(subtrac(a, b), expected)
    • test.assert_equals(subtra(a, b), expected)
Code
Diff
  • def subtrac(a, b):
        return a-b
    • def subtract(a, b):
    • def subtrac(a, b):
    • return a-b
Code
Diff
  • def subtract(a, b):
        return a-b
    • def subtracti(a, b):
    • def subtract(a, b):
    • return a-b
Code
Diff
  • def subtracti(a, b):
        return a-b
    • def subtractio(a, b):
    • def subtracti(a, b):
    • return a-b
Code
Diff
  • def subtractio(a, b):
        return a-b
    • def subtraction(a, b):
    • def subtractio(a, b):
    • return a-b

Write a function that subtracts two random inputs from each other.

def subtraction(a, b):
    return a-b
Fundamentals
Mathematics

Write a function that multiplies two random inputs.

Code
Diff
  • def m(a,b):
        return a*b
    • def m(a, b):
    • def m(a,b):
    • return a*b
Fundamentals
Mathematics
Code
Diff
  • def m(a,b):
        return a * b
    • def m(a, b):
    • def m(a,b):
    • return a * b
Fundamentals
Mathematics
Code
Diff
  • def m(a, b):
        return a*b
    • def m(a, b):
    • return a * b
    • return a*b
Loading more items...