Do you know python's object model? A lot of these things will make much
more sense once you do:
http://effbot.org/zone/python-objects.htm
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailma
"spir" wrote
Lie's example actually was:
a,b,c = 1,2,3
print (a,b,c) # here parenthesized
(1, 2, 3)
Oops, I've been using Python 3 too much, I mentally blanked
out the parens!
Sorry about that.
Alan G.
___
Tutor maillist - Tutor@python.or
On Mon, 25 Jan 2010 01:06:45 -
"Alan Gauld" wrote:
>
> "Lie Ryan" wrote
>
> >> and used print, I thought they would be considered the same whether as
> >> a variable, or as a direct line, guess not.
> > what is equivalent:
> > print (a, b, c)
> >
> > and
> > x = a, b, c
> > print x
> >
"David Hutto" wrote
>>> a = 1
>>> b = 2
>>> c = 3
>>> x = a,b,c
>>> print a,b,c
1 2 3
>>> print x
(1, 2, 3)
So 'print a,b,c' says display the values of a,b,c in the sequence of
a,b,c given.
'print x' says print the value of x, x grabs a's value, b's value, and
c's value,
and displays the
Re: [Tutor] The magic parentheses
Sunday, January 24, 2010 9:28 PM
From:
"David Hutto"
Add sender to Contacts
To:
"Alan Gauld"
--- On Sun, 1/24/10, Alan Gauld wrote:
> From: Alan Gauld
> Subject: Re: [Tutor] The magic parentheses
> To: tutor@python.org
> Date
"Lie Ryan" wrote
and used print, I thought they would be considered the same whether as
a variable, or as a direct line, guess not.
what is equivalent:
print (a, b, c)
and
x = a, b, c
print x
both construct a tuple and prints a,b,c as tuple
Not quite:
a = 1
b = 2
c = 3
x = a,b,c
print
On 01/24/10 19:17, David Hutto wrote:
> Thanks
> for the solutions and the quick responses. I just removed the variable
> and used print, I thought they would be considered the same whether as
> a variable, or as a direct line, guess not.
>
what is equivalent:
print (a, b, c)
and
x = a, b, c
pr
On Sun, Jan 24, 2010 at 12:08 PM, Alan Gauld wrote:
>
> "Hugo Arts" wrote
>
> print "this is {0}".format("formatted")
>>
>> this is formatted
>
> Caveat:
> this style only works in Python 3.0 upwards (or maybe in 2.6/2.7?)
It's in 2.6
http://docs.python.org/library/stdtypes.html#str.for
"Hugo Arts" wrote
print "this is {0}".format("formatted")
this is formatted
Caveat:
this style only works in Python 3.0 upwards (or maybe in 2.6/2.7?)
Alan G.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription option
@David,
Alan and rest have clarified your doubt I guess. However let me point you
towards some other mistakes.
def area1(radius):
area1r = 3.14159 * mainvar1**2
return area1r
print area1r
def area2(radius):
area2r = 3.14159 * mainvar2**2
return area2r
print area2r
Here y
Thanks
for the solutions and the quick responses. I just removed the variable
and used print, I thought they would be considered the same whether as
a variable, or as a direct line, guess not.
Thanks again,
David
___
Tutor maillist - Tutor@py
"David Hutto" wrote
This is my first post to the list, so tell me if I'm posting incorrectly.
You are doing fine. Welcome.
My problem is when the results are printed, I get this:
>>>
('Variable 2,', 490.0, 'is greater than', 'Variable 2,', 8.0, '.')
The parentheses, as well as the apos
On Sun, Jan 24, 2010 at 7:14 AM, David Hutto wrote:
> Hi,
>
> This is my first post to the list, so tell me if I'm posting incorrectly.
>
> I'm creating a script, http://python.codepad.org/mHyqbJ2z that gives the
> area of two circles, based on their radius, and displays the difference
> between
On 01/24/10 17:14, David Hutto wrote:
> Hi,
>
> This is my first post to the list, so tell me if I'm posting incorrectly.
>
> I'm creating a script, http://python.codepad.org/mHyqbJ2z that gives the area
> of two circles, based on their radius, and displays the difference between
> the two resu
Hi,
This is my first post to the list, so tell me if I'm posting incorrectly.
I'm creating a script, http://python.codepad.org/mHyqbJ2z that gives the area
of two circles, based on their radius, and displays the difference between the
two results.
My problem is when the results are printed, I
15 matches
Mail list logo