Smart Baba special limited offer. We are the only world lowest-cost,
yet professional and elegant-designing website developing company.
Follow us for further details:
www.websitedeals.com
--
http://mail.python.org/mailman/listinfo/python-list
On Oct 22, 6:35 am, Terry Reedy wrote:
> On 10/21/2010 7:55 PM, Baba wrote:
>
> > the bit i'm having difficulties with in constructing my loops is:
> > "whose small sides are no larger than n"
>
> from math import sqrt
>
> def py_trips(n):
> fo
On Oct 22, 6:35 am, Terry Reedy wrote:
> On 10/21/2010 7:55 PM, Baba wrote:
>
> > the bit i'm having difficulties with in constructing my loops is:
> > "whose small sides are no larger than n"
>
> from math import sqrt
>
> def py_trips(n):
> fo
On Oct 22, 8:07 am, Dennis Lee Bieber wrote:
> On Thu, 21 Oct 2010 03:51:07 -0700 (PDT), Baba
> declaimed the following in gmane.comp.python.general:
>
> > Hi everyone
>
> > i need a hint regarding the following exercise question:
>
> > "Write a program
On Oct 21, 10:18 pm, Terry Reedy wrote:
> On 10/21/2010 6:55 AM, Baba wrote:
>
> > Hi everyone
>
> > i need a hint regarding the following exercise question:
>
> > "Write a program that generates all Pythagorean triples whose small
> > sides are no larg
n range(20):
for a in range(1, b):
c = math.sqrt( a * a + b * b)
if c % 1 == 0:
print (a, b, int(c))
this returns
(3, 4, 5) (6, 8, 10) (5, 12, 13) (9, 12, 15) (8, 15, 17) (12, 16, 20)
is that the desired output? what is the step that i'm missing?
thanks in a
ava by Dissection (Ira Pohl and Charlie McDowell)
thanks
Baba
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 23, 8:13 pm, nn wrote:
> On Sep 23, 1:25 pm, Baba wrote:
>
>
>
> > On Sep 23, 4:17 pm, nn wrote:
>
> > > On Sep 23, 10:56 am, nn wrote:
>
> > > > On Sep 22, 6:39 pm, Baba wrote:
>
> > > > > On Sep 22, 9:18 pm, Baba wrote:
On Sep 23, 8:13 pm, nn wrote:
> On Sep 23, 1:25 pm, Baba wrote:
>
>
>
> > On Sep 23, 4:17 pm, nn wrote:
>
> > > On Sep 23, 10:56 am, nn wrote:
>
> > > > On Sep 22, 6:39 pm, Baba wrote:
>
> > > > > On Sep 22, 9:18 pm, Baba wrote:
On Sep 23, 4:17 pm, nn wrote:
> On Sep 23, 10:56 am, nn wrote:
>
>
>
> > On Sep 22, 6:39 pm, Baba wrote:
>
> > > On Sep 22, 9:18 pm, Baba wrote:
>
> > > > On Sep 22, 3:38 pm, nn wrote:
>
> > > > > On Sep 21, 6:39 pm, Ba
On Sep 22, 9:18 pm, Baba wrote:
> On Sep 22, 3:38 pm, nn wrote:
>
>
>
> > On Sep 21, 6:39 pm, Baba wrote:
>
> > > Hi
>
> > > query level: beginner
>
> > > as part of a learning exercise i have written code that:
>
> > > a
On Sep 22, 3:38 pm, nn wrote:
> On Sep 21, 6:39 pm, Baba wrote:
>
>
>
> > Hi
>
> > query level: beginner
>
> > as part of a learning exercise i have written code that:
>
> > a) asks for a single letter input (assumption: only 1 letter wil be
> >
you loose'
this code works but can it be optimised? i have the feeling that my
nesting of IF, WHILE and FOR statements is overkill?
inspired by part IV of
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/as
On Sep 21, 1:39 pm, Mel wrote:
> Baba wrote:
> > I am working on a simple wordgame exercise: 2 players form a word by
> > alternating turns saying a letter, which is added on to the end of the
> > word fragment.
>
> > I am familiar with loops, iterations etc but
source:
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/assignments/pset5.pdf
thanks
Baba
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 9, 10:09 pm, Nobody wrote:
> On Wed, 08 Sep 2010 03:30:00 -0700, Baba wrote:
> > Who is licensed to judge what can and cannot be posted as a question?
>
> Exactly the same set of people who are licensed to judge what can and
> cannot be posted as an answer.
>
&g
On Sep 9, 11:22 pm, Alain Ketterlin
wrote:
> Baba writes:
> > In below code "the outer loop test in step 4 will execute ( n + 1 )
> > times (note that an extra step is required to terminate the for loop,
> > hence n + 1 and not n executions), which will consume T4( n
a positive integer from input
2if n > 10
3print "This might take a while..."
4for i = 1 to n
5for j = 1 to i
6print i * j
7print "Done!"
Why does step 4 execute n+1 times? what is the exta step mentioned
above
tnx
Baba
--
http://mail.p
On 8 sep, 14:39, Paul Rubin wrote:
> Baba writes:
> > But where do you draw the line? Can we not just let people ask
> > questions regardless? And let those answer who want to and those who
> > don't just ignore the question? That seems so much easier to me.
>
> T
On 8 sep, 12:46, Paul Rubin wrote:
> Baba writes:
> > It is just unfriendly
> > to tell someone to go and look it up by themselves.
>
> Someone seeing too many unthoughtful questions from you might tell you
> to look it up yourself, in the hopes of getting you to change
On 8 sep, 02:07, Ben Finney wrote:
> Baba writes:
> > However the following Wiki excerpt seems to go in my direction:
>
> No, it doesn't. It advises that people show kindness; as I've been
> arguing, that's exactly what you were shown. You haven't shown how
ich rules |
> _o__) apply.” —Eben Moglen, _Anarchism Triumphant_, 1999 |
> Ben Finney
Thanks all for feedback!
Baba
--
http://mail.python.org/mailman/listinfo/python-list
On 7 sep, 22:37, MRAB wrote:
> On 07/09/2010 21:06, Paul Rubin wrote:
>
> > Baba writes:
> >> word= 'even'
> >> dict2 = {'i': 1, 'n': 1, 'e': 1, 'l': 2, 'v': 2}
>
> >> i want to know if word is
On 7 sep, 22:08, Gary Herron wrote:
> On 09/07/2010 12:46 PM, Baba wrote:
>
> > word= 'even'
> > dict2 = {'i': 1, 'n': 1, 'e': 1, 'l': 2, 'v': 2}
>
> Just go through each letter of word checking for its existe
i think this is easy but google and python doc didn't return any good
hints so i'm trying here.
Thanks Baba
--
http://mail.python.org/mailman/listinfo/python-list
On 7 sep, 16:50, Grant Edwards wrote:
> On 2010-09-07, Baba wrote:
>
> > Sloppy wording, I apologise. This should say: If you find the
> > question you're reading too easy then just don't answer. Noone is the
> > owner of a democratic forum where freedom to
ntion of the
mutation concept.
I know that a ditionary is unordered. How Can i however avoid
'acidental' mutation?
Thanks
Baba
--
http://mail.python.org/mailman/listinfo/python-list
On 7 sep, 13:39, Baba wrote:
> On 7 sep, 02:18, Ben Finney wrote:
>
>
>
>
>
> > Ben Finney writes:
> > > We value respect for people here, and that's what you've been shown
> > > consistently. But respect for opinions, or for delicacy abo
On 7 sep, 02:18, Ben Finney wrote:
> Ben Finney writes:
> > We value respect for people here, and that's what you've been shown
> > consistently. But respect for opinions, or for delicacy about
> > learning, is not welcome here.
>
> Sloppy wording, I apologise. This should say “… is not respect f
On 6 sep, 18:14, geremy condra wrote:
> On Mon, Sep 6, 2010 at 8:53 AM, Baba wrote:
> > On 6 sep, 16:58, Thomas Jollans wrote:
> >> On Monday 06 September 2010, it occurred to Baba to exclaim:
>
> >> > On 6 sep, 00:01, Benjamin Kaplan wrote:
> >> >
On 6 sep, 16:58, Thomas Jollans wrote:
> On Monday 06 September 2010, it occurred to Baba to exclaim:
>
>
>
> > On 6 sep, 00:01, Benjamin Kaplan wrote:
> > > On Sun, Sep 5, 2010 at 5:47 PM, Baba wrote:
> > > > level: beginner
>
> > > >
On 6 sep, 00:04, Seth Rees wrote:
> On 09/05/10 16:47, Baba wrote:
>
> > level: beginner
>
> > how can i access the contents of a text file in Python?
>
> > i would like to compare a string (word) with the content of a text
> > file (word_list). i want to see i
On 6 sep, 00:01, Benjamin Kaplan wrote:
> On Sun, Sep 5, 2010 at 5:47 PM, Baba wrote:
> > level: beginner
>
> > how can i access the contents of a text file in Python?
>
> > i would like to compare a string (word) with the content of a text
> > file (word_l
(word, word_list)
thanks
Baba
--
http://mail.python.org/mailman/listinfo/python-list
or the next iteration, leading to an
> infinite loop.
If you look at the output you will see that the interval DOES seem to
reduce at each interval as expenses and fundsize reduce gradually. The
computation does not lead to an infinite loop.
tnx
Baba
--
http://mail.python.org/mailman/listinfo/python-list
input i was
able to considerably optimise my approach:
def fib_range(start, end):
fib_1 = 0
fib_2 = 1
range = []
while fib_2 < end:
fib_1, fib_2 = fib_2, fib_1 + fib_2
if fib_2 >= start and fib_2 <= end:
range.append(fib_2)
return range
p
yearsOfretirement -=1
return fundsize
findMaxExpenses(1,10,[3, 4, 5, 0, 3],[10, 5, 0, 5, 1],0.01)
thanks
Baba
--
http://mail.python.org/mailman/listinfo/python-list
Thanks to All for your kind help!
Baba
--
http://mail.python.org/mailman/listinfo/python-list
not in list'
fib_range(5,55)
thanks
Baba
--
http://mail.python.org/mailman/listinfo/python-list
ding/defining the
start of the Fibonacci series?
def r_fib(n):
if n == 1: return 1
elif n == 2: return 2
else: return r_fib(n-2) + r_fib(n-1)
print r_fib(12)
Thanks
Baba
--
http://mail.python.org/mailman/listinfo/python-list
g recursions
OR
def fibonacci(n):
# base case:
fibonacci(n+2) - fibonacci(n+1) - n = 0
>> this too would create overlapping recursions
How to go about this?
Thanks
Baba
--
http://mail.python.org/mailman/listinfo/python-list
ting this loop means all compared chars were identical hence it
is a palindrome and i return True
tnx
Baba
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 22, 7:12 pm, Tim Chase wrote:
> On 08/22/10 12:50, Baba wrote:
>
>
>
> > level: beginners
>
> > I was trying to write simple code that compares 2 tuples and returns
> > any element in the second tuple that is not in the first tuple.
>
>
the ELSE clause is positioned
under the second FOR loop. As if it was an ELSE clause without an IF
statement!?
Why/How does this work?
tnx
Baba
--
http://mail.python.org/mailman/listinfo/python-list
place we are
calling from—instead, we can leave the stack alone, and the newly
called function will return its result directly to the original
caller. Converting a call to a branch or jump in such a case is called
a tail call optimization. "
not sure i understand that...
is this bit of theory
On Aug 19, 11:00 pm, Martin Gregorie
wrote:
> By way of a hint, here are two versions of the classic example of
> recursion: calculating factorials. Recursion can be quite a trick to get
> your mind round at first, so compare the two and follow through their
> operation step by step...
Hi Martin
Hi Martin
Thanks for your post. This basic but fundamental computation is a
great example when trying to understand the concept of recursion for
the first time.
Also thanks to John for the stackoverflow link where i found a very
good summarised definition completing some of the posts left here.
Level: Beginner
exercise source:
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/assignments/pset3.pdf
I am looking at the first problem in the above assignment. The
assignemnt deals, amongst others, with the i
et up to speed.
kind regards to everyone!
Baba
--
http://mail.python.org/mailman/listinfo/python-list
/pdf/0708/0708.3224v1.pdf
i would be interested in the answer to problem 3: explain in English
why the theorem is true
@Giacomo: when you say that i have not read the text of the assignment
i tend to disagree. Therefore could you point out what it is i
overlooked that should help me prove my
ges[2]+1):
#print "trying for %d: %d %d %d" % (n_nuggets,a,b,c)
if packages[0]*a+packages[1]*b+packages[2]*c==n_nuggets:
can_buy=True
break
if can_buy==True:
cbc+=1
else:
cbc=0
sol=n_nuggets
print so
Hi Chas, Roald,
These are all complicated formula that i believe are not expected at
this level. If you look at the source (see my first submission) you
will see that this exercise is only the second in a series called
"Introduction to Programming". Therefore i am convinced that there is
a much si
Hi Mel,
indeed i thought of generalising the theorem as follows:
If it is possible to buy n, n+1,…, n+(x-1) sets of McNuggets, for some
x, then it is possible to buy any number of McNuggets >= x, given that
McNuggets come in x, y and z packs.
so with diophantine_nuggets(7,10,21) i would need 7 pa
Hi All,
@Emile tnx for spotting the mistake. Should have seen it myself.
@John & Ian i had a look around but couldn't find a general version of
below theorem
If it is possible to buy x, x+1,…, x+5 sets of McNuggets, for some x,
then it is possible to buy any number of McNuggets >= x, given that
M
Hi John,
Thanks for your submission! I've improved a lot and everone's help so
far has been thrilling and is very good for my self-study
motivation :)
ok so i think i'm clear on how to approach this problem and on how to
write basic but clean Python code to solve it.
The next step is to generali
Hi John,
Thanks for your submission! I've improved a lot and everone's help so
far has been thrilling amd is very good for my self-study
motivation :)
ok so i think i'm clear on how to approach this problem and on how to
write basic but clean Python code to solve it.
The next step is to generali
print n_nuggets-1
break
i suppose this can be tweaked to make it shorter? For instance i
wonder if i can do the same with less variable to be defined?
tnx
Baba
--
http://mail.python.org/mailman/listinfo/python-list
_nuggets in range(30):
result = can_buy(n_nuggets)
if result==True:
truelist=truelist+[n_nuggets,]
else:
falselist=falselist+[n_nuggets,]
print 'true',truelist
print 'false',falselist
tnx
Baba
--
http://mail.python.org/mailman/listinfo/python-list
_nuggets in range(30):
result = can_buy(n_nuggets)
if result==True:
truelist=truelist+[n_nuggets,]
else:
falselist=falselist+[n_nuggets,]
print 'true',truelist
print 'false',falselist
tnx
Baba
--
http://mail.python.org/mailman/listinfo/python-list
and ask it to test a
value nothing happens. What is wrong? My syntax? My semantic? Both?
tnx
Baba
--
http://mail.python.org/mailman/listinfo/python-list
level: beginner
exercise: given that packs of McNuggets can only be bought in 6, 9 or
20 packs, write an exhaustive search to find the largest number of
McNuggets that cannot be bought in exact quantity.
exercise source:
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-
Hi, this is my question:
I want to know if several switch (about 50) in a big lan are up and then
know their MAC addresses to do a list that contains host name, ip and mac.
I know only the range of their IP addresses (the host name it's simply
to know using socket.gethostn.
The first idea it's
62 matches
Mail list logo