Why the ans to this code is 3 shouldn't it be 2 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why the ans to this code is 3 shouldn't it be 2

https://www.sololearn.com/post/624862/?ref=app

29th Sep 2020, 12:24 PM
Smiley[Offline]
3 Answers
+ 3
Because you had written 3 in capital D and 2 in small d and you have written D inside the brackets if you will write small d in brackets in place of D then the outputs becomes 2
29th Sep 2020, 12:28 PM
🔰Saurabh🔰
🔰Saurabh🔰 - avatar
+ 2
the if statement did not have an execution so it brought back the value of D... note that D and d are 2 different variables.😀
29th Sep 2020, 12:29 PM
LIONEL
LIONEL - avatar
+ 1
Thanks all got my mistake
29th Sep 2020, 12:31 PM
Smiley[Offline]