Found 27104 Articles for Server Side Programming

Iterating through a range of dates in Python

Tapas Kumar Ghosh
Updated on 14-Aug-2023 12:10:55

4K+ Views

The range of dates is defined by the starting date, ending date, and all dates in between. In Python, we have some built−in functions such as datetime.date(), range(), timedelta(), and, delta() will be used to iterate through a range of dates. Let’s take an example of this. The Starting Date, 26−06−2023 The Ending Date, 30−06−2023 Therefore, the final result of a range of dates becomes: 26−06−2023 27−06−2023 28−06−2023 29−06−2023 30−06−2023 Syntax The following syntax is used in the examples- datetime.date() The date is an instance function of the datetime library of Python that returns date objects. range() The ... Read More

How to show or hide labels in Pygal

Tapas Kumar Ghosh
Updated on 14-Aug-2023 12:07:38

80 Views

The Python module named Pygal is a data visualization library that creates SVG graphs in various styles. This type of graph generally creates a highly interactive plot that users will easily understand. For example− line(), pie(), histogram(), etc. In Python, we have some built−in functions such as x_labels(), add(), and, render_to_file() will be used to show or hide labels in Pygal. Syntax The following syntax is used in the examples- x_labels() x_labels() follow the pyplot module of matplotlib that can be used to set the label on the horizontal axis. add() The add() is an in−built function ... Read More

Initialize Dictionary keys with Matrix in Python

Tapas Kumar Ghosh
Updated on 14-Aug-2023 12:04:38

150 Views

The dictionary is one of the four popular datatypes in Python that has a collection of specific keys with value pair whereas matrix is defined by a rectangular array that consists of rows and columns. In Python, we have some built−in functions such as append(), str(), fromkeys(), dict(), and, deepcopy() will be used to initialize dictionary keys with Matrix. Syntax The following syntax is used in the examples append() The append() is a built−in method in Python that accepts a single parameter as input to add to the given dictionary at the end. str() The built−in function ... Read More

Incremental List Extension in Python

Tapas Kumar Ghosh
Updated on 14-Aug-2023 12:02:48

121 Views

The list is a popular datatype in Python that store multiple values in a single variable. While incrementing any number/string to the list it will use some operations and conditions to extend the list by adding new values. In Python, we have some built−in functions such as map(), range(), and, lambda will be used to solve the Incremental List Extension. Using list comprehension is another way to generate the expression, conditions, and, efficient result to solve this problem statements. Syntax The following syntax is used in the examples map() The built−in function map() allows a specific function for each ... Read More

Python - Incremental Sublist Sum

Tapas Kumar Ghosh
Updated on 14-Aug-2023 11:59:01

87 Views

In Incrementak Sublist sum, there will be a given list that contains some integer element and that allows for some specific condition and iteration to add the preceding element. In Python, we have some built−in functions such as accumulate(), cumsum(), and tolist(), that will be used to solve the Incremental Sublist Sum. Let’s take an example of this. The given list, [10, 20, 30, 40, 50] 10 : 0th Index 10 + 20 = 30 : 1st Index 10+ 20 + 30 = 60 : 2nd Index 10 + 20 + 30 + 40 = 100 : 3rd Index 10 ... Read More

Conversion of Integer String to list in Python

Tapas Kumar Ghosh
Updated on 14-Aug-2023 11:56:23

238 Views

The integer string is any number that sets within the double quote whereas the integer list is defined as the list of numbers separated by commas. In Python, we have some built−in functions− len(), isdigit(), append(), map(), fromstring(), and, split() that will be used for the Conversion of Integer String to list. For example The given integer string, my_str = “1 2 3 4 5” The final output become [1, 2, 3, 4, 5] Syntax The following syntax is used in the examples- len() The len() is a built−in method in Python that returns the length ... Read More

Convert Nested dictionary to Mapped Tuple in Python

Tapas Kumar Ghosh
Updated on 14-Aug-2023 11:21:17

265 Views

The nested dictionary is a hierarchical data structure where values themselves are called as dictionaries. It allows storing more than one dictionary inside the base dictionary. The mapped tuple is defined by the collection of tuples where individual tuples contain pairing values. By converting one form into another it means to set the changes between key−value pairs into a tuples list. In Python, we have some built−in functions such as isintance(), extend(), append(), and, str() will be used to convert the Nested dictionary to Mapped Tuple. Syntax The following syntax is used in the examples- isintance() The isinstance() is ... Read More

Finding the Minimum of Non-Zero Groups using Python

Tapas Kumar Ghosh
Updated on 14-Aug-2023 11:16:55

626 Views

The group in Python is defined by sets or collections of element that have the same characteristics based on specific conditions or operations. The group can be represented by lists, sets, or other data structures. In this problem statement, the non−zero group refers subset of the list where all the elements are non−zero and adjacent to each other without any zero value in between. In Python, we have some built−in functions like list(), groupby(), lambda, etc. will be used to solve the minimum of non−zero groups. Syntax The following syntax is used in the examples list() list() is a ... Read More

Invoking Function with and without Parenthesis in Python

Tapas Kumar Ghosh
Updated on 14-Aug-2023 11:15:06

215 Views

The term invoking function refers to recursion which means the function calls itself. The function with parenthesis defines some parameter to work on specific conditions and operations whereas without parenthesis function refers to a function reference. In Python, we have two types of methods such as function reference and function with parameter that will be used to solve the Invoking function with and without Parenthesis. Syntax The following syntax is used in the examples def function_name(): -------- -------- function_name() This is the representation of function with parenthesis. def function_name(): -------- -------- reference = function_name print("The function reference:", reference) ... Read More

Index Mapping Cypher in Python

Tapas Kumar Ghosh
Updated on 14-Aug-2023 11:13:04

172 Views

The Index Mapping Cypher is defined by passing the integer string to get the specific string. In Python, we have some built−in functions such as str(), len(), join(), and, int() will be used to solve the problem based on Index Mapping Cypher. Let’s take an example to understand this: The given string, my_str = “Hyderabad” The given index, idx = 101456 The final result becomes yHyrab Syntax The following syntax is used in the examples- str() This is a built−in function in Python that accepts any value to convert it into string. len() This is a built−in method ... Read More

Advertisements