V Jyothi has Published 87 Articles

How to format numbers to strings in Python?

V Jyothi

V Jyothi

Updated on 05-Mar-2020 10:54:42

488 Views

You can format a floating number to a fixed width in Python using the format function on the string. examplenums = [0.555555555555, 1, 12.0542184, 5589.6654753] for x in nums:    print("{:10.4f}".format(x))OutputThis will give the output −0.5556 1.0000 12.0542 5589.6655ExampleUsing the same function, you can also format integers −nums = [5, 20, ... Read More

How to loop through multiple lists using Python?

V Jyothi

V Jyothi

Updated on 05-Mar-2020 08:06:15

492 Views

The most straightforward way seems to use an external iterator to keep track. Note that this answer considers that you're looping on same sized lists. examplea = [10, 12, 14, 16, 18] b = [10, 8, 6, 4, 2] for i in range(len(a)):    print(a[i] + b[i])OutputThis will give the ... Read More

How to set what browsers will show that do not support the ruby element?

V Jyothi

V Jyothi

Updated on 03-Mar-2020 06:22:50

82 Views

The HTML tag specifies to show browsers that do not support the ruby annotations. Ruby Annotations are used in East Asian typography.ExampleYou can try to run the following code to implement tag in HTML −           HTML Rp Tag                        漢 (Kan)          字 (ji)          

How to set that the text direction will be submitted in HTML?

V Jyothi

V Jyothi

Updated on 03-Mar-2020 05:30:41

132 Views

Use the dirname attribute allows you to submit the the text direction. The value will be the name of the input followed by “.dir”.Example           Student Contact Form                Student Name:          Student Subject:                    

How to create table heading in HTML?

V Jyothi

V Jyothi

Updated on 02-Mar-2020 12:20:32

547 Views

Use the tag in HTML to create a heading. The HTML tag is used for specifying a header cell or table header within a table.The following are the attributes −AttributeValueDescriptionabbrabbreviated_textDeprecated − Specifies an abbreviated version of the content in a header cell.alignrightleftcenterjustifycharDeprecated − Content alignment in header cell.axisNameDeprecated ... Read More

How to apply EXTRACT() function with WHERE Clause on the dates stored in MySQL table?

V Jyothi

V Jyothi

Updated on 27-Feb-2020 06:34:26

720 Views

With the help of following MySQL query, we can apply EXTRACT() function with WHERE clause on the dates stored in a table.mysql> Select StudentName,EXTRACT(Year from dateofreg)AS YEAR from testing WHERE StudentName = 'Gaurav'; +-------------+------+ | StudentName | YEAR | +-------------+------+ | Gaurav      | 2017 | +-------------+------+ 1 row in set (0.00 sec)

How to Convert Double to String to Double in Java?

V Jyothi

V Jyothi

Updated on 26-Feb-2020 09:51:54

188 Views

Java lang package provides a Double class which has methods to convert Double to String and vice versa. You can convert a String to a double using the parseDouble() method and double to String using the toString() methodExampleLive Demopublic class StringDouble {    public static void main(String args[]){       Double ... Read More

How to Split String in Java using Regular Expression?

V Jyothi

V Jyothi

Updated on 26-Feb-2020 08:27:11

4K+ Views

The split(String regex) method of the String class splits this string around matches of the given regular expression.This method works in the same way as invoking the method i.e split(String regex, int limit) with the given expression and a limit argument of zero. Therefore, trailing empty strings are not included ... Read More

How to test String is null or empty?

V Jyothi

V Jyothi

Updated on 26-Feb-2020 08:05:55

424 Views

We can verify whether the given string is empty using the isEmpty() method of the String class. This method returns true only if length() is 0.ExampleLive Demoimport java.lang.*; public class StringDemo {    public static void main(String[] args) {       String str = "tutorialspoint";       // ... Read More

String compare by == operator in Java

V Jyothi

V Jyothi

Updated on 26-Feb-2020 06:23:02

79 Views

You can compare two strings using == operator. But, it compares references of the given variables, not values.ExampleLive Demopublic class Sample {    public static void main(String args[]){       String str1 = "hello";       String str2 = "hello";       System.out.println(str1 == str2);    } }Outputtrue

Previous 1 ... 3 4 5 6 7 ... 9 Next
Advertisements