All
- Hello world in python
- How to add two numbers in python
- If else statement python
- Lists tuples and dictionaries
- Loops in python
- Python Functions
- How To Reverse Number In Python
- How to create voice from words and How to play music in Python
- How to Sort Dictionary using keys or values python
- Python Lambda
- Python map() filter() and reduce() functions
- What does if __name__ == "__main__": do?
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
pythonocean.com/watch-course/variables-in-python
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
print(result)
Subscribe to my youtube channel
All
What is python programming and why you should learn it in 2021
May 7, 2021, 7:20 a.m.
Best Programming laptops to buy in 2021
May 23, 2021, 12:19 p.m.
What is Data Science & How to become a Data Scientist - A complete Guide for Beginners
June 21, 2021, 3:08 p.m.
Linear Regression Using Gradient Descent Python
Aug. 26, 2021, 10:22 a.m.