decimal = 7
def convertToBinary(n):
(decimal)
print()
Homework/Hacks: For the hw, you have two options, easy or hard. The easy hack is for a 2.7 + extra work for the full 3. The easy hack is simply creating your own procedure with your own creativity. Since there is a lot of leeway for this one, you must do additional work to get a 3. For the hard hack, below is the start to a character to binary convertor. This is just a template, but the goal is to translate "APCSP" into binary. You can delete the existing code if you want. The only contraint is that you must use a procedure. Doing this will get you a 3.
def convertToBinary(num):
return bin(num)
def charToBinary(x):
return convertToBinary(ord(x))
word = "APCSP"
for i in word:
print(charToBinary(i)[2:])
# The output shown below is the output you are supposed to get