- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Samual Sam has Published 2492 Articles
Samual Sam
221 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
Samual Sam
827 Views
This is a language agnostic question. Loops are there in almost every language and the same principles apply everywhere. You need to realize that compilers do most heavy lifting when it comes to loop optimization, but you as a programmer also need to keep your loops optimized.It is important to ... Read More
Samual Sam
2K+ Views
There are multiple ways in which you can use multiline statements in the command line in python. For example, bash supports multiline statements, which you can use like −Example$ python -c ' > a = True > if a: > print("a is true") > 'OutputThis will give the output −a ... Read More
Samual Sam
2K+ Views
The += operator is syntactic sugar for object.__iand__() function. From the python docs:These methods are called to implement the augmented arithmetic assignments (+=, -=, *=, @=, /=, //=, %=, **=, =, &=, ^=, |=). These methods should attempt to do the operation in-place (modifying self) and return the result (which ... Read More
Samual Sam
2K+ Views
If you have a dict with string-integer mappings, you can use the max method on the dictionary's item pairs to get the largest value. exampled = { 'foo': 100, 'bar': 25, 'baz': 360 } print(max(k for k, v in d.items()))OutputThis will give the output −foofoo is largest in alphabetical order.
Samual Sam
4K+ Views
The easiest way to convert a spreadsheet to Python dictionary is to use an external library like pandas. This provides very helpful features like to_dict on excel objects. You can use these like −Examplefrom pandas import * xls = ExcelFile('my_file.xls') data = xls.parse(xls.sheet_names[0]) print(data.to_dict())OutputThis will give the output −{'id': 10, ... Read More
Samual Sam
2K+ Views
We can print multiple blank lines in python by using the character the number of times we need a blank line. For example, If you need 5 blank lines, you can use −Python 2.x: print "" Python 3.x: print("")You can use features like repetition operator in python to ... Read More
Samual Sam
159 Views
The outline-style property specifies the style for the line that goes around an element. It can take one of the following values −none − No border. (Equivalent of outline-width:0;)solid − Outline is a single solid line.dotted − Outline is a series of dots.dashed − Outline is a series of short lines.double ... Read More
Samual Sam
806 Views
An element with position: absolute is positioned at the specified coordinates relative to your screen top-left corner.You can use two values top and left along with the position property to move an HTML element anywhere in the HTML document.Move Left - Use a negative value for left. Move Right - Use a positive value for left. Move ... Read More