content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# Flask settings DEBUG = False # Flask-restplus settings RESTPLUS_MASK_SWAGGER = False SWAGGER_UI_DOC_EXPANSION = 'none' # Application settings # API metadata API_TITLE = 'MAX Image Colorizer' API_DESC = 'Adds color to black and white images.' API_VERSION = '1.1.0' ERR_MSG = 'Invalid file type/extension. Please pro...
debug = False restplus_mask_swagger = False swagger_ui_doc_expansion = 'none' api_title = 'MAX Image Colorizer' api_desc = 'Adds color to black and white images.' api_version = '1.1.0' err_msg = 'Invalid file type/extension. Please provide a valid image (supported formats: JPEG, PNG).' model_name = API_TITLE model_id =...
minx = 20 maxx = 30 miny = -10 maxy = -5 minx = 25 maxx = 67 miny = -260 maxy = -200 def simulate(vx, vy): x = 0 y = 0 highest = 0 while y > miny: x += vx y += vy if vx > 0: vx -= 1 elif vx < 0: vx += 1 vy -= 1 if vy == 0: ...
minx = 20 maxx = 30 miny = -10 maxy = -5 minx = 25 maxx = 67 miny = -260 maxy = -200 def simulate(vx, vy): x = 0 y = 0 highest = 0 while y > miny: x += vx y += vy if vx > 0: vx -= 1 elif vx < 0: vx += 1 vy -= 1 if vy == 0: ...
def file_to_list(filename): lines = [] fin = open(filename, "rt", encoding="utf-8") lines = fin.readlines() fin.close() return lines def print_table(lines): template = { "1": "+" + "-" * 11 + "+" + "-" * 11 + "+" + "-" * 8 + "+", "2": "| {:<10.9}| {:<10.9}| {:<7.6}|", } ...
def file_to_list(filename): lines = [] fin = open(filename, 'rt', encoding='utf-8') lines = fin.readlines() fin.close() return lines def print_table(lines): template = {'1': '+' + '-' * 11 + '+' + '-' * 11 + '+' + '-' * 8 + '+', '2': '| {:<10.9}| {:<10.9}| {:<7.6}|'} print(template['1']) ...
# -*- coding: utf-8 -*- # Copyright 2021 Cohesity Inc. class SiteIdentity(object): """Implementation of the 'SiteIdentity' model. O365 Sharepoint online Site Identity. These may be obtained by Graph/REST or PnP cmdlets. All fields are case insensitive. Attributes: id (string): Unique guid fo...
class Siteidentity(object): """Implementation of the 'SiteIdentity' model. O365 Sharepoint online Site Identity. These may be obtained by Graph/REST or PnP cmdlets. All fields are case insensitive. Attributes: id (string): Unique guid for the site in SPO. This is a unqiue identifie...
a = int(input()) b = int(input()) c = int(input()) a_odd = a % 2 b_odd = b % 2 c_odd = c % 2 a_even = not (a % 2) b_even = not (b % 2) c_even = not (c % 2) if (a_odd or b_odd or c_odd) and (a_even or b_even or c_even): print("YES") else: print("NO")
a = int(input()) b = int(input()) c = int(input()) a_odd = a % 2 b_odd = b % 2 c_odd = c % 2 a_even = not a % 2 b_even = not b % 2 c_even = not c % 2 if (a_odd or b_odd or c_odd) and (a_even or b_even or c_even): print('YES') else: print('NO')
# Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
"""Definition of wrap_web_test_suite.""" load('//web:web.bzl', 'web_test_suite') load(':constants.bzl', 'DEFAULT_TEST_SUITE_TAGS', 'DEFAULT_WEB_TEST_SUITE_TAGS', 'DEFAULT_WRAPPED_TEST_TAGS') def wrap_web_test_suite(name, browsers, rule, args=None, browser_overrides=None, config=None, flaky=None, local=None, shard_coun...
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def closestValue(self, root: TreeNode, target: float) -> int: if root == None: return float('inf') diff = target - root.val if diff > 0: ...
class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def closest_value(self, root: TreeNode, target: float) -> int: if root == None: return float('inf') diff = target - root.val if diff > 0: ...
command = '/opt/django/smegurus-django/env/bin/gunicorn' pythonpath = '/opt/django/smegurus-django/smegurus' bind = '127.0.0.1:8001' workers = 3
command = '/opt/django/smegurus-django/env/bin/gunicorn' pythonpath = '/opt/django/smegurus-django/smegurus' bind = '127.0.0.1:8001' workers = 3
language_compiler_param = \ { "java": "-encoding UTF-8 -d -cp ." }
language_compiler_param = {'java': '-encoding UTF-8 -d -cp .'}
aTuple = ("Orange", [10, 20, 30], (5, 15, 25)) print(aTuple[1][1])
a_tuple = ('Orange', [10, 20, 30], (5, 15, 25)) print(aTuple[1][1])
__all__ = [ "sorter", "ioputter", "handler", "timer", "simple", "process", "HarnessChartProcessing", "KomaxTaskProcessing", "KomaxCore", "HarnessProcessing" ]
__all__ = ['sorter', 'ioputter', 'handler', 'timer', 'simple', 'process', 'HarnessChartProcessing', 'KomaxTaskProcessing', 'KomaxCore', 'HarnessProcessing']
_base_ = "base.py" fold = 1 percent = 1 data = dict( samples_per_gpu=1, workers_per_gpu=1, train=dict( ann_file="data/coco/annotations/semi_supervised/instances_train2017.${fold}@${percent}.json", img_prefix="data/coco/train2017/", ), ) work_dir = "work_dirs/${cfg_name}/${percent}/${fold...
_base_ = 'base.py' fold = 1 percent = 1 data = dict(samples_per_gpu=1, workers_per_gpu=1, train=dict(ann_file='data/coco/annotations/semi_supervised/instances_train2017.${fold}@${percent}.json', img_prefix='data/coco/train2017/')) work_dir = 'work_dirs/${cfg_name}/${percent}/${fold}' log_config = dict(interval=50, hook...
class GumballMonitor: def __init__(self, machine): self.machine = machine def report(self): try: print(f'Gumball Machine: {self.machine.get_location()}') print(f'Current inventory: {self.machine.get_count()} gumballs') except Exception as e: print(e)
class Gumballmonitor: def __init__(self, machine): self.machine = machine def report(self): try: print(f'Gumball Machine: {self.machine.get_location()}') print(f'Current inventory: {self.machine.get_count()} gumballs') except Exception as e: print(e)
################### Error URLs ##################### # For imageGen.py not_enough_info = 'http://i.imgur.com/2BZk32a.jpg' improperly_formatted_tag = 'http://i.imgur.com/HvFX82m.jpg' # For memeAPI.py meme_not_supported = 'http://i.imgur.com/6VoMZqm.jpg' couldnt_create_meme = 'http://i.imgur.com/bkW1HEV.jpg' too_many_li...
not_enough_info = 'http://i.imgur.com/2BZk32a.jpg' improperly_formatted_tag = 'http://i.imgur.com/HvFX82m.jpg' meme_not_supported = 'http://i.imgur.com/6VoMZqm.jpg' couldnt_create_meme = 'http://i.imgur.com/bkW1HEV.jpg' too_many_lines = 'http://i.imgur.com/fGkrbGe.jpg' too_few_lines = 'http://i.imgur.com/aLYiN7V.jpg' n...
# # PySNMP MIB module CENTILLION-FILTERS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CENTILLION-FILTERS-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:47:45 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, value_size_constraint, value_range_constraint, single_value_constraint) ...
""" Author: Haris Hasic, PhD Student Institution: Ishida Laboratory, Department of Computer Science, School of Computing, Tokyo Institute of Technology Updated on: April, 2021 Description: Currently, this folder does not contain any libraries which are taken from an outside source. Disclaimer: The...
""" Author: Haris Hasic, PhD Student Institution: Ishida Laboratory, Department of Computer Science, School of Computing, Tokyo Institute of Technology Updated on: April, 2021 Description: Currently, this folder does not contain any libraries which are taken from an outside source. Disclaimer: The...
def ask_user_for_weeknum(): weeknum = 0 while weeknum not in range(1,23): try: weeknum = int(input('Please enter the number of the week that we\'re in:')) if weeknum in range(1,23): break else: print('You did not enter a valid week number') #weeknum = int(input('...
def ask_user_for_weeknum(): weeknum = 0 while weeknum not in range(1, 23): try: weeknum = int(input("Please enter the number of the week that we're in:")) if weeknum in range(1, 23): break else: print('You did not enter a valid week num...
message = input() new_message = '' index = 0 current_text = '' multiplier = '' while index < len(message): if message[index].isdigit(): multiplier += message[index] if index+1 < len(message): if message[index+1].isdigit(): multiplier += message[index+1] ...
message = input() new_message = '' index = 0 current_text = '' multiplier = '' while index < len(message): if message[index].isdigit(): multiplier += message[index] if index + 1 < len(message): if message[index + 1].isdigit(): multiplier += message[index + 1] ...
load("//:import_external.bzl", import_external = "safe_wix_scala_maven_import_external") def dependencies(): import_external( name = "org_mongodb_mongodb_driver_reactivestreams", artifact = "org.mongodb:mongodb-driver-reactivestreams:1.11.0", jar_sha256 = "ae3d5eb3c51a0c286f43fe7ab0c52e3e0b385766f...
load('//:import_external.bzl', import_external='safe_wix_scala_maven_import_external') def dependencies(): import_external(name='org_mongodb_mongodb_driver_reactivestreams', artifact='org.mongodb:mongodb-driver-reactivestreams:1.11.0', jar_sha256='ae3d5eb3c51a0c286f43fe7ab0c52e3e0b385766f1b4dd82e06df1e617770764', ...
""" [2017-11-10] Challenge #339 [Hard] Severing the Power Grid https://www.reddit.com/r/dailyprogrammer/comments/7c4bju/20171110_challenge_339_hard_severing_the_power/ # Description In energy production, the power grid is a a large directed graph of energy consumers and producers. At times you need to cut at certain ...
""" [2017-11-10] Challenge #339 [Hard] Severing the Power Grid https://www.reddit.com/r/dailyprogrammer/comments/7c4bju/20171110_challenge_339_hard_severing_the_power/ # Description In energy production, the power grid is a a large directed graph of energy consumers and producers. At times you need to cut at certain ...
def delete_date_symbols(date,dateFormat): if(dateFormat == 'YYYY-MM-DD HH:MM:SS'): year = date[0:4] month = date[5:7] day = date[8:10] hours = date[11:13] minutes = date[14:16] seconds = date[17:19] formattedDate=year+month+day+hours+minutes+seconds re...
def delete_date_symbols(date, dateFormat): if dateFormat == 'YYYY-MM-DD HH:MM:SS': year = date[0:4] month = date[5:7] day = date[8:10] hours = date[11:13] minutes = date[14:16] seconds = date[17:19] formatted_date = year + month + day + hours + minutes + secon...
#!/usr/bin/env python """ Copyright 2012 Wordnik, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applica...
""" Copyright 2012 Wordnik, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to i...
class Solution: def countAndSay(self, n: int) -> str: if n == 1: return "1" prev = "1" for i in range(1, n): res = "" val = prev[0] count = 1 for i in range(1, len(prev)): if prev[i] == val: count...
class Solution: def count_and_say(self, n: int) -> str: if n == 1: return '1' prev = '1' for i in range(1, n): res = '' val = prev[0] count = 1 for i in range(1, len(prev)): if prev[i] == val: co...
begin_unit comment|'# Copyright 2014 OpenStack Foundation' nl|'\n' comment|'# All Rights Reserved.' nl|'\n' comment|'#' nl|'\n' comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may' nl|'\n' comment|'# not use this file except in compliance with the License. You may obtain' nl|'\n' co...
begin_unit comment | '# Copyright 2014 OpenStack Foundation' nl | '\n' comment | '# All Rights Reserved.' nl | '\n' comment | '#' nl | '\n' comment | '# Licensed under the Apache License, Version 2.0 (the "License"); you may' nl | '\n' comment | '# not use this file except in compliance with the License. You may ...
# # @lc app=leetcode id=771 lang=python3 # # [771] Jewels and Stones # # @lc code=start class Solution: def numJewelsInStones(self, J: str, S: str) -> int: jewels = set(J) number_jewels = 0 for char in S: if char in jewels: number_jewels += 1 return num...
class Solution: def num_jewels_in_stones(self, J: str, S: str) -> int: jewels = set(J) number_jewels = 0 for char in S: if char in jewels: number_jewels += 1 return number_jewels
#Odd numbers for number in range(1,21,2): print(number)
for number in range(1, 21, 2): print(number)
# Copyright (C) 2019 The Android Open Source Project # # 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 ...
def _noop_override(**kwargs): pass perfetto_config = struct(root='//', deps=struct(build_config=['//:build_config_hdr'], zlib=['@perfetto_dep_zlib//:zlib'], jsoncpp=['@perfetto_dep_jsoncpp//:jsoncpp'], linenoise=['@perfetto_dep_linenoise//:linenoise'], sqlite=['@perfetto_dep_sqlite//:sqlite'], sqlite_ext_percentile...
load("@npm//@bazel/typescript:index.bzl", "ts_library") def ng_ts_library(**kwargs): ts_library( compiler = "//libraries/angular-tools:tsc_wrapped_with_angular", supports_workers = True, use_angular_plugin = True, **kwargs )
load('@npm//@bazel/typescript:index.bzl', 'ts_library') def ng_ts_library(**kwargs): ts_library(compiler='//libraries/angular-tools:tsc_wrapped_with_angular', supports_workers=True, use_angular_plugin=True, **kwargs)
# Copyright (C) 2013 - 2016 - Oscar Campos <oscar.campos@member.fsf.org> # This program is Free Software see LICENSE file for details class StubProcess(object): """Self descriptive class name, right? """ def __init__(self, interpreter): self._process = None self._interpreter = None ...
class Stubprocess(object): """Self descriptive class name, right? """ def __init__(self, interpreter): self._process = None self._interpreter = None def start(self): """Just returns True and does nothing """ return True
def comb(n, k): if n - k < k: k = n - k if k == 0: return 1 a = 1 b = 1 for i in range(k): a *= n - i b *= i + 1 return a // b N, P = map(int, input().split()) A = list(map(int, input().split())) odds = sum(a % 2 for a in A) evens = len(A) - odds print(sum(com...
def comb(n, k): if n - k < k: k = n - k if k == 0: return 1 a = 1 b = 1 for i in range(k): a *= n - i b *= i + 1 return a // b (n, p) = map(int, input().split()) a = list(map(int, input().split())) odds = sum((a % 2 for a in A)) evens = len(A) - odds print(sum((co...
class Solution: def medianSlidingWindow(self, nums: List[int], k: int) -> List[float]: if k == 0: return [] win = sorted(nums[:k]) ans = [] for i in range(k, len(nums) + 1): median = (win[k // 2] + win[(k - 1) // 2]) / 2.0 ans.append(median) if i =...
class Solution: def median_sliding_window(self, nums: List[int], k: int) -> List[float]: if k == 0: return [] win = sorted(nums[:k]) ans = [] for i in range(k, len(nums) + 1): median = (win[k // 2] + win[(k - 1) // 2]) / 2.0 ans.append(median) ...
# https://codeforces.com/problemset/problem/230/A s, n = [int(x) for x in input().split()] dragons = [] new_dragons = [] for _ in range(n): x, y = [int(x) for x in input().split()] dragons.append([x, y]) dragons.sort() for row in range(n - 1): current_row = dragons[row] next_row = dragons[row + 1] ...
(s, n) = [int(x) for x in input().split()] dragons = [] new_dragons = [] for _ in range(n): (x, y) = [int(x) for x in input().split()] dragons.append([x, y]) dragons.sort() for row in range(n - 1): current_row = dragons[row] next_row = dragons[row + 1] if current_row[0] == next_row[0]: if cu...
# # PySNMP MIB module NMS-EPON-ONU-RESET (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NMS-EPON-ONU-RESET # Produced by pysmi-0.3.4 at Mon Apr 29 20:12:13 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, constraints_union, constraints_intersection, value_range_constraint) ...
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you m...
def duplicate_edges_in_reverse(graph): """ Takes in a directed multi graph, and creates duplicates of all edges, the duplicates having reversed direction to the originals. This is useful since directed edges constrain the direction of messages passed. We want to permit omni-directional message passing. ...
def centuryFromYear(year): remainer = year % 100 if remainer == 0: return year/100 else: return int(year/100)+1
def century_from_year(year): remainer = year % 100 if remainer == 0: return year / 100 else: return int(year / 100) + 1
#Christine Logan #9/10/2017 #CS 3240 #Lab 3: Pre-lab #hello.py def greeting(msg): print(msg) def salutation(msg): print(msg) if __name__ == "__main__": greeting("hello") salutation("goodbye")
def greeting(msg): print(msg) def salutation(msg): print(msg) if __name__ == '__main__': greeting('hello') salutation('goodbye')
# TODO: to be deleted class FieldMock: def __init__(self): self.find = lambda _: FieldMock() self.skip = lambda _: FieldMock() self.limit = lambda _: FieldMock() class BeaconMock: def __init__(self): self.datasets = FieldMock() class DBMock: def __init__(self): self...
class Fieldmock: def __init__(self): self.find = lambda _: field_mock() self.skip = lambda _: field_mock() self.limit = lambda _: field_mock() class Beaconmock: def __init__(self): self.datasets = field_mock() class Dbmock: def __init__(self): self.beacon = beaco...
class SecurityKeyError(Exception): def __init__(self, message): super().__init__(message) class ListenError(Exception): def __init__(self, message): super().__init__(message) class ChildError(Exception): def __init__(self, message): super().__init__(message)
class Securitykeyerror(Exception): def __init__(self, message): super().__init__(message) class Listenerror(Exception): def __init__(self, message): super().__init__(message) class Childerror(Exception): def __init__(self, message): super().__init__(message)
def main(): single_digit = 36 teens = 70 second_digit = 46 hundred = 7 nd = 3 thousand = 11 a = single_digit * (10 * 19) a += second_digit * 10 * 10 a += teens * 10 a += hundred * 900 a += nd * 891 a += thousand print(a) main()
def main(): single_digit = 36 teens = 70 second_digit = 46 hundred = 7 nd = 3 thousand = 11 a = single_digit * (10 * 19) a += second_digit * 10 * 10 a += teens * 10 a += hundred * 900 a += nd * 891 a += thousand print(a) main()
class CreditCard: def __init__(self, cc_number, expiration, security_code): self.cc_number = cc_number self.expiration = expiration self.security_code = security_code class Charge: def __init__(self, success, error=''): self.success = success self.error = error
class Creditcard: def __init__(self, cc_number, expiration, security_code): self.cc_number = cc_number self.expiration = expiration self.security_code = security_code class Charge: def __init__(self, success, error=''): self.success = success self.error = error
{ 'targets': [ { 'target_name': 'xxhash', 'cflags!': [ '-fno-exceptions' ], 'cflags_cc!': [ '-fno-exceptions' ], 'xcode_settings': { 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', 'CLANG_CXX_LIBRARY': 'libc++', 'MACOSX_DEPLOYMENT_TARGET': '10.7', }, 'msvs_settings': { ...
{'targets': [{'target_name': 'xxhash', 'cflags!': ['-fno-exceptions'], 'cflags_cc!': ['-fno-exceptions'], 'xcode_settings': {'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', 'CLANG_CXX_LIBRARY': 'libc++', 'MACOSX_DEPLOYMENT_TARGET': '10.7'}, 'msvs_settings': {'VCCLCompilerTool': {'ExceptionHandling': 1}}, 'sources': ['lib/binding/x...
class Solution: def canCross(self, stones): memo, stones, target = {}, set(stones), stones[-1] def dfs(unit, last): if unit == target: return True if (unit, last) not in memo: memo[(unit, last)] = any(dfs(unit + move, move) for move in (last - 1, last, last +...
class Solution: def can_cross(self, stones): (memo, stones, target) = ({}, set(stones), stones[-1]) def dfs(unit, last): if unit == target: return True if (unit, last) not in memo: memo[unit, last] = any((dfs(unit + move, move) for move in (l...
path2file = sys.argv[1] file = open(path2file, 'r') while True: line = file.readline() if not line: break stroka = unicode(line, 'utf-8') type('f', KeyModifier.CTRL) sleep(1) paste(stroka) sleep(1) type(Key.ENTER) sleep(1) break exit(0)
path2file = sys.argv[1] file = open(path2file, 'r') while True: line = file.readline() if not line: break stroka = unicode(line, 'utf-8') type('f', KeyModifier.CTRL) sleep(1) paste(stroka) sleep(1) type(Key.ENTER) sleep(1) break exit(0)
class Solution: def lengthOfLongestSubstring(self, s: str) -> int: longestSubstring = 0 start = -1 end = 0 characterSet = set() stringLength = len(s) while start < stringLength and end < stringLength: currentChar = s[end] if currentChar in char...
class Solution: def length_of_longest_substring(self, s: str) -> int: longest_substring = 0 start = -1 end = 0 character_set = set() string_length = len(s) while start < stringLength and end < stringLength: current_char = s[end] if currentChar...
def Swap(a,b): temp = a a=b b=temp lst = [a,b] return lst
def swap(a, b): temp = a a = b b = temp lst = [a, b] return lst
class Solution(object): def removeDuplicates(self, nums): """ :type nums: List[int] :rtype: int """ ind = 0 pos = 0 while ind < len(nums): if ind > 0 and ind < len(nums) and nums[ind] == nums[ind - 1]: ind += 1 continue nums[pos] = nums[ind] pos += 1 ...
class Solution(object): def remove_duplicates(self, nums): """ :type nums: List[int] :rtype: int """ ind = 0 pos = 0 while ind < len(nums): if ind > 0 and ind < len(nums) and (nums[ind] == nums[ind - 1]): ind += 1 continue ...
class Solution(object): def kthSmallest(self, root, k): """ :type root: TreeNode :type k: int :rtype: int """ if not root: return 0 stack = [root] count, curr = 0, root while stack: if curr.left: stack.ap...
class Solution(object): def kth_smallest(self, root, k): """ :type root: TreeNode :type k: int :rtype: int """ if not root: return 0 stack = [root] (count, curr) = (0, root) while stack: if curr.left: st...
""" 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, software distributed under the Li...
""" 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, software distributed under the Li...
# 5 # 5 3 # 1 5 2 6 1 # 1 6 # 6 # 3 2 # 1 2 3 # 4 3 # 3 1 2 3 # 10 3 # 1 2 3 4 5 6 7 8 9 10 i = int(input()) l = [] for j in range(i): k = list(map(int,(input().split(' ')))) il = list(map(int,input().split(' '))) if k[1] in il and len(il)==1: l.append('yes') elif k[1] in il[1:] and len(il) %...
i = int(input()) l = [] for j in range(i): k = list(map(int, input().split(' '))) il = list(map(int, input().split(' '))) if k[1] in il and len(il) == 1: l.append('yes') elif k[1] in il[1:] and len(il) % 2 == 1: l.append('yes') elif k[1] in il[1:-1] and len(il) % 2 == 0: l.ap...
class Solution: def minTimeToVisitAllPoints(self, points: List[List[int]]) -> int: now = points[0] ans = 0 for point in points[1:]: ans += max(abs(now[0] - point[0]), abs(now[1] - point[1])) now = point return ans
class Solution: def min_time_to_visit_all_points(self, points: List[List[int]]) -> int: now = points[0] ans = 0 for point in points[1:]: ans += max(abs(now[0] - point[0]), abs(now[1] - point[1])) now = point return ans
# Runtime: 176 ms, faster than 97.52% of Python3 online submissions for Set Mismatch. # Memory Usage: 15.9 MB, less than 42.22% of Python3 online submissions for Set Mismatch. def find_error_nums(nums: [int]) -> [int]: """You have a set of integers s, which originally contains all the numbers from 1 to n. Unfortuna...
def find_error_nums(nums: [int]) -> [int]: """You have a set of integers s, which originally contains all the numbers from 1 to n. Unfortunately, due to some error, one of the numbers in s got duplicated to another number in the set, which results in repetition of one number and loss of another number. You ...
# Write a Python class which has two methods get_String and print_String.... # get_String accept a string from the user and print_String print the string in upper case. class IOString(): def __init__(self): self.str1 = "" def get_String(self): self.str1 = input() def print_String(self): ...
class Iostring: def __init__(self): self.str1 = '' def get__string(self): self.str1 = input() def print__string(self): print(self.str1.upper()) str1 = io_string() str1.get_String() str1.print_String()
##################### ### Base classes. ### ##################### class room: repr = "room" m_description = "You are in a simple room." def __init__(self, contents=[]): self.contents = contents def __str__(self): s = "" for object in self.contents: ...
class Room: repr = 'room' m_description = 'You are in a simple room.' def __init__(self, contents=[]): self.contents = contents def __str__(self): s = '' for object in self.contents: s += ' ' + str(object) return self.m_description + s def __repr__(self...
# Source # ====== # https://www.hackerrank.com/contests/projecteuler/challenges/euler008 # # Problem # ======= # Find the greatest product of K consecutive digits in the N digit number. # # Input Format # ============ # First line contains T that denotes the number of test cases. # First line of each test case will co...
def product(num_subset): p = 1 for i in num_subset: p *= i return p t = int(input().strip()) for _ in range(t): (n, k) = input().strip().split(' ') (n, k) = [int(n), int(k)] num = input().strip() p = [] for i in range(n - k): num_subset = [int(x) for x in list(num[i:k + i...
class Stack: """ Stack data structure using list """ def __init__(self,value): """ Class initializer: Produces a stack with a single value or a list of values """ self._items = [] if type(value)==list: for v in value: self._items.append...
class Stack: """ Stack data structure using list """ def __init__(self, value): """ Class initializer: Produces a stack with a single value or a list of values """ self._items = [] if type(value) == list: for v in value: self._items.ap...
# __version__ is for deploying with seed. # VERSION is to keep the rest of the app DRY. __version__ = '0.1.18' VERSION = __version__
__version__ = '0.1.18' version = __version__
class Vehicle(object): def __init__(self, vehicle_id, company, location): self.vehicle_id = vehicle_id self.company = company self.location = location # def __str__(self): # return str( P["id":+str(self.id) + " company: " + str(self.company)+ # str(self.location)+ " loca...
class Vehicle(object): def __init__(self, vehicle_id, company, location): self.vehicle_id = vehicle_id self.company = company self.location = location
# -*- coding: utf-8 -*- """ Copyright 2022 Mitchell Isaac Parker 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 ...
""" Copyright 2022 Mitchell Isaac Parker 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...
""" CBMPy: MiriamIds module ======================= Constraint Based Modelling in Python (http://pysces.sourceforge.net/cbm) Copyright (C) 2009-2017 Brett G. Olivier, VU University Amsterdam, Amsterdam, The Netherlands This program is free software: you can redistribute it and/or modify it under the terms of th...
""" CBMPy: MiriamIds module ======================= Constraint Based Modelling in Python (http://pysces.sourceforge.net/cbm) Copyright (C) 2009-2017 Brett G. Olivier, VU University Amsterdam, Amsterdam, The Netherlands This program is free software: you can redistribute it and/or modify it under the terms of the GNU G...
''' The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143? ''' def largest_prime_factor(n): f = 2 while f**2 <= n: while n % f == 0: n //= f f += 1 return max(f-1, n) print(largest_prime_factor(600851475143))
""" The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143? """ def largest_prime_factor(n): f = 2 while f ** 2 <= n: while n % f == 0: n //= f f += 1 return max(f - 1, n) print(largest_prime_factor(600851475143))
def selectionSort(alist): for fillslot in range (len(alist)-1, 0, -1): positionofMax = 0; for location in range(1,fillslot+1): if alist[location] > alist[positionofMax]: positionofMax = location temp = alist[fillslot] alist[fillslot] = alist[positionofMax] alist[positionofMax] = temp a = [54,26,93,1...
def selection_sort(alist): for fillslot in range(len(alist) - 1, 0, -1): positionof_max = 0 for location in range(1, fillslot + 1): if alist[location] > alist[positionofMax]: positionof_max = location temp = alist[fillslot] alist[fillslot] = alist[position...
#!/usr/bin/env python a = 1000000000 for i in xrange(1000000): a += 1e-6 a -= 1000000000 print(a)
a = 1000000000 for i in xrange(1000000): a += 1e-06 a -= 1000000000 print(a)
# -*- coding: utf-8 -*- """Top-level package for Creating the Docs.""" __author__ = """Barry J. Whiteside""" __email__ = 'barrywhiteside@gmail.com' __version__ = '0.1.0'
"""Top-level package for Creating the Docs.""" __author__ = 'Barry J. Whiteside' __email__ = 'barrywhiteside@gmail.com' __version__ = '0.1.0'
class EnviadorDeSpam(): def __init__(self, sessao, enviador): self.sessao = sessao self.enviador = enviador def enviar_emails(self, remetente, assunto, corpo): for usuario in self.sessao.listar(): self.enviador.enviar( remetente, usuario.email...
class Enviadordespam: def __init__(self, sessao, enviador): self.sessao = sessao self.enviador = enviador def enviar_emails(self, remetente, assunto, corpo): for usuario in self.sessao.listar(): self.enviador.enviar(remetente, usuario.email, assunto, corpo)
"""A helper class for pygame colors.""" WHITE = (255, 255, 255) BLACK = (0, 0, 0) GRAY = (80, 80, 80) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255) YELLOW = (255, 255, 0) ORANGE = (255, 165, 0)
"""A helper class for pygame colors.""" white = (255, 255, 255) black = (0, 0, 0) gray = (80, 80, 80) red = (255, 0, 0) green = (0, 255, 0) blue = (0, 0, 255) yellow = (255, 255, 0) orange = (255, 165, 0)
class DDAE_Hyperparams: drop_rate = 0.5 n_units = 1024 activation = 'lrelu' final_act = 'linear' f_bin = 257 class CBHG_Hyperparams: #### Modules #### drop_rate = 0.0 normalization_mode = 'layer_norm' activation = 'lrelu' final_act = 'linear' f_bin = 257 ##...
class Ddae_Hyperparams: drop_rate = 0.5 n_units = 1024 activation = 'lrelu' final_act = 'linear' f_bin = 257 class Cbhg_Hyperparams: drop_rate = 0.0 normalization_mode = 'layer_norm' activation = 'lrelu' final_act = 'linear' f_bin = 257 banks_filter = 64 n_banks = 8 ...
SIZE_BOARD = 10 # Tipo de navios na forma "tipo": tamanho TYPES_OF_SHIPS = { "1": 5, "2": 4, "3": 3, "4": 2 }
size_board = 10 types_of_ships = {'1': 5, '2': 4, '3': 3, '4': 2}
x = input("input a letter : ") if x == "a" or x == "i" or x == "u" or x == "e" or x == "o": print("This is a vowel!") elif x == "y": print("Sometimes y is a vowel and sometimes y is a consonant") else: print("This is a consonant!")
x = input('input a letter : ') if x == 'a' or x == 'i' or x == 'u' or (x == 'e') or (x == 'o'): print('This is a vowel!') elif x == 'y': print('Sometimes y is a vowel and sometimes y is a consonant') else: print('This is a consonant!')
class Solution: def findMaxConsecutiveOnes(self, nums: List[int]) -> int: max_count = 0 count = 0 for i in nums: if i == 1: count += 1 else: count = 0 max_count = max(max_count, count) return max_count
class Solution: def find_max_consecutive_ones(self, nums: List[int]) -> int: max_count = 0 count = 0 for i in nums: if i == 1: count += 1 else: count = 0 max_count = max(max_count, count) return max_count
# This file declares all the constants for used in this app MAIN_URL = 'https://api.github.com/repos/' ONE_DAY = 1
main_url = 'https://api.github.com/repos/' one_day = 1
# The guess API is already defined for you. # @param num, your guess # @return -1 if my number is lower, 1 if my number is higher, otherwise return 0 # def guess(num: int) -> int: class Solution: def guessNumber(self, n: int) -> int: l, h = 1, n while l <= h: m = l + (h - l) // 2 ...
class Solution: def guess_number(self, n: int) -> int: (l, h) = (1, n) while l <= h: m = l + (h - l) // 2 if guess(m) < 0: h = m - 1 elif guess(m) > 0: l = m + 1 else: return m return -1
def make_shirt(text, size = 'large'): print('You can buy a ' + size + ' size t-shirt with written ' + text + ' written on it.') make_shirt(text = 'yepa')
def make_shirt(text, size='large'): print('You can buy a ' + size + ' size t-shirt with written ' + text + ' written on it.') make_shirt(text='yepa')
########################################################### # This module is used to centralise messages # used by the self service bot. # ########################################################### class ErrorMessages: BOT_ABORT_ERROR = "Aborting Self Service Bot" BOT_INIT_ERROR = "ERROR reported during init...
class Errormessages: bot_abort_error = 'Aborting Self Service Bot' bot_init_error = 'ERROR reported during initialisation of SelfServiceBot' dynamodb_scan_error = 'ERROR reported by DynamoDB' general_error = 'The bot encountered an error.' missing_param_error = 'Required parameter not provided' ...
class Solution: def maxChunksToSorted(self, arr): intervals = {} for i in range(len(arr)): if i < arr[i]: minVal, maxVal = i, arr[i] else: minVal, maxVal = arr[i], i if minVal in intervals: if maxVal > intervals[ min...
class Solution: def max_chunks_to_sorted(self, arr): intervals = {} for i in range(len(arr)): if i < arr[i]: (min_val, max_val) = (i, arr[i]) else: (min_val, max_val) = (arr[i], i) if minVal in intervals: if maxVal ...
class Solution: def maxIncreaseKeepingSkyline(self, grid): """ :type grid: List[List[int]] :rtype: int """ r=len(grid) c=len(grid[0]) matrix=[[101 for j in range(c)] for i in range(r)] for i in range(r): m=max(grid[i]) ...
class Solution: def max_increase_keeping_skyline(self, grid): """ :type grid: List[List[int]] :rtype: int """ r = len(grid) c = len(grid[0]) matrix = [[101 for j in range(c)] for i in range(r)] for i in range(r): m = max(grid[i]) ...
def bubble_sort(alist): for i in range(len(alist)-1, 0, -1): for j in range(i): if alist[j] > alist[j+1]: temp = alist[j] alist[j] = alist[j+1] alist[j+1] = temp return alist list_to_sort = [147, -16, 18, 91, 44, 1, 8, 54, 31, 18] bubble_so...
def bubble_sort(alist): for i in range(len(alist) - 1, 0, -1): for j in range(i): if alist[j] > alist[j + 1]: temp = alist[j] alist[j] = alist[j + 1] alist[j + 1] = temp return alist list_to_sort = [147, -16, 18, 91, 44, 1, 8, 54, 31, 18] bubbl...
class MenuItem(): def __init__(self, itemID, itemName, itemPrice): self.itemID = itemID self.itemName = itemName self.itemPrice = itemPrice self.itemMods = list() def getItemID(self): return self.itemID def setItemID(self, itemID): self.itemID = s...
class Menuitem: def __init__(self, itemID, itemName, itemPrice): self.itemID = itemID self.itemName = itemName self.itemPrice = itemPrice self.itemMods = list() def get_item_id(self): return self.itemID def set_item_id(self, itemID): self.itemID = self.item...
def find_highest_number(numbers): highest_number = 0 for num in numbers: if num > highest_number: highest_number = num return highest_number
def find_highest_number(numbers): highest_number = 0 for num in numbers: if num > highest_number: highest_number = num return highest_number
# [17CE023] Bhishm Daslaniya ''' Algorithm! --> Build a list of tuples such that the string "aaabbc" can be squashed down to [("a", 3), ("b", 2), ("c", 1)] --> Add to answer all combinations of substrings from these tuples which would represent palindromes which have all same letters --> traverse this list to specific...
""" Algorithm! --> Build a list of tuples such that the string "aaabbc" can be squashed down to [("a", 3), ("b", 2), ("c", 1)] --> Add to answer all combinations of substrings from these tuples which would represent palindromes which have all same letters --> traverse this list to specifically find the second case ment...
""" Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example: Given the below binary tree and sum = 22, 5 / \ 4 8 / / \ 11 13 4 / \ / \ 7 ...
""" Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example: Given the below binary tree and sum = 22, 5 / 4 8 / / 11 13 4 / \\ / 7 2 5 ...
# Copyright 2019 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. config_type='sweetberry' revs = [5] inas = [ ('sweetberry', '0x40:3', 'pp975_io', 7.7, 0.100, 'j2', True), # R111 ('sweetberry', '0x40:1'...
config_type = 'sweetberry' revs = [5] inas = [('sweetberry', '0x40:3', 'pp975_io', 7.7, 0.1, 'j2', True), ('sweetberry', '0x40:1', 'pp850_prim_core', 7.7, 0.1, 'j2', True), ('sweetberry', '0x40:2', 'pp3300_dsw', 3.3, 0.01, 'j2', True), ('sweetberry', '0x40:0', 'pp3300_a', 7.7, 0.01, 'j2', True), ('sweetberry', '0x41:3'...
class A: def __init__(self): print("In A __init__") def feature1(self): print("Feature 1") def feature2(self): print("Feature 2") # class B(A): class B: def __init__(self): super().__init__() print("In B __init__") def feature3(...
class A: def __init__(self): print('In A __init__') def feature1(self): print('Feature 1') def feature2(self): print('Feature 2') class B: def __init__(self): super().__init__() print('In B __init__') def feature3(self): print('Feature 3') d...
"""Conversion tools for Python""" def dollars2cents(dollars): """Convert dollars to cents""" cents = dollars * 100 return cents def gallons2liters(gallons): """Convert gallons to liters""" liters = gallons * 3.785 return liters
"""Conversion tools for Python""" def dollars2cents(dollars): """Convert dollars to cents""" cents = dollars * 100 return cents def gallons2liters(gallons): """Convert gallons to liters""" liters = gallons * 3.785 return liters
# fastq handling class fastqIter: " A simple file iterator that returns 4 lines for fast fastq iteration. " def __init__(self, handle): self.inf = handle def __iter__(self): return self def next(self): lines = {'id': self.inf.readline().strip(), 'seq': self.i...
class Fastqiter: """ A simple file iterator that returns 4 lines for fast fastq iteration. """ def __init__(self, handle): self.inf = handle def __iter__(self): return self def next(self): lines = {'id': self.inf.readline().strip(), 'seq': self.inf.readline().strip(), '+': sel...
vowels = ['a' , 'o' , 'u' , 'e' , 'i' , 'A' , 'O' , 'U' , 'E' , 'I'] string = input() result = [s for s in string if s not in vowels] print(''.join(result))
vowels = ['a', 'o', 'u', 'e', 'i', 'A', 'O', 'U', 'E', 'I'] string = input() result = [s for s in string if s not in vowels] print(''.join(result))
# Given a binary string (ASCII encoded), write a function that returns the equivalent decoded text. # Every eight bits in the binary string represents one character on the ASCII table. # Examples: # csBinaryToASCII("011011000110000101101101011000100110010001100001") -> "lambda" # 01101100 -> 108 -> "l" # 01100001 ->...
def cs_binary_to_ascii(binary): binary_letters = [] letters = '' if binary == '': return '' for index in range(0, len(binary), 8): binary_letters.append(binary[index:index + 8]) print(binary_letters) for string in binary_letters: binary_int = v = chr(int(string, 2)) ...
""" A modern, Python3-compatible, well-documented library for communicating with a MineCraft server. """ __version__ = "0.5.0" SUPPORTED_MINECRAFT_VERSIONS = { '1.8': 47, '1.8.1': 47, '1.8.2': 47, '1.8.3': 47, '1.8.4': 47, '1.8.5': 47, '1.8.6': 4...
""" A modern, Python3-compatible, well-documented library for communicating with a MineCraft server. """ __version__ = '0.5.0' supported_minecraft_versions = {'1.8': 47, '1.8.1': 47, '1.8.2': 47, '1.8.3': 47, '1.8.4': 47, '1.8.5': 47, '1.8.6': 47, '1.8.7': 47, '1.8.8': 47, '1.8.9': 47, '1.9': 107, '1.9.1': 108, '1.9.2'...
# 5/1/2020 # Elliott Gorman # ITSW 1359 # VINES - STACK ABSTRACT DATA TYPE class Stack(): def __init__(self): self.stack = [] #set stack size to -1 so when first object is pushed # its reference is correct at 0 self.size = -1 def push(self, object): sel...
class Stack: def __init__(self): self.stack = [] self.size = -1 def push(self, object): self.stack.append(object) self.size += 1 def pop(self): if self.isEmpty(): raise empty_stack_exception('The Stack is already Empty.') else: remov...
# Motor MOTOR_LEFT_FORWARD = 20 MOTOR_LEFT_BACK = 21 MOTOR_RIGHT_FORWARD = 19 MOTOR_RIGHT_BACK = 26 MOTOR_LEFT_PWM = 16 MOTOR_RIGHT_PWM = 13 # Track Sensors TRACK_LEFT_1 = 3 TRACK_LEFT_2 = 5 TRACK_RIGHT_1 = 4 TRACK_RIGHT_2 = 18 # Button BUTTON = 8 BUZZER = 8 # Servos FAN = 2 SEARCHLIGHT_SERVO = 23 CAMERA_SERVO_H = 1...
motor_left_forward = 20 motor_left_back = 21 motor_right_forward = 19 motor_right_back = 26 motor_left_pwm = 16 motor_right_pwm = 13 track_left_1 = 3 track_left_2 = 5 track_right_1 = 4 track_right_2 = 18 button = 8 buzzer = 8 fan = 2 searchlight_servo = 23 camera_servo_h = 11 camera_servo_v = 9 led_r = 22 led_g = 27 le...
"""base class for user transforms""" class UserTransform: """base class for user transforms, should express taking a set of k inputs to k outputs independently""" def __init__(self, treatment): self.y_aware_ = True self.treatment_ = treatment self.incoming_vars_ = [] self.deri...
"""base class for user transforms""" class Usertransform: """base class for user transforms, should express taking a set of k inputs to k outputs independently""" def __init__(self, treatment): self.y_aware_ = True self.treatment_ = treatment self.incoming_vars_ = [] self.deriv...
# Selection Sort # Time Complexity: O(n^2) # A Implementation of a Selection Sort Algorithm Through a Function. def selection_sort(nums): # This value of i corresponds to each value that will be sorted. for i in range(len(nums)): # We assume that the first item of the unsorted numbers is the smallest...
def selection_sort(nums): for i in range(len(nums)): lowest_value_index = i for j in range(i + 1, len(nums)): if nums[j] < nums[lowest_value_index]: lowest_value_index = j (nums[i], nums[lowest_value_index]) = (nums[lowest_value_index], nums[i]) random_list_of_num...
input = """ att_val(perGrant,name,nameCG). att_val(perGrant,name,nameGrant). att_val(nameCG,lastName,"Grant"). att_val(nameGrant,lastName,"Leach"). acted(perGrant,m12). involved(P,M) :- acted(P,M). matchingMovie(q1, m12). inferred_topic(X5, X1) :- matchingMovie(X5, X4), involved(X3, X4), att_val(X3...
input = '\natt_val(perGrant,name,nameCG).\natt_val(perGrant,name,nameGrant).\n\natt_val(nameCG,lastName,"Grant").\n\natt_val(nameGrant,lastName,"Leach").\n\nacted(perGrant,m12).\n\ninvolved(P,M) :- acted(P,M).\n\nmatchingMovie(q1, m12).\n\n\ninferred_topic(X5, X1) :- matchingMovie(X5, X4), involved(X3, X4), att_val(X3,...
""" File: class_reviews.py Name: ------------------------------- At the beginning of this program, the user is asked to input the class name (either SC001 or SC101). Attention: your program should be case-insensitive. If the user input -1 for class name, your program would output the maximum, minimum, and average among...
""" File: class_reviews.py Name: ------------------------------- At the beginning of this program, the user is asked to input the class name (either SC001 or SC101). Attention: your program should be case-insensitive. If the user input -1 for class name, your program would output the maximum, minimum, and average among...
# -*- coding: utf-8 -*- """ custom resp-code """ class RET(object): OK = "0" DBERR = "4001" DATAEXIST = "4002" DATAERR = "4003" INVALIDCODE = "4004" PARAMERR = "4005" THIRDERR = "4006" IOERR ...
""" custom resp-code """ class Ret(object): ok = '0' dberr = '4001' dataexist = '4002' dataerr = '4003' invalidcode = '4004' paramerr = '4005' thirderr = '4006' ioerr = '4007' tokenerr = '4008' reqerr = '4009' iperr = '4010' abnormal = '4011' pwderr = '4012' bala...
prompt = """ I translate python code into english descriptions. I say what I will do if I were to execute them, precising what tools and function calls I will use. I flag behaviours that seem weird or dangerous by preceeding them with "DANGER:". If the code seems to be deceptive or does not do what it says it does, I...
prompt = '\nI translate python code into english descriptions. I say what I will do if I were to execute them, precising what tools and function calls I will use.\n\nI flag behaviours that seem weird or dangerous by preceeding them with "DANGER:". \nIf the code seems to be deceptive or does not do what it says it does,...
arguments = ["self", "info", "args"] minlevel = 3 helpstring = "enable <plugin>" def main(connection, info, args) : """Enables a plugin""" if args[1] not in ["disable", "enable", "*"] : if args[1] not in connection.users["channels"][info["channel"]]["enabled"] : connection.users["channels"]...
arguments = ['self', 'info', 'args'] minlevel = 3 helpstring = 'enable <plugin>' def main(connection, info, args): """Enables a plugin""" if args[1] not in ['disable', 'enable', '*']: if args[1] not in connection.users['channels'][info['channel']]['enabled']: connection.users['channels'][in...
# Solution to problem 7 # #Student: Niamh O'Leary# #ID: G00376339# #Date: 10/03/2019# #Write a program that takes a positive floating point number as input and outputs an approximation of its square root# #Note: for the problem please use number 14.5. num = 14.5 num_sqrt = num ** 0.5 #calulates the...
num = 14.5 num_sqrt = num ** 0.5 print('The square root of %0.3f is %0.3f' % (num, num_sqrt))
''' 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...
class Categories: def __init__(self, category_name, money_allocated, index_inside_list): self.category_name = category_name self.money_allocated = money_allocated self.index_inside_list = index_inside_list
class Categories: def __init__(self, category_name, money_allocated, index_inside_list): self.category_name = category_name self.money_allocated = money_allocated self.index_inside_list = index_inside_list
class Solution: def fib(self, N: int) -> int: self.seen = {} self.seen[0] = 0 self.seen[1] = 1 return self.dfs(N) def dfs(self, n): if n in self.seen: return self.seen[n] self.seen[n] = self.dfs(n - 1) + self.dfs(n - 2) return self.se...
class Solution: def fib(self, N: int) -> int: self.seen = {} self.seen[0] = 0 self.seen[1] = 1 return self.dfs(N) def dfs(self, n): if n in self.seen: return self.seen[n] self.seen[n] = self.dfs(n - 1) + self.dfs(n - 2) return self.seen[n]