Tutorialspoint

Quine in Python

Samual Sam
Answered 1d 4h ago

The Quine is a program, which takes no input, but it produces output. It will show it’s own source code. Additionally, Quine has some conditions. We cannot open the source code file inside the program. Example code Live Demo a='a=%r;print (a%%a)';print (a%a) Output a='a=%r;print (a%%a)';print (a%a) ... Read More

Handling missing keys in Python dictionaries

karthikeya Boyini
Answered 1d 4h ago

In Python there is one container called the Dictionary. In the dictionaries, we can map keys to its value. Using dictionary the values can be accessed in constant time. But when the given keys are not present, it may occur some errors. In this section we will see how to ... Read More

JSON Formatting in Python

Samual Sam
Answered 1d 4h ago

The JSON (Java Script Object Notation) is light weight, well accepted data interchange format. Using JSON formatting techniques in Python, we can convert JSON strings to Python objects, and also convert Python Objects to JSON strings. To use these functionalities, we need to use the json module of Python. The ... Read More

Type Conversion in Python

Samual Sam
Answered 1d 5h ago

Using Python, we can easily convert data into different types. There are different functions for Type Conversion. We can convert string type objects to numeric values, perform conversion between different container types etc. In this section we will see how the conversions can be done using Python. Converting String to ... Read More

Operator Functions in Python

karthikeya Boyini
Answered 1d 5h ago

In Python there are some additional standard library methods for mathematical operations, like arithmetic, logical, relational, bitwise etc. operations. These methods can be found under the operator module. To use it at first we need to import it the operator standard library module. import operator In this section ... Read More

Merge two sorted arrays in Python using heapq?

Samual Sam
Answered 1d 5h ago

In this section we will see how two sorted lists can be merged using the heapq module in Python. As an example, if list1 = [10, 20, 30, 40] and list2 = [100, 200, 300, 400, 500], then after merging it will return list3 = [10, 20, 30, 40, 100, ... Read More

Creating child process using fork() in Python

karthikeya Boyini
Answered 1d 5h ago

Our task is to create a child process and display process id of both parent and child process using fork() function in Python. When we use fork(), it creates a copy of itself, it is a very important aspect of LINUX, UNIX. fork() is mainly applicable for multithreading environment that ... Read More

Determine if a String is a legal Java Identifier

karthikeya Boyini
Answered 2d 2h ago

To determine if a String is a legal Java Identifier, use the Character.isJavaIdentifierPart() and Character.isJavaIdentifierStart() methods. Character.isJavaIdentifierPart() The java.lang.Character.isJavaIdentifierPart() determines if the character (Unicode code point) may be part of a Java identifier as other than the first character. A character may be part of a Java identifier if any ... Read More

Java Program to compare two Java char Arrays

Samual Sam
Answered 2d 2h ago

To compare two Java char arrays, use the Arrays.equals() method. Let us first declare and initialize some char arrays. char[] arr1 = new char[] { 'p', 'q', 'r' }; char[] arr2 = new char[] { 'p', 'r', 's' }; char[] arr3 = new char[] { 'p', 'q', 'r' }; ... Read More

Convert string to char array in Java

karthikeya Boyini
Answered 2d 2h ago

The following is our string. String str = "Tutorial"; Now, use the toCharArray() method to convert string to char array. char[] ch = str.toCharArray(); Now let us see the complete example. Example Live Demo public class Demo { public static void ... Read More

Java Program to determine a Character's Unicode Block

Samual Sam
Answered 2d 2h ago

To determine a Character’s Unicode Block, use the Character.UnicodeBlock.of() method in Java. The method returns the object representing the Unicode block containing the given character, or null if the character is not a member of a defined block. Let us see the syntax of Character.UnicodeBlock.of() method. Character.UnicodeBlock of(char c) ... Read More

Store unicode in a char variable in Java

karthikeya Boyini
Answered 2d 3h ago

To store Unicode in a char variable, simply create a char variable. char c; Now assign unicode. char c = '\u00AB'; The following is the complete example that shows what will get displayed: when Unicode is stored in a char variable and displayed. Example Live ... Read More

Copy char array to string in Java

Samual Sam
Answered 2d 3h ago

Use the valueOf() method in Java to copy char array to string. You can also use the copyValueOf() method, which represents the character sequence in the array specified. Here, you can specify the part of array to be copied. Let us first create a character array. char[] arr = ... Read More

Java Program to convert ASCII code to String

karthikeya Boyini
Answered 2d 3h ago

To convert ASCII to string, use the toString() method. Using this method will return the associated character. Let’s say we have the following int value, which works as ASCII for us. int asciiVal = 89; Now, use the toString() method. String str = new Character((char) asciiVal).toString(); ... Read More

Java Program to check whether the entered character a digit, white space, lower case or upper case character

Samual Sam
Answered 2d 3h ago

To check whether the entered character is a digit, whitespace, lowercase or uppercase, you need to check for the ASCII values. Let’s say we have a value in variable “val”, which is to be checked. For Lower Case. if(val >= 97 && val <= 123) { ... Read More

1 2 3 4 5 6 7 ... 884 Next
Advertisements
Loading...
Unanswered Questions View All