 
 Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Programming Articles - Page 2499 of 3366
 
 
			
			842 Views
In this article, we will learn about increment and decrement operators in Python 3.x. Or earlier. In other languages we have pre and post increment and decrement (++ --) operators.In Python we don’t have any such operators . But we can implement these operators in the form as dicussed in example below.Examplex=786 x=x+1 print(x) x+=1 print(x) x=x-1 print(x) x-=1 print(x)Output787 788 787 786Other languages have for loops which uses increment and decrement operators. Python offers for loop which has a range function having default increment value “1” set. We can also specify our increment count as ... Read More
 
 
			
			1K+ Views
In Statistical analysis study of data variability in a sample indicates how dispersed are the values in a given data sample. The two important ways we calculate the variability are Absolute Deviation and Mean Absolute Deviation.Absolute DeviationIn this method we first find the mean value of the given sample and then calculate the difference between each value and the mean value of the sample called as the absolute deviation value of each data sample. So for the values higher than mean the value the deviation value will be positive and for those lower than the mean value the deviation value ... Read More
 
 
			
			1K+ Views
In this article, we will learn about the 4 inbuilt data structures in python namely Lists, Dictionaries, Tuples & Sets.ListsA list is an ordered sequence of elements. It is a non-scalar data structure and mutable in nature. A list can contain distinct data types in contrast to arrays storing elements belonging to the same data types.Lists can be accessed by the help of the index by enclosing index within square brackets.Now let’s see an illustration to understand list better.Examplelis=['tutorialspoint', 786, 34.56, 2+3j] # displaying element of list for i in lis: print(i) # adding an elements at end of ... Read More
 
 
			
			143 Views
In this chapter we see what happens when we update the values in a tuple, which is actually immutable. We will be able to merge new values with old values but that throws an error. We can study the bytecode of the error and understand better how the rules for tuple work.First we define a tuple and then issue a command to update its last element as shown below.Example>>> tupl = (5, 7, 9, [1, 4]) >>> tupl[3] += [6, 8]OutputRunning the above code gives us the following result −Traceback (most recent call last): File "", line 1, in TypeError: ... Read More
 
 
			
			201 Views
In this article, we will learn about the usage and implementation of id() function in Python 3.x. Or earlier. It is present in Python Standard Library and is automatically imported before executing the code.Syntax: id ()Return value: Identity value of type The function accepts exactly one argument i.e. the name of the entity whose id has to be used. This id is unique for every entity until they are referring to the same data.Id’s are merely address in the memory locations and is used internally in Python.Example Codestr_1 = "Tutorials" print(id(str_1)) str_2 = "Tutorials" print(id(str_2)) # This will return True ... Read More
 
 
			
			439 Views
Converting a character array to a reader in Java means treating the array as a stream of characters to be read sequentially. Let's quickly learn about character array and its creation in Java: In Java, a character array is an array that holds elements of only char type, and it is also used to store a sequence of characters. Following is the syntax to define a character array in Java: char char_array_name[] = {'char1', 'char2', 'char3'....} or char char_array_name[] = new char[size]; Here, char_array_name: The name of the character array. ... Read More
 
 
			
			244 Views
No, for that matter to throw any exception explicitly you need to create an object of that exception and throw it using the throw keyword.Without creating an object you cannot throw an exception explicitly, you might create a scenario that causes the respective exception.ExampleFollowing Java program throws a NullPointerExceptionpublic class ExceptionExample { public static void main(String[] args) { System.out.println("Hello"); NullPointerException nullPointer = new NullPointerException(); throw nullPointer; } }OutputHello Exception in thread "main" java.lang.NullPointerException at MyPackage.ExceptionExample.main(ExceptionExample.java:6)
 
 
			
			736 Views
While reading values from the user in the constructor or any method you can validate those values using if condition.ExampleIn the following Java example we are defining two custom exception classes verifying name and age.import java.util.Scanner; class NotProperAgeException extends Throwable{ NotProperAgeException(String msg){ super(msg); } } class NotProperNameException extends Throwable{ NotProperNameException(String msg){ super(msg); } } public class CustomException{ private String name; private int age; public static boolean containsAlphabet(String name) { for (int i = 0; i < name.length(); i++) { char ch = name.charAt(i); if (!(ch >= 'a' && ch
 
 
			
			3K+ Views
Read the inputs and perform the required calculations within a method. Keep the code that causes exception in try block and catch all the possible exceptions in catch block(s). In each catch block display the respective message and call the method again.ExampleIn the following example we have an array with 5 elements, we are accepting two integers from user representing positions in the array and performing division operation with them, if the integer entered representing the positions is more than 5 (length of the exception) an ArrayIndexOutOfBoundsException occurs and, if the position chosen for denominator is 4 which is 0 ... Read More
 
 
			
			4K+ Views
An exception is an issue (run time error) occurred during the execution of a program. When an exception occurred the program gets terminated abruptly and, the code past the line that generated the exception never gets executed.Printing the Exception messageYou can print the exception message in Java using one of the following methods which are inherited from Throwable class.printStackTrace() − This method prints the backtrace to the standard error stream.getMessage() − This method returns the detail message string of the current throwable object.toString() − This message prints the short description of the current throwable object.Exampleimport java.util.Scanner; public class PrintingExceptionMessage { ... Read More