for(each) element aliasing
Will McGugan
news at NOwillmcguganSPAM.com
Mon Nov 22 11:48:15 EST 2004
Matija Papec wrote:
> I know how to alter the list via list indicies but I would like to know if
> there is posibility to write in Python something like:
>
> my @arr = 1..3;
> for my $element (@arr) {
> $element *= 2;
> }
> print "@arr\n";
>
> and get the result
> -------
> 2 4 6
>
>
Something like this?
arr= range(1,4)
for index, value in enumerate( arr):
arr[index]*= 2
print arr
Regards,
Will McGugan
More information about the Python-list
mailing list