On 28/04/2016 10:34, g.v.aar...@skct.edu.in wrote:
start_list = [5, 3, 1, 2, 4]
square_list = []
# Your code here!
for square_list in start_list:
x = pow(start_list, 2)
square_list.append(x)
square_list.sort()
print square_list
TypeError: unsupported operand type(s) for ** or pow(): 'l
g.v.aar...@skct.edu.in wrote:
> start_list = [5, 3, 1, 2, 4]
> square_list = []
>
> # Your code here!
> for square_list in start_list:
You are iterating over start_list, that's OK. But you are assigning the
current value to square_list, a variable name that you already use for the
list where y
On Thu, 28 Apr 2016 07:34 pm, g.v.aar...@skct.edu.in wrote:
> start_list = [5, 3, 1, 2, 4]
> square_list = []
Here you set square_list to a list.
> # Your code here!
> for square_list in start_list:
.^
Here you set square_list to each item of the start_list. So the first time
ar
start_list = [5, 3, 1, 2, 4]
square_list = []
# Your code here!
for square_list in start_list:
x = pow(start_list, 2)
square_list.append(x)
square_list.sort()
print square_list
TypeError: unsupported operand type(s) for ** or pow(): 'list' and 'int'
Please provide me the solution for the
kkiranmca writes:
> Hi i am new for this version and could please help me .
Welcome!
Don't ask whether you can ask. Just ask.
http://catb.org/~esr/faqs/smart-questions.html>
--
\ “I put contact lenses in my dog's eyes. They had little |
`\ pictures of cats on them. Then I to
On Wed, Jun 22, 2011 at 11:50 PM, kkiranmca wrote:
> Hi i am new for this version and could please help me .
You didn't pose an actual question...
Cheers,
Chris
--
http://mail.python.org/mailman/listinfo/python-list
Hi i am new for this version and could please help me .
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 21, 3:47 am, Steven D'Aprano <[EMAIL PROTECTED]
cybersource.com.au> wrote:
> On Sat, 20 Sep 2008 16:27:41 -0700, Alex Snast wrote:
> > Another quick question please, is the List data structure just a dynamic
> > array? If so how can you use static size array, linked list, AVL trees
> > etcet
On Sun, 21 Sep 2008 01:56:59 +0200, Christian Heimes wrote:
> Just *don't* try to abuse lists by creating fancy stuff e.g. linked
> lists. The memory overhead is going to kill your app.
I agree with your advice not to abuse lists, but not for the reason you
give. The memory overhead of a linked
On Sat, 20 Sep 2008 16:27:41 -0700, Alex Snast wrote:
> Another quick question please, is the List data structure just a dynamic
> array? If so how can you use static size array, linked list, AVL trees
> etcetera.
Before I answer your question, I should say that you can go a LONG way
with just t
Christian Heimes:
> Unless you have specific needs for highly specialized data types, use lists.
There's also the collections.deque for other related purposes.
(I suggest people willing to look at some nice C code to read the
sources of deque, Hettinger has created some refined code, very
readabl
On Sat, 20 Sep 2008 16:22:31 -0700, Alex Snast wrote:
> That's a lot of responses guys. Thanks a lot i think i got it. Another
> question, are there any pointers in python (or iterators) for when i use
> a data structure that doesn't support random access?
That surely depends on the data structu
En Sat, 20 Sep 2008 20:27:41 -0300, Alex Snast <[EMAIL PROTECTED]> escribió:
Another quick question please, is the List data structure just a
dynamic array? If so how can you use static size array, linked list,
AVL trees etcetera.
Yes, lists are implemented as dynamic arrays (but you shouldn't
Alex Snast wrote:
Another quick question please, is the List data structure just a
dynamic array? If so how can you use static size array, linked list,
AVL trees etcetera.
You should treat Python lists as an opaque item. You shouldn't concern
yourself with the implementation details. Python li
On Sep 20, 8:13 pm, [EMAIL PROTECTED] wrote:
> Duncan Booth:
>
> > > e.g. the python equivalent to the c++ loop
> > > for (i = 10; i >= 0; --i)
>
> > The exact equivalent would be:
> > for i in range(10, -1, -1): print i
>
> I'd use xrange there. Anyway, I have always felt that Python synta
On Sep 20, 8:13 pm, [EMAIL PROTECTED] wrote:
> Duncan Booth:
>
> > > e.g. the python equivalent to the c++ loop
> > > for (i = 10; i >= 0; --i)
>
> > The exact equivalent would be:
> > for i in range(10, -1, -1): print i
>
> I'd use xrange there. Anyway, I have always felt that Python synta
Duncan Booth:
> > e.g. the python equivalent to the c++ loop
> > for (i = 10; i >= 0; --i)
>
> The exact equivalent would be:
> for i in range(10, -1, -1): print i
I'd use xrange there. Anyway, I have always felt that Python syntax
not easy to understand at first sight, expecially when you
Gary Herron wrote:
> Or you can create a new reversed (copy of the original) list and iterate
> through it
>
> for item in reversed(L):
> print item
It's not a copy, it's a view:
>>> items = [1,2,3]
>>> r = reversed(items)
>>> items[:] = "abc"
>>> for item in r: print item
...
c
b
a
Peter
-
Fredrik Lundh wrote:
e.g. the python equivalent to the c++ loop
for (i = 10; i >= 0; --i)
use range with a negative step:
for i in range(10-1, -1, -1):
...
or just reverse the range:
for i in reversed(range(10)):
...
(and to include the 10 in the range, add one to
Alex Snast wrote:
Hello
I'm new to python and i can't figure out how to write a reverse for
loop in python
e.g. the python equivalent to the c++ loop
for (i = 10; i >= 0; --i)
--
http://mail.python.org/mailman/listinfo/python-list
What are you trying to loop through?
Alex Snast wrote:
I'm new to python and i can't figure out how to write a reverse for
loop in python
e.g. the python equivalent to the c++ loop
for (i = 10; i >= 0; --i)
use range with a negative step:
for i in range(10-1, -1, -1):
...
or just reverse the range:
2008/9/20 Alex Snast <[EMAIL PROTECTED]>:
> I'm new to python and i can't figure out how to write a reverse for
> loop in python
>
> e.g. the python equivalent to the c++ loop
>
> for (i = 10; i >= 0; --i)
for i in range(10, 0, -1):
print i
--
Cheer
Alex Snast <[EMAIL PROTECTED]> wrote:
> Hello
>
> I'm new to python and i can't figure out how to write a reverse for
> loop in python
>
> e.g. the python equivalent to the c++ loop
>
> for (i = 10; i >= 0; --i)
>
The exact equivalent would be
On Sep 20, 11:16�am, Alex Snast <[EMAIL PROTECTED]> wrote:
> Hello
>
> I'm new to python and i can't figure out how to write a reverse for
> loop in python
>
> e.g. the python equivalent to the c++ loop
>
> for (i = 10; i >= 0; --i)
>>> for i i
Alex Snast a écrit :
Hello
I'm new to python and i can't figure out how to write a reverse for
loop in python
e.g. the python equivalent to the c++ loop
for (i = 10; i >= 0; --i)
for (i = 0; i < 10; i--) -> for i in range(10):
for (i = 10; i >= 0; --i) -> for i i
Hello
I'm new to python and i can't figure out how to write a reverse for
loop in python
e.g. the python equivalent to the c++ loop
for (i = 10; i >= 0; --i)
--
http://mail.python.org/mailman/listinfo/python-list
26 matches
Mail list logo