In this program, we import the built-in module called itertools. With itertools, you can find all the permutations of the given string. In itertools there are numerous methods, you can try a combination and other methods.
This conditional expression was added to Python 2.5 version. This can be used with
A if condition else B syntax. First, the condition is evaluated and returns based on the boolean value of the condition. If it is true it returns A or else if it is false it returns B.
In this program, we use an extended slice to reverse the…
Python is one of the popular programming languages. Mastering Python basics is crucial. Python has an easy and simple code style, which makes it easy to learn. It is also the language that is used in developing many media networks like Instagram, Amazon, Uber, Netflix, and many more.
In this article, let us try to learn the basics of python in 10 days. This article is written assuming you have some programming knowledge.
In this article, five important functions are explained in detail with code. These functions are simple yet the most powerful function in Python. Python has many libraries and built-in functions. Understanding these functions and using them properly helps with efficient programming.
One of the most powerful functions in Python also known as the anonymous function. It is known as anonymous because we can instantiate and declare a function without a name. If you have a single operation to be executed, the lambda function is extremely useful instead of declaring a traditional function. …
PDF files are extensively used in many fields and learning to handle PDF files is important. In this article, we try to do different operations on the PDF file like locking, unlocking, merging, creating, and adding watermark with python script.
A program to lock the PDF file with the given password with Python.
Some PDF files with important information need to be protected. Let us try to do this with a python script. Install the python package used in this program with
pip install PyPDF2 syntax.
Note: Two methods PdfFileReader and PdfFileWriter are used, to read and write a…
Python programs have many modules and packages, which helps with efficient programming. Understanding these modules and proper usage is important. In this article, a few interesting modules and packages are used for programming.
Create a program to generate fake data like name, email, or detailed fake profile with all the information about a person.
Faker is a python package, which can be installed by using
pip install Faker in the terminal. Each time you run this program faker generator, it will result in different random data.
Implementing string formatting helps with control over the console while printing. It reduces the junk code and makes it much easier to read the code. In this article, let us understand three commonly used string formatting methods.
If you have ever worked with c programming, then this should sound familiar. This uses a % operator to format the string in the program. Commonly used string formatting placeholders are:
Extensive markup language supports the hierarchical representation of the data. Understanding parsing and modification of an XML file are important for web scraping. Searching, modification, and processing of the XML document are explained in this article.
For better understanding, let us consider an example XML file:
To parse an XML file first import
ElementTree package for parsing an XML file. ET is a commonly used alias for the ElementTree. Parsing is a process where the interface reads the XML documents. After reading the XML file, the interface can perform certain functions like searching, building, modifications.
While the XML…
Python comes with a variety of random modules to generate a random number. Unpredictability is necessary for most of the computing process. Python uses a pseudo-random number generator. A complete understanding of modules is the key to problem-solving.
Random has many inbuilt modules for efficient programming. By using the dir command, you will be able to print all the methods in the random module.
The Internet, phones, camera, and social networks continue to thrive and become an essential part of our lives. Logically, you can find thousands of social media uses. Among them, I use Instagram as a diary to keep all my photos to ensure the fond memories are not lost.
I have two profiles, one is for actual socializing, and the other is for keeping my photos. My diary account has no followers, and its sole purpose is to keep my data safe, organized, and caption to represent that moment.
Haven’t you noticed losing some photos and data somehow in the long…
Data structures are used to store data more efficiently. In python, there are four kinds of iterable objects which are used for the collection of data. The four data structures in python are Lists, Tuples, Sets, Dictionary. These data structures are used from simple programs to complex programs. Proper understanding and usage of this data structure help run efficiently.
Art | Travel | Engineer | Writer I am a programmer who loves to write about my traveling experience.