DEV Community

Cover image for Python assignment statements
EzeanaMichael
EzeanaMichael

Posted on • Edited on

Python assignment statements

Last week we discussed datatypes, this week we'll be talking about the assignment statement "="
The "=" is used as an assignment statement since In python programming language the machine reads the code from right to left
So,

Image description

Image description
Can also be said as the numeric value 3 is stored in the memory address of a, so when referencing a in places like,

Image description
Will give the output of 8,

Image description
All data types can be assigned this way,
I.e

Image description

Image description
Number= 50.56
Print(Number) / 50.56

With this, we're ready to write our first program
One to add two numbers.
It starts with the comment, like all programming languages python has comments in place, something you can type that would not be read by the computer, or be displayed when the program is run, the "#".

Program to add two numbers

Image description

Image description

Note:Use the exact case when referencing I.e "A" is not "a", python can be said to be case-sensitive.

Top comments (0)