Sander Sweers wrote:
2009/3/7 Alan Gauld :
mycopy = original[:]
Returns a slice of the original list. In this case it so happens
the slice is the full list.
mycopy = list(original)
Use the list type constructor to make a list out of its argument.
It just so happens the argument in this case
2009/3/7 Alan Gauld :
>> mycopy = original[:]
>
> Returns a slice of the original list. In this case it so happens
> the slice is the full list.
>
>> mycopy = list(original)
>
> Use the list type constructor to make a list out of its argument.
> It just so happens the argument in this case is a lis
2009/3/7 Alan Gauld
>
> "Emad Nawfal (عماد نوفل)" wrote
>
> As a linguist, I would love to know what the difference between these
>> things are:
>>
>
> The differences are the same whether you are a linguist or not :-)
> (and yes I know my reading is incorrect grammaticallly but I couldn't
> re
"Emad Nawfal (عماد نوفل)" wrote
As a linguist, I would love to know what the difference between
these
things are:
The differences are the same whether you are a linguist or not :-)
(and yes I know my reading is incorrect grammaticallly but I couldn't
resist it!)
mycopy = original[:]
Re
On Sat, Mar 7, 2009 at 2:36 PM, Kapsicum wrote:
>
>
> On Sun, Mar 8, 2009 at 12:39 AM, sphennings W. wrote:
>
>> When I enter the following code into IDLE do both lists have the same
>> value?
>> How would I manipulate both lists separately?
>>
>> >>> List1=[1,2,3]
>> >>> List2=List1
>> >>> List
On Sun, Mar 8, 2009 at 12:39 AM, sphennings W. wrote:
> When I enter the following code into IDLE do both lists have the same
> value?
> How would I manipulate both lists separately?
>
> >>> List1=[1,2,3]
> >>> List2=List1
> >>> List2.reverse()
> >>> print(List2)
> [3, 2, 1]
> >>> print(List1)
>
sphennings W. wrote:
When I enter the following code into IDLE do both lists have the same value?
They way you've done it, both names List1 and List2 refer/point to the
same list. Changes to one affect both.
How would I manipulate both lists separately?
Assign them separately or use a c
On Sat, Mar 7, 2009 at 2:09 PM, sphennings W. wrote:
> When I enter the following code into IDLE do both lists have the same
> value?
> How would I manipulate both lists separately?
>
> >>> List1=[1,2,3]
> >>> List2=List1
> >>> List2.reverse()
> >>> print(List2)
> [3, 2, 1]
> >>> print(List1)
>
When I enter the following code into IDLE do both lists have the same value?
How would I manipulate both lists separately?
>>> List1=[1,2,3]
>>> List2=List1
>>> List2.reverse()
>>> print(List2)
[3, 2, 1]
>>> print(List1)
[3, 2, 1]
>>> List2.append(0)
>>> print(List2)
[3, 2, 1, 0]
>>> print(List1)