10 Easter Eggs in Python

Easter eggs python

Have you heard about Python Easter eggs? In this article, we will discuss the 10 best Easter eggs in Python. 1.Simple Hello World This Easter egg will print a hello world message. Open the python terminal and try this code. Hello world can be printed using importing __phello__. 2. The Zen of Python As per … Read more

Python Single line If

If statements are important in any programming language. Python provides if statements, in this article we will discuss single line if statements. Let’s first understand the syntax of single line if statement in python. Example Output Singe line statements reduces number of lines but still maintains code quality, but don’t over use it; long and … Read more

Python docstrings, format and examples

In this tutorial, we will discuss python docstrings, and learn about docstring format with examples. What is docstring in Python? Docstring is a string literal appears after the definition of modules, functions or classes. In other words, it is a description of the function, class or module. Lets define a small function to calculate the … Read more

How To Use Lambda Function in Python

In this article, we will discuss lambda function definition and usages in Python. Lambda functions are also known as anonymous function or lambda expression. Lambda function definition A lambda function/expression is a notation used in the lambda calculus. A normal function is , where x is a variable but a lambda function as shown below … Read more

Class Variables and Instance Variables in Python

Class variables and instance variables are two important concepts related to classes in Python. In this article, we will discuss class variable and instance variables with examples. We can define empty class in Python as shown below Two types of variables associated with a Python class – instance variables and class variables. Instance variables Instance … Read more

How to Concatenate Strings in Python

String concatenation is a common task in most applications. In this article, we will look into different ways to concatenate strings in Python. 1.Using the + operator To concatenate strings we can use the + operator. Output Here string str1 and str2 are joined using the + operator. We can add space between str1 and … Read more

Maximum value of integers in Python

In this article, we discuss the maximum value of integers in python. We will consider python 2 and python 3 versions. Python 2 In python 2, integers are internally handled using int and long data types. If the number value is beyond int’s maximum value of int it automatically switches to a long data type. … Read more

Python Split String into List

In this tutorial, we will discuss the methods to split a string into a list. Python string has split() method it can be used to split the string into a list. Syntax Parameters seperator – seperator used to split the string, it can be a character or multiple characters (optional) maxsplit – Number of splits … Read more