Python Introduction and Variable Assignment(Quick Code-Python)

Shreedhar Vellayaraj
Geek Culture
Published in
4 min readAug 30, 2021
(credit:wallpaperflare)

This is the first chapter of the Quick Code-Python series. I am very excited to start this series. There are a lot of fun codes and concepts that are coming along the chapters of this series. Hoping you’d learn something new and valuable out of this series.

Note: I’ve written the Quick Code-Python series in a linear fashion so that even a newbie can follow along the series to get a grasp of what python can actually do. For folks that are good with the fundamentals, you can follow along with the series to refresh your concepts or choose any of the chapters in the series that you want to know more about.

Python is an easy-to-understand programming language that you can use to code various projects such as building a web scrapper to building an automated car (simulation). Python got its popularity due to its ease of understanding and coding. I mean it’s so easy that you would prefer using a python to a calculator once you get a hold of it.

(credit:datacamp)

Where do I code Python?

You can code python using an IDE ( Integrated Development Environment ). There are various IDE’s available for python like Pycharm, Spyder, Jupyter, etc. I’ve written a detailed blog to guide you to install and run your first code using one of the IDE’s. Check that out if you haven’t installed any python related software on your PC/Mac.

Remember I told you you’d prefer using python instead of a calculator, so we’ll start by understanding the basic math operation that you could do in python

Basic Arithmetic operations for python is as follows,

The Same operations are implemented in python code using jupyter IDE

basic arithmetic operations

Quick tips while using jupyter notebook:

  1. hold shift+enter to run a cell
  2. press ‘b’ to create a new cell below the current cell
  3. press ‘a’ to create a new cell above the current cell
  4. press ‘dd’ to delete the current cell

Basic Mathematics order of operations apply the same here to python, remember the BODMAS rule :

BODMAS operation on python

Now, we need to save the answers that we got from our basic python calculator so that we can access them anywhere else in the program. That’s where Variable comes into play and these variables will basically be any type of data such as numbers, strings, or even boolean, that’s why we have a datatype around them to tell them what type of data we’re expecting.

different data types in python (credit: RealPython)

Now, I’ll write snippets in jupyter to assign various values to the variable

variable assignment using python

Note: There are specific keywords in python that you cannot use to assign variables.

Keywords in Python (credit: educba)

These have their own functionalities inside python, like creating loops using for or creating a condition statement using if, etc.

In this blog, we’ve understood what python could do and we’ve also done some quick math operations and stored them in a variable using python.

In the next blog of the Quick Code-Python series, we’ll take all this knowledge and use them into solving problems such as finding the area of a rectangle/square, use algebraic operations, converting celsius into Fahrenheit, and much more fun stuff.

Check out the next chapter of the Quick Code-Python series here and the introduction to Quick Code here

Stay tuned :)

--

--