Python f-strings
Python f-strings called formatted string literals, have a more concise syntax and can be super helpful in string formatting. To create f-strings, you only need… Read More »Python f-strings
python
Python f-strings called formatted string literals, have a more concise syntax and can be super helpful in string formatting. To create f-strings, you only need… Read More »Python f-strings
You can use Python in operator or not in operator to check if a string is not present in the list. The cheapest and most… Read More »Python string not in list
Python vars() function is an inbuilt function and returns the__dict__ (dictionary mapping) attribute of the given object. The vars() function takes only one optional parameter.… Read More »Python vars() function
Python help() function returns the Python documentation of a particular object, method, attributes, etc, and dir() shows a list of attributes for the object passed… Read More »help() and dir() function in Python
Python Help() function is called the built-in Python help system. It displays the documentation of modules, functions, classes, keywords, etc. help(object) Help() function in Python… Read More »Help() function in Python
Python dir() function is used to get the list of the attributes and methods of any object (say functions, modules, strings, lists, dictionaries, etc). This… Read More »dir() function in Python
Use the len() method to count characters in a string in Python. This is the most convenient method in Python to get the occurrence of… Read More »Python count characters in string
You need to import math, and use math.ceil to Ceiling division in Python. There is no operator that divides with ceil. Here’s how you can… Read More »Ceiling division Python
To count specific characters in a string use Counter from the collections module and then just iterate over the counter, if the char is found,… Read More »Python count specific characters in string
Python counter can be used to calculate the frequency in a string because the string is passed as input. it returns the output as a… Read More »Python Counter string