-1
  • a=input("a value is:")

  • b=input("b value is:")

  • sum =a+b

  • print("the Sum of {0} and {1} is {2}" .format(a,b,sum))

  • result is coming like this

  • a value is:1

  • b value is:3

  • the Sum of 1 and 3 is 13

  • Welcome to Stack Overflow. Please read [ask], and see the [formatting help](https://stackoverflow.com/help/formatting) to understand how to post code properly. Before asking questions, [please try](https://meta.stackoverflow.com/questions/261592) to look for existing Q&A, for example by [using a search engine](https://duckduckgo.com/?q=python+sum+of+numbers+is+wrong). – Karl Knechtel Jan 30 '23 at 06:58

1 Answers1

1

when using input the input is entered as a string, just cast it to int before summing aka :
sum = int(a) + int(b)
Hope i helped :)

  • Welcome to Stack Overflow. Please read [answer] and note well that this is **not a discussion forum**. Please do not add conversational language to answers; and please try not to give new answers for frequently-asked questions - instead, look for an existing Q&A on the topic. You can help keep the site organized by flagging questions as duplicates (at 3000 reputation you can participate in directly voting to close them). – Karl Knechtel Jan 30 '23 at 06:56