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
#!/usr/bin/env python3 | |
def get_init(factor): | |
values = [] | |
for i in range(1, 10): | |
s = str(i) | |
s = str((i * factor) % 10) + s | |
while s[0] == '0': | |
s = str((int(s) * factor) // 10) + s | |
values += [s] |
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
fn main() { | |
let ints: Vec<u8> = b"1234" | |
.into_iter() | |
.map(|c| c - 48) | |
.collect(); | |
let length = ints.len(); | |
let mut sum = 0; | |
for i in 0..length { | |
/* | |
if ints[i] == ints[(i + 1) % length] { |
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; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace ConsoleApp1 | |
{ | |
class SlowMethod |
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
>>> class Num(): | |
... def __init__(self, value): | |
... self.value = value | |
... def get(self): | |
... return self.value | |
... def __add__(self, other): | |
... return Num(self.value + other.value) | |
... | |
>>> a = Num(3) | |
>>> b = a + Num(5) |
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
class Creature: | |
def __init__(self, name, hp): | |
self.name = name | |
self.hp = hp | |
class Monster(Creature): | |
def __init__(self, name, hp, intelligence=10): | |
Creature.__init__(self, name, hp) | |
self.intelligence = intelligence |
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
class Creature: | |
def __init__(self, name, hp): | |
self.name = name | |
self.hp = hp | |
class Monster(Creature): | |
def __init__(self, name, hp, attrs): | |
Creature.__init__(self, name, hp) | |
self.int = 10 | |
if 'int' in attrs: |