Re: [Tutor] question about the an exercise in (including the discription about the exercise)

2012-01-04 Thread David Palao
Hi, some hints: 1) strings are iterables 2) help(zip) 3) help(enumerate) Best regards. 2012/1/4 daedae11 > ** > Who can give me an example program about the exercise 6 in chapter 9 in > ? > > The exercise is: > Write a program that compare the two files given by users. If the two > files' cont

Re: [Tutor] Should error checking be duplicated for both functions if one function calls another one?

2015-06-01 Thread David Palao
Hello, Not sure if I got it, but, in my opinion functions should do only one thing.So if function 2 finds an error, it should raise it. There should be another function (function 1 in your case?) taking care of possible raised errors. Best 2015-06-01 16:27 GMT+02:00 boB Stepp : > Suppose in a gi

Re: [Tutor] Root and power

2015-07-29 Thread David Palao
2015-07-29 5:29 GMT+02:00 Job Hernandez : > How is it going tutors? > > The following problem seems impossible to me: > > "*Write a program that asks the user to enter an integer and prints two > integers, root and pwr, such that 0 < pwr < 6 and root^pwr (root**pwr) is > equal to the integer entere

Re: [Tutor] Help

2016-06-28 Thread David Palao
2016-06-28 7:54 GMT+02:00 Aaron Johnson : > I have a program that is telling my i need your digital snake, but i dont > want a snake. Help > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.o

Re: [Tutor] reading files

2014-01-29 Thread David Palao
2014-01-29 Mark Lawrence : > On 29/01/2014 14:50, Gabriele Brambilla wrote: >> >> thanks to everyone, I've used David's method. >> >> Gabriele >> >> 2014-01-29 Mark Lawrence > > >> >> >> On 29/01/2014 02:09, Gabriele Brambilla wrote: >> >> Hi, >>

[Tutor] Fwd: reading files

2014-01-29 Thread David Palao
...that I forgot to send to the mailing list... -- Forwarded message -- From: David Palao Date: 2014-01-29 Subject: Re: [Tutor] reading files To: Gabriele Brambilla Hi, One possibility I can think of: If you make one string with one line of your input, like s

Re: [Tutor] Changing only intergers in a list of strings

2014-02-05 Thread David Palao
Hi, Is it not clear to me if you must distinguish ints from other type of numbers, or if, for instances floats and ints must be dealt differently. Anyway, I would propose something like the following function: def FindNumbers(a_string): print "You entered:", a_string out_list = [] for

Re: [Tutor] Changing only intergers in a list of strings

2014-02-05 Thread David Palao
Sorry, there is a typo: "(num+a,)" should be "(num+1,)", obviously. 2014-02-05 David Palao : > Hi, > Is it not clear to me if you must distinguish ints from other type of > numbers, or if, for instances floats and ints must be dealt > differently. > Anyway,

Re: [Tutor] good django book?

2014-02-07 Thread David Palao
Hi, The Django community has plenty of good information in the web. I would go there and have a look. At least this is what I did, precisely for the same reason that you mention. Best, David 2014-02-06 Christopher Spears : > Can anyone recommend a good Django book? I have been looking on Amazon,

Re: [Tutor] second if

2014-02-10 Thread David Palao
Also, could you explain better what is your doubt? You don't understand what "index >= 1" means, or why this "if" at this point, or anything else? Best 2014-02-07 17:14 GMT+01:00 rahmad akbar : > he guys, i am trying to understand this code: i understand the first if > statement (if line.startswi

Re: [Tutor] second if

2014-02-10 Thread David Palao
I guess the replies by Alan and Peter precisely answer to your question? Best 2014-02-10 12:46 GMT+01:00 rahmad akbar : > David, > > thanks for your reply. i cant figure out why the if at that point and what > is the 'if' try to accompolish > > > On Mon, Feb 10

Re: [Tutor] for: how to skip items

2014-02-17 Thread David Palao
Hi Gabriele, Without knowing the details of what you are trying, I guess you could be interested in looking at how to define your own iterators. Regards 2014-02-17 17:05 GMT+01:00 Gabriele Brambilla : > Hi, > > I'm wondering how I can (if I can) make a for loop in which I don't use all > the elem

Re: [Tutor] from command prompt use interactive python and running script together

2014-02-21 Thread David Palao
2014-02-21 15:20 GMT+01:00 Gabriele Brambilla : > Hi, > > Is possible on python to running scripts from the command prompt (I'm using > python on windows) and in the end saving all the variables and continue the > analysis in the interactive mode? (the one that you activate typing python > in the c

Re: [Tutor] When to use multiprocessing Managers?

2014-02-26 Thread David Palao
2014-02-25 11:52 GMT+01:00 James Chapman : > Hello tutors > > I'm curious about managers and when to use them. > For example, I see they offer a Queue() for sharing a Q between > processes, but if I create a Q in the parent process and pass it down > to child processes, then they can put messages i

Re: [Tutor] Help Noob Question

2014-03-27 Thread David Palao
Hello, What do you mean by "open it in the interpreter"? Do you want to open it and read from it its content? or do you want to execute its python code within the interpreter? Best 2014-03-27 7:43 GMT+01:00 Leo Nardo : > Im on windows 8 and i need to open a file called string1.py that is on my > d

Re: [Tutor] Inheritance in classes

2014-04-08 Thread David Palao
2014-04-08 7:44 GMT+02:00 Santosh Kumar : > Can i mask the parent attibutes in the child. let me give a quick example. > > In [1]: class a: >...: value1 = 1 >...: value2 = 2 >...: > > In [2]: class b(a): >...: value3 = 3 >...: > > In [3]: obj1 = b() > > In [4]: obj1.

Re: [Tutor] While truth

2014-05-20 Thread David Palao
Hi, 6, -1 or 0 are not bools (True or False): >>> 6 is True False >>> 0 is False False If you had to design a language and want to think about using numbers in a logical context you could do at least two things: 1) convert the number to bool, ie define a set of rules to assign to each number a lo

Re: [Tutor] Function not returning 05 as string

2015-04-13 Thread David Palao
Hello, In the code that you posted, as it is, you are: 1) defining a function (numberentry) 2) defining a global variable (number01) and setting it to 0 3) calling numberentry discarding the result 4) printing the value of the global variable number01 I would guess that you want to store the resul