content
stringlengths
7
1.05M
""" [9/10/2014] Challenge #179 [Intermediate] Roguelike - The traveller Game https://www.reddit.com/r/dailyprogrammer/comments/2g1c80/9102014_challenge_179_intermediate_roguelike_the/ #Description: So I was fooling around once with an idea to make a fun Rogue like game. If you do not know what a Rogue Like is check ...
""" Selection sort. """ def selection_sort(A, unused_0=0, unused_1=1): for j in range(len(A)-1): iMin = j for i in range(j+1, len(A)): if A[i] < A[iMin]: iMin = i if iMin != j: A[j], A[iMin] = A[iMin], A[j]
""" This file is part of Totara Enterprise Extensions. Copyright (C) 2020 onwards Totara Learning Solutions LTD Totara Enterprise Extensions is provided only to Totara Learning Solutions LTD's customers and partners, pursuant to the terms and conditions of a separate agreement with Totara Learning Solutions LTD or it...
#!/usr/bin/env python3.7 # -*- coding: utf-8 -*- # Source: https://youtu.be/6oL-0TdVy28 class Node(object): def __init__(self, value): self.value = value self.left = None self.right = None class BinaryTree(object): def __init__(self, root): self.root = Node(root) def pr...
#!/usr/bin/env python # Software License Agreement (BSD License) # # Copyright (c) 2011, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code...
# -*- coding: utf-8 -*- # 高阶函数 # sorted ## 翻转字符串 s = '12345' d = sorted(s, reverse=True) print(''.join(d)) s = '12345' d = s[::-1] print(d) ## 列表元素排序 L = [36, 5, -12, 9, -21] print('列表', L, '排序: ', sorted(L)) ## 按元素的绝对值排序 print('列表', L, '绝对值排序: ', sorted(L, key=abs)) ## 字符串排序 L = ['bob', 'about', 'Zoo', 'Credit'] ...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def isSubtree(self, root: TreeNode, subRoot: TreeNode) -> bool: if not root: return Fals...
'''Helper to filter sets of data''' class SetFilter: '''Helper class to filter list''' @staticmethod def diff(a_set, b_set): '''Filter by not intersection''' return not set(b_set).intersection(set(a_set)) @staticmethod def exact(a_set, b_set): '''Filter by eq''' return set(a_set) == set(b_se...
code_begin = """#!/usr/bin/env bash curl""" code_header = """ --header "{header}:{value}" """ code_proxy = " -x {proxy}" code_post = """ --data "{data}" """ code_search = """ | egrep --color " {search_string} |$" """ code_nosearch = """ -v --request {method} {url} {headers} --include"""
# Solution to Exercise #1 # ... env = MultiAgentArena() obs = env.reset() while True: # Compute actions separately for each agent. a1 = dummy_trainer.compute_action(obs["agent1"]) a2 = dummy_trainer.compute_action(obs["agent2"]) # Send the action-dict to the env. obs, rewards, dones, _ = env.step...
#!/usr/bin/env python # -*- coding: utf-8 -*- count = 0 while count < 10: count += 1 if count % 2 == 0: continue print(count, end=" ")
def bubble_sort(arr): length = len(arr) for i in range(length): for j in range(0, length - i - 1): if arr[j] > arr[j + 1]: arr[j], arr[j + 1] = arr[j + 1], arr[j] def main(): random_list = [12, 4, 5, 6, 25, 14, 15] bubble_sort(random_list) print(random_list) if...
def bowling_score(frames): frames = [list(r) for r in frames.split(' ')] points = 0 for f in range(0, 8): if frames[f][0] == 'X': points += 10 if frames[f+1][0] == 'X': points += 10 if frames[f+2][0] == 'X': p...
# -*- coding: utf-8 -*- __soap_format = ( '<?xml version="1.0" encoding="UTF-8"?>\n' '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" ' 'xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" ' 'xmlns:xsi="http://www.w3.org/2001/XM...
ACCEL_FSR_2G = 0 ACCEL_FSR_4G = 1 ACCEL_FSR_8G = 2 ACCEL_FSR_16G = 3
SUCCESS = 0 FAILURE = 1 # NOTE: click.abort() uses this # for when tests are already running ALREADY_RUNNING = 2
karman_line_earth = 100_000*m // km karman_line_mars = 80_000*m // km karman_line_venus = 250_000*m // km
def extractWLTranslations(item): """ # 'WL Translations' """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol or frag) or 'preview' in item['title'].lower(): return None if 'Chapter Releases' in item['tags'] and ('OSI' in item['tags'] or item['title'].startswith('OSI ...
class Car: def __init__(self, make, petrol_consumption): self.make = make self.petrol_consumption = petrol_consumption def petrol_calculation(self, price = 22.5): return self.petrol_consumption * price ford = Car("ford", 10) money = ford.petrol_calculation() print(money)
# Mouse Move # # November 12, 2018 # By Robin Nash [c,r] = [int(i) for i in input().split(" ") if i != " "] x,y = 0,0 while True: pair = [int(i) for i in input().split(" ") if i != " "] if pair == [0,0]: break x += pair[0] y += pair[1] pair = [x,y] for i in range(2): ...
class Solution: def thirdMax(self, nums: List[int]) -> int: hq = [] for x in nums: if x not in hq: if len(hq) < 3: heapq.heappush(hq, x) else: heapq.heappushpop(hq, x) if len(hq) < 3: return hq[-1...
s = input() k = int(input()) ans = set() for i in range(len(s)): for j in range(1, k+1): ans.add(s[i:i+j]) # print(ans) print(sorted(list(ans))[k-1])
# coding: utf-8 """ Given a string, return a new string where the first and last chars have been exchanged. front_back('code') → 'eodc' front_back('a') → 'a' front_back('ab') → 'ba' """ def front_back(str): if len(str) <= 1: return str elif len(str) == 2: return str[-1] + str[0] new_str =...
""" File: copyfile.py Project 7.3 Copies the text from a given input file to a given output file. """ # Take the inputs inName = input("Enter the input file name: ") outName = input("Enter the output file name: ") # Open the input file and read the text inputFile = open(inName, 'r') text = inputFile.read() # Open t...
# -*- coding: utf-8 -*- def test_task_run(): print("test task run module") assert 1 == 1
# A program to calculate frequency of array elements class ArrayBasic: def __init__(self, arr, n): self.arr = arr self.n = n def calculate_frequency_hash_map(self): """ [A program to calculate counting frequency of array elements] Time complexity: O(n) Auxiliary...
n=int(input("Enter the Decimal Number:")) def covbin(n): if(n==0): return 0 else: return (n%2)+(10*covbin(n//2)) print("Binary is=",covbin(n))
""" ssml:sheetViews = ssml:CT_SheetViews Sequence [1..1] ssml:sheetView [1..*] Worksheet View ssml:extLst [0..1] Future Feature Storage Area ssml:sheetView = ssml:CT_SheetView Sequence [1..1] ssml:pane [0..1] View Pane ssml:selection [0..4] Selection ssml:pivotSelection [0..4] PivotT...
__all__ = ['descriptor', 'es_transport', 'flushing_buffer', 'line_buffer', 'sqs_transport', 'transport_exceptions', 'transport_result', 'transport_utils']
# GPLv3 License # # Copyright (C) 2020 Ubisoft # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # This program is dis...
def total_centro_custo(D_e): D_return = {} # Pecorre dados de cada pessoa for v in D_e.values(): if v['centro de custo'] not in D_return: D_return[v['centro de custo']] = 0 D_return[v['centro de custo']] += v['valor'] return D_return
""" jupylet/lru.py Copyright (c) 2020, Nir Aides - nir@winpdb.org Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this ...
"""MicroESP Errors """ __author__ = 'Oleksandr Shepetko' __email__ = 'a@shepetko.com' __license__ = 'MIT' class ESP8266Error(Exception): pass class DeviceNotConnectedError(ESP8266Error): pass class DeviceCodeExecutionError(ESP8266Error): pass
soma = 1 #divisores = 0 num = int(input("Informe um numero")) for c in range(1, num): if num % c == 0: soma = soma + 1 if soma != 2 : print("\033[31mo numero {} não é primo ".format(num)) print("O numero {} é divisivel por {} numeros".format(num, soma)) else: print("\033[32mo numero {} é prim...
def print_n(s, n): while n >= 0: print(s) n -= 1
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). # You may not use this file except in compliance with the License. # A copy of the License is located at # # http://www.apache.org/licenses/LICENSE-2.0 # # or in the "licens...
class CommandModule: def __init__(self, name, bus, conn, chan, conf): self.name = name self.conf = conf self.chan = chan self.conn = conn self.bus = bus def send(self, msg): self.conn.privmsg(self.chan, msg)...
text = input('Enter a text: ') character = input('Enter a character that you can search in "'+text+'": ') result = text.count(character) print('The character "'+character+'" appears '+str(result)+' times in "'+text+'".')
# # @lc app=leetcode.cn id=55 lang=python3 # # [55] 跳跃游戏 # # https://leetcode-cn.com/problems/jump-game/description/ # # algorithms # Medium (33.65%) # Total Accepted: 12.2K # Total Submissions: 36K # Testcase Example: '[2,3,1,1,4]' # # 给定一个非负整数数组,你最初位于数组的第一个位置。 # # 数组中的每个元素代表你在该位置可以跳跃的最大长度。 # # 判断你是否能够到达最后一个位置。 ...
class BME280: '''Class to mock temp sensor''' def __init__(self): '''Constructor for mock''' def get_temperature(self): '''Temp''' return 20.0
def test_movie_tech_sections(ia): movie = ia.get_movie('0133093', info=['technical']) tech = movie.get('tech', []) assert set(tech.keys()) == set(['sound mix', 'color', 'aspect ratio', 'camera', 'laboratory', 'cinematographic process', 'printed film format', ...
#!/usr/bin/env python3 #Swimming in the pool excercise def getValue(): try: valueInput = int(input()) except ValueError: print("Wrong type") quit() else: return valueInput def calcResidue(length, coordinate): halfOfLength = length / 2 residue = length - coordinate if residue < halfOfLength: return res...
class Robot: def greet(self): print('Hello Viraj') class RobotChild(Robot): def greet(self): print('Hello Scott') # Instantiate RobotChild Class child = RobotChild() # Invoke Greet method from RobotChild class child.greet()
#!/usr/bin/env python3 def welcome(): print("Welcome") def hi(name): print("Hi " + name + "!") welcome() username = input("Who are there? ") hi(name=username) hi(username)
class Solution(object): def reverseBits(self, n): """ :type n: int :rtype: int """ for i in xrange(16): a = (n >> i) & 1 b = (n >> (31-i)) & 1 if a: n |= 1 << (31-i) else: n &= ~(1 << (31-i)) ...
# -*- coding: utf-8 -*- # words consist of 2 or more alphanumeric characters where there first is not # numeric and not an underscore alphanumeric is defined in the unicode sense. # here is a list of the unicode characters with codepoints 300 and below that # match this pattern: # ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk...
# preorder: root -> left -> right # inorder: left -> root -> right # we can first pick up root from preorder, then get the left and right subtrees from inorder # Recursion # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val...
# Travel club # A group of people are member of a travel club. # The group shares expenses equally but it is not practical to share every expense as they happen, so all expenses are collated (such as taxis, train tickets etc) after the trip # The member cost is shared to within 1% between the group. # Create a prog...
classes_names = [ 'book', 'bottle', 'cabinet', 'ceiling', 'chair', 'cone', 'counter', 'dishwasher', 'faucet', 'fire extinguisher', 'floor', 'garbage bin', 'microwave', 'paper towel dispenser', 'paper', 'pot', 'refridgerator', 'stove burner', 'table', 'unknown', 'wall', 'bowl', 'magnet', 'sink', 'air vent', 'box', 'door...
# -*- coding: utf-8 -*- class CoinPair: """ 币对处理类 """ @classmethod def coin_pair_with(cls, cp_str, sep='/'): comps = cp_str.split(sep) if len(comps) < 2: return None return CoinPair(comps[0], comps[1]) def __init__(self, trade_coin='', base_coin='', custom_min_cos...
''' Return the nth Fibonacci number F0 = 0 F1 = 1 Fn = Fn-1 + Fn-2 ''' def Fibonacci(n): ''' return nth fibonacci number to reduce O(n), we invoke recursion only once during one call (Fn-1, Fn-2) ''' if n <= 1: return (n,0) else: (a,b) = Fibonacci(n-1) return (a+b,a) #p...
thisdict = { "brand":"Ford", "model":"Mustang", "year":1964 } for x in thisdict.values(): print(x)
# Little Vasya has received a young builder’s kit. The kit consists of several wooden bars, the lengths # of all of them are known. The bars can be put one on the top of the other if their lengths are the same. # Vasya wants to construct the minimal number of towers from the bars. Help Vasya to use the bars in the # be...
name = "ada lovelace" print(name.title()) print(name.upper()) print(name.lower())
#!/usr/bin/env python """ Class definition to store attributes of micro architectural events This module provides definitions for the following events 1. generic core - events programmable in general purpose pmu registers 2. fixed core - events colleted by fixed pmu registers 3. offcore - counters for off...
""" Functions for working with, checking and converting numbers. All numbers are stored within the computer as the positive equivalent. They may be interpreted as negative. """ def number_to_bitstring(number, bit_width=8): """ Convert a number to an equivalent bitstring of the given width. Raises: ...
def has_style(tag): return tag.has_attr('style') def has_class(tag): return tag.has_attr('class') def clean(soup): if soup.name == 'br' or soup.name == 'img' or soup.name == 'p' or soup.name == 'div': return try: ll = 0 for j in soup.strings: ll += len(j.replace('\n', '')) if ll == 0: soup.decompose...
# # PySNMP MIB module HIRSCHMANN-PIM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HIRSCHMANN-PIM-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:31:12 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
""" [Question.py] @description: a set of functions which helps with asking console questions. """ def ask(question): print(question) answer = input("Response: ") return answer def ask_bool_positive_safe(question): answer = input(question + " ") return (answer.lower() == "true") or \ (...
# 1. Write a function called int_return that takes an integer as input and returns the same integer. user_input = input("Enter a number") def int_return(val): return int(val) int_return(user_input) # 2. Write a function called add that takes any number as its input and returns that sum with 2 added. user_input ...
load( "@d2l_rules_csharp//csharp:defs.bzl", "csharp_register_toolchains", "csharp_repositories", "import_nuget_package", ) def selenium_register_dotnet(): csharp_register_toolchains() csharp_repositories() native.register_toolchains("//third_party/dotnet/ilmerge:all") import_nuget_pac...
wifi_ssid = "" wifi_password = "" mqtt_username = "" mqtt_password = "" mqtt_address = "" mqtt_port = 8883
# NOTE: \a is the delimiter for chat pages # Quest ids can be found in Quests.py SCRIPT = ''' ID reward_100 SHOW laffMeter LERP_POS laffMeter 0 0 0 1 LERP_SCALE laffMeter 0.2 0.2 0.2 1 WAIT 1.5 ADD_LAFFMETER 1 WAIT 1 LERP_POS laffMeter -1.18 0 -0.87 1 LERP_SCALE laffMeter 0.075 0.075 0.075 1 WAIT 1 FINISH_QUEST_MOVIE ...
# https://leetcode.com/submissions/detail/109225225/ # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def reverseList(self, head): """ :type head: ListNode :rtype: ListNode ...
class Word(): """docstring for Word""" def __init__(self, text: str, start_time: float, end_time: float): assert isinstance(text, str), "text should be string." assert isinstance(start_time, float) and isinstance(end_time, float), "Start time and end time should be float values." self.text = text ...
while True: valores = input().split() n = int(valores[0]) d = a = int(valores[1]) e = b = int(valores[2]) if n == 0 and a == 0 and b == 0: break while e != 0: d, e = e, d % e c = (a * b) // d a_l = len(range(a, n + 1, a)) b_l = len(range(b, n + 1, b)) c_...
def convert_to_string(idx_list, form_manager): w_list = [] for i in range(len(idx_list)): w_list.append(form_manager.get_idx_symbol(int(idx_list[i]))) return " ".join(w_list) def is_all_same(c1, c2, form_manager): all_same = False if len(c1) == len(c2): all_same = True for ...
def test_geoadd(judge_command): judge_command( 'GEOADD Sicily 13.361389 38.115556 "Palermo" 15.087269 37.502669 "Catania"', { "command": "GEOADD", "key": "Sicily", "longitude": "15.087269", "latitude": "37.502669", "member": '"Catania"', ...
""" Common utilities/lib for use by multiple services """ subscription_types = ['policy_eval', 'tag_update', 'vuln_update', 'repo_update', 'analysis_update'] resource_types = ['registries', 'users', 'images', 'policies', 'evaluations', 'subscriptions', 'archive'] bucket_types = ["analysis_data", "policy_bundles", "pol...
""" Dexter Legaspi Class: CS 521 - Summer 2 Date: 08/03/2021 Homework Problem # 5.6.3 Description of Problem: A program that highlights the use of proper exception handling. """ EXPECTED_INPUTS = 4 # validate input and the result loop while True: user_input = input('Please enter {} numbers delimited by space: ' ...
# Copyright 2019 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'recipe_engine/cipd', 'recipe_engine/commit_position', 'recipe_engine/context', 'recipe_engine/file'...
class Cup(object): def __init__(self, name): self.name = name self.price = 0 class MyClass: pass def myfunc(): pass if __name__ == '__main__': cup1 = Cup('aaa') cup2 = Cup('bbb') # get attribute of object print(getattr(cup1, 'name')) print(getattr(cup2, 'name')) ...
# set, himpunan: super_hero = {'superman','ironman','hulk','flash'} print(super_hero) print('1=====================') super_hero.add('gundala') super_hero.add('121') print(super_hero) print('2=====================') super_hero.add('hulk') print(super_hero) print(sorted(super_hero)) print('3========...
# Python carefully avoids evaluating bools more than once in a variety of situations. # Eg: # In the statement # if a or b: # it doesn't simply compute (a or b) and then evaluate the result to decide whether to # jump. If a is true it jumps directly to the body of the if statement. # We can confirm that this behaviour...
def firstZero(arr, low, high): if (high >= low): # Check if mid element is first 0 mid = low + int((high - low) / 2) if (( mid == 0 or arr[mid-1] == 1) and arr[mid] == 0): return mid # If mid element is not 0 if (...
#Faça um algoritmo que leia o salário de um funcionário e mostre seu novo salário, com 15% de aumento. sal = float(input('Digite o valor do seu Salário: R$')) aum = sal * 0.15 print('Seu salario teve aumento de 15% equivalentes a R${:.2f}. Portanto seu salário atual é R${:.2f}'.format(aum, sal + aum))
# coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # Licensed under the Apache License, Version 2.0 (the "License") # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http: // www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
SYMBOL_JSON = { "rb":{"sylbom":"RB0","name":"螺纹钢","contractSize":"10","exchangeName":"上期所","exchangeCode":"SHFE"}, "ag":{"sylbom":"AG0","name":"白银","contractSize":"15","exchangeName":"上期所","exchangeCode":"SHFE"}, "au":{"sylbom":"AU0","name":"黄金","contractSize":"1000","exchangeName":"上期所","exchangeCode":"SHF...
"""Package pyang.transforms: transform plugins for YANG. Modules: * edit: YANG edit transform plugin """
# augmented vertex class Vertex: def __init__(self, element, location): self.element = element self.location = location def getElement(self): return self.element def setElement(self, element): self.element = element def getLocation(self): return self.location ...
def get_node_info(file): nodes = set() df = [line.strip().split() for line in open('input/%s.txt' % file).readlines() if line.startswith('/dev')] for nodeinfo in df: # Filesystem Size Used Avail Use% # /dev/grid/node-x0-y0 92T 68T ...
""" 04 - Escreva um programa que declare um inteiro, inicialize-o com 0, e incremente de 1000 em 1000, imprimindo o seu valor na tela, até que seu valor seja 100000(cem mil). """ numero = 0 while numero <= 100000: print(numero, end=' ') numero += 1000
class Problem: initial_state = [None, None, None, None, None, None, None, None] row = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] col = [0,1,2,3,4,5,6,7] def check_if_attacked(self, state): # returns True if attacked try: index = state.index(None) - 1 except ValueEr...
#soma dos pares #mostre a soma apenas daqueles que forem pares.Se o valor digitado for impar,desconsidere-o. soma = 0 cont = 0 for c in range(1, 7): num = int(input('Digite o {} valor: '.format(c))) if num % 2 == 0: soma += num cont += 1 print('Você informou {} números e a soma foi {}'.format(co...
# Easy # https://leetcode.com/problems/climbing-stairs/ class Solution: # Time complexity : O(n) # Space complexity: O(1) # Fibonacci sequence def climbStairs(self, n: int) -> int: a, b = 1, 2 for _ in range(1, n): a, b = b, a + b return a
""" Author: Clinton Wang, E-mail: `clintonjwang@gmail.com`, Github: `https://github.com/clintonjwang/lipiodol` """ class Config: def __init__(self): self.proj_dims = [64,64,32] self.world_dims = [32,64,64] #self.aug_factor = 100 self.npy_dir = r"D:\CBCT\Train\NPYs" self.nii_dir = r"D:\CBCT\Train\NIFTIs" ...
file = {'amy':5, 'bob':8, 'candy':6, 'doby':9, 'john':0} print("Amy's number is:" +'\n\t' + str(file['amy']) +'.') print("\nBob's number is:" +'\n\t' + str(file['bob']) +'.')
print('trace | Start.') # 配列アクセスは遅い気がするので、match構文で書こうぜ☆(^~^) enums = ['Sq11', 'Sq12', 'Sq13', 'Sq14', 'Sq15', 'Sq16', 'Sq17', 'Sq18', 'Sq19', 'Sq21', 'Sq22', 'Sq23', 'Sq24', 'Sq25', 'Sq26', 'Sq27', 'Sq28', 'Sq29', 'Sq31', 'Sq32', 'Sq33', 'Sq34', 'Sq35', 'Sq36', 'Sq37', 'Sq38', 'Sq39', 'Sq41', 'Sq42', 'Sq43', 'Sq44',...
class Solution: def myAtoi(self, str): if len(str) == 0: return 0 res = 0 max_int = 2147483647 min_int = -2147483648 for i in range(0, len(str)): c = str[i] if c != ' ': break s = str[i:] pos = False ...
class Config: def __init__(self): self.basename = 'delta_video' self.directory = '/home/eleanor/Documents/gcamp_analysis_files_temp/171019-06-bottom-experiment/data' self.topics = ['/multi_tracker/1/delta_video',] self.record_length_hours = 1
## -*- coding: utf-8 -*- ## ## Sage Doctest File ## #**************************************# #* Generated from PreTeXt source *# #* on 2017-08-24T11:43:34-07:00 *# #* *# #* http://mathbook.pugetsound.edu *# #* ...
class Memory: def __init__(self, size): self.mem = bytearray(size) self.bin_size = 0 def read8(self, addr): val = self.mem[addr] #if addr > self.bin_size: # print(f'Read {val:02x} at {addr}') return val def write8(self, addr, val): self.mem[addr]...
__author__ = 'Jeffrey Seifried' __description__ = 'A library for forecasting sun positions' __email__ = 'jeffrey.seifried@gmail.com' __program__ = 'analemma' __url__ = 'http://github.com/jeffseif/{}'.format(__program__) __version__ = '1.0.0' __year__ = '2020'
""" MIT License Copyright (c) 2021 FelipeSavazi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, ...
''' Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by strings. You need to help them find out their common interest with the least list index sum. If there is a choice tie between answers, output all of them with no order requirement. You co...
# -*- coding: utf-8 -*- """ Procurement A module to handle Procurement Currently handles Suppliers Planned Procurements Purchase Orders (POs) @ToDo: Extend to Purchase Requests (PRs) """ if not settings.has_module(c): raise HTTP(404, body="Module disabled: %s" % ...
# flake8: noqa # https://github.com/trezor/python-mnemonic/blob/master/vectors.json trezor_vectors = { "english": [ { "id": 0, "entropy": "00000000000000000000000000000000", "mnemonic": "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about", "salt"...
# -*- coding: utf-8 -*- # Copyright 2011 Fanficdownloader team # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
class Mapper(object): """ A base clap from which to ineherit in order to create a keyboard mapper. """ def __init__(self): self.base_map = None self.alt_map = None self.map = None def create_map(self): self.map = dict(zip(self.base_map, self.alt_map)) def map_key(self, ...
""" A package with everything you need to build a simple neural network """ # todo - add unit tests