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
// from http://b.0218.jp/20121227183142.html | |
// http://javatechnology.net/java/html-sanitizing/ | |
public class Sanitize { | |
public static String sanitizing(String str){ | |
if( str == null || str.equals("") ){ | |
return str; | |
} | |
// javaでメソッドチェインの使用はどうか |
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 java.util.*; | |
class SyainClass { | |
private int syainNo; | |
private String syainName; | |
public SyainClass(int syainNo, String syainName){ | |
this.syainNo = syainNo; | |
this.syainName = syainName; | |
} |
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 random | |
def choice(doors): | |
return doors[random.randrange(len(doors))] | |
def trial(change, times): | |
doors = "A B C".split(' ') | |
match = 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: utf-8 -*- | |
while True: | |
bins = input().split() | |
if len(bins) == 0: | |
break | |
for b in bins: | |
print(chr(int(b,2)), end='') |
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: utf-8 -*- | |
names = ["alice", "becky", "charlie", "Dave"] | |
ages = [25, 38, 12] | |
for name, age in zip(names, ages): | |
print(name, age) | |
# alice 25 | |
# becky 38 |
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: utf-8 -*- | |
class OldRobot(): | |
def __init__(self): | |
self.speed = 5 | |
def walk(self): | |
print("old robot walking {} km/h.".format(self.speed)) | |
class NewRobot(): |
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: utf-8 -*- | |
ITEMS = 5 | |
SIZE = [2, 3, 5, 6, 9] | |
VALUE = [2, 4, 7, 10, 14] | |
NAP_SIZE = 16 | |
nap_value = [0] * (NAP_SIZE + 1) | |
print("ナップザックの大きさ:", end="") | |
for i in range(1, NAP_SIZE+1): |
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
using System; | |
namespace ConsoleApp | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
int[] values = new int[5] { 1, 2, 3, 4, 5 }; | |
Console.WriteLine(string.Join(" ", values)); |
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: utf-8 -*- | |
values = [1, 2, 3, 4, 5] | |
strs = map(str, values) | |
print(" ".join(strs)) |
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 numpy as np | |
import matplotlib.pyplot as plt | |
def step_function(x): | |
return np.array(x > 0, dtype=np.int) | |
def sigmoid(x): | |
return 1 / (1 + np.exp(-x)) | |
def relu(x): |
OlderNewer