content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Board: def __init__(self): self.board = [0] * 9 def __getitem__(self, n): return self.board[n] def __setitem__(self, n, value): self.board[n] = value def __str__(self): return "\n".join([ "".join([[" ", "o", "x"][j] for j in self.board[3*i:3*i+3]]) ...
class Board: def __init__(self): self.board = [0] * 9 def __getitem__(self, n): return self.board[n] def __setitem__(self, n, value): self.board[n] = value def __str__(self): return '\n'.join([''.join([[' ', 'o', 'x'][j] for j in self.board[3 * i:3 * i + 3]]) for i in...
line = input() words = line.split() for word in words: line = line.replace(word, word.capitalize()) print(line)
line = input() words = line.split() for word in words: line = line.replace(word, word.capitalize()) print(line)
"""Leetcode 9. Palindrome Number Easy URL: https://leetcode.com/problems/palindrome-number/ Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: Input: -121 Output: false Explanation: From left to right, i...
"""Leetcode 9. Palindrome Number Easy URL: https://leetcode.com/problems/palindrome-number/ Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: Input: -121 Output: false Explanation: From left to right, i...
expected_output = { 'jid': {1: {'index': {1: {'data': 344, 'dynamic': 0, 'jid': 1, 'process': 'init', 'stack': 136, 'text': 296}}}, 51: {'index': {1: {'data': 1027776, 'd...
expected_output = {'jid': {1: {'index': {1: {'data': 344, 'dynamic': 0, 'jid': 1, 'process': 'init', 'stack': 136, 'text': 296}}}, 51: {'index': {1: {'data': 1027776, 'dynamic': 5668, 'jid': 51, 'process': 'processmgr', 'stack': 136, 'text': 1372}}}, 53: {'index': {1: {'data': 342500, 'dynamic': 7095, 'jid': 53, 'proce...
#!/usr/bin/env python # # Copyright 2014 Tuenti Technologies S.L. # # 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 app...
class Mergestrategy(object): """ Defines an strategy to perform a merge operation, its arguments are the same as the ones of the merge method, plus an instance of repoman.Repository. """ def __init__(self, repository, local_branch=None, other_rev=None, other_branch_name=None): self.repo...
def primefactor(n): for i in range(2,n+1): if n%i==0: isprime=1 for j in range(2,int(i/2+1)): if i%j==0: isprime=0 break if isprime: print(i) n=315 primefactor(n) ...
def primefactor(n): for i in range(2, n + 1): if n % i == 0: isprime = 1 for j in range(2, int(i / 2 + 1)): if i % j == 0: isprime = 0 break if isprime: print(i) n = 315 primefactor(n)
# Copyright (c) 2011 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. { 'includes': [ '../../../build/common.gypi', ], 'variables': { 'common_sources': [ ], }, 'targets' : [ { 'target_name':...
{'includes': ['../../../build/common.gypi'], 'variables': {'common_sources': []}, 'targets': [{'target_name': 'nosys_lib', 'type': 'none', 'variables': {'nlib_target': 'libnosys.a', 'build_glibc': 0, 'build_newlib': 1, 'build_pnacl_newlib': 1}, 'sources': ['access.c', 'chmod.c', 'chown.c', 'endpwent.c', 'environ.c', 'e...
def is_leap(year): if ( year >= 1900 and year <=100000): leap = False if ( (year % 4 == 0) and (year % 400 == 0 or year % 100 != 0) ): leap = True return leap year = int(input()) print(is_leap(year))
def is_leap(year): if year >= 1900 and year <= 100000: leap = False if year % 4 == 0 and (year % 400 == 0 or year % 100 != 0): leap = True return leap year = int(input()) print(is_leap(year))
# Copyright 2014 The Johns Hopkins University Applied Physics Laboratory # # 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 ...
def format_capitalize(fqdn): return ''.join([x.capitalize() for x in fqdn.split('.')]) def format_dash(fqdn): return fqdn.replace('.', '-') class Awsnameaccumulator(object): def __init__(self, initial_value, callback): self.acc = [initial_value] self.cb = callback def __repr__(self):...
# -*- coding: utf-8 -*- def count_days(y, m, d): return (365 * y + (y // 4) - (y // 100) + (y // 400) + ((306 * (m + 1)) // 10) + d - 429) def main(): y = int(input()) m = int(input()) d = int(input()) if m == 1 or m == 2: m += 12 y -= 1 print(count_days(201...
def count_days(y, m, d): return 365 * y + y // 4 - y // 100 + y // 400 + 306 * (m + 1) // 10 + d - 429 def main(): y = int(input()) m = int(input()) d = int(input()) if m == 1 or m == 2: m += 12 y -= 1 print(count_days(2014, 5, 17) - count_days(y, m, d)) if __name__ == '__main__...
class CausalFactor: def __init__(self, id_: int, name: str, description: str): self.id_ = id_ self.name = name self.description = description class VehicleCausalFactor: def __init__(self): self.cf_driver = [] self.cf_fellow_passenger = [] self.cf_vehicle = [] ...
class Causalfactor: def __init__(self, id_: int, name: str, description: str): self.id_ = id_ self.name = name self.description = description class Vehiclecausalfactor: def __init__(self): self.cf_driver = [] self.cf_fellow_passenger = [] self.cf_vehicle = [] ...
class Account: """ Class that generates new instances of account credentials to be stored. """ def __init__(self, acc_nm, acc_uname, acc_pass): self.acc_nm=acc_nm self.acc_uname=acc_uname self.acc_pass=acc_pass
class Account: """ Class that generates new instances of account credentials to be stored. """ def __init__(self, acc_nm, acc_uname, acc_pass): self.acc_nm = acc_nm self.acc_uname = acc_uname self.acc_pass = acc_pass
class Solution: def numJewelsInStones(self, J: str, S: str) -> int: result = 0 for i in set(J): result += S.count(i) return result
class Solution: def num_jewels_in_stones(self, J: str, S: str) -> int: result = 0 for i in set(J): result += S.count(i) return result
int16gid = lambda n: '-'.join(['{:04x}'.format(n >> (i << 4) & 0xFFFF) for i in range(0, 1)[::-1]]) int32gid = lambda n: '-'.join(['{:04x}'.format(n >> (i << 4) & 0xFFFF) for i in range(0, 2)[::-1]]) int48gid = lambda n: '-'.join(['{:04x}'.format(n >> (i << 4) & 0xFFFF) for i in range(0, 3)[::-1]]) int64gid = lambda n:...
int16gid = lambda n: '-'.join(['{:04x}'.format(n >> (i << 4) & 65535) for i in range(0, 1)[::-1]]) int32gid = lambda n: '-'.join(['{:04x}'.format(n >> (i << 4) & 65535) for i in range(0, 2)[::-1]]) int48gid = lambda n: '-'.join(['{:04x}'.format(n >> (i << 4) & 65535) for i in range(0, 3)[::-1]]) int64gid = lambda n: '-...
######################################################## # Copyright (c) 2015-2017 by European Commission. # # All Rights Reserved. # ######################################################## extends("BaseKPI.py") """ Welfare (euro) --------------- Indexed by * scope * delivery ...
extends('BaseKPI.py') '\nWelfare (euro)\n---------------\n\nIndexed by\n\t* scope\n\t* delivery point\n\t* test case\n\t\nThe welfare for a given delivery point is the sum of its consumer surplus, its producer surplus, the border exchange surplus and half of the congestion rent for power transmission lines connected to...
class Indent: def __init__(self, left: int = None, top: int = None, right: int = None, bottom: int = None): self.left = left self.top = top self.right = right self.bottom = bottom
class Indent: def __init__(self, left: int=None, top: int=None, right: int=None, bottom: int=None): self.left = left self.top = top self.right = right self.bottom = bottom
"""Top-level package for Indonesia Name and Address Preprocessing.""" __author__ = """Esha Indra""" __email__ = 'esha.indra@gmail.com' __version__ = '0.2.7'
"""Top-level package for Indonesia Name and Address Preprocessing.""" __author__ = 'Esha Indra' __email__ = 'esha.indra@gmail.com' __version__ = '0.2.7'
drink = input() sugar = input() drinks_count = int(input()) if drink == "Espresso": if sugar == "Without": price = 0.90 elif sugar == "Normal": price = 1 elif sugar == "Extra": price = 1.20 elif drink == "Cappuccino": if sugar == "Without": price = 1 elif sugar == "N...
drink = input() sugar = input() drinks_count = int(input()) if drink == 'Espresso': if sugar == 'Without': price = 0.9 elif sugar == 'Normal': price = 1 elif sugar == 'Extra': price = 1.2 elif drink == 'Cappuccino': if sugar == 'Without': price = 1 elif sugar == 'Norm...
n = int(input()) arr = [int(e) for e in input().split()] ans = 0 for i in arr: if i % 2 == 0: ans += i / 4 else: ans += i * 3 print("{:.1f}".format(ans))
n = int(input()) arr = [int(e) for e in input().split()] ans = 0 for i in arr: if i % 2 == 0: ans += i / 4 else: ans += i * 3 print('{:.1f}'.format(ans))
# Copyright 2019 Nicholas Kroeker # # 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 applicable law or agreed to in writ...
class Error(Exception): """Base error class for all `bz.formo` exceptions.""" class Timeouterror(Error): """Raised when a Formo component experiences a timeout."""
# This exercise should be done in the interpreter # Create a variable and assign it the string value of your first name, # assign your age to another variable (you are free to lie!), print out a message saying how old you are name = "John" age = 21 print("my name is", name, "and I am", age, "years old.") # Use the ...
name = 'John' age = 21 print('my name is', name, 'and I am', age, 'years old.') age += 10 print(name, 'will be', age, 'in 10 years.')
def divide(num1, num2): try: num1 / num2 except Exception as e: print(e) divide(1, 0)
def divide(num1, num2): try: num1 / num2 except Exception as e: print(e) divide(1, 0)
class Automation(object): def __init__(self, productivity, cost,numberOfAutomations, lifeSpan): # self.annualHours = annualHours self.productivity = float(productivity) self.cost = float(cost) self.lifeSpan = float(lifeSpan) self.numberOfAutomations = float(numberOfAutomation...
class Automation(object): def __init__(self, productivity, cost, numberOfAutomations, lifeSpan): self.productivity = float(productivity) self.cost = float(cost) self.lifeSpan = float(lifeSpan) self.numberOfAutomations = float(numberOfAutomations) def production(self): r...
# coding=utf-8 DBcsvName = 'houseinfo_readable_withXY' with open(DBcsvName + '.csv', 'r', encoding='UTF-8') as f: lines = f.readlines() print(lines[0]) with open(DBcsvName + '_correct.csv', 'w', encoding='UTF-8') as fw: fw.write( "houseID" + "," + "title" + "," + "link" + "," + "community" + "," ...
d_bcsv_name = 'houseinfo_readable_withXY' with open(DBcsvName + '.csv', 'r', encoding='UTF-8') as f: lines = f.readlines() print(lines[0]) with open(DBcsvName + '_correct.csv', 'w', encoding='UTF-8') as fw: fw.write('houseID' + ',' + 'title' + ',' + 'link' + ',' + 'community' + ',' + 'years' + ',' + 'houset...
class Node(): def __init__(self, val, left, right): self.val = val self.left = left self.right = right def collect(node, data, depth = 0): if not node: return None if depth not in data: data[depth] = [] data[depth].append(node.val) collect(node.left, data, depth + 1) collect(node.rig...
class Node: def __init__(self, val, left, right): self.val = val self.left = left self.right = right def collect(node, data, depth=0): if not node: return None if depth not in data: data[depth] = [] data[depth].append(node.val) collect(node.left, data, depth...
ques=input('Do you wish to find the Volume of Cube by 2D Method or via Side Method? Please enter either 2D or Side') if ques=='2D': print ('OK.') ba=int(input('Enter the Base Area of the Cube')) Height=int(input('Enter a Height measure')) v=ba*Height print ('Volume of the Cube is', v) elif qu...
ques = input('Do you wish to find the Volume of Cube by 2D Method or via Side Method? Please enter either 2D or Side') if ques == '2D': print('OK.') ba = int(input('Enter the Base Area of the Cube')) height = int(input('Enter a Height measure')) v = ba * Height print('Volume of the Cube is', v) elif...
#!/usr/bin/env python3 class Solution: def fizzBuzz(self, n: int): res = [] for i in range(1, n+1): if i % 15 == 0: res.append('FizzBuzz') elif i % 3 == 0: res.append('Fizz') elif i % 5 == 0: res.append('Buzz') ...
class Solution: def fizz_buzz(self, n: int): res = [] for i in range(1, n + 1): if i % 15 == 0: res.append('FizzBuzz') elif i % 3 == 0: res.append('Fizz') elif i % 5 == 0: res.append('Buzz') else: ...
#!/usr/bin/python3 accesses = {} with open('download.log') as f: for line in f: splitted_line = line.split(',') if len(splitted_line) != 2: continue [file_path, ip_addr] = splitted_line if file_path not in accesses: accesses[file_path] = [] ...
accesses = {} with open('download.log') as f: for line in f: splitted_line = line.split(',') if len(splitted_line) != 2: continue [file_path, ip_addr] = splitted_line if file_path not in accesses: accesses[file_path] = [] if ip_addr not in accesses[fil...
''' This module contains all the configurations needed by the modules in the etl package ''' # import os # from definitions import ROOT_DIR TRANSFORMED_DATA_DB_CONFIG = { 'user': 'root', 'password': 'xxxxxxxxxxxx', 'host': '35.244.x.xxx', 'port': 3306, 'database': 'transformed_data' #...
""" This module contains all the configurations needed by the modules in the etl package """ transformed_data_db_config = {'user': 'root', 'password': 'xxxxxxxxxxxx', 'host': '35.244.x.xxx', 'port': 3306, 'database': 'transformed_data'}
file_name = input('Enter file name: ') fn = open(file_name) count = 0 for line in fn: words = line.strip().split() try: if words[0] == 'From': print(words[1]) count += 1 except IndexError: pass print(f'There were {count} lines in the file with From as the first word')...
file_name = input('Enter file name: ') fn = open(file_name) count = 0 for line in fn: words = line.strip().split() try: if words[0] == 'From': print(words[1]) count += 1 except IndexError: pass print(f'There were {count} lines in the file with From as the first word')
# -*- coding: utf-8 -*- class GeneratorRegister(object): def __init__(self): self.generators = [] def register(self, obj): self.generators.append(obj) def generate(self, command=None): for generator in self.generators: if command is not None and command.verbosity > 1: command.stdout.write('\nGeneratin...
class Generatorregister(object): def __init__(self): self.generators = [] def register(self, obj): self.generators.append(obj) def generate(self, command=None): for generator in self.generators: if command is not None and command.verbosity > 1: command....
class CoOccurrence: def __init__(self, entity: str, score: float, entity_type: str = None): self.entity = entity self.score = score self.entity_type = entity_type def __repr__(self): return f'{self.entity} - {self.entity_type} ({self.score})' def as_dict(self): d = ...
class Cooccurrence: def __init__(self, entity: str, score: float, entity_type: str=None): self.entity = entity self.score = score self.entity_type = entity_type def __repr__(self): return f'{self.entity} - {self.entity_type} ({self.score})' def as_dict(self): d = d...
year = int(input()) if year % 4 == 0 and not (year % 100 == 0): print("Leap") else: if year % 400 == 0: print("Leap") else: print("Ordinary")
year = int(input()) if year % 4 == 0 and (not year % 100 == 0): print('Leap') elif year % 400 == 0: print('Leap') else: print('Ordinary')
class ChatRoom: def __init__(self): self.people = [] def broadcast(self, source, message): for p in self.people: if p.name != source: p.receive(source, message) def join(self, person): join_msg = f'{person.name} joins the chat' self.broadcast('ro...
class Chatroom: def __init__(self): self.people = [] def broadcast(self, source, message): for p in self.people: if p.name != source: p.receive(source, message) def join(self, person): join_msg = f'{person.name} joins the chat' self.broadcast('r...
class LinkedList: def __init__(self): self.head = None def insert(self, value): self.head = Node(value, self.head) def append(self, value): new_node = Node(value) current = self.head if current == None: self.head = new_node elif current...
class Linkedlist: def __init__(self): self.head = None def insert(self, value): self.head = node(value, self.head) def append(self, value): new_node = node(value) current = self.head if current == None: self.head = new_node elif current.next == ...
# # Explore # - The Adventure Interpreter # # Copyright (C) 2006 Joe Peterson # class ItemContainer: def __init__(self): self.items = [] self.item_limit = None def has_no_items(self): return len(self.items) == 0 def has_item(self, item): return item in self...
class Itemcontainer: def __init__(self): self.items = [] self.item_limit = None def has_no_items(self): return len(self.items) == 0 def has_item(self, item): return item in self.items def is_full(self): if self.item_limit == None or len(self.items) < self.item...
#!/usr/bin/python3 a = sum(range(100)) print(a)
a = sum(range(100)) print(a)
WINDOW_TITLE = "ElectriPy" HEIGHT = 750 WIDTH = 750 RESIZABLE = True FPS = 40 DEFAULT_FORCE_VECTOR_SCALE_FACTOR = 22e32 DEFAULT_EF_VECTOR_SCALE_FACTOR = 2e14 DEFAULT_EF_BRIGHTNESS = 105 DEFAULT_SPACE_BETWEEN_EF_VECTORS = 20 MINIMUM_FORCE_VECTOR_NORM = 10 MINIMUM_ELECTRIC_FIELD_VECTOR_NORM = 15 KEYS = { "clear_scre...
window_title = 'ElectriPy' height = 750 width = 750 resizable = True fps = 40 default_force_vector_scale_factor = 2.2e+33 default_ef_vector_scale_factor = 200000000000000.0 default_ef_brightness = 105 default_space_between_ef_vectors = 20 minimum_force_vector_norm = 10 minimum_electric_field_vector_norm = 15 keys = {'c...
# Copyright (c) 2016-2022 Kirill 'Kolyat' Kiselnikov # This file is the part of chainsyn, released under modified MIT license # See the file LICENSE.txt included in this distribution """Module with various processing patterns""" # DNA patterns dna = 'ATCG' dna_to_dna = { 'A': 'T', 'T': 'A', 'C': 'G', ...
"""Module with various processing patterns""" dna = 'ATCG' dna_to_dna = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'} dna_to_rna = {'A': 'U', 'T': 'A', 'C': 'G', 'G': 'C'} rna = 'AUCG' rna_to_dna = {'A': 'T', 'U': 'A', 'C': 'G', 'G': 'C'} rna_to_abc = {'UUU': 'F', 'UUC': 'F', 'UUA': 'L', 'UUG': 'L', 'CUU': 'L', 'CUC': 'L', ...
""" The present module contains functions meant to help handling file paths, which must be provided as pathlib.Path objects. Library Pathlib represents file extensions as lists of suffixes starting with a '.' and it defines a file stem as a file name without the last suffix. In this module, however, a stem is a file n...
""" The present module contains functions meant to help handling file paths, which must be provided as pathlib.Path objects. Library Pathlib represents file extensions as lists of suffixes starting with a '.' and it defines a file stem as a file name without the last suffix. In this module, however, a stem is a file n...
# Multiples of 3 and 5 # Problem 1 # If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. # The sum of these multiples is 23. # Find the sum of all the multiples of 3 or 5 below 1000 def solution(limit): s = 0 for x in range(1, limit): if x % 3 == 0: ...
def solution(limit): s = 0 for x in range(1, limit): if x % 3 == 0: s = s + x elif x % 5 == 0: s = s + x return s def main(): limit = 1000 ans = solution(limit) print(ans) if __name__ == '__main__': main()
""" This question was asked by Zillow. You are given a 2-d matrix where each cell represents number of coins in that cell. Assuming we start at matrix[0][0], and can only move right or down, find the maximum number of coins you can collect by the bottom right corner. For example, in this matrix 0 3 1 1 2 0 0 4 1 5 3...
""" This question was asked by Zillow. You are given a 2-d matrix where each cell represents number of coins in that cell. Assuming we start at matrix[0][0], and can only move right or down, find the maximum number of coins you can collect by the bottom right corner. For example, in this matrix 0 3 1 1 2 0 0 4 1 5 3...
class Index: def set_index(self, index_name): self.index = index_name def mapping(self): return { self.doc_type:{ "properties":self.properties() } } def analysis(self): return { 'filter':{ 'spanish_stop'...
class Index: def set_index(self, index_name): self.index = index_name def mapping(self): return {self.doc_type: {'properties': self.properties()}} def analysis(self): return {'filter': {'spanish_stop': {'type': 'stop', 'stopwords': '_spanish_'}, 'spanish_stemmer': {'type': 'stemme...
""" A dictionary for enumering all stages of sleep """ SLEEP_STAGES = { 'LIGHT': 'LIGHT', 'DEEP': 'DEEP', 'REM': 'REM' } """ A dictionary for setting the mimimum known duration for the sleep stages """ MIN_STAGE_DURATION = { 'LIGHT': 15, 'DEEP': 30, 'REM': 8 } """ Topics we are subscribing/pu...
""" A dictionary for enumering all stages of sleep """ sleep_stages = {'LIGHT': 'LIGHT', 'DEEP': 'DEEP', 'REM': 'REM'} '\nA dictionary for setting the mimimum known duration for the sleep stages\n' min_stage_duration = {'LIGHT': 15, 'DEEP': 30, 'REM': 8} '\nTopics we are subscribing/publishing to\n' topic = {'START_TO_...
''' Encontrar el valor repetido de ''' lista =[1,2,2,3,1,5,6,1] for number in lista: if lista.count(number) > 1: i = lista.index(number) print(i) lista_dos = ["a", "b", "a", "c", "c"] mylist = list(dict.fromkeys(lista_dos)) print(mylist) print("*"*10)
""" Encontrar el valor repetido de """ lista = [1, 2, 2, 3, 1, 5, 6, 1] for number in lista: if lista.count(number) > 1: i = lista.index(number) print(i) lista_dos = ['a', 'b', 'a', 'c', 'c'] mylist = list(dict.fromkeys(lista_dos)) print(mylist) print('*' * 10)
# 969. Pancake Sorting class Solution: def pancakeSort2(self, A): ans, n = [], len(A) B = sorted(range(1, n+1), key=lambda i: -A[i-1]) for i in B: for f in ans: if i <= f: i = f + 1 - i ans.extend([i, n]) n -= 1...
class Solution: def pancake_sort2(self, A): (ans, n) = ([], len(A)) b = sorted(range(1, n + 1), key=lambda i: -A[i - 1]) for i in B: for f in ans: if i <= f: i = f + 1 - i ans.extend([i, n]) n -= 1 return ans ...
## Logging logging_config = { 'console_log_enabled': True, 'console_log_level': 25, # SPECIAL 'console_fmt': '[%(asctime)s] %(message)s', 'console_datefmt': '%y-%m-%d %H:%M:%S', ## 'file_log_enabled': True, 'file_log_level': 15, # VERBOSE 'file_fmt': '%(asctime)s %(levelname)-8s %(nam...
logging_config = {'console_log_enabled': True, 'console_log_level': 25, 'console_fmt': '[%(asctime)s] %(message)s', 'console_datefmt': '%y-%m-%d %H:%M:%S', 'file_log_enabled': True, 'file_log_level': 15, 'file_fmt': '%(asctime)s %(levelname)-8s %(name)s: %(message)s', 'file_datefmt': '%y-%m-%d %H:%M:%S', 'log_dir': 'lo...
# coding:utf-8 ''' @Copyright:LintCode @Author: taoleetju @Problem: http://www.lintcode.com/problem/find-minimum-in-rotated-sorted-array @Language: Python @Datetime: 15-12-14 03:26 ''' class Solution: # @param num: a rotated sorted array # @return: the minimum number in the array def findMin(self, nu...
""" @Copyright:LintCode @Author: taoleetju @Problem: http://www.lintcode.com/problem/find-minimum-in-rotated-sorted-array @Language: Python @Datetime: 15-12-14 03:26 """ class Solution: def find_min(self, num): p1 = 0 p2 = len(num) - 1 pm = p1 while num[p1] >= num[p2]: ...
"""Kata: Fibonacci's FizzBuzz - return a list of the fibonacci sequence with the words 'Fizz', 'Buzz', and 'FizzBuzz' replacing certain integers. #1 Best Practices Solution by damjan. def fibs_fizz_buzz(n): a, b, out = 0, 1, [] for i in range(n): s = "Fizz"*(b % 3 == 0) + "Buzz"*(b % 5 == 0) ...
"""Kata: Fibonacci's FizzBuzz - return a list of the fibonacci sequence with the words 'Fizz', 'Buzz', and 'FizzBuzz' replacing certain integers. #1 Best Practices Solution by damjan. def fibs_fizz_buzz(n): a, b, out = 0, 1, [] for i in range(n): s = "Fizz"*(b % 3 == 0) + "Buzz"*(b % 5 == 0) ...
# These constants are all possible fields in a message. ADDRESS_FAMILY = 'address_family' ADDRESS_FAMILY_IPv4 = 'ipv4' ADDRESS_FAMILY_IPv6 = 'ipv6' CITY = 'city' COUNTRY = 'country' RESPONSE_FORMAT = 'format' FORMAT_HTML = 'html' FORMAT_JSON = 'json' FORMAT_MAP = 'map' FORMAT_REDIRECT = 'redirect' FORMAT_BT = 'bt' VA...
address_family = 'address_family' address_family_i_pv4 = 'ipv4' address_family_i_pv6 = 'ipv6' city = 'city' country = 'country' response_format = 'format' format_html = 'html' format_json = 'json' format_map = 'map' format_redirect = 'redirect' format_bt = 'bt' valid_formats = [FORMAT_HTML, FORMAT_JSON, FORMAT_MAP, FOR...
def f(): x = 5 def g(y): print (x + y) g(1) x = 6 g(1) x = 7 g(1) f()
def f(): x = 5 def g(y): print(x + y) g(1) x = 6 g(1) x = 7 g(1) f()
# Python program to insert, delete and search in binary search tree using linked lists # A Binary Tree Node class Node: # Constructor to create a new node def __init__(self, key): self.key = key self.left = None self.right = None # A utility function to do inorder traversal of BST ...
class Node: def __init__(self, key): self.key = key self.left = None self.right = None def inorder(root): if root is not None: inorder(root.left) print(root.key, end=', ') inorder(root.right) def insert(node, key): if node is None: return node(key) ...
def keyword_argument_example(your_age, **kwargs): return your_age, kwargs ### Write your code below this line ### about_me = "Replace this string with the correct function call." ### Write your code above this line ### print(about_me)
def keyword_argument_example(your_age, **kwargs): return (your_age, kwargs) about_me = 'Replace this string with the correct function call.' print(about_me)
""" Version management system. """ class Version: clsPrev = None #`Version` class that represents the previous version of `self`, or `None` if there is no previous `Version`. def __init__(self): pass def _initialize(self, obj): """ Initializes `obj` to match this version from scratch. `obj` may be modi...
""" Version management system. """ class Version: cls_prev = None def __init__(self): pass def _initialize(self, obj): """ Initializes `obj` to match this version from scratch. `obj` may be modified in place, but regardless will be returned. By default, this will invoke `clsPrev._...
#MAP # def fahrenheit(T): # return (9/5) * T + 32 temp = [9,22,40,90,120] # for t in temp: # print(fahrenheit(t)) # print(list(map(fahrenheit, temp))) # print(list(map(lambda t:(9/5)*t+32,temp))) #FILTER pares = [1,2,3,4,8,10,11,15,16,28,24,20] # print(list(filter(lambda x: x%2 == 0, pares))) #ZIP x = ...
temp = [9, 22, 40, 90, 120] pares = [1, 2, 3, 4, 8, 10, 11, 15, 16, 28, 24, 20] x = [1, 2, 3, 4, 87, 65, 84, 87, 96, 258] y = [4, 5, 6, 256, 245, 635, 85, 96, 256, 485] a = [1, 2, 3, 5, 5, 2] b = [2, 3, 25, 2] c = [2, 4, 2, 5] lista = ['a', 'b', 'c', 'd'] teste = 'How long are the words in this phrase' def word_length...
# # PySNMP MIB module RSVP-MIB (http://pysnmp.sf.net) # ASN.1 source http://mibs.snmplabs.com:80/asn1/RSVP-MIB # Produced by pysmi-0.0.7 at Sun Feb 14 00:27:32 2016 # On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose # Using Python version 3.5.0 (default, Jan 5 2016, 17:11:52) # ( ObjectIden...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, single_value_constraint, constraints_intersection, constraints_union) ...
# Implemente uma nova classe que simule uma pilha usando apenas duas filas. class Node: def __init__(self, data, next=None): self.data = data self.next = next class MyQueue: def __init__(self): self.head = None self.tail = self.head def enqueue(self, value): if (se...
class Node: def __init__(self, data, next=None): self.data = data self.next = next class Myqueue: def __init__(self): self.head = None self.tail = self.head def enqueue(self, value): if self.head: new_node = node(value) self.tail.next = new...
class card(): """docstring for .""" def __init__(self, name, type, cost, coins=0, vp=0): ''' Parameters: name: string type: LIST OF STRINGS cost: int coins: int vp: int Returns: None ''' ...
class Card: """docstring for .""" def __init__(self, name, type, cost, coins=0, vp=0): """ Parameters: name: string type: LIST OF STRINGS cost: int coins: int vp: int Returns: None """ sel...
# 371. Sum of Two Integers # ttungl@gmail.com # Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. class Solution: def getSum(self, a, b): """ :type a: int :type b: int :rtype: int """ # sol 1: # runtime: 40ms ...
class Solution: def get_sum(self, a, b): """ :type a: int :type b: int :rtype: int """ return sum([a, b]) def add(a, b): if not a or not b: return a or b return add(a ^ b, (a & b) << 1) if a * b < 0: ...
''' 199. Binary Tree Right Side View Medium Given the root of a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. Example 1: Input: root = [1,2,3,null,5,null,4] Output: [1,3,4] Example 2: Input: root = [1,null,3] Output: [1,3] E...
""" 199. Binary Tree Right Side View Medium Given the root of a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. Example 1: Input: root = [1,2,3,null,5,null,4] Output: [1,3,4] Example 2: Input: root = [1,null,3] Output: [1,3] E...
class Content(): def __init__(self): self.content_type = "video" self.title = "sample title" self.author = {"url": "", "name": "James"} self.time_estimate = "(15 min)" self.url = "http://mim-rec-engine.heroku.com" self.thumbnail_url = "static/imgs/document.png" ...
class Content: def __init__(self): self.content_type = 'video' self.title = 'sample title' self.author = {'url': '', 'name': 'James'} self.time_estimate = '(15 min)' self.url = 'http://mim-rec-engine.heroku.com' self.thumbnail_url = 'static/imgs/document.png' ...
""" diamond.clauses ~~~~~~~~~~~~~~~ :copyright: (c) 2015 Jaco Ruit :license: MIT, see LICENSE for more details """ class Node(object): def __init__(self, inner = None, condition = None): self.inner = inner self.condition = condition self.children = [] def __and__(...
""" diamond.clauses ~~~~~~~~~~~~~~~ :copyright: (c) 2015 Jaco Ruit :license: MIT, see LICENSE for more details """ class Node(object): def __init__(self, inner=None, condition=None): self.inner = inner self.condition = condition self.children = [] def __and__(self, o...
__author__ = 'hs634' class Solution(): def __init__(self): pass def three_sum_zero(self, arr): arr, solution, i = sorted(arr), [], 0 while i < len(arr) - 2: j, k = i + 1, len(arr) - 1 while j < k: three_sum = arr[i] + arr[j] + arr[k] ...
__author__ = 'hs634' class Solution: def __init__(self): pass def three_sum_zero(self, arr): (arr, solution, i) = (sorted(arr), [], 0) while i < len(arr) - 2: (j, k) = (i + 1, len(arr) - 1) while j < k: three_sum = arr[i] + arr[j] + arr[k] ...
class Solution: def merge(self, A, m, B, n): sm, sn, i = m - 1, n - 1, m + n - 1 while sm >= 0 and sn >= 0: if A[sm] > B[sn]: A[i] = A[sm] sm -= 1 else: A[i] = B[sn] sn -= 1 i -= 1 while sn >...
class Solution: def merge(self, A, m, B, n): (sm, sn, i) = (m - 1, n - 1, m + n - 1) while sm >= 0 and sn >= 0: if A[sm] > B[sn]: A[i] = A[sm] sm -= 1 else: A[i] = B[sn] sn -= 1 i -= 1 while ...
class TasksService: def __init__(self, site): self.__site = site self.__is_loaded = False def load(self): self.__is_loaded = True
class Tasksservice: def __init__(self, site): self.__site = site self.__is_loaded = False def load(self): self.__is_loaded = True
class Recipe(object): def __init__(self): self.ingredients = [] # need to store lots of qty & unit & ingred per recipe. will be ordered triple self.directions = "" # how to make this food self.notes = "" # personal annotations re: this recipe self.recipe_name = "" # what's in a ...
class Recipe(object): def __init__(self): self.ingredients = [] self.directions = '' self.notes = '' self.recipe_name = '' self.synopsis = '' self.uses = 0 self.source = '' self.labels = [] def add_ingredient(self, qty, unit, name): self....
class User: """ Class that generates new instances of users. """ list_of_users = [] def __init__(self, user_name,gender, password): self.user_name = user_name self.gender = gender self.password = password def save_user(self): ''' function that saves Use...
class User: """ Class that generates new instances of users. """ list_of_users = [] def __init__(self, user_name, gender, password): self.user_name = user_name self.gender = gender self.password = password def save_user(self): """ function that saves Use...
class GetTableInteractor(object): def __init__(self, repo): self.repo = repo def set_params(self, user, year, month, before, after): self.user = user self.year = year self.month = month self.before = before self.after = after return self def exec...
class Gettableinteractor(object): def __init__(self, repo): self.repo = repo def set_params(self, user, year, month, before, after): self.user = user self.year = year self.month = month self.before = before self.after = after return self def execute...
# AUTOGENERATED! DO NOT EDIT! File to edit: 13_dataproc.ipynb (unless otherwise specified). __all__ = ['dataproc_test'] # Cell def dataproc_test(test_msg): "Function dataproc" return test_msg
__all__ = ['dataproc_test'] def dataproc_test(test_msg): """Function dataproc""" return test_msg
def parse_config(path): """ This method parses a config file and constructs a list of blocks. Each block is a singular unit in the architecture as explained in the paper. Blocks are represented as a dictionary in the list. Input: - path: path to the config file. Returns: - a list co...
def parse_config(path): """ This method parses a config file and constructs a list of blocks. Each block is a singular unit in the architecture as explained in the paper. Blocks are represented as a dictionary in the list. Input: - path: path to the config file. Returns: - a list co...
todos = [ { 'id': 1, 'title': 'Workout tomorrow', 'body': 'I intend to go through some rigorous exercise targetting my abs and my lower stomach', 'completed': False, 'date': '08/12/2019' }, { 'id': 2, 'title': 'Chefs Quaters', 'body': 'I intend...
todos = [{'id': 1, 'title': 'Workout tomorrow', 'body': 'I intend to go through some rigorous exercise targetting my abs and my lower stomach', 'completed': False, 'date': '08/12/2019'}, {'id': 2, 'title': 'Chefs Quaters', 'body': 'I intend to cook Rice with vegetables and also garnish it with some fried chicken', 'com...
class Solution: def combine(self, n: int, k: int) -> List[List[int]]: ans = [] def dfs(n: int, k: int, s: int, path: List[int]) -> None: if k == 0: ans.append(path.copy()) return for i in range(s, n + 1): path.append(i) dfs(n, k - 1, i + 1, path) path.pop(...
class Solution: def combine(self, n: int, k: int) -> List[List[int]]: ans = [] def dfs(n: int, k: int, s: int, path: List[int]) -> None: if k == 0: ans.append(path.copy()) return for i in range(s, n + 1): path.append(i) ...
# ----------- # User Instructions: # # Modify the the search function so that it returns # a shortest path as follows: # # [['>', 'v', ' ', ' ', ' ', ' '], # [' ', '>', '>', '>', '>', 'v'], # [' ', ' ', ' ', ' ', ' ', 'v'], # [' ', ' ', ' ', ' ', ' ', 'v'], # [' ', ' ', ' ', ' ', ' ', '*']] # # Where '>', '<', '^',...
grid = [[0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0], [0, 0, 1, 0, 1, 0], [0, 0, 1, 0, 1, 0]] init = [0, 0] goal = [len(grid) - 1, len(grid[0]) - 1] cost = 1 delta = [[-1, 0], [0, -1], [1, 0], [0, 1]] delta_name = ['^', '<', 'v', '>'] def search(grid, init, goal, cost): closed = [[-1 for row in range...
class PID: """ Discrete PID control """ def __init__(self, P=2.0, I=0.0, D=1.0, Derivator=0, Integrator=0, Integrator_windup_max=100, Integrator_windup_min=-100): self.Kp=P self.Ki=I self.Kd=D self.Derivator=Derivator self.Integrator=Integrator self.Integrator_max=Integrator_windup_max self.Integrat...
class Pid: """ Discrete PID control """ def __init__(self, P=2.0, I=0.0, D=1.0, Derivator=0, Integrator=0, Integrator_windup_max=100, Integrator_windup_min=-100): self.Kp = P self.Ki = I self.Kd = D self.Derivator = Derivator self.Integrator = Integrator self.I...
def add_numbers(start,end): c = 0 for number in range(start,end+1): print(number) c = c + number return(c) answer = add_numbers(333,777) #print(answer) #print(add_numbers()) #add_numbers()
def add_numbers(start, end): c = 0 for number in range(start, end + 1): print(number) c = c + number return c answer = add_numbers(333, 777)
# CELERY CELERY_BROKER_URL = 'redis://10.16.78.86:6380' CELERY_RESULT_BACKEND = 'redis://10.16.78.86:6380' # NGINX STATIC HOME DOC_HOME = '/opt/data' # Flask-Log Settings LOG_LEVEL = 'debug' LOG_FILENAME = "/var/archives/error.log" LOG_ENABLE_CONSOLE = False # REDIS Settings REDIS_HOST = '10.16.78.86'...
celery_broker_url = 'redis://10.16.78.86:6380' celery_result_backend = 'redis://10.16.78.86:6380' doc_home = '/opt/data' log_level = 'debug' log_filename = '/var/archives/error.log' log_enable_console = False redis_host = '10.16.78.86' redis_port = 6383
X = [[12,7,3], [4,5,6], [7,8,9]] Y = [[5,8,1], [6,7,3], [4,5,9]] result = [[0,0,0], [0,0,0], [0,0,0]] print(len(X),len(Y)) # iterate through rows for i in range(0,3): # iterate through columns for j in range(0,3): result[i][j] = X[i][j] + Y[i][j] for r in result: pr...
x = [[12, 7, 3], [4, 5, 6], [7, 8, 9]] y = [[5, 8, 1], [6, 7, 3], [4, 5, 9]] result = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] print(len(X), len(Y)) for i in range(0, 3): for j in range(0, 3): result[i][j] = X[i][j] + Y[i][j] for r in result: print(r)
#!/bin/python3 annee_naissance = input('t ne ou ') annee = 2025 - int(annee_naissance) print(annee) print(f'voila : {str(annee)} pewepw')
annee_naissance = input('t ne ou ') annee = 2025 - int(annee_naissance) print(annee) print(f'voila : {str(annee)} pewepw')
# Python program to demonstrate in-built poly- # morphic functions # len() being used for a string print(len("geeks")) # len() being used for a list print(len([10, 20, 30]))
print(len('geeks')) print(len([10, 20, 30]))
""" PayloadGroup type/prototype containing multiple Payload objects """ class PayloadGroup(object): """ PayloadGroup Class: groups of individual Payload objects. """ def __init__(self, payloads, check_type_list=[]): """ Initialize a PayloadGroup This interface is kept similar to the interface...
""" PayloadGroup type/prototype containing multiple Payload objects """ class Payloadgroup(object): """ PayloadGroup Class: groups of individual Payload objects. """ def __init__(self, payloads, check_type_list=[]): """ Initialize a PayloadGroup This interface is kept similar to the interface ...
class Solution: def isOneBitCharacter(self, bits): if len(bits) == 1: return True idx = 0 while True: if idx == len(bits) - 3 or idx == len(bits) - 2: break if bits[idx] == 1: idx += 2 else: idx +...
class Solution: def is_one_bit_character(self, bits): if len(bits) == 1: return True idx = 0 while True: if idx == len(bits) - 3 or idx == len(bits) - 2: break if bits[idx] == 1: idx += 2 else: i...
# S E # array = [8, 5, 2, 8, 5, 6, 3] # P L R # if s >= e : r # assigning p, l, r -variables # while r >= e # if l >= p & r <= p # swap # l <= p - l+ # r >= p - r- # leftsubarrayissmaller = r - 1 - s < e - (r + 1) # (p , s, r - 1) # (p, r + 1, e) # Worst : time - O(n^2),Space- O(log(n)) # in inp...
def quick_sort(array): quick_sort_helper(array, 0, len(array) - 1) return array def quick_sort_helper(array, startIdx, endIdx): if startIdx >= endIdx: return pivot_idx = startIdx left_idx = startIdx + 1 right_idx = endIdx while rightIdx >= leftIdx: if array[leftIdx] > array[...
def palindrome(n): a0=n s=0 while a0>0: d=a0%10 s=s*10+d a0=a0//10 if s==n: return 1 else: return 0 n=int(input("Enter a number ")) if palindrome(n)==1: print("palindrome ...") else: print("Not palindrome..")
def palindrome(n): a0 = n s = 0 while a0 > 0: d = a0 % 10 s = s * 10 + d a0 = a0 // 10 if s == n: return 1 else: return 0 n = int(input('Enter a number ')) if palindrome(n) == 1: print('palindrome ...') else: print('Not palindrome..')
class Bicycle: def __init__(self, name, wheel_numbers, brake_type, gear_number): self.name = name self.wheel_numbers = wheel_numbers self.brake_type = brake_type self.gear_number = gear_number bicycle = Bicycle('single speed', '2', 'rim brake', 'free wheel') print(bicycle.n...
class Bicycle: def __init__(self, name, wheel_numbers, brake_type, gear_number): self.name = name self.wheel_numbers = wheel_numbers self.brake_type = brake_type self.gear_number = gear_number bicycle = bicycle('single speed', '2', 'rim brake', 'free wheel') print(bicycle.name) prin...
CELERY_IMPORTS=("app", ) CELERY_BROKER_URL="amqp://saket:fedora13@localhost//" CELERY_RESULT_BACKEND="amqp://saket:fedora13@localhost//" SQLALCHEMY_DATABASE_URI="mysql://saket:fedora13@localhost/moca" CELERYD_MAX_TASKS_PER_CHILD=10
celery_imports = ('app',) celery_broker_url = 'amqp://saket:fedora13@localhost//' celery_result_backend = 'amqp://saket:fedora13@localhost//' sqlalchemy_database_uri = 'mysql://saket:fedora13@localhost/moca' celeryd_max_tasks_per_child = 10
""" File: largest_digit.py Name: Johsuan ---------------------------------- This file recursively prints the biggest digit in 5 different integers, 12345, 281, 6, -111, -9453 If your implementation is correct, you should see 5, 8, 6, 1, 9 on Console. """ def main(): print(find_largest_digit(12345)) # 5 print(f...
""" File: largest_digit.py Name: Johsuan ---------------------------------- This file recursively prints the biggest digit in 5 different integers, 12345, 281, 6, -111, -9453 If your implementation is correct, you should see 5, 8, 6, 1, 9 on Console. """ def main(): print(find_largest_digit(12345)) print(find_...
class Restaurant: def __init__(self): self.restaurant = [] def update_location(self): pass def add(self, restaurant): self.restaurant.append(restaurant)
class Restaurant: def __init__(self): self.restaurant = [] def update_location(self): pass def add(self, restaurant): self.restaurant.append(restaurant)
t = int(input()) for i in range(t): count = 0 n = int(input()) l = list(map(int, input().split())) for j in range(1,len(l)-1): if l[j-1]<l[j] and l[j+1]<l[j]: count += 1 print(f'Case #{i+1}: {count}')
t = int(input()) for i in range(t): count = 0 n = int(input()) l = list(map(int, input().split())) for j in range(1, len(l) - 1): if l[j - 1] < l[j] and l[j + 1] < l[j]: count += 1 print(f'Case #{i + 1}: {count}')
def linear_search(arr, x): for i in range(len(arr)): if arr[i] == x: return i return -1 def binary_search(arr, low, high, x): if high >= 1: mid = (high + low) // 2 if arr[mid] == x: return mid elif arr[mid] > x: return binary_search(arr...
def linear_search(arr, x): for i in range(len(arr)): if arr[i] == x: return i return -1 def binary_search(arr, low, high, x): if high >= 1: mid = (high + low) // 2 if arr[mid] == x: return mid elif arr[mid] > x: return binary_search(arr, l...
emptyForm = """ {"form": [ { "type": "message", "name": "note", "description": "Connect to graphql" }, { "name": "url", "description": "Graphql URL", "type": "string", "required": true } ]} """
empty_form = '\n{"form": [\n {\n "type": "message",\n "name": "note",\n "description": "Connect to graphql"\n },\n {\n "name": "url",\n "description": "Graphql URL",\n "type": "string",\n "required": true\n }\n]}\n'
""" List of image ids for the validation split of the full training set of the MPII Pose dataset. The image file ids have been randomly generated and are set to have a split of 70-30 w.r.t. all available person detections with all pose detections for the custom training and validation splits. """ val_images_ids = [...
""" List of image ids for the validation split of the full training set of the MPII Pose dataset. The image file ids have been randomly generated and are set to have a split of 70-30 w.r.t. all available person detections with all pose detections for the custom training and validation splits. """ val_images_ids = [4, ...
# Used for import directories into other modules. Good for setting # project wide parameters, such as the location of the database. class settings(): db = "C:\\Users\\Andrew\\lab_project\\database\\frontiers_corpus.db" d2v = "C:\\Users\\Andrew\\lab_project\\models\\doc2vecmodels\\" d2v500 = "C:\\Users\\Andrew\...
class Settings: db = 'C:\\Users\\Andrew\\lab_project\\database\\frontiers_corpus.db' d2v = 'C:\\Users\\Andrew\\lab_project\\models\\doc2vecmodels\\' d2v500 = 'C:\\Users\\Andrew\\lab_project\\models\\doc2vecmodels\\500model' d2v300 = 'C:\\Users\\Andrew\\lab_project\\models\\doc2vecmodels\\300model' d...
class OverrideRootError(Exception): def __init__(self): super().__init__(self, "Cannot override Tree root node") class TreeHeightError(Exception): def __init__(self): super().__init__(self, "Cannot add node lower than tree height")
class Overriderooterror(Exception): def __init__(self): super().__init__(self, 'Cannot override Tree root node') class Treeheighterror(Exception): def __init__(self): super().__init__(self, 'Cannot add node lower than tree height')
CROCKFORD_MODIFIED = ( b"ahm6a81a59rqaub3dcn2m832e9qqevh0ctqqg83aenpq0wt0dxv6awh0ehm6a818dhgqmy994" b"1j6ytt1" ) CROCKFORD = ( b"AHM6A81A59RQATB3DCN2M832E9QQEVH0CSQQG83AENPQ0WS0DXV6AWH0EHM6A818DHGQMY994" b"1J6YSS1" ) ZBASE32 = ( b"ktwgkebkfjazk4mdpcinwednqjzzq5tyc3zzoedkqiszyh3yp75gkhtyqtwgkebeptozw...
crockford_modified = b'ahm6a81a59rqaub3dcn2m832e9qqevh0ctqqg83aenpq0wt0dxv6awh0ehm6a818dhgqmy9941j6ytt1' crockford = b'AHM6A81A59RQATB3DCN2M832E9QQEVH0CSQQG83AENPQ0WS0DXV6AWH0EHM6A818DHGQMY9941J6YSS1' zbase32 = b'ktwgkebkfjazk4mdpcinwednqjzzq5tyc3zzoedkqiszyh3yp75gkhtyqtwgkebeptozw6jjrb1g633b' rfc_3548 = b'KRUGKIBKFJYX...
# Script to help automation of converting a cpu/layoutX/CpuConstraintPoly.sol contract to Rust # Parses out "mload(0xDEADBEEF)" (Solidity EVM Assembley Command) from the file and replaces it with the proper Rust equivalent # Note: replace file_name.txt appropriately # file_name.txt should contain Solidity Assembly fro...
f = open('file_name.txt', 'r') text = f.read() parsed_num = '' start_parsing = False i = 5 mload_start_idx = -1 while i < len(text): if text[i] == ')' and startParsing: addr = int(parsedNum, 0) new_text = '' if addr == 0: new_text += 'ctx[map::MM_PERIODIC_COLUMN__PEDERSEN__POINTS...
del_items(0x80137B7C) SetType(0x80137B7C, "void EA_cd_seek(int secnum)") del_items(0x80137BA4) SetType(0x80137BA4, "void MY_CdGetSector(unsigned long *src, unsigned long *dst, int size)") del_items(0x80137BD8) SetType(0x80137BD8, "void init_cdstream(int chunksize, unsigned char *buf, int bufsize)") del_items(0x80137BE8...
del_items(2148760444) set_type(2148760444, 'void EA_cd_seek(int secnum)') del_items(2148760484) set_type(2148760484, 'void MY_CdGetSector(unsigned long *src, unsigned long *dst, int size)') del_items(2148760536) set_type(2148760536, 'void init_cdstream(int chunksize, unsigned char *buf, int bufsize)') del_items(2148760...
MONOBANK_API_TOKEN = None MONOBANK_API_BASE_URL = 'https://api.monobank.ua' MONOBANK_API_CURRENCY_ENDPOINT = MONOBANK_API_BASE_URL + '/bank/currency' MONOBANK_API_CLIENT_INFO_ENDPOINT = MONOBANK_API_BASE_URL + '/personal/client-info' MONOBANK_API_WEBHOOK_ENDPOINT = MONOBANK_API_BASE_URL + '/personal/webhook' MONOBANK_...
monobank_api_token = None monobank_api_base_url = 'https://api.monobank.ua' monobank_api_currency_endpoint = MONOBANK_API_BASE_URL + '/bank/currency' monobank_api_client_info_endpoint = MONOBANK_API_BASE_URL + '/personal/client-info' monobank_api_webhook_endpoint = MONOBANK_API_BASE_URL + '/personal/webhook' monobank_a...
arquivo = open('numeros.txt', 'w') for linha in range(1, 101): arquivo.write('%d\n' % linha) arquivo.close()
arquivo = open('numeros.txt', 'w') for linha in range(1, 101): arquivo.write('%d\n' % linha) arquivo.close()
""" Copyright 2017 Timothy Laskoski tree.py handles all code related to the parse tree """ def tree_append(parent, sub): "tree_append appends a sub tree to the parent tree" parent["Sub"].append(sub) # print("TREE APPEND", parent) def add_subtree(parent, token): "add_subtree adds a subtree with a toke...
""" Copyright 2017 Timothy Laskoski tree.py handles all code related to the parse tree """ def tree_append(parent, sub): """tree_append appends a sub tree to the parent tree""" parent['Sub'].append(sub) def add_subtree(parent, token): """add_subtree adds a subtree with a token to the parent""" new_su...
def getMessage(content): firstCarrot = content.index('<') secondCarrot = content.index('>') return content[firstCarrot+3:secondCarrot] y = getMessage('GG <@!799778925936246804>, you just advanced to level 5') print(y)
def get_message(content): first_carrot = content.index('<') second_carrot = content.index('>') return content[firstCarrot + 3:secondCarrot] y = get_message('GG <@!799778925936246804>, you just advanced to level 5') print(y)