Search your course

Lets see how we can add two numbers in python.

for this topic if you are unfimiliar with python variables, please give 1 minute to this page

first declare two variables

a = 2
b = 3

now a has value 2 and and b has value 3

make another variable result and

result = a+b
#Now print this result
print(f"Answer is {result}")

Complete code

a = 3
b = 2
result = a+b
print(f"Answer is {result}")

To get input from user use input() method

a = float(input("Enter first number :"))
b = float(input("Enter second number :"))

result = a+b



Subscribe to my youtube channel