Lakshmi Srinivas has Published 315 Articles

What is the associativity of Python's ** operator?

Lakshmi Srinivas

Lakshmi Srinivas

Updated on 17-Jun-2020 11:55:12

187 Views

From the Python docs:Operators in the same box group left to right (except for comparisons), including tests, which all have the same precedence and chain from left to right — see section Comparisons — and exponentiation, which groups from right to left).So the ** operator(exponentiation) is right to left associative. ... Read More

How to put comments inside a Python dictionary?

Lakshmi Srinivas

Lakshmi Srinivas

Updated on 17-Jun-2020 11:46:03

304 Views

You can put comments like you normally would anywhere in a python script. But note that you can only put single line comments using #. Multiline comments act like strings and you cannot put just a string in between definition of a dict. For example, the following declaration is perfectly ... Read More

How to sort a Python dictionary by datatype?

Lakshmi Srinivas

Lakshmi Srinivas

Updated on 17-Jun-2020 10:24:04

125 Views

You can sort a list of dictionaries by values of the dictionary using the sorted function and passing it a lambda that tells which key to use for sorting. For example, A = [{'name':'john', 'age':45},      {'name':'andi', 'age':23},      {'name':'john', 'age':22},      {'name':'paul', 'age':35},      {'name':'john', ... Read More

How can I create a non-literal python tuple?

Lakshmi Srinivas

Lakshmi Srinivas

Updated on 17-Jun-2020 10:11:15

117 Views

You can first construct a list then change the single value you want to change, then finally convert that to a tuple if you want to create a non-literal python tuple. For example, def create_non_literal_tuple(a, b, c):    x = [1] * a    x[c] = b    return tuple(x) ... Read More

How to create and populate Java array of Hash tables?

Lakshmi Srinivas

Lakshmi Srinivas

Updated on 16-Jun-2020 09:52:15

463 Views

One way to create an array of hash tables is to create Hashtable objects and to assign these to a Hashtable array using curly braces:ExampleLive Demoimport java.util.Hashtable; public class HashTableOfArrays {    public static void main(String args[]) {       Hashtable ht1 = new Hashtable();       ... Read More

How to draw a circular gradient in HTML5?

Lakshmi Srinivas

Lakshmi Srinivas

Updated on 15-Jun-2020 11:43:34

153 Views

This method returns a CanvasGradient object that represents a radial gradient that paints along the cone given by the circles represented by the arguments. The first three arguments define a circle with coordinates (x1, y1) and radius r1 and the second a circle with coordinates (x2, y2) and radius r2.createRadialGradient(x0, ... Read More

Hide content depending on screen size with Bootstrap

Lakshmi Srinivas

Lakshmi Srinivas

Updated on 12-Jun-2020 22:06:19

461 Views

Use the .hidden-* class in Bootstrap to hide content depending on screen size with BootstrapExampleLive Demo           Bootstrap Example                                 This is visible.       This is hidden.       Hidden on small screen       Hidden on medium screen    

Add plain text next to a form label within a form with Bootstrap

Lakshmi Srinivas

Lakshmi Srinivas

Updated on 12-Jun-2020 21:43:27

349 Views

To add plain text to a form label within a form, use the .form-control-static in Bootstrap.You can try to run the following code to implement a .form-control-static class in BootstrapExampleLive Demo           Bootstrap Example                                                       Email:                            amit@demo.com                                

Add the default styles for the dropdown menu container in Bootstrap

Lakshmi Srinivas

Lakshmi Srinivas

Updated on 12-Jun-2020 21:25:14

160 Views

Use the .dropdown-menu class in Bootstrap to add the default styles for the dropdown menu containerExampleLive Demo           Bootstrap Example                                          Mobile Phones          The following are the mobile phone brands available in India:                       Companies                                            Apple                Samsung                Oppo                Nokia                                

Set a container that spans the full width of the screen with Bootstrap

Lakshmi Srinivas

Lakshmi Srinivas

Updated on 12-Jun-2020 21:16:41

1K+ Views

Use the .container-fluid class in Bootstrap to set a container that spans the full width of the screen.You can try to run the following code to implement the container-fluid classExampleLive Demo           Bootstrap Example                                          Container fluid          Normal width          Width is 75%          Width is 50%          Width is 25%          

Previous 1 ... 7 8 9 10 11 ... 32 Next
Advertisements