How to Add Two Numbers with Python

Опубликовано: 28 Май 2026
на канале: Cypherr
64
8

In this program, we asked the user to enter two numbers and this program displays the sum of two numbers entered by user.

Source Code:
x = input("Num1: ")
y = input("Num2: ")

sum = int(x) + int(y)
print("the sum is: " , sum)
______________________________

sorry for bg noice

We use the built-in function input() to take the input. Since, input() returns a string, we convert the string into number using the float() function. Then, the numbers are added.