AmitDiwan has Published 10744 Articles

Python Program to Create a Class wherein a Method accepts a String from the User and Another Prints it

AmitDiwan

AmitDiwan

Updated on 12-Mar-2021 11:54:06

423 Views

When it is required to create a class that has a method that accepts a string from the user, and another method that prints the string, object oriented method is used. Here, a class is defined, and attributes are defined. Functions are defined within the class that perform certain operations. ... Read More

Python Program to Create a class performing Calculator Operations

AmitDiwan

AmitDiwan

Updated on 12-Mar-2021 11:50:52

3K+ Views

When it is required to create a class that performs calculator operations, object oriented method is used. Here, a class is defined, and attributes are defined. Functions are defined within the class that perform certain operations. An instance of the class is created, and the functions are used to perform ... Read More

Creating Attractive First Lines with CSS ::first-line

AmitDiwan

AmitDiwan

Updated on 12-Mar-2021 11:28:31

177 Views

The CSS ::first-line pseudo-element helps us style first line of an elementThe following examples illustrate CSS ::first-line pseudo-element.Example Live Demo body {    text-align: center;    background-color: darkorchid; } ::first-line {    font-size: 2em;    color: black;    font-weight: bold;    text-shadow: 0 -10px grey; } ... Read More

Controlling Whether Mouse & Touch Allowed with CSS pointer-events Property

AmitDiwan

AmitDiwan

Updated on 12-Mar-2021 11:06:24

253 Views

Using the CSS pointer-events property we can control whether a mouse and touch are allowed on an element.The syntax of CSS pointer-events property is as follows −pointer-events: auto|none;Above, auto is default. Element reacts to pointer events, whereasnone: Element does not react to pointer eventsExampleThe following examples illustrate CSS pointer-events property. Live ... Read More

Using Data-Attributes (data-*) in CSS

AmitDiwan

AmitDiwan

Updated on 12-Mar-2021 11:02:47

1K+ Views

We can store extra information about elements using data-* attribute. The following examples illustrate CSS data-* attribute.Example Live Demo dl {    margin: 2%; } p {    width: 60%;    background-color: lightgreen;    padding: 2%;    color: white;    text-align: center; } dt {    font-weight: bold; ... Read More

How to Create a Checkmark / Tick with CSS

AmitDiwan

AmitDiwan

Updated on 12-Mar-2021 10:53:39

3K+ Views

We can create a customized checkmark using CSS. The following examples illustrate this effect −Example Live Demo div {    margin: 2%;    position: relative;    width: 40px;    height: 40px;    box-shadow: inset 0 0 12px lightblue; } div::before {    content: "";    position: absolute;    width: ... Read More

Latest CSS Properties and APIs for Web Design in 2020

AmitDiwan

AmitDiwan

Updated on 12-Mar-2021 10:43:02

153 Views

To help developers customize their websites with a mix of JavaScript and CSS, new CSS properties have been developed and now support popular browsers. Some of these are listed below −focus-withinIt aims to solve focus-accessibility within elementsscroll-snapThis enables native scroll and deceleration@media(prefers-*)Helps set both UI and UX of page according ... Read More

Remove duplicate tuples from list of tuples in Python

AmitDiwan

AmitDiwan

Updated on 12-Mar-2021 06:11:22

1K+ Views

When it is required to remove duplicate tuples from a list of tuples, the loop, the 'any' method and the enumerate method can be used.The 'any' method checks to see if any value in the iterable is True, i.e atleast one single value is True. If yes, it returns 'True', ... Read More

Initialize tuples with parameters in Python

AmitDiwan

AmitDiwan

Updated on 12-Mar-2021 06:10:45

478 Views

When it is required to initialize the tuples with certain parameters, the 'tuple' method and the '*' operator can be used.The 'tuple' method will convert the iterable passed to it as parameter into a tuple class type.The * operator can be used to get the product of two values. It ... Read More

Convert Tuple to integer in Python

AmitDiwan

AmitDiwan

Updated on 12-Mar-2021 06:09:30

2K+ Views

When it is required to convert a tuple into an integer, the lambda function and the 'reduce' function can be used.Anonymous function is a function which is defined without a name. The reduce function takes two parameters- a function and a sequence, where it applies the function to all the ... Read More

Advertisements