Flow Control

In this tutorial you will learn: Python if, elif and else Statement Python for Loop Python while Loop Python break and continue Statement 1 Python if, elif and else Statement: These statements are used when we want to make some decisions in our program to run some codes for a specific condition. The if statement will first take a test expression and will run the code only if the result of the test expression is True. »

Author image Adnan

Python Strings

In this tutorial you will learn: String indexing and slicing How to count the number of characters using len() String operations Some useful string methods 1 String indexing and slicing: In the prevous tutorial (Python Data Types Part Two), we have seen how to access any character in a string using indexing method: 0var = "Hello World" 1 2#OUTPUT: H o 3print(var[0], var[4]) The index numbering in python and some other programming language start from zero (0). »

Author image Adnan

Python Data Types Part Two

In this tutorial you will learn: Strings List Tuple Set Dictionary 1 Strings: We have already been using this type in prevoius tutorials, this data type is actualy a sequence of characters enclosed within single (“) or double quotes (”“). Strings (called “str” in python) are an immutable sequence which means we can’t change any of the charachters in the sequence. Lets make this more clear to you with an example: »

Author image Adnan

Python Operators

In this tutorial you will learn: Arithmetic operators Assignment operators Comparison operators Logical operators Bitwise operators Membership operators Identity operators Introduction: Before we jump to the operators lets define what is an operator. An operator is a special symbol that python or any other programming language use to make some arithmetic, assignment or logical computation. 1 Arithmetic operators: Arithmetic operators are used to perform mathematical operations that we are familliar with, like addition, subtraction, division and multiplication etc. »

Author image Adnan

Python Data Types Part One

In this tutorial you will learn: Numbers Booleans NoneType Type conversion Introduction: Python data-type is a classification that specifies the type of value a variable has. Since everything in python is an object, every type in python have his own specific methods and attributes that can be used on this type. (we will discuss more about Ojbects later and see how to create our own data type). »

Author image Adnan

Multiple Assignment and Comments

In this tutorial you will learn: Multiple assginment Comments 1 Multiple assginment: In the previous tutorial Variables and Inputs/Outputs we saw how to make a variable and assign to it a value using the assignement sign ‘=’. In python we can create more than one variables on the same line, lets see an example: 0x, y, z = 22, 23, 24 1 2print(x, y, z) OUTPUT: 22 23 24 »

Author image Adnan

Variables and Inputs/Outputs

In this tutorial you will learn: What is a variable How to create variables in python How to use print to display variables How to read user inputs 1 What is a variable: To understand what is a variable lets imagine that we have two boxes, the first box contain some clothes and the second one contain some video games CD’s as you see our two boxes are containers that holdes some objects. »

Author image Adnan

Getting Started

Before starting the pytutorials series i want to explain what is PyTutorials. PyTutorials is a beginner guide to learn the basics of python and programming, each tutorial will contain an explanation on the topic followed by 2 or 3 exercices to practice what you have learned. Two tutorials will be posted every week. In this tutorial we will be using python 3. I am assuming that you already have python installed on your machine if not you can download it from here or you can use an online interpreter for python. »

Author image Adnan