content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def urlopen(): pass usocket = None
def urlopen(): pass usocket = None
def LABELS(): LABELS1 = { "1": "speed limit 30 (prohibitory)", "0": "speed limit 20 (prohibitory)", "2": "speed limit 50 (prohibitory)", "3": "speed limit 60 (prohibitory)", "4": "speed limit 70 (prohibitory)", "5": "speed limit 80 (prohibitory)", "6": "restr...
def labels(): labels1 = {'1': 'speed limit 30 (prohibitory)', '0': 'speed limit 20 (prohibitory)', '2': 'speed limit 50 (prohibitory)', '3': 'speed limit 60 (prohibitory)', '4': 'speed limit 70 (prohibitory)', '5': 'speed limit 80 (prohibitory)', '6': 'restriction ends 80 (other)', '7': 'speed limit 100 (prohibitor...
""" Name: Srinivas Jakkula CIS 41A Spring 2020 Unit G Take-Home Assignment """ def part1(): max_pop = 0 max_state = "" file_obj = open("States.txt", "r") for line in file_obj: line_list = line.split() pop = int(line_list[2]) if line_list[1] == "Midwest" and pop > max_pop: ...
""" Name: Srinivas Jakkula CIS 41A Spring 2020 Unit G Take-Home Assignment """ def part1(): max_pop = 0 max_state = '' file_obj = open('States.txt', 'r') for line in file_obj: line_list = line.split() pop = int(line_list[2]) if line_list[1] == 'Midwest' and pop > max_pop: ...
""" This module contains heuristic search algorithm implemtations, like A*. The ``lib.search.graph.Graph`` is supposed to be used as a bases for these implementations. """
""" This module contains heuristic search algorithm implemtations, like A*. The ``lib.search.graph.Graph`` is supposed to be used as a bases for these implementations. """
"""Application base, containing global templates.""" default_app_config = 'pontoon.base.apps.BaseConfig' MOZILLA_REPOS = ( 'ssh://hg.mozilla.org/users/m_owca.info/firefox-beta/', 'ssh://hg.mozilla.org/users/m_owca.info/firefox-for-android-beta/', 'ssh://hg.mozilla.org/users/m_owca.info/thunderbird-beta/',...
"""Application base, containing global templates.""" default_app_config = 'pontoon.base.apps.BaseConfig' mozilla_repos = ('ssh://hg.mozilla.org/users/m_owca.info/firefox-beta/', 'ssh://hg.mozilla.org/users/m_owca.info/firefox-for-android-beta/', 'ssh://hg.mozilla.org/users/m_owca.info/thunderbird-beta/', 'ssh://hg.mozi...
def reverse(x: int): """ takes in integer and output it's reverse """ result = 0 if x < 0: x = x*(-1) a = -1 else: a = 1 while x > 0: carry = x%10 result = result*10+carry x = x//10 result = result*a if result < -2**31 or result > (2**3...
def reverse(x: int): """ takes in integer and output it's reverse """ result = 0 if x < 0: x = x * -1 a = -1 else: a = 1 while x > 0: carry = x % 10 result = result * 10 + carry x = x // 10 result = result * a if result < -2 ** 31 or re...
SKIP = 2 driver.add_pipeline('Create', [ Filter(Service, CreateService), CreateCounter(), Filter(Message, [UnitCreated]), Timer('unit creation intervals', SKIP) ]) units_per_level = Counter('units ordered per level', LinearOrderExtended, lambda entry: entry[Size]) timing_freq = Timer('timing unit deci...
skip = 2 driver.add_pipeline('Create', [filter(Service, CreateService), create_counter(), filter(Message, [UnitCreated]), timer('unit creation intervals', SKIP)]) units_per_level = counter('units ordered per level', LinearOrderExtended, lambda entry: entry[Size]) timing_freq = timer('timing unit decision intervals', SK...
# super() deep dive # mechanism of super() # super() can also take two parameter: # the first is the subclass, the second is an object that is an instance of # that subclass class Rectangle: def __init__(self, length, width): self.length = length self.width = width def area(self): ret...
class Rectangle: def __init__(self, length, width): self.length = length self.width = width def area(self): return self.length * self.width def perimeter(self): return 2 * self.length * self.width class Square(Rectangle): def __init__(self, length): super(Squ...
#create list List = [1,2,3,4] Tuple = (8,1,2011) print("Size of list:", List.__sizeof__()) print("Size of tuple:", Tuple.__sizeof__())
list = [1, 2, 3, 4] tuple = (8, 1, 2011) print('Size of list:', List.__sizeof__()) print('Size of tuple:', Tuple.__sizeof__())
def categorize(biblio, root, directory_keyname, category_keyname): skip_len = len(root) + 1 for book in biblio: directory = book[directory_keyname] structure = directory[skip_len:] category = structure.split('\\') book[category_keyname] = category
def categorize(biblio, root, directory_keyname, category_keyname): skip_len = len(root) + 1 for book in biblio: directory = book[directory_keyname] structure = directory[skip_len:] category = structure.split('\\') book[category_keyname] = category
name, age = "Harikrishnan", 25 username = "hari94codes" print ('Hello!') print("Name: {}\nAge: {}\nUsername: {}".format(name, age, username))
(name, age) = ('Harikrishnan', 25) username = 'hari94codes' print('Hello!') print('Name: {}\nAge: {}\nUsername: {}'.format(name, age, username))
wsHub = { "endPoint": "ws://192.168.0.163:8080/", "onConnection": "hubConnected", "onReceived": "receivedNote", } wsHassio = { "endPoint": "ws://192.168.0.163:8123/api/websocket", "onConnection": "hassioConnected", "onReceived": "receivedNotice", } wsClient = wsHub ttyBridge = { "onReceiv...
ws_hub = {'endPoint': 'ws://192.168.0.163:8080/', 'onConnection': 'hubConnected', 'onReceived': 'receivedNote'} ws_hassio = {'endPoint': 'ws://192.168.0.163:8123/api/websocket', 'onConnection': 'hassioConnected', 'onReceived': 'receivedNotice'} ws_client = wsHub tty_bridge = {'onReceived': None, 'onConnection': None, '...
def divide1(x, y): try: # Floor Division : Gives only Fractional Part as Answer result = x // y print("Yeah ! Your answer is :", result) except ZeroDivisionError: print("Sorry ! You are dividing by zero ") def divide2(x, y): try: print(f'{x}/{y} is {x / y}') ...
def divide1(x, y): try: result = x // y print('Yeah ! Your answer is :', result) except ZeroDivisionError: print('Sorry ! You are dividing by zero ') def divide2(x, y): try: print(f'{x}/{y} is {x / y}') except ZeroDivisionError as e: print(e) else: pr...
class Solution: def removeDuplicates(self, nums: List[int]) -> int: # base case if len(nums) <= 1: return len(nums) count = 1 j = 1 for i in range(len(nums) - 1): while j < len(nums): if nums[i] == nums[j]: ...
class Solution: def remove_duplicates(self, nums: List[int]) -> int: if len(nums) <= 1: return len(nums) count = 1 j = 1 for i in range(len(nums) - 1): while j < len(nums): if nums[i] == nums[j]: j += 1 else...
class Unit(object): def __init__(self): pass def __str__(self): pass class Seconds(Unit): def __init__(self): super().__init__() def __str__(self): return "(s)"
class Unit(object): def __init__(self): pass def __str__(self): pass class Seconds(Unit): def __init__(self): super().__init__() def __str__(self): return '(s)'
# write a python program to add two numbers num1 = 1.5 num2 = 6.3 sum = num1 + num2 print(f'Sum: {sum}') # write a python function to add two user provided numbers and return the sum def add_two_numbers(num1, num2): sum = num1 + num2 return sum # write a program to find and print the largest among three nu...
num1 = 1.5 num2 = 6.3 sum = num1 + num2 print(f'Sum: {sum}') def add_two_numbers(num1, num2): sum = num1 + num2 return sum num1 = 10 num2 = 12 num3 = 14 if num1 >= num2 and num1 >= num3: largest = num1 elif num2 >= num1 and num2 >= num3: largest = num2 else: largest = num3 print(f'largest:{largest}...
# Databricks notebook source # MAGIC %md-sandbox # MAGIC # MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;"> # MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px"> # MAGIC </div> # COMMAND ---------- # M...
print(f'Target: {DA.db_name}') print(f'Storage location: {DA.paths.storage_location}')
followers = {} while True: command = input().split(": ") if command[0] == "Log out": break username = command[1] if command[0] == "New follower": if username not in followers: followers[username] = (0, 0) elif command[0] == "Like": count = int(command[2]) ...
followers = {} while True: command = input().split(': ') if command[0] == 'Log out': break username = command[1] if command[0] == 'New follower': if username not in followers: followers[username] = (0, 0) elif command[0] == 'Like': count = int(command[2]) ...
BIRD = [212, 4] REPTILE = [358, 4] MOLLUSCS = [52, 4] CHEPHALOPODS = [136, 5] MAMMAL = [359, 4] RODENTS = [1459, 5] FISSIPEDIA = [732, 5] MUSTELIDAE = [5307, 6] # badgers, weasels, martens, ferrets, minks and wolverines CANIDAE = [9701, 6] # domestic dogs, wolves, foxes, jackals, coyotes, CANIS = [5219142, 7] # ...
bird = [212, 4] reptile = [358, 4] molluscs = [52, 4] chephalopods = [136, 5] mammal = [359, 4] rodents = [1459, 5] fissipedia = [732, 5] mustelidae = [5307, 6] canidae = [9701, 6] canis = [5219142, 7] canis_lupus = [5219173, 8] vulpes = [5219234, 7] felidae = [9703, 6] felis = [2435022, 7] leopardus = [2434918, 7] pan...
""" Data format for unit commitment problem """ IG = 1 PG = 2
""" Data format for unit commitment problem """ ig = 1 pg = 2
# Copyright 2015-2017 Cisco Systems, Inc. # 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 ...
"""RFC 2858 subsequent address family numbers""" safnum_unicast = 1 safnum_mulcast = 2 safnum_unimulc = 3 safnum_mpls_label = 4 safnum_mcast_vpn = 5 safnum_encapsulation = 7 safnum_tunnel = 64 safnum_vpls = 65 safnum_mdt = 66 safnum_evpn = 70 safnum_bgpls = 71 safnum_srte = 73 safnum_lab_vpnunicast = 128 safnum_lab_vpn...
"""Helper functions for small things done in many places.""" def dot_join(*args): """Join the args together.""" return '.'.join(args)
"""Helper functions for small things done in many places.""" def dot_join(*args): """Join the args together.""" return '.'.join(args)
NAMESPACE_FILE = '/var/run/secrets/kubernetes.io/serviceaccount/namespace' def get_k8s_namespace(): with open(NAMESPACE_FILE, 'r') as f: return f.read()
namespace_file = '/var/run/secrets/kubernetes.io/serviceaccount/namespace' def get_k8s_namespace(): with open(NAMESPACE_FILE, 'r') as f: return f.read()
# PySNMP SMI module. Autogenerated from smidump -f python TOKEN-RING-RMON-MIB # by libsmi2pysnmp-0.1.3 at Mon Apr 2 20:39:46 2012, # Python version sys.version_info(major=2, minor=7, micro=2, releaselevel='final', serial=0) # Imports ( Integer, ObjectIdentifier, OctetString, ) = mibBuilder.importSymbols("ASN1", "I...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, single_value_constraint, value_range_constraint, value_size_constraint) ...
#Body """ Compare two linked list head could be None as well for empty list Node is defined as class Node(object): def __init__(self, data=None, next_node=None): self.data = data self.next = next_node return back the head of the linked list in the below method. """ class Node(object): def _...
""" Compare two linked list head could be None as well for empty list Node is defined as class Node(object): def __init__(self, data=None, next_node=None): self.data = data self.next = next_node return back the head of the linked list in the below method. """ class Node(object): def __ini...
HOST = "0.0.0.0" PORT = 8140 # https://docs.sqlalchemy.org/en/14/dialects/postgresql.html POSTGRESQL_URL = "postgresql+asyncpg://imgsmlr:imgsmlr-123456@127.0.0.1:5400/imgsmlr" SQL_DEBUG = False SEARCH_LIMIT = 50 SEARCH_SIMR_THRESHOLD = 4.5
host = '0.0.0.0' port = 8140 postgresql_url = 'postgresql+asyncpg://imgsmlr:imgsmlr-123456@127.0.0.1:5400/imgsmlr' sql_debug = False search_limit = 50 search_simr_threshold = 4.5
# Copyright (c) 2018 PrimeVR # Distributed under the MIT software license, see the accompanying # file LICENSE or http://www.opensource.org/licenses/mit-license.php def united_bitcoin_qualification(span): ubtc_start = 494000 ubtc_end = 502315 if not span['defunded']: return None if (span['defun...
def united_bitcoin_qualification(span): ubtc_start = 494000 ubtc_end = 502315 if not span['defunded']: return None if span['defunded']['block'] < ubtc_end and span['defunded']['block'] > ubtc_start: return span['defunded']['value'] return None united_bitcoin = {'id': 'united-bitcoin'...
""" Profile ../profile-datasets-py/div83/010.py file automaticaly created by prof_gen.py script """ self["ID"] = "../profile-datasets-py/div83/010.py" self["Q"] = numpy.array([ 2.095776, 2.465104, 3.1296 , 3.963974, 5.003875, 5.921015, 6.371809, 6.473068, 6.457728, 6.4...
""" Profile ../profile-datasets-py/div83/010.py file automaticaly created by prof_gen.py script """ self['ID'] = '../profile-datasets-py/div83/010.py' self['Q'] = numpy.array([2.095776, 2.465104, 3.1296, 3.963974, 5.003875, 5.921015, 6.371809, 6.473068, 6.457728, 6.408619, 6.31879, 6.221031, 6.186012, 6.208...
class Protocol: def __init__(self, data): self.iniciator = data.get('iniciator', {}) self.responder = data.get('responder', {})
class Protocol: def __init__(self, data): self.iniciator = data.get('iniciator', {}) self.responder = data.get('responder', {})
N = int(input()) t_list = [int(input()) for _ in range(N)] if N == 1: print(t_list[0]) exit() ans = float("inf") for bit in range(2 ** N): one = 0 zero = 0 for j in range(N): if 1 & bit >> j: one += t_list[j] else: zero += t_list[j] ans = min(ans, max(one...
n = int(input()) t_list = [int(input()) for _ in range(N)] if N == 1: print(t_list[0]) exit() ans = float('inf') for bit in range(2 ** N): one = 0 zero = 0 for j in range(N): if 1 & bit >> j: one += t_list[j] else: zero += t_list[j] ans = min(ans, max(one,...
""" This script is used for course notes. Author: Erick Marin Date: 11/28/2020 """ # Creating a file object and assigning a variable. file = open("Course_2/Week_2/spider.txt") # The operating system checks that we have permissions to access that file and # then gives our code a file descriptor. This is a token gener...
""" This script is used for course notes. Author: Erick Marin Date: 11/28/2020 """ file = open('Course_2/Week_2/spider.txt') print(file.readline()) print(file.readline()) print(file.read()) file.close() with open('Course_2/Week_2/spider.txt') as file: print(file.readline())
# This controls how frequently the whole batch is iterated over vs only # {QUICK_EVAL_PERCENT} of the data QUICK_EVAL_FREQUENCY = 0 QUICK_EVAL_PERCENT = 0.05 QUICK_EVAL_TRAIN_PERCENT = 0.025 def train( device, model, manifold, dimension, data, optimizer, loss_pa...
quick_eval_frequency = 0 quick_eval_percent = 0.05 quick_eval_train_percent = 0.025 def train(device, model, manifold, dimension, data, optimizer, loss_params, n_epochs, eval_every, sample_neighbors_every, lr_scheduler, shared_params, thread_number, feature_manifold, conformal_loss_params, tensorboard_watch={}, eval_d...
class MyClass: def __init__(self, value): self.__value = value def __int__(self): return int(self.__value) c = MyClass(1.23) print(int(c))
class Myclass: def __init__(self, value): self.__value = value def __int__(self): return int(self.__value) c = my_class(1.23) print(int(c))
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"component_save_data_fixture": "tst.components.ipynb", "column_transformer_data_fixture": "tst.compose.ipynb", "multi_split_data_fixture": "tst.compose.ipynb", "test_pipeline_find_l...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'component_save_data_fixture': 'tst.components.ipynb', 'column_transformer_data_fixture': 'tst.compose.ipynb', 'multi_split_data_fixture': 'tst.compose.ipynb', 'test_pipeline_find_last_fitted_model_seq_others': 'tst.compose.ipynb', 'test_pipeline_fi...
def solution(): data = open(r'inputs\day13.in').readlines() print('Part 1 result: ' + str(part1(data))) print('Part 2 result: ' + str(part2(data))) def part1(data): # build out the grid and instructions from our data grid, fold_instructions = build_grid_and_instructions(data) # run the first f...
def solution(): data = open('inputs\\day13.in').readlines() print('Part 1 result: ' + str(part1(data))) print('Part 2 result: ' + str(part2(data))) def part1(data): (grid, fold_instructions) = build_grid_and_instructions(data) grid = fold(grid, fold_instructions[0]) return len(grid) def part2(...
cappacity = 0 lines = int(input()) for i in range(0, lines): water = int(input()) if cappacity + water > 255: print("Insufficient capacity!") continue else: cappacity += water print(cappacity)
cappacity = 0 lines = int(input()) for i in range(0, lines): water = int(input()) if cappacity + water > 255: print('Insufficient capacity!') continue else: cappacity += water print(cappacity)
# Write your code here def query(arr, x, l, r, k): for i in range(l-1,r): if arr[i] == x: k -= 1 if k == 0: print(i+1) return print(-1) return def update(arr, ind, value): arr[ind-1] = value n,x = map(int, input().split()) arr ...
def query(arr, x, l, r, k): for i in range(l - 1, r): if arr[i] == x: k -= 1 if k == 0: print(i + 1) return print(-1) return def update(arr, ind, value): arr[ind - 1] = value (n, x) = map(int, input().split()) arr = list(map(int, input().split())) q =...
""" makers ====== Auxjad's leaf making classes. """
""" makers ====== Auxjad's leaf making classes. """
def foo(a, b): a = a + b print(a, b) def bar(x): x += 1 print(x+1) x = x + 1 return x def multi( a, b, c=12): pass if a is None: print(123) if a == b and \ True: print(bla) class A: def bar(self, aa): print(aa)
def foo(a, b): a = a + b print(a, b) def bar(x): x += 1 print(x + 1) x = x + 1 return x def multi(a, b, c=12): pass if a is None: print(123) if a == b and True: print(bla) class A: def bar(self, aa): print(aa)
def part_one(data_input: list) -> int: frequency = 0 for line in data_input: frequency += int(line) return frequency def part_two(data_input: list) -> int: change_after_iteration = sum(data_input) if not change_after_iteration: return change_after_iteration best_n_repetition =...
def part_one(data_input: list) -> int: frequency = 0 for line in data_input: frequency += int(line) return frequency def part_two(data_input: list) -> int: change_after_iteration = sum(data_input) if not change_after_iteration: return change_after_iteration best_n_repetition = f...
''' This is the 5th problem on Day 3 based on if else and if statements In this problem, we are going to build a love calculator which shall calculate compatibility between 2 people if score < 10 or score > 90, we have to print Your score is this, you go together like coke and mentos if score >=40 and score <= 50 we h...
""" This is the 5th problem on Day 3 based on if else and if statements In this problem, we are going to build a love calculator which shall calculate compatibility between 2 people if score < 10 or score > 90, we have to print Your score is this, you go together like coke and mentos if score >=40 and score <= 50 we h...
"""merge 886b65 and f94174 Revision ID: 99822318096d Revises: f94174183e7e, 886b65e82e3e Create Date: 2020-10-29 15:54:09.623122 """ # revision identifiers, used by Alembic. revision = '99822318096d' down_revision = ('f94174183e7e', '886b65e82e3e') branch_labels = None depends_on = None def upgrade(): pass ...
"""merge 886b65 and f94174 Revision ID: 99822318096d Revises: f94174183e7e, 886b65e82e3e Create Date: 2020-10-29 15:54:09.623122 """ revision = '99822318096d' down_revision = ('f94174183e7e', '886b65e82e3e') branch_labels = None depends_on = None def upgrade(): pass def downgrade(): pass
# learn about boolean #a=True #b=False a=not True b=not False print(a) print(b)
a = not True b = not False print(a) print(b)
def affiche_table(liste): ... def construit_table(largeur, hauteur): tab = [[],[]] for nb in range(largeur): tab[0].append(nb+1) for nb in range(hauteur): tab[1].append(nb+1) for line in hauteur: tab.append([]) return tab
def affiche_table(liste): ... def construit_table(largeur, hauteur): tab = [[], []] for nb in range(largeur): tab[0].append(nb + 1) for nb in range(hauteur): tab[1].append(nb + 1) for line in hauteur: tab.append([]) return tab
name = "Gary" number = len(name) * 3 print("Hello {}, your lucky number is {}".format(name, number))
name = 'Gary' number = len(name) * 3 print('Hello {}, your lucky number is {}'.format(name, number))
# DP N = int(input()) A = [list(map(int, input().split())) for _ in range(2)] b = [[0] * N for _ in range(2)] b[0][0] = A[0][0] for i in range(1, N): b[0][i] = b[0][i - 1] + A[0][i] b[1][0] = b[0][0] + A[1][0] for i in range(1, N): b[1][i] = max(b[1][i - 1], b[0][i]) + A[1][i] print(b[1][N - 1])
n = int(input()) a = [list(map(int, input().split())) for _ in range(2)] b = [[0] * N for _ in range(2)] b[0][0] = A[0][0] for i in range(1, N): b[0][i] = b[0][i - 1] + A[0][i] b[1][0] = b[0][0] + A[1][0] for i in range(1, N): b[1][i] = max(b[1][i - 1], b[0][i]) + A[1][i] print(b[1][N - 1])
class Solution: def missingNumber(self, nums: List[int]) -> int: ideal_sum = 0 actual_sum = 0 for i in range(0, len(nums)): ideal_sum += i actual_sum += nums[i] ideal_sum += len(nums) return ideal_sum - actual_sum
class Solution: def missing_number(self, nums: List[int]) -> int: ideal_sum = 0 actual_sum = 0 for i in range(0, len(nums)): ideal_sum += i actual_sum += nums[i] ideal_sum += len(nums) return ideal_sum - actual_sum
class TokenType: ID = 'ID' STRING = 'STRING' NUMBER = 'NUMBER' REGEX = 'REGEX' COMMA = 'COMMA' L_BRACKET = 'LEFT BRACKET' R_BRACKET = 'RIGHT BRACKET' COLON = 'COLON' SEMICOLON = 'SEMICOLON' NEW_LINE = 'NEW LINE' TAB = 'TAB' class Token: def __init__(self, token_type, lex...
class Tokentype: id = 'ID' string = 'STRING' number = 'NUMBER' regex = 'REGEX' comma = 'COMMA' l_bracket = 'LEFT BRACKET' r_bracket = 'RIGHT BRACKET' colon = 'COLON' semicolon = 'SEMICOLON' new_line = 'NEW LINE' tab = 'TAB' class Token: def __init__(self, token_type, le...
array = list(input().split(",")) def find_single(array): for item in array: if array.count(item) == 1: return item print(find_single(array))
array = list(input().split(',')) def find_single(array): for item in array: if array.count(item) == 1: return item print(find_single(array))
n = int(input()) height = list(map(int,input().strip(" ").split())) distinct = set(height) average = sum(distinct)/len(distinct) print(average)
n = int(input()) height = list(map(int, input().strip(' ').split())) distinct = set(height) average = sum(distinct) / len(distinct) print(average)
# Write your solution for 1.4 here! def is_prime(x): a=0 for i in range(2,x): if x%i==0: a+=1 if a==1: return(False) print("False") else: return(True) print("True") is_prime(13) is_prime(4)
def is_prime(x): a = 0 for i in range(2, x): if x % i == 0: a += 1 if a == 1: return False print('False') else: return True print('True') is_prime(13) is_prime(4)
def runner_cli(augury, args): assert args.cmd == 'runner' paths = { 'status': set_status, 'config': get_config, 'artifacts': add_artifacts, } paths[args.runner_cmd](augury, args) def set_status(augury, args): if args.status: print(augury.set_runner_status(args.stat...
def runner_cli(augury, args): assert args.cmd == 'runner' paths = {'status': set_status, 'config': get_config, 'artifacts': add_artifacts} paths[args.runner_cmd](augury, args) def set_status(augury, args): if args.status: print(augury.set_runner_status(args.status)) else: print(augu...
locit_settings = { 'scaling': 'none' } coral_settings = { 'scaling': 'none' # needs to be none with separate test set! } pwmstl_settings = { 'mu': 0.1, 'rho': 1.0, 'beta1': 10.0, 'beta2': 10.0, 'kernel': 'linear', 'max_alpha': 10.0, 'tau_lambda': 1.0 }
locit_settings = {'scaling': 'none'} coral_settings = {'scaling': 'none'} pwmstl_settings = {'mu': 0.1, 'rho': 1.0, 'beta1': 10.0, 'beta2': 10.0, 'kernel': 'linear', 'max_alpha': 10.0, 'tau_lambda': 1.0}
# # Copyright 2022 Duncan Rose # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
fill = 8080 class Spacereq: def __init__(self, minx, desx, maxx, miny, desy, maxy): self._xmax = _fill_or(maxx) self._xmin = _fill_or(minx) self._xpref = _fill_or(desx) self._ymax = _fill_or(maxy) self._ymin = _fill_or(miny) self._ypref = _fill_or(desy) def __r...
errors = { 'NotFound': { 'status': 404, }, 'BadRequest': { 'status': 400, }, 'MethodNotAllowed': { 'status': 405, } }
errors = {'NotFound': {'status': 404}, 'BadRequest': {'status': 400}, 'MethodNotAllowed': {'status': 405}}
# Copyright (c) 2019-2020 Intel Corporation # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publi...
install = ['libva', 'libva-utils', 'gmmlib', 'ffmpeg', 'metrics-calc-lite', 'media-driver', 'mediasdk'] test_script_path = infra_path / 'driver_tests' test_env = {'MFX_HOME': '/opt/intel/mediasdk', 'LD_LIBRARY_PATH': '/opt/intel/mediasdk/lib64', 'LIBVA_DRIVERS_PATH': '/opt/intel/msdk_driver/lib64', 'LIBVA_DRIVER_NAME':...
# This is my first Python Project using Project Euler. # Find the sum of all the multiples of 3 or 5 below 1000. # The easy and efficient way # (1 + 2 + 3 + .... n) = 1/2 n(n+1) print(0.5*((333*1002)+(199*1000)-(66*1005))) # The second way # I am defining a function to sum up all of the multiples of 3 and 5...
print(0.5 * (333 * 1002 + 199 * 1000 - 66 * 1005)) def sum(): number = range(1, 1000) def multiple_of_3(): for x in Number: y = x / 3 print(y) if type(y) == int: print(x) else: pass multiple_of_3() sum() a = range(1000) count = 0 for ...
""" Adds the even valued numbers of the fibonacci series below limit Author: Juan Rios """ def fibonacci_sum(limit): a = 1 b = 2 sum = 0 while (b<limit): if (b%2==0): sum += b temp = b b += a a = temp return sum if __name__ == "__main__": limit = 400...
""" Adds the even valued numbers of the fibonacci series below limit Author: Juan Rios """ def fibonacci_sum(limit): a = 1 b = 2 sum = 0 while b < limit: if b % 2 == 0: sum += b temp = b b += a a = temp return sum if __name__ == '__main__': limit = 40...
''' File: __init__.py Project: src File Created: Sunday, 28th February 2021 3:03:13 am Author: Sparsh Dutta (sparsh.dtt@gmail.com) ----- Last Modified: Sunday, 28th February 2021 3:03:13 am Modified By: Sparsh Dutta (sparsh.dtt@gmail.com>) ----- Copyright 2021 Sparsh Dutta '''
""" File: __init__.py Project: src File Created: Sunday, 28th February 2021 3:03:13 am Author: Sparsh Dutta (sparsh.dtt@gmail.com) ----- Last Modified: Sunday, 28th February 2021 3:03:13 am Modified By: Sparsh Dutta (sparsh.dtt@gmail.com>) ----- Copyright 2021 Sparsh Dutta """
""":mod:`Stock` -- Provides an interface for Neopets stocks .. module:: Stock :synopsis: Provides an interface for Neopets stocks .. moduleauthor:: Kelly McBride <kemcbride28@gmail.com> """ def clean_numeric(string_value): # Clean commas cleaned = string_value.replace(',', '') # Clean percent signs ...
""":mod:`Stock` -- Provides an interface for Neopets stocks .. module:: Stock :synopsis: Provides an interface for Neopets stocks .. moduleauthor:: Kelly McBride <kemcbride28@gmail.com> """ def clean_numeric(string_value): cleaned = string_value.replace(',', '') cleaned = cleaned.replace('%', '') retur...
jpg1 = 0 jpg2 = 0 img1 = 0 img2 = 0 def setup(): global jpg1, jpg2 background(100) smooth() size(1200, 700) noStroke() jpg1 = loadImage ('br1.jpg') jpg2 = loadImage ('bread1.gif') def draw(): global jpg1, jpg2 if ( frameCount == 1): image...
jpg1 = 0 jpg2 = 0 img1 = 0 img2 = 0 def setup(): global jpg1, jpg2 background(100) smooth() size(1200, 700) no_stroke() jpg1 = load_image('br1.jpg') jpg2 = load_image('bread1.gif') def draw(): global jpg1, jpg2 if frameCount == 1: image(jpg1, 0, 0) val1 = int(random(0, ...
def slices(series, length): if len(series) <= 0 or length <= 0: raise ValueError("invalid arguments.") if length > len(series): raise ValueError(f"Cannot get {length} digit series from a {len(series)} digit string.") resultList = [] diff = len(series) - length +1 for i in range (...
def slices(series, length): if len(series) <= 0 or length <= 0: raise value_error('invalid arguments.') if length > len(series): raise value_error(f'Cannot get {length} digit series from a {len(series)} digit string.') result_list = [] diff = len(series) - length + 1 for i in range(d...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Mar 10 19:48:36 2019 @author: dvdgmf """ class MeteorologicalDiagnosis: def __init__(self, obs, pred): self.tptn = self.get_TPTN(obs, pred) self.tn = self.tptn.count('TN') self.tp = self.tptn.count('TP') self.f...
""" Created on Sun Mar 10 19:48:36 2019 @author: dvdgmf """ class Meteorologicaldiagnosis: def __init__(self, obs, pred): self.tptn = self.get_TPTN(obs, pred) self.tn = self.tptn.count('TN') self.tp = self.tptn.count('TP') self.fn = self.tptn.count('FN') self.fp = self.tpt...
""" .. module:: base_geometry :platform: Unix, Windows :synopsis: Base classes for geometry """ def validate_knot(knot): """ Confirm a knot is in the range [0, 1] Parameters ---------- knot : float Parameter to verify Returns ------- bool Whether or not the knot is...
""" .. module:: base_geometry :platform: Unix, Windows :synopsis: Base classes for geometry """ def validate_knot(knot): """ Confirm a knot is in the range [0, 1] Parameters ---------- knot : float Parameter to verify Returns ------- bool Whether or not the knot is...
class Solution: def removeDuplicates(self, nums): """ :type nums: List[int] :rtype: int """ if not nums: return 0 if len(nums) == 1: return 1 idx = 1 for n in nums[2:]: if n > nums[idx - 1]: idx += 1 ...
class Solution: def remove_duplicates(self, nums): """ :type nums: List[int] :rtype: int """ if not nums: return 0 if len(nums) == 1: return 1 idx = 1 for n in nums[2:]: if n > nums[idx - 1]: idx += ...
class Solution: def gameOfLife(self, board: List[List[int]]) -> None: """ Do not return anything, modify board in-place instead. """
class Solution: def game_of_life(self, board: List[List[int]]) -> None: """ Do not return anything, modify board in-place instead. """
# parsetab.py # This file is automatically generated. Do not edit. # pylint: disable=W,C,R _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'AND ASSIGN COMMA DEF DIFF DIVIDE ELIF ELSE EQ FALSE FLOAT FOR GET GT ID IF IN INTEGER LBRACE LBRACKET LET LPAREN LT MINUS MINUSMINUS MULTIPLY NOT OR PLUS PLUSPLUS RBRAC...
_tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'AND ASSIGN COMMA DEF DIFF DIVIDE ELIF ELSE EQ FALSE FLOAT FOR GET GT ID IF IN INTEGER LBRACE LBRACKET LET LPAREN LT MINUS MINUSMINUS MULTIPLY NOT OR PLUS PLUSPLUS RBRACE RBRACKET RPAREN SEMI STRING TRUE WHILEcode : code sent\n\t\t\t\t| sent\n\t\t\t\t| emptysent ...
# To create a variable character_name = "Jin" character_age = "99" print(character_name + " is " + character_age + " years old.") # reassigning the variable character_name = "mochi" print(character_name + " is " + character_age + " years old.") print("jin\nacademy") print(len(character_name)) # to create a new line ...
character_name = 'Jin' character_age = '99' print(character_name + ' is ' + character_age + ' years old.') character_name = 'mochi' print(character_name + ' is ' + character_age + ' years old.') print('jin\nacademy') print(len(character_name)) my_character = 'mochi' print(my_character[3]) print(my_character.index('h'))...
def gimme5(): return 5 def gimme3(): return 3
def gimme5(): return 5 def gimme3(): return 3
class Solution: def maxArea(self, height): """ :type height: List[int] :rtype: int """ p1 = 0 p2 = len(height) - 1 ret = 0 while p1 < p2: ret = max(min(height[p1], height[p2]) * (p2 - p1), ret) if height[p2] > height[p1]: ...
class Solution: def max_area(self, height): """ :type height: List[int] :rtype: int """ p1 = 0 p2 = len(height) - 1 ret = 0 while p1 < p2: ret = max(min(height[p1], height[p2]) * (p2 - p1), ret) if height[p2] > height[p1]: ...
def sqrt_approx(num): i = 0 minsq = 0 maxsq = 0 while i <= num: if i * i <= num: minsq = i if i * i >= num: maxsq = i break i = i + 1 return minsq, maxsq for i in range(0, 26): print(i, sqrt_approx(i))
def sqrt_approx(num): i = 0 minsq = 0 maxsq = 0 while i <= num: if i * i <= num: minsq = i if i * i >= num: maxsq = i break i = i + 1 return (minsq, maxsq) for i in range(0, 26): print(i, sqrt_approx(i))
# # PySNMP MIB module Wellfleet-IPEX-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-IPEX-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:40:34 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, single_value_constraint, constraints_intersection, constraints_union) ...
## lists7.py def main(): pals = ['Bob','Rob','Fred','Amy','Sarah'] pals2 = pals ## both variables refer to SAME LIST pals.remove('Fred') print(pals2) ### crude pals3 = [] for p in pals: pals3.append(p) print(pals3) ### crude dump del pals[0] ### dele...
def main(): pals = ['Bob', 'Rob', 'Fred', 'Amy', 'Sarah'] pals2 = pals pals.remove('Fred') print(pals2) pals3 = [] for p in pals: pals3.append(p) print(pals3) del pals[0] print(pals) main()
""" 1. The oscillations start getting larger and larger which could in the end become uncontrollable 2. Looking at the shape of the spiral """
""" 1. The oscillations start getting larger and larger which could in the end become uncontrollable 2. Looking at the shape of the spiral """
""" Definition of ParentTreeNode: class ParentTreeNode: def __init__(self, val): self.val = val self.parent, self.left, self.right = None, None, None """ class Solution: """ @param: root: The root of the tree @param: A: node in the tree @param: B: node in the tree @return: The ...
""" Definition of ParentTreeNode: class ParentTreeNode: def __init__(self, val): self.val = val self.parent, self.left, self.right = None, None, None """ class Solution: """ @param: root: The root of the tree @param: A: node in the tree @param: B: node in the tree @return: The l...
# Copyright 2021 John Millikin and the rust-fuse contributors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
_checksums = {'v5.2.0/pc-bios/edk2-x86_64-code.fd.bz2': '8d9af6d88f51cfb6732a2542fefa50e7d5adb81aa12d0b79342e1bc905a368f1'} _build = '\nfilegroup(\n name = "qemu",\n srcs = glob(\n ["**/*"],\n exclude = ["BUILD.bazel", "WORKSPACE"],\n ),\n visibility = ["//visibility:public"],\n)\n' def _qemu_repository(ctx)...
class fcf(object): nr_cortes = None coef_vf = None termo_i = None estagio = None def __init__(self, estagio): self.nr_cortes = 0 self.coef_vf = [] self.termo_i = [] self.estagio = estagio def add_corte(self, coeficientes, constante, volume, nr_estagios): ...
class Fcf(object): nr_cortes = None coef_vf = None termo_i = None estagio = None def __init__(self, estagio): self.nr_cortes = 0 self.coef_vf = [] self.termo_i = [] self.estagio = estagio def add_corte(self, coeficientes, constante, volume, nr_estagios): ...
def Neighbors(row: int, col: int, data: list) -> list: adjacents = [] for i in range(row - 1, row + 2): for j in range(col - 1, col + 2): if i == row and j == col or i < 0 or i >= len(data) or j < 0 or j >= len(data[0]): continue adjacents.append((i, j)) retur...
def neighbors(row: int, col: int, data: list) -> list: adjacents = [] for i in range(row - 1, row + 2): for j in range(col - 1, col + 2): if i == row and j == col or i < 0 or i >= len(data) or (j < 0) or (j >= len(data[0])): continue adjacents.append((i, j)) r...
class QuadraticEquation(object): def __init__(self, a1, a2, c, eq=0): """ :param a1: X**2 Square index. :param a2: X Meddule index. :param c: C Constants :param eq: Mostly equal to zero """ self.a1 = a1 if self.a1 == 0: raise ...
class Quadraticequation(object): def __init__(self, a1, a2, c, eq=0): """ :param a1: X**2 Square index. :param a2: X Meddule index. :param c: C Constants :param eq: Mostly equal to zero """ self.a1 = a1 if self.a1 == 0: raise ...
# Decorator for triggers # A trigger is an event that we can watch. # We expect it to return True if the event has happened and False if not. # If it has 'required_arg_types', then the trigger will request those arguments in the console # and will be passed them at runtime. class Trigger(): def __init__(self, name, de...
class Trigger: def __init__(self, name, description, required_arg_types=[], generated_arg_types=[]): self.trigger = True self.tname = name self.tdesc = description self.treqs = required_arg_types self.tgen = generated_arg_types def __call__(self, f): f.trigger =...
# Convert 1024 to binary print(bin(1024)) print(hex(1024)) # 2 palce round of 5.23222 print(round(5.23222,2)) # check if every letter in str is lowercase s='hello how are you Mary,are you feeling okay' print(s.islower()) # how many time w showup s = 'twywywtwywbwhsjhwuwshshwuwwwjdjdid' print(s.count('w')) #...
print(bin(1024)) print(hex(1024)) print(round(5.23222, 2)) s = 'hello how are you Mary,are you feeling okay' print(s.islower()) s = 'twywywtwywbwhsjhwuwshshwuwwwjdjdid' print(s.count('w')) set1 = {2, 3, 1, 5, 6, 8} set2 = {3, 1, 7, 5, 6, 8} print(set1.difference(set2)) print(set1.union(set2)) a = {x: x ** 3 for x in ra...
# Stats for each item in the game # 0-attack, 1-defense, 2-price, 3-type, 4-Pclass, 5-HP, 6-count, 7-lvl Items = {'sword': list((10, 0, 10, 'weapon', 'swordsman', 0, 0, 1)), 'bronze sword': list((15, 0, 15, 'weapon', 'swordsman', 0, 0, 5)), 'iron sword': list((20, 0, 20, 'weapon', 'swordsman', 0, 0, 1...
items = {'sword': list((10, 0, 10, 'weapon', 'swordsman', 0, 0, 1)), 'bronze sword': list((15, 0, 15, 'weapon', 'swordsman', 0, 0, 5)), 'iron sword': list((20, 0, 20, 'weapon', 'swordsman', 0, 0, 10)), 'steel sword': list((25, 0, 25, 'weapon', 'swordsman', 0, 0, 15)), 'long sword': list((30, 0, 30, 'weapon', 'swordsman...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def isSubtree(self, s: TreeNode, t: TreeNode) -> bool: def rec(s,t): if s is No...
class Solution: def is_subtree(self, s: TreeNode, t: TreeNode) -> bool: def rec(s, t): if s is None and t is None: return True if s is None or t is None: return False return s.val == t.val and rec(s.left, t.left) and rec(s.right, t.right)...
def f(a, b, c): return (a, b, c) ___assertEqual(f(*[0, 1, 2]), (0, 1, 2)) ___assertEqual(f(*"abc"), ('a', 'b', 'c')) ___assertEqual(f(*range(3)), (0, 1, 2))
def f(a, b, c): return (a, b, c) ___assert_equal(f(*[0, 1, 2]), (0, 1, 2)) ___assert_equal(f(*'abc'), ('a', 'b', 'c')) ___assert_equal(f(*range(3)), (0, 1, 2))
def is_leap(year): leap = False # Write your logic here if year%4 == 0 and year%100 != 0: leap = True elif year%400 == 0: leap = True return leap year = int(input("Enter the year")) print(is_leap(year))
def is_leap(year): leap = False if year % 4 == 0 and year % 100 != 0: leap = True elif year % 400 == 0: leap = True return leap year = int(input('Enter the year')) print(is_leap(year))
floor_lenght = float(input()) tile_wight = float(input()) tile_lenght = float(input()) bench_wight = float(input()) bench_lenght = float(input()) speed = 0.2 bench_area = bench_lenght * bench_wight tile_area = (tile_wight * tile_lenght) floor_area = floor_lenght * floor_lenght - bench_area print("%.2f" % (floor_area...
floor_lenght = float(input()) tile_wight = float(input()) tile_lenght = float(input()) bench_wight = float(input()) bench_lenght = float(input()) speed = 0.2 bench_area = bench_lenght * bench_wight tile_area = tile_wight * tile_lenght floor_area = floor_lenght * floor_lenght - bench_area print('%.2f' % (floor_area / ti...
print("give me two numbers, and I'll divide them.") print("enter 'q' to quit.") while True: first_number = input("\nFirst Number:") if first_number == 'q': break second_number = input("\nSecond Number:") if second_number == 'q': break try: answer = int(first_number)/int(secon...
print("give me two numbers, and I'll divide them.") print("enter 'q' to quit.") while True: first_number = input('\nFirst Number:') if first_number == 'q': break second_number = input('\nSecond Number:') if second_number == 'q': break try: answer = int(first_number) / int(sec...
def convert_adjacent_matrix_to_adjacent_list(graph: list, vertices: list) -> dict: result_graph = {} for v in vertices: result_graph[v] = [] rows, cols = len(graph), len(graph[0]) for i in range(rows): for j in range(cols): if graph[i][j] == 1: result_graph[v...
def convert_adjacent_matrix_to_adjacent_list(graph: list, vertices: list) -> dict: result_graph = {} for v in vertices: result_graph[v] = [] (rows, cols) = (len(graph), len(graph[0])) for i in range(rows): for j in range(cols): if graph[i][j] == 1: result_grap...
class Settlement: def __init__(self, node: int = None, tx: float = 0, ty: float = 0, tz: float = 0, rx: float = 0, ry: float = 0, rz: float = 0 ) -> None: """Creates an ins...
class Settlement: def __init__(self, node: int=None, tx: float=0, ty: float=0, tz: float=0, rx: float=0, ry: float=0, rz: float=0) -> None: """Creates an instance of the SkyCiv Settlement class. Args: node (int): The ID of the node at which the settlement is applied. tx (fl...
ANDHRA_TRACK_DIR = '/Users/jalend15/PycharmProjects/electoral_rolls/andhra/andhra_pdfs' ANDHRA_PDF_ENGLISH_DIR = '/Users/jalend15/PycharmProjects/electoral_rolls/andhra/andhra_pdfs/english' ANDHRA_PDF_TELUGU_DIR = '/Users/jalend15/PycharmProjects/electoral_rolls/andhra/andhra_pdfs/telugu'
andhra_track_dir = '/Users/jalend15/PycharmProjects/electoral_rolls/andhra/andhra_pdfs' andhra_pdf_english_dir = '/Users/jalend15/PycharmProjects/electoral_rolls/andhra/andhra_pdfs/english' andhra_pdf_telugu_dir = '/Users/jalend15/PycharmProjects/electoral_rolls/andhra/andhra_pdfs/telugu'
class shapes: Count_Cylinder=0 Count_Cone=0 def __init__(self,rad,height): self.rad=rad self.height=height def disp(self): return self.rad+","+self.height class Cone(shapes): def __init__(self,rad,height): shapes.__init__(self,rad,height) self.slen=pow((pow(self.rad,2)+pow(self.height,2)),0.5) self.Vo...
class Shapes: count__cylinder = 0 count__cone = 0 def __init__(self, rad, height): self.rad = rad self.height = height def disp(self): return self.rad + ',' + self.height class Cone(shapes): def __init__(self, rad, height): shapes.__init__(self, rad, height) ...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def verticalTraversal(self, root): result = collections.defaultdict(list) stack = [(root, 0)] while stack...
class Solution(object): def vertical_traversal(self, root): result = collections.defaultdict(list) stack = [(root, 0)] while stack: new_stack = [] cur_result = collections.defaultdict(list) for (node, level) in stack: cur_result[level].app...
""" <+$FILENAME$+> Copyright (c) <+$YEAR$+> Idiap Research Institute, http://www.idiap.ch/ Written by Weipeng He <weipeng.he@idiap.ch> """
""" <+$FILENAME$+> Copyright (c) <+$YEAR$+> Idiap Research Institute, http://www.idiap.ch/ Written by Weipeng He <weipeng.he@idiap.ch> """
def metodoBloqueioMovimento(x, y, mapaAtual, direcao, item_select): if x > -1 and x < 750 and y >-1 and y < 560: if mapaAtual == 1: if direcao == 'direita': if y < 330 and y > 200: if (x+10>350 or x+10<270): return True ...
def metodo_bloqueio_movimento(x, y, mapaAtual, direcao, item_select): if x > -1 and x < 750 and (y > -1) and (y < 560): if mapaAtual == 1: if direcao == 'direita': if y < 330 and y > 200: if x + 10 > 350 or x + 10 < 270: return True ...
class Team: def __init__(self, dmg=0, heal=0, cast=0, kills=0): self.dmg = dmg self.heal = heal self.casts = cast self.kills = kills class Teamfight: """Used to store data of a Teamfight in a Match""" def __init__(self): # Player is in teamfight self.is_in = False self.result = "" self.players = []...
class Team: def __init__(self, dmg=0, heal=0, cast=0, kills=0): self.dmg = dmg self.heal = heal self.casts = cast self.kills = kills class Teamfight: """Used to store data of a Teamfight in a Match""" def __init__(self): self.is_in = False self.result = '' ...
def fun(n): if n%2==0: return '.' return '*' l=[[fun(j) for j in range(5)] for i in range(5)] print(l)
def fun(n): if n % 2 == 0: return '.' return '*' l = [[fun(j) for j in range(5)] for i in range(5)] print(l)
''' The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
""" The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
""" A class for delayed evaluation """ class Delayed(object): """A delayed evaluation tree. """ def __init__(self, function, *args, **kwargs): self.function = function self.args = args self.kwargs = kwargs def __str__(self): return '({}, {}, {})'.format(self.function,...
""" A class for delayed evaluation """ class Delayed(object): """A delayed evaluation tree. """ def __init__(self, function, *args, **kwargs): self.function = function self.args = args self.kwargs = kwargs def __str__(self): return '({}, {}, {})'.format(self.function,...
class Stack: """A class that implements a stack. Stack is a LIFO data structure where each new item is settled on top compared to others. Requires O(n) memory to store items and O(n) time to search an item. Requires O(1) time to push and to pop an item.""" def __init__(self) -> No...
class Stack: """A class that implements a stack. Stack is a LIFO data structure where each new item is settled on top compared to others. Requires O(n) memory to store items and O(n) time to search an item. Requires O(1) time to push and to pop an item.""" def __init__(self) -> No...
class Work: __id = None __artist = None __artist_name = None __name = None __created = None __description = None __tags = [] __forks = 0 __likes = 0 __allow_download = False __allow_sketch = False __allow_fork = False __address = None def set_address(self, addres...
class Work: __id = None __artist = None __artist_name = None __name = None __created = None __description = None __tags = [] __forks = 0 __likes = 0 __allow_download = False __allow_sketch = False __allow_fork = False __address = None def set_address(self, addres...