average of two numbers plus three in python

You can calculate the average of two numbers plus three in Python using the arithmetic operators like this:

main.py
a = 5
b = 7

average = (a + b) / 2 + 3

print(average)
55 chars
7 lines

Output:

main.py
8.5
4 chars
2 lines

In the above code, we first assign values to the variables 'a' and 'b'. Then we calculate the sum of those two numbers by using the '+' operator and divide it by 2 to get the average. Finally, we add 3 to the average to get the desired result.

gistlibby LogSnag