# Adding String Numbers

**URL:** <https://discuss.python.org/t/adding-string-numbers/31512>\
**Category:** Python Help\
**Tags:** help\
**Created:** [August 12, 2023, 9:19pm UTC](https://discuss.python.org/t/adding-string-numbers/31512 "2023-08-12T21:19:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![milkboy33](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@milkboy33](https://discuss.python.org/u/milkboy33)\
**Post date:** [August 12, 2023, 9:19pm UTC](https://discuss.python.org/t/adding-string-numbers/31512/1 "2023-08-12T21:19:51Z")

</div>

Hi All 👋 🙂

Could anybody tell me why when adding two string numbers an output is actually given. What is happening under the hood? For example:

x = input( )  
y = input( )  
print( x + y )

I inputted 2 for x and 4 for y and the interpreter outputted 24.

Thanks,  
Tom

---

<div class="post-metadata">

**Author:** ![rob42](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/rob42/32/8218_2.png) [@rob42](https://discuss.python.org/u/rob42)\
**Post date:** [August 12, 2023, 9:23pm UTC](https://discuss.python.org/t/adding-string-numbers/31512/2 "2023-08-12T21:23:21Z")

</div>

What you are doing is concatenating two string objects. The fact that the objects happen to represent two numbers, is not relevant.

---

<div class="post-metadata">

**Author:** ![milkboy33](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@milkboy33](https://discuss.python.org/u/milkboy33)\
**Post date:** [August 12, 2023, 10:01pm UTC](https://discuss.python.org/t/adding-string-numbers/31512/3 "2023-08-12T22:01:40Z")

</div>

Thank you. 🙂

For others reading this post, a little more information:

print( “3” \* 5 )

will output 33333

---

<div class="post-metadata">

**Author:** ![e-dreyer](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/e-dreyer/32/14055_2.png) [@e-dreyer](https://discuss.python.org/u/e-dreyer)\
**Post date:** [August 12, 2023, 10:17pm UTC](https://discuss.python.org/t/adding-string-numbers/31512/4 "2023-08-12T22:17:05Z")

</div>

This is because “3” \*5 is 5 times “3”, which is “33333”.

You are using strings, imagine like letters and words instead of math. You want to do 3\*5 not “3”\*5. So use int,(x) and int(y) or floats to process your input.
