This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| S1 = "Hello World" | |
| print("Length of the String is", len(S1)) # To find the length of a String | |
| List1 = ["Emon", "Bakkar", "Ehassan", "Anik", "Ahad", "Sibbir"] | |
| print("After join the list:", ", ".join(List1)) # To join the String | |
| S2 = "Hey this is Emon" | |
| List2 = S2.split() | |
| print("After Split the String:{}".format(List2)) # To Split a String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| S1 = "Hello Python" | |
| print(S1) # Prints complete string | |
| print(S1[0]) # Prints first character of the string | |
| print(S1[2:5]) # Prints character starting from 3rd t 5th | |
| print(S1[2:]) # Prints string starting from 3rd character | |
| print(S1 * 2) # Prints string two times | |
| print(S1 + "Thanks") # Prints concatenated string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package input; | |
| import java.util.Scanner; | |
| public class Get_input { | |
| @SuppressWarnings("resource") | |
| public static void main(String[] args) { | |
| Scanner scr = new Scanner(System.in); | |
| System.out.println("Enter a number:"); | |
| int a = scr.nextInt(); | |
| System.out.println("Enter another number:"); | |
| int b = scr.nextInt(); |