Gistlib Logo

gistlib

sum 3 numbers in python

To sum three numbers in Python, you can simply use the addition operator + between the three numbers.

main.py
num1 = 5
num2 = 10
num3 = 15

total = num1 + num2 + num3

print("The sum is:", total)
86 chars
8 lines

This will output The sum is: 30

similar python code snippets

find the sum of a list of numbers in python
add two numbers in python
add all into in a list together in python
sum money in python
define a function that takes a list of numbers as an argument and returns the sum of the numbers in the list. in python
find the sum of all values in a map in python
find the sum of all elements in an array in python
how to get all combinations of a set in python
how to get the power set of a set in python
how to get distinct combinations of a set in python

related categories

python
arithmetic
sum
addition
numbers

gistlibby LogSnag