Convert Decimal to Binary Using Recursion in Python

Vikram Chiluka
Updated on 27-Oct-2022 12:37:31

3K+ Views

In this article, we will show you how to convert decimal to binary using recursion in python. A decimal number is the most familiar number system to the general public. It is base 10 which has only 10 symbols − 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. Whereas Binary number is the most familiar number system to digital systems, networking, and computer professionals. It is base 2 which has only 2 symbols: 0 and 1, these digits can be represented by off and on respectively. When we convert a number from the decimal number system to ... Read More

Check if a Number is Odd or Even using Python

Vikram Chiluka
Updated on 27-Oct-2022 12:36:20

4K+ Views

In this article, we will show you how to check if a number is odd or even in python. Below are the methods to accomplish this task − Using modulo (%) operator Using Recursion Using the Binary AND (&) operator Using modulo (%) operator Python's modulo (%) operator (also called the remainder operator) is useful to determine if a number is odd or even. We obtain the remainder of the division of a number by 2. If it is 0, it is even otherwise it is odd Even Number − A number that can be divided by 2, ... Read More

Calculate Square Root of a Number in Python

Vikram Chiluka
Updated on 27-Oct-2022 12:24:16

3K+ Views

In this article, we will show you how to calculate the square root of a number in Python. Below are the various methods to accomplish this task − Calculating square root using sqrt() Calculating the square root using the pow() function Calculating the square root using the exponent operator Calculating square root using the cmath module What is the square root of a number? The square root of a number is a value when multiplied by itself returns that same number. Example − 5 x 5 = 25, hence the square root of 25 is 5. However -5 ... Read More

Find Largest Integer Less Than x in Python

Jayashree
Updated on 27-Oct-2022 12:23:22

3K+ Views

In this article, we will show you how to find the largest integer less than x in python. The Greatest Integer Function [X] denotes an integral part of the real number x that is the closest and smallest integer to x. It's also called the X-floor. [x]=the largest integer less than or equal to x. Generally If n

Get Image Element of Current Instance in Fabric.js

Rahul Gurung
Updated on 27-Oct-2022 12:12:11

796 Views

In this tutorial, we are going to learn how to get the image element on which the current instance is based on using FabricJS. We can create an Image object by creating an instance of fabric.Image. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to get the image element on which the current instance is based on, we use the getElement method. Syntax getElement(): HTMLImageElement Using the getElement method Example In this example, we have used the getElement method to obtain ... Read More

Set Multiplier to Scale Cloned Image Using Fabric.js

Rahul Gurung
Updated on 27-Oct-2022 11:26:37

343 Views

In this tutorial, we are going to learn how to set a multiplier to scale the cloned image using FabricJS. We can create an Image object by creating an instance of fabric.Image. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to set a multiplier to scale the cloned image, we use the multiplier property. Syntax cloneAsImage( callback: function, { multiplier: Number}: Object): fabric.Object Parameters callback (optional) − This parameter is a function which is to be invoked with ... Read More

Scale Image Object to Given Width in Fabric.js

Rahul Gurung
Updated on 27-Oct-2022 11:25:21

4K+ Views

In this tutorial, we are going to learn how to scale an Image object to a given width using FabricJS. We can create an Image object by creating an instance of fabric.Image. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to scale an Image object to a given width, we use the scaleToWidth method. Syntax scaleToWidth(value: Number, absolute: Boolean): fabric.Object Parameters value − This parameter accepts a Number which determines the new width value of our Image object. absolute ... Read More

Scale Image Object to a Given Height in Fabric.js

Rahul Gurung
Updated on 27-Oct-2022 11:23:41

882 Views

In this tutorial, we are going to learn how to scale an Image object to a given height using FabricJS. We can create an Image object by creating an instance of fabric.Image. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to scale an Image object to a given height, we use the scaleToHeight method. Syntax scaleToHeight(value: Number, absolute: Boolean): fabric.Object Parameters value − This parameter accepts a Number which determines the new height value of our Image object. absolute ... Read More

Scale Image Equally on Horizontal and Vertical Directions in Fabric.js

Rahul Gurung
Updated on 27-Oct-2022 11:21:43

357 Views

In this tutorial, we are going to learn how to scale an image equally on horizontal and vertical directions using FabricJS. We can create an Image object by creating an instance of fabric.Image. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to scale an image equally on horizontal and vertical directions, we use the scale method. Syntax scale(value: Number): fabric.Object Parameters scale − This parameter accepts a Number which sets the scale factor of an image object. Default ... Read More

Remove Current Object Transform in Cloned Image using Fabric.js

Rahul Gurung
Updated on 27-Oct-2022 11:20:04

414 Views

In this tutorial, we are going to learn how to remove the current object transform (scale, angle, flip and skew) in a cloned image using FabricJS. We can create an Image object by creating an instance of fabric.Image. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to remove the current object transform in a cloned image, we use the withoutTransform property. Syntax cloneAsImage( callback: function, { withoutTransform: Boolean }: Object): fabric.Object Parameters callback (optional) − This parameter is ... Read More

Advertisements