Sum Calculator in Python

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.

0
Subscribe to my newsletter

Read articles from Utkarsh Narayan Tiwari directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Utkarsh Narayan Tiwari
Utkarsh Narayan Tiwari