Python | accessors, mutators, and @property What we call getters and setters in languages like Java, we term accessors and mutators in Python. In Java, if we have a user-defined class with the property ‘x’, we …

Last updated 1 year, 10 months ago | 430 views

Tags:- Python

Django | Model  A model is a Python class in Django that is derived from the django.db.models.Model class. A model is used in Django to represent a table in a database. It is used to interact …

Last updated 1 year, 10 months ago | 428 views

Tags:- Django

Windows | Set path and environment variables in Windows 10 Press the + to access the Power User Task Menu. Now, select the System option. In the About window, click the Advanced system settings link under Related settings from the right side. In the Advanced tab, click the  button. In …

Last updated 1 year, 8 months ago | 427 views

Tags:- Windows

Python | Inheritance  Inheritance is a process by which a class can inherit the methods and properties of another class. The concept of inheritance provides the idea of reusability. The class from which we are inheriting is …

Last updated 1 year, 8 months ago | 426 views

Tags:- Python

Python | vars(), dir() and help()  The vars() function returns the __dict__ attribute of an object. The dir() function returns all properties and methods of the specified object, without the values. The help() function is used to display …

Last updated 1 year, 11 months ago | 426 views

Tags:- Python

Python has a multi-threading package, but commonly not considered good practice to use it as it will result in increased code execution time. Python has a constructor called the Global Interpreter Lock (GIL). The GIL ensures …

Last updated 1 year, 10 months ago | 426 views

Tags:- Python

PEP stands for Python Enhancement Proposal. A PEP is an official design document that describes new features proposed for Python and documents aspects of Python, like design and style, for the community. PEP 8 exists to …

Last updated 1 year, 11 months ago | 425 views

Tags:- Python

We can use the python re module to match the string import re def check(txt): # regex pattern pattern = 'ab{4,8}' if re.search(pattern, txt): print('Match found') else: print('Match not found') check("abcbbbb") # Match not found check("aabbbbbc") # …

Last updated 1 year, 8 months ago | 421 views

Tags:- Python

Python | map() Function The map() function executes a specified function for each item in an iterable. The map() function in Python has two parameters, function and iterable. The map() function takes a function as an argument and …

Last updated 1 year, 10 months ago | 421 views

Tags:- Python

Django is a framework that allows you to build large projects. On the other hand, Flask is used to build smaller websites but flask is much easier to learn and use compared to Django. Django is …

Last updated 1 year, 10 months ago | 421 views

Tags:- Django

Python is an interpreted language, that executes each statement line by line and thus type-checking is done on the fly, during execution. Hence, Python is a Dynamically Typed Language.   Typing refers to type-checking in programming …

Last updated 1 year, 10 months ago | 419 views

Tags:- Python

Python | Generate random numbers Python provides a module called random using which we can generate random numbers. e.g: print(random.random())     We have to import a random module and call the random() method as shown …

Last updated 1 year, 11 months ago | 419 views

Tags:- Python

Python | Dogpile effect In case the cache expires, what happens when a client hits a website with multiple requests is what we call the dogpile effect. To avoid this, we can use a semaphore lock. When …

Last updated 1 year, 10 months ago | 418 views

Tags:- Python

Django | Features  Features available in Django are Optimized for SEO Extremely fast A loaded framework that features authentications, content administrations and RSS feeds Exceptionally scalable to meet the heaviest traffic demand Highly secure Versatility, …

Last updated 1 year, 10 months ago | 416 views

Tags:- Django

Python program to count the number of capital letters in a file. with open(FILE_NAME) as my_file: count = 0 text = my_file.read() for character in text: if character.isupper(): count += 1 print(count)    

Last updated 1 year, 8 months ago | 416 views

Tags:- Python