content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Subtraction: print('Test Subtraction class') def __init__(self, x, y): self.x = x self.y = y print('This is Subtraction function and result of your numbers is : ', x-y)
class Subtraction: print('Test Subtraction class') def __init__(self, x, y): self.x = x self.y = y print('This is Subtraction function and result of your numbers is : ', x - y)
# number = input('Enter a Number') # w, x, y, z = 5, 10, 10, 20 # if w > x: # print('x equals y') # elif w < y: # print('Second Condition') # elif x == y: # print('Third Condition') # else: # print('Everything is False') # username = 'qaidjohar' # password = 'qwerty' # if not 5 == 5: # if (usern...
print('****Welcome To QJ Amusement Park****') age = int(input('Enter You Age: ')) if age <= 8: print('Your ticket is Rs.500') elif age <= 50: print('Your ticket is Rs.800') else: print('Your ticket is Rs. 300')
paths = \ [dict(steering_angle = -20, target_angle = -20, coords = \ [[0, 53, 91, 97], [0, 64, 97, 107], [15, 76, 107, 119], [33, 86, 119, 132], [47, 95, 132, 146], [59, 102, 146, 160], [69, 108, 160, 175], [76, 112, 175, 190]]), dict(st...
paths = [dict(steering_angle=-20, target_angle=-20, coords=[[0, 53, 91, 97], [0, 64, 97, 107], [15, 76, 107, 119], [33, 86, 119, 132], [47, 95, 132, 146], [59, 102, 146, 160], [69, 108, 160, 175], [76, 112, 175, 190]]), dict(steering_angle=-15, target_angle=-15, coords=[[0, 52, 34, 54], [15, 67, 54, 73], [33, 79, 73, 9...
tests = int(input()) for _ in range(tests): data = [float(num) for num in input().split()] sum = 2*data[0]+3*data[1]+5*data[2] print("%0.1f" % (sum/10))
tests = int(input()) for _ in range(tests): data = [float(num) for num in input().split()] sum = 2 * data[0] + 3 * data[1] + 5 * data[2] print('%0.1f' % (sum / 10))
# Append at the end of /etc/mailman/mm_cfg.py DEFAULT_ARCHIVE = Off DEFAULT_REPLY_GOES_TO_LIST = 1 DEFAULT_SUBSCRIBE_POLICY = 3 DEFAULT_MAX_NUM_RECIPIENTS = 30 DEFAULT_MAX_MESSAGE_SIZE = 10000 # KB
default_archive = Off default_reply_goes_to_list = 1 default_subscribe_policy = 3 default_max_num_recipients = 30 default_max_message_size = 10000
class Palindrome: def __init__(self, word, start, end): self.word = word self.start = int(start / 2) self.end = int(end / 2) def __str__(self): return self.word + " " + str(self.start) + " " + str(self.end) + "\n"
class Palindrome: def __init__(self, word, start, end): self.word = word self.start = int(start / 2) self.end = int(end / 2) def __str__(self): return self.word + ' ' + str(self.start) + ' ' + str(self.end) + '\n'
# -*- coding: utf-8 -*- dictTempoMusica = dict({"W":1,"H":1/2,"Q":1/4,"E":1/8,"S":1/16,"T":1/32,"X":1/64}) listSeqCompasso = list(map(str, input().split("/"))) while listSeqCompasso[0] != "*": listSeqCompasso.pop(0) listSeqCompasso.pop(-1) qntCompassoDuracaoCorreta = 0 for compasso in listSeqCompasso:...
dict_tempo_musica = dict({'W': 1, 'H': 1 / 2, 'Q': 1 / 4, 'E': 1 / 8, 'S': 1 / 16, 'T': 1 / 32, 'X': 1 / 64}) list_seq_compasso = list(map(str, input().split('/'))) while listSeqCompasso[0] != '*': listSeqCompasso.pop(0) listSeqCompasso.pop(-1) qnt_compasso_duracao_correta = 0 for compasso in listSeqCom...
def decode(message): first_4 = message[:4] first = add_ordinals(message[0], message[-1]) second = add_ordinals(message[1], message[0]) third = add_ordinals(message[2], message[1]) fourth = add_ordinals(message[3], message[2]) fifth = add_ordinals(message[-4], message[-5]) sixth = add_ordin...
def decode(message): first_4 = message[:4] first = add_ordinals(message[0], message[-1]) second = add_ordinals(message[1], message[0]) third = add_ordinals(message[2], message[1]) fourth = add_ordinals(message[3], message[2]) fifth = add_ordinals(message[-4], message[-5]) sixth = add_ordinal...
_empty = [] _simple = [1, 2, 3] _complex = [{"value": 1}, {"value": 2}, {"value": 3}] _locations = [ ("Scotland", "Edinburgh", "Branch1", 20000), ("Scotland", "Glasgow", "Branch1", 12500), ("Scotland", "Glasgow", "Branch2", 12000), ("Wales", "Cardiff", "Branch1", 29700), ("Wales", "Cardiff", "Branc...
_empty = [] _simple = [1, 2, 3] _complex = [{'value': 1}, {'value': 2}, {'value': 3}] _locations = [('Scotland', 'Edinburgh', 'Branch1', 20000), ('Scotland', 'Glasgow', 'Branch1', 12500), ('Scotland', 'Glasgow', 'Branch2', 12000), ('Wales', 'Cardiff', 'Branch1', 29700), ('Wales', 'Cardiff', 'Branch2', 30000), ('Wales',...
MYSQL_DB = 'edxapp' MYSQL_USER = 'root' MYSQL_PSWD = '' MONGO_DB = 'edxapp' MONGO_DISCUSSION_DB = 'cs_comments_service_development'
mysql_db = 'edxapp' mysql_user = 'root' mysql_pswd = '' mongo_db = 'edxapp' mongo_discussion_db = 'cs_comments_service_development'
# coding: utf-8 class DataBatch: def __init__(self, torch_module): self._data = [] self._label = [] self.torch_module = torch_module def append_data(self, new_data): self._data.append(self.__as_tensor(new_data)) def append_label(self, new_label): self._label.appen...
class Databatch: def __init__(self, torch_module): self._data = [] self._label = [] self.torch_module = torch_module def append_data(self, new_data): self._data.append(self.__as_tensor(new_data)) def append_label(self, new_label): self._label.append(self.__as_tenso...
def find(A): low = 0 high = len(A) - 1 while low < high: mid = (low + high) // 2 if A[mid] > A[high]: low = mid + 1 elif A[mid] <= A[high]: high = mid return low A = [4, 5, 6, 7, 1, 2, 3] idx = find(A) print(A[idx])
def find(A): low = 0 high = len(A) - 1 while low < high: mid = (low + high) // 2 if A[mid] > A[high]: low = mid + 1 elif A[mid] <= A[high]: high = mid return low a = [4, 5, 6, 7, 1, 2, 3] idx = find(A) print(A[idx])
class ladder: def __init__(self): self.start=0 self.end=0
class Ladder: def __init__(self): self.start = 0 self.end = 0
#$Id: embed_pythonLib.py,v 1.3 2010/10/05 19:24:18 jrb Exp $ def generate(env, **kw): if not kw.get('depsOnly',0): env.Tool('addLibrary', library = ['embed_python']) if env['PLATFORM'] == 'posix': env.AppendUnique(LINKFLAGS = ['-rdynamic']) if env['PLATFORM'] == "win32" and env.get('CONTAIN...
def generate(env, **kw): if not kw.get('depsOnly', 0): env.Tool('addLibrary', library=['embed_python']) if env['PLATFORM'] == 'posix': env.AppendUnique(LINKFLAGS=['-rdynamic']) if env['PLATFORM'] == 'win32' and env.get('CONTAINERNAME', '') == 'GlastRelease': env.Tool('findPkgPath', p...
# -*- coding: utf-8 -*- # Copyright by BlueWhale. All Rights Reserved. class ValidateError(ValueError): def __init__(self, val, msg: str, *args): super().__init__(val, msg, *args) self.__val = val self.__msg = msg @property def val(self): return self.__val @property ...
class Validateerror(ValueError): def __init__(self, val, msg: str, *args): super().__init__(val, msg, *args) self.__val = val self.__msg = msg @property def val(self): return self.__val @property def msg(self): return self.__msg class Fieldseterror(Runtime...
def setup(): #this is your canvas size size(1000,1000) #fill(34,45,56,23) #background(192, 64, 0) stroke(255) colorMode(RGB) strokeWeight(1) #rect(150,150,150,150) def draw(): x=mouseX y=mouseY ix=width-x iy=height-y px=pmouseX py=pmouseY ...
def setup(): size(1000, 1000) stroke(255) color_mode(RGB) stroke_weight(1) def draw(): x = mouseX y = mouseY ix = width - x iy = height - y px = pmouseX py = pmouseY background(0, 0, 0) stroke_weight(5) line(x, y, ix, iy) stroke_weight(120) point(40, x) i...
def binary_search(coll, elem): low = 0 high = len(coll) - 1 while low <= high: middle = (low + high) // 2 guess = coll[middle] if guess == elem: return middle if guess > elem: high = middle - 1 else: low = middle + 1 return N...
def binary_search(coll, elem): low = 0 high = len(coll) - 1 while low <= high: middle = (low + high) // 2 guess = coll[middle] if guess == elem: return middle if guess > elem: high = middle - 1 else: low = middle + 1 return None...
# Time Complexity => O(n^2 + log n) ; log n for sorting class Solution: def threeSum(self, nums: List[int]) -> List[List[int]]: output = [] nums.sort() for i in range(len(nums)-2): if i>0 and nums[i]==nums[i-1]: continue j = i+1 k = len(nu...
class Solution: def three_sum(self, nums: List[int]) -> List[List[int]]: output = [] nums.sort() for i in range(len(nums) - 2): if i > 0 and nums[i] == nums[i - 1]: continue j = i + 1 k = len(nums) - 1 while j < k: ...
# input 3 number and calculate middle number def Middle_3Num_Calc(a, b, c): if a >= b: if b >= c: return b elif a <= c: return a else: return c elif a > c: return a elif b > c: return c else: return b def Middle_3Num_C...
def middle_3_num__calc(a, b, c): if a >= b: if b >= c: return b elif a <= c: return a else: return c elif a > c: return a elif b > c: return c else: return b def middle_3_num__calc_ver2(a, b, c): if b >= a and c <= ...
# -*- coding: utf-8 -*- class Null(object): def __init__(self, *args, **kwargs): return None def __call__(self, *args, **kwargs): return self def __getattr__(self, name): return self def __setattr__(self, name, value): return self def __delattr__(self, name): ...
class Null(object): def __init__(self, *args, **kwargs): return None def __call__(self, *args, **kwargs): return self def __getattr__(self, name): return self def __setattr__(self, name, value): return self def __delattr__(self, name): return self de...
batch_size = 32 epochs = 200 lr = 0.01 momentum = 0.9 no_cuda =False cuda_id = '0' seed = 1 log_interval = 10 l2_decay = 5e-4 class_num = 31 param = 0.3 bottle_neck = True root_path = "/data/zhuyc/OFFICE31/" source_name = "dslr" target_name = "amazon"
batch_size = 32 epochs = 200 lr = 0.01 momentum = 0.9 no_cuda = False cuda_id = '0' seed = 1 log_interval = 10 l2_decay = 0.0005 class_num = 31 param = 0.3 bottle_neck = True root_path = '/data/zhuyc/OFFICE31/' source_name = 'dslr' target_name = 'amazon'
def solution(record): Change = "Change" entry = {"Enter": " entered .", "Leave": " left." } recs = [] for r in record: r = r.split(" ") recs.append(r) # Change user id for all record first. for r in recs: uid = "" nickname = "" if (Chang...
def solution(record): change = 'Change' entry = {'Enter': ' entered .', 'Leave': ' left.'} recs = [] for r in record: r = r.split(' ') recs.append(r) for r in recs: uid = '' nickname = '' if Change in r: uid = r[1] nickname = r[2] ...
with open("input4.txt") as f: raw = f.read() pp = raw.split("\n\n") ppd = list() for p in pp: p = p.replace("\n", " ") p = p.strip() if not p: continue pairs = p.split(" ") ppd.append({s.split(":")[0]: s.split(":")[1] for s in pairs}) def isvalid(p): if not {"byr", "iyr", "eyr", ...
with open('input4.txt') as f: raw = f.read() pp = raw.split('\n\n') ppd = list() for p in pp: p = p.replace('\n', ' ') p = p.strip() if not p: continue pairs = p.split(' ') ppd.append({s.split(':')[0]: s.split(':')[1] for s in pairs}) def isvalid(p): if not {'byr', 'iyr', 'eyr', 'hg...
class Block(object): def __init__(self, block): self.block = block def get_block(self): return self.block def set_block(self, new_block): self.block = new_block
class Block(object): def __init__(self, block): self.block = block def get_block(self): return self.block def set_block(self, new_block): self.block = new_block
# Author: Nic Wolfe <nic@wolfeden.ca> # URL: http://code.google.com/p/sickbeard/ # # This file is part of Sick Beard. # # Sick Beard is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Lice...
ep_regexes = [('standard_repeat', '\n ^(?P<series_name>.+?)[. _-]+ # Show_Name and separator\n s(?P<season_num>\\d+)[. _-]* # S01 and optional separator\n e(?P<ep_num>\\d+) # E02 and separator\n ([. _-]+s(?...
''' Problem 48 @author: Kevin Ji ''' def self_power_with_mod(number, mod): product = 1 for _ in range(number): product *= number product %= mod return product MOD = 10000000000 number = 0 for power in range(1, 1000 + 1): number += self_power_with_mod(power, MOD) number %= MOD ...
""" Problem 48 @author: Kevin Ji """ def self_power_with_mod(number, mod): product = 1 for _ in range(number): product *= number product %= mod return product mod = 10000000000 number = 0 for power in range(1, 1000 + 1): number += self_power_with_mod(power, MOD) number %= MOD print...
# Code for demo_03 def captureInfoCam(): GPIO.setwarnings(False) # Ignore warning for now GPIO.setmode(GPIO.BOARD) # Use physical pin numbering subprocess.call(['fswebcam -r 640x480 --no-banner /home/pi/Desktop/image.jpg', '-1'], shell=True) #Azure face_uri = "https://raspberr...
def capture_info_cam(): GPIO.setwarnings(False) GPIO.setmode(GPIO.BOARD) subprocess.call(['fswebcam -r 640x480 --no-banner /home/pi/Desktop/image.jpg', '-1'], shell=True) face_uri = 'https://raspberrycp.cognitiveservices.azure.com/vision/v1.0/analyze?visualFeatures=Faces&language=en' path_to_file_in...
wagons = int(input()) wagons_list = [0 for _ in range(wagons)] command = input().split() while "End" not in command: if "add" in command: wagons_list[-1] += int(command[1]) elif "insert" in command: wagons_list[int(command[1])] += int(command[2]) elif "leave" in command: wagons_list...
wagons = int(input()) wagons_list = [0 for _ in range(wagons)] command = input().split() while 'End' not in command: if 'add' in command: wagons_list[-1] += int(command[1]) elif 'insert' in command: wagons_list[int(command[1])] += int(command[2]) elif 'leave' in command: wagons_list[...
# -------------- ##File path for the file file_path def read_file(path): file = open(file_path, 'r') sentence = file.readline() file.close() return sentence sample_message = read_file(file_path) # -------------- #Code starts here #Function to fuse message def fuse_msg(message_a,me...
file_path def read_file(path): file = open(file_path, 'r') sentence = file.readline() file.close() return sentence sample_message = read_file(file_path) def fuse_msg(message_a, message_b): quot = int(message_b) // int(message_a) return str(quot) message_1 = read_file(file_path_1) print(message...
# 3.uzdevums my_name = str(input('Enter sentence ')) words = my_name.split() rev_list = [word[::-1] for word in words] rev_string=" ".join(rev_list) result=rev_string.capitalize() print(result) print(" ".join([w[::-1] for w in my_name.split()]).capitalize())
my_name = str(input('Enter sentence ')) words = my_name.split() rev_list = [word[::-1] for word in words] rev_string = ' '.join(rev_list) result = rev_string.capitalize() print(result) print(' '.join([w[::-1] for w in my_name.split()]).capitalize())
# def math(num1, num2, operation='add'): # if(operation == "mult"): # return num1 * num2 # if(operation == "div"): # return num1 / num2 # if(operation == "sub"): # return num1 - num2 # if(operation == "add"): # return num1 + num2 # else: # print("not a valid o...
def multiply(num1, num2): return num1 * num2 y = multiply(10, 20) print(y)
def binary_search(arr, target): low, high = 0, len(arr)-1 while low < high: mid = (low + high)/2 if arr[mid] == target: return mid elif arr[mid] > target: high = mid - 1 else: low = mid + 1 try: if arr[high] == target: return high else: return -1 except Ind...
def binary_search(arr, target): (low, high) = (0, len(arr) - 1) while low < high: mid = (low + high) / 2 if arr[mid] == target: return mid elif arr[mid] > target: high = mid - 1 else: low = mid + 1 try: if arr[high] == target: ...
MOD_ID = 'id' MOD_RGB = 'rgb' MOD_SS_DENSE = 'semseg_dense' MOD_SS_CLICKS = 'semseg_clicks' MOD_SS_SCRIBBLES = 'semseg_scribbles' MOD_VALIDITY = 'validity_mask' SPLIT_TRAIN = 'train' SPLIT_VALID = 'val' MODE_INTERP = { MOD_ID: None, MOD_RGB: 'bilinear', MOD_SS_DENSE: 'nearest', MOD_SS_CLICKS: 'sparse...
mod_id = 'id' mod_rgb = 'rgb' mod_ss_dense = 'semseg_dense' mod_ss_clicks = 'semseg_clicks' mod_ss_scribbles = 'semseg_scribbles' mod_validity = 'validity_mask' split_train = 'train' split_valid = 'val' mode_interp = {MOD_ID: None, MOD_RGB: 'bilinear', MOD_SS_DENSE: 'nearest', MOD_SS_CLICKS: 'sparse', MOD_SS_SCRIBBLES:...
nmbr = 3 if nmbr % 2 == 0: print("%d is even" % nmbr) elif nmbr == 0: print("%d is zero" % nmbr) else: print("%d is odd" % nmbr) free = "free"; print("I am free") if free == "free" else print("I am not free") # Nested Conditions nmbr = 4 if nmbr % 2 == 0: if nmbr % 4 == 0: print("I can pas...
nmbr = 3 if nmbr % 2 == 0: print('%d is even' % nmbr) elif nmbr == 0: print('%d is zero' % nmbr) else: print('%d is odd' % nmbr) free = 'free' print('I am free') if free == 'free' else print('I am not free') nmbr = 4 if nmbr % 2 == 0: if nmbr % 4 == 0: print('I can pass all the condititions!') i...
DEBUG = True SECRET_KEY = 'topsecret' #SQLALCHEMY_DATABASE_URI = 'postgresql://yazhu:root@localhost/matcha' # SQLALCHEMY_DATABASE_URI = 'postgresql://jchung:@localhost/matcha' SQLALCHEMY_DATABASE_URI = 'postgresql://root:1234@localhost/matcha' SQLALCHEMY_TRACK_MODIFICATIONS = False ACCOUNT_ACTIVATION = False ROOT_URL ...
debug = True secret_key = 'topsecret' sqlalchemy_database_uri = 'postgresql://root:1234@localhost/matcha' sqlalchemy_track_modifications = False account_activation = False root_url = 'localhost:5000' redirect_http = False
PURCHASE_NO_CLIENT_STATE = 0 PURCHASE_WAITING_STATE = 1 PURCHASE_PLAYAGAIN_STATE = 2 PURCHASE_EXIT_STATE = 3 PURCHASE_DISCONNECTED_STATE = 4 PURCHASE_UNREPORTED_STATE = 10 PURCHASE_REPORTED_STATE = 11 PURCHASE_CANTREPORT_STATE = 12 PURCHASE_COUNTDOWN_TIME = 120
purchase_no_client_state = 0 purchase_waiting_state = 1 purchase_playagain_state = 2 purchase_exit_state = 3 purchase_disconnected_state = 4 purchase_unreported_state = 10 purchase_reported_state = 11 purchase_cantreport_state = 12 purchase_countdown_time = 120
# 14. Write a program in Python to calculate the volume of a sphere rad=int(input("Enter radius of the sphere: ")) vol=(4/3)*3.14*(rad**3) print("Volume of the sphere= ",vol)
rad = int(input('Enter radius of the sphere: ')) vol = 4 / 3 * 3.14 * rad ** 3 print('Volume of the sphere= ', vol)
''' Created on Aug 10, 2017 @author: Itai Agmon ''' class ReportElementType(): REGULAR = "regular" LINK = "lnk" IMAGE = "img" HTML = "html" STEP = "step" START_LEVEL = "startLevel" STOP_LEVEL = "stopLevel" class ReportElementStatus(): SUCCESS = "success" WARNING = "warning" FA...
""" Created on Aug 10, 2017 @author: Itai Agmon """ class Reportelementtype: regular = 'regular' link = 'lnk' image = 'img' html = 'html' step = 'step' start_level = 'startLevel' stop_level = 'stopLevel' class Reportelementstatus: success = 'success' warning = 'warning' failur...
{ "targets": [ { "target_name": "strings", "sources": ["main.cpp"], "cflags": ["-Wall", "-Wextra", "-ansi", "-O3"], "include_dirs" : ["<!(node -e \"require('nan')\")"] } ] }
{'targets': [{'target_name': 'strings', 'sources': ['main.cpp'], 'cflags': ['-Wall', '-Wextra', '-ansi', '-O3'], 'include_dirs': ['<!(node -e "require(\'nan\')")']}]}
class Solution: def groupAnagrams(self, strs: List[str]) -> List[List[str]]: anagrams = {} for str in strs: key = ''.join(sorted(str)) if key not in anagrams: anagrams[key] = [] anagrams[key].append(str) return list(anagrams.values())
class Solution: def group_anagrams(self, strs: List[str]) -> List[List[str]]: anagrams = {} for str in strs: key = ''.join(sorted(str)) if key not in anagrams: anagrams[key] = [] anagrams[key].append(str) return list(anagrams.values())
class Car: # Class-level wheels = 4 def __init__(self, manufacturer: str, model: str, color: str, mileage: int): # Instance-level self.manufacturer = manufacturer self.model = model self.color = color self.mileage = mileage # Method def add_mileage(self, mil...
class Car: wheels = 4 def __init__(self, manufacturer: str, model: str, color: str, mileage: int): self.manufacturer = manufacturer self.model = model self.color = color self.mileage = mileage def add_mileage(self, miles: int) -> str: self.mileage += miles p...
def gcd(a, b): while b != 0: a, b = b, a % b return a def lcm(a, b, g): return a * b // g A, B = (int(term) for term in input().split()) g = gcd(A, B) print(g) print(lcm(A, B, g))
def gcd(a, b): while b != 0: (a, b) = (b, a % b) return a def lcm(a, b, g): return a * b // g (a, b) = (int(term) for term in input().split()) g = gcd(A, B) print(g) print(lcm(A, B, g))
def solution(a, b): answer = 0 for x,y in zip(a,b): answer+=x*y return answer
def solution(a, b): answer = 0 for (x, y) in zip(a, b): answer += x * y return answer
AVAILABLE_OPTIONS = [('doc_m2m_prob_threshold', 'Probability threshold for showing document to mass2motif links'), ('doc_m2m_overlap_threshold', 'Threshold on overlap score for showing document to mass2motif links'), ('log_peakset_intensities', 'Whether or not to log the peakset intensities (...
available_options = [('doc_m2m_prob_threshold', 'Probability threshold for showing document to mass2motif links'), ('doc_m2m_overlap_threshold', 'Threshold on overlap score for showing document to mass2motif links'), ('log_peakset_intensities', 'Whether or not to log the peakset intensities (true,false)'), ('heatmap_mi...
phi, d, t, coll = input().split() phi = float(phi) phi_1 = phi - 0.01 phi_2 = phi + 0.01 print(str(phi) + " " + "0.00001" + " " + "0.1 " + str(t) + " 10 20")
(phi, d, t, coll) = input().split() phi = float(phi) phi_1 = phi - 0.01 phi_2 = phi + 0.01 print(str(phi) + ' ' + '0.00001' + ' ' + '0.1 ' + str(t) + ' 10 20')
class usuario(object): def __init__(self, nombre, apellido, edad, genero): self.nombre = nombre self.apellido = apellido self.edad = edad self.genero = genero def descripcion_usuario(self): print("Nombre: " + self.nombre.title() + "\nApellido: " + self.apellido.title() +...
class Usuario(object): def __init__(self, nombre, apellido, edad, genero): self.nombre = nombre self.apellido = apellido self.edad = edad self.genero = genero def descripcion_usuario(self): print('Nombre: ' + self.nombre.title() + '\nApellido: ' + self.apellido.title() ...
class Class1(object): def __init__(self): pass def test1(self): return 5 class Class2(object): def test1(self): return 6 class Class3(object): def test1(self, x): return self.test2(x)-1 def test2(self, x): return 2*x a = Class1() print(a.test1()) a = ...
class Class1(object): def __init__(self): pass def test1(self): return 5 class Class2(object): def test1(self): return 6 class Class3(object): def test1(self, x): return self.test2(x) - 1 def test2(self, x): return 2 * x a = class1() print(a.test1()) a ...
class Tee: def __init__(self, f, f_tee): self.f = f self.f_tee = f_tee def read(self, nbytes): buf = self.f.read(nbytes) self.f_tee.write(buf) return buf def write(self, buf): self.f_tee.write(buf) self.f.write(buf) def flush(self): self...
class Tee: def __init__(self, f, f_tee): self.f = f self.f_tee = f_tee def read(self, nbytes): buf = self.f.read(nbytes) self.f_tee.write(buf) return buf def write(self, buf): self.f_tee.write(buf) self.f.write(buf) def flush(self): sel...
''' This is all the calculation for the main window '''
""" This is all the calculation for the main window """
__title__ = 'lottus' __description__ = 'An ussd library that will save you time' __version__ = '0.0.4' __author__ = 'Benjamim Chambule' __author_email__ = 'benchambule@gmail.com' __license__ = 'MIT' __copyright__ = 'Copyright 2021 Benjamim Chambule'
__title__ = 'lottus' __description__ = 'An ussd library that will save you time' __version__ = '0.0.4' __author__ = 'Benjamim Chambule' __author_email__ = 'benchambule@gmail.com' __license__ = 'MIT' __copyright__ = 'Copyright 2021 Benjamim Chambule'
extra_annotations = \ { 'ai': [ 'artificial intelligence', 'machine learning', 'statistical learning', 'statistical model', 'supervised model', 'unsupervised model', 'computer vision', 'image analysis', 'object recognistion', 'object detection', 'image segmentation', 'deep learni...
extra_annotations = {'ai': ['artificial intelligence', 'machine learning', 'statistical learning', 'statistical model', 'supervised model', 'unsupervised model', 'computer vision', 'image analysis', 'object recognistion', 'object detection', 'image segmentation', 'deep learning', 'cognitive computing', 'neural network'...
num = int(input()) numdict = { 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine' } print(numdict.get(num, 'number too big'))
num = int(input()) numdict = {1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine'} print(numdict.get(num, 'number too big'))
class Rational: def __init__(self, p, q): self.numerator = p self.denominator = q def __mul__(self, other): return Rational( self.numerator * other.numerator, self.denominator * other.denominator ) def __str__(self): return f"{self.numera...
class Rational: def __init__(self, p, q): self.numerator = p self.denominator = q def __mul__(self, other): return rational(self.numerator * other.numerator, self.denominator * other.denominator) def __str__(self): return f'{self.numerator}/{self.denominator}' r0 = rationa...
# -*- coding: utf-8 -*- db.define_table('Device', Field('device_id', 'string'), Field('device_name', 'string'), Field('model', 'string'), Field('location', 'string') ) db.Device.device_id.requires = [IS_NOT_EMPTY(),IS_NOT_IN_DB(db, 'Device...
db.define_table('Device', field('device_id', 'string'), field('device_name', 'string'), field('model', 'string'), field('location', 'string')) db.Device.device_id.requires = [is_not_empty(), is_not_in_db(db, 'Device.device_id')] db.Device.device_name.requires = is_not_empty() db.define_table('User_Device', field('user_...
lista = [1753, 1858, 1860, 1978, 1758, 1847, 2010, 1679, 1222, 1723, 1592, 1992, 1865, 1635, 1692, 1653, 1485, 848, 1301, 1818, 1872, 1883, 1464, 2002, 1736, 1821, 1851, 1299, 1627, 1698, 1713, 1676, 1673, 1448, 1939, 1506, 1896, 1710, 1677, 1894, 1645, 1454, 1972, 1687, 265, 1923, 1666, 1761, 1386, 2006, 1463, 1759, 1...
lista = [1753, 1858, 1860, 1978, 1758, 1847, 2010, 1679, 1222, 1723, 1592, 1992, 1865, 1635, 1692, 1653, 1485, 848, 1301, 1818, 1872, 1883, 1464, 2002, 1736, 1821, 1851, 1299, 1627, 1698, 1713, 1676, 1673, 1448, 1939, 1506, 1896, 1710, 1677, 1894, 1645, 1454, 1972, 1687, 265, 1923, 1666, 1761, 1386, 2006, 1463, 1759, 1...
class helloworld: def hello(self): print("This is my first task !") def run(): helloworld().hello()
class Helloworld: def hello(self): print('This is my first task !') def run(): helloworld().hello()
# dp class Solution: def lengthOfLIS(self, nums: 'List[int]') -> 'int': if len(nums) < 2: return len(nums) dp = [1] * (len(nums) + 1) for i in range(1, len(nums)): for j in range(0, i): if nums[i] > nums[j]: dp[i] = max(dp[i], dp[j] + 1) return max(dp)
class Solution: def length_of_lis(self, nums: 'List[int]') -> 'int': if len(nums) < 2: return len(nums) dp = [1] * (len(nums) + 1) for i in range(1, len(nums)): for j in range(0, i): if nums[i] > nums[j]: dp[i] = max(dp[i], dp[j] +...
''' Dict with attr access to keys. Usage: pip install adict from adict import adict d = adict(a=1) assert d.a == d['a'] == 1 See all features, including ajson() in adict.py:test(). adict version 0.1.7 Copyright (C) 2013-2015 by Denis Ryzhkov <denisr@denisr.com> MIT License, see http://opensource.or...
""" Dict with attr access to keys. Usage: pip install adict from adict import adict d = adict(a=1) assert d.a == d['a'] == 1 See all features, including ajson() in adict.py:test(). adict version 0.1.7 Copyright (C) 2013-2015 by Denis Ryzhkov <denisr@denisr.com> MIT License, see http://opensource.or...
while True: n = int(input()) if n == 0: break x, y = [int(g) for g in str(input()).split()] for j in range(n): a, b = [int(g) for g in str(input()).split()] if a == x or b == y: print('divisa') else: if x < a: if y < b: print('NE') else...
while True: n = int(input()) if n == 0: break (x, y) = [int(g) for g in str(input()).split()] for j in range(n): (a, b) = [int(g) for g in str(input()).split()] if a == x or b == y: print('divisa') elif x < a: if y < b: print('NE') ...
''' - Leetcode problem: 98 - Difficulty: Medium - Brief problem description: Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only nodes with keys less than the node's key. The right subtree of a node contains only nod...
""" - Leetcode problem: 98 - Difficulty: Medium - Brief problem description: Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only nodes with keys less than the node's key. The right subtree of a node contains only nod...
class TapeEnvWrapper: def __init__(self, env): self.__env = env self.__factors = self.__get_factors() def reset(self): return self.__env.reset() def step(self, action): action = self.__undiscretise(action) next_state, reward, done, info = self.__env.step(action) ...
class Tapeenvwrapper: def __init__(self, env): self.__env = env self.__factors = self.__get_factors() def reset(self): return self.__env.reset() def step(self, action): action = self.__undiscretise(action) (next_state, reward, done, info) = self.__env.step(action) ...
class Solution: def solve(self, n): if n == 0: return '0' remainders = [] while n: n, r = divmod(n, 3) remainders.append(str(r)) return ''.join(reversed(remainders))
class Solution: def solve(self, n): if n == 0: return '0' remainders = [] while n: (n, r) = divmod(n, 3) remainders.append(str(r)) return ''.join(reversed(remainders))
# # PySNMP MIB module CISCO-ITP-GSP2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ITP-GSP2-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:03:31 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, value_size_constraint, constraints_union, single_value_constraint) ...
{ 'targets': [ { 'target_name': 'discount', 'dependencies': [ 'libmarkdown' ], 'sources': [ 'src/discount.cc' ], 'include_dirs': [ 'deps/discount' ], 'libraries': [ 'deps/disco...
{'targets': [{'target_name': 'discount', 'dependencies': ['libmarkdown'], 'sources': ['src/discount.cc'], 'include_dirs': ['deps/discount'], 'libraries': ['deps/discount/libmarkdown.a']}, {'target_name': 'libmarkdown', 'type': 'none', 'actions': [{'action_name': 'build_libmarkdown', 'inputs': ['deps/discount/Csio.c', '...
class BTNode: def __init__(self, data = -1, left = None, right = None): self.data = data self.left = left self.right = right class BTree: def __init__(self): self.root = None self.is_comp = True self.num = 0 def is_empty(self): return self.root is Non...
class Btnode: def __init__(self, data=-1, left=None, right=None): self.data = data self.left = left self.right = right class Btree: def __init__(self): self.root = None self.is_comp = True self.num = 0 def is_empty(self): return self.root is None ...
# Calculating Page rank. class Graph(): def __init__(self): self.linked_node_map = {} self.PR_map = {} def add_node(self, node_id): if node_id not in self.linked_node_map: self.linked_node_map[node_id] = [] self.PR_map[node_id] = 0 def add_link(self, node1, ...
class Graph: def __init__(self): self.linked_node_map = {} self.PR_map = {} def add_node(self, node_id): if node_id not in self.linked_node_map: self.linked_node_map[node_id] = [] self.PR_map[node_id] = 0 def add_link(self, node1, node2, v): if node...
class NavigationValues: navigation_distance = None navigation_time = None speed_limit = None class Movement: value = None kph = None mph = None def calculate_speed(self): self.kph = self.value * 3.6 self.mph = self.value * 2.25 def __init__(...
class Navigationvalues: navigation_distance = None navigation_time = None speed_limit = None class Movement: value = None kph = None mph = None def calculate_speed(self): self.kph = self.value * 3.6 self.mph = self.value * 2.25 def __init__(...
def is_phone_valid(phone: str) -> bool: if ( phone.isnumeric() and phone.startswith(("6", "7", "8", "9")) and len(phone) == 10 ): return True return False
def is_phone_valid(phone: str) -> bool: if phone.isnumeric() and phone.startswith(('6', '7', '8', '9')) and (len(phone) == 10): return True return False
panjang = int(raw_input("masukan panjang: ")) lebar = int(raw_input("masukan lebar: ")) tinggi = int(raw_input("masukan tinggi: ")) volume = panjang * lebar * tinggi print(volume)
panjang = int(raw_input('masukan panjang: ')) lebar = int(raw_input('masukan lebar: ')) tinggi = int(raw_input('masukan tinggi: ')) volume = panjang * lebar * tinggi print(volume)
class Node: def __init__(self,data): self.data = data self.left = self.right = None def findPreSuc(root, key): # Base Case if root is None: return # If key is present at root if root.data == key: # the maximum value in left subtree is predecessor if ro...
class Node: def __init__(self, data): self.data = data self.left = self.right = None def find_pre_suc(root, key): if root is None: return if root.data == key: if root.left is not None: tmp = root.left while tmp.right: tmp = tmp.right ...
STUDENT_NUMBER_STOP = 999 def parse_correct_answers(record): return record.split(" ") def parse_student_answers(record): parsed = record.split(" ") student = int(parsed[0]) if len(parsed) == 1: return (student, None) else: return (student, parsed[1:]) def calculate_marks(correct,...
student_number_stop = 999 def parse_correct_answers(record): return record.split(' ') def parse_student_answers(record): parsed = record.split(' ') student = int(parsed[0]) if len(parsed) == 1: return (student, None) else: return (student, parsed[1:]) def calculate_marks(correct, ...
# Copyright 2021 The Fraud Detection Framework Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
request_timeout = (60, 180) message_type_info = 5 message_type_warning = 4 message_type_error = 3 db_connection_string = 'postgresql://postgres:password@localhost:5432/fdf' exception_wait_sec = 5 setting_status_name = 'status' setting_status_processing = 'processing' setting_status_stopped = 'stopped' setting_status_re...
def czynniki_pierwsze(num: int) -> []: factors = [] k = 2 while num > 1: while num % k == 0: factors.append(k) num = num // k k = k + 1 return factors
def czynniki_pierwsze(num: int) -> []: factors = [] k = 2 while num > 1: while num % k == 0: factors.append(k) num = num // k k = k + 1 return factors
versions = {} def get_by_vid(vid): return versions[vid] def get_by_package(package, version_mode, vid): if not in_cache(package, version_mode, vid): return None return versions[vid][package + version_mode] def in_cache(package, version_mode, vid): package_str = package + version_mode return vid in ve...
versions = {} def get_by_vid(vid): return versions[vid] def get_by_package(package, version_mode, vid): if not in_cache(package, version_mode, vid): return None return versions[vid][package + version_mode] def in_cache(package, version_mode, vid): package_str = package + version_mode retu...
#Linear Search class LinearSerach: def __init__(self): self.elements = [10,52,14,8,1,400,900,200,2,0] def SearchEm(self,elem): y = 0 if elem in self.elements: print("{x} is in the position of {y}".format(x = elem,y = self.elements.index(elem))) else: ...
class Linearserach: def __init__(self): self.elements = [10, 52, 14, 8, 1, 400, 900, 200, 2, 0] def search_em(self, elem): y = 0 if elem in self.elements: print('{x} is in the position of {y}'.format(x=elem, y=self.elements.index(elem))) else: print('The...
for t in range(int(input())): L=list(map(int,input().split())) sum=0 for i in L: if i<40: sum+=40 else : sum+=i print(f"#{t+1} {sum//5}")
for t in range(int(input())): l = list(map(int, input().split())) sum = 0 for i in L: if i < 40: sum += 40 else: sum += i print(f'#{t + 1} {sum // 5}')
class AgeBean: def __init__(self, judgement_id=0, age=''): self._judgement_id = judgement_id self._age = age @property def judgement_id(self): return int(self.judgement_id) @judgement_id.setter def judgement_id(self, id): self._judgement_id = id ...
class Agebean: def __init__(self, judgement_id=0, age=''): self._judgement_id = judgement_id self._age = age @property def judgement_id(self): return int(self.judgement_id) @judgement_id.setter def judgement_id(self, id): self._judgement_id = id @property ...
def reverse(head): cur = head pre = None while cur: nxt = cur.next cur.next = pre cur.pre = nxt pre = cur cur = nxt return pre
def reverse(head): cur = head pre = None while cur: nxt = cur.next cur.next = pre cur.pre = nxt pre = cur cur = nxt return pre
names = ['Anddy', 'Christian', 'Lucero', 'Yamile', 'Evelyn'] print(names) print(names[0]) print(names[0:2]) # numbers = [6, 2, 3, 45, 23, 3, 4, 55, 3, 2, 4456, 7, 98, 6, 64, 4, 321, 4, 323, 6, 68, 2, 2, 12, 4, 5] largeNumber = numbers[0] for number in numbers: if number > largeNumber: largeNumber = numb...
names = ['Anddy', 'Christian', 'Lucero', 'Yamile', 'Evelyn'] print(names) print(names[0]) print(names[0:2]) numbers = [6, 2, 3, 45, 23, 3, 4, 55, 3, 2, 4456, 7, 98, 6, 64, 4, 321, 4, 323, 6, 68, 2, 2, 12, 4, 5] large_number = numbers[0] for number in numbers: if number > largeNumber: large_number = number p...
class placeholder_optimizer(object): done=False self_managing=False def __init__(self,max_iter): self.max_iter=max_iter def update(self): pass
class Placeholder_Optimizer(object): done = False self_managing = False def __init__(self, max_iter): self.max_iter = max_iter def update(self): pass
# # Copyright (c) 2017-2018 Joy Diamond. All rights reserved. # @gem('Sapphire.LineMarker') def gem(): def construct_token__line_marker__many(t, s, newlines): assert (t.ends_in_newline is t.line_marker is true) and (newlines > 1) t.s = s t.newlines = newlines class LineMarke...
@gem('Sapphire.LineMarker') def gem(): def construct_token__line_marker__many(t, s, newlines): assert t.ends_in_newline is t.line_marker is true and newlines > 1 t.s = s t.newlines = newlines class Linemarker(PearlToken): class_order = CLASS_ORDER__LINE_MARKER display_n...
casos = int(input()) dentro = 0 fora = 0 for i in range(casos): num = int(input()) if num >= 10 and num <= 20: dentro += 1 else: fora += 1 print('{} in\n{} out'.format(dentro, fora))
casos = int(input()) dentro = 0 fora = 0 for i in range(casos): num = int(input()) if num >= 10 and num <= 20: dentro += 1 else: fora += 1 print('{} in\n{} out'.format(dentro, fora))
#https://www.hackerrank.com/challenges/quicksort2 ''' def quickSort(ar): if len(ar) <2 : # 0 or 1 return(ar) else: p = ar[0] less = [] more = [] for item in ar[1:]: if item < p: less.append(item) else: m...
""" def quickSort(ar): if len(ar) <2 : # 0 or 1 return(ar) else: p = ar[0] less = [] more = [] for item in ar[1:]: if item < p: less.append(item) else: more.append(item) l = quickSort(less) m = quickS...
class User: def __init__(self,username,password): self.is_authenticated = False self.username = username self.password = password
class User: def __init__(self, username, password): self.is_authenticated = False self.username = username self.password = password
def add(x): def do_add(y): return x + y return do_add add_to_five = add(5) # print(add_to_five(7)) # print(add(5)(3)) def Person(name, age): def print_hello(): print('Hello! My name is {}'.format(name)) def get_age(): return age return {'print_hello': print_hello, 'ge...
def add(x): def do_add(y): return x + y return do_add add_to_five = add(5) def person(name, age): def print_hello(): print('Hello! My name is {}'.format(name)) def get_age(): return age return {'print_hello': print_hello, 'get_age': get_age} john = person('John', 32) john...
class Solution: def largestDivisibleSubset(self, nums: List[int]) -> List[int]: nums.sort() n=len(nums) if n==0: return [] dp=[[i,1] for i in range(n)] last=0 maxm=0 for i in range(1,n): for j in range(i-1,-1,-1): if num...
class Solution: def largest_divisible_subset(self, nums: List[int]) -> List[int]: nums.sort() n = len(nums) if n == 0: return [] dp = [[i, 1] for i in range(n)] last = 0 maxm = 0 for i in range(1, n): for j in range(i - 1, -1, -1): ...
class Book: def __init__(self, title, author, price): self.title = title self.author = author self.price = price def __str__(self): return f'{self.title} {self.author} {self.price}' def __call__(self, title, author, price): self.title = title self.author = au...
class Book: def __init__(self, title, author, price): self.title = title self.author = author self.price = price def __str__(self): return f'{self.title} {self.author} {self.price}' def __call__(self, title, author, price): self.title = title self.author = ...
class Solution: @staticmethod def naive(nums): return nums+nums
class Solution: @staticmethod def naive(nums): return nums + nums
''' Created on 25 Mar 2020 @author: bogdan ''' class s1010hy_wiki2text(object): ''' parsing wikipedia xml, extracting textual input ''' def __init__(self): ''' Constructor '''
""" Created on 25 Mar 2020 @author: bogdan """ class S1010Hy_Wiki2Text(object): """ parsing wikipedia xml, extracting textual input """ def __init__(self): """ Constructor """
# # PySNMP MIB module CISCO-HSRP-EXT-CAPABILITY (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-HSRP-EXT-CAPABILITY # Produced by pysmi-0.3.4 at Mon Apr 29 17:42:35 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3....
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, value_range_constraint, single_value_constraint, value_size_constraint) ...
master_doc = 'index' project = u'Infrastructure-Components' copyright = '2019, Frank Zickert' htmlhelp_basename = 'Infrastructure-Components-Doc' language = 'en' gettext_compact = False html_theme = 'sphinx_rtd_theme' #html_logo = 'img/logo.svg' html_theme_options = { 'logo_only': True, 'display_version': F...
master_doc = 'index' project = u'Infrastructure-Components' copyright = '2019, Frank Zickert' htmlhelp_basename = 'Infrastructure-Components-Doc' language = 'en' gettext_compact = False html_theme = 'sphinx_rtd_theme' html_theme_options = {'logo_only': True, 'display_version': False} notfound_context = {'title': 'Page ...
a, b = input().split() a = int(a[::-1]) b = int(b[::-1]) print(a if a > b else b)
(a, b) = input().split() a = int(a[::-1]) b = int(b[::-1]) print(a if a > b else b)
ENDCODER_BANK_CONTROL1 = ['ModDevice_knob0', 'ModDevice_knob1', 'ModDevice_knob2', 'ModDevice_knob3'] ENDCODER_BANK_CONTROL2 = ['ModDevice_knob4', 'ModDevice_knob5', 'ModDevice_knob6', 'ModDevice_knob7'] ENDCODER_BANKS = {'NoDevice':[ENDCODER_BANK_CONTROL1 + ['CustomParameter_'+str(index+(bank*24)) for index in range(...
endcoder_bank_control1 = ['ModDevice_knob0', 'ModDevice_knob1', 'ModDevice_knob2', 'ModDevice_knob3'] endcoder_bank_control2 = ['ModDevice_knob4', 'ModDevice_knob5', 'ModDevice_knob6', 'ModDevice_knob7'] endcoder_banks = {'NoDevice': [ENDCODER_BANK_CONTROL1 + ['CustomParameter_' + str(index + bank * 24) for index in ra...
# -*- coding: utf-8 -*- class LoginError(Exception): pass
class Loginerror(Exception): pass
''' maze block counts for horizontal and vertical dimensions''' HN = 25 VN = 25 ''' screen width and height ''' WIDTH = 600 HEIGHT = 600 ''' configurations to fit the maze size regarding the block counts and its ratio with respect to the screen size ''' HSIZE = int(WIDTH*2./3.) VSIZE = int(HEIGHT*2./3.) HOFFSET = ...
""" maze block counts for horizontal and vertical dimensions""" hn = 25 vn = 25 ' screen width and height ' width = 600 height = 600 ' configurations to fit the maze size regarding the block counts and its ratio with respect to the screen size ' hsize = int(WIDTH * 2.0 / 3.0) vsize = int(HEIGHT * 2.0 / 3.0) hoffset = i...
# md5 : 506fc4d9b83c53f867e483f9235de8f3 # sha1 : 0e90c892528abee5127e047b6ca037991267b9e0 # sha256 : 04deb949dd7601ee92a1868b2591c2829ff8d80e42511691bad64fd01374d7fe ord_names = { 733: b'mF_ld_load_ldnames', 734: b'mFt_os_mm_set_cushion', 735: b'mFt_os_resource_delete_ru_entry', 795: b'mFt_os_thread_i...
ord_names = {733: b'mF_ld_load_ldnames', 734: b'mFt_os_mm_set_cushion', 735: b'mFt_os_resource_delete_ru_entry', 795: b'mFt_os_thread_id_valid', 796: b'ASCII2HEX', 797: b'ASCII2OCTAL', 798: b'CBL_ABORT_RUN_UNIT', 799: b'CBL_ALLOC_DYN_MEM', 800: b'CBL_ALLOC_MEM', 801: b'CBL_ALLOC_SHMEM', 802: b'CBL_ALLOC_THREAD_MEM', 80...
people = int(input()) name_doc = input() grade_sum = 0 average_grade = 0 total_grade = 0 numbers = 0 while name_doc != "Finish": for x in range(people): grade = float(input()) grade_sum += grade average_grade = grade_sum / people print(f"{name_doc} - {average_grade:.2f}.") name_doc ...
people = int(input()) name_doc = input() grade_sum = 0 average_grade = 0 total_grade = 0 numbers = 0 while name_doc != 'Finish': for x in range(people): grade = float(input()) grade_sum += grade average_grade = grade_sum / people print(f'{name_doc} - {average_grade:.2f}.') name_doc =...
neopixel = Runtime.createAndStart("neopixel","NeoPixel") def startNeopixel(): neopixel.attach(i01.arduinos.get(rightPort),23,16) neopixel.setAnimation("Ironman",0,0,255,1) pinocchioLying = False def onStartSpeaking(data): if (pinocchioLying): neopixel.setAnimation("Ironman",0,255,0,1) else: ...
neopixel = Runtime.createAndStart('neopixel', 'NeoPixel') def start_neopixel(): neopixel.attach(i01.arduinos.get(rightPort), 23, 16) neopixel.setAnimation('Ironman', 0, 0, 255, 1) pinocchio_lying = False def on_start_speaking(data): if pinocchioLying: neopixel.setAnimation('Ironman', 0, 255, 0, 1)...
def pprint_matcher(node, *args, **kwargs): print(matcher_to_str(node, *args, **kwargs)) def matcher_to_str( node, indent_nr: int = 0, indent: str = " ", first_line_prefix=None ) -> str: ind = indent * indent_nr ind1 = indent * (indent_nr + 1) if first_line_prefix is None: first_line_pref...
def pprint_matcher(node, *args, **kwargs): print(matcher_to_str(node, *args, **kwargs)) def matcher_to_str(node, indent_nr: int=0, indent: str=' ', first_line_prefix=None) -> str: ind = indent * indent_nr ind1 = indent * (indent_nr + 1) if first_line_prefix is None: first_line_prefix = ind ...
class model4: def __getattr__(self,x): var_name = 'var_'+x v = self.__dict__[var_name] if var_name in self.__dict__ else self.__dict__[x] return v() if callable(v) else v def chain(self,other): for k,v in other.__dict__.items(): self.__dict__[k]=v return self if __name__=="__main__": x = model4() x.va...
class Model4: def __getattr__(self, x): var_name = 'var_' + x v = self.__dict__[var_name] if var_name in self.__dict__ else self.__dict__[x] return v() if callable(v) else v def chain(self, other): for (k, v) in other.__dict__.items(): self.__dict__[k] = v r...