DEV Community

Cover image for Python assignment statements
EzeanaMichael
EzeanaMichael

Posted on • Edited on

3 1

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.

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

Heroku

This site is powered by Heroku

Heroku was created by developers, for developers. Get started today and find out why Heroku has been the platform of choice for brands like DEV for over a decade.

Sign Up

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay