+ 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
4 ответов
+ 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.
+ 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))])
+ 2
Thanks I appreciate
+ 2
It was first time asking a question now I know