• 09 August

    Python | cv2 imshow() Method

    In this tutorial, we will see how to display an image as an output using python by the use of open-cv which is exist as cv2 (computer vision) library. We can use imshow() method of cv2 library to display an image in a window. In order to use cv2 library, we need to import cv2 […]

  • Detect keypress in Python
    12 June

    Detect keypress in Python

    Python allows us to work with user input in its programs. We can also work with hardware devices in Python. In this article, we will discuss how to detect keypress in Python. Using the keyboard module to detect keypress in Python The keyboard module is well equipped with different functions to perform operations related to […]

  • Write a list to a file in Python
    12 June

    Write a list to a file in python

    Python allows us to work with different data structures and write them to an external file. In this tutorial, we will learn how to write a list to a file in Python Using the write() function to write a list to a file in Python The write() function is used to write contents to a […]

  • Copy a dictionary in Python
    12 June

    7 ways to copy a dictionary in python

    💡 Outline **Shallow copy** You can use copy method of Dictionary to create shallow copy of dictionary in Python. [crayon-60c76871addbf770209032/] **Deep copy** You can use deepcopy() function of copy module to create deep copy of dictionary in Python. Dictionaries are a mutable structure in Python. We can alter the key-value pairs in a dictionary without […]

  • Escape quotes in Python
    11 June

    Escape quotes in Python

    💡 Outline You can use \ to escape quotes in Python. If you want to delay python program by 500 ms, then you need to pass 0.5 as parameter to sleep method. [crayon-60c76871ae252270669250/] Escape sequences are frequently used in programming. They are used to convey to the compiler that the escape character has some other […]

  • 07 June

    Number guessing game in Python

    A number guessing game is a common mini-project for basic programmers who have a grasp on random number generation and conditional statements with iteration. The number guessing game is based on a concept where player has to guess a number between given range. If player guesses the expected number then player wins else player loose […]

  • Sort list alphabetically in Python
    31 May

    Sort list alphabetically in Python

    💡 Outline You can use sort() method of list to sort list alphabetically in Python [crayon-60c76871ae6ff429605879/] In this tutorial, we will discuss different ways to sort a list namely using the sort() function, sorted() function, and implementing the quick sort algorithm. Use of the sort() function to sort list alphabetically in Python. The sort() method […]

  • Perfect number in Python
    31 May

    Perfect number program in Python

    According to number theory, a limb of pure mathematics that deals with integers, a Perfect Number can be defined as a positive integer whose value is equivalent to the sum of its proper positive divisors, excluding the number itself (alternatively known as aliquot sum). An example of a perfect number is the number 6, the […]

  • Sleep for milliseconds in python
    31 May

    How to sleep for milliseconds(ms) in Python

    💡 Outline You can use time.sleep() method to sleep for milliseconds in Python. If you want to delay python program by 500 ms, then you need to pass 0.5 as parameter to sleep method. [crayon-60c76871aecb7074739459/] Sometimes, the execution of a program needs to be suspended or paused for a given time. This is done so […]

  • Python hex to bytes
    31 May

    Convert Hex to bytes in Python

    💡 Outline You can use codecs’s decode() function to convert Hex to bytes in python. This method works for Python 2.x and Python 3.x Here is an example: [crayon-60c76871aee8d930973754/] In the world of programming, there are many conversions of data types that programmers have to perform that best suit their problem statements. One of these […]