Hello,

1.) a short example for Python 3, but not exactly what they want.

def square(numbers):
    yield from sorted(n**2 for n in numbers)

numberlist = [99, 4, 3, 5, 6, 7, 0]
result = list(square(numberlist))

To solve this tutorial, you need a different way.
I'm just showing how sexy Python 3 is ;-)
Python 2.7 feels old... it is old. Please learn Python 3.

Greetings
Andre

Am 08.05.2017 um 08:52 schrieb gyrhgyrh...@gmail.com:
> Python - Exercise 5
> 1. Write a function that gets a list (list) of numbers. The function returns 
> a new list of ordered square numbers from the smallest to grow.
> For example, for the list [2, 4, 5, 3, 1] the function returns
> [25, 16, 9, 4, 1].
>
> 2. Write a function that receives a list (list) and a number. The function 
> returns the number of times the number appears in the list.
> For example, for list [2, 4, 2, 3, 2] and number 2 will return 3 because 
> number 2 is listed 3 times.
>
> The answers here:
>
> https://www.youtube.com/watch?v=nwHPM9WNyw8&t=36s


Attachment: signature.asc
Description: OpenPGP digital signature

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to