1

I am having troubles executing the code that converts each character in the string to its base 3 number representation.

This code works for printing the decimal and binary number representations:

print(["{0} {0:06b} ".format(ord(c)-ord('a')) for c in PT])

Where the user inputs values for PT.

I have tried using this code :

print(["{0} {0:04b} ".format(ord(c)-ord('a')) for c in PT])

but this does not output base 3.

Any help on what I am doing wrong?

Barmar
  • 669,327
  • 51
  • 454
  • 560
BassJelly
  • 11
  • 2

0 Answers0