Python

Difference between abstract class and interface in Python 
using an example

Abstract class Interface 1) Abstract class can have abstract and non-abstract methods. Interface can have only abstract methods. Since Java 8, it can have default and static methods also. 2) Abstract class doesn’t support multiple inheritance. Interface supports multiple inheritance. 3) Abstract class can have final, non-final, static and non-static variables. Interface has only static …

Difference between abstract class and interface in Python 
using an example Read More »

Explain the function which is used to retrieve the parts of URL in python

Urllib module is the URL handling module for python. It is used to fetch URLs (Uniform Resource Locators). It uses the urlopen function and is able to fetch URLs using a variety of different protocols. Urllib is a package that collects several modules for working with URLs, such as: 1 urllib.request for opening and reading.2 …

Explain the function which is used to retrieve the parts of URL in python Read More »

Explain title and capitalize methods in python

OR Give the syntax and significance of string functions: title() and capitalize(). String capitalize(): In Python, the capitalize() method converts first character of a string to uppercase letter and lowercases all other characters, if any. syntax:​ string.capitalize() String title(): The title() method returns a string with first letter of each word capitalized; a title cased …

Explain title and capitalize methods in python Read More »

What is the use of islower and isupper method in python

ISUPPER(): In Python, isupper() is a built-in method used for string handling. The isupper() methods returns “True” if all characters in the string are uppercase, Otherwise, It returns “False”. Syntax​ : string.isupper() Returns :  1.True- If all characters in the string are uppercase.2.False- If the string contains 1 or more non-uppercase characters ISLOWER(): In Python, …

What is the use of islower and isupper method in python Read More »

How sorted function can be used with list in Python

The sorted() function returns a sorted list from the items in an iterable. sorted() is built-in function of python The sorted() function sorts the elements of a given iterable in a specific order (either ascending or descending). Syntax: ​sorted(iterable, key=None, reverse=False) sorted() Parameters: sorted() can take a maximum of three parameters: iterable​ – A sequence …

How sorted function can be used with list in Python Read More »