In this article, we will learn how to count Words with a specific letter in a string in python. Methods Used The following are the various methods to accomplish this task − Using list comprehension, len() & split() functions Using split() & find() functions Using split(), replace() & len() functions Using Counter() function Example Assume we have taken an input string and some random character. We will now count the words that contain the given input character in an input string. Input inputString = 'hello tutorialspoint python codes' inputChar = "p" Output Count of words containing the ... Read More
In this article, we will learn a Python program to concatenate every element across lists. Methods Used The following are the various methods to accomplish this task − Using the List Comprehension and String Concatenation Using itertools.product() Function Example Assume we have taken two input lists. We will now concatenate every element across the given two lists Input inputList1 = ["hello", "tutorialspoint", "python"] inputList2 = ["coding", "articles"] Output Resultant paired combinations list: ['hello coding', 'hello articles', 'tutorialspoint coding', 'tutorialspoint articles', 'python coding', 'python articles'] Method 1: Using the List Comprehension and String Concatenation List Comprehension When ... Read More
In this article, we will learn how to capitalize repeated characters in a string in python. Methods Used The following are the various methods to accomplish this task - Using Dictionary Hashing Using count() Function Using replace() and len() functions Using Counter() function Example Assume we have taken an input string containing some random text. We will now convert the repeated characters in an input string into uppercase using the above methods. Input inputString = 'hello tutorialspoint' Output heLLO TuTOrIaLspOInT In the above input string, the characters l, o, t, i are repeated. Hence they are ... Read More
In this article, we will learn how to get alternate list elements as key-value pairs in python. Assume we have taken an input list containing integers. We will now Methods Used The following are the various methods used to accomplish this task − Using for loop Using dictionary comprehension and list slicing Example Assume we have taken an input list. We will now print alternate list elements as key-value pairs. Input inputList = [20, 13, 5, 2, 6, 8, 18, 3] Output Dictionary with alternate list elements as key-value pairs: {13: 2, 2: 8, 8: 3, 20: ... Read More
In this article, we will learn how to find common keys in a list and dictionary in python. Methods Used The following are the various methods to accomplish this task − Using the ‘in’ operator and List Comprehension Using set(), intersection() functions Using keys() function & in operator Using the Counter() function Example Assume we have taken an input dictionary and list. We will find the common elements in the input list and keys of a dictionary using the above methods. Input inputDict = {"hello": 2, "all": 4, "welcome": 6, "to": 8, "tutorialspoint": 10} inputList = ["hello", "tutorialspoint", ... Read More
In this article, we will learn how to find the difference of the sum of list elements that are missing from Matrix and vice versa. Methods Used The following are the various methods to accomplish this task − Using for loop & from_iterable() function Using sum() & from_iterable() functions Using the Counter() function Example Assume we have taken an input matrix and a target list. We will now find the difference of the sum of list elements that are missing from Matrix and vice versa. Input inputMatrix = [[6, 3, 2], [5, 4, 1], [10, 8, 1], [15, ... Read More
In this article, we will learn Case insensitive string replacement in python. Methods Used The following are the various methods to accomplish this task − Using re.IGNORECASE, re.escape(), re.sub() Using re.sub(), lambda, re.escape() functions Using split(), lower() & replace() functions Using split(), list() and join() functions Method 1: Using re.IGNORECASE, re.escape(), re.sub() re.compile() function A regular expression pattern can be combined with pattern objects, which can then be used for pattern matching. This function also allows searching for a pattern again without rewriting it. Syntax re.compile(pattern, repl, string) re.sub() function The string with replaced ... Read More
According to Barak Obama, the Affordable Care Act (aka Obamacare) borrows heavily from similar state-level legislation (aka Romneycare) implemented in Massachusetts in 2006 and passed by then-governor Mitt Romney. The ACA exchanges' less-than- smooth launch, combined with recent revelations that many people who buy health insurance on the individual market are receiving cancellation notices, has some Americans wondering if the new law will work. President Barack Obama cites the success of Massachusetts' health-care reform as proof that, despite a rocky start, the law will work to provide nearly universal coverage to all Americans. What is Obamacare? At the national and ... Read More
Introduction Migrating from a SQL to a NoSQL database is a significant undertaking that requires careful planning and strategizing. It's important to understand the differences between these two types of databases and to identify the specific use cases for which you will be using the NoSQL database. There are several different tools and techniques available for migrating data from a SQL to a NoSQL database, and it's important to carefully evaluate the pros and cons of each option to determine the best fit for your needs. Migrating from a SQL to a NoSQL database can be a significant undertaking and ... Read More
Introduction In SQL Server, permissions are used to control access to database objects, such as tables and views. Each user in a database has a set of permissions that determine what they are able to do within the database, such as SELECT, INSERT, UPDATE, DELETE, and EXECUTE. To view the permissions that a user has been granted in a database, you can use the sys.database_permissions view. This view provides information about the permissions that have been granted or denied on database-level securables for a specific database. The sys.objects view contains information about all the objects in a database, and the ... Read More