Problem Euler 26

kinuthiA muchanE muchanek at gmail.com
Wed Jul 2 20:12:42 BST 2008


Andrew,

I find your reply very encouraging, I hope more will come aboard and
make this mailing list livelier. Project Euler is turning me into a
geek! But I can live with that :-/

I am sure you will not be disappointed by python, I haven't. I do not
know what others would say. Right now I am trying to come into terms
with Java and it being statically-typed and coming from python, it takes
a lot to get used to it, I think.

Anyway, jump into Euler or any other challenge and lets know how you are
faring. 
Cheers!!

Kinuthia...

On Wed, 2008-07-02 at 14:05 -0400, Andrew Mathenge wrote:
> Habari Kinuthia,
> 
> Thanks for the code and the explanation. I will subscribe to the list
> since I'm interested in learning Python and heard very very good
> things about it.
> 
> This is actually the first time that I've heard about Euler so I'm
> going to roll my sleeves and try the other problems. I'll use this as
> an opportunity to learn Python.
> 
> By the way, thanks for posting the question. This is the most active
> that I've seen this mailing list.
> 
> Andrew.
> 
> On Wed, Jul 2, 2008 at 12:37 PM, kinuthiA muchanE <muchanek at gmail.com> wrote:
> > Habari,
> >
> > Andrew, this is hideous, really trivial! Here we go:
> >
> > from decimal import Decimal,getcontext # import the module because it is
> > not a standard module
> > getcontext().prec = 1000 # set the precision to 1000 places
> > a = Decimal("1") # the argument passed to the Decimal function has to be
> > a string
> > h=983 # the guess!
> > b = Decimal(str(h)) # convert it  into a string
> > abStr = str(a/b)[2:] # slice the string to remove "0."
> >
> > print abStr
> >
> > I am sure you will find far, far erudite codes in all languages in the
> > thread for that question. Apparently, there is an known algorithm for
> > solving this particular problem, but do I say. But it seems I was not
> > alone in using bush logic in trying to solve the problem!!
> >
> > As you might already know, python is a dynamically typed language( some
> > really pedantic types will also add strongly typed, because you cannot
> > use an integer as a string without converting it first, something you
> > can in a language like VB Script!!), you do not declare the data-types
> > of variables (like in C and Java), just assign values to variables and
> > off you go! You do not need even the $ sign to identify your variables
> > like Perl or php. They say python is very user friendly and at the same
> > time very powerful, and undoubtedly very readable.
> >
> > You can subscribe to the mailing list here:
> > http://mail.python.org/mailman/listinfo
> >
> > By the way, Andrew, Miano how many problems have you solved on Project
> > Euler? I have solved a measly 33.
> >
> > Kinuthia...
> >
> >
> >
> >




More information about the Ubuntu-ke mailing list