
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 26504 Articles for Server Side Programming

412 Views
In data analysis using python we may come across situation when two lists need to be merged. But it may be a challenge to handle the duplicate elements present in those lists. In this article we will see how to combine two lists by maintain all the elements form the first list and only the unique elements from the second list.Using extendIn this approach we take the first list and create a result list. Then we design a for loop to check for the presence of element of the first list in the second list and if the element is ... Read More

3K+ Views
A list in python is normally a 1D list where the elements are listed one after another. But in a 2D list we have list nested inside the outer list. In this article we will see how to create a 2D list from a given 1D list. We also supply the values for the number of elements inside the 2D list to the program.Using append and indexIn this approach we will create a for loop to loop through each element in the 2D list and use it as an index for the new list to be created. We keep incrementing ... Read More

1K+ Views
Given a nested list we want to convert it to a dictionary whose elements can be considered as part of a tree data structure. In this article we will see the two approaches to convert a nested list into to add dictionary whose elements represent a tree like data structure.Using SlicingWe reverse the items in the list aby slicing and then check if the item is present in the list. If it is not present we ignore it else we add it to the tree.Exampledef CreateTree(lst): new_tree = {} for list_item in lst: currTree = ... Read More

712 Views
Python dictionaries have keys and values. If we have two or more dictionaries to be merged a nested dictionary, then we can take the below approaches. Here year the dictionaries are given along with the new keys that will become a key in the nested dictionary.Assigning keysIn this approach we will create a new empty dictionary. Then assigned the given dictionaries to each new key. The resulting dictionary will be a nested dictionary with the keys assigned.ExampledictA = {'Sun': 1, 'Mon': 2} dictB = {'Tue': 3, 'Sun': 5} # Given Dictionaries print("DictA : ", dictA) print("DictB: ", dictB) ... Read More

2K+ Views
When analyzing data with python we come across situations when we have to merge two dictionaries in such a way that we add the values of those elements whose keys have equal values. In this article we will see such two dictionaries getting added.With For loop and | OperatorIn this approach we design a for loop to check for the presence of the value of the key in both the dictionaries and then add them. Finally we merge the two dictionaries using the | operator available for the dictionaries.ExampledictA = {'Mon': 23, 'Tue': 11, 'Sun': 6} dictB = {'Wed': 10, ... Read More

337 Views
Many times during data analysis using lists we come across a situation where we need to find out if a given element is present at least N Times in the given list. For example if 5 is present at least three times in the list or not. In this article we will see 2 approaches on how to achieve this.Counting OccurrencesIn the below approach we take the number and it's occurrences as an input. Then we e designer follow to keep the count of the occurrences. If the count value is greater than or equal to the required value then ... Read More

382 Views
The Pygorithm module is an educational module containing the implementation of various algorithms. The best use of this module is to get the code of an algorithm implemented using python. But it can also be used for actual programming where we can apply the various algorithms to a given data set.Finding the Data StructuresAfter installing the module in the python environment we can find the various data structures that is present in the package.Examplefrom pygorithm import data_structures help(data_structuresRunning the above code gives us the following result −OutputHelp on package pygorithm.data_structures in pygorithm: NAME pygorithm.data_structures - Collection of data structure ... Read More

10K+ Views
The os.path module is a very extensively used module that is handy when processing files from different places in the system. It is used for different purposes such as for merging, normalizing and retrieving path names in python . All of these functions accept either only bytes or only string objects as their parameters. Its results are specific to the OS on which it is being run.os.path.basenameThis function gives us the last part of the path which may be a folder or a file name. Please the difference in how the path is mentioned in Windows and Linux in terms ... Read More

2K+ Views
Python can connect to oracle using a python package called cx_Oracle. Oracle is one of the famous and widely used database and python’s data processing features are leverages well using this connectivity. In this article we will see how we can connect to oracle database and query the DB.Installing cx_OracleWe can use the below command to install the python package which can be used for establishing the connectivity.Examplepip install cx_OracleConnecting to OracleNow using this module we can connect to a oracle database which is accessible through the oracle service name. We create a cursor and execute the SQl query through ... Read More

1K+ Views
The netrc class in python is used to read the data from the .netrc file presnt in unix systems in user’s home firectory. These are hidden files containing user’s login credential details. This is helpful for tool slike ftp, curl etc to successfully read the ,netrc file and use it for their actions.The below program shows how we can read the .netrc file using python’s netrc module.Exampleimport netrc netrc = netrc.netrc() remoteHostName = "hostname" authTokens = netrc.authenticators(remoteHostName) # Print the access tokens print("Remote Host Name:%s" % (remoteHostName)) print("User Name at remote host:%s" % (authTokens[0])) print("Account Password:%s" % (authTokens[1])) print("Password for ... Read More