A Pen by Takuma YOSHITANI on CodePen.
This file contains 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
# coding: utf8 | |
print [x for x in range(1900, 2201) if x%4 == 0 and x%100 != 0 or x%400 == 0] |
This file contains 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
# coding: utf8 | |
def isLeapYear(x): | |
return x%4 == 0 and x%100 != 0 or x%400 == 0 |
This file contains 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
# coding: utf8 | |
import a2 | |
import csv | |
reader = csv.DictReader(open("evaluation-values.csv")) | |
leapAvg = 0 | |
leapNum = 0 | |
nonLeapAvg = 0 |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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
puts "Hello World" |
This file contains 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
(* Sort list of polynomial functions (fs) based on degree of x in ascending order *) | |
SortByDegree[fs_, x_] := Module[{}, | |
Comp[f1_,f2_] := Exponent[f1,x] < Exponent[f2,x]; | |
Sort[fs,Comp] | |
]; | |
(* Calculate pseud-remainder *) | |
Rem[f_, g_, x_] := Module[{q,r,u}, | |
{q,r} = Together[#]&/@PolynomialQuotientRemainder[f,g,x]; | |
u = PolynomialLCM[Denominator[q], Denominator[r]]; |
This file contains 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
#include <stdio.h> | |
int main(void){ | |
printf("Hello World!\n"); //this is a test | |
} |
This file contains 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
import System.IO | |
main = do | |
putStrLn $ show $ sum $ filter judge [1..999] | |
judge a | a `mod` 3 == 0 || a `mod` 5 == 0 = True | |
| otherwise = False |
This file contains 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
import System.IO | |
main = do | |
putStrLn $ show $ sum $ filter even $ takeWhile ((>) 4000000) fib | |
fib = 1:2:[ a+b | (a,b) <- zip fib (tail fib)] |
OlderNewer