# I have a problem to run this Calculator!

**URL:** <https://forum.codewithmosh.com/t/i-have-a-problem-to-run-this-calculator/3074>\
**Category:** Python\
**Created:** [February 28, 2021, 6:45pm UTC](https://forum.codewithmosh.com/t/i-have-a-problem-to-run-this-calculator/3074 "2021-02-28T18:45:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AunyTheProgrammer](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/aunytheprogrammer/32/1041_2.png) [@AunyTheProgrammer](https://forum.codewithmosh.com/u/AunyTheProgrammer)\
**Post date:** [February 28, 2021, 6:45pm UTC](https://forum.codewithmosh.com/t/i-have-a-problem-to-run-this-calculator/3074/1 "2021-02-28T18:45:04Z")

</div>

Please see the attached image to Know my Code. I just want to make a **calculation (+ - \* /)** from **User input**. But the code is **not working** , I think there is something wrong. I would be grateful if someone helps me to solve this problem!

![Screenshot_1](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/3/3f99206456c9afc37262dca5de322553213805ff.png)

---

<div class="post-metadata">

**Author:** ![Adika](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@Adika](https://forum.codewithmosh.com/u/Adika)\
**Post date:** [February 28, 2021, 11:45pm UTC](https://forum.codewithmosh.com/t/i-have-a-problem-to-run-this-calculator/3074/2 "2021-02-28T23:45:45Z")

</div>

I think there’s no need to make the operators strings

---

<div class="post-metadata">

**Author:** ![NicolasATC](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/nicolasatc/32/714_2.png) [@NicolasATC](https://forum.codewithmosh.com/u/NicolasATC)\
**Post date:** [March 1, 2021, 2:18am UTC](https://forum.codewithmosh.com/t/i-have-a-problem-to-run-this-calculator/3074/3 "2021-03-01T02:18:34Z")

</div>

When you take user input, you get a string… so number\_1 is a string. I’m pretty sure this is the reason your calculator is not working.

You can verify that `number_1` is a string by printing:

`print(type(number_1))`

For the calculator to work you have to convert number\_1 (and number\_2) to an integer, do the math and then concatenate to give the result back to the user. However, consider that you can only concatenate strings… so maybe you need to convert the result to a string again 🙄… or keep it simple and use python formater to avoid converting:

[https://www.w3schools.com/python/ref\_string\_format.asp](https://www.w3schools.com/python/ref_string_format.asp)

Let me know how the calculator ends up!

---

<div class="post-metadata">

**Author:** ![djdilla](https://avatars.discourse-cdn.com/v4/letter/d/df705f/32.png) [@djdilla](https://forum.codewithmosh.com/u/djdilla)\
**Post date:** [March 2, 2021, 8:44pm UTC](https://forum.codewithmosh.com/t/i-have-a-problem-to-run-this-calculator/3074/4 "2021-03-02T20:44:01Z")

</div>

you need to convert the answers for numbers to integer or float:

number1 = float(input(‘first num’))

operator = input(‘operator’)

number2 = float(input(‘second num’))
