Found 33676 Articles for Programming

Donut Chart using Matplotlib in Python

Rohan Singh
Updated on 10-Jul-2023 12:35:34

2K+ Views

A Donut chart is a circular chart that shows the relative representation of the data in a circular way. Donut and pie charts look similar but the donut chart has a hole in the center of the chart whereas the pie chart doesn’t. A donut chart can be created for a dataset containing various groups in different proportions using Matplotlib. In this article, we will create a Donut chart using Matplotlib. Algorithm The donut chart in Matplotlib can be drawn using the methods provided by the matplotlib library. We can follow the below algorithm to make a Donut chart ... Read More

Donut Chart in Pygal

Rohan Singh
Updated on 10-Jul-2023 12:21:55

172 Views

Pygal is a Python library that is used for creating graphs and charts for data visualization. The donut chart is a type of pie chart with a hole in the middle. Donut chat can be easily created using the Pygal library. In this article, we will visualize sample data using a Donut chart. Installing Pygal library Before we start using the Pygal module, we need to install the Pygal library in our system by using the Python package manager. Type the following command in your terminal or command prompt to install the Pygal library. pip install pygal Algorithm ... Read More

Docopt module in Python

Rohan Singh
Updated on 10-Jul-2023 11:50:46

1K+ Views

Docopt module in Python is used to create command-line interfaces. Similar to other command line arguments and options docopt allows us to define command line arguments and options and also generate help messages and usage strings for the Program. In this article, we will understand how the Docopt module is defined and how it is used to create a command line interface. Installation You can install the Docopt module before using it with the help of the pip command in Python. To install the Docopt module type the following command on your terminal or command prompt. pip install docopt ... Read More

dllist class of llist module in Python

Rohan Singh
Updated on 10-Jul-2023 11:42:47

191 Views

The dllist is a class of the llist module in Python that is used to implement a doubly linked list that has the functionality for insertion, deletion, and traversal of elements. The dllist class provides methods for adding, removing, and iterating over the list in both directions. In this article, we will understand the dllist class in detail and its methods. Creating dllist object To create a dllist object, we need to first import the llist module from the pyllist package. We can then use the dllist class constructor to create a new instance of a doubly-linked list. The ... Read More

Adam Optimizer in Tensorflow

Rohan Singh
Updated on 06-Jul-2023 17:24:01

1K+ Views

Adam optimizer in Tensorflow is an algorithm used in deep learning models. Optimization algorithms are used in deep learning models to minimize the loss function and improve performance. Adam stands for Adaptive Moment Estimation, which is a stochastic gradient descent algorithm. It combines the advantages of both RMSprop and AdaGrad algorithms to achieve a better optimization result. In this article, we will understand the Adam Optimizer in Tensorflow and how it works. Working principle of Adam Optimizer Adam optimizer is an iterative optimization algorithm. It uses first and second-order moments of the gradient to adaptively adjust the learning rate ... Read More

Accessing Web Resources using Factory Method Design Pattern in Python

Rohan Singh
Updated on 06-Jul-2023 17:07:07

187 Views

The Factory Method Design Pattern of Python is a creational pattern that provides an interface for creating objects in a superclass but allows subclasses to alter the type of objects that will be created. It is used to define a generic interface for creating objects while allowing subclasses to decide which class to instantiate. In this article, we will explore how to use the Factory Method Design Pattern to access web resources in Python. Accessing Web Resources Python provides several libraries for accessing web resources such as HTTP requests, urllib, and Requests. These libraries allow us to send HTTP requests ... Read More

Golang program of two struct types with identical fields, with having one "JSON" tag on each field

Akhil Sharma
Updated on 06-Jul-2023 12:48:47

1K+ Views

Struct types are used to construct custom data structures consist of fields. These fields reflect the structure's characteristics or attributes. The ability to add tags to fields, such as "JSON" tags, which offer additional metadata about the field when serializing or deserializing the struct to/from JSON format, is a valuable feature of struct types. In this article, we will write Go language programs to represent structs with one JSON tag in each field. type StructName struct { Field1 DataType1 `Tag1:"Value1" Tag2:"Value2"` Field2 DataType2 `Tag3:"Value3" Tag4:"Value4"` // ... ... Read More

How do you compare two struct instances that have pointers as fields in Golang

Akhil Sharma
Updated on 06-Jul-2023 12:40:48

1K+ Views

In golang, Pointers are the variables which store the address of other variables. A struct is a counterpart to class in object-oriented programming where different fields can be placed in the struct, where these fields can be implemented later on and they have a type like int, float, string etc. In this article, we will write a Go language program to compare two struct instances that have pointers as fields. Mathematical representation for assigning the address of variable “b” to variable “a” − a = &b & denotes the address of operator, and receives the memory address of ... Read More

Golang program to compare two instances of this struct for equality, taking into account the values in the slice

Akhil Sharma
Updated on 06-Jul-2023 12:35:58

287 Views

A struct is a counterpart to class in object-oriented programming where different fields can be placed in the struct, where these fields can be implemented later on and they have a type like int, float, string etc.In this article, we will write a Go language program to compare the equality of two structs. Syntax func len(v Type) int The len() method returns the length of any parameter. It accepts one input, the data type variable whose length we want to know. func range(variable) The range function iterates through any data type. To utilize this, we must first put ... Read More

How to find the capacity of the pointers pointing at a map in Golang?

Akhil Sharma
Updated on 06-Jul-2023 12:32:23

160 Views

A pointer is a variable which holds the address of another variable and can be used to point to the content of another variable. A pointer does not have its capacity just like slices, it can be used to point to the map whose length of elements can be calculated.In this article, we will write a Go language program to find the capacity of a pointer pointing to a map. Syntax func make ([] type, size, capacity) The make function in go language is used to create an array/map it accepts the type of variable to be created, its ... Read More

Advertisements