OneBite.Dev - Coding blog in a bite size

add two numbers in python

Code snippet on how to add two numbers in python

  a = 4
  b = 5
  c = a + b
  print(c)

This code adds two numbers in Python. First, two variables are declared on lines 1 and 2 as “a” with a value of 4 and “b” with a value of 5. On line 3, the two variable values are added together and assigned to a third variable “c”. Finally, on line 4, the value of the variable “c” is printed out, which is 9 since the values of a and b are 4 and 5 respectively.

python