content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def test_del_contact(app): app.session.login(username="admin", password="secret") app.contact.del_first_contact() app.session.logout()
def test_del_contact(app): app.session.login(username='admin', password='secret') app.contact.del_first_contact() app.session.logout()
x = float(input()) y = float(input()) i = 1 while x < y: x += 0.1 * x i += 1 print(i)
x = float(input()) y = float(input()) i = 1 while x < y: x += 0.1 * x i += 1 print(i)
def meme(thing): chars = [] for char in thing: if chars[-1:] and chars[-1]["char"] == char: chars[-1]["count"] += 1 else: chars.append({ "char": char, "count": 1 }) final = "" for data in chars: final += str(data["count"]) + data["char"] return final print(meme(raw_input("Type some crap here: ")))
def meme(thing): chars = [] for char in thing: if chars[-1:] and chars[-1]['char'] == char: chars[-1]['count'] += 1 else: chars.append({'char': char, 'count': 1}) final = '' for data in chars: final += str(data['count']) + data['char'] return final pri...
n = 5 i = 0 while i < n : print("sssssssss") i = i + 1
n = 5 i = 0 while i < n: print('sssssssss') i = i + 1
def canSum(t, arr, memo=None): ''' input: target- t arr- array of numbers output: bool indicating whether it's possible to generate t by adding numbers in arr ''' if memo is None: memo = {} if (t in memo): return memo[t] if t == 0: return True if t < 0: return False for ele in arr: if can...
def can_sum(t, arr, memo=None): """ input: target- t arr- array of numbers output: bool indicating whether it's possible to generate t by adding numbers in arr """ if memo is None: memo = {} if t in memo: return memo[t] if t == 0: return True if t < 0: re...
firstName = "erIc" lastName = "LoVEry" print (firstName.upper(), lastName.upper()) print (firstName.lower(), lastName.lower()) print (firstName.title(), lastName.title())
first_name = 'erIc' last_name = 'LoVEry' print(firstName.upper(), lastName.upper()) print(firstName.lower(), lastName.lower()) print(firstName.title(), lastName.title())
# name {Number , Atomic Weight , coval_radius , vanderWaals_radius} atomic_radii = { "H": ( 1 , 1.0080 , 0.320 , 1.33 ), "D": ( 1 , 1.0080 , 0.320 , 1.33 ), "He": ( 2 , 4.0026 , 0.93 , 1.50 ), "Li": ( 3 , 6.939 , 0.60 , 1.78 ), "Be": ( 4 , 9.0122 , 0.31 ...
atomic_radii = {'H': (1, 1.008, 0.32, 1.33), 'D': (1, 1.008, 0.32, 1.33), 'He': (2, 4.0026, 0.93, 1.5), 'Li': (3, 6.939, 0.6, 1.78), 'Be': (4, 9.0122, 0.31, 1.45), 'B': (5, 10.811, 0.82, 1.93), 'C': (6, 12.01, 0.77, 1.7), 'N': (7, 14.007, 0.75, 1.7), 'O': (8, 15.999, 0.73, 1.5), 'F': (9, 18.998, 0.72, 1.47), 'Ne': (10,...
class Player: def __init__(self, name, dict_object): self.name = name self.score = int(dict_object['score']) self.bike = bool(dict_object['bike']) self.portal_gun = bool(dict_object['portal_gun']) self.location = dict_object['location'] class Map: BLOCK_CHAR = '#' S...
class Player: def __init__(self, name, dict_object): self.name = name self.score = int(dict_object['score']) self.bike = bool(dict_object['bike']) self.portal_gun = bool(dict_object['portal_gun']) self.location = dict_object['location'] class Map: block_char = '#' s...
{ 'targets': [ { 'target_name': 'cpufeatures', 'dependencies': [ 'build_deps' ], 'include_dirs': [ 'deps/cpu_features/include', 'src', "<!(node -e \"require('nan')\")", ], 'sources': [ 'src/binding.cc' ], 'cflags': [ '-O2' ], 'conditi...
{'targets': [{'target_name': 'cpufeatures', 'dependencies': ['build_deps'], 'include_dirs': ['deps/cpu_features/include', 'src', '<!(node -e "require(\'nan\')")'], 'sources': ['src/binding.cc'], 'cflags': ['-O2'], 'conditions': [['OS=="win"', {'link_settings': {'libraries': ['<(module_root_dir)/deps/cpu_features/build/...
# # PySNMP MIB module HPN-ICF-RSA-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-RSA-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:29:06 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, constraints_intersection, constraints_union, single_value_constraint) ...
class Solution: def isRectangleOverlap(self, rec1: List[int], rec2: List[int]) -> bool: # Check if area of intersection is positive left = max(rec1[0], rec2[0]) right = min(rec1[2], rec2[2]) bottom = max(rec1[1], rec2[1]) up = min(rec1[3], rec2[3]) if left < right ...
class Solution: def is_rectangle_overlap(self, rec1: List[int], rec2: List[int]) -> bool: left = max(rec1[0], rec2[0]) right = min(rec1[2], rec2[2]) bottom = max(rec1[1], rec2[1]) up = min(rec1[3], rec2[3]) if left < right and up > bottom: return True els...
''' Given the root of a binary tree, return all root-to-leaf paths in any order. A leaf is a node with no children. Example 1: Input: root = [1,2,3,null,5] Output: ["1->2->5","1->3"] Example 2: Input: root = [1] Output: ["1"] Constraints: The number of nodes in the tree is in the range [1, 100]. -100 <= Nod...
""" Given the root of a binary tree, return all root-to-leaf paths in any order. A leaf is a node with no children. Example 1: Input: root = [1,2,3,null,5] Output: ["1->2->5","1->3"] Example 2: Input: root = [1] Output: ["1"] Constraints: The number of nodes in the tree is in the range [1, 100]. -100 <= Nod...
variable = int(input("enter number: ")) if (variable % 2) == 0: print ("this number is even") else: print ("this number is odd")
variable = int(input('enter number: ')) if variable % 2 == 0: print('this number is even') else: print('this number is odd')
__description__ = "Process monitoring" __config__ = { "monit.alert_emails": dict( display_name = "Alert emails", description = "Emails that should receive alerts about service changes.", default = [], ), "monit.password": dict( dispaly_name = "Password", description ...
__description__ = 'Process monitoring' __config__ = {'monit.alert_emails': dict(display_name='Alert emails', description='Emails that should receive alerts about service changes.', default=[]), 'monit.password': dict(dispaly_name='Password', description='Password for accessing web interface', default='m0n1t1tup'), 'mon...
def test(num): for i in iter(range(num)): pass test(100000000)
def test(num): for i in iter(range(num)): pass test(100000000)
#!/bin/env python3 try: invalid = 10 / 0 except ZeroDivisionError as e: print('catch except: ', e) finally: print('finally...') try: invalid = 10 / 1 except ZeroDivisionError as e: print('catch except: ', e) finally: print('finally...')
try: invalid = 10 / 0 except ZeroDivisionError as e: print('catch except: ', e) finally: print('finally...') try: invalid = 10 / 1 except ZeroDivisionError as e: print('catch except: ', e) finally: print('finally...')
# helper descriptor class _descr(object): objrefs = {} clsrefs = {} def __init__(self,name): self.name = name def __get__(self,instance,owner): if instance is None: return getattr(_descr.clsrefs[id(owner)],self.name) else: return getattr(_descr.objrefs[id(...
class _Descr(object): objrefs = {} clsrefs = {} def __init__(self, name): self.name = name def __get__(self, instance, owner): if instance is None: return getattr(_descr.clsrefs[id(owner)], self.name) else: return getattr(_descr.objrefs[id(instance)], se...
#! /usr/bin/env python # -*- coding: utf-8 -*- xsq = "120.22940239501227;30.226915680225147;120.28948387694587;30.146807031535218" xsqlist = xsq.split(";") xsq_x_list = [] xsq_y_list = [] for i in range(len(xsqlist)): if i % 2 == 0: xsq_x_list.append(float(xsqlist[i])) else: xsq_y_list.appen...
xsq = '120.22940239501227;30.226915680225147;120.28948387694587;30.146807031535218' xsqlist = xsq.split(';') xsq_x_list = [] xsq_y_list = [] for i in range(len(xsqlist)): if i % 2 == 0: xsq_x_list.append(float(xsqlist[i])) else: xsq_y_list.append(float(xsqlist[i])) xsq_x_y_list = [] for (x, y) i...
# Stack N = int(input()) stack = [] for _ in range(N): op = input().split() # operator, operand if op[0] == 'push': stack.append(op[1]) elif op[0] == 'pop': try: print(stack.pop()) except IndexError as e: print(-1) elif op[0] == 'size': print(le...
n = int(input()) stack = [] for _ in range(N): op = input().split() if op[0] == 'push': stack.append(op[1]) elif op[0] == 'pop': try: print(stack.pop()) except IndexError as e: print(-1) elif op[0] == 'size': print(len(stack)) elif op[0] == 'em...
# annotation_parsetab.py # This file is automatically generated. Do not edit. # pylint: disable=W,C,R _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'LBRACE LPAREN RBRACE RPAREN WORDexpression : words\n | annotation\n | words annotationexpression : words annotation express...
_tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'LBRACE LPAREN RBRACE RPAREN WORDexpression : words\n | annotation\n | words annotationexpression : words annotation expression\n | annotation expressionannotation : LBRACE expression RBRACE LPAREN WORD RPARENwor...
current_number = 0 while current_number < 10: current_number += 1 if current_number % 2 == 0: # Return to the beginning of the loop. we skip printing it and just go back. continue print(current_number) print("\nSimple count now.") x = 1 while x <= 5: print(x) x += 1
current_number = 0 while current_number < 10: current_number += 1 if current_number % 2 == 0: continue print(current_number) print('\nSimple count now.') x = 1 while x <= 5: print(x) x += 1
''' URL: https://leetcode.com/problems/distribute-candies-to-people/ Difficulty: Easy Title: Distribute Candies to People ''' ################### Code ################### class Solution: def minOperations(self, logs: List[str]) -> int: levels = ["main"] for op in logs: ...
""" URL: https://leetcode.com/problems/distribute-candies-to-people/ Difficulty: Easy Title: Distribute Candies to People """ class Solution: def min_operations(self, logs: List[str]) -> int: levels = ['main'] for op in logs: if op == './': continue elif o...
s = 0 i = 1 while i < 1000: if i%3 == 0 or i%5 == 0: s += i i += 1 print(s)
s = 0 i = 1 while i < 1000: if i % 3 == 0 or i % 5 == 0: s += i i += 1 print(s)
#Calling a method multiple times by using explicit calls when a base uses super() class Vehicle(object): def __init__(self): super(Vehicle, self).__init__() self.mobile = True class Car(Vehicle): def __init__(self): super(Car, self).__init__() self.car_init()...
class Vehicle(object): def __init__(self): super(Vehicle, self).__init__() self.mobile = True class Car(Vehicle): def __init__(self): super(Car, self).__init__() self.car_init() def car_init(self): pass class Sportscar(Car, Vehicle): def __init__(self): ...
# coding: utf8 # Author: Wing Yung Chan (~wy) # Date: 2017 # Circular Primes # Need to use a rotation method, let's write one def rotations(n): rot = [] s = str(n) length = len(s) if "0" in s or "2" in s or "4" in s or "6" in s or "8" in s: return [] for i in range(0,length): ...
def rotations(n): rot = [] s = str(n) length = len(s) if '0' in s or '2' in s or '4' in s or ('6' in s) or ('8' in s): return [] for i in range(0, length): rot.append(n) n2 = n % 10 n = n // 10 n = n + n2 * 10 ** (length - 1) return rot def prime(n): ...
expected_output = { 'global_hsrp_bfd': 'enabled', 'intf_total': 1, 'nsf': 'enabled', 'nsf_time': 10, 'pkt_unknown_groups': 0, 'total_mts_rx': 85, 'stats': { 'total_groups': 3, 'active': 0, 'listen': 0, 'standby': 0, 'v1_ipv4': 0, 'v2_ipv4': 3...
expected_output = {'global_hsrp_bfd': 'enabled', 'intf_total': 1, 'nsf': 'enabled', 'nsf_time': 10, 'pkt_unknown_groups': 0, 'total_mts_rx': 85, 'stats': {'total_groups': 3, 'active': 0, 'listen': 0, 'standby': 0, 'v1_ipv4': 0, 'v2_ipv4': 3, 'v2_ipv6': 0, 'v6_active': 0, 'v6_listen': 0, 'v6_standby': 0}, 'total_packets...
DEVICES = [ "cuda:0", "cuda:1", "cuda:2", "cuda:3", ] BROADCAST = 'broadcast' SCATTER = 'scatter' ALL_REDUCE = 'all-reduce' LEADER_RANK = 0 MAX_SEQ_LEN = 10 class InvalidDistributedOperationError(Exception): ...
devices = ['cuda:0', 'cuda:1', 'cuda:2', 'cuda:3'] broadcast = 'broadcast' scatter = 'scatter' all_reduce = 'all-reduce' leader_rank = 0 max_seq_len = 10 class Invaliddistributedoperationerror(Exception): ...
# message.py # Collects methods that handle details of messages # Checks that the message information in the dictionary m is valid: # - There should be a `from` with length at most 20 # - There should be a `to` with length at most 20 # - There should be a `subject` with length at most 140 # - There should be a ...
def validate_new_message(m): for field in ['to', 'subject', 'body']: if field not in m: return 'Required fields: to, subject, body' for (field, length) in [('from', 20), ('to', 20), ('subject', 140), ('body', 5000)]: if len(m[field]) > length: return 'Field "%s" must not ...
N = int(input()) L = list(map(int,input().split())) for i in range(L[0],0,-1): chk = True S = [i] for j in range(N-1): if(L[j] - S[-1] <= 0): chk = False S.append(L[j]-S[-1]) if not chk: continue for k in S: print(k,end = " ") break
n = int(input()) l = list(map(int, input().split())) for i in range(L[0], 0, -1): chk = True s = [i] for j in range(N - 1): if L[j] - S[-1] <= 0: chk = False S.append(L[j] - S[-1]) if not chk: continue for k in S: print(k, end=' ') break
# -*- coding: utf-8 -*- SQL = { 'create_users_table': ''' CREATE TABLE IF NOT EXISTS users_table ( login_id INTEGER PRIMARY KEY, login TEXT, access_token TEXT )''', 'add_token': 'INSERT INTO users_table (login, access_token) VALUES(?, ?)', 'get_token': 'SELECT access_token FROM users_table WHERE ...
sql = {'create_users_table': '\nCREATE TABLE IF NOT EXISTS users_table (\n login_id INTEGER PRIMARY KEY,\n login TEXT,\n access_token TEXT\n)', 'add_token': 'INSERT INTO users_table (login, access_token) VALUES(?, ?)', 'get_token': 'SELECT access_token FROM users_table WHERE login = ?', 'rm_token': 'DELETE FROM u...
# # PySNMP MIB module MICROCOM-MBR-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MICROCOM-MBR-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:02:25 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, constraints_intersection, value_range_constraint, value_size_constraint) ...
def drop_lines(lines: list[str], pos: int, keep_value: str): i = 0 while i < len(lines) and len(lines) > 1: if lines[i][pos] != keep_value: lines.pop(i) else: i += 1 def count_values(lines: list[str]): sz = len(lines[0]) - 1 # minus 1 for newline zero_counts = ...
def drop_lines(lines: list[str], pos: int, keep_value: str): i = 0 while i < len(lines) and len(lines) > 1: if lines[i][pos] != keep_value: lines.pop(i) else: i += 1 def count_values(lines: list[str]): sz = len(lines[0]) - 1 zero_counts = [0] * sz for line in...
class Whaterve: def __init__(self): pass def what(self): print('This is vertyGood')
class Whaterve: def __init__(self): pass def what(self): print('This is vertyGood')
#!/usr/bin/python3 with open("kernel/arch/vectors.s", "w") as f: f.write("; vectors.s - generated by vectors.py\n"); f.write("; Michael Lazear 2016, adapted from xv6-public\n") f.write("extern trap_handler\n\n") for i in range(0, 256): f.write("global vector{0}\n".format(i)) f.write("vector{0}:\n".form...
with open('kernel/arch/vectors.s', 'w') as f: f.write('; vectors.s - generated by vectors.py\n') f.write('; Michael Lazear 2016, adapted from xv6-public\n') f.write('extern trap_handler\n\n') for i in range(0, 256): f.write('global vector{0}\n'.format(i)) f.write('vector{0}:\n'.format(i)...
# Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompa...
def register_custom_endpoint_note(event_emitter): event_emitter.register_last('doc-description.iot-data', add_custom_endpoint_url_note) def add_custom_endpoint_url_note(help_command, **kwargs): style = help_command.doc.style style.start_note() style.doc.writeln('The default endpoint data.iot.[region].a...
current_grammar = None push_lookup = None class Action: last = None action = Action() stack = [] def push_grammar(name): stack.append(current_grammar) switch_grammar(push_lookup[name]) def pop_grammar(): switch_grammar(stack.pop()) def void_rule(start, action, norepeat=False): return { 'type': 'V...
current_grammar = None push_lookup = None class Action: last = None action = action() stack = [] def push_grammar(name): stack.append(current_grammar) switch_grammar(push_lookup[name]) def pop_grammar(): switch_grammar(stack.pop()) def void_rule(start, action, norepeat=False): return {'type': 'V...
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # # Copyright (c) 2019, Gianluca Fiore # ############################################################################### __author__ = "Gianluca Fiore" class Node(object): def __init__(sel...
__author__ = 'Gianluca Fiore' class Node(object): def __init__(self, data=None): self.data = data self.left = None self.right = None class Binarysearchtree(object): def __init__(self): self.root = None def get_root(self): return self.root def count_size(self...
# AUTOGENERATED! DO NOT EDIT! File to edit: notebooks/00_core.ipynb (unless otherwise specified). __all__ = ['mySum'] # Cell def mySum(x,y): '''return sum of x and y''' return x+y
__all__ = ['mySum'] def my_sum(x, y): """return sum of x and y""" return x + y
class SeaError(Exception): def __init__(self, message = ""): self.message = message self.position = "[No Position]" super().__init__(message) def get_message(self): return self.message def get_position(self): return f"{self.position}"
class Seaerror(Exception): def __init__(self, message=''): self.message = message self.position = '[No Position]' super().__init__(message) def get_message(self): return self.message def get_position(self): return f'{self.position}'
# # PySNMP MIB module Nortel-MsCarrier-MscPassport-IpNhrpMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-IpNhrpMIB # Produced by pysmi-0.3.4 at Wed May 1 14:30:35 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, single_value_constraint, constraints_intersection, constraints_union) ...
nacionalidade=input() ocupacao=input() quant_arm=int(input()) calibre=int(input()) if nacionalidade == "E" and quant_arm == 0: print("Liberado") elif nacionalidade == "B" and ocupacao == "M": print("Liberado") elif nacionalidade == "B" and ocupacao == "T" or ocupacao == "O" and quant_arm == 1 and calibre == 22...
nacionalidade = input() ocupacao = input() quant_arm = int(input()) calibre = int(input()) if nacionalidade == 'E' and quant_arm == 0: print('Liberado') elif nacionalidade == 'B' and ocupacao == 'M': print('Liberado') elif nacionalidade == 'B' and ocupacao == 'T' or (ocupacao == 'O' and quant_arm == 1 and (cali...
#2 in 1 triangle pattern #1. in this we print a simple triangle n = int(input('Enter the number of row: ')) for i in range(0,n): #rows for j in range(0, n-i): #for space print(end=" ") for j in range(0,i+1): #number of star to be print in rows print('*', end=" ") print() #2. Pyramid p...
n = int(input('Enter the number of row: ')) for i in range(0, n): for j in range(0, n - i): print(end=' ') for j in range(0, i + 1): print('*', end=' ') print() n = int(input('Enter the number of row: ')) for i in range(0, n): for j in range(0, n - i): print(end=' ') for j in...
# list are ordered sequence that can hold a variety of object types # they use [] brackets and commas to separate objects in the list. eg- [1,2,3,4,5] # list support indexing and slicing # list can be nested and also have a variety of useful method that can be called off of them. my_list=[1,2,3,4,5] print(my_list) pri...
my_list = [1, 2, 3, 4, 5] print(my_list) print('\n\n') my_list = ['name', 1, 1.23] print(len(my_list)) print(my_list) my_list = [1, 2, 3, 4, 5] print(my_list[0]) print(my_list[1:]) my_list2 = [6, 7] my_list = my_list + my_list2 print(my_list) my_list.append(8) print(my_list) print('\n\n') print(f'popped element: {my_li...
# One without delete class Solution: def sumZero(self, n: int) -> List[int]: res = [0] if n%2 == 0: res = [] for i in range(1,(n//2)+1): res.append(i) res.append(-i) return res # # One with delete. # class Solution: # def sumZero(self, n: int)...
class Solution: def sum_zero(self, n: int) -> List[int]: res = [0] if n % 2 == 0: res = [] for i in range(1, n // 2 + 1): res.append(i) res.append(-i) return res
# # Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. # _MGMT_STR = "management" _LEFT_STR = "left" _RIGHT_STR = "right" _OTHER_STR = "other0" _SVC_VN_MGMT = "svcVnMgmt" _SVC_VN_LEFT = "svcVnLeft" _SVC_VN_RIGHT = "svcVnRight" _SVC_VN_OTHER = "svcVnOther" _VN_MGMT_SUBNET_CIDR = '10.250.1.0/24' _VN_LEFT_SU...
_mgmt_str = 'management' _left_str = 'left' _right_str = 'right' _other_str = 'other0' _svc_vn_mgmt = 'svcVnMgmt' _svc_vn_left = 'svcVnLeft' _svc_vn_right = 'svcVnRight' _svc_vn_other = 'svcVnOther' _vn_mgmt_subnet_cidr = '10.250.1.0/24' _vn_left_subnet_cidr = '10.250.2.0/24' _vn_right_subnet_cidr = '10.250.3.0/24' _vn...
ADMIN_HELP = "This command configures the Steam Announcement feature, used to post game announcements from Steam. " \ "Takes up to two arguments, with the first one being `set_channel`, `unset_channel`, `list_games`, " \ "`add_game`, or `remove_game`." ADMIN_SET_CHANNEL_CURRENT = "Set the anno...
admin_help = 'This command configures the Steam Announcement feature, used to post game announcements from Steam. Takes up to two arguments, with the first one being `set_channel`, `unset_channel`, `list_games`, `add_game`, or `remove_game`.' admin_set_channel_current = 'Set the announcement channel to the current chan...
# 1. Two Sum Easy # # Given an array of integers, return indices of the two numbers such that they add up to a specific target. # # You may assume that each input would have exactly one solution, and you may not use the same element twice. # # Example: # # Given nums = [2, 7, 11, 15], target = 9, # # Because nums[0] + ...
class Solution: def two_sum(self, nums: List[int], target: int) -> List[int]: difference = {} "\n Runtime: 36 ms, faster than 92.32% of Python3 online submissions for Two Sum.\n Memory Usage: 14.5 MB, less than 23.27% of Python3 online submissions for Two Sum.\n\n target = 9\n ...
N = int(input()) num=1 a=1 room=6 if N==1: print(1) else: while (a<N): a+=room room+=6 num+=1 print(num)
n = int(input()) num = 1 a = 1 room = 6 if N == 1: print(1) else: while a < N: a += room room += 6 num += 1 print(num)
class Point: def __init__(self, initX: float, initY: float): self.x = initX self.y = initY def getX(self): return self.x def getY(self): return self.y def setX(self, newX): self.x = newX def setY(self, newY): self.y = newY ...
class Point: def __init__(self, initX: float, initY: float): self.x = initX self.y = initY def get_x(self): return self.x def get_y(self): return self.y def set_x(self, newX): self.x = newX def set_y(self, newY): self.y = newY def __str__(sel...
jogador = dict() gol = list() jogador['nome'] = input('Nome do Jogador: ') partidas = int(input(f'Quantas partidas {jogador["nome"]} jogou? ')) for c in range(0, partidas): gol.append(int(input(f' Quantos gols na partida {c + 1}: '))) jogador['gols'] = gol.copy() jogador['total'] = sum(gol) print('=' * 50) prin...
jogador = dict() gol = list() jogador['nome'] = input('Nome do Jogador: ') partidas = int(input(f"Quantas partidas {jogador['nome']} jogou? ")) for c in range(0, partidas): gol.append(int(input(f' Quantos gols na partida {c + 1}: '))) jogador['gols'] = gol.copy() jogador['total'] = sum(gol) print('=' * 50) prin...
REST_FRAMEWORK = { 'DEFAULT_PERMISSION_CLASSES': ( 'rest_framework.permissions.IsAuthenticated', ), }
rest_framework = {'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAuthenticated',)}
# Leo colorizer control file for ml mode. # This file is in the public domain. # Properties for ml mode. properties = { "commentEnd": "*)", "commentStart": "(*", } # Attributes dict for ml_main ruleset. ml_main_attributes_dict = { "default": "null", "digit_re": "", "escape": "\\", ...
properties = {'commentEnd': '*)', 'commentStart': '(*'} ml_main_attributes_dict = {'default': 'null', 'digit_re': '', 'escape': '\\', 'highlight_digits': 'true', 'ignore_case': 'false', 'no_word_sep': ''} attributes_dict_dict = {'ml_main': ml_main_attributes_dict} ml_main_keywords_dict = {'ANTIQUOTE': 'literal2', 'Bind...
# Q4. write a program using functions and procedures. def func1(x, y): # function to return minimum if x < y: return x else: return y def proc1(n): # procedure to print 0 - n for i in range(n+1): print(i) minimum = func1(10, 5) print('minimum element : ', minimum) proc1(minimum)
def func1(x, y): if x < y: return x else: return y def proc1(n): for i in range(n + 1): print(i) minimum = func1(10, 5) print('minimum element : ', minimum) proc1(minimum)
class DashFinder: def __init__(self): self.f = "" self.counter = 0 #Path is inputted from AIPController #Returns dash counter def sendFile(self, path): self.f = open(path) for line in self.f: try: self.counter += self.get_all_dashes(...
class Dashfinder: def __init__(self): self.f = '' self.counter = 0 def send_file(self, path): self.f = open(path) for line in self.f: try: self.counter += self.get_all_dashes(line) except: continue c = self.counter...
# Python3 def isCryptSolution(crypt, solution): solution = { ord(s[0]): ord(s[1]) for s in solution } decrypt = [ c.translate(solution) for c in crypt ] for d in decrypt: if len(d) > 1 and d[0] == '0': return False decrypt = [*map(int, decrypt)] return (decrypt[0] + decrypt[1]) ...
def is_crypt_solution(crypt, solution): solution = {ord(s[0]): ord(s[1]) for s in solution} decrypt = [c.translate(solution) for c in crypt] for d in decrypt: if len(d) > 1 and d[0] == '0': return False decrypt = [*map(int, decrypt)] return decrypt[0] + decrypt[1] == decrypt[2]
PAYLOAD = { "context": { "client": { "clientName": "WEB", "clientVersion": "2.20201220.08.00", }, "user": { "lockedSafetyMode": False, } }, "webClientInfo": { "isDocumentHidden": True } } HEADERS = { "x-youtube-client-name"...
payload = {'context': {'client': {'clientName': 'WEB', 'clientVersion': '2.20201220.08.00'}, 'user': {'lockedSafetyMode': False}}, 'webClientInfo': {'isDocumentHidden': True}} headers = {'x-youtube-client-name': '1', 'x-youtube-client-version': '2.20210407.08.00', 'accept-language': 'en-US'} thumbnail_template = {'defa...
# # PySNMP MIB module A3COM-HUAWEI-DLDP-MIB (http://pysnmp.sf.net) # Produced by pysmi-0.0.1 from A3COM-HUAWEI-DLDP-MIB at Sun May 3 23:23:09 2015 # On host cray platform Linux version 2.6.37.6-smp by user tt # Using Python version 2.7.2 (default, Apr 2 2012, 20:32:47) # ( h3cCommon, ) = mibBuilder.importSymbols("A3...
(h3c_common,) = mibBuilder.importSymbols('A3COM-HUAWEI-OID-MIB', 'h3cCommon') (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constra...
filename = input("Filename > ") filesize = input("Filesize (bytes) > "); filesize = int(filesize) s = input("string: (if left blank none will be included)") if s != "": size = filesize - len(s) else: size = filesize with open(filename, 'wb') as f: f.write(s.encode()) f.write('\x00'.encode()*size) f.close()
filename = input('Filename > ') filesize = input('Filesize (bytes) > ') filesize = int(filesize) s = input('string: (if left blank none will be included)') if s != '': size = filesize - len(s) else: size = filesize with open(filename, 'wb') as f: f.write(s.encode()) f.write('\x00'.encode() * size) f...
# YOLO options YOLO_DARKNET_WEIGHTS = "./model_data/yolov3.weights" YOLO_DARKNET_TINY_WEIGHTS = "./model_data/yolov3-tiny.weights" YOLO_COCO_CLASSES = "./model_data/coco.names" YOLO_STRIDES = [8, 16, 32] YOLO_IOU_LOSS_THRESH = 0.5 YOLO_ANCHOR_PER_SCALE = 3 YOLO_MAX_BBOX_PE...
yolo_darknet_weights = './model_data/yolov3.weights' yolo_darknet_tiny_weights = './model_data/yolov3-tiny.weights' yolo_coco_classes = './model_data/coco.names' yolo_strides = [8, 16, 32] yolo_iou_loss_thresh = 0.5 yolo_anchor_per_scale = 3 yolo_max_bbox_per_scale = 100 yolo_input_size = 416 yolo_anchors = [[[10, 13],...
#!/usr/bin/env python3 def valid_password(password): password = list(password) if(len(password) != 31): return False for x in range(0, len(password)): val = ord(password[x]) val = val + 5 password[x] = chr(val) if(password[:8] != ['r', 'f', 'x', 't', 's', 'h', 'h', '\x80...
def valid_password(password): password = list(password) if len(password) != 31: return False for x in range(0, len(password)): val = ord(password[x]) val = val + 5 password[x] = chr(val) if password[:8] != ['r', 'f', 'x', 't', 's', 'h', 'h', '\x80']: return False ...
def field(f, cast=None, **kwargs): def _inner(self): if "default" in kwargs: ret = self._obj.get(f, kwargs["default"]) else: ret = self._obj[f] if cast: ret = cast(ret) return ret def _setter(self, val): self._obj[f] = val return property(_inner, _setter) class Object: def __init__(self, data=N...
def field(f, cast=None, **kwargs): def _inner(self): if 'default' in kwargs: ret = self._obj.get(f, kwargs['default']) else: ret = self._obj[f] if cast: ret = cast(ret) return ret def _setter(self, val): self._obj[f] = val return ...
class RealEstateSearch: def __init__(self, search_json={}): self.search_dict = dict(search_json) def to_json(self): return self.search_dict class RealEstateSearchBuilder: def __init__(self): self.dict = dict({}) def __getitem__(self, key): if (key not in self.dict): ...
class Realestatesearch: def __init__(self, search_json={}): self.search_dict = dict(search_json) def to_json(self): return self.search_dict class Realestatesearchbuilder: def __init__(self): self.dict = dict({}) def __getitem__(self, key): if key not in self.dict: ...
RES_ESCORT_TXT = [ "click", "tel", "sorry", "call", "incall", "outcall", "hh", "hr", "quick", "quickie", "hott", "legged", "busty" ]
res_escort_txt = ['click', 'tel', 'sorry', 'call', 'incall', 'outcall', 'hh', 'hr', 'quick', 'quickie', 'hott', 'legged', 'busty']
# in parrot = "Norwegin Blue" letter = input("Enter a charecter: ") if letter in parrot.capitalize(): # capitalize()- to make sentence upper case print("{} is in {}".format(letter,parrot)) else: print("I don't have that letter") print("*" * 120) # not in activity = input("What would you like you today? \n") ...
parrot = 'Norwegin Blue' letter = input('Enter a charecter: ') if letter in parrot.capitalize(): print('{} is in {}'.format(letter, parrot)) else: print("I don't have that letter") print('*' * 120) activity = input('What would you like you today? \n') if 'cinema' not in activity.casefold(): print('But I wan...
def buildGraph(): graph = {} graph['start'] = {} graph['start']['a'] = 6 graph['start']['b'] = 2 graph['a'] = {} graph['a']['fin'] = 1 graph['b'] = {} graph['b']['a'] = 3 graph['b']['fin'] = 5 graph['fin'] = {} return graph def buildCost(): cost = {} cost['a'] =...
def build_graph(): graph = {} graph['start'] = {} graph['start']['a'] = 6 graph['start']['b'] = 2 graph['a'] = {} graph['a']['fin'] = 1 graph['b'] = {} graph['b']['a'] = 3 graph['b']['fin'] = 5 graph['fin'] = {} return graph def build_cost(): cost = {} cost['a'] = 6 ...
# [[ Data ]] a = [8, 1, 0, 5, 6, 3, 2, 4, 7, 1] for i in range(len(a)): for j in range(len(a) - i - 1): # [[ Compare(j, j+1) ]] if a[j] > a[j + 1]: # [[ Swap(j, j+1) ]] a[j], a[j + 1] = a[j + 1], a[j] print(a)
a = [8, 1, 0, 5, 6, 3, 2, 4, 7, 1] for i in range(len(a)): for j in range(len(a) - i - 1): if a[j] > a[j + 1]: (a[j], a[j + 1]) = (a[j + 1], a[j]) print(a)
# Link: https://leetcode.com/problems/next-permutation/ # Time: O(N) # Space: O(1) # To compute the next permutation, we must increase the sequence as little as possible. # Try to modify the rightmost elements, such that it forms a greater numbers. # Example: # -> 0 1 2 5 3 3 0 # find the rightmost element that nee...
def next_permutation(nums): i = len(nums) - 1 while i > 0 and nums[i - 1] >= nums[i]: i -= 1 if i <= 0: nums.reverse() return j = len(nums) - 1 while j > 0 and nums[i - 1] >= nums[j]: j -= 1 (nums[i - 1], nums[j]) = (nums[j], nums[i - 1]) j = len(nums) - 1 ...
#from am_defines import * INFO0_SIGNATURE0_O = 0x00000000 INFO0_SIGNATURE1_O = 0x00000004 INFO0_SIGNATURE2_O = 0x00000008 INFO0_SIGNATURE3_O = 0x0000000c INFO0_SECURITY_O = 0x00000010 INFO0_CUSTOMER_TRIM_O = 0x00000014 INFO0_CUSTOMER_TRIM2_O = 0x00000018 INFO0_SECURITY_OVR_O = 0x00000020 INFO0_SECURITY_WIRED_CF...
info0_signature0_o = 0 info0_signature1_o = 4 info0_signature2_o = 8 info0_signature3_o = 12 info0_security_o = 16 info0_customer_trim_o = 20 info0_customer_trim2_o = 24 info0_security_ovr_o = 32 info0_security_wired_cfg_o = 36 info0_security_wired_ifc_cfg0_o = 40 info0_security_wired_ifc_cfg1_o = 44 info0_security_wir...
# gen.yield.for.py def print_squares(start, end): for n in range(start, end): yield n ** 2 for n in print_squares(2, 5): print(n)
def print_squares(start, end): for n in range(start, end): yield (n ** 2) for n in print_squares(2, 5): print(n)
wpns = ["B", "F", "T", "L", "C"] n = str(input()) for i in range(5): if "B" in wpns and "B" in n: wpns.remove("B") if "F" in wpns and "F" in n: wpns.remove("F") if "T" in wpns and "T" in n: wpns.remove("T") if "L" in wpns and "L" in n: wpns.remove("L") if "C" in wpn...
wpns = ['B', 'F', 'T', 'L', 'C'] n = str(input()) for i in range(5): if 'B' in wpns and 'B' in n: wpns.remove('B') if 'F' in wpns and 'F' in n: wpns.remove('F') if 'T' in wpns and 'T' in n: wpns.remove('T') if 'L' in wpns and 'L' in n: wpns.remove('L') if 'C' in wpns ...
''' Created on 7 Mar 2017 @author: Comma ''' class ResultHelper(object): ''' classdocs ''' def __init__(self): ''' Constructor ''' def make_result_handsome(self, tickets): beautyful_result = '' beautyful_string_line = '' for ticket in tickets: ...
""" Created on 7 Mar 2017 @author: Comma """ class Resulthelper(object): """ classdocs """ def __init__(self): """ Constructor """ def make_result_handsome(self, tickets): beautyful_result = '' beautyful_string_line = '' for ticket in tickets: ...
def permutations(string): perm = []; if len(string) is 0: perm.append(''); else: first = string[0]; rest = string[1:]; subpermute = permutations(rest); for p in subpermute: for j in range(len(p) + 1): str = p[:j] + first + p[j:] perm.append(str); return perm; ...
def permutations(string): perm = [] if len(string) is 0: perm.append('') else: first = string[0] rest = string[1:] subpermute = permutations(rest) for p in subpermute: for j in range(len(p) + 1): str = p[:j] + first + p[j:] ...
# class for tracker layers class Layer(): def __init__(self, radius, color, moduleType, layerNumber): # Read in parameters self._radius = radius self._color = color self._moduleType = moduleType self._layerNumber = layerNumber # Default attributes self.plot...
class Layer: def __init__(self, radius, color, moduleType, layerNumber): self._radius = radius self._color = color self._moduleType = moduleType self._layerNumber = layerNumber self.plotColor = 7 self.width = 102.4 self.modleShape = 'rectangular' def add...
def mass_sum(mum): k = mum print(k) num = "shperewave" mass_sum(num)
def mass_sum(mum): k = mum print(k) num = 'shperewave' mass_sum(num)
class ApiResponse: def __init__(self, r): self.raw_respone = r self.json = {} self.status = '' self.status_code = r.status_code self.headers = r.headers if r.status_code == 200: self.status = 'success' self.json = r.json() elif r.status...
class Apiresponse: def __init__(self, r): self.raw_respone = r self.json = {} self.status = '' self.status_code = r.status_code self.headers = r.headers if r.status_code == 200: self.status = 'success' self.json = r.json() elif r.statu...
def execute(args, extra_args, controller): search_conditions = controller.get_search_conditions(args, extra_args) repo_list = controller.get_repos(search_conditions) total_commits_in_all_repos = 0 index = 0 ordered_repo_list = sorted(repo_list, key=lambda x: controller.get_total_commits(x), reve...
def execute(args, extra_args, controller): search_conditions = controller.get_search_conditions(args, extra_args) repo_list = controller.get_repos(search_conditions) total_commits_in_all_repos = 0 index = 0 ordered_repo_list = sorted(repo_list, key=lambda x: controller.get_total_commits(x), reverse=...
def choose(n, k): if k == 0 or n == k: return 1 else: return choose(n-1, k-1)+choose(n-1, k)
def choose(n, k): if k == 0 or n == k: return 1 else: return choose(n - 1, k - 1) + choose(n - 1, k)
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def pybind11_repository(): maybe( http_archive, name = "pybind11", urls = ["https://github.com/pybind/pybind11/archive/v2.8.1.zip"], build_file = "@pyb...
load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'maybe') load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') def pybind11_repository(): maybe(http_archive, name='pybind11', urls=['https://github.com/pybind/pybind11/archive/v2.8.1.zip'], build_file='@pybind11_bazel//:pybind11.BUILD', sha256='...
class TooManyContentExceeded(Exception): def __init__(self, message): super().__init__(message) class CallLimitExceeded(Exception): def __init__(self, message): super().__init__(message) class BannedForever(Exception): def __init__(self, message): super().__init__(message) clas...
class Toomanycontentexceeded(Exception): def __init__(self, message): super().__init__(message) class Calllimitexceeded(Exception): def __init__(self, message): super().__init__(message) class Bannedforever(Exception): def __init__(self, message): super().__init__(message) clas...
# # PySNMP MIB module JUNIPER-TLB-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/JUNIPER-TLB-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:50:26 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_union, value_range_constraint, constraints_intersection, single_value_constraint) ...
# -*- coding: utf-8 -*- description = 'DNS shutter digital in- and outputs' group = 'lowlevel' includes = ['reactor'] tango_base = 'tango://phys.dns.frm2:10000/dns/' devices = dict( expshutter = device('nicos_mlz.jcns.devices.shutter.Shutter', description = 'Experiment Shutter', tangodevice = ta...
description = 'DNS shutter digital in- and outputs' group = 'lowlevel' includes = ['reactor'] tango_base = 'tango://phys.dns.frm2:10000/dns/' devices = dict(expshutter=device('nicos_mlz.jcns.devices.shutter.Shutter', description='Experiment Shutter', tangodevice=tango_base + 'fzjdp_digital/ExpShutter', mapping=dict(ope...
# Variable declaration/initialization. loanAmt = 0.00 interestRate = 0.00 years = 0.00 monthlyPaymnt = 0.00 # Get user info. print ("\nHello, welcome to the loan calculator.") print ("\nWhat is the total amount of your loan?") loanAmt = input() print ("What is the interest rate on your loan (enter X% as a decimal 0.0X...
loan_amt = 0.0 interest_rate = 0.0 years = 0.0 monthly_paymnt = 0.0 print('\nHello, welcome to the loan calculator.') print('\nWhat is the total amount of your loan?') loan_amt = input() print('What is the interest rate on your loan (enter X% as a decimal 0.0X?') interest_rate = input() print('How many years will it ta...
def load(h): return ({'abbr': 'eggr', 'code': 0, 'title': 'UK Met Office - UK'}, {'abbr': 'aemet', 'code': 1, 'title': 'AEMET- Spain HIRLAM'}, {'abbr': 'arpasim', 'code': 2, 'title': 'ARPA-SIM - Italy COSMO'}, {'abbr': 'metno', 'code': 3, 'title': 'Met.NO'}, {'abbr': ...
def load(h): return ({'abbr': 'eggr', 'code': 0, 'title': 'UK Met Office - UK'}, {'abbr': 'aemet', 'code': 1, 'title': 'AEMET- Spain HIRLAM'}, {'abbr': 'arpasim', 'code': 2, 'title': 'ARPA-SIM - Italy COSMO'}, {'abbr': 'metno', 'code': 3, 'title': 'Met.NO'}, {'abbr': 'zamg', 'code': 4, 'title': 'ZAMG / Austria'}, {...
def spec(x, y, color, step="step"): tooltip = {"signal": "{" + f"'{y}': datum['{y}'], '{x}': datum['{x}']" + "}"} return { "$schema": "https://vega.github.io/schema/vega/v5.json", "axes": [ {"scale": "y", "title": y, "orient": "left"}, { "scale": "x", ...
def spec(x, y, color, step='step'): tooltip = {'signal': '{' + f"'{y}': datum['{y}'], '{x}': datum['{x}']" + '}'} return {'$schema': 'https://vega.github.io/schema/vega/v5.json', 'axes': [{'scale': 'y', 'title': y, 'orient': 'left'}, {'scale': 'x', 'title': x, 'encode': {'labels': {'update': {'align': {'value':...
# # PySNMP MIB module OWNEXT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/OWNEXT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:26:39 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:...
(own_ext,) = mibBuilder.importSymbols('APENT-MIB', 'ownExt') (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, constrai...
n, m = map(int, raw_input().split()) result = 0 for i in xrange(n, 0, -1): if m >= i: m -= i result += 1 if not m: break print -1 if m else result
(n, m) = map(int, raw_input().split()) result = 0 for i in xrange(n, 0, -1): if m >= i: m -= i result += 1 if not m: break print - 1 if m else result
no_change = [ "Sorry, I couldn\'t pekofy the message for some reason peko. So here\'s a clip of Pekora saying [{}]({}) instead peko.".format(title, link) \ for title, link in { "naww": "https://www.youtube.com/watch?v=JNgCFHbPARg", "motherf*cker": "https://www.youtube.com/watch?v=1OjQVMiyUMg", ...
no_change = ["Sorry, I couldn't pekofy the message for some reason peko. So here's a clip of Pekora saying [{}]({}) instead peko.".format(title, link) for (title, link) in {'naww': 'https://www.youtube.com/watch?v=JNgCFHbPARg', 'motherf*cker': 'https://www.youtube.com/watch?v=1OjQVMiyUMg', 'oh no jesus': 'https://www.y...
class Triangle: def __init__(self,base=0,height = 0): self.__base = base self.__height = height def getBase(self): return self.__base def getHeight(self): return self.__height def setBase(self,base): self.__base = base def setHeight(self,height): self....
class Triangle: def __init__(self, base=0, height=0): self.__base = base self.__height = height def get_base(self): return self.__base def get_height(self): return self.__height def set_base(self, base): self.__base = base def set_height(self, height): ...
class Area_model(object): def __init__( self, name = "Area_name", polish_name = "Polish_area_name", workstations = {}, layout_path = "" ): self.name = name self.polish_name = polish_name self.workstations = workstations self.layout_path =...
class Area_Model(object): def __init__(self, name='Area_name', polish_name='Polish_area_name', workstations={}, layout_path=''): self.name = name self.polish_name = polish_name self.workstations = workstations self.layout_path = layout_path
# Python - 3.6.0 Test.describe('Basic tests') Test.assert_equals(bonus_time(10000, True), '$100000') Test.assert_equals(bonus_time(25000, True), '$250000') Test.assert_equals(bonus_time(10000, False), '$10000') Test.assert_equals(bonus_time(60000, False), '$60000') Test.assert_equals(bonus_time(2, True), '$20') Test.a...
Test.describe('Basic tests') Test.assert_equals(bonus_time(10000, True), '$100000') Test.assert_equals(bonus_time(25000, True), '$250000') Test.assert_equals(bonus_time(10000, False), '$10000') Test.assert_equals(bonus_time(60000, False), '$60000') Test.assert_equals(bonus_time(2, True), '$20') Test.assert_equals(bonus...
class LinkNodes: top_url = None top_dir = None page_url = None prntnode = None samedomain = True prntcheck = True link_nodes = None link_count = 0 check_index = 0 allow_urls = {} deny_urls = {} deny_exts = {} allow_exts = {} def __init__(self, page_url, prnt...
class Linknodes: top_url = None top_dir = None page_url = None prntnode = None samedomain = True prntcheck = True link_nodes = None link_count = 0 check_index = 0 allow_urls = {} deny_urls = {} deny_exts = {} allow_exts = {} def __init__(self, page_url, prntnode,...
# # author: wang-yang # email: tnst92002@gmail.com # N = int(input()) def run(s: str): res = [] cnt = [0] * 26 for c in s: cnt[c] += 1 order = 0 while True: end = True if order == 0 : for i in range(26): if cnt[i] != 0: end = F...
n = int(input()) def run(s: str): res = [] cnt = [0] * 26 for c in s: cnt[c] += 1 order = 0 while True: end = True if order == 0: for i in range(26): if cnt[i] != 0: end = False cnt[i] = cnt[i] - 1 ...
#Test python program to generate hello world 4 times def hey(): for i in range(4): print ("Hello World") if __name__=='__main__': hey()
def hey(): for i in range(4): print('Hello World') if __name__ == '__main__': hey()
class Solution: def countSquares(self, matrix: List[List[int]]) -> int: counter = 0 for size in range(1, min(len(matrix), len(matrix[0])) + 1): for i in range(0, len(matrix) - size + 1): for j in range(0, len(matrix[0]) - size + 1): counter += sum([sum...
class Solution: def count_squares(self, matrix: List[List[int]]) -> int: counter = 0 for size in range(1, min(len(matrix), len(matrix[0])) + 1): for i in range(0, len(matrix) - size + 1): for j in range(0, len(matrix[0]) - size + 1): counter += sum([s...
class QueueArray: def __init__(self, capacity): self._data = [] self._count = 0 self._head = 0 self._tail = 0 self._n = capacity def enQueue(self, item): if self._n == self._tail: if self._head == 0: print ("Enqueue fail...
class Queuearray: def __init__(self, capacity): self._data = [] self._count = 0 self._head = 0 self._tail = 0 self._n = capacity def en_queue(self, item): if self._n == self._tail: if self._head == 0: print('Enqueue failed. The queue ...
# Team 5 def save_to_database(datatables: list, directory=None): pass def open_database(): pass
def save_to_database(datatables: list, directory=None): pass def open_database(): pass
#/* *** ODSATag: Payroll *** */ # A simple payroll entry with ID, name, address fields class Payroll: def __init__(self, inID, inname, inaddr): self.ID = inID self.name = inname self.address = inaddr def getID(self): return self.ID def getname(self): return self.name def getaddr...
class Payroll: def __init__(self, inID, inname, inaddr): self.ID = inID self.name = inname self.address = inaddr def get_id(self): return self.ID def getname(self): return self.name def getaddr(self): return self.address
# i = 0 # s = 0 # while i < 10: # i = i + 1 # s = s + i # if s > 15: # break # i = i + 1 # print(i) # limit = 25 # numbers = [] # while len(numbers) < 5: # for i in range(limit): # if i % 3 != 0: # continue # else: # numbers.append(i) # print(len(n...
names = [] numbers = [] while True: address = input() if address == 'MEOW': break address_split = address.split() names.append(address_split[0]) numbers.append(int(address_split[1])) x = numbers.index(max(numbers)) print(names[x])
class Weapon: possible_weapons = {"Paper", "Rock", "Scissor"} lookup_table = {("Scissor", "Scissor"): "TIE", ("Scissor", "Rock"): "Rock", ("Scissor", "Paper"): "Scissor", ("Rock", "Scissor"): "Rock", ("Rock", "Rock"): "TIE", ...
class Weapon: possible_weapons = {'Paper', 'Rock', 'Scissor'} lookup_table = {('Scissor', 'Scissor'): 'TIE', ('Scissor', 'Rock'): 'Rock', ('Scissor', 'Paper'): 'Scissor', ('Rock', 'Scissor'): 'Rock', ('Rock', 'Rock'): 'TIE', ('Rock', 'Paper'): 'Paper', ('Paper', 'Scissor'): 'Scissor', ('Paper', 'Rock'): 'Paper'...
nam1 = '"Teddy" Roosevelt' nam2 = 'Theodore "Teddy" Roosevelt' age = 60 wt = 199.1515115 #%% # minimal formating -- {n} represents data item n --- notice misalignment out1 = "name: {0} age: {1} weight: {2}" #%% print("name: {0} age: {1} weight: {2}".format(nam1,age,wt)) print("name: {0} age: {1} weight: {2}"...
nam1 = '"Teddy" Roosevelt' nam2 = 'Theodore "Teddy" Roosevelt' age = 60 wt = 199.1515115 out1 = 'name: {0} age: {1} weight: {2}' print('name: {0} age: {1} weight: {2}'.format(nam1, age, wt)) print('name: {0} age: {1} weight: {2}'.format(nam2, age, wt)) out2 = 'name: {0:>26} age: {1:>4} weight: {2:>10}' print('...