Walter and Dave, thank you for the useful and detailed answer, now I see it
better. I didn't write code, because once I realized I had spoiled
something, the mistake has no more importance except historical, the correct
solutions have importance.
2011. június 8. 4:19 Dave Angel írta, :
> Now, if
On 01/-10/-28163 02:59 PM, Válas Péter wrote:
Hi,
let X be a mutable container, such as dict/set/list=bytearray, and Y=X,
When I change X, Y will follow it, having always the same value, although
id(X)!=id(Y). How is that, what is the explanation? Meanwhile the same for
immutable types results a
unsubscribe
在 2011-06-08 07:11:33,"Walter Prins" 写道:
Hi,
2011/6/7 Válas Péter
Hi,
let X be a mutable container, such as dict/set/list=bytearray, and Y=X,
When I change X, Y will follow it, having always the same value, although
id(X)!=id(Y).
That's not correct:
Python 2.7 (r27:82525, Jul
Hi,
2011/6/7 Válas Péter
> Hi,
>
> let X be a mutable container, such as dict/set/list=bytearray, and Y=X,
> When I change X, Y will follow it, having always the same value, although
> id(X)!=id(Y).
That's not correct:
Python 2.7 (r27:82525, Jul 4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)]
2011. június 8. 1:02 Wayne Werner írta, :
> You are slightly confused - ints are not mutable!
>
All right, I was really wrong in this question (here it is after midnight
:-), but this doesn't make an influence on the main question.
___
Tutor maillist -
Apologies for the top post, my phone doesn't allow editing the message body.
You are slightly confused - ints are not mutable! You can combine or
multiply them, along with several other operations, but they are certainly
not mutable. The easiest way to check is use them as keys in a dict. You
can'
"Andre Engels" wrote
Actually, no, this case it's not your ignorance. What is probably
going on is that you are using Python 2, but the book is going with
Python 3.
You can quickly check the version by just typing python at
an OS command prompt to get into the interactive interpreter(>>>)
Hi,
let X be a mutable container, such as dict/set/list=bytearray, and Y=X,
When I change X, Y will follow it, having always the same value, although
id(X)!=id(Y). How is that, what is the explanation? Meanwhile the same for
immutable types results a real copy, and so does for simple mutables such
On Tue, Jun 7, 2011 at 11:26 PM, Matthew Brunt wrote:
> i'm very new to python (currently going through a python for beginners
> book at work to pass the time), and i'm having trouble with an if
> statement exercise. basically, i'm creating a very simple password
> program that displays "Access G
i'm very new to python (currently going through a python for beginners
book at work to pass the time), and i'm having trouble with an if
statement exercise. basically, i'm creating a very simple password
program that displays "Access Granted" if the if statement is true.
the problem i'm having is
Hello Michael
On 7 June 2011 21:10, Michael bridges wrote:
> ok, will attempt to clarify.
> i want to out put of two numbers [int or float or anything] to be x.xx not
> x.x.
> i want two numbers after the decimal not one.
>
> Alan's already given you exactly the correct answer. Have you tried h
ok, will attempt to clarify.
i want to out put of two numbers [int or float or anything] to be x.xx not x.x.
i want two numbers after the decimal not one.
--- On Tue, 6/7/11, Alan Gauld wrote:
> From: Alan Gauld
> Subject: Re: [Tutor] floats
> To: tutor@python.org
> Date: Tuesday, June 7, 2011
"Michael bridges" wrote
i want to 10 / 1000 and get 0.01 not 0
if 1000 is made 1000.00 then 0.01 is printed
but that gives 500 / 1000.00 is 0.5 not 0.50
can someone till me how to get a two decimal precision every time?
You are confusing two different things..
The first case is that of inte
13 matches
Mail list logo