Python Basic

Python Static

❮ Previous Next ❯ Python Static Method In Python, the @staticmethod decorator is used to define a static method in a class. Static methods do not need an instance of the class (i.e., an object) to be called. They belong to the class itself and can be accessed using the class name. Like in C#, […]

Python Static Read More »

Python Functions

❮ Previous Next ❯ Python Functions and Methods Python Functions:A function is a block of code that performs a task, and it can be called anywhere in your program. Syntax: def function_name(): #function definition#your code goes herefunction_name() #function call Example: create a program to find a max number between these 2 no(10,20) without using max

Python Functions Read More »

Python Date and Time

❮ Previous Next ❯ Python Date and Time Python’s datetime module provides functions to work with dates and times. Below are some common patterns for date and time handling in Python. The following table describes various formats with their results: Format Example Result datetime.datetime.now().strftime(‘%m/%d/%Y’) 05/29/2015 datetime.datetime.now().strftime(‘%A, %d %B %Y’) Friday, 29 May 2015 datetime.datetime.now().strftime(‘%Y-%m-%d’) 2024-07-06

Python Date and Time Read More »

Python Keywords

❮ Previous Next ❯ Python Keywords Keywords are the reserved words in python programming dedicated for a certain type of task or action. A Keyword cannot be used as a variable or a constant. Python Keywords: Keyword Description Example FALSE Represents the boolean value False. is_valid = False None Represents a null or no value.

Python Keywords Read More »