Anu has written the following program in Python but she is not
getting the correct output. Help her to find out the mistakes.
A="5"
B="4"
C=a+b
Print (C)
Answers
Answered by
0
Answer:
C = int(A) + int(B)
wrong variable is used
and since A and B are string we need to type cast them first
Explanation:
We need to type cast the A and B to integer or float first
C = int(A) + int(B)
Answered by
6
Answer:
A=5
B =6
C=A+B
print(C)
Explanation:
she is getting wrong output because she is taking A and B as string value,
so when you do
<string> + <string> =concatenation(which means joining two words)
Eg = "2" +"5" =25
2 + 5 = 7
both are different
hope you understood
Similar questions