The task is to create a calculator that accepts user input numbers using the input
statement. However, when arithmetic operations are applied to the input numbers, the result is string concatenation instead of mathematical operations. Here is the code:
This code reads two input numbers as strings using the input()
function and stores them in num1
and num2
variables. However, the +
operator is used for the addition operation, which results in the concatenation of the two strings instead of performing addition. As a result, the output is not as expected.
The current output indicates that the input numbers are being treated as strings. The next step is to convert these string numbers into integers to perform mathematical operations correctly. However, I’m unsure how to do this and needs guidance on the appropriate method for converting strings to integers