How to Iterate Over a Dictionary in Python?

[toc] Introduction A Python dictionary stores data in the form of key-value pairs. A dictionary in Python is ordered, mutable and does not allow duplicates. The keys in the dictionary are paired with the values by using a colon (:) while the commas fill in as a separator for the pairs. The values can be the same but … Read more

Python Or Operator

Python’s or operator performs the logical OR operation that returns True if at least one of the operands evaluates to True. The operator performs an optimization called short-circuiting, so if the first operand evaluates to True, it returns the first right away without further evaluating the second, and if the first operand evaluates to False, … Read more

How To Add New Keys To a Python Dictionary?

Introduction Before diving into the solutions to our question, here’s a quick recap of Python dictionaries. In Python, a dictionary is a collection of objects. A Python dictionary stores data in the form of key-value pairs. A dictionary in Python is ordered, changeable and does not allow duplicates. The keys in the dictionary are paired … Read more

How to Find the Index of a List Element in Python?

Introduction Lists are the built-in data type in Python used to store items in an ordered sequence. You will definitely use lists in most of your projects if you are programming in Python. So take your time and invest a good hour or so to study this guide carefully. Note: In Python, list elements start … Read more

Python And Operator

Python’s and operator performs the logical AND operation that returns True if both operands evaluate to True. The operator performs an optimization called short-circuiting, so if the first operand evaluates to True, it returns the second operand; and if the first operand evaluates to False, it returns False without further evaluating the second operand. As … Read more

[Google Interview] Rotate Matrix

[toc] ?️ Asked in: Google, Facebook, Amazon Are you terrified of being asked this question in an interview? Don’t worry! You are not alone. Many people found it intimidating. Unfortunately, the probability of seeing it at least once is quite high if you are undergoing a lot of interviews. Many interviewee’s have claimed that they … Read more

Python Exponent – 4 Operators Every Coder Must Know

Python has four ways to calculate the n-th power (exponent) of x so that xⁿ=x*x*…*x that multiplies the base x with itself, and repeating this n-times. Method 1: Use the double-asterisk operator such as in x**n. Method 2: Use the built-in pow() function such as in pow(x, n). Method 3: Import the math library and … Read more

Python Networking with Sockets

Have you ever wondered what happens in the system when you type https://app.finxter.com/Β orΒ https://google.com and press enter in your web browser? This is exactly what we will be covering in Python Networking. How the data flows from HTTP protocol to TCP/IP protocol stack. Then finally over the internet to fetch the data you requested. We discuss … Read more

How to Display a 1D and 2D Multiplication Table in Python?

Python Multiplication Table For Loop To calculate the multiplication table for a given number, iterate over all values i=0, 1, …, limit in a for loop and use the following statement as a loop body: print(number, ‘x’, i, ‘=’, number * i). This prints all equations, line by line, in the form i x j … Read more