content
stringlengths
7
1.05M
# -*- coding: utf-8 -*- """ File Name: translateNum Author : jing Date: 2020/4/26 把数字翻译成字符串,求不同的翻译个数 """ class Solution: def translateNum(self, num: int) -> int: if num is None or num < 0: return 0 if 0 <= num <= 9: return 1 mod = nu...
#programa que leia nome e preço de produtos; usuario decide quando parar # mostrar: - total da compra; quantos produtos >1000,00 ; nome do produto mais barato totalcompra = topcaros = baratinho = compra = 0 nbaratinho = "" print("~><~ "*5) print("LOJA PRA PESSOA COMPRAR COISAS VARIADAS") print("~><~ "*5) print("S...
""" read by line """ def get_path(): raise NotImplementedError def get_absolute_path(): raise NotImplementedError def get_canonical_path(): raise NotImplementedError def get_cwd_path(): raise NotImplementedError def is_absolute_path(): raise NotImplementedError
class Player: def __init__(self, player_name, examined_step_list): self.user_name = player_name self.player_score = {} self.step_list = examined_step_list self.generate_score_dict() def generate_score_dict(self): for key in self.step_list: self.player_score[k...
class InwardMeta(type): @classmethod def __prepare__(meta, name, bases, **kwargs): cls = super().__new__(meta, name, bases, {}) return {"__newclass__": cls} def __new__(meta, name, bases, namespace): cls = namespace["__newclass__"] del namespace["__newclass__"] for na...
class InvalidateEventArgs(EventArgs): """ Provides data for the System.Windows.Forms.Control.Invalidated event. InvalidateEventArgs(invalidRect: Rectangle) """ def Instance(self): """ This function has been arbitrarily put into the stubs""" return InvalidateEventArgs() @staticmethod def __new...
nome=input('Qual o seu nome?') print('Seja Bem-Vindo,',nome)
# 337. House Robber III # Leetcode solution(approach 1) # 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 rob(self, root: TreeNode) -> int: def h...
def main(): puzzleInput = open("python/day01.txt", "r").read() # Part 1 assert(part1("") == 0) print(part1(puzzleInput)) # Part 2 assert(part2("") == 0) print(part2(puzzleInput)) def part1(puzzleInput): return 0 def part2(puzzleInput): return 0 if __name__ == "__main__": ...
# coding=utf-8 # Author: Jianghan LI # Question: 230.Kth_Smallest_Element_in_a_BST # Complexity: O(N) # Date: 2017-10-03 # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): ...
def subst(text): s = { 'т' : 't', '$' : 's', '@' : 'a', '!' : 'i', 'Я' : 'r', '1' : 'l', 'ш' : 'w', '0' : 'o', 'п' : 'n'} return "".join([t if not(t in s) else s[t] for t in text ]) print(subst("тhe$e @Яe que$т!0п$ f0Я @cт!0п, п0т $pecu1@т!0п, шh!ch !$ !d1e."))
#!/usr/bin/env python # -*- coding: utf-8 -*- """ __title__ = '' __author__ = 'HaiFeng' __mtime__ = '2016/8/16' """ class Bar(object): '''K线数据''' def __init__(self, datetime, h, l, o, c, v, i): self.D = datetime self.H = h self.L = l self.O = o self.C = c self.V = v self.I = i self.__preVolume = 0 ...
def sentencemaker(pharase): cap = pharase.capitalize() interogatives = ("how" , "what" , "why") if pharase.startswith(interogatives): return "{}?".format(cap) else: return "{}".format(cap) results = [] while True: user_input = input("Say Something :-) ") if user_inp...
""" https://github.com/alexhagiopol/cracking-the-coding-interview http://jelices.blogspot.com/ https://www.youtube.com/watch?v=bum_19loj9A&list=PLBZBJbE_rGRV8D7XZ08LK6z-4zPoWzu5H https://www.youtube.com/channel/UCOf7UPMHBjAavgD0Qw5q5ww/videos https://github.com/TheAlgorithms/Python https://codesays.com/ https://github....
{ 'targets': [ { 'target_name': 'node_stringprep', 'cflags_cc!': [ '-fno-exceptions', '-fmax-errors=0' ], 'include_dirs': [ '<!(node -e "require(\'nan\')")' ], 'conditions': [ ['OS=="win"', { 'conditions': [ ['"<!@(cmd /C where /Q icu-config || e...
""" The main init module """ __version__ = "1.1.0"
class Todo: """ Implement the Todo Class """ def __init__(self, name, description, points, completed=False): self.name = name self.description = description self.points = points self.completed = completed def __repr__(self): return (f" Task Nam...
# Special Pythagorean triplet # Problem 9 # A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, # # a^2 + b^2 = c^2 # For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2. # # There exists exactly one Pythagorean triplet for which a + b + c = 1000. # Find the product abc. # # First, we recognize that i...
print('hello') """ Visible to students editEdit lab (Links to an external site.)noteNote Write a program that removes all digits from the given input. I like purple socks. Ex: If the input is: 1244Crescent the output is: Crescent The program must define and call the following function that takes a string as paramete...
# This Script for generating Tables # Steps: # [1] Get The Table Title # [2] Get The Table Cells width # [3] Get The Table Column Names # [4] Get The Table Cells Data # ========================================================== def calc_space_before(word,cell_length): # Get Total width of ...
# ch18/example4.py def read_data(): for i in range(5): print('Inside the inner for loop...') yield i * 2 result = read_data() for i in range(6): print('Inside the outer for loop...') print(next(result)) print('Finished.')
class Location: def __init__(self, lat: float, lon: float): self.lat = lat self.lon = lon def __repr__(self) -> str: return f"({self.lat}, {self.lon})" def str_between(input_str: str, left: str, right: str) -> str: return input_str.split(left)[1].split(right)[0]
# Consume: CONSUMER_KEY = '' CONSUMER_SECRET = '' # Access: ACCESS_TOKEN = '' ACCESS_SECRET = ''
# Title : Queue implementation using lists # Author : Kiran Raj R. # Date : 03:11:2020 class Queue: def __init__(self): self._queue = [] self.head = self.length() def length(self): return len(self._queue) def print_queue(self): if self.length == self.head: p...
# -*- coding: utf-8 -*- target_cancer = "PANCANCER" input_file1 = [] input_file2 = [] output_tumor1 = open(target_cancer + ".SEP_8.Tumor_Cor_CpGsite&CytAct_pearson.txt", 'w') output_tumor2 = open(target_cancer + ".SEP_8..Tumor_Cor_CpGSite&CytAct_spearman.txt", 'w') for i in range(0, 10) : name = str(i) inp...
openers_by_closer = { ')': '(', '}': '{', ']': '[', '>': '<', } closers_by_opener = {v: k for k, v in openers_by_closer.items()} part1_points = { ')': 3, ']': 57, '}': 1197, '>': 25137, } part2_points = { ')': 1, ']': 2, '}': 3, '>': 4, } def part1(input): stack ...
""" MangaDex API wrapper for Python :copyright: (c), 2021 Mansuf :license: MIT, see LICENSE for more details. """ __version__ = 'v0.0.1'
class TaskException(Exception): """ Like classic Exception, but we keep the task result, which gets spoiled by celery cache result backend. The kwargs parameter is used for passing custom metadata. """ obj = None def __init__(self, result, msg=None, **kwargs): if msg: resul...
def minimumNumber(n, password): # Return the minimum number of characters to make the password strong # Its length is at least 6. # It contains at least one digit. # It contains at least one lowercase English character. # It contains at least one uppercase English character. # It contains at lea...
# -*- coding: utf-8 -*- def get_site_id(domain_name, sites): ''' Accepts a domain name and a list of sites. sites is assumed to be the return value of ZoneSerializer.get_basic_info() This function will return the CloudFlare ID of the given domain name. ''' site_id = None match = fi...
#encoding:utf-8 subreddit = '00ag9603' t_channel = '@r_00ag9603' def send_post(submission, r2t): return r2t.send_simple(submission)
names = ['Cecil', 'Brian', 'Michael', 'Edna', 'Gertrude', 'Lily', 'Beverly'] #result = [] # for name in names: # result.append(len(name)) def cap(name): up = name.upper() reversed_list = list(reversed(up)) return "".join(reversed_list) result = [cap(name) for name in names] print(result)
# [Copyright] # SmartPath v1.0 # Copyright 2014-2015 Mountain Pass Solutions, Inc. # This unpublished material is proprietary to Mountain Pass Solutions, Inc. # [End Copyright] manage_joint_promotions = { "code": "manage_joint_promotions", "descr": "Manage Joint Secondary Promotions", "header": "Manage Joint Second...
# # This is the Robotics Language compiler # # Parameters.py: Definition of the parameters for this package # # Created on: 08 October, 2018 # Author: Gabriel Lopes # Licence: license # Copyright: copyright # parameters = { 'globalIncludes': set(), 'localIncludes': set() } command_line_fl...
x = 1000000 while True: y = x z = x + 1 x = z + 1
"""Implementation of basic templating engine.""" FORM_POST = """<html> <head> <title>Submit This Form</title> </head> <body onload="javascript:document.forms[0].submit()"> <form method="post" action="{action}"> {html_inputs} </form> </body> </html>""" VERIFY_LOGOUT = """<html> <head> ...
# -*- coding: UTF-8 -*- logger.info("Loading 0 objects to table cal_subscription...") # fields: id, user, calendar, is_hidden loader.flush_deferred_objects()
def extended_euclidean_gcd(a, b): """Copied from http://en.wikibooks.org/wiki/Algorithm_Implementation/Mathematics/Extended_Euclidean_algorithm""" x,y, u,v = 0,1, 1,0 while a != 0: q,r = b//a,b%a; m,n = x-u*q,y-v*q b,a, x,y, u,v = a,r, u,v, m,n return b, x, y
class n_X(flatdata.archive.Archive): _SCHEMA = """namespace n { archive X { payload : raw_data; } } """ _PAYLOAD_SCHEMA = """namespace n { archive X { payload : raw_data; } } """ _PAYLOAD_DOC = """""" _NAME = "X" _RESOURCES = { "X.archive" : flatdata.archive.ResourceSignature( ...
# TODO(mihaibojin): WIP; finish writing a javadoc -> target plugin def _javadoc(ctx): """ Rule implementation for generating javadoc for the specified sources """ target_name = ctx.label.name output_jar = ctx.actions.declare_file("{}:{}-javadoc.jar".format(ctx.attr.group_id, ctx.attr.artifact_id)) ...
class Solution: def searchMatrix(self, matrix, target): """ :type matrix: List[List[int]] :type target: int :rtype: bool """
#!/usr/bin/python # -*- coding: utf-8 -*- # Hive Flask Quorum # Copyright (C) 2008-2012 Hive Solutions Lda. # # This file is part of Hive Flask Quorum. # # Hive Flask Quorum is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Fr...
def is_immutable(new, immutable_attrs): sub = new() it = iter(immutable_attrs) for atr in it: try: setattr(sub, atr, getattr(sub, atr, None)) except AttributeError: continue else: raise AssertionError( f"attribute `{sub.__class__.__...
# Copyright 2017 Brocade Communications Systems, Inc # # 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 la...
pt = int(input('Digite o primeiro termo da PA: ')) r = int(input('Digite a razão : ')) s = 0 for c in range(0, 11): s = pt + (c * r) print('A{} = {}'.format(c + 1, s))
# Str! API_TOKEN = 'YOUR TOKEN GOES HERE' # Int! ADMIN_ID = 'USER_ID OF PERSON(s) DESIGNATED AS ADMINS'
#! /usr/bin/env python3 # Mikhail Kolodin, 2020 # proc2a.py 2020-11-17 1.3 # АСАП, КААП # обработка бард-афиши 1998-2003 годов, архивист: М.Колодин infile = './ap2013.tabs' outfile = './out-ap2013.tab' print("starting...") ln = 0 with open (infile) as inf, open (outfile, 'w') as outf: ln += 1 print(ln, end...
model_space_filename = 'path/to/metrics.json' model_sampling_rules = dict( type='sequential', rules=[ # 1. select model with best performance, could replace with your own metrics dict( type='sample', operation='top', # replace with customized metric in your o...
""" variable [operator]= value/variable_2 i += 1 result += 1 result /= 10 result *= t result += 4/3 prod %= 10 """
group_count = 0 count = 0 group = {} with open("input.txt") as f: lines = f.readlines() for line in lines: line = line.strip("\n") if line: group_count += 1 for letter in line: group[letter] = 1 if letter not in group else group[letter] + 1 else: ...
# 🚨 Don't change the code below 👇 student_scores = input("Input a list of student scores ").split() for n in range(0, len(student_scores)): student_scores[n] = int(student_scores[n]) print(student_scores) # 🚨 Don't change the code above 👆 #Write your code below this row 👇 max_score = -1 index = -1 max_index = -...
# Maximum Unsorted Subarray # https://www.interviewbit.com/problems/maximum-unsorted-subarray/ # # You are given an array (zero indexed) of N non-negative integers, A0, A1 ,…, AN-1. # # Find the minimum sub array Al, Al+1 ,…, Ar so if we sort(in ascending order) that sub array, then the whole array # # should get sorte...
with open('input.txt') as f: graph = f.readlines() tree_count = 0 x = 0 for line in graph: if line[x] == '#': tree_count += 1 x += 3 x %= len(line.strip()) print('Part one: ', tree_count) slopes = (1, 3, 5, 7) mult_count = 1 for slope in slopes: tree_count = 0 x = 0 for line in gr...
""" Shortest Remaining Time First Scheduler process format: python dict{ 'name':str 'burst_time':int 'arrival_time':int 'remaining_time':int } """ def sort_by(processes, key, reverse=False): """ sorts the given processes list according to the key specified """ return sorted(processes, ...
class Vector(object): def __init__(self, p0, p1): self.x = p1[0] - p0[0] self.y = p1[1] - p0[1] def is_vertical(self, other): return not self.dot(other) def dot(self, other): return self.x * other.x + self.y * other.y def norm_square(self): return self.dot(self...
def normalize(df, features): for f in features: range = df[f].max() - df[f].min() df[f] = df[f] / range
dt = {} def solve(a, b): if a == b: return True if len(a) <= 1: return False flag = False temp = a + '-' + 'b' if temp in dt: return dt[temp] for i in range(1, len(a)): temp1 = solve(a[:i], b[-i:]) and solve(a[i:], b[:-i]) # swapped temp2 = solve(a[:i]...
''' Author: ZHAO Zinan Created: 06-Nov-2018 75. Sort Colors https://leetcode.com/problems/sort-colors/description/ ''' class Solution: def sortColors(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ ...
n = int(input()) uid_list = [] for i in range(1,n+1): uid = input() uid_list.append(uid) alpha = '''abcdefghijklmnopqrstuvwxyz''' Alpha = '''ABCDEFGHIJKLMNOPQRSTUVWXYZ''' numeric = '0123456789' N = 0 A = 0 a = 0 valid = [] rep = 0 for i in uid_list: for j in i: if j in Alpha: ...
APP = 'CRYE' MENU = { 'CRYE': { 'title': 'CREDIPyME', 'modules': [ { 'title': 'SIEBEL DESBLOQUEO', 'icon': 'flaticon-lifebuoy', 'text': 'Desbloquea trenes de crédito', 'subtext': 'Desbloqueo de tren de credito del sistema S...
# 350111 # a3 p10.py # Tibebu T.Biru # t.biru@jacobs-university.de #function definition def print_frame(n, m, c): print(c * m) for i in range(1, n - 1): print(c, ' ' * (m - 2), c, sep='') print(c * m) """ Basically, we print the first and last lines by using repetition which is mult...
Clock.bpm=144; Scale.default="lydianMinor" d1 >> play("x-o{-[-(-o)]}", sample=0).every([28,4], "trim", 3) d2 >> play("(X )( X)N{ xv[nX]}", drive=0.2, lpf=var([0,40],[28,4]), rate=PStep(P[5:8],[-1,-2],1)).sometimes("sample.offadd", 1, 0.75) d3 >> play("e", amp=var([0,1],[PRand(8,16)/2,1.5]), dur=PRand([1/2,1/4]), pan=va...
# -*- mode: python -*- # vi: set ft=python : # Copyright (c) 2018-2019, Toyota Research Institute. # 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 must retain...
s = input() count = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] for i in s : if(i == '0') : count[0]+=1 elif(i == '1') : count[1]+=1 elif(i == '2') : count[2]+=1 elif(i == '3') : count[3]+=1 elif(i == '4') : count[4]+=1 elif(i == '5') : count[5]+=1 elif(i =...
# # PySNMP MIB module Wellfleet-IFWALL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-IFWALL-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:33:47 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
# The observer pattern is a software design pattern in which an object, called the subject, # maintains a list of its dependents, called observers, and notifies them automatically of # any state changes, usually by calling one of their methods. # See more in wiki: https://en.wikipedia.org/wiki/Observer_pattern # # We w...
DEBUG = True ADMINS = frozenset([ "yourname@yourdomain.com" ])
magic_square = [ [8, 3, 4], [1, 5, 9], [6, 7, 2] ] print("Row") print(magic_square[0][0]+magic_square[0][1]+magic_square[0][2]) print(magic_square[1][0]+magic_square[1][1]+magic_square[1][2]) print(magic_square[2][0]+magic_square[2][1]+magic_square[2][2]) print("colume") print(magic_square[0][0]+magic_squa...
pessoa =[] lista = [] maior = menor = 0 continuar = 's' while continuar not in 'Nn': pessoa.append(str(input('Informe o nome : '))) pessoa.append(float(input('Informe o peso : '))) if maior == 0: maior = pessoa[1] menor = pessoa[1] if pessoa[1]>maior: maior = pessoa[1] if pe...
#!/usr/bin/python3 """a class empty""" class BaseGeometry(): """create class""" pass def area(self): """area""" raise Exception("area() is not implemented")
class UserImporter: def __init__(self, api): self.api = api self.users = {} def run(self): users = self.api.GetPersons() def save_site_privs(self, user): # update site roles pass def save_slice_privs(self, user): # update slice roles pass ...
def I(d,i,v):d[i]=d.setdefault(i,0)+v L=open("inputday14").readlines();t,d,p=L[0],dict([l.strip().split(' -> ')for l in L[2:]]),{};[I(p,t[i:i+2],1)for i in range(len(t)-2)] def E(P):o=dict(P);[(I(P,p,-o[p]),I(P,p[0]+n,o[p]),I(P,n+p[1],o[p]))for p,n in d.items()if p in o.keys()];return P def C(P):e={};[I(e,c,v)for p,v i...
# Faça um programa que mostre a tabuada de vários números, um de cada vez, para cada valor digitado # pelo usuário. O programa será interrompido quando o número solicitado for negativo. while True: number = int(input('Digite um número: \033[33m[negativo para fechar]\033[m ')) if number < 0: break p...
N,M=map(int,input().split()) edges=[list(map(int,input().split())) for i in range(M)] ans=0 for x in edges: l=list(range(N)) for y in edges: if y!=x:l=[l[y[0]-1] if l[i]==l[y[1]-1] else l[i] for i in range(N)] if len(set(l))!=1:ans+=1 print(ans)
def initialize_weights_normal(network): pass def initialize_weights_xavier(network): pass
class Solution: def fourSum(self, nums: List[int], target: int) -> List[List[int]]: def kSum(nums: List[int], target: int, k: int) -> List[List[int]]: res = [] # If we have run out of numbers to add, return res. if not nums: return res ...
class Employee: def __init__(self, first, last, sex): self.first = first self.last = last self.sex = sex self.email = first + '.' + last + '@company.com' def fullname(self): return "{} {}".format(self.first, self.last) def main(): emp_1 = Employee('prajesh', 'anant...
class Solution: def lowestCommonAncestor(self, root: 'TreeNode', nodes: 'List[TreeNode]') -> 'TreeNode': nodes = set(nodes) return self._lca(root, nodes) def _lca(self, root, nodes): if not root or root in nodes: return root l = self._lca(root.left, nodes) ...
''' Este snipet tiene como propósito revisar lso conceptos el patrón de diseño adaptador. ''' class Korean: def __ini__(self): self.name ="Korean" def speak_korean(self): return "An-neyong?" class British: '''English spear''' def __init__(self): self.name ="British" ...
# # PySNMP MIB module EMC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EMC-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:02:38 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)...
class IrisAbstract(metaclass=ABCMeta): @abstractmethod def mean(self) -> float: ... @abstractmethod def sum(self) -> float: ... @abstractmethod def len(self) -> int: ...
"""https://open.kattis.com/problems/planina""" def mid(n): if n == 0: return 2 else: return 2 * mid(n-1) - 1 n = int(input()) print(mid(n)**2)
class Solution: def rob(self, nums: List[int]) -> int: def recur(arr): memo = {} def dfs(i): if i in memo: return memo[i] if i >= len(arr): return 0 ...
class Solution: def longestCommonSubsequence(self, text1: str, text2: str) -> int: dp = [[0]*(len(text2)+1) for _ in range(len(text1)+1)] m, n = len(text1), len(text2) for i in range(1, m+1): for j in range(1, n+1): if text1[i-1] == text2[j-1]: ...
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def sortList0(self, head: ListNode) -> ListNode: # 当没有或只有一个节点时, 直接返回 if not head or not head.next: return head # 不存在第三个节点, 也就是只有两个节点 ...
tail = input() body = input() head = input() animal = [head, body, tail] print(animal)
ngroups = int(input()) for i in range(ngroups): bef = '0.0' while True: act = input() if act == '0': break if act.find('.') == -1: act += '.0' nDecAct = len(act) - act.find('.') - 1 nDecBef = len(bef) - bef.find('.') - 1 decima...
def part1(): Input = [int(x) for x in open("input.txt").read().split("\n")] Start = 0 Jumps = {} while len(Input) != 0: Smallest = float("inf") for x in Input: Smallest = min(Smallest, x-Start) if Smallest not in Jumps: Jumps[Smallest] = 1 else:...
# Adapted from: http://jared.geek.nz/2013/feb/linear-led-pwm INPUT_SIZE = 255 # Input integer size OUTPUT_SIZE = 255 # Output integer size INT_TYPE = 'uint8_t' TABLE_NAME = 'cie'; def cie1931(L): L = L*100.0 if L <= 8: return (L/902.3) else: return ((L+16.0)/116.0)**3 x = range...
class ImportBuilder(): def __init__(self, file_type: str) -> None: self.allowed_file_types = [ 'xlsx', 'json', 'pbix', 'rdl', 'onedrive' ] if file_type not in self.allowed_file_types: raise ValueError( ...
# # PySNMP MIB module HPN-ICF-NVGRE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-NVGRE-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:40:39 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
""" # Definition for a Node. class Node(object): def __init__(self, val, children): self.val = val self.children = children """ # Idea: preorder recursive traversal; add number of children after root val, in order to know when to terminate. class Codec: def serialize(self, root): """E...
image = [] with open('conv0.bb','rb') as f: pixels = f.read(320 * 160 * 4 * 2) print(type(pixels)) for pixel in pixels: image.append(pixel) print(len(image)) print(max(image)) print(min(image))
print ("Hello world ....! Hi") count = 10 print("I am at break-point ",count); count=10*2 print("end ",count) print ("Hello world") pr = input("enter your name .!!") print ("Hello world",pr) for hooray_counter in range(1, 10): for hip_counter in range(1, 3): print ("Hip") print ("Hooray!!") while Tr...
class Solution(object): def intToRoman(self, num): """ :type num: int :rtype: str """ exchange = [['I', 1], ['V', 5], ['X', 10], ['L', 50], ['C', 100], ['D', 500], ['M', 1000]] exchange = exchange[::-1] roman = "" index = 0 while num >...
ofd1 = open('D:\\MyGit\\ML\Data\\x_y_seqindex.csv','r') ofd2 = open('D:\\MyGit\\ML\Data\\OrderSeq.csv','r') nfd = open('D:\\MyGit\\ML\Data\\OrderClassificationCheck.txt','w') orders = [] for i in ofd2: t = i.strip().split(',') order,design,classification,seq = t orders.append(t) dic = {} dic[0]='Complex'...
# from flask import Blueprint, request # from app.api.utils import good_json_response, bad_json_response # import requests # blueprint.route('/add', methods=['POST']) def test_register(): pass # url = 'http://localhost:5000/json' # resp = requests.get(url) # assert resp.status_code == 200 # assert...
# -*- coding: utf-8 -*- class AgendamentoExistenteError(Exception): def __init__(self, *args, **kwargs): super(AgendamentoExistenteError, self).__init__(*args, **kwargs)
""" Parameters for tf.function decorators that need be defined before importing the model file""" # used by RADU_NN*.py, defaults to four amplitude images INPUT_FEATURES_SHAPE = [None, 512, 512, 4]
class Slot: def __init__(self, x, y, paint=False): self.x = x self.y = y self.paint = paint self.painted = False self.neigh = set() self.neigh_count = 0 def __str__(self): return "%d %d" % (self.x, self.y) class Grid: def __init__(self, n_rows, n_col...