What do you want to save?
Add Code snippet
New code examples
-
Perl 2021-09-03 18:27:03
perl last characters
# For Perl (language) only # syntax substr(<your-string>,-<characters-to-extract>) # example substr("Glass half empty, glass half full",-15) # application my $sRandom = "Glass half empty, glass half full"; my $sLastFewC... Add solution -
Python 2021-09-03 18:20:02
Take n as input and check which ones are Armstrong number using a function in the range 1 to n in python
num = 370 # Changed num variable to string, # and calculated the length (number of digits) order = len(str(num)) # initialize sum sum = 0 # find the sum of the cube of each digit temp = num while temp > 0: digit = temp % 10 sum += digit ** order... Add solution -
PHP 2021-09-03 17:07:03
php regex file extension
$fileName = 'banner.jpg'; $ext = end(explode('.', $fileName)); $ext = substr(strrchr($fileName, '.'), 1); $ext = substr($fileName, strrpos($fileName, '.') + 1); $ext = preg_replace('/^.*\.([^.]+)$/D', '$1', $fileName); $ext = pathinfo($fileName, PATHINFO... Add solution -
Other 2021-09-03 13:38:02
7.8 LAB: Double Helix All the Way (Long)
#returns the upstream dna sequence def find_upstream(dna_sequence): index = dna_sequence.find('ATG') return dna_sequence[0:index] # finds and returns the gene sequence def find_gene(dna_sequence): index = dna_sequence.find('ATG') return d... Add solution -
Python 2021-09-03 08:22:02
how to use visualize_runtimes
import threading import multiprocessing import math import numpy as np import time import matplotlib.pyplot as plt import glob from PIL import Image import random from random import sample import string from concurrent.futures import ThreadPoolExecutor ... Add solution -
Javascript 2021-09-03 07:17:02
create video playlist using jquery
function handler(e) { e.preventDefault(); videotarget = this.getAttribute("href"); filename = videotarget.substr(0, videotarget.lastIndexOf('.')) || videotarget; video = document.querySelector("#video_player video"); video.removeA... Add solution -
Python 2021-09-02 23:20:03
how to loop through pages of pdf using python
import PyPDF2 import re for k in range(1,100): # open the pdf file object = PyPDF2.PdfFileReader("C:/my_path/file%s.pdf"%(k)) # get number of pages NumPages = object.getNumPages() # define keyterms String = "New Y... Add solution -
Javascript 2021-09-02 23:13:01
object of type set is not json serializable
JSON notation has only a handful of native datatypes (objects, arrays, strings, numbers, booleans, and null), so anything serialized in JSON needs to be expressed as one of these types. As shown in the json module docs, this conversion can be done automa... Add solution -