Skip to main content

Command Palette

Search for a command to run...

Sum Calculator in Python

Updated
•1 min read•View as Markdown

I started learning about Python a few weeks ago. Today I learned about datatypes, typecasting, variables and the input function. Using the input function and typecasting and the print statement, i have build my most basic python project- a calculator that calculates the sum of two numbers.

m=int(input("Enter 1st number:"))
n=int(input("Enter 2nd number:"))
print("The sum is ",m+n)

I have defined m and n as variables and then used the input function and typecasting on them The input() function takes input as a string, and int() converts it into an integer so we can perform addition. Building your first python project- it’s really fun.