def return_hundred(n): hundred = '3й*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h' return hundred.count("*h") - 3
- def return_hundred(n):
hundred = '*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h'- hundred = '3й*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h*h'
- return hundred.count("*h") - 3
Find the largest number from the string and output in the number format
def my_first_kumite(s):
s = list(s)
for i in range(len(s)):
s[i] = int(s[i])
return max(s)
import codewars_test as test
# TODO Write tests
import solution # or from solution import example
# test.assert_equals(actual, expected, [optional] message)
@test.describe("Example")
def test_group():
@test.it("test case")
def test_case():
test.assert_equals(my_first_kumite("1234564569"), 9)
test.assert_equals(my_first_kumite("3756983475698"), 9)
test.assert_equals(my_first_kumite("847235463524632465"), 8)
test.assert_equals(my_first_kumite("456462534652347"), 7)
test.assert_equals(my_first_kumite("62314231434151"), 6)
test.assert_equals(my_first_kumite("54124231124"), 5)
test.assert_equals(my_first_kumite("423123213213"), 4)
test.assert_equals(my_first_kumite("21213121"), 3)
test.assert_equals(my_first_kumite("1211111121"), 2)
def return_hundred(n=100): return n
function returnhundred() {return 10 ** 2;}- def return_hundred(n=100):
- return n
test.assert_equals(return_hundred(),100)
// TODO: Add your tests here// Starting from Node 10.x, [Mocha](https://mochajs.org) is used instead of our custom test framework.// [Codewars' assertion methods](https://github.com/Codewars/codewars.com/wiki/Codewars-JavaScript-Test-Framework)// are still available for now.//// For new tests, using [Chai](https://chaijs.com/) is recommended.// You can use it by requiring:// const assert = require("chai").assert;// If the failure output for deep equality is truncated, `chai.config.truncateThreshold` can be adjusted.Test.assertEquals(returnhundred(),100)- test.assert_equals(return_hundred(),100)
rectangle = lambda n, n1:f"The area of the rectangle is {int((n*n1))} and the perimeter is {(n*2) + (n1*2)}"
def rectangle(n, n1):return f"The area of the rectangle is {int((n*n1))} and the perimeter is {(n*2) + (n1*2)}"- rectangle = lambda n, n1:f"The area of the rectangle is {int((n*n1))} and the perimeter is {(n*2) + (n1*2)}"
def rectangle(n, n1):return f"The area of the rectangle is {int((n*n1))} and the perimeter is {(n*2) + (n1*2)}"
def rectangle(n, n1):return f"The area of the rectangle is {int((n*n1))} and the perimeter is {(n*2) + (n1*2)}"- def rectangle(n, n1):return f"The area of the rectangle is {int((n*n1))} and the perimeter is {(n*2) + (n1*2)}"
def rectangle(n, n1): area = (n*n1)/2 perimeter = (n*2) + (n1*2) return f"The area of the rectangle is {int((n*n1))} and the perimeter is {(n*2) + (n1*2)}"
- def rectangle(n, n1):
- area = (n*n1)/2
- perimeter = (n*2) + (n1*2)
return f"The area of the rectangle is {int((n*n1))} and the perimeter is {perimeter}"- return f"The area of the rectangle is {int((n*n1))} and the perimeter is {(n*2) + (n1*2)}"
def rectangle(n, n1): area = (n*n1)/2 perimeter = (n*2) + (n1*2) return f"The area of the rectangle is {int((n*n1))} and the perimeter is {perimeter}"
- def rectangle(n, n1):
- area = (n*n1)/2
- perimeter = (n*2) + (n1*2)
return f"The area of the rectangle is {int(area*2)} and the perimeter is {(n*2) + (n1*2)}"- return f"The area of the rectangle is {int((n*n1))} and the perimeter is {perimeter}"