Showing posts with label list. Show all posts
Showing posts with label list. Show all posts

Sunday, July 25, 2021

Regular Expressions in Python | Scenario - Finding sub-string match patterns to validate a genuine number from a numeric string using Regular Expressions and search() method in Python | Conceptual Infographic Note

 


Case 01 : Ascertaining a positive match using "\w" to match a specific phone number to a generic string


Case 02 : Ascertaining a negative  match or mismatch using "\w" whether a  match over given string occurs or not

Regular Expressions in Python | Scenario - Finding a sub-string match and its count from a main string using Regular Expressions and findall() function in Python | Conceptual Infographic Note


 

Regular Expressions in Python | Scenario - Replacing a word ("sub-string") with another word ("sub-string") in a main string using Regular Expressions and substitute function in Python | Conceptual Infographic Note


 

Regular Expressions in Python | Scenario - Finding matching pattern of the main string using Regular Expressions and findall() function in Python | Conceptual Infographic Note

 


Regular Expressions in Python | Scenario - Finding Positional Indexes of each matching pattern of the main string using Regular Expressions | Conceptual Infographic Note

 


Regular Expressions in Python | Scenario - Finding and Retrieving specific sub-strings with commonality in patterns using Regular Expressions | Conceptual Infographic Note


 

Regular Expressions in Python | Scenario - Finding and Retrieving specific sub-strings with commonality in patterns using Regular Expressions | Conceptual Infographic Note

 


Regular Expressions in Python | Scenario - Finding and Retrieving specific sub-string and their cpount of occurrence from a main parent string using regular expressions | Conceptual Infographic Note


 

Regular Expressions in Python | Scenario - Finding and Retrieving specific positional indexes of sub-strings and index positions from a parent string using regular expressions and store them in one dictionary | Conceptual Inforgraphic Note

 


Regular Expressions in Python | Scenario - Finding and Retrieving specific sub-strings and integers from a parent string using regular expressions and store them in one dictionary | Conceptual Inforgraphic Note


 

Regular Expressions in Python usecase Scenario | Finding and Retrieving specific sub-strings from a parent string using regular expressions and storing in separate list | Conceptual Inforgraphic Note

 


Thursday, July 22, 2021

Examples of Using "JOIN" function on Python Data Structures | Sample Conceptual Questions with Answers with examples | Infographic Note

 


Example - 01 : Joining Numeric List Elements with char string

Example - 02 : Joining Tuples with character string

Example - 03 : Joining List elements with long string

Example - 04 : Joining Character List Elements with long string

Example - 05 : Joining Character List Elements with null string


Monday, June 7, 2021

Lists and Dictionaries in Python Dictionaries in Python

 When should one use dictionaries and when should one use lists in Python

 =====================================================

 *  Lists are the most widely used data when the data is stored in the form of integral indexes with some starting position to some given position within the Python list

 *  Lists are also mostly used when the data that needs to be maintained in a certain specific manner or  where the data needs to be sorted where finding  some data is only good enough when the user of the given set of code is knowing the exact index or position of the item element where the list item needs to be searched or retrieved

 *  Lists are also used when the ordering of items within the List item object is irrelevant as any given element within a list can be searched and retrieved just by using some conditional loops which will iterate over the list item object and then the item could be put to use directly without any form of replacement or elimination within the data structure

 *  One of the main highlighting important points about Lists as a data structure for item storage is that Lists can be used for storage of other lists and tuples as a data storage within it because of which the main list containing the sub-lists within it could act as a parent list object which can keep within it other child objects for storage and retrieval as well

 *   Now coming to dictionaries and what they are used for :-

 *  Dictionaries are perfect storage objects when the data is to be stored on the basis of positonal indexes coupled with an adjoining value associated for that index position . Here also the ordering of the data is not of great matter and does not need to sort the stored data . Finding any associated data of the dictionary object needs only a key value of that object 


*   Example where a List is used for data storage is an example of a shopping cart where any stored item object's storage does not matter .


*  Example where a Dictionary Item object is used as a storage object is that of a an examination roll / rank number sheet ( parikhya patra ) where people are arranged on the basis of their marks obtained in some examination from Rank 1 to the last rank in the exam . Usually the person who obtains the highest marks in a given exam is attributted the 1st rank and the first roll number for that examination is also alloted to the first rank holder after the results are out , the successive role numbers are also attributed according the net marks obtained  by an examiner in the considered case of the examination till the last rank/roll number of the examiner .

 

*  A dictionary is very useful data storage object where one may need to access a given data based on the item that is present over a given index position within the storage object of the data structure .

 *  As a measure of how important the dictionaries are - every module , class , function and method written in Python in the form of dictionaries where all the attribute names are in the form of Keys and all the attribute values there in can be found quickly .

 *  Therefore when one wants to decide upon which data structure to be used for a certain type of data object one might need to consider the best use cases of both these data structure objects : Lists and Dictionary Items .


 ======================================

To sum up once again for Lists and Dictionaries

 =====================================

 

*  Lists are ordered data structure objects that means that the program has control over the order in which the data is stored . This data is also sortable that means that the program can sort the data into whatever order when the data is needed to be fetched and retrieved , the list is also containing a list of iterable items i,e items that can be accessed one item at a time when the list object is iterated or executed within a loop .

 

*  Dictionaries are like the partially ordered data structures that can control the order or the manner in which the data items are inserted and stored within the object in the form of keys and attributes . Dictionaries are non-sortable and iterable in pairs of both keys and associated value objects .



 

 

 

 

 

 

 

 

 

Last modified: 18:49