Sunday, September 15, 2019

Python tutorial 4 | Comparison Operators

This is the fourth of Python Tutorials for Beginners. You can see all the Python tutorials in this blog here. This Python beginner tutorial explains comparison operations in Python programming with multiple examples. Please view my Python video tutorial 4 or read on...

You can use Python comparison operators when you write conditions in Python if statement or Python while loop statement. In Python programming language, the comparison operators include equal to, not equal to, less than, less than or equal to, greater than and greater than or equal to. The result of any Python comparison operation is a True or False value.

A single Python condition may contain different comparison operators but all comparison operators in Python have the same priority. This means that there is no operator precedence.
Now, let us see these comparison operators with examples.

Monday, September 9, 2019

Python tutorial 3 | Arithmetic Operators

This is the third of Python Tutorials for Beginners. In order to get started, you can see Python Tutorial 1 | Introduction and Python tutorial 2 | Handling Strings. Let us learn about arithmetic operators in Python programming language. This tutorial explains the arithmetic operators in Python programming. Please view my Python video tutorial 3 or read on...

What is an operator? It is a construct for processing one or more data values. In Python programming language, an operator is shown by a special character or a keyword.

There are several arithmetic operators in Python. These are + for addition, - for subtraction, * for multiplication, / for division, // for floor division or integer division, % for remainder of integer division and ** for power. Now, let us see examples of integer add, float add, integer subtract, float subtract, integer multiply, float multiply, division, floor division, remainder and power arithmetic operations in Python.

Sunday, September 1, 2019

Python tutorial 2 | Handling Strings

This is the second of Python Tutorials for Beginners. In order to get started, please first see the Python Tutorial 1 | Introduction. Let us learn how to handle strings in Python programming language. Please view my Python video tutorial 2 or read on...

A string is a sequence of characters. A string is enclosed by single quotes or double quotes. A multi-line string is enclosed by triple quotes (either both single quotes or both double quotes). You can see your string by using the print function. The print function omits enclosing quotes. The + Python string operator concatenates (combines) strings. The * Python string operator repeats a string a number of times. You can assign multiple variables in a single Python statement. Using indexing, you can extract a single character from a string. Using slicing, you can extract any part of a string. Strings in Python programming language are immutable. This means that once you define a string, you cannot change it. Now, let us see examples of these concepts.