
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 10401 Articles for Python

283 Views
Python's implementation of a data structure known more commonly as an associative array is a dictionary. A dictionary is made up of a group of key-value pairs. Each key-value combination corresponds to a key and its corresponding value. Given a dictionary with some random key-value pairs, In this article, we will learn how to rotate the given dictionary by K in python. Methods Used The following are the various methods to accomplish this task: Using list comprehension, items(), and dictionary comprehension Using dictionary comprehension, deque.rotate(), and items() functions Example Assume we have taken an input dictionary and ... Read More

181 Views
In this article we are going to learn how to use internla python functions like len(), slicing(), replace(), ljust() to retain first N element of a string and replace the remaining by k. The python strings are easily made by simply surrounding letters in quotations. Python treats single quotes and double quotes the same way. Assigning a value to a variable and creating a string is really straightforward. Example Assume we have taken an input string N, K values. We will now retain the first N characters of an input string and replace it with the given K character ... Read More

614 Views
Python has in build functions like slicing() and replace() that can be used for replacing the occurrence by k except the first character. In Python, strings are among the most often used types. These are easily made by simply surrounding letters in quotations. Python treats single quotes and double quotes the same way. Assigning a value to a variable and creating a string is really straightforward. Example Assume we have taken an input string and k. We will now replace all the k characters except the first in an input string with the input character using the above methods. Input ... Read More

412 Views
In python we can use not operator or subtraction operation as well as counter function to the number that are in range but not in set. A Python set is a grouping of unsorted elements. The set's elements must all be distinct, and unchangeable, and the sets must eliminate any duplicates. Sets can be changed after they are created because they are mutable. Example Assume we have taken an input set and range Input inputSet = {3, 10, 2, 11, 15, 4, 1} lowIndex, highIndex = 0, 8 Output [0, 5, 6, 7] Here 0, ... Read More

150 Views
Python's implementation of a data structure known more commonly as an associative array is a dictionary. A dictionary is made up of a group of key-value pairs. Each key-value combination corresponds to a key and its corresponding value. In this article, we will learn how to extract keys with specific value type in python. Methods Used The following are the various methods to accomplish this task − Using for loop and isinstance() method Using list comprehension and isinstance() method Using keys() & type() methods Example Assume we have taken an input dictionary. We will now Input ... Read More

373 Views
In Python, strings are among the most often used types. These are easily made by simply surrounding letters in quotations. Python treats single quotes and double quotes the same way. Assigning a value to a variable and creating a string is really straightforward. In this article, we will learn how to expand a character frequency string in python. Methods Used The following are the various methods to accomplish this task: Using zip() and join() functions Using re(regex) module and join() function Without using any built-in functions Example Assume we have taken an input string containing characters followed ... Read More

106 Views
Python's implementation of a data structure known more commonly as an associative array is a dictionary. A dictionary is made up of a group of key-value pairs. Each key-value combination corresponds to a key and its corresponding value. In this article, we will learn how to concatenate all keys which have similar values in python. Methods Used The following are the various methods to accomplish this task: Using defaultdict() and join() functions Using dictionary comprehension, groupby() and join() functions Example Assume we have taken an input dictionary. We will now concatenate all the keys ... Read More

85 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

765 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
343 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