Found 26504 Articles for Server Side Programming

Print all repeating digits present in a given number in sorted order

Aditya Varma
Updated on 18-Aug-2023 18:32:12

780 Views

Python has internal functions lie count, counter and operator functions that can be used for printing all the repeated digits present in a number that too in sorted order. The following example will help you understand the concept more clearly. Example Assume we have taken an input string. We will now print all repeating/duplicate digits present in a given input number in sorted order using the above methods. Input inputNum = 5322789124199 Output 1 2 9 In the above input number, 2, 1, and 9 are repeated digits. So these digits are sorted in ascending ... Read More

How to Convert Dictionary to Concatenated String using Python?

Pranay Arora
Updated on 18-Aug-2023 17:49:05

379 Views

A dictionary in Python is a built-in data structure that allows you to store and retrieve values using unique keys. It is an unordered collection of key-value pairs enclosed in curly braces {}. Dictionaries provide a convenient way to organize and manipulate data, making it easy to access values based on their corresponding keys. In this article, we are going to see how to convert Dictionary to Concatenated String using Python which means that all the keys and values of the dictionary will be combined in the form of a string as follows. Input = {'one': 1, 'two': 2, ... Read More

Convert List to List of dictionaries in Python

Pranay Arora
Updated on 18-Aug-2023 17:47:39

366 Views

Data handling or organizing or structuring in Python has a lot of common tasks and 1 such task is the conversion of list to list of dictionaries. It is a simple process that allows us to associate specific keys with their corresponding values; creating a collection of dictionaries that can be simply accessed and/or manipulated. Before going forward with the techniques let us 1st see an example input and output. Consider the following: Input test_list = ['John', 25, 'Smith', 30, 'Alice', 35] key_list = ['name', 'age'] Output [{'name': 'John', 'age': 25}, {'name': 'Smith', 'age': 30}, {'name': 'Alice', 'age': ... Read More

Convert Image to String and vice-versa in Python

Pranay Arora
Updated on 18-Aug-2023 17:46:40

3K+ Views

When we speak of "converting an image into string format and back again in Python", this refers to converting image files to something that can be stored and managed using strings of characters, before eventually returning it back into its original image format. Converting Image to String − Converting images to strings involves transcribing their binary data into text format for transmittal or storage over network protocols that require text-based images. This conversion method can help us transmit or store an image more efficiently when working with APIs, databases or sending images over network protocols requiring text data transmission or ... Read More

How to Create Custom Turtle shapes in Python?

Pranay Arora
Updated on 18-Aug-2023 17:44:49

3K+ Views

Python’s Turtle library is used for generating 2D graphics and animations. It has a very simple interface with help of which we can create shapes and patterns on the screen. It comes with some built-in shapes like squares, circles, triangles etc. However, we can even create our own shapes with the help of Turtle. In this article, we are going to see how to create custom turtle shapes in python. Before going forward with the creating custom shapes we need to install Turtle on the system and this can be done by simply using the following command − pip install ... Read More

How to Create Checkbox in Kivymd-Python?

Pranay Arora
Updated on 18-Aug-2023 17:42:59

593 Views

Checkboxes are a type of graphical user interface (GUI) element. It enables users to select 1 or more options from a given set of choices. They are often represented in the form of small square boxes which can be either checked(selected) or unchecked(deselected). Checkboxes are normally in square shape and are on almost all forms on the internet depending upon the use case scenarios. The KivyMD framework of python is built on top of the Kivy library that allows developers to build cross-platform applications along with GUI’s. KivyMD consists of a large set of Material Design widgets which can ... Read More

How to Create Bottom Navigation using Kivymd and Python?

Pranay Arora
Updated on 18-Aug-2023 17:42:03

610 Views

KivyMD is a commonly known library of Python which offers us with a collection of Material Design (MD) compliant widgets. These widgets can be used along with the kivy framework which is another library and is used for creating multi-touch applications. The large number of UI elements that kivyMD provides us with, include buttons, cards, dialogs, menus and many more such elements, all of which are designed to give an appealing look and feel. A navigation bar is a UI element that allows users to “navigate” between different screens/sections of an application. They are normally present on the top ... Read More

Converting each list element to key-value pair in Python

Pranay Arora
Updated on 18-Aug-2023 17:40:55

421 Views

Lists are a commonly used data structure in python where data is stored in the form of elements. Key-value pairs are what we refer to as dictionaries where the data had unique keys and corresponding values. In this article, we are going to convert each list element into a key-value pair in Python. Converting each list element to a key-value pair in Python is done to efficiently organize and retrieve data by associating each element with a unique key. This transformation enhances data structure, enables faster lookup operations, and provides a flexible and meaningful representation of the data, improving readability ... Read More

Convert list to Single Dictionary Key Value list in Python

Pranay Arora
Updated on 18-Aug-2023 17:40:02

219 Views

Python is one of the most popular, high-level languages widely in use. Lists are one of the four built in data types in Python, used to store collections or groups of Data. Dictionary, Tuples and Sets are the other three data types. When working with Python, there are often situations where you have a list of values and you need to convert it into a single dictionary with key-value pairs. This article will guide you through the process of converting a list into a dictionary in Python. By the end, you will have a clear understanding of how ... Read More

Program to construct a DFA to check if a given integer is unsigned or not

Shubham Vora
Updated on 18-Aug-2023 18:13:39

373 Views

In this problem, we need to check whether the given number is an unsigned integer using the DFA. We need to construct the DFA using the 2D array to solve the problem. Problem statement – We have given string str of length N. By constructing the DFA, we need to check whether the str represents the unsigned integer. In the output, print ‘unsinged integer’ or ‘Not an unsinged integer’ according to whether the number is unsinged or not. Sample examples Input– str = "1729" Output– “Unsigned integer.” Explanation– As the number doesn’t contain any sign, it is an ... Read More

Advertisements