Programming Articles - Page 373 of 3363

Creating a SQLite database from CSV with Python

Tamoghna Das
Updated on 25-Apr-2023 16:31:28

7K+ Views

In today's data-driven world, having efficient ways to handle data is essential, and SQLite is one of the best solutions for small-scale database systems. SQLite is a popular relational database system, that is easy to use, lightweight, and scalable. One way to store data in SQLite, is to store it in CSV format. This allows us to store structured data in flat files, which can be easily parsed with the help of Python. In this tutorial, we will learn how to create a SQLite database from CSV files, using Python. What is a SQLite Database? SQLite is a software library ... Read More

Create a GUI to extract information from VIN number Using Python

Tamoghna Das
Updated on 25-Apr-2023 14:29:11

799 Views

A Vehicle Identification Number (VIN) is a unique 17-digit code assigned to every vehicle manufactured after 1981. It contains information about the vehicle’s make, model, year of manufacture, country of origin, and other relevant details. In this instruction manual, we will learn how to create a Graphical User Interface (GUI) using Python programming language to extract vehicle information from a VIN number. Prerequisites Before we dive into the details of creating a GUI, you should have a basic understanding of Python programming, object-oriented programming (OOP) concepts, and how to work with the Tkinter module. List of recommended settings pip ... Read More

Haskell Program to Check Armstrong Number

Akhil Sharma
Updated on 25-Apr-2023 15:35:09

393 Views

In Haskell we can check whether a given number is Armstrong or not using list comprehension and sum function. Armstrong numbers, also known as narcissistic numbers, are numbers such that the sum of the cubes of their digits is equal to the number itself. For example, the number 153 is an Armstrong number because 1^3 + 5^3 + 3^3 = 153. Algorithm Step 1 − The armstrong function calculates the sum of the cubes of the digits of n using list comprehension and the sum function, and define Step 2 − Program execution will be started from main function. ... Read More

Haskell Program to Check Leap Year

Akhil Sharma
Updated on 25-Apr-2023 15:34:14

833 Views

In Haskell, we can check whether a given year is a leap year is not using simple boolean expression. A leap year is a year that has an extra day (February 29th) compared to a normal year. For example, 2004 is a leap year. To determine if a year is a leap year or not, there are a few rules that must be followed. Algorithm Step 1 − The isLeapYear function is defined Step 2 − Program execution will be started from main function. The main() function has whole control of the program. It is written as main ... Read More

Haskell Program to Convert Array to Set (HashSet)

Akhil Sharma
Updated on 25-Apr-2023 15:26:36

304 Views

In Haskell, we will convert Array to Set (HashSet) by using fromList, nub and foldr functions. In the first example, we are going to use ( let set = Set.fromList arr) and in the second example, we are going to use ( let set = nub arr). And in the third example, we are going to use (let set = foldr Set.insert Set.empty arr). Algorithm Step 1 − The Data.Set module is imported to work over set. Step 2 − The program execution will be started from main function. The main() function has whole control of the ... Read More

Haskell Program to Convert File to Byte Array

Akhil Sharma
Updated on 25-Apr-2023 15:25:46

506 Views

In Haskell, we will convert File to byte array by using B.readFile function along with fromIntegral and foldl function. In the first example, we are going to use ( let byteArray = B.unpack bytes) and in the second example, we are going to use (let wordArray = map fromIntegral (B.unpack bytes) :: [Word8]). And in the third example, we are going to use (let byteArray = B.foldl' (\acc byte -> acc ++ [byte]) [] bytes). Algorithm Step 1 − The Data.ByteString modules are imported. Step 2 − The program execution will be started from main function. The main() ... Read More

Haskell Program to convert primitive types to objects

Akhil Sharma
Updated on 25-Apr-2023 15:12:55

221 Views

In Haskell, we will convert primitive types to objects by using accessor functions along with getName function, constructors and record syntax. In the first example, we are going to use (getName person = name person) and in the second example, we are going to use (getName (Person name _) = name and getAge (Person _ age) = age). And in the third example, we are going to use record syntax. Algorithm Step 1 − The ‘Person’ data type is defined with two fields I.e., Name and Age. Step 2 − The getName function is defined Step 3 − ... Read More

Multiple Interfaces in Golang

Sabid Ansari
Updated on 25-Apr-2023 11:30:49

2K+ Views

Interfaces in Golang are an integral part of the language's design philosophy. They enable polymorphism, which is the ability to create objects with different underlying types but with common behavior. However, sometimes a struct needs to implement multiple interfaces. This is where multiple interfaces come into play. In this article, we'll explore the concept of multiple interfaces in Golang, how to implement them, and their practical applications. What are Multiple Interfaces in Golang? In Golang, a type can implement multiple interfaces. When a struct implements multiple interfaces, it gains access to all the methods of those interfaces. This means that ... Read More

Multiple Goroutines

Sabid Ansari
Updated on 25-Apr-2023 11:28:59

348 Views

In computer programming, goroutines are lightweight threads that allow for concurrent execution of code in a single process. Goroutines are a key feature of the Go programming language, which was developed by Google in 2009. In this article, we'll explore the concept of multiple goroutines and how they can be used to improve the performance of your applications. What is a Goroutine? A goroutine is a function that is executed concurrently with other goroutines in a single Go process. Goroutines are similar to threads, but they are much lighter and more efficient. When a goroutine is created, it is assigned ... Read More

Methods With Same Name in Golang

Sabid Ansari
Updated on 25-Apr-2023 11:26:50

858 Views

Go programming language allows multiple methods with the same name, as long as they are defined on different types. This feature is known as method overloading. In this article, we will discuss how to implement methods with the same name in Go and their usage. What are Methods in Golang? Methods in Go are functions that are associated with a specific type. They allow us to define behavior for a particular type. Methods can be defined on both user-defined types and built-in types. Syntax of Methods in Go func (t Type) methodName(parameterList) (returnType) { // Method body ... Read More

Advertisements