Python Programming Tutorial

This tutorial covers basics of Python Programming Language. It has been specifically designed for beginners and students of computer science and informatics practices.

Lessons

Using Python IDLE | Python Programming in Python IDLE

Preview

Complexity: Easy

After installing Python IDLE, we can type and run Python commands Using Python IDLE. How To Run Python Commands Using Python IDLE Click at start Menu-> All Programs-> Python 3.6 ->IDLE (Python 3.6 32 Bit). IDLE may be different depending upon the version of Python installed on your computer. Python IDLE will open as shown …

Installing Anaconda | Download Anaconda and Installation

Preview

What is Anaconda Anaconda distribution of Python is best for Python programmers. It is free and can be easily downloaded and installed on your computer. Anaconda comes with pre-installed packages including NumPy, Matplotlib and SymPy etc. How to download Anaconda Open website https://www.anaconda.com/distribution/ from your web browser. Click at Windows if you are downloading it …

Using Anaconda Navigator | Python using Anaconda Navigator

Preview

Using Anaconda Navigator Anaconda Navigator is a graphical user interface (GUI application that allows you to launch different applications and easily manage conda packages without using command-line commands. It can also search for packages on Anaconda Cloud or in a local Anaconda directory. It can work with Windows, macOS as well as Linux. Python IDLE …

Introduction to Python | Basic Python Components

Preview

Complexity: Easy

What is Python Python is an object oriented Programming Language developed by Guido Van Rossum in February 1991. It is basically influenced from two languages namely ABC and Modula-3. Why it is named Python Python is not named after snake but is named after famous BBC comedy show “Monty Python’s Flying Circus”. Who is promoting …

Literals in Python

Preview

Literals in Python Literal may be defined as a quantity whose value can’t be changed during the execution of a Program. So values of Python Literals don’t change during execution of program. Types of Python Literals Python Literals are categorized into five types as: 1. String literals 2. Numeric Literals 3. Boolean 4. None 5. …

Data types in Python

Preview

Complexity: Standard

Data types in Python Data type specifies the type of data as well as the range of values that can be stored in the data object . Different Data types in Python 3 are as follows: Numeric Data Types Boolean String List Tuple Dictionary Numeric Data types in Python Numeric data types are categorized into …

Display output in Python | print() function in Python

Preview

Complexity: Standard

print() function in Python We can use print() function in Python to display some message or output on Python shell. The Syntax of print function is: print(EXPRESSION) Here EXPRESSION is the variable of any data type or string value that we want to display. In previous versions of Python there was no need of parenthesis …

Read values in Python 3 | input function in Python

Preview

Complexity: Standard

input() function in Python We can use input() function in Python to read some value at python shell. This function is basically used to read string value. The Syntax of input() function is: varname=input() Here varname is the name of variable that we want to read. 1. Reading string values using input() We can use …

eval() function in Python 3

Preview

eval ( ) Function in Python The eval ( ) function is used to convert a string value to numeric value. Example 1: Convert string value to integer value Description >>> a=eval(’10’) >>> print(a) 10 >>> print(type(a)) <class ‘int’> eval() function converts string value ‘10’ into  integer value 10. That is why type(a) is returned …

Basic operators in Python

Preview

Complexity: Standard

Operators in Python Operator It is the symbol used to perform some calculation or manipulation on variables , literals or expressions. Operand It is the variable, literal or expression on which an operator performs some operation. Example: 9 + 8 In above expression, 9 and 8 are operands whereas + is an operator. Types of …

Relation between Equality(= =) and Identity (is) operators

Preview

We have seen that if values of two variables are same, a=10 b=10 a==b  and a is b will return true But it is not always true. There are some cases where two variables have same value but they return different results. It happens because there are few cases where Python creates two different objects …

5 types of if Statement in Python

Preview

Complexity: Standard

if statement in Python is very powerful decision making statement used to control the flow of execution of statements. It is a two way decision making statement used with a relational or logical expression. It can be used in five ways: Simple if If else Nested if If else if ladder Single Line if 1. …

2 Types of Looping in Python (for, while, nested loop)

Preview

Looping statements in Python Looping statements are used to repeat same set of statements again and again for a specific number of times or depending upon a condition.There are two types of looping statements Python: for loop while loop 1. for loop for loop is basically used when we know how many times, a specific …

String in Python 3 | Manipulating strings in Python

Preview

Complexity: Standard

What is a String in Python? String is a sequence of characters within the pair of single quotes(‘) or double quotes (“).   Example: “school”, “Rs100”, ‘$24.50’,’father-name’. 1. Creating a String Variable To create a string variable, we need to put a string value into string variable using assignment operator Syntax: Stringvariable =”Value1”   OR Stringvariable=’Value1’ …

Python List with Examples | List in Python 3

Preview

Complexity: Standard

What is a List in Python? List  is a collection of values within pair of square brackets. These values must be separated by commas. These values can be of any data type. Lists are mutable i.e. we can modify the elements of a list. 1. Creating a List To create a list, we can put …

Python Tuple with Examples | Tuple in Python 3

Preview

Complexity: Standard

What is a Tuple in Python 3? Tuple  is a collection of values within pair of parenthesis. These values must be separated by commas. These values can be of any data type. Tuples are immutable i.e. we can’t modify the elements of a tuple. 1. Creating a Tuple To create a tuple, we can put …

Python Dictionary with examples

Preview

Python Dictionary with examples What is a dictionary? A Dictionay is an unordered collections of elements in the form of  key: value pairs separated by commas within the pair of braces(curly brackets). Example: {1:’a’,2:’b’,3:’c’}  Characteristics of a Dictionary 1. Unordered Set Dictionary is an unordered set of key: value pairs i.e. Its values can contain …

string functions in python 3 with examples

Preview

string functions in python 3 1. String .capitalize() This method makes first character of string capital. Example >>> name=’lovejot’ >>> name.capitalize() ‘Lovejot’ #First character becomes capital  2. String .find() This method is used to find first index position of substring in a string value. It returns-1 if substring is not found. Syntax: String.find (Substr[,Start[,End]]) Substr …