smart baba new year special offer

2012-02-07 Thread Smart Baba
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

Re: pythagorean triples exercise

2010-10-22 Thread Baba
On Oct 22, 8:07 am, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Thu, 21 Oct 2010 03:51:07 -0700 (PDT), Baba raoul...@gmail.com declaimed the following in gmane.comp.python.general: Hi everyone i need a hint regarding the following exercise question: Write a program that generates

Re: pythagorean triples exercise

2010-10-22 Thread Baba
On Oct 22, 6:35 am, Terry Reedy tjre...@udel.edu 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):    for b in range(4,n+1):      for a in range(3,b+1

Re: pythagorean triples exercise

2010-10-22 Thread Baba
On Oct 22, 6:35 am, Terry Reedy tjre...@udel.edu 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):    for b in range(4,n+1):      for a in range(3,b+1

pythagorean triples exercise

2010-10-21 Thread Baba
out where to fit in n. a^a + b^b = c^c is the condition to satisfy and i need to use loops and n will be an upper limit of one (or more?) of the loops but i am a bit lost. Please help me get thinking about this right. exercise source: Java by Dissection (Ira Pohl and Charlie McDowell) thanks Baba

pythagorean triples exercise

2010-10-21 Thread Baba
( 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 advance Baba p.s. this is not homework but self-study -- http

Re: pythagorean triples exercise

2010-10-21 Thread Baba
On Oct 21, 10:18 pm, Terry Reedy tjre...@udel.edu 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 larger than n. This is not well worded. I

Re: lists and list item matches (ghost wodgame)

2010-09-23 Thread Baba
On Sep 23, 4:17 pm, nn prueba...@latinmail.com wrote: On Sep 23, 10:56 am, nn prueba...@latinmail.com wrote: On Sep 22, 6:39 pm, Baba raoul...@gmail.com wrote: On Sep 22, 9:18 pm, Baba raoul...@gmail.com wrote: On Sep 22, 3:38 pm, nn prueba...@latinmail.com wrote: On Sep 21, 6

Re: lists and list item matches (ghost wodgame)

2010-09-23 Thread Baba
On Sep 23, 8:13 pm, nn prueba...@latinmail.com wrote: On Sep 23, 1:25 pm, Baba raoul...@gmail.com wrote: On Sep 23, 4:17 pm, nn prueba...@latinmail.com wrote: On Sep 23, 10:56 am, nn prueba...@latinmail.com wrote: On Sep 22, 6:39 pm, Baba raoul...@gmail.com wrote: On Sep 22, 9

Re: lists and list item matches (ghost wodgame)

2010-09-23 Thread Baba
On Sep 23, 8:13 pm, nn prueba...@latinmail.com wrote: On Sep 23, 1:25 pm, Baba raoul...@gmail.com wrote: On Sep 23, 4:17 pm, nn prueba...@latinmail.com wrote: On Sep 23, 10:56 am, nn prueba...@latinmail.com wrote: On Sep 22, 6:39 pm, Baba raoul...@gmail.com wrote: On Sep 22, 9

Re: lists and list item matches (ghost wodgame)

2010-09-22 Thread Baba
On Sep 22, 3:38 pm, nn prueba...@latinmail.com wrote: On Sep 21, 6:39 pm, Baba raoul...@gmail.com 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 entered) b) adds

Re: lists and list item matches (ghost wodgame)

2010-09-22 Thread Baba
On Sep 22, 9:18 pm, Baba raoul...@gmail.com wrote: On Sep 22, 3:38 pm, nn prueba...@latinmail.com wrote: On Sep 21, 6:39 pm, Baba raoul...@gmail.com wrote: Hi query level: beginner as part of a learning exercise i have written code that: a) asks for a single letter input

basic 2 player wordgame

2010-09-21 Thread Baba
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

Re: basic 2 player wordgame

2010-09-21 Thread Baba
On Sep 21, 1:39 pm, Mel mwil...@the-wire.com 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 i need a hint as to how

lists and list item matches (ghost wodgame)

2010-09-21 Thread Baba
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/assignments/pset5.pdf thanks Baba -- http://mail.python.org/mailman/listinfo/python

Re: accessing a text file

2010-09-16 Thread Baba
On Sep 9, 10:09 pm, Nobody nob...@nowhere.com 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. If you don't like

Re: analysis of algoritms

2010-09-12 Thread Baba
On Sep 9, 11:22 pm, Alain Ketterlin al...@dpt-info.u-strasbg.fr wrote: Baba raoul...@gmail.com 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

analysis of algoritms

2010-09-09 Thread Baba
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.python.org/mailman/listinfo/python-list

Re: mutate dictionary or list

2010-09-08 Thread Baba
! Baba -- http://mail.python.org/mailman/listinfo/python-list

Re: accessing a text file

2010-09-08 Thread Baba
On 8 sep, 02:07, Ben Finney ben+pyt...@benfinney.id.au wrote: Baba raoul...@gmail.com 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

Re: accessing a text file

2010-09-08 Thread Baba
On 8 sep, 12:46, Paul Rubin no.em...@nospam.invalid wrote: Baba raoul...@gmail.com 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

Re: accessing a text file

2010-09-08 Thread Baba
On 8 sep, 14:39, Paul Rubin no.em...@nospam.invalid wrote: Baba raoul...@gmail.com 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

Re: accessing a text file

2010-09-07 Thread Baba
On 7 sep, 02:18, Ben Finney ben+pyt...@benfinney.id.au wrote: Ben Finney ben+pyt...@benfinney.id.au 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

Re: accessing a text file

2010-09-07 Thread Baba
On 7 sep, 13:39, Baba raoul...@gmail.com wrote: On 7 sep, 02:18, Ben Finney ben+pyt...@benfinney.id.au wrote: Ben Finney ben+pyt...@benfinney.id.au writes: We value respect for people here, and that's what you've been shown consistently. But respect for opinions, or for delicacy

mutate dictionary or list

2010-09-07 Thread Baba
is unordered. How Can i however avoid 'acidental' mutation? Thanks Baba -- http://mail.python.org/mailman/listinfo/python-list

Re: accessing a text file

2010-09-07 Thread Baba
On 7 sep, 16:50, Grant Edwards inva...@invalid.invalid wrote: On 2010-09-07, Baba raoul...@gmail.com 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 ask

compare dictionaries

2010-09-07 Thread Baba
any good hints so i'm trying here. Thanks Baba -- http://mail.python.org/mailman/listinfo/python-list

Re: compare dictionaries

2010-09-07 Thread Baba
On 7 sep, 22:08, Gary Herron gher...@digipen.edu 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 existence in dict2.  Return False if one misses, and True if you get through

Re: compare dictionaries

2010-09-07 Thread Baba
up of elements of dict2. Your hint pointed me in the right direction. for k in word.keys(): if k not in hand: return False elif k in hand: if word[k] hand[k]: return False return True Baba -- http

Re: accessing a text file

2010-09-06 Thread Baba
On 6 sep, 00:01, Benjamin Kaplan benjamin.kap...@case.edu wrote: On Sun, Sep 5, 2010 at 5:47 PM, Baba raoul...@gmail.com 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

Re: accessing a text file

2010-09-06 Thread Baba
On 6 sep, 00:04, Seth Rees s...@sthrs.me 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 if word is in word_list. let's

Re: accessing a text file

2010-09-06 Thread Baba
On 6 sep, 16:58, Thomas Jollans tho...@jollybox.de wrote: On Monday 06 September 2010, it occurred to Baba to exclaim: On 6 sep, 00:01, Benjamin Kaplan benjamin.kap...@case.edu wrote: On Sun, Sep 5, 2010 at 5:47 PM, Baba raoul...@gmail.com wrote: level: beginner how can i access

Re: accessing a text file

2010-09-06 Thread Baba
On 6 sep, 18:14, geremy condra debat...@gmail.com wrote: On Mon, Sep 6, 2010 at 8:53 AM, Baba raoul...@gmail.com wrote: On 6 sep, 16:58, Thomas Jollans tho...@jollybox.de wrote: On Monday 06 September 2010, it occurred to Baba to exclaim: On 6 sep, 00:01, Benjamin Kaplan benjamin.kap

accessing a text file

2010-09-05 Thread Baba
, word_list) thanks Baba -- http://mail.python.org/mailman/listinfo/python-list

Re: bisection method: Simulating a retirement fund

2010-09-03 Thread Baba
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

bisection method: Simulating a retirement fund

2010-09-02 Thread Baba
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

Re: Fibonacci: returning a selection of the series

2010-09-02 Thread Baba
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 print fib_range(4,76) Thanks Baba

Re: Fibonacci: How to think recursively

2010-08-29 Thread Baba
? 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

Fibonacci: returning a selection of the series

2010-08-29 Thread Baba
) thanks Baba -- http://mail.python.org/mailman/listinfo/python-list

Re: Fibonacci: How to think recursively

2010-08-29 Thread Baba
Thanks to All for your kind help! Baba -- http://mail.python.org/mailman/listinfo/python-list

Fibonacci: How to think recursively

2010-08-28 Thread Baba
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

palindrome iteration

2010-08-27 Thread Baba
compared chars were identical hence it is a palindrome and i return True tnx Baba -- http://mail.python.org/mailman/listinfo/python-list

comparing tuples

2010-08-22 Thread Baba
if 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

Re: comparing tuples

2010-08-22 Thread Baba
On Aug 22, 7:12 pm, Tim Chase python.l...@tim.thechases.com 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. def tuples(t1, t2):      result

Re: Iterative vs. Recursive coding

2010-08-21 Thread Baba
above? tnx Baba -- http://mail.python.org/mailman/listinfo/python-list

Re: Iterative vs. Recursive coding

2010-08-20 Thread Baba
len(key)==len(target): if key==target: counter+=1 return counter else: return counter return counter print r_countSubStringMatch(atgacatgcacaagtatgcat,atgc) tnx Baba -- http://mail.python.org/mailman/listinfo/python-list

Re: Iterative vs. Recursive coding

2010-08-20 Thread Baba
else: return counter elif len(key)==len(target): if key==target: counter+=1 return counter else: return counter return counter print r_countSubStringMatch(atgacatgcacaagtatgcat,atgc) tnx Baba -- http://mail.python.org/mailman/listinfo

Iterative vs. Recursive coding

2010-08-19 Thread Baba
: print 'key is longer than target...' print '%s is %d times in the target string' %(key,counter) countSubStringMatchRecursive(atgacatgcacaagtatgcat,atgacatgcacaagtatgcatatgc) tnx Baba -- http://mail.python.org/mailman/listinfo/python-list

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-18 Thread Baba
to speed. kind regards to everyone! Baba -- http://mail.python.org/mailman/listinfo/python-list

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-17 Thread Baba
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 assumption for the generalisation? Enjoy the sausages btw :) tnx Baba

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-16 Thread Baba
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

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-16 Thread Baba
): #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 sol Baba -- http://mail.python.org

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-15 Thread Baba
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

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-15 Thread Baba
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

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-15 Thread Baba
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

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-15 Thread Baba
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

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-14 Thread Baba
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

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-13 Thread Baba
): 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

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-13 Thread Baba
): 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

Re: looping through possible combinations of McNuggets packs of 6,9 and 20

2010-08-12 Thread Baba
a value nothing happens. What is wrong? My syntax? My semantic? Both? tnx Baba -- http://mail.python.org/mailman/listinfo/python-list

looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-11 Thread Baba
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:

Ping and ARP on both Win and Linux in Python

2008-03-13 Thread Mauro Baba Mascia
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