Python Forum

Full Version: Need to print the output as follows
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
I am trying to figure out how can I print the below output. Can anybody pls help me with the code?

   CCCC        RRRRR
 C       C       R       R
C                  R       R
C                  RRRRR
 C       C       R       R
   CCCC        R         R
First you have to figure out how you are storing the character definitions. You could hard code them as multi-line strings, you could store the strings in a file that would have to be read in, or you could store them as integer representations of binary numbers indicating each row.

Once you have the characters loaded, I would probably go with a list of strings, each string being one line in the expansion/output. If your characters are stored the same way, you could then just add each row of the character to each row of the output.
(Jul-08-2017, 03:24 PM)Mac Wrote: [ -> ]Can anybody pls help me with the code?
Sure!

>>> text = """
...   CCCC    RRRRR
...  C   C    R   R
... C         R   R
... C         RRRRR
...  C   C    R  R
...   CCCC    R   R
... """
>>> print(text)

 CCCC    RRRRR
C   C    R   R
C         R   R
C         RRRRR
C   C    R  R
 CCCC    R   R

>>>