Creation and use of ranges

The Range () function creates a list of variables for you to use, very common when working with “for” loops.

There are two ways to create a range:

  • Range (stop): this range starts with zero and ends with the number given as the stop value.
  • Range ([start], stop [step]): you give the function the lower bound, the upper bound and the difference between each value.

In case of ranges, all parameters must be integers, values can be positive or negative and the upper bound in both types is non-inclusive.

There were two types of ranges in python 2, range and x-range, now in python 3 we only have the range we all know and love.

It is also possible to create a random rage of numbers using the rand-range function, but since you have to import a module to use it you should just focus your attention in the first two.

In the python 3 range, ranges have their own data type, and before in python 2, ranges produced lists and x-ranges produced iterators minus a sequence.

Publicado por: juansalvadorfernandez

Elegí estudiar ITE porque pienso que es una carrera versátil con la que se pueden lograr cosas muy interesantes. Aunque realmente no sé si alguna otra carrera me gustaría más, las personas terminan haciendo lo que les gusta, independientemente de la carrera que estudien. Si alguien me pregunta quien es mi héroe, sería mi padre, pues es una persona fuerte que en momento de necesidad sacó adelante a su familia, pagó los estudios de sus hermanos, es un profesionista que disfruta de su trabajo y que tiene metas fijas y aspira a ellas con todas sus fuerzas. Hace tiempo tocaba la flauta dulce e intenté aprender a tocar piano, teclado y guitarra. No me gusta el deporte. Realmente no tengo un autor ni un libro favorito, siento que me falta encontrar un tema o un estilo que realmente me guste.

Etiquetas, Deja un comentario

Deja un comentario