Python Forum
Need to print the output as follows - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: Need to print the output as follows (/thread-3923.html)



Need to print the output as follows - Mac - Jul-08-2017

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


RE: Need to print the output as follows - ichabod801 - Jul-08-2017

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.


RE: Need to print the output as follows - nilamo - Jul-19-2017

(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

>>>