How to make a list of numbers with the range function | Python

Опубликовано: 14 Октябрь 2024
на канале: CyberTodd
447
14

You can use - list - keyword to automatically create a list in 1 line of code. Example:

numbers = list(range(1, 6))
print(numbers)

Output:
[1, 2, 3, 4, 5]

-------------------------Subscribe----------------------------
• If you like to see a variety of fun and interactive projects written in Python
• If you love ☕ and 🐶 WAIT! - Yeah! Definitely, coffee and dogs!
-----------------------------------------------------------------------

-------------------------Socials----------------------------
• Twitter:   / iftodd1  
• Facebook:   / iftodd  
• Instagram:   / if_todd  
------------------------------------------------------------------

-------------------------Support----------------------------
You can support me here:   / if_todd  
--------------------------------------------------------------------

How to make a list of numbers with the range function #python #shorts #function