for loop in python
BartC
bc at freeuk.com
Thu Apr 28 06:04:51 EDT 2016
On 28/04/2016 10:34, g.v.aarthi at 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(): 'list' and 'int'
> Please provide me the solution for the above problem
Try:
start_list = [5, 3, 1, 2, 4]
square_list = []
# Your code here!
for i in start_list:
x = pow(i, 2)
square_list.append(x)
square_list.sort()
print (square_list)
More information about the Python-list
mailing list