[Tutor] Fwd: Printing multi-line variables horizontally

2014-08-09 Thread Chris “Kwpolska” Warrick
It looks ilke this WONDERFUL mailing list which does not do something
as basic as a sane Reply-to header made me send a response to the OP
only.  Here it is again:


-- Forwarded message --
From: Chris “Kwpolska” Warrick 
Date: Fri, Aug 8, 2014 at 7:36 PM
Subject: Re: [Tutor] Printing multi-line variables horizontally
To: Greg Markham 


On Aug 8, 2014 7:22 PM, "Greg Markham"  wrote:
>
> Hello,
>
> Python novice back again.  :)  I'm making progress in my learning process, 
> but struggling whenever attempting to creatively go beyond what's required in 
> the various chapter assignments.  For example, there's a simple random die 
> roller program that looks like the following:
>
>
> # Craps Roller
> # Demonstrates random number generation
>
> import random
>
> # generate random numbers 1 - 6
> die1 = random.randint(1, 6)
> die2 = random.randrange(6) + 1
>
> total = die1 + die2
>
> print("You rolled a", die1, "and a", die2, "for a total of", total)
>
> input("\n\nPress the enter key to exit.")
>
>
> I wanted to make it a little more interesting by using ascii art 
> representations of the six die.  When printing, however, they do so 
> vertically and not horizontally.  Here's a snippet of the code:
>
>

>


> die_2 = """
> .-.
> |o|
> | |
> |o|
> `-'"""
>
> print(die_1, die_2)
>
>
> So, how would I get this to display horizontally?
>
> Like so...
> .-.   .-.
> | |   |o|
> |  o  |   | |
> | |   |o|
> `-'   `-'
>
> Thanks,
>
> Greg
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>

You would need to do some extra work. Specifically, you must split the
string into lines, and print them side-by-side and line-by-line. Like
this:

die_1 = [
".-.",
"|o|",
"| |",
"|o|",
"`-'",
]

die_2 = [
".-.",
"| |",
"|  o  |",
"| |",
"`-'",
]

for l, r in zip(die_1, die_2):
print(l, r)

--
Chris “Kwpolska” Warrick 
Sent from my SGS3.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Fwd: Printing multi-line variables horizontally

2014-08-09 Thread Steven D'Aprano
On Sat, Aug 09, 2014 at 12:39:37PM +0200, Chris “Kwpolska” Warrick wrote:
> It looks ilke this WONDERFUL mailing list which does not do something
> as basic as a sane Reply-to header made me send a response to the OP
> only.  Here it is again:
[...]

Although I personally agree with you that setting the Reply-To address 
to the list is more sensible than the alternative, I'll point out that 
it is not the only "sane" option.

http://woozle.org/~neale/papers/reply-to-still-harmful.html

I don't agree with all the arguments here, I think the author has jumped 
to some unjustified conclusions, and I don't think the argument is 
anywhere near as settled as he thinks. Certainly the mailing list should 
never override a Reply-To header that has been set by the sender, but 
that doesn't mean it can't set one where it hasn't been set.

In any case, you should be able to set the Reply-To address yourself 
(either manually, or if your mail client allows it, automatically) and 
the mailing list will honour it. I have done so in this post, so we'll 
see what happens.



-- 
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor