DEV Community

Sarah Mukuti
Sarah Mukuti

Posted on

Python 101: Ultimate Python guide

Python is a high-level and interpreted language that serves a wide range of purposes in programming. Due to its many libraries and frameworks python is used in web development, data science, artificial intelligence, and automation. Python ahs simple syntax and is also portable across multiple platforms.
When learning python I found the following concepts to be the most important for a beginner.

Variable

A variable is a defined memory location. In python variables can be defined and assigned values.

Image description

Output

Python provides the inbuilt function print()to display variables, literals, or any other values.

Image description

Comments

Comments are lines of code that are not executed. They help to document the code and make it easy to explain some of the complicated parts to other people. In python comments are preceded by the # symbol.

input

Python allows for the program to request for user-defined inputs.
It uses the input() function

Image description

function

Functions are blocks of code that contain a set of operations. The functions enhance reusability of code. They can be inbuilt or defined by the user. Functions in python are declared using the def keyword.

Image description

Data structures

Data structures provide a way to organize data. they are like containers that can store multiple values of the same or even different data types. They include tuple, lists, dictionary, set, array.

Image description

Decision making

Decision making is an important aspect to programming. Some lines of code are only executed while a specific condition is valid conditions or when a specific condition is met. The major key words in decision making and looping are; while, for, if--else.

Image description
In the next article I will write longer programs that analyze decision making and data structures in a more comprehensive manner. The concepts discussed in this article do not exhaust the basics of python but act as a guide to someone who is thinking of starting the python learning journey.

Top comments (0)