+ 1

Does using anonymous programming reduce the lines of code in a program?

Use of lambda https://code.sololearn.com/cW5U77cN8j1h/?ref=app https://code.sololearn.com/cW5U77cN8j1h/?ref=app

11th Jan 2021, 8:16 AM
Emmanuel Kipngeno cheruiyot
Emmanuel Kipngeno cheruiyot - avatar
4 Answers
+ 5
This thread should have been tagged with 'Python' rather than 'none' Lambdas do not directly impact code size. P.S. Attach relevant link only please, that code isn't yours, and isn't relevant to your question.
11th Jan 2021, 8:28 AM
Ipang
+ 5
Emmanuel Kipngeno cheruiyot Not lambda, lambda is mostly used for anonymous values/variables, but here we are printing some pattern so lambda is not advisable and the code will be longer. Better to use list comprehension if you want to make it shorter. inpt = input() print(*[f"\n{inpt[:i+1]}" for i in range(len(inpt))])
11th Jan 2021, 8:47 AM
noteve
noteve - avatar
+ 2
Thanks I appreciate
11th Jan 2021, 8:48 AM
Emmanuel Kipngeno cheruiyot
Emmanuel Kipngeno cheruiyot - avatar
+ 2
It was first time asking a question now I know
11th Jan 2021, 9:05 AM
Emmanuel Kipngeno cheruiyot
Emmanuel Kipngeno cheruiyot - avatar