Ad

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
Code
Diff
  • def multiply (a,b):
        a * b / b * b
    • def multiply (a,b):
    • a * b
    • a * b / b * b
Code
Diff
  • def test() :
        word = "test"
        return f"{word}"
    • def test() :
    • return "test"
    • word = "test"
    • return f"{word}"

def test():
return "t"+"e"+"s"+"t"

Code
Diff
  • def test():
      return "t"+"e"+"s"+"t"
    • def test() :
    • return "test"
    • def test():
    • return "t"+"e"+"s"+"t"