Hafeezul Kareem has Published 328 Articles

Python - Make pair from two list such that elements are not same in pairs

Hafeezul Kareem

Hafeezul Kareem

Updated on 13-Nov-2020 17:27:24

5K+ Views

In this article, we are going to learn how to make pairs from two lists such that no similar elements make a pair. Follow the below steps to solve the problem.Initialize the lists with elements.Iterate over the lists and append the pair into a list if the corresponding elements from ... Read More

SQL using Python and SQLite

Hafeezul Kareem

Hafeezul Kareem

Updated on 13-Nov-2020 13:09:38

1K+ Views

In this article, we are going to learn how to use SQL with Python and SQLite database. Python has a built-in module to connect with SQLite database. We are going to use sqlite3 module to connect Python and SQLite.We have to follow the below steps to connect the SQLite database ... Read More

Prefix matching in Python using pytrie module

Hafeezul Kareem

Hafeezul Kareem

Updated on 13-Nov-2020 13:03:21

447 Views

In this article, we are going to learn about the pytrie module to prefix matching strings from a list of strings. Let's see an example to understand it clearly.Input: List: ['tutorialspoint', 'tutorials', 'tutorialspython', 'python'] Prefix: 'tutorials' Output: ['tutorialspoint', 'tutorials', 'tutorialspython']We can achieve it in different ways. In this tutorial, ... Read More

Form validation using Django

Hafeezul Kareem

Hafeezul Kareem

Updated on 13-Nov-2020 12:58:00

4K+ Views

In this article, we are going to learn how to validate a form in django. Django comes with build-in validators for forms. We can use them in the tutorial to validate forms.You must familiar with the Django to follow along with this tutorial. If you are not familiar with Django, ... Read More

Fetching text from Wikipedia’s Infobox in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 13-Nov-2020 12:41:01

1K+ Views

In this article, we are going to scrape the text from Wikipedia's Infobox using BeatifulSoup and requests in Python. We can do it in 10 mins. It's straightforward.We need to install bs4 and requests. Execute the below commands to install.pip install bs4 pip install requestsFollow the below steps to write ... Read More

Auto-complete feature using Trie

Hafeezul Kareem

Hafeezul Kareem

Updated on 21-Sep-2020 13:19:12

557 Views

We have a Trie, and when a user enters a character, we have to show the matching string the Trie. This feature we call it as auto-completion. For example, if a Trie contains "xyzzzz, ""xyz, " "xxxyyxzzz" and when the user enter xy, then we have to show them xyzzzz, ... Read More

Add the slug field inside Django Model

Hafeezul Kareem

Hafeezul Kareem

Updated on 21-Sep-2020 13:02:30

474 Views

In this tutorial, we are going to learn about the SlugField in Django.SlugFieldSlugField is a way to generate a URL using the data which we already have. You can generate URL using your title of the post or page. Let's see one detailed example.Let's say we have an article with ... Read More

trunc() in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 11-Jul-2020 08:22:56

304 Views

In this tutorial, we are going to learn about the math.trunc() method.The method math.trunc() is used to truncate the float values. It will act as math.floor() method for positive values and math.ceil() method for negative values.Example Live Demo# importing math module import math # floor value print(math.floor(3.5)) # trunc for positive ... Read More

time.process_time() function in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 11-Jul-2020 08:21:15

2K+ Views

In this tutorial, we are going to learn about the time.process_time() method.The method time.process_time() will return a float value of time in seconds of a system and user CPU time of the current process.Example Live Demo# importing the time module import time # printing the current process time print(time.process_time()) 1.171875OutputIf you ... Read More

time.perf_counter() function in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 11-Jul-2020 08:19:13

4K+ Views

In this tutorial, we are going to learn about the time.perf_counter() method.The method time.perf_counter() returns a float value of time in seconds. Let's see anExample Live Demo# importing the time module import time # printing the time print(time.perf_counter())OutputIf you run the above code, then you will get the following result.263.3530349We can ... Read More

Advertisements