what will be the output of this expression:
a+b if 12.isdigit() else c+d
a) ab
b) cd
c)abcd
d) ab12
Answers
Answered by
3
Answer:
b)cd
I hope this helps !!!
Answered by
0
The below written expression is from python language because isdigit is the built in function of python. The output generated by the following expression will be 'ab'. So, the option 'a' is correct.
Detailed Explanation:
- isdigit function return true if the all characters in the strings are digit. If any argument contains digits or not to check that, this particular function is being used and return true or false accordingly.
- In the mentioned expression: 12.isdigit, 12 is a digit so it generate true as a outcome.
- Now, when the if condition of the written program get satisfied it will not further jump into the else block, so true is returned from the if block and the else part of the program remains unexecuted.
- Therefore, If condition is true, so it will run and it will generate the output ab.
So, 'ab' is the outcome of the written segment of program and option 'a' is the correct option.
Similar questions