miércoles, 19 de octubre de 2022

range() to a list in Python: My_list = [*range(10, 21, 1)]

https://www.geeksforgeeks.org/range-to-a-list-in-python/

range() to a list in Python


# Create a list in a range of 10-20
My_list = [*range(10, 21, 1)]
  
# Print the list
print(My_list)

Output :

As we can see in the output, the argument-unpacking operator has successfully unpacked the result of the range function.

No hay comentarios:

Publicar un comentario