Takes input of an integer or string and returns 100.
def returnhundred(word): word = str(word) while len(word) < 4: word += "a" word = word[0:4] val = bin(len(word)) return int(val[2:])
function returnhundred() {return 10 ** 2;}- def returnhundred(word):
- word = str(word)
- while len(word) < 4:
- word += "a"
- word = word[0:4]
- val = bin(len(word))
- return int(val[2:])
test.assert_equals(returnhundred("hi"),100) test.assert_equals(returnhundred("Hello there"),100) test.assert_equals(returnhundred(""),100) test.assert_equals(returnhundred(12098),100) test.assert_equals(returnhundred(0),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(returnhundred("hi"),100)
- test.assert_equals(returnhundred("Hello there"),100)
- test.assert_equals(returnhundred(""),100)
- test.assert_equals(returnhundred(12098),100)
- test.assert_equals(returnhundred(0),100)