def division(a, b):
return a / b
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(division(a,b), expected)
Write a function that subtracts two random inputs.
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(s(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(s(a, b), expected)- test.assert_equals(s(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(s(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(su(a, b), expected)- test.assert_equals(s(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(su(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(sub(a, b), expected)- test.assert_equals(su(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(sub(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(subt(a, b), expected)- test.assert_equals(sub(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(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)
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)
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)
- 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(subtract(a, b), expected)- test.assert_equals(subtrac(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(subtract(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(subtracti(a, b), expected)- test.assert_equals(subtract(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(subtracti(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(subtractio(a, b), expected)- test.assert_equals(subtracti(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(subtractio(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(subtraction(a, b), expected)- test.assert_equals(subtractio(a, b), expected)
Write a function that subtracts two random inputs from each other.
def subtraction(a, b):
return a-b
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(subtraction(a, b), expected)
Fundamentals
Mathematics
Write a function that multiplies two random inputs.