A Beginner's Guide to Python; Set up and know the basics

victoria ottahvictoria ottah
4 min read

Learning a programming language can be challenging, especially when there is no prior knowledge of programming. However, learning python is a good way to start if you are new in the world of programming. It is a versatile language that has been very useful in the industry over the years.

What is Python

Python is an open source programming language, good for beginners, closer to English and can be used for a variety of things like machine learning, data science, web development, AI, game processing and many more.

Python makes use of print statements. This print() function prints the specified messages on the screen or any other standard output devices.

Python is a high level programming language, meaning that the idea of what a problem is and how to solve it is gotten from the computer, you do not need to be aware of the coding structure.

Python is an integrated language, this means that the python interpreter executes the codes one line at a time. It doesn't need to be compiled and converted from one language to another. It is advised that python should be written in small chunks and tested while writing the code.

When Python scripts are written one line at a time, it makes debugging easier. Python supports the execution of codes written in other programming languages like C++ and Java.

Set Up

  1. To start, download Python software. Python3 is mostly preferable, so if a python2 was previously downloaded, upgrade to python3.
  2. Install Jupyter notebook. This is important because it serves not just as an integrated development environment IDE but as a presentation tool, in case you want to communicate to an audience.

Someone who has a background in web development, HTML, CSS and wants to learn python might prefer to code using a software they are familiar with Vscode. You can also learn to code Python using Vscode and you can set it up like so;

  1. Download python3
  2. Open a new folder in flle and Create a Python file to start learning
  3. Install python extension and the pylance extensions first. You would install more as you learn

Know the basics

A good way to start is to learn terminologies and their application. One of the important things to note before starting out are Data Types. Data types tell you what Operations are carried out on specific data.

In python there are about 7 standard data types. Numeric, String, boolean, list, tuple, set and dictionary, however we would talk about 3 basic data types.

String; is any element enclosed in quotation marks. It can be single or double quotation marks. This quotes make them interpreted as scripts

string.jpg

Strings can be concatenated. This simple means a string can be joined to another string using a plus sign.

string anot.jpg

Numeric data types; there are numbers and they can be Integers, float or complex numeric data types Integers; are 0 to n, when n can be positive or negative whole numbers Floats are fractions or decimals till 15 points Complex numeric had complex numbers

Boolean; is used to write a true or false statement

Indentation

This is another important concept in python. Indentation is the White space at the beginning of a line of code. Why is this important? This indentation helps python understand line of code or block or statement should be executed first. The number of white space to use depends on the programmer but you should use at least one space.

Comparison Operators

These are characters used to compare Strings and/or numbers. It can also be perform transactions on these elements.

They are;

  • == or = is equal to
  • != is not equal to
  • < is less than
  • is greater than

  • <= is less than or equal to
  • = is greater than or equal to

Variables

Variables are containers used to store data. It is usually a symbolic name used to reference a value. Variables can be used to change characters it values from one datatype to another.

string anot.jpg

Comments

While writing a code, comments can be made on a python script. Comments are statements used to explain python codes, they explain what a line of code is used for, making it more readable.

A hash sign can be used to comment on a single line, a triple quotation can be used to comment on multiple lines.

comments.jpg

Basic convention to writing python

  • Put every statement on a line by itself
  • Use spaces around operators
  • Use spaces after commas, colons, and semicolons
  • Indentation is very important

The learning Spectrum of every individual differs and knowing all there is about programming at a go is illogical, however, practice and consistency helps the process.

Sources; https://www.w3schools.com/python/default.asp

https://www.coursera.org/learn/python-programming-intro

0
Subscribe to my newsletter

Read articles from victoria ottah directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

victoria ottah
victoria ottah

I am a Product designer specializing in Accessibility and a technical writer. Currently into machine learning, AI and assistive technology.