Found 34494 Articles for Programming

Python Program to Add K between case shifts

Aditya Varma
Updated on 18-Aug-2023 19:16:55

31 Views

In python we can use various internal functions like isupper(), islower() and and join() that can help us adding k symbol between case shifts. The following example will help you understand what is case shift and how we can add k symbol between them. Example Assume we have taken an input string and K. We will now add the input k symbol between Case shifts using the above methods. Case shift simply means the words shifting between uppercase and lowercase. Input inputString = tUtoRialsPoInt k = ‘# Output Resultant String after adding # between caseshifts − t#U#to#R#ials#P#o#I#nt ... Read More

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

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

539 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

120 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

177 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

2K+ 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

2K+ 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

309 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

315 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

217 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

111 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

Advertisements