+ 1

Ques: we have a list = ['my','name','is','ashish'] and give the result like this ['m', 'n', 'i', 'a'] without any loop.

This question asked in the one of my interview

5th Oct 2021, 11:26 AM
ashish soni
ashish soni - avatar
5 Answers
- 1
def first_char(a,b,x=[]): if b >= len(a)+b: print(x) print("task done") else: iteration = iter(a) x.append(next(iteration)[0]) return first_char(a[1:],b+1,x) def main(): first_char (['my','name','is','ashish'],b = 0) main()
5th Oct 2021, 12:28 PM
ashish soni
ashish soni - avatar
+ 2
Thats not how this works. If you don't know how to solve a problem, ask with your attempt. If you already know, then there's no need for a question
5th Oct 2021, 12:19 PM
Slick
Slick - avatar
+ 2
print(list("mnia"))
5th Oct 2021, 12:20 PM
Simba
Simba - avatar
+ 1
You might be using anonymous function but it also used loop internally. Well bro share your answer now
5th Oct 2021, 12:27 PM
Mohd Aadil
Mohd Aadil - avatar
0
This is the solution guys
5th Oct 2021, 12:29 PM
ashish soni
ashish soni - avatar