Akshitha Mote has Published 54 Articles

What is function of ^ operator in Python

Akshitha Mote

Akshitha Mote

Updated on 18-Apr-2025 21:45:21

1K+ Views

In Python, the XOR operator is one of the bitwise operators and is represented by the caret symbol ^. It returns 0 if both operands are the same and 1 if the operands are different. Truth Table of XOR The following is the truth table of the XOR (exclusive OR) ... Read More

Explain function of % operator in Python.

Akshitha Mote

Akshitha Mote

Updated on 18-Apr-2025 19:16:17

637 Views

The % symbol in Python is defined as the modulo operator. It can also called as remainder operator. It returns the remainder of the division of two numeric operands (except complex numbers). The Python modulo % operator is a part of arithmetic operations like addition (+), subtraction (-), multiplication (*), ... Read More

Does Python have a ternary conditional operator?

Akshitha Mote

Akshitha Mote

Updated on 18-Apr-2025 19:13:45

319 Views

The Python ternary operator returns a value based on whether a condition is True or False. It is similar to an if-else statement but is expressed in a single line. For understanding the ternary operator, we need to have an idea about conditional statements. Let's have a basic understanding of ... Read More

How to create an empty list in Python?

Akshitha Mote

Akshitha Mote

Updated on 17-Apr-2025 16:42:25

753 Views

In Python, list is one of the built-in data types. A Python list is a sequence of items separated by commas, enclosed in square brackets [ ]. The items in a Python list need not be of the same data type.  In this article, we will discuss different ways to ... Read More

How to create Python dictionary from list of keys and values?

Akshitha Mote

Akshitha Mote

Updated on 17-Apr-2025 16:41:25

24K+ Views

In Python, the dictionary is one of the built-in data types that stores the data in the form of key-value pairs. The pair of key-value is separated by a comma and enclosed within curly braces {}. The key and value within each pair are separated by a colon (:). Each ... Read More

What is tilde (~) operator in Python?

Akshitha Mote

Akshitha Mote

Updated on 15-Apr-2025 17:47:07

8K+ Views

In Python, the bitwise operator ~ (pronounced as tilde) is a complement operator. It takes one bit operand and returns its complement. If the operand is 1, it returns 0, and if it is 0, it returns 1. For example, consider the 4-bit binary number (1100)2. By performing the tilde ... Read More

How to convert an integer to an ASCII value in Python?

Akshitha Mote

Akshitha Mote

Updated on 15-Apr-2025 14:44:38

2K+ Views

Converting Integer to ASCII Using chr() Function In Python, the chr() function converts an integer value to the corresponding ASCII (American Standard Code for Information Interchange) character only if the integer range lies between 0 and 127. The chr() function accepts Unicode values within the range of 0 to 1114111. ... Read More

What is behavior of ++ and -- operators in Python?

Akshitha Mote

Akshitha Mote

Updated on 15-Apr-2025 14:28:21

314 Views

In C/C++, Java, etc., ++ and -- operators are defined as increment and decrement operators. In Python, they are not defined as operators. Increment and Decrement Operators in Python In Python, objects are stored in memory. Variables are just labels. Numeric objects are immutable. Hence, they can't be incremented or ... Read More

How do we reference Python class attributes?

Akshitha Mote

Akshitha Mote

Updated on 15-Apr-2025 14:01:17

837 Views

In Python, the variables that are declared inside the class are known as attributes. These attributes can be accessed and modified by both the class and its objects. Following are the two types of attributes - Class Attributes: The attributes that are defined globally in ... Read More

Python program to capitalize each word\'s first letter

Akshitha Mote

Akshitha Mote

Updated on 15-Apr-2025 12:58:55

2K+ Views

Let's understand the problem statement: we need to convert a given strings to a title case, which involves capitalizing the first letter of each word while converting the remaining letters to lowercase. The following are the various ways to capitalize each word's first letter in a string - ... Read More

Advertisements