Hafeezul Kareem has Published 303 Articles

Lambda expression in Python Program to rearrange positive and negative numbers

Hafeezul Kareem

Hafeezul Kareem

Updated on 24-Apr-2020 12:34:21

845 Views

In this tutorial, we are going to write an anonymous function using lambda to rearrange positive and negative number in a list. We need the pick the negative numbers and then positive numbers from a list to create a new one.AlgorithmLet's see how to solve the problem step by step.1. ... Read More

Python Dictionary Comprehension

Hafeezul Kareem

Hafeezul Kareem

Updated on 24-Apr-2020 12:26:13

478 Views

In this tutorial, we are going to learn how to use dictionary comprehensions in Python. If you are already familiar with list comprehension, then it won't take much time to learn dictionary comprehensions.We need the key: value pairs to create a dictionary. How to get these key-value pairs using dictionary ... Read More

Program to print its script name as output in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 24-Apr-2020 12:20:22

1K+ Views

In this tutorial, we are going to write a program that prints the name of the Python script file. We can find the script name using the sys module.The sys module will store all the command line arguments of python command in the sys.argv list. The first element in the ... Read More

Writing files in the background in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 12-Feb-2020 13:01:33

616 Views

In this tutorial, we will learn about the multi-threading in Python. It helps us to perform multiple tasks at a time. Python has a module called threading for multitasking.We see how it works by writing data to a file in the background while calculating the sum of elements in a ... Read More

Sum 2D array in Python using map() function

Hafeezul Kareem

Hafeezul Kareem

Updated on 12-Feb-2020 12:54:03

5K+ Views

In this tutorial, we are going to find the sum of a 2D array using map function in Python.The map function takes two arguments i.e., function and iterable. It passes every element of the iterable to the function and stores the result in map object. We can covert the map ... Read More

Simple GUI calculator using Tkinter in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 12-Feb-2020 12:51:27

4K+ Views

In this tutorial, we are going to create a simple GUI calculator using the Tkinter module. Tkinter is builtin the Python module for developing the GUI application. It's easy to use and comes with Python. We can visualize our data with GUI applications.Let's see how to create a simple GUI calculator.Import everything ... Read More

Run Length Encoding in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 12-Feb-2020 12:40:49

2K+ Views

In this tutorial, we are going to learn how to create a run-length encoding in Python. Given a string return a new string containing char and frequency.For example, the string tutorialspoint will be encoded as t3u1o2r1i2a1l1s1p1n1. The order is every char+frequency. Join all of them and return. See the steps ... Read More

Python program to check if a string contains any unique character

Hafeezul Kareem

Hafeezul Kareem

Updated on 12-Feb-2020 12:32:36

3K+ Views

In this tutorial, we are going to write a program that checks whether a string contains any special character or not. It's straightforward in Python.We will have a set of special characters in the string module. We can use that one to check whether a string contains any special characters ... Read More

Print a Calendar in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 12-Feb-2020 12:21:27

13K+ Views

In this tutorial, we are going to learn how to print the calendar of month and year using the calendar module of Python. It's a straightforward thing in Python. We need year and month numbers. That's it.Let's see how to print a year calendar. Follow the below steps to print ... Read More

Move all zeroes to end of the array using List Comprehension in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 12-Feb-2020 11:44:21

2K+ Views

Given a list of numbers, move all the zeroes to the end using list comprehensions. For example, the result of [1, 3, 0, 4, 0, 5, 6, 0, 7] is [1, 3, 4, 5, 6, 7, 0, 0, 0].It's a single line code using the list comprehensions. See the following ... Read More

Advertisements