0
Why??
What is the purpose of converting strings to integers isnât it simpler to just say >>>print(3+4) 7 Then >>> print(int(â3â) + int(â4â)) 7
2 Answers
+ 11
Converting strings to integers is useful when getting user input:
x = int(input())
y = int(input())
print(x + y)
+ 5
The example is just there to show you how to convert string to integer values so that you can add them. There's no practical reason for you to write the latter over the former, if you just want to add two numbers.