+ 2
How to convert the out put we got from forloop back into a list??
def n_numbers(number): lst =[1,2,3,4] for i in lst: print(i*number) print(n_numbers(4))
4 odpowiedzi
+ 1
RAJESH SAHU you didn't need to provide answer to person,that's not how they learn and I gave enough hint to make him dig deeper about append method and how list works ,I could have just provide the answer as well
0
Initialise a empty list to some variable before for loop
and in for loop after append the result i*number to it
in case you didn't understand I will provide the answer but try first hopefully you are familiar with list methods
0
new=[]
for i in lst:
new.append(i * number)
- 1
Mention the language name in tags
And also put the code link in description ,that will give better insights into what you have done and how we can help