Exam results:
90% = "9"
80% = "8"
70% = "7"
Anything else is a "fail".
def result(perc):
if perc >= 90:
return 9
elif perc >= 80:
return 8
elif perc >= 70:
return 7
else:
return "fail"
import codewars_test as test
# TODO Write tests
from solution import result
# test.assert_equals(actual, expected, [optional] message)
@test.describe("Example")
def test_group():
@test.it("test case")
def test_case():
test.assert_equals(result(75), 7)
test.assert_equals(result(90), 9)
test.assert_equals(result(56), "fail")
test.assert_equals(result(89), 8)
test.assert_equals(result(-10), "fail")
test.assert_equals(result(200), 9)
test.assert_equals(result(0), "fail")
def cube(a, b, c): #your code here return a*b*c #return 0
def kube(a, b, c):- def cube(a, b, c):
- #your code here
- return a*b*c
- #return 0
import codewars_test as test # TODO Write tests from solution import cube # test.assert_equals(actual, expected, [optional] message) @test.describe("Example") def test_group(): @test.it("test case") def test_case(): test.assert_equals(cube(7, 9, 4), 252) test.assert_equals(cube(5, 12, 7), 420) test.assert_equals(cube(3, 7, 49), 1029)
- import codewars_test as test
- # TODO Write tests
from solution import kube- from solution import cube
- # test.assert_equals(actual, expected, [optional] message)
- @test.describe("Example")
- def test_group():
- @test.it("test case")
- def test_case():
test.assert_equals(kube(7, 9, 4), 252)test.assert_equals(kube(5, 12, 7), 420)test.assert_equals(kube(3, 7, 49), 1029)- test.assert_equals(cube(7, 9, 4), 252)
- test.assert_equals(cube(5, 12, 7), 420)
- test.assert_equals(cube(3, 7, 49), 1029)