Re: [Tutor] Keeping change-in-place vs. copy methods straight

2014-04-28 Thread Emile van Sebille
On 4/28/2014 11:45 AM, taserian wrote: Is there some sort of rule-of-thumb to determine if a function is in-place or returns a value? my rule of thumb is to ask: Python 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license

Re: [Tutor] Keeping change-in-place vs. copy methods straight

2014-04-28 Thread Danny Yoo
Hi Antonio, Unfortunately, I don't think it's apparent whether or not a function applies mutations or is a pure computation. In Python, those are by convention or documentation rather than part of the language. There are other programming languages can control the effects and scope of mutation,

Re: [Tutor] New to Python

2014-04-28 Thread Steven D'Aprano
On Sat, Apr 26, 2014 at 03:53:33PM -0700, jordan smallwood wrote: > Hello, > > I am new to Python. I mean completely new and we're working on this > problem set in class where they give us specs and we have to build > something based off these specs. I have no idea what they're asking. > Could

[Tutor] Keeping change-in-place vs. copy methods straight

2014-04-28 Thread taserian
I can't claim to be new to programming, but I've dabbled in Python over and over again to get small problems and puzzles resolved. One thing that I find I can't keep straight are the methods that change a list in place, vs. those that return a copy (sometimes transformed) of the list. Call me old-

Re: [Tutor] New to Python

2014-04-28 Thread Danny Yoo
Hi Jordan, You probably want to read up to chapter 3 (including the "Functions" chapter) in "How to Think Like a Computer Scientist": http://www.greenteapress.com/thinkpython/html/index.html or some equivalent tutorial, so that you at least know what the terms in the problem statement means.

Re: [Tutor] Stephen Mik-Almost Brand New to Python 3.4.0-"Guess My Number" program is syntactically correct but will not run as expected

2014-04-28 Thread Steven D'Aprano
On Mon, Apr 28, 2014 at 01:49:31PM -0400, C Smith wrote: > That is definitely more useful information in answering your questions. > Whenever you see the error you are getting: > > NameError: name 'smv_guessNumber' is not defined > > That means you are using a variable, in this case 'smv_guessNum

Re: [Tutor] Stephen Mik-Almost Brand New to Python 3.4.0-"Guess My Number" program is syntactically correct but will not run as expected

2014-04-28 Thread Steven D'Aprano
On Mon, Apr 28, 2014 at 01:50:56PM -0400, C Smith wrote: > I should probably clarify that this list is mainly for python2.7, correct > me if I am wrong. Nope, any version of Python. If anyone is silly enough to be using Python 0.9 (which is over 20 years old!) I can try to answer their questions

Re: [Tutor] Stephen Mik-Almost Brand New to Python 3.4.0-"Guess My Number" program is syntactically correct but will not run as expected

2014-04-28 Thread Steven D'Aprano
On Mon, Apr 28, 2014 at 10:32:06AM -0700, Stephen Mik wrote: >     I must be doing something very wrong. The program is supposed to > run a main loop ,for control of the program. The program DOES print > out the prompts before the While Loop, but when it comes to a variable > named"smv_guessNum

Re: [Tutor] Stephen Mik-Almost Brand New to Python 3.4.0-"Guess My Number" program is syntactically correct but will not run as expected

2014-04-28 Thread C Smith
> > The reason this is happening here is you need to import sys. > I don't know why you would think importing sys would fix this. docs say it accepts from sys.stdin I now see that it is not necessary to import sys, although I am not sure why. On Mon, Apr 28, 2014 at 1:59

Re: [Tutor] Stephen Mik-Almost Brand New to Python 3.4.0-"Guess My Number" program is syntactically correct but will not run as expected

2014-04-28 Thread C Smith
The reason this is happening here is you need to import sys. > I don't know why you would think importing sys would fix this. docs say it accepts from sys.stdin On Mon, Apr 28, 2014 at 1:55 PM, Philip Dexter wrote: > > > On Mon, 28 Apr 2014, C Smith wrote: > > I should probably clar

Re: [Tutor] Stephen Mik-Almost Brand New to Python 3.4.0-"Guess My Number" program is syntactically correct but will not run as expected

2014-04-28 Thread Peter Otten
Stephen Mik wrote: > My program, Assignment4,does run partially. You can see the results of the > Python Shell attached to this email. I also have included part of my code > for your perusal. > > I must be doing something very wrong. The program is supposed to run a > main loop ,for control of th

Re: [Tutor] Stephen Mik-Almost Brand New to Python 3.4.0-"Guess My Number" program is syntactically correct but will not run as expected

2014-04-28 Thread C Smith
I should probably clarify that this list is mainly for python2.7, correct me if I am wrong. On Mon, Apr 28, 2014 at 1:49 PM, C Smith wrote: > That is definitely more useful information in answering your questions. > Whenever you see the error you are getting: > > NameError: name 'smv_guessNumber

Re: [Tutor] Stephen Mik-Almost Brand New to Python 3.4.0-"Guess My Number" program is syntactically correct but will not run as expected

2014-04-28 Thread C Smith
That is definitely more useful information in answering your questions. Whenever you see the error you are getting: NameError: name 'smv_guessNumber' is not defined That means you are using a variable, in this case 'smv_guessNumber', that has not been created yet. The reason this is happening he

[Tutor] Stephen Mik-Almost Brand New to Python 3.4.0-"Guess My Number" program is syntactically correct but will not run as expected

2014-04-28 Thread Stephen Mik
Dear Python Tutor:     Well,I am Stephen Mik,and I'm a beginning,rookie programmer who is just trying to get a class Assignment going. The instructor of my class does not accept email and she is not on Campus on Monday. So,my only recourse is to turn to Python Tutor for assistance.     My progr

Re: [Tutor] converting strings to float: strange case

2014-04-28 Thread C Smith
.split() will split things based on whitespace or newlines. Do you know that your file is only going to contain things that should convert to floats? If you post your entire code, the error you have included will be more helpful as it points to a certain line. The last line in your code has (stri)

Re: [Tutor] converting strings to float: strange case

2014-04-28 Thread Joel Goldstick
On Apr 28, 2014 11:14 AM, "Gabriele Brambilla" < gb.gabrielebrambi...@gmail.com> wrote: > > Hi, > > I'm trying to convert a string to a float. It seems a basic thing but I don't know why I'm getting this erroris > > Traceback (most recent call last): > File "phresREADER.py", line 27, in > tr

Re: [Tutor] converting strings to float: strange case

2014-04-28 Thread Gabriele Brambilla
solved, sorry for the disturb http://stackoverflow.com/questions/23344345/strings-not-converting-to-float-as-expected/23344830#23344830 bye Gabriele 2014-04-28 11:13 GMT-04:00 Gabriele Brambilla < gb.gabrielebrambi...@gmail.com>: > Hi, > > I'm trying to convert a string to a float. It seems a

[Tutor] converting strings to float: strange case

2014-04-28 Thread Gabriele Brambilla
Hi, I'm trying to convert a string to a float. It seems a basic thing but I don't know why I'm getting this erroris Traceback (most recent call last): File "phresREADER.py", line 27, in tra = float(stri) ValueError: could not convert string to float: My file has this line 5.5e+000 5.

Re: [Tutor] New to Python

2014-04-28 Thread R. Alan Monroe
> 1. Write a program module with at least two functions. Hint: "def" is the Python keyword used to define a function. You can read all about def in the docs on python.org. Alan ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscripti

Re: [Tutor] New to Python

2014-04-28 Thread Mark Lawrence
On 26/04/2014 23:53, jordan smallwood wrote: Hello, I am new to Python. I mean completely new and we're working on this problem set in class where they give us specs and we have to build something based off these specs. I have no idea what they're asking. Could someone help get me started on the

[Tutor] New to Python

2014-04-28 Thread jordan smallwood
Hello, I am new to Python. I mean completely new and we're working on this problem set in class where they give us specs and we have to build something based off these specs. I have no idea what they're asking. Could someone help get me started on the path to figuring this out? Below is the qu