• 21 December

    Python create empty set

    In this post, we will see how to create an set in python. Set is collection which contains unique elements.You can simply use set() function to create empty set in Python. Let’s see this with the help of example. [crayon-662ab65ddc0ab325301934/] Output: empty set s: set() set s: {1, 2, 3} That’s all about Python create […]

  • 21 December

    How to Take Integer Input in Python

    1. Introduction to the Problem Statement In Python programming, a common requirement is to obtain user input. Specifically, we often need to receive numerical input, particularly integers, for various calculations or data processing tasks. The challenge lies not just in capturing the input but also in ensuring that the input is valid and in the […]

  • 21 December

    Combine two lists in Python

    In this tutorial, we will see how to combine twolist in python There are multiple ways to combine list in python. Using + operator You can use + operator to combine list in python. Let’s understand with the help of example. [crayon-662ab65ddd02c753916686/] Output: Combined List: [1, 2, 3, 4, 5, 6, 7, 8] As you […]

  • 21 December

    Python count items in the list

    In this tutorial, we will see how to count items inlist in python Count total items in the list You can use len() function to count items in the list. Let’s understand with the help of example. [crayon-662ab65ddd12a276386517/] Output: List: [1, 2, 3, 4] Length of list1: 4 Count occurence of each element in the […]

  • 19 December

    Python list to tuple

    In this tutorial, we will see how to convert list to tuple. Using tuple function You can use python tuple() function to convert list to tuole.It is simplest way to convert list to tuple. Let’s understand with the help of example. [crayon-662ab65ddd1cc590515527/] Output: List of Fruits [‘Apple’, ‘Orange’, ‘Grapes’, ‘Banana’] Tuple of Fruits: (‘Apple’, ‘Orange’, […]

  • 22 October

    Python not equal operator

    In this post, we will see about Python not equal operator. Not equal operator is denoted by != in Python and returns true when two variables are of same type but have different value. If two variable posses same value, then not equal operator will return False. Python not equal operator example Here is simple […]

  • 21 October

    Python add to Dictionary

    In python, there are multiple ways to add keys or values to dictionary. You can use assignment operator to add key to dictionary. # Updates if ‘x’ exists, else adds ‘x’ dic[‘x’]=1 There are other ways to add to dictionay as well in python. dic.update({‘x’:1}) # OR dic.update(dict(x=1)) # OR dic.update(x=1) Example: [crayon-662ab65ddf5b7868314847/] Output: Before: […]

  • 21 October

    Python String compare

    In this post, we will see how to compare two Strings in Python. You don’t any specific methods to compare Strings in python. You can use different operators such == and =! for String comparison. You can also use <, >, <=, >= with Strings. Let’s understand with the help of example: [crayon-662ab65ddfd37279232612/] Output: True […]

  • 21 October

    Validate email address in Python

    In this post, we will see how to validate email address in Python. There are times when you want to validate email address. You can write your own code to validate email address but there are many regular expressions which you can use to validate email address. We can use regular expression provided by OWASP […]