[Tutor] Printing multi-line variables horizontally

emile emile at fenx.com
Fri Aug 8 22:09:53 CEST 2014


On 08/08/2014 10:58 AM, emile wrote:
> On 08/08/2014 01:50 AM, Greg Markham wrote:
>>
>>
>> die_1 = """
>> .-----.
>> |     |
>> |  o  |
>> |     |
>> `-----'"""
>>
>> die_2 = """
>> .-----.
>> |o    |
>> |     |
>> |    o|
>> `-----'"""
>

Not quite sure how this part was dropped...

 >>> for line in zip(die_1.split("\n"),die_2.split("\n")): print line
...
('', '')
('.-----.', '.-----.')
('|     |', '|o    |')
('|  o  |', '|     |')
('|     |', '|    o|')
("`-----'", "`-----'")


>
> I'll leave the cleanup as an exercise for you.
>
> HTH,
>
> Emile
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>




More information about the Tutor mailing list