+ 2

How to transfer range number to list ?

How to transfer range numbers _ 1 2 3 4 5 To list ??? https://code.sololearn.com/cs6tK7hyeM9L/?ref=app

6th Apr 2021, 11:00 AM
🔰 Arit Dey 🔰
🔰 Arit Dey 🔰 - avatar
14 ответов
+ 5
You can try with append function n=int(input()) list=[] for i in range(n): list.append(i) print(list)
6th Apr 2021, 11:02 AM
Aditya
Aditya - avatar
+ 8
my_list = list(range(1, 10)) print(my_list)
6th Apr 2021, 11:02 AM
SAN
SAN - avatar
+ 4
my_list = list(range(1, 10)) I know that , but i don't say this please see the code
6th Apr 2021, 11:05 AM
🔰 Arit Dey 🔰
🔰 Arit Dey 🔰 - avatar
6th Apr 2021, 11:15 AM
SAN
SAN - avatar
+ 2
what do you mean? please provide an example
6th Apr 2021, 11:01 AM
Slick
Slick - avatar
+ 2
Aditya it's really good your code is properly work in my code thanks bro
6th Apr 2021, 11:21 AM
🔰 Arit Dey 🔰
🔰 Arit Dey 🔰 - avatar
+ 1
Aditya ok i will try your code
6th Apr 2021, 11:07 AM
🔰 Arit Dey 🔰
🔰 Arit Dey 🔰 - avatar
+ 1
SAN i know it
6th Apr 2021, 11:11 AM
🔰 Arit Dey 🔰
🔰 Arit Dey 🔰 - avatar
+ 1
But i will need first print range thin print range numbers in list
6th Apr 2021, 11:12 AM
🔰 Arit Dey 🔰
🔰 Arit Dey 🔰 - avatar
+ 1
try i_list = range(1,5+1) [print(item) for item in i_list] then print(list(i_list))
7th Apr 2021, 3:19 AM
MrForce-1way
MrForce-1way - avatar
+ 1
Hello the easiest way is use extend ,correct code below list=[] list.extend(range(5)) print(list)
7th Apr 2021, 3:50 PM
Akhil Krishna
+ 1
Arit try the code i provided it is the easiest way
7th Apr 2021, 3:51 PM
Akhil Krishna
- 1
li = range(5) print(list(li)) for i in li: print(i)
7th Apr 2021, 6:29 PM
Oma Falk
Oma Falk - avatar