Python | Bigram formation from given list

[ad_1] When we are dealing with text classification, sometimes we need to do certain kind of natural language processing and hence sometimes require to form bigrams of words for processing. In case of absence of appropriate library, its difficult and having to do the same is always quite useful. Let’s discuss certain ways in which … Read more

Python | Convert case of elements in a list of strings

[ad_1] Given a list of strings, write a Python program to convert all string from lowercase/uppercase to uppercase/lowercase. Input : [‘GeEk’, ‘FOR’, ‘gEEKS’] Output: [‘geeks’, ‘for’, ‘geeks’] Input : [‘fun’, ‘Foo’, ‘BaR’] Output: [‘FUN’, ‘FOO’, ‘BAR’]  Method #1 : Convert Uppercase to Lowercase using map function    out = map(lambda x:x.lower(), [‘GeEk’, ‘FOR’, ‘gEEKS’]) … Read more

Method resolution order in Python Inheritance

[ad_1] Method Resolution Order :Method Resolution Order(MRO) it denotes the way a programming language resolves a method or attribute. Python supports classes inheriting from other classes. The class being inherited is called the Parent or Superclass, while the class that inherits is called the Child or Subclass. In python, method resolution order defines the order … Read more