## Python index method to get the index of an item in a list

Python index method to get the index of an item in a list : The ‘index’ method is used to find the index of the first occurrence of an item in a list. The syntax of ‘index’ method is as below : s.index(x[, i[, j]]) It will find the index of the first occurrence of […]

## Python 3 program to find union of two lists using set

Python 3 program to find union of two lists using set : In this tutorial, we will learn how to find the union of two lists using set in Python 3. To find the union of two lists, we don’t have any built-in methods. We are going to use ‘set‘ to find the union. Union […]

## Python program to print a triangle using star

Python 3 program to print a Triangle using star : In this tutorial, we will learn how to print a triangle using star ( * ) . You can change it to any other characters if you want. User will enter the height of the triangle and the triangle will be print. It is a […]

## zip function in python and how to use it

What is zip() function in python and how to use it : What is zip() : The syntax of zip() function is ‘zip(*iterables)’ that means it will take multiple iterables as inputs. It makes an iterator aggregating elements from each of the iterable. What it returns : zip() returns an iterator of tuples. If no […]

## Python 3 program to print invert right angle triangle

Python 3 program to print invert right angle triangle using number : height = int(input(“Enter the height of the triangle : “)) for i in range(1,height+1): for j in range(1,height – i+2): print(str(j)+” “, end=”) print() Output : Enter the height of the triangle : 5 1 2 3 4 5 1 2 3 4 […]

## Python program to print all even numbers in a range

Python 3 program to print all even numbers in a range: In this example, we will learn how to print all the even numbers in a given range. Even number is a number that is perfectly divisible by 2. Steps we are going to use in this program are as below : Steps to find […]

## Python 3 program to count the number of blank spaces in a file

Python 3 program to count the number of blank spaces in a file : In this tutorial, we will learn how to find the total number of blank space in a text file. Following algorithm we are going to use in this example : Algorithm : 1. Store the file path in a variable. 2. […]

## Python program to find the circumference of a circle

Python program to find the circumference of a circle : In this tutorial, we will learn how to find the circumference of a circle in python 3. The formulae to calculate circumference is ‘2 * Pi * radius’. So, we need only the value of radius to calculate the circumference. We will take this input […]

## Python program to concatenate two dictionaries

Python program to concatenate Two dictionaries : In this tutorial, we will learn how to concatenate two dictionaries . Algorithm we are going to use is : Algorithm : 1. First create one two dictionaries with some elements in both. 2. Now use ‘update()’ method to concatenate both of these dictionaries. 3. ‘update()’ method takes […]

## Write a simple calculator program in Python 3

Simple Calculator Program in Python 3 : In this tutorial, we will learn how to create a Calculator using python 3. We are going to create only a simple calculator that can perform addition, subtraction, multiplication and division . You can add any other mathematical operations to it if you want. Before going through the […]