python

python

Python program to find out the sum of all digits of a number

In this python programming tutorial, we will learn how to find out the total sum of all digits of a number. For example, if the number is 123, the program will print 6 as the output. Our program will take the number as input from the user.

Read
python

Python string ljust() method explanation with example

The ljust() word stands for left-justified. It returns a left-justified string of a given width. It uses one specific character called fill character to fill the additional position of the string. The default value of fill character is space.

Read
python

How to find the intersection of two list elements in python

In this python programming tutorial, we will learn how to find the intersection of two lists. The program will create two lists by taking the inputs from the user first. It will then find out the intersection of the lists and print out the result.

Read
python

Python symmetric_difference_update example

symmetricdifferenceupdate method is used to find the symmetric difference of two sets in python.

Read
python

Python program to swap the first and the last character of a string

Python program to exchange the first and the last character of a string. We will learn different string slicing ways to do that.

Read
python

Python program to swap the first and the last element of a list

Python list is one of the most frequently used datatypes. A list is used to hold a group of elements. These elements are placed inside a square bracket separated by commas. Python list can hold items of different datatypes e.g. a list can have items of type 'integer', 'float', 'string' etc.

Read
python

Python program to find out the sum of odd and even numbers in a list

Python program to find the sum of all odd numbers and even numbers in a list. The program will ask the user to enter the size of the list first. Then, it will ask each number to add to the list one by one. Finally, the program will calculate and print out the sum of all odd numbers and even numbers in the list.

Read
python

Python dictionary example to find keys with the same value

A python dictionary is a collection of key-value pairs. All keys in a python dictionary should be different.No two keys can have the same name. But for different keys, we can have the same 'value'. This tutorial is to show you how we can find all keys in a python dictionary with the same value.

Read
python

Python program to delete all files with specific extension in a folder

In this python programming tutorial, we will learn how to delete all files with a specific extension in a folder recursively.

Read
python

Python program to rename a directory or file

Renaming of a directory or file is always required if you are dealing with the filesystem. Note that the filesystem works differently on different platforms. Even if you are developing applications for mobile platforms (Android or iOS), it will be different.

Read