• Exercises

## Concatenating two Tuples in python

We can add two tuples using the + operator. The resultant tuple will have items from both the tuples. Example tuple1 = (1, 2, 3, 4, 5, 6) tuple2 =…

• Exercises

## Slice a Tuple in python

In this example we show how you can slice a tuple in python Syntax: slice(stop) slice(start, stop, step) Parameters: start: (Optional) Starting index where the slicing of the iterable starts.…

• Exercises

## Find Sum of Tuple Items using Python

In this example we use the sum function to return the sum of all tuple items. Example # Sum of All Items number_tuple = (10, 20, 30, 40, 50, 60,…

• Exercises

## Find Largest and Smallest Item in a Tuple in python

In this example we use the min and max functions which will return the smallest and largest items ina  tuple Example # Largest and Smallest Item in a tuple number_tuple…

• Exercises

## Check Item exists in a Tuple in Python

In this example we check to see if an item exists in a tuple We use the in operator to find the item that exists in a tuple. Example number_tuple…

• Exercises

## Creating a Tuple in Python

In this example we show you how to create a tuple in python A tuple can have items of different data types like integers, floats, lists, strings, etc; Example There…

• Exercises

## List all Files with a Certain Extension using Python

In this example we will list all the files in a specific directory that have a certain file extension This example shows how to find files in a directory with…

• Exercises

## How to check if a file exists in python.

In this example we will show you how to check if a file exists using python This checks whether a file exists or not using the exists() function of the…

• Exercises

## Reading a CSV File using the CSV Module in Python

In this example we will open a csv file using the csv module The contents of our test csv file called Countries2.csv was Entry,Country,Capital 1,France,Paris 2,Germany,Berlin 3,Spain,Madrid 4,Italy,Rome 5,UK,London Example…

• Exercises

## How to add or subtract days to a date in Python

In this example we will show you how to add or subtract days to a date in Python Example The timedelta() method takes the number of days to be added…