This file contains hidden or 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 threading import Thread | |
| from time import sleep | |
| class Loendur(Thread): | |
| def __init__(self, limiit): # meetod, mis kutsutakse objekti loomisel. Self on viide iseendale, ülejäänud antud parameetrid | |
| Thread.__init__(self) # kutsume välja ülemklassi konstruktori (sellest täpsemalt OOP aines) | |
| self.limiit = limiit | |
| self.kus = 0 # jätame meelde, kui kaugel me oleme | |
| def run(self): |
This file contains hidden or 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 bisect import bisect_left | |
| from sys import stdin | |
| def is_palin(n): | |
| s = str(n) | |
| return s == s[::-1] | |
| def fair(n): | |
| return is_palin(n) and is_palin(n**2) |
This file contains hidden or 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
| ((lambda f:(lambda x: f(lambda v: x(x)(v)))(lambda x: f(lambda v: x(x)(v))))(lambda rec: lambda amount: lambda coins: lambda taken:((lambda boolean: boolean)((lambda a: lambda b:((lambda a: lambda b:((lambda boolean: boolean)(a)(b)((lambda a: lambda b: b))))((lambda a: lambda b:((lambda num: num(lambda x:((lambda a: lambda b: b)))((lambda a: lambda b: a)))((lambda a: lambda b: b((lambda num: lambda f: lambda x: num(lambda g: lambda h: h(g(f)))(lambda y: x)(lambda y: y)))(a))(a)(b))))(a)(b))((lambda a: lambda b:((lambda num: num(lambda x:((lambda a: lambda b: b)))((lambda a: lambda b: a)))((lambda a: lambda b: b((lambda num: lambda f: lambda x: num(lambda g: lambda h: h(g(f)))(lambda y: x)(lambda y: y)))(a))(a)(b))))(b)(a))))(amount)((((lambda f:(lambda x: f(lambda v: x(x)(v)))(lambda x: f(lambda v: x(x)(v))))(lambda rec: lambda f: lambda init: lambda lst:((lambda boolean: boolean)(((lambda pair: pair((lambda a: lambda b: a))))(lst))(init)(lambda x: f((lambda lst:((lambda pair: pair((lambda a: lambda b: a)))(( |
This file contains hidden or 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
| { | |
| "metadata": { | |
| "name": "LambdaCalculus" | |
| }, | |
| "nbformat": 3, | |
| "nbformat_minor": 0, | |
| "worksheets": [ | |
| { | |
| "cells": [ | |
| { |
This file contains hidden or 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 collections import deque | |
| def readArg(string): | |
| for i in range(len(string)): | |
| if string[i] == ")": | |
| return deque([string[:i]]), string[i+1:] | |
| if string[i] == "(": | |
| inner_result, rest = readArg(string[i+1:]) | |
| other_results, return_rest = readArg(rest) | |
| other_results.extendleft(deque([inner_result, string[:i]])) |
This file contains hidden or 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 inspect | |
| from functools import wraps | |
| def inject(function): | |
| @wraps(function) | |
| def inner(**kwargs): | |
| original_args_list = inspect.getargspec(function).args | |
| undefined = [arg for arg in original_args_list if arg not in kwargs] | |
| if undefined: | |
| raise Exception("We don't know what to do with "+str(undefined)) |
This file contains hidden or 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 urllib.request import urlopen | |
| from time import sleep | |
| import json | |
| subreddit = input("sisesta subreddit: ") | |
| url = "http://imgur.com/r/"+subreddit+"/top.json" | |
| vastus = urlopen(url).read().decode("utf8") | |
| andmed = json.loads(vastus) | |
| for pilt in andmed['data']: |
This file contains hidden or 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 -- | |
| # Koduylesannete alla laadimine | |
| from __future__ import print_function | |
| from pyquery import PyQuery as pq | |
| import mechanize | |
| import cookielib | |
| import getpass | |
| import os | |
| import re |
This file contains hidden or 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
| { | |
| "metadata": { | |
| "name": "N\u00e4dal neli" | |
| }, | |
| "nbformat": 3, | |
| "nbformat_minor": 0, | |
| "worksheets": [ | |
| { | |
| "cells": [ | |
| { |
This file contains hidden or 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
| #juhendaja lahendus | |
| def mitu_tugevusega(alg, a, b = -1, c = -1): | |
| tul = 1 | |
| if a == alg: tul += 1 | |
| if b == alg: tul += 1 | |
| if c == alg: tul += 1 | |
| return tul | |
| def paar(k1, k2, k3, k4, k5): |
OlderNewer