Resolved: Exam Question. Question No: 24. Not totally correct option and explanation.
Question No 24:
Option: Josh cannot put different types of variables in the same expression — 'age' is an integer and 'Josh is' is a string
But that is not the case, Josh can put different types of variables in the same expression. It's just that the '+' operator has no defined operation when being operated on str and int. But, '*' has. Hence, if the code of Josh had been
print ( 'Josh is ' * age)
then it wouldn't have been issue, as the '*' operator is supported for expression with str and int data type.
I will delete this comment after get answer that am i right or wrong. As this is a question of final exam.
Hi Bhaskar!
Thanks for reaching out and for the understanding that you are commenting a final exam!
Your observation is absolutely correct. However, in the context of the question, we are thinking of the + operator only. Hence the answer we've provided.
Hope this helps.
Kind regards,
Martin
1. raw data ia s original source of data