Please solve & explain | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Please solve & explain

What is the output of this code? d=lambda p: p*2 t=lambda p:p*3 X=2 X=d(x) X=t(x) X=d(x) Print(x) Ans 24

16th May 2020, 11:43 AM
RAHUL Kumar
4 Answers
+ 4
X=2 d(2)=4 t(4)=12 d(12)=24
16th May 2020, 11:52 AM
Oma Falk
Oma Falk - avatar
+ 4
Error. Python is case sensitive. You've declared a variable named 'X' then used 'x'. 'Print' is not a function. Its 'print'. Now, real problem and solution : d = lambda p:p*2 Means, def d(p) : return p*2 t = lambda p:p*3 Means , def t(p) : return p*3 Then, x = 2 x = d(x) # x = 2*2 = 4 x = t(x) # x = 4*3 = 12 x = d(x) # x = 12*2 = 24 So, `print (x)` will output 24 ✓
16th May 2020, 11:54 AM
Ayan Fox
Ayan Fox - avatar
0
Aur yaha small x undefined hai, correct your code, variable names are case sensitive
11th Jul 2020, 8:42 PM
Aman Kumar
Aman Kumar - avatar
- 3
Tune dm ne youtube link bheja tha, wo subscribe kar diya hai, waha message ka reply nhi jaa rha tha to idhar reply kiya gai, dekh kar delete kr dena
11th Jul 2020, 8:40 PM
Aman Kumar
Aman Kumar - avatar