Convert strings to binary using the ASCII value for each character in the string. The function should return a list with each letter's binary value as an integer stored in separate indices.
def string_to_binary(s):
asc = [int(bin(ord(c))[2:]) for c in s]
return asc
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(string_to_binary("!"), [100001])
test.assert_equals(string_to_binary("Hello"), [1001000, 1100101, 1101100, 1101100, 1101111])
test.assert_equals(string_to_binary("World!"), [1010111, 1101111, 1110010, 1101100, 1100100, 100001])
test.assert_equals(string_to_binary("<@> <@>"), [111100, 1000000, 111110, 100000, 111100, 1000000, 111110])
test.assert_equals(string_to_binary("(^_^) [o_o] (^.^) ($.$)"),[101000, 1011110, 1011111, 1011110, 101001, 100000, 1011011, 1101111, 1011111, 1101111, 1011101, 100000, 101000, 1011110, 101110, 1011110, 101001, 100000, 101000, 100100, 101110, 100100, 101001])
def test():
return "t"+"e"+"s"+"t"