Ankith Reddy has Published 1070 Articles

How to concatenate a Python dictionary to display all the values together?

Ankith Reddy

Ankith Reddy

Updated on 05-Mar-2020 06:51:37

1K+ Views

You can get all the values using a call to dict.values(). Then you can call ", ".join on the values to concatenate just the values in the dict separated by commas. examplea = {'foo': "Hello", 'bar': "World"} vals = a.values() concat = ", ".join(vals) print(concat)OutputThis will give the output −Hello, WorldRead More

How can I define duplicate items in a Python tuple?

Ankith Reddy

Ankith Reddy

Updated on 05-Mar-2020 06:13:47

639 Views

You can directly enter duplicate items in a Python tuple as it doesn't behave like a set(which takes only unique items). examplemyTpl = (1, 2, 2, 2, 3, 5, 5, 4)You can also use operators on tuples to compose large tuples.For ExamplemyTpl = (1, ) * 5 print(myTpl)OutputThis will give the ... Read More

How to assign multiple values to a same variable in Python?

Ankith Reddy

Ankith Reddy

Updated on 05-Mar-2020 05:40:07

898 Views

In Python, if you try to do something likea = b = c = [0, 3, 5] a[0] = 10You'll end up with the same values ina, b, and c: [10, 3, 5]This is because all three variables here point to the same value. If you modify this value, you'll ... Read More

Usage of :hover pseudo-class in CSS

Ankith Reddy

Ankith Reddy

Updated on 04-Mar-2020 12:45:06

114 Views

The :hover pseudo class is used to add special style to an element when you mouse over it. Possible values could be any color name in any valid format.Example                    a:hover {             color: #FFCC00          }                     Bring Mouse Here    

Create layers using CSS

Ankith Reddy

Ankith Reddy

Updated on 04-Mar-2020 12:17:03

73 Views

To create layers using CSS, you can try to run the following code. I have used the the z-index propertyExample                                                    

Set outline style as ridge with CSS

Ankith Reddy

Ankith Reddy

Updated on 04-Mar-2020 11:28:16

152 Views

To set the outline style as ridge, use the outline-style property with the value ridge. Under groove, the outline looks as though it is carved into the page. The ridge value is the opposite. Example                            This text is having 3px ridge outline.          

Set the color of the outline with CSS

Ankith Reddy

Ankith Reddy

Updated on 04-Mar-2020 11:25:51

93 Views

The outline-color property allows you to specify the color of the outline. Its value should either be a color name, a hex color, or an RGB value, as with the color and border-color properties.ExampleYou can try to run the following code to implement outline-color property −         ... Read More

HTML5 semantic elements and which old browsers does it support?

Ankith Reddy

Ankith Reddy

Updated on 04-Mar-2020 06:19:30

203 Views

Internet Explorer 8 and older versions does not support semantic elements like nav, header and article. To style semantic elements, Modernizer is used. Some CSS can be added to block CSS by default.article, header, nav, section, footer {    display:block; }We can also create our own elements through JavaScript by ... Read More

How to get materialize CSS checkbox to work with @Html.CheckBoxFor?

Ankith Reddy

Ankith Reddy

Updated on 04-Mar-2020 06:08:57

147 Views

The only way to materialize CSS checkbox to work with Html.checkbox without disappearance of the checkbox to the left is by moving the hidden element to the bottom of the parent element.$("input[type='hidden']").each(checkbox1 (0, IsActive ) {    $(this).appendTo($(IsActive).parent()); });In this hidden element, IsActive is placed in the bottom of parent ... Read More

How do I add a simple onClick event handler to an HTML5 canvas element?

Ankith Reddy

Ankith Reddy

Updated on 04-Mar-2020 04:46:50

4K+ Views

The elements that are drawn in canvas element have no representation. Their only representation is the pixels they use and their color. Drawing to a canvas element means drawing a bitmap in immediate mode. To get a click event on a canvas element (shape), you need to capture click events ... Read More

Advertisements