Python

Python Empty Tuple

Python Empty Tuple | Explained

To create an empty tuple, the “tuple()” function and empty parentheses are used in Python. For instance, “()” represents an empty tuple.

Python List Reverse() Function _ Explained

Python List reverse() Method | Explained

To reverse the list element, the “reverse()” method is used in Python. The “reversed()” function also accepts the list and returns the reversed iterable object.

Python while Loop _ Explained

Python While Loop | Explained

“while” loop executes the block of code until the condition remains “True”. It iterates infinite times if the increment/decrement value is not defined.

Python | Convert Hex to Decimal

Python | Convert Hex to Decimal

In Python, the hexadecimal to decimal conversion is carried out using the inbuilt “int()” function, “literal_eval()”, “while” loop, and “dictionary”.

How to Convert Float to Int in Python

How to Convert Float to Int in Python?

To convert float to int, the inbuilt functions such as “int()”, “math.floor()”, “math.ceil()”, “round()”, and “math.trunc()” are used in Python.

Python Convert Dictionary Keys to List

Python | Convert Dictionary Keys to List

The “dict.keys()”, “List Comprehension”, “for loop with append()”, “Unpacking with *” and “itemgetter()“are used to convert dictionary keys to lists.

Python str() Function Examples

Python str() Function | Examples

The “str()” function is used to return any input data type as a string. Data types, such as list, dict, etc., can be converted into a string using this function.

Python Access Tuple Explained

Python Access Tuple | Explained

In Python, the index number is used to access the items of a Python tuple. The items of tuples are accessed individually and in the form of ranges.

Python Set add() Explained

set.add() Function in Python

Python provides a built-in function named “set.add()” that adds a new element to a set. The set.add() function accepts exactly one argument.

Fibonacci Series in Python Using For Loop

Fibonacci Series in Python Using For Loop

The “Fibonacci series” is created using the “for loop” iteration of any user-defined range. The Fibonacci series is generated by adding the previous two numbers.

Python Pillow Tutorial

Python Pillow Tutorial

In Python, the pillow module is used for multiples operation on digital images like cropping, filtering, drawing and enhancing, etc

How to get Python String Length

How to Get Python String Length?

To get the length of a Python string, a built-in function named “len()” or a user-defined function with “for loop” or “if-else” statements is used.

Python Convert Dictionary to JSON-01

Python | Convert Dictionary to JSON

The “json.dumps()” function of the json module converts the value of the dictionary into JSON. The value is stored in “keys” and then converted into JSON.

Python Logical AND Operator | Explained

Python Logical AND Operator | Explained

The logical “and” operator returns the boolean value “True” when both of the operands are “True”. This operator checks multiple conditions at one time.

Memory Error in Python

Memory Error in Python

The causes and solutions of python memory errors are discussed and how python memory error occurs due to the use of 32-Bit python installation.

Read a Text File

How to Read a Text File in Python

The “read()” function, “read(n)” with parameter value, and “readline()” function is used to read a text file completely, specifically and line by line.

How to Use the Python If Not Statement

How to Use the Python If Not Statement?

The “If Not” statement is used to execute the statements of a program when the condition is “False”. The “If Not” statement is used to check any empty iterable.

How to Generate Random Numbers in Python

How to Generate Random Numbers in Python?

In Python, the random module function “randint()”, “random() method”, “random.sample()” and “for loop with randint()” functions are used to generate random numbers.

For Loop in Python Explained

For Loop in Python | Explained

In Python, the “for loop” function iterates over the sequence of elements of different iterable objects like tuples, strings, and lists.

How to Get Class Name in Python

How to Get Class Name in Python

In Python, the class name is obtained by different methods like “type().__name__”, and “__class__.__name__” and “nested “__qualname__” method.

Python Division Operators Explained

Python Division Operators | Explained

The division operators divide two input “float” or “integer” data type numbers using “/” and “//” operators. Both operators provide different types of answers.

How to Reverse a Number in Python

How to Reverse a Number in Python

In Python, the “for loop”, “while loop”, “string slicing”, “recursive method” and “reversed() function” are used to reverse a number.

How to Split String in Python

How to Split String in Python?

In Python, the “split()” method is used to split the string according to the value provided by the “separator” parameter and “max split” parameter

How to Repeat N Times in Python

How to Repeat N Times in Python

In Python, the built-in “range() function”, “iter.tools() method” and “split() function” are used to repeat N times. All these methods are explained here.

Exit Commands in Python

Exit Commands in Python

In Python, we used several “Exit” commands like “quit()”, ”exit()”, “sys.exit()”, “os_exit()” and “SystemExit” to terminate the program.

How to Convert Int to Binary in Python

How to Convert Int to Binary in Python

In Python, the “bin()” function, “format()” function, “f-string()” function, and “str.format()” method can be used to convert an integer to binary.