What do you want to save?
Add Code snippet
New code examples
-
C# 2022-03-17 06:45:03
c sharp substring
// To get a substring of a string use 'Substring()' // The first value is the index of where to start and the second // value is the lenght of the substring. string str = "Hello World!" str.Substring(3, 4) // Output: "lo W" // If yo... Add solution -
Other 2022-03-16 12:00:07
javascript arrays
//Creating a list var fruits = ["Apple", "Banana", "Cherry"]; //Creating an empty list var books = []; //Getting element of list //Lists are ordered using indexes //The first element in an list has an index of 0, //the sec... Add solution -
C++ 2022-03-15 06:55:06
segment tree complexity
// C++ program to show segment tree operations like construction, query // and update #include <bits/stdc++.h> using namespace std; // A utility function to get the middle index from corner indexes. int getMid(int s, int e) { return s + (e -s)... Add solution -
Java 2022-03-15 01:00:03
java find all of letter in string
String stringName = "Hello"; String characterToFind = "l"; //This example will find all the Ls in this string and will print the index of //it as soon as it is detected for(int i = 0; i < stringName.length(); i++){ if(stringName.... Add solution -
Java 2022-03-12 21:15:23
java indexof all occurrences
String stringName = "Hello"; String characterToFind = "l"; //This example will find all the Ls in this string and will print the index of //it as soon as it is detected for(int i = 0; i < stringName.length(); i++){ if(stringName.... Add solution -
Other 2022-03-06 20:30:03
python brute-force network training
from sklearn.metrics import accuracy_score from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split digits = load_digits() X_scale = StandardScaler() X = X_scale.fit_transform(digits.data) y = digits.target # setup th... Add solution -
Python 2022-03-03 07:40:33
python list functions
list.append(x) # append x to end of list list.extend(iterable) # append all elements of iterable to list list.insert(i, x) # insert x at index i list.remove(x) # remove first occurance of x from list list.pop([i]) # pop element at index i (defaults to end... Add solution -
Python 2022-03-03 06:20:01
how to print a list nicely python
# Creating a list. Can also be floats and intagers list = ["a", "b", "c", "d", "e", "f", "g"] # Have a for loop and then print the answer index of the variable in the loop(i) for i in ... Add solution -
Javascript 2022-02-27 05:40:22
8.3.1. Common Array Methods // indexOf Examples (.indexOf)
//The general syntax for this method is: arrayName.indexOf(item) /*This method returns the index of the FIRST occurence of an item in the array. If the item is not in the array, -1 is returned.*/ let charles = [1, 7, 5, 9, 5]; let otherArray = ['hello',... Add solution