# [Tutor] 42

Fri Jun 11 01:32:01 EDT 2004

```--- Gregor Lingl <glingl at aon.at> wrote:
> What is the most convincing way to mimick this in Python?
>
> #include <stdio.h>
>
> #define SIX 1 + 5
> #define NINE 8 + 1
>
> int main(void) {
>   printf("What do you get if you multiply six by nine: %d\n", SIX *
> 	NINE);
>   return 0;
> }
>

print "What do you get if you multiply six by nine: %d" % 6 * 7

Or, if you absolutely must be silly and define names for digits (and
sillier by using arithmetic to create the digits), the following:

# oops - pretend you don't see that nine is set to 8 - 1
digits = {'six': 5 + 1, 'nine': 8 - 1}
print "What do you get if you multiply six by nine: %d" %
(digits['six'] * digits['nine'])
# that was magic

I don't think Python can duplicate this specific bug (yes, of course
it's a bug) from C, at least not without using a C extension. I think
that's probably a good thing.

- Jeremy

__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/

```