Python Forum
Need to print the output as follows
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need to print the output as follows
#1
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
Reply
#2
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.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#3
(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

>>>
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Print not appearing in output dgizzly 1 1,206 Oct-14-2022, 09:55 PM
Last Post: rob101
  Read text file, process data and print specific output Happythankyoumoreplease 3 2,920 Feb-20-2020, 12:19 PM
Last Post: jefsummers
  How do we print this output? veve 5 3,412 May-14-2018, 08:35 AM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020