Best Practices for Using If Statements in Python

karthikeya Boyini
Updated on 30-Jul-2019 22:30:22

655 Views

Here are some of the steps that you can follow to optimize a nested if...elif...else.1. Ensure that the path that'll be taken most is near the top. This ensures that not multiple conditions are needed to be checked on the most executed path.2. Similarly, sort the paths by most use and put the conditions accordingly.3. Use short-circuiting to your advantage. If you have a statement like:if heavyOperation() and lightOperation():Then consider changing it toif lightOperation() and heavyOperation():This will ensure that heavyOperation is not even executed if lightOperation is false. Same can be done with or conditions as well.4. Try flattening the ... Read More

CSS Media Types

Samual Sam
Updated on 30-Jul-2019 22:30:22

128 Views

The following are the media types in CSS:S.noValue & Description1.AllSuitable for all devices.2.AuralIntended for speech synthesizers.3.BrailleIntended for braille tactile feedback devices.4.EmbossedIntended for paged braille printers.5.HandheldIntended for handheld devices (typically small screen, monochrome, limited bandwidth).6.PrintIntended for paged, opaque material and for documents viewed on screen in print preview mode. Please consult the section on paged media.7.ProjectionIntended for projected presentations, for example, projectors or print to transparencies. Please consult the section on paged media.8.ScreenIntended primarily for color computer screens.9.TtyIntended for media using a fixed-pitch character grid, such as teletypes, terminals, or portable devices with limited display capabilities.10.TvIntended for television-type devices. Read More

Why Python For Loops Don't Default to One Iteration for Single Objects

Chandu yadav
Updated on 30-Jul-2019 22:30:22

171 Views

Python cannot iterate over an object that is not 'iterable'. The 'for' loop construct in python calls inbuilt functions within the iterable data-type which allow it to extract elements from the iterable.Since non-iterable data-types don't have these methods, there is no way to extract elements from them. And hence for loops ignore them.

HTML5 Application Cache vs Browser Cache

Nancy Den
Updated on 30-Jul-2019 22:30:22

353 Views

HTML5 applicationCacheIt can be understood by an example that a web application is cached, and accessible without a connected internet. Application cache has some advantages: users can use the application when they're offline, cached resources load faster and reduced server load. Browser cache Web browsers use caching to store HTML web pages by storing a copy of visited pages. After that, the copy is used to render when you visit that page again

Get Maximal GPS Precision on Mobile Browser

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:22

258 Views

Built-in browser for Android will not give you accurate GPS location for security reasons. Test it with different web browsers that would need permissions to get the accurate location from GPS when installed.After switching GPS off, the data is received with < 10 meters accuracy.Do not use Android Browser for websites, if you want to get GPS location with high accuracy.50 meters precision can be seen for Safari browser if tested for iPhone with wifi switched off. Yes, the accuracy is lesser.

To User Scalable: No or Not to User Scalable: No in HTML5

Rishi Rathor
Updated on 30-Jul-2019 22:30:22

240 Views

For responsive design, you do not have to use user-scalable=no. Use it only if you want your application to look more like a native app.Zooming is a key feature for accessibility and you need to keep that in mind. You can control that users won't break your design if they zoom in. If you are doing responsive and your design breaks when zooming in, then you're not doing it right.If you totally need to use it, then keep in mind that zooming is an important accessibility feature that is used by many people.

What is ABAP? Explain ABAP OOP Feature in Detail

Nikitha N
Updated on 30-Jul-2019 22:30:22

381 Views

ABAP stands for Advanced Business Application Programming. It is one of the primary programming languages used for developing programs and applications for SAP R/3 systems and its related modules. It is a high-level language with respect to SAP as it is understood and known only to SAP environment.The latest version of ABAP which is ABAP Objects follows Object Oriented paradigm. Also, it is fully backward compatible with applications written in previous versions of ABAP whether it is ABAP/4 or other which were highly impressed by COBOL.Being an Object Oriented Programming language it fully supports features like inheritance, polymorphism, encapsulation, and ... Read More

Generate Statistical Graphs Using Python

Ankitha Reddy
Updated on 30-Jul-2019 22:30:22

437 Views

Python has an amazing graph plotting library called matplotlib. It is the most popular graphing and data visualization module for Python. You can start plotting graphs using 3 lines! For example, from matplotlib import pyplot as plt # Plot to canvas plt.plot([1, 2, 3], [4, 5, 1]) #Showing what we plotted plt.show() This will create a simple graph with coordinates (1, 4), (2, 5) and (3, 1). You can Assign labels to the axes using the xlabel and ylabel functions. For example, plt.ylabel('Y axis') plt.xlabel('X axis') And also provide a title using the title ... Read More

Show If-Else Statement Using a Flowchart in JavaScript

Sai Subramanyam
Updated on 30-Jul-2019 22:30:22

289 Views

The if statement is the fundamental control statement that allows JavaScript to make decisions and execute statements conditionally. Let’s see how to show if…else statement using flowchart in JavaScript.

Difference between Session Storage and Local Storage in HTML5

Daniol Thomas
Updated on 30-Jul-2019 22:30:22

811 Views

Session StorageThe Session Storage is designed for scenarios where the user is carrying out a single transaction but could be carrying out multiple transactions in different windows at the same time.Local StorageThe Local Storage is designed for storage that spans multiple windows and lasts beyond the current session. In particular, Web applications may wish to store megabytes of user data, such as entire user-authored documents or a user's mailbox, on the client side for performance reasons.HTML5 introduces the localStorage attribute which would be used to access a page's local storage area without no time limit and this local storage will ... Read More

Advertisements