What are Class, Object, and Method in Python?

A class is a user-defined prototype, from which objects can be created. Classes can bundle data and functions together. An object is an instance of a class. When an object is created, the class is said to be instantiated.  How to define a simple class? The following is an example of defining a class in … Read more

Python Booleans

What are Booleans? Booleans are two opposite values: either True or False. The tutorial provides examples about writing Boolean statements in Python.

Python Binary

This tutorial provide brief explanations on bytes(), bytearray(), and memoryview() with examples.

Python frozenset()

What is a frozenset? frozenset() is a function in Python that makes an iterable object immutable. In other words, frozenset() freezes the iterable objects and makes them unchangeable. What does iterable mean in Python? Iterable in Python means an object capable of returning its members one at a time, allowing it to be iterated over in a … Read more

Python Built-in Data Types with Examples

Python has the following built-in data types. The following table provides the definition, name in Python, examples, and how to set data types. You can also click links to see in-depth explanations and examples. Data Types Names in Python Examples Set Data Types Text str “Hello World” str(“Hello World”) Numeric int 12 int(12) float 12.5 … Read more

How to Get the Current Date in Python

This tutorial will show you how to get the current date in Python. It will also show you how to print the weekday in English like Monday, Tuesdady, Wednesday, etc. Use today() to get the date in number format in Python We can ask Python to return the current date by using the date.today() in … Read more

How to Check the Current Python Version

You can check the version of Python that is running by using the standard module sys. First, you need to import the sys module. Since it is a standard module, you do not need to install externally. The following is the output showing the current version of Python. It is Python 3.10. sys.version_info(major=3, minor=10, micro=0, … Read more

What is Python and How to Get Started?

Python is an interpreted, general-purpose programming language. For interpreted language, it means that the Python codes are converted into bytecode, which is executed by the Python virtual machine. You can simply use the basic Python interpreter to run your code with the command line. For instance, you type “print(‘Hello New York’)” and hit Enter. It will show “Hello … Read more