Python3 Add Number
# Python3.x Python Number Sum
[ Python3 Examples](#)
The following example demonstrates how to take two numbers as input from the user and calculate their sum:
## Example (Python 3.0+)
```python
# -*- coding: UTF-8 -*-
# Filename : test.py
# author by : www..com
# User input numbers
num1 = input('Enter first number: ')
num2 = input('Enter second number: ')
# Sum
sum = float(num1) + float(num2)
# Display the result
print('The sum of {0} and {1} is: {2}'.format(num1, num2, sum))
The output of the above code is:
Enter first number: 1.5
Enter second number: 2.5
The sum of 1.5 and 2.5 is: 4.0
In this example, we take two numbers as input from the user to calculate their sum. We use the built-in function `input()` to get user input. `input()` returns a string, so we need to use the `float()` method to convert the string to a number.
For arithmetic operations, we use the plus sign (`+`) operator for addition. Besides this, there are minus (`-`), multiply (`*`), divide (`/`), floor division (`//`), or modulo (`%`). For more number operations, you can check our (#).
We can also combine the above operations into a single line of code:
## Example (Python 3.0+)
```python
# -*- coding: UTF-8 -*-
# Filename : test.py
# author by : www..com
print('The sum is %.1f' %(float(input('Enter first number: '))+float(input('Enter second number: '))))
The output of the above code is:
$ python test.py
Enter first number: 1.5
Enter second number: 2.5
The sum is 4.0
[ Python3 Examples](#)
[](#)(#)
(#)[](#)
YouTip