content
stringlengths
7
1.05M
NOT_ASSINGNED = 0 MAFIA = 1 DETECTIVE = 2 JOKER = 3 ANGEL = 4 SHEELA = 5 SILENCER = 6 TERORIST = 7 CIVILIAN = 8
"""Keys to be used for the returned objects via API.""" # pylint: disable=too-few-public-methods SUCCESS = "success" ERRORS = "errors" FLAGS = "flags" DATA = "data" INFO = "info" RESULT = "result" REQUIRED = "required" class Common: """Common result keys.""" CREATOR_OID = "creator" CHANNEL_OID = "chann...
print('hello world') i = 10 if i==10: print('true') print('i =10')
class StatementRecord: def __init__(self, s_name, r_name, e_name, s_type, e_type, which_extractor, info_from_set=None, **extra_info): if info_from_set is None: self.info_from_set = set([]) else: self.info_from_set = info_from_set self.s_name = s_name self.r_...
DEFAULT_FILE_STORAGE = 'djangae.storage.CloudStorage' FILE_UPLOAD_MAX_MEMORY_SIZE = 1024 * 1024 FILE_UPLOAD_HANDLERS = ( 'djangae.storage.BlobstoreFileUploadHandler', 'django.core.files.uploadhandler.MemoryFileUploadHandler', ) DATABASES = { 'default': { 'ENGINE': 'djangae.db.backends.appengine' ...
def fizzbuzz(n): result = [] for count in range (1, n): if count % 3 == 0 and not count % 5 == 0: result.append("Fizz") elif count % 5 == 0 and not count % 3 == 0: result.append("Buzz") elif count % 3 == 0 and count % 5 == 0: result.append("FizzBuzz") else: result.append(cou...
""" solved wrong problem, paths can start from anywhere TODO: ask better questions degree[neigh]: 3 matrix[neigh[0]][neigh[1]]: 8 matrix[node[0]][node[1]]: 4 neigh: (1, 2) node: (0, 2) """ class Solution: def longestIncreasingPath(self, matrix: List[List[int]]) -> int: self.cnt = 0 if len(...
i = 2 print("Even numbers from 1 to 100:") while i <= 100: print(i) i += 2
#!/usr/bin/env python3 def print_ok(msg, **kargs): """ Print the message in green. """ print(f"\033[32m{msg}\033[0m", **kargs) def print_failed(msg, **kargs): """ Print the message in red. """ print(f"\033[31m{msg}\033[0m", **kargs)
""".. Ignore pydocstyle D400. ==================== Resolwe Test Helpers ==================== """
''' lab 7 while loop ''' #3.1 i = 0 while i <=5: if i !=3: print(i) i = i +1 #3.2 i = 1 result =1 while i <=5: result = result *i i = i +1 print(result) #3.3 i = 1 result =0 while i <=5: result = result +i i = i +1 print(result) #3.4 i = 3 result =1 while i <=8...
class Kerror(Exception): def __init__(self, technicalMessage, guiMessage=None): self.technicalMessage = technicalMessage self.guiMessage = guiMessage
s = 'I am Sam' print('Sam' in s) # True print('sam' in s) # False print('I' in s and 'Sam' in s) # True s = 'I am Sam' print(s.find('Sam')) # 5 print(s.find('XXX')) # -1 print(s.find('am')) # 2 print(s.find('am', 3)) # 6 print(s.find('am', 3, 5)) # -1 print(s.rfind('am')) # 6 print(s.rfind('XXX')) # -1 prin...
# Copyright (c) 2012 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. { 'conditions': [ # In component mode (shared_lib), we build all of skia as a single DLL. # However, in the static mode, we need to build skia ...
# 2.6.9 _strptime.py # In 2.6 bug in handling BREAK_LOOP followed by JUMP_BACK # So added rule: # break_stmt ::= BREAK_LOOP JUMP_BACK for value in __file__: if value: if (value and __name__): pass else: tz = 'a' break
# Time: O(1) # Space: O(1) # A rectangle is represented as a list [x1, y1, x2, y2], # where (x1, y1) are the coordinates of its bottom-left corner, # and (x2, y2) are the coordinates of its top-right corner. # # Two rectangles overlap if # the area of their intersection is positive. # To be clear, two rectangles that...
class yrange: def __init__(self, n): self.i = 0 self.n = n def __iter__(self): return self def next(self): if self.i < self.n: i = self.i self.i += 1 return i else: raise StopIteration() dias = ['lunes', 'martes', 'mi...
"""Sentinel class for constants with useful reprs""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. class Sentinel(object): def __init__(self, name, module, docstring=None): self.name = name self.module = module if docstring: ...
# 000562_04_ex03_def_vowels.py # в развитие темы - написать программу, которая выводит количество гласных букв, в порядке возрастания частотности def searsh4vowels(word): """выводит гласные, находящиеся в веденном тексте""" vowels = set('aeiou') return vowels.intersection(set(word)) word = input ('Provide a word...
def get_model_for_training(): return def load_model(): return def save_model(): return
if __name__ == "__main__": team_A = Team("A") team_B = Team("B") arena = Arena(team_A, team_B) arena.build_team_one() arena.build_team_two() arena.team_battle() arena.show_stats()
# Copyright 2018 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
class User: id = 1 name = 'Test User' email = 'test@email.com' def find(self, id): return self
#Faça um programa que leia um número qualquer e mostre o seu fatorial. #Ex: 5! = 5 x 4 x 3 x 2 x 1 = 120 '''n = int(input('Digite um número: ')) i = 2 fat = 1 while i <= n: fat = fat * i i = i + 1 print('{}! é igual a {}'.format(n, fat))''' n = int(input('Digite um número para saber o fatorial: ')) cont = n fa...
"""igvm - Main Module Copyright (c) 2018 InnoGames GmbH """ VERSION = (2, 1)
# Approach 2 - DP # Time: O(N*sqrt(N)) # Space: O(N) class Solution: def winnerSquareGame(self, n: int) -> bool: dp = [False] * (n+1) for i in range(1, n+1): for k in range(1, int(i**0.5)+1): if dp[i - k*k] == False: dp[i] = True ...
# Implements hack/lib/version.sh's kube::version::ldflags() for Bazel. def version_x_defs(): # This should match the list of packages in kube::version::ldflag stamp_pkgs = [ "k8s.io/kubernetes/pkg/version", # In hack/lib/version.sh, this has a vendor/ prefix. That isn't needed here? "k8s.io/client...
# # @lc app=leetcode id=687 lang=python3 # # [687] Longest Univalue Path # # @lc code=start # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def longestUnivaluePath(self, root: TreeNode...
class Circle: def __init__(self): print("Parent constractor") class Point(Circle): def __init__(self, x, y): print("Child constractor") # self.x_point = x # self.y_point = y # circle = Circle() def draw(self): print(f"draw a point with {self.x_point} and {se...
# !/usr/bin/env python3 # Author: C.K # Email: theck17@163.com # DateTime:2021-06-21 19:06:23 # Description: class Solution: def summaryRanges(self, nums: List[int]) -> List[str]: ranges, r = [], [] for n in nums: if n - 1 not in r: r = [] ranges += r, ...
class Solution: def findWords(self, words): """ :type words: List[str] :rtype: List[str] """ res = [] rows = ['qwertyuiop', 'asdfghjkl', 'zxcvbnm'] for word in words: for row in rows: if all(letter in row for letter in word.lower()...
# # PySNMP MIB module MSTP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MSTP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:05:57 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:1...
Name=str(input("Por favor escriba su nombre: ")) bn=float(input("Por favor ingrese su salario fijo: ")) vt=float(input("Ingrese su numero de ventas este mes: ")) qc=(vt*0.15) tl=(qc+bn) print("TOTAL = R$ ""{:.2f}".format (tl))
LOG_HANDLERS = { "mrq.logger.MongoHandler": { "mongodb_logs_size": 16 * 1024 * 1024 } }
class Base: def __init__(self, name): self.name = name class Foo(Base): def __init__(self, name, time): Base.__init__(self, name) self.time = time class BaseA: def __init__(self): print("BaseA") class FooA(BaseA): def __init__(self): BaseA.__init__(self) ...
# coding=utf-8 MASTER_NODE_URL = 'https://api.sentinelgroup.io' KEYSTORE_FILE_PATH = '/root/.sentinel/keystore' CONFIG_DATA_PATH = '/root/.sentinel/config.json' LIMIT_1GB = (1.0 * 1024 * 1024 * 1024)
# Copyright 2021 by Sergio Valqui. All rights reserved. # Navigating Object structures def obj_struct(my_obj): for att in dir(my_obj): print(att, getattr(my_obj, att), type(getattr(my_obj, att)).__name__) # TODO: Differentiate methods, other objects, known structures # TODO: show values...
# -*- coding: utf-8 -*- def main(): n = int(input()) b = list(map(int, input().split())) ans = list() # KeyInsight # 数列aに数字を追加して数列bが作れるか? # ⇒数列bのk番目の値kを取り除くことができるか? と言い換える # https://www.youtube.com/watch?v=wOacBGq5OWU while b: index = -1 candidate = -1 ...
class Person: def __init__(self, first_name, middle, last, nick, title, company, comaddr, homenr, mobile, worknr, faxnr, email_1, email_2, email_3, home_page, year_b, year_a, home_add, home_phone, note): self.first_name = first_name self.middle = middle self.last = last ...
x = [] for i in range(6): x.append(float(input())) mn = x[0] mx = x[0] for i in range(6): if(x[i] < mn): mn = x[i] if(x[i] > mx): mx = x[i] print(mn,mx)
CODEDIR = '/home/antonio/Codes/bronchinet/src/' DATADIR = '/home/antonio/Data/EXACT_Testing/' BASEDIR = '/home/antonio/Results/AirwaySegmentation_EXACT/' # NAMES INPUT / OUTPUT DIR NAME_RAW_IMAGES_RELPATH = 'Images/' NAME_RAW_LABELS_RELPATH = 'Airways/' NAME_RAW_ROIMASKS_RELPATH = 'Lungs/' NAME_RAW_COARSEAIRWAYS_REL...
# Igual / Suma / resta / Multiplicación / División # Igualdad x = 2 y = 1 z = 4 # Suma x += 34 # x = x + 34 => 2 + 34 = x = 36 y += 2 # y = y + 2 => 1 + 2 = y = 3 z += 78 # z = z + 78 => 4 + 78 = z = 82 # resta x -= 3 # x = x - 3 => 36 - 3 = x = 33 y -= 21 # y = y - 21 => 3 - 21 = y = -18 z -= 7 # z = z - 7 => 82 ...
# coding=utf-8 # Module wingdings_16 # generated from Wingdings 11.25pt name = "Wingdings 16" start_char = '!' end_char = chr(255) char_height = 16 space_width = 8 gap_width = 2 bitmaps = ( # @0 '!' (14 pixels wide) 0x00, 0x00, # 0x00, 0x00, # 0x00, 0x18, # ...
class Student: def __init__(self, name, school): self.name = name self.school = school self.marks = [] def average(self): return sum(self.marks) / len(self.marks) class WorkingStudent(Student): def __init__(self, name, school, salary): super().__init__(name, school) self.salary = salar...
def my_create_model(switch_prob=0.1,noise_level=0.5): """ Create an HMM with binary state variable and 1D Gaussian observations The probability to switch to the other state is `switch_prob`. Two observation models have mean 1.0 and -1.0 respectively. `noise_level` specifies the standard deviation of t...
#En ciertos casos usar listas y estas al ser dinamicas consumen mucha memoria y eso resulta ser ineficiente #Para solucionar ese problema es cuando entran las tuplas #Tuplas elementos de tipo estatico - no se pueden modificar #Mas eficientes en los recorridos - estructura de datos mas rapida #Inmutabilidad - no pued...
#!/usr/bin/env python # -*- coding: utf-8 -*- def gll(N): """ Returns GLL (Gauss Lobato Legendre module with collocation points and weights) """ # Initialization of integration weights and collocation points # [xi, weights] = gll(N) # Values taken from Diploma Thesis Bernhard Schuberth ...
class NoteBook(object): """Specifies the notebooks associated with a particular user""" def get_all_notebooks(self, note_store): """Returns all notebooks""" return note_store.listNotebooks()
#!/usr/bin/env python3 def read_digits(): return map(int, input().strip()) def index_of_nonzero(items): return next(i for i, x in enumerate(items) if x != 0) def with_leading_nonzero(items): index = index_of_nonzero(items) items.insert(0, items.pop(index)) return items for _ in range(int(input()...
a = int(input()) b = int(input()) print(b % a)
UNIT = 20 c = 0.01 t = 0.01 def setup(): fullScreen() background(200,100,155) def X(x): return width/2 + x def Y(x): return height/2 - x def draw(): background(0) global c,t noStroke() rectMode(CORNER) f = [1,1,2,3,5,8,13,21,34,55,89] e = [(1,-1),(...
# # PySNMP MIB module SMON-MIB (http://pysnmp.sf.net) # ASN.1 source http://mibs.snmplabs.com:80/asn1/SMON-MIB # Produced by pysmi-0.0.7 at Sun Feb 14 00:28:37 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...
#바닥공사 n=3 d=[0]*1001 d[1]=1 d[2]=3 for i in range(3,n+1): print('d[i-1]=', d[i-1] ) print('d[i-2]=', d[i-2] ) d[i]=(d[i-1]+2 * d[i-2]) % 796796 print(d[n])
matrix = [ [1, 2, 3, 4], [5, 6, 0, 8], [9, 0, 2, 4], [4, 5, 6, 7] ]
# # PySNMP MIB module NET-SNMP-PERIODIC-NOTIFY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NET-SNMP-PERIODIC-NOTIFY-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:18:12 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python vers...
''' Created on Sep 9, 2013 @author: akittredge '''
""" ============ Unsupervised ============ Unsupervised learning. """ # Category description for the widget registry NAME = "Unsupervised" DESCRIPTION = "Unsupervised learning." BACKGROUND = "#CAE1EF" ICON = "icons/Category-Unsupervised.svg" PRIORITY = 6
def getCookie(cookie_name): JS(""" var results = document.cookie.match ( '(^|;) ?' + @{{cookie_name}} + '=([^;]*)(;|$)' ); if ( results ) return ( decodeURIComponent ( results[2] ) ); else return null; """) # expires can be int or Date def setCookie(name, value, expires, domain=N...
# import pyperclip class User: ''' the user class ''' user_list = [] def __init__(self, first_name, last_name, number, email, password): self.first_name = first_name self.last_name = last_name self.phone_number = number self.email = email self.password = pas...
# a = input("Birinci Kenar") # b = input("İkinci Kenar") # if (a and b) and (a.isdigit() and b.isdigit()): # a, b = int(a), int(b) # liste = [a,b,(180-(a+b))] # if sum(liste) == 180: # if len(set(liste)) == 2: # print("İkizkenar") # if len(set(liste)) == 3: # print("...
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") PROTOBUF_VERSION = "3.6.1.3" SHA = "9510dd2afc29e7245e9e884336f848c8a6600a14ae726adb6befdb4f786f0be2" def generate_protobuf(): http_archive( name = "com_google_protobuf", urls = ["https://github.com/protocolbuffers/protobuf/archi...
# # @lc app=leetcode id=69 lang=python3 # # [69] Sqrt(x) # # @lc code=start class Solution: def mySqrt(self, x: int) -> int: v = 1 result = 0 while True: if v * v > x: result = v - 1 break v = v + 1 return result # @lc code=end...
def morris_pratt_string_matching(t, w, m, n): B = prefix_suffix(w) i = 0 while i <= n - m + 1: j = 0 while j < m and t[i + j + 1] == w[j + 1]: j = j + 1 if j == m: return True i, j = i + j - B[j], max(0, B[j]) return False
teste = list() teste.append('Pedro') teste.append(15) galera = list() galera.append(teste[:]) teste[0] = 'Ronaldo' teste[1] = '22' galera.append(teste[:]) print(galera)
_base_ = [ '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py', '../_base_/swa.py' ] num_stages = 6 num_proposals = 512 model = dict( type='SparseRCNN', pretrained = 'https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_base_patch4_window...
abi = '''[ { "inputs": [ { "internalType": "int256", "name": "bp", "type": "int256" }, { "internalType": "int256", "name": "sp", "type": "int256" } ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { ...
class HashEngine: def __init__(self): self.location_hash = None self.location_auth_hash = None self.request_hashes = [] def hash(self, timestamp, latitude, longitude, altitude, authticket, sessiondata, requests): raise NotImplementedError() def get_location_hash(self): ...
############################################### # Constants | Logo and help messages ############################################### VERSION = 'v2.1.0-dev' USAGE = 'Usage: python %prog [options] arg' EPILOG = 'Example: python DRipper.py -s 192.168.0.1 -p 80 -t 100' LOGO_COLOR = f'''[deep_sky_blue1] ██████╗ ██████═╗██╗...
"""This function is used to verify key. If the key is valid, return a dictionary with key and answer If the key is invalid, return False """ def isvalid(Key): #Check the length of string first if len(Key) != 26: return False #Use a dictionary to store the key and value d = dict() Ch...
for _ in range(int(input())): n = int(input()) arr = list(map(int,input().split())) flag = 0 for i in arr: if i < 0: flag = 1 break if flag: print('NO') continue for i in range(max(arr)): if i not in arr: arr.append(i) print...
bind = '0.0.0.0:8000' # Assuming one CPU. http://docs.gunicorn.org/en/stable/design.html#how-many-workers # 2 * cores + 1 workers = 3 # You can send signals to it http://docs.gunicorn.org/en/latest/signals.html pidfile = '/run/gunicorn.pid' # Logformat including request time. access_log_format = '%(h)s %({X-Forwarded-F...
""" Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete AT MOST ONE transaction (i.e., buy one and sell one share of the stock), design an algorithm to find the maximum profit. Note that you cannot sell a stock before you buy one. Example 1: ...
#print("Olá " + "Mundo!!") #print("7" + "4") nome = input("Qual o seu nome? ") idade = input("Qual a sua idade? ") peso = input("Qual a sua Peso? ") print("Seu nome é ",nome, ", sua idade é", idade, ", e seu peso é ", peso, "kilos.")
""" To understand what's going on: 1. The Merge Sort Recursively breaks down a list of size N to left and right, each of size N/2; 2. The new sliced lists are fed to cmp_sort that rearranges the fed total list of size N with index to be sorted in the original list. Since, Original list is Mutable - This Original list c...
class Constants: RESPONSE_CODES_SUCCESS = [200, 201] RESPONSE_CODES_FAILURE = [400, 401, 404, 500] RESPONSE_500 = 500 URL = "https://api.coingecko.com/api/v3/coins/{}?localization=false&tickers=false&market_data=false&community_data=false&developer_data=false&sparkline=false" CONTENT_TYPE = "applica...
# 4из20 + Выигрышные номера нескольких тиражей def test_4x20_winning_numbers_for_several_draws(app): app.ResultAndPrizes.open_page_results_and_prizes() app.ResultAndPrizes.click_game_4x20() app.ResultAndPrizes.click_the_winning_numbers_for_several_draws() app.ResultAndPrizes.click_ok_for_several_draw...
def P_total(pressures=[]): """Returns a float of the total pressure of a gas in a container \npressure: ```list``` \n\tList of pressures in a container""" total = 0.0 for pressure in pressures: total += pressure return float(total) def partial_pressure(num_moles, ideal_gas_law, temp, volum...
"""Loads the absl library""" load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def repo(): http_archive( name = "com_google_absl", sha256 = "f41868f7a938605c92936230081175d1eae87f6ea2c248f41077c8f88316f111", strip_prefix = "abseil-cpp-20200225.2", urls = [ ...
""" Constants file for wiating backend """ AUTH0_CLIENT_ID='AUTH0_CLIENT_ID' AUTH0_DOMAIN='AUTH0_DOMAIN' AUTH0_CLIENT_SECRET='AUTH0_CLIENT_SECRET' AUTH0_CALLBACK_URL='AUTH0_CALLBACK_URL' AUTH0_AUDIENCE='AUTH0_AUDIENCE' SECRET_KEY = 'SECRET_KEY' S3_BUCKET = 'S3_BUCKET' ES_CONNECTION_STRING = 'ES_CONNECTION_STRING' INDEX...
class User(object): def __init__(self, type, mail, preferences, added, following=None, follower=None): """ Represent a zodiac user Args --- :arg type {str} type of that identify the schema :arg mail {str} user email adress...
colddrinks = "pepsi", "cola", "sprite", "7up", 58 num = [89, 38,94,23,98,192] #num.sort() #num.reverse() print(colddrinks[:4]) print(num[:: 2])
#Author: Bhumi Patel #The given function will take in an educational website and count the number #of clicks it takes for users to reach privacy policy and end-user license agreement ''' -> With the current pandemic, lives all around the world has been disturbed and changed completely. With change in lifestyle...
# Complete the function below. def main(): conn = sqlite3.connect('SAMPLE.db') cursor = conn.cursor() cursor.execute("drop table if exists ITEMS") sql_statement = '''CREATE TABLE ITEMS (item_id integer not null, item_name varchar(300), item_description text, item_category text, quan...
class Solution(object): def maxProduct(self, nums): """ :type nums: List[int] :rtype: int """ if len(nums) == 0: return 0 # max_p[i] saves maximum product of subarray among nums[0...i], both inclusive # min_p[i] saves minimum product of subarray a...
class LearnedEquivalence: def __init__(self, eq_class): self.equivalence_class = eq_class def __str__(self): return "LEARNED_EQCLASS_" + self.equivalence_class
# data is [ 0 name of game, # 1 path to game saves, # 2 backups directory] ''' self.game.name self.game.saveLocation self.game.backupLocation ''' class gameInfo: def __init__( self, name, saveLocation, backupLocation ): self.name = name self.saveLocation = saveLocation self.backupLocation = backupLocatio...
name='tkitAutoMask'#修改包名字- version='0.0.0.1 ' description='Terry toolkit tkitAutoMask' author='Terry Chan' author_email='napoler2008@gmail.com' url='https://terrychan.org/' copyright = '2021, Terry Chan' language = 'zh_cn'
"""Provides the repository macro to import LLVM.""" load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "4b4bc1ea16dec58e828ec3a0154046b10ec69242" LLVM_SHA256 = "a744dd2d7241daf6573ef88f9bd61b9d690cbac73d1f26381054d74e1f3505e0" http_a...
class Field(): def __init__(self, dictionary = {}): self.name = dictionary.get("name") self.rname = dictionary.get("rname") self.domain = dictionary.get("domain") self.description = dictionary.get("description") # Props self.input = dictionary.get("input", False) ...
# some helper functions def build_tree(A, i, n): """ Build a tree from level array in leetcode :param A: input array :param i: start index :param n: size of array :return: TreeNode """ if i < n: if A[i] is None: # return if null return x = TreeNode(A[...
# -*- coding: utf-8 -*- """ Created on Wed Oct 28 05:48:47 2020 @author: ucobiz """ def happy(): print("Happy Bday to you!") def sing(person): happy() happy() print("Happy Bday,", person) happy() def main(): sing("Fred") print() sing("Lucy") main()
# QuickSort def quicksort(L,l,r): #If list has only one element, return the list as is if(r-l <=1): return L # Set pivot as the very first position in the list, upper and lower are the next element (pivot,lower,upper) = (L[l],l+1,l+1) # Loop from the item after pivot to the end for i in range(l+1,r): #If L[i]...
# import pytest class TestMessageFolder: def test_folders(self): # synced assert True def test_messages(self): # synced assert True def test_order_messages_by_date(): # synced assert True class TestAttributes: class TestChildFolderCount: pass ...
def character_xor(input_string, char): output_string = "" for c in input_string: output_string += chr(ord(c)^char) return output_string def calculate_score(input_string): frequencies = { 'a': .08167, 'b': .01492, 'c': .02782, 'd': .04253, 'e': .12702, 'f': .02228, 'g': .02015, 'h': .06094, '...
_base_ = './cifar10split_bs16.py' data = dict( unlabeled=dict( type='TVDatasetSplit', base='CIFAR10', train=True, data_prefix='data/torchvision/cifar10', num_images=1000, download=True ) )
def runModels(sproc,modelList,testPredictionPaths,CVPredictionPaths,trials,RMSEPaths,useRMSE): subprocesses = [] for trial in range(0,trials): # Setup utility arrays testPredictionPaths.append([]) CVPredictionPaths.append([]) for model in modelList: print("Running Model " + m...
""" Manages the game colors -- Author : DrLarck Last update : 22/08/19 (DrLarck) """ game_color = { "n" : 0xad5f25, "r" : 0xdcdede, "sr" : 0xfe871a, "ssr" : 0xfcdc09, "ur" : 0x0b68f3, "lr" : 0xd90e82 }
def faculty_evaluation_result(nev, rar, som, oft, voft, alw): ''' Write code to calculate faculty evaluation rating according to assignment instructions :param nev: Never :param rar: Rarely :param som: Sometimes :param oft: Often :param voft: Very Often :param alw: Always ...
""" https://leetcode.com/problems/minimum-distance-between-bst-nodes/ Given a Binary Search Tree (BST) with the root node root, return the minimum difference between the values of any two different nodes in the tree. Example : Input: root = [4,2,6,1,3,null,null] Output: 1 Explanation: Note that root is a TreeNode obj...
def sumas(n):#Algoritmo de acumulacion de sumas cont=0 i=1 k=0 for i in range(int(n)): j=n for j in range(1): k=k+j k=k+i cont=cont+1 #Cada bucle se ejecuta n veces, y en el interior del segundo hay 2 instrucciones. cont=2*cont*cont #Asi la relacion qu...