content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
"""Helpers to subset an extracted dataframe""" readability_cols = [ "flesch_reading_ease", "flesch_kincaid_grade", "smog", "gunning_fog", "automated_readability_index", "coleman_liau_index", "lix", "rix", ] dependency_cols = [ "dependency_distance_mean", "dependency_distance_st...
"""Helpers to subset an extracted dataframe""" readability_cols = ['flesch_reading_ease', 'flesch_kincaid_grade', 'smog', 'gunning_fog', 'automated_readability_index', 'coleman_liau_index', 'lix', 'rix'] dependency_cols = ['dependency_distance_mean', 'dependency_distance_std', 'prop_adjacent_dependency_relation_mean', ...
class Solution: def longestPalindrome(self, s: str) -> int: d = {} for c in s: if c not in d: d[c] = 1 else: d[c] = d[c] + 1 res = 0 for _, n in d.items(): res += n - (n & 1) return res + 1 if res < len(s) e...
class Solution: def longest_palindrome(self, s: str) -> int: d = {} for c in s: if c not in d: d[c] = 1 else: d[c] = d[c] + 1 res = 0 for (_, n) in d.items(): res += n - (n & 1) return res + 1 if res < len(s...
"""GCP Storage Constant.""" locations_list = [ "US", "EU", "ASIA", "ASIA1", "EUR4", "NAM4", "NORTHAMERICA-NORTHEAST1", "NORTHAMERICA-NORTHEAST2", "US-CENTRAL1", "US-EAST1", "US-EAST4", "US-WEST1", "US-WEST2", "US-WEST3", "US-WEST4", "SOUTHAMERICA-EAST1", ...
"""GCP Storage Constant.""" locations_list = ['US', 'EU', 'ASIA', 'ASIA1', 'EUR4', 'NAM4', 'NORTHAMERICA-NORTHEAST1', 'NORTHAMERICA-NORTHEAST2', 'US-CENTRAL1', 'US-EAST1', 'US-EAST4', 'US-WEST1', 'US-WEST2', 'US-WEST3', 'US-WEST4', 'SOUTHAMERICA-EAST1', 'EUROPE-CENTRAL2', 'EUROPE-NORTH1', 'EUROPE-WEST1', 'EUROPE-WEST2'...
class Articles: def __init__(self,id,name,author, title, description, url, urlToImage,publishedAt): self.id = id self.name = name self.author = author self.title = title self.description = description self.url = url self.urlToImage = urlToImage ...
class Articles: def __init__(self, id, name, author, title, description, url, urlToImage, publishedAt): self.id = id self.name = name self.author = author self.title = title self.description = description self.url = url self.urlToImage = urlToImage se...
# OpenWeatherMap API Key weather_api_key = "f4695ec49ac558195fc591f0d450c34c" # Google API Key g_key = "AIzaSyAyIq5hhFN-Y0M16Ltie3YuwpDiKWx8tCk"
weather_api_key = 'f4695ec49ac558195fc591f0d450c34c' g_key = 'AIzaSyAyIq5hhFN-Y0M16Ltie3YuwpDiKWx8tCk'
class ArgumentError(Exception): def __init__(self, argument_name: str, *args) -> None: super().__init__(*args) self.argument_name = argument_name @property def argument_name(self) -> str: return self.__argument_name @argument_name.setter def argument_name(self, value: s...
class Argumenterror(Exception): def __init__(self, argument_name: str, *args) -> None: super().__init__(*args) self.argument_name = argument_name @property def argument_name(self) -> str: return self.__argument_name @argument_name.setter def argument_name(self, value: str)...
BOT_NAME = "placement" SPIDER_MODULES = ["placement.spiders"] NEWSPIDER_MODULE = "placement.spiders" ROBOTSTXT_OBEY = True CONCURRENT_REQUESTS = 16 DUPEFILTER_DEBUG = True EXTENSIONS = {"spidermon.contrib.scrapy.extensions.Spidermon": 500} SPIDERMON_ENABLED = True ITEM_PIPELINES = {"spidermon.contrib.scrapy.pipeli...
bot_name = 'placement' spider_modules = ['placement.spiders'] newspider_module = 'placement.spiders' robotstxt_obey = True concurrent_requests = 16 dupefilter_debug = True extensions = {'spidermon.contrib.scrapy.extensions.Spidermon': 500} spidermon_enabled = True item_pipelines = {'spidermon.contrib.scrapy.pipelines.I...
def star_pattern(n): for i in range(n): for j in range(i+1): print("*",end=" ") print() star_pattern(5) ''' star_pattern(5) * * * * * * * * * * * * * * * '''
def star_pattern(n): for i in range(n): for j in range(i + 1): print('*', end=' ') print() star_pattern(5) '\n star_pattern(5)\n *\n * *\n * * *\n * * * *\n * * * * *\n '
# 1461. Check If a String Contains All Binary Codes of Size K # User Accepted:2806 # User Tried:4007 # Total Accepted:2876 # Total Submissions:9725 # Difficulty:Medium # Given a binary string s and an integer k. # Return True if any binary code of length k is a substring of s. Otherwise, return False. # Example 1: # ...
class Solution: def has_all_codes(self, s: str, k: int) -> bool: for i in range(2 ** k): tmp = str(bin(i))[2:] if len(tmp) < k: tmp = '0' * (k - len(tmp)) + tmp if tmp in s: continue else: return False r...
n = int(input()) v = [] for i in range(n): v.append(int(input())) s = sorted(set(v)) for i in s: print(f'{i} aparece {v.count(i)} vez (es)')
n = int(input()) v = [] for i in range(n): v.append(int(input())) s = sorted(set(v)) for i in s: print(f'{i} aparece {v.count(i)} vez (es)')
#! /usr/bin/env python # Copyright (C) 2012-2015, Alphan Ulusoy (alphan@bu.edu) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any lat...
class Environment: def __init__(self, case): """Defines regions in the environment. """ self.global_reqs = dict() self.local_reqs = dict() if case == 'case1': self.global_reqs[3, 1] = {'reqs': {'photo'}, 'color': 'green'} self.global_reqs[5, 10] = {'reqs': ...
expected_output = { "vrf": { "VRF1": { "address_family": { "ipv4": { "instance": { "1": { "areas": { "0.0.0.1": { "sham_links": { ...
expected_output = {'vrf': {'VRF1': {'address_family': {'ipv4': {'instance': {'1': {'areas': {'0.0.0.1': {'sham_links': {'10.21.33.33 10.151.22.22': {'cost': 111, 'dcbitless_lsa_count': 1, 'donotage_lsa': 'not allowed', 'dead_interval': 13, 'demand_circuit': True, 'hello_interval': 3, 'hello_timer': '00:00:00:772', 'if_...
pkgname = "cargo-bootstrap" pkgver = "1.60.0" pkgrel = 0 # satisfy runtime dependencies hostmakedepends = ["curl"] depends = ["!cargo"] pkgdesc = "Bootstrap binaries of Rust package manager" maintainer = "q66 <q66@chimera-linux.org>" license = "MIT OR Apache-2.0" url = "https://rust-lang.org" source = f"https://ftp.oct...
pkgname = 'cargo-bootstrap' pkgver = '1.60.0' pkgrel = 0 hostmakedepends = ['curl'] depends = ['!cargo'] pkgdesc = 'Bootstrap binaries of Rust package manager' maintainer = 'q66 <q66@chimera-linux.org>' license = 'MIT OR Apache-2.0' url = 'https://rust-lang.org' source = f'https://ftp.octaforge.org/chimera/distfiles/ca...
# m=wrf_hydro_ens_sim.members[0] # dir(m) # Change restart frequency to hourly in hydro namelist att_tuple = ('base_hydro_namelist', 'hydro_nlist', 'rst_dt') # The values can be a scalar (uniform across the ensemble) or a list of length N (ensemble size). values = 60 wrf_hydro_ens_sim.set_member_diffs(att_tuple, valu...
att_tuple = ('base_hydro_namelist', 'hydro_nlist', 'rst_dt') values = 60 wrf_hydro_ens_sim.set_member_diffs(att_tuple, values) wrf_hydro_ens_sim.member_diffs [mm.base_hydro_namelist['hydro_nlist']['rst_dt'] for mm in wrf_hydro_ens_sim.members] att_tuple = ('base_hrldas_namelist', 'noahlsm_offline', 'restart_frequency_h...
def main () : i = 1 fib = 1 target = 10 temp = 0 while (i < target) : temp = fib fib += temp i+=1 print(fib) return 0 if __name__ == '__main__': main()
def main(): i = 1 fib = 1 target = 10 temp = 0 while i < target: temp = fib fib += temp i += 1 print(fib) return 0 if __name__ == '__main__': main()
class Solution: def findContentChildren(self, g: List[int], s: List[int]) -> int: g.sort() s.sort() greed_p = 0 size_p = 0 count = 0 while greed_p < len(g) and size_p < len(s): if g[greed_p] <= s[size_p]: count += 1 greed_p ...
class Solution: def find_content_children(self, g: List[int], s: List[int]) -> int: g.sort() s.sort() greed_p = 0 size_p = 0 count = 0 while greed_p < len(g) and size_p < len(s): if g[greed_p] <= s[size_p]: count += 1 greed...
""" This is duplicated from Django 3.0 to avoid starting an import chain that ends up with ContentTypes which may not be installed in a Djangae project. """ class BaseBackend: def authenticate(self, request, **kwargs): return None @classmethod def can_authenticate(cls, request): ...
""" This is duplicated from Django 3.0 to avoid starting an import chain that ends up with ContentTypes which may not be installed in a Djangae project. """ class Basebackend: def authenticate(self, request, **kwargs): return None @classmethod def can_authenticate(cls, request): ...
data = { "publication-date": { "year": { "value": "2020"}, "month": {"value": "01"}}, "short-description": "With a central surface brightness of 29.3 mag arcsec, and half-light radius of r_half=3.1^{+0.9}_{-1.1} kpc, Andromeda XIX (And XIX) is an extremely diffuse satellite of Androm...
data = {'publication-date': {'year': {'value': '2020'}, 'month': {'value': '01'}}, 'short-description': 'With a central surface brightness of 29.3 mag arcsec, and half-light radius of r_half=3.1^{+0.9}_{-1.1} kpc, Andromeda XIX (And XIX) is an extremely diffuse satellite of Andromeda.', 'external-ids': {'external-id': ...
""" For an array, we can build a SegmentTree for it, each node stores an extra attribute count to denote the number of elements in the the array which value is between interval start and end. (The array may not fully filled by elements) Design a query method with three parameters root, start and end, find the number o...
""" For an array, we can build a SegmentTree for it, each node stores an extra attribute count to denote the number of elements in the the array which value is between interval start and end. (The array may not fully filled by elements) Design a query method with three parameters root, start and end, find the number o...
# This is a sample Python script. def test_print_hi(): assert True
def test_print_hi(): assert True
hours = input('Enter Hours \n') rate = input('Enter Rate\n') hours = int(hours) rate = float(rate) if (hours <= 40): pay = rate*hours else: extra_time = hours - 40 pay = (rate*hours) + ((rate*extra_time)/2) print('Pay: ', pay)
hours = input('Enter Hours \n') rate = input('Enter Rate\n') hours = int(hours) rate = float(rate) if hours <= 40: pay = rate * hours else: extra_time = hours - 40 pay = rate * hours + rate * extra_time / 2 print('Pay: ', pay)
def get_schema(): return { 'type': 'object', 'properties': { 'connections': { 'type': 'array', 'items': { 'type': 'object', 'properties': { 'name': {'type': 'string'}, ...
def get_schema(): return {'type': 'object', 'properties': {'connections': {'type': 'array', 'items': {'type': 'object', 'properties': {'name': {'type': 'string'}, 'path': {'type': 'string'}, 'driver': {'type': 'string'}, 'server': {'type': 'string'}, 'database': {'type': 'string'}, 'name_col': {'type': 'string'}, '...
def main(): mainFile = open("index.html", 'r', encoding='utf-8') writeFile = open("index_pasted.html", 'w+', encoding='utf-8') classId = 'class="internal"' cssId = '<link rel=' for line in mainFile: if (classId in line): pasteScript(line, writeFile) elif (cssId in line):...
def main(): main_file = open('index.html', 'r', encoding='utf-8') write_file = open('index_pasted.html', 'w+', encoding='utf-8') class_id = 'class="internal"' css_id = '<link rel=' for line in mainFile: if classId in line: paste_script(line, writeFile) elif cssId in line:...
def main(): seed = 0x1234 e = [0x62d5, 0x7b27, 0xc5d4, 0x11c4, 0x5d67, 0xa356, 0x5f84, 0xbd67, 0xad04, 0x9a64, 0xefa6, 0x94d6, 0x2434, 0x0178] flag = "" for index in range(14): for i in range(0x7f-0x20): c = chr(0x20+i) res = encode(c, index, seed) if...
def main(): seed = 4660 e = [25301, 31527, 50644, 4548, 23911, 41814, 24452, 48487, 44292, 39524, 61350, 38102, 9268, 376] flag = '' for index in range(14): for i in range(127 - 32): c = chr(32 + i) res = encode(c, index, seed) if res == e[index]: ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- file1=open('data/u_Lvoid_20.txt',encoding='utf-8') file2=open('temp2/void.txt','w',encoding='utf-8') count=0 for line in file1: count=count+1 if(line[0]=='R'):# 'line' here is a string line_list=line.split( ) # 'line_list' is a list of small strings=['R4...
file1 = open('data/u_Lvoid_20.txt', encoding='utf-8') file2 = open('temp2/void.txt', 'w', encoding='utf-8') count = 0 for line in file1: count = count + 1 if line[0] == 'R': line_list = line.split() branch = line_list[0].split('-') branch0 = branch[0].split('R') branch[0] = branc...
def climbingLeaderboard(scores, alice): scores = list(reversed(sorted(set(scores)))) r, rank = len(scores), [] for a in alice: while (r > 0) and (a >= scores[r - 1]): r -= 1 rank.append(r + 1) return rank
def climbing_leaderboard(scores, alice): scores = list(reversed(sorted(set(scores)))) (r, rank) = (len(scores), []) for a in alice: while r > 0 and a >= scores[r - 1]: r -= 1 rank.append(r + 1) return rank
screen = { "bg": "blue", "rows": 0, "columns": 0, "columnspan": 4, "padx": 5, "pady": 5, } input = { "bg": "blue", "fg": "red", "fs": "20px", } button = { "bg": "blue", "fg": "red", "fs": "20px", }
screen = {'bg': 'blue', 'rows': 0, 'columns': 0, 'columnspan': 4, 'padx': 5, 'pady': 5} input = {'bg': 'blue', 'fg': 'red', 'fs': '20px'} button = {'bg': 'blue', 'fg': 'red', 'fs': '20px'}
# 3. Single layered 4 inputs and 3 outputs(Looping) mInputs = [3, 4, 1, 2] mWeights = [[0.2, -0.4, 0.6, 0.4], [0.4, 0.3, -0.1, 0.8], [0.7, 0.6, 0.3, -0.3]] mBias1 = [3, 4, 2] layer_output = [] for neuron_weights, neuron_bias in zip(mWeights, mBias1): neuron_output = 0 for n_inputs, ...
m_inputs = [3, 4, 1, 2] m_weights = [[0.2, -0.4, 0.6, 0.4], [0.4, 0.3, -0.1, 0.8], [0.7, 0.6, 0.3, -0.3]] m_bias1 = [3, 4, 2] layer_output = [] for (neuron_weights, neuron_bias) in zip(mWeights, mBias1): neuron_output = 0 for (n_inputs, n_weights) in zip(mInputs, neuron_weights): neuron_output += n_inpu...
# reading 2 numbers from the keyboard and printing maximum value r = int(input("Enter the first number: ")) s = int(input("Enter the second number: ")) x = r if r>s else s print(x)
r = int(input('Enter the first number: ')) s = int(input('Enter the second number: ')) x = r if r > s else s print(x)
def main(): STRING = "aababbabbaaba" compressed = compress(STRING) print(compressed) decompressed = decompress(compressed) print(decompressed) def compress(string): encode = {} # string -> code known = "" count = 0 result = [] for letter in string: if known + letter in...
def main(): string = 'aababbabbaaba' compressed = compress(STRING) print(compressed) decompressed = decompress(compressed) print(decompressed) def compress(string): encode = {} known = '' count = 0 result = [] for letter in string: if known + letter in encode: ...
# When one class does the work of two, awkwardness results. class Person: def __init__(self, name, office_area_code, office_number): self.name = name self.office_area_code = office_area_code self.office_number = office_number def telephone_number(self): return "%d-%d" % (s...
class Person: def __init__(self, name, office_area_code, office_number): self.name = name self.office_area_code = office_area_code self.office_number = office_number def telephone_number(self): return '%d-%d' % (self.office_area_code, self.office_number) if __name__ == '__main_...
class Solution(object): def maxCount(self, m, n, ops): """ :type m: int :type n: int :type ops: List[List[int]] :rtype: int """ return reduce(operator.mul, map(min, zip(*ops + [[m,n]])))
class Solution(object): def max_count(self, m, n, ops): """ :type m: int :type n: int :type ops: List[List[int]] :rtype: int """ return reduce(operator.mul, map(min, zip(*ops + [[m, n]])))
#!/usr/bin/python # -*- coding: utf-8 -*- class OpenError(StandardError): def __init__(self, error_code, error, error_info): self.error_code = error_code self.error = error self.error_info = error_info StandardError.__init__(self, error) def __str__(self): return 'Erro...
class Openerror(StandardError): def __init__(self, error_code, error, error_info): self.error_code = error_code self.error = error self.error_info = error_info StandardError.__init__(self, error) def __str__(self): return 'Error: %s: %s, request: %s' % (self.error_code,...
table = 'fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF' tr = {} for i in range(58): tr[table[i]] = i s = [11, 10, 3, 8, 4, 6] xor = 177451812 add = 8728348608 def dec(x): r = 0 for i in range(6): r += tr[x[s[i]]] * 58**i return (r - add) ^ xor def enc(x): x = (x ^ xor) + add...
table = 'fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF' tr = {} for i in range(58): tr[table[i]] = i s = [11, 10, 3, 8, 4, 6] xor = 177451812 add = 8728348608 def dec(x): r = 0 for i in range(6): r += tr[x[s[i]]] * 58 ** i return r - add ^ xor def enc(x): x = (x ^ xor) + add ...
class ConfigException(Exception): """Configuration exception when an integration that is not available is called in the `Config` object. """ pass
class Configexception(Exception): """Configuration exception when an integration that is not available is called in the `Config` object. """ pass
# # @lc app=leetcode id=838 lang=python3 # # [838] Push Dominoes # # @lc code=start class Solution: def pushDominoes(self, dominoes: str) -> str: l = 0 ans = [] dominoes = 'L' + dominoes + 'R' for r in range(1, len(dominoes)): if dominoes[r] == '.': conti...
class Solution: def push_dominoes(self, dominoes: str) -> str: l = 0 ans = [] dominoes = 'L' + dominoes + 'R' for r in range(1, len(dominoes)): if dominoes[r] == '.': continue cnt = r - l - 1 if l > 0: ans.append(do...
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
def get_segment_of_url(url: str, prefix: str) -> str: """ Get the next segment from url following prefix. The return value is a segment without slash. For example, url = "projects/test-project/global/networks/n1", and prefix = "networks/", then the return value is "n1". """ if not url: ...
# (c) Copyright [2017] Hewlett Packard Enterprise Development LP # # 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 appli...
""" Module implements exception classes that can be thrown by the DLBS.""" class Dlbserror(Exception): """Base class for all exceptions.""" pass class Configurationerror(DLBSError): """This exception is thrown whenever error is found in an input configuration. Several examples of situations in which ...
"""A tool for modeling composite beams and aircraft wings. ``Aerodynamics`` This module provides the aerodynamics models used within AeroComBAT ``AircraftParts`` This module provides a full-fledged wing object that can be used to determine if a design is both statically adequate as well as stable. ``...
"""A tool for modeling composite beams and aircraft wings. ``Aerodynamics`` This module provides the aerodynamics models used within AeroComBAT ``AircraftParts`` This module provides a full-fledged wing object that can be used to determine if a design is both statically adequate as well as stable. ``...
# A Text to Morse Code Converter Project # Notes: # This Morse code make use of the basic morse code charts which contains 26 alphabets and 10 numerals # No special characters are currently involved. But can be added in the '.txt ' file based on the requirement. MORSE_CODE_CHART = "script_texts.txt" def lo...
morse_code_chart = 'script_texts.txt' def load_chart(): """Loads contents of the text file from the directory and returns the output as a Dictionary.""" with open(file=MORSE_CODE_CHART, mode='r', encoding='utf-8') as file: mc_dict = {line.split(' ')[0]: line.split(' ')[1].strip('\n') for line in file.r...
class Node: def __init__(self, val, left=None, right=None): self.val = val self.left = left self.right = right def count_univals(node): if node.right is None and node.left is None: return node.val, True, 1 l_val, l_is_unival, l_univals = count_univals(node.left) r_val...
class Node: def __init__(self, val, left=None, right=None): self.val = val self.left = left self.right = right def count_univals(node): if node.right is None and node.left is None: return (node.val, True, 1) (l_val, l_is_unival, l_univals) = count_univals(node.left) (r_...
def naive(a, b): c = 0 while a > 0: c = c + b a = a - 1 return c def russian(a, b): """ The Russian Peasant Algorithm: Multiply one integer by the other integer. Input: a, b: integers Returns: a*b """ c = 0 while a > 0: if a % 2 == 1: ...
def naive(a, b): c = 0 while a > 0: c = c + b a = a - 1 return c def russian(a, b): """ The Russian Peasant Algorithm: Multiply one integer by the other integer. Input: a, b: integers Returns: a*b """ c = 0 while a > 0: if a % 2 == 1: ...
# Python Tuples # Ordered, Immutable collection of items which allows Duplicate Members # We can put the data, which will not change throughout the program, in a Tuple # Tuples can be called as "Immutable Python Lists" or "Constant Python Lists" employeeTuple = ("Sam", "Sam" "Mike", "John", "Harry", "Tom", "Sean", "Ju...
employee_tuple = ('Sam', 'SamMike', 'John', 'Harry', 'Tom', 'Sean', 'Justin') print(type(employeeTuple)) print(isinstance(employeeTuple, tuple)) for employee_name in employeeTuple: print('Employee: ' + employeeName) print('**********************************************************') print(employeeTuple[0]) print(le...
# automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite class BuiltinOperator(object): ADD = 0 AVERAGE_POOL_2D = 1 CONCATENATION = 2 CONV_2D = 3 DEPTHWISE_CONV_2D = 4 EMBEDDING_LOOKUP = 7 FULLY_CONNECTED = 9 HASHTABLE_LOOKUP = 10 L2_NORMALIZATION = ...
class Builtinoperator(object): add = 0 average_pool_2_d = 1 concatenation = 2 conv_2_d = 3 depthwise_conv_2_d = 4 embedding_lookup = 7 fully_connected = 9 hashtable_lookup = 10 l2_normalization = 11 l2_pool_2_d = 12 local_response_normalization = 13 logistic = 14 lsh_...
class Table(object): def __init__(self, name): self.name = name self.columns = [] def createColumn(self, column): self.columns.append(column) def readColumn(self, name): for value in self.columns: if value.name == name: return value ...
class Table(object): def __init__(self, name): self.name = name self.columns = [] def create_column(self, column): self.columns.append(column) def read_column(self, name): for value in self.columns: if value.name == name: return value def u...
class Config: api_host = "https://api.frame.io" default_page_size = 50 default_concurrency = 5
class Config: api_host = 'https://api.frame.io' default_page_size = 50 default_concurrency = 5
""" Profile ../profile-datasets-py/div83/073.py file automaticaly created by prof_gen.py script """ self["ID"] = "../profile-datasets-py/div83/073.py" self["Q"] = numpy.array([ 1.956946, 2.801132, 4.230252, 5.419981, 6.087733, 6.419039, 6.547807, 6.548787, 6.504738, 6.4...
""" Profile ../profile-datasets-py/div83/073.py file automaticaly created by prof_gen.py script """ self['ID'] = '../profile-datasets-py/div83/073.py' self['Q'] = numpy.array([1.956946, 2.801132, 4.230252, 5.419981, 6.087733, 6.419039, 6.547807, 6.548787, 6.504738, 6.432189, 6.370779, 6.31601, 6.30854, 6.30...
# Introductory examples name = 'Maurizio' surname = 'Petrelli' print('-------------------------------------------------') print('My name is {}'.format(name)) print('-------------------------------------------------') print('My name is {} and my surname is {}'.format(name, surname)) print('------------------------------...
name = 'Maurizio' surname = 'Petrelli' print('-------------------------------------------------') print('My name is {}'.format(name)) print('-------------------------------------------------') print('My name is {} and my surname is {}'.format(name, surname)) print('-------------------------------------------------') pi...
class PartialFailure(Exception): """ Error indicating either send_messages or delete_messages API call failed partially """ def __init__(self, result, *args): self.success_count = len(result['Successful']) self.failure_count = len(result['Failed']) self.result = result s...
class Partialfailure(Exception): """ Error indicating either send_messages or delete_messages API call failed partially """ def __init__(self, result, *args): self.success_count = len(result['Successful']) self.failure_count = len(result['Failed']) self.result = result s...
''' Created on Dec 18, 2016 @author: rch '''
""" Created on Dec 18, 2016 @author: rch """
#!/usr/bin/env python # coding=utf-8 class BaseException(Exception): def __init__(self, code, msg): self.code = code self.msg = msg def __str__(self): return '<%s %s>' % (self.__class__.__name__, self.code)
class Baseexception(Exception): def __init__(self, code, msg): self.code = code self.msg = msg def __str__(self): return '<%s %s>' % (self.__class__.__name__, self.code)
class Solution: def wiggleSort(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ ''' [3,5,2,1,6,4] [3,5,1,6,2,4] [4,3,2,1] [3,4,2,1] [6,6,5,6,3,8] ''' def is_correct_order(x, ...
class Solution: def wiggle_sort(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ '\n [3,5,2,1,6,4]\n [3,5,1,6,2,4]\n \n [4,3,2,1]\n [3,4,2,1]\n [6,6,5,6,3,8]\n ' def is_correct_ord...
# Copyright (c) 2014 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'targets': [ { 'target_name': 'test_cdecl', 'type': 'loadable_module', 'msvs_settings': { 'VCCLCompilerTool': { 'Calling...
{'targets': [{'target_name': 'test_cdecl', 'type': 'loadable_module', 'msvs_settings': {'VCCLCompilerTool': {'CallingConvention': 0}}, 'sources': ['calling-convention.cc', 'calling-convention-cdecl.def']}, {'target_name': 'test_fastcall', 'type': 'loadable_module', 'msvs_settings': {'VCCLCompilerTool': {'CallingConvent...
class BaseAgent(object): """ Class for the basic agent objects. """ def __init__(self, env, actor_critic, storage, device): """ env: (gym.Env) environment following the openAI Gym API """ self.env = en...
class Baseagent(object): """ Class for the basic agent objects. """ def __init__(self, env, actor_critic, storage, device): """ env: (gym.Env) environment following the openAI Gym API """ self.env = env self.actor_critic = actor_critic self.storage = stor...
# # PySNMP MIB module RBT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RBT-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:18:46 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constraint, single_value_constraint, constraints_union, constraints_intersection) ...
def solution(num): if num < 0: raise ValueError if num == 1: return 1 k = None for k in range(num // 2 + 1): if k ** 2 == num: return k elif k ** 2 > num: return k - 1 return k def best_solution(num): if num < 0: raise ValueEr...
def solution(num): if num < 0: raise ValueError if num == 1: return 1 k = None for k in range(num // 2 + 1): if k ** 2 == num: return k elif k ** 2 > num: return k - 1 return k def best_solution(num): if num < 0: raise ValueError ...
# Homework #6. Loops print("--- Task #1. 10 monkeys") # Task #1. Write a program that output the following string: "1 monkey 2 monkeys ... 10 monkeys". for x in range(1, 11): if x == 1: monkey = f"{x} monkey " else: monkey = monkey + f"{x} monkeys " print(monkey.strip()) print("\n--- Task #2. Countdow...
print('--- Task #1. 10 monkeys') for x in range(1, 11): if x == 1: monkey = f'{x} monkey ' else: monkey = monkey + f'{x} monkeys ' print(monkey.strip()) print('\n--- Task #2. Countdown timer') for x in range(10, 0, -1): print(str(x) + ' seconds...') print() print('\n--- Task #3') n = int(inp...
""" https://leetcode.com/problems/diameter-of-binary-tree/ Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path between any two nodes in a tree. This path may or may not pass through the root. Example: Given a binary tree ...
""" https://leetcode.com/problems/diameter-of-binary-tree/ Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path between any two nodes in a tree. This path may or may not pass through the root. Example: Given a binary tree ...
# # PySNMP MIB module TRANGO-APEX-TRAP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TRANGO-APEX-TRAP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:19:34 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, single_value_constraint, value_range_constraint, value_size_constraint) ...
""" District Mapping ================ Defines the algorithms that perform the mapping from precincts to districts. """
""" District Mapping ================ Defines the algorithms that perform the mapping from precincts to districts. """
# -*- coding: utf-8 -*- i = 1 for x in range(60, -1, -5): print('I={} J={}'.format(i, x)) i += 3
i = 1 for x in range(60, -1, -5): print('I={} J={}'.format(i, x)) i += 3
def process(N): temp = str(N) temp = temp.replace('4','2') res1 = int(temp) res2 = N-res1 return res1,res2 T = int(input()) for t in range(T): N = int(input()) res1,res2 = process(N) print('Case #{}: {} {}'.format(t+1,res1,res2))
def process(N): temp = str(N) temp = temp.replace('4', '2') res1 = int(temp) res2 = N - res1 return (res1, res2) t = int(input()) for t in range(T): n = int(input()) (res1, res2) = process(N) print('Case #{}: {} {}'.format(t + 1, res1, res2))
class T: WORK_REQUEST = 1 WORK_REPLY = 2 REDUCE = 3 BARRIER = 4 TOKEN = 7 class Tally: total_dirs = 0 total_files = 0 total_filesize = 0 total_stat_filesize = 0 total_symlinks = 0 total_skipped = 0 total_sparse = 0 max_files = 0 total_nlinks = 0 total_nlinke...
class T: work_request = 1 work_reply = 2 reduce = 3 barrier = 4 token = 7 class Tally: total_dirs = 0 total_files = 0 total_filesize = 0 total_stat_filesize = 0 total_symlinks = 0 total_skipped = 0 total_sparse = 0 max_files = 0 total_nlinks = 0 total_nlinked...
# Copyright 2018 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
"""Implementation of the `swift_c_module` rule.""" load(':swift_common.bzl', 'swift_common') load(':utils.bzl', 'merge_runfiles') def _swift_c_module_impl(ctx): module_map = ctx.file.module_map deps = ctx.attr.deps cc_infos = [dep[CcInfo] for dep in deps] data_runfiles = [dep[DefaultInfo].data_runfiles...
class ProgramError(Exception): """Generic exception class for errors in this program.""" pass class PluginError(ProgramError): pass class NoOptionError(ProgramError): pass class ExtCommandError(ProgramError): pass
class Programerror(Exception): """Generic exception class for errors in this program.""" pass class Pluginerror(ProgramError): pass class Nooptionerror(ProgramError): pass class Extcommanderror(ProgramError): pass
# Types Symbol = str # A Lisp Symbol is implemented as a Python str List = list # A Lisp List is implemented as a Python list Number = (int, float) # A Lisp Number is implemented as a Python int or float # Exp = Union[Symbol, Exp] def atom(token): "Numbers become numbers; every other token i...
symbol = str list = list number = (int, float) def atom(token): """Numbers become numbers; every other token is a symbol.""" try: return int(token) except ValueError: try: return float(token) except ValueError: return symbol(token)
def GetInfoMsg(): infoMsg = "This python snippet is triggered by the 'cmd' property.\r\n" infoMsg += "Any command line may be triggered with the 'cmd' property.\r\n" return infoMsg if __name__ == "__main__": print(GetInfoMsg())
def get_info_msg(): info_msg = "This python snippet is triggered by the 'cmd' property.\r\n" info_msg += "Any command line may be triggered with the 'cmd' property.\r\n" return infoMsg if __name__ == '__main__': print(get_info_msg())
def shift_rect(rect, direction, distance=48): if direction == 'left': rect.left -= distance elif direction == 'right': rect.left += distance elif direction == 'up': rect.top -= distance elif direction == 'down': rect.top += distance return rect
def shift_rect(rect, direction, distance=48): if direction == 'left': rect.left -= distance elif direction == 'right': rect.left += distance elif direction == 'up': rect.top -= distance elif direction == 'down': rect.top += distance return rect
# -*- coding: utf-8 -*- """ Created on Sat Oct 6 17:11:11 2018 @author: Haider Raheem """ a= float(input("Type a : ")) b= float(input("Type b : ")) c= float(input("Type c : ")) x= (a*b)+(b*c)+(c*a) y= (a+b+c) r= x/y print( ) print("The result of the calculation is {0:.2f}".format(r))
""" Created on Sat Oct 6 17:11:11 2018 @author: Haider Raheem """ a = float(input('Type a : ')) b = float(input('Type b : ')) c = float(input('Type c : ')) x = a * b + b * c + c * a y = a + b + c r = x / y print() print('The result of the calculation is {0:.2f}'.format(r))
# -*- coding: utf-8 -*- # Copyright 2021 Cohesity Inc. class ObjectStatusEnum(object): """Implementation of the 'ObjectStatus' enum. Specifies the status of an object during a Restore Task. 'kFilesCloned' indicates that the cloning has completed. 'kFetchedEntityInfo' indicates that information about ...
class Objectstatusenum(object): """Implementation of the 'ObjectStatus' enum. Specifies the status of an object during a Restore Task. 'kFilesCloned' indicates that the cloning has completed. 'kFetchedEntityInfo' indicates that information about the object was fetched from the primary source. '...
# 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 getLonelyNodes(self, root: TreeNode) -> List[int]: lonely_nodes = [] def dfs(no...
class Solution: def get_lonely_nodes(self, root: TreeNode) -> List[int]: lonely_nodes = [] def dfs(node, is_lonely): if node is None: return if is_lonely: lonely_nodes.append(node.val) if (node.left is None) ^ (node.right is None)...
# -*- coding: utf-8 -*- __title__ = "flloat" __description__ = "A Python implementation of the FLLOAT library." __url__ = "https://github.com/marcofavorito/flloat.git" __version__ = "1.0.0a0" __author__ = "Marco Favorito" __author_email__ = "marco.favorito@gmail.com" __license__ = "MIT license" __copyright__ = "2019 M...
__title__ = 'flloat' __description__ = 'A Python implementation of the FLLOAT library.' __url__ = 'https://github.com/marcofavorito/flloat.git' __version__ = '1.0.0a0' __author__ = 'Marco Favorito' __author_email__ = 'marco.favorito@gmail.com' __license__ = 'MIT license' __copyright__ = '2019 Marco Favorito'
class Solution: def rotatedDigits(self, N: 'int') -> 'int': result = 0 for nr in range(1, N + 1): ok = False for digit in str(nr): if digit in '347': break if digit in '6952': ok = True els...
class Solution: def rotated_digits(self, N: 'int') -> 'int': result = 0 for nr in range(1, N + 1): ok = False for digit in str(nr): if digit in '347': break if digit in '6952': ok = True else...
#-------------------------------------------------------------------------------- # SoCaTel - Backend data storage API endpoints docker container # These tokens are needed for database access. #-------------------------------------------------------------------------------- #===========================================...
elastic_user_index = 'so_user' elastic_group_index = 'so_group' elastic_organisation_index = 'so_organisation' elastic_service_index = 'so_service' elastic_host = '<insert_elastic_host>' elastic_port = '9200' elastic_user = '<insert_elasticsearch_username>' elastic_passwd = '<insert_elasticsearch_password>' path = 'htt...
x1 = 1 y1 = 0 x2 = 0 y2 = -2 m1 = (y2 / x1) x1 = 2 y1 = 2 x2 = 6 y2 = 10 m2 = (y2 - y1 / x2 - x1) diff = m1 - m2 print(f'Diff of 8 and 9: {diff:.2f}') # 10
x1 = 1 y1 = 0 x2 = 0 y2 = -2 m1 = y2 / x1 x1 = 2 y1 = 2 x2 = 6 y2 = 10 m2 = y2 - y1 / x2 - x1 diff = m1 - m2 print(f'Diff of 8 and 9: {diff:.2f}')
# https://www.codechef.com/problems/COPS for T in range(int(input())): M,x,y=map(int,input().split()) m,a = list(map(int,input().split())),list(range(1,101)) for i in m: for j in range(i-x*y,i+1+x*y): if(j in a): a.remove(j) print(len(a))
for t in range(int(input())): (m, x, y) = map(int, input().split()) (m, a) = (list(map(int, input().split())), list(range(1, 101))) for i in m: for j in range(i - x * y, i + 1 + x * y): if j in a: a.remove(j) print(len(a))
# -*- coding: utf-8 -*- """ wordpress ~~~~ tamper for wordpress :author: LoRexxar <LoRexxar@gmail.com> :homepage: https://github.com/LoRexxar/Kunlun-M :license: MIT, see LICENSE for more details. :copyright: Copyright (c) 2017 LoRexxar. All rights reserved """ wordpress = { "es...
""" wordpress ~~~~ tamper for wordpress :author: LoRexxar <LoRexxar@gmail.com> :homepage: https://github.com/LoRexxar/Kunlun-M :license: MIT, see LICENSE for more details. :copyright: Copyright (c) 2017 LoRexxar. All rights reserved """ wordpress = {'esc_url': [1000, 10001, 10002], '...
""" Definition of ListNode class ListNode(object): def __init__(self, val, next=None): self.val = val self.next = next """ class Solution: """ @param head: a ListNode @param k: An integer @return: a ListNode @ O(n) time | O(1) space """ def reverseKGroup(self, head, k)...
""" Definition of ListNode class ListNode(object): def __init__(self, val, next=None): self.val = val self.next = next """ class Solution: """ @param head: a ListNode @param k: An integer @return: a ListNode @ O(n) time | O(1) space """ def reverse_k_group(self, head, k...
# -*- coding: utf-8 -*- """ Wrapper class for Bluetooth LE servers returned from calling :py:meth:`bleak.discover`. Created on 2018-04-23 by hbldh <henrik.blidh@nedomkull.com> """ class BLEDevice(object): """A simple wrapper class representing a BLE server detected during a `discover` call. - When usin...
""" Wrapper class for Bluetooth LE servers returned from calling :py:meth:`bleak.discover`. Created on 2018-04-23 by hbldh <henrik.blidh@nedomkull.com> """ class Bledevice(object): """A simple wrapper class representing a BLE server detected during a `discover` call. - When using Windows backend, `detai...
# # Hubblemon - Yet another general purpose system monitor # # Copyright 2015 NAVER Corp. # # 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 # # U...
class Jquery: def __init__(self): self.scripts = [] def render(self): pass def autocomplete(self, id): ret = jquery_autocomplete(id) self.scripts.append(ret) return ret def button(self, id): ret = jquery_button(id) self.scripts.append(ret) ...
class DataGridViewCellStateChangedEventArgs(EventArgs): """ Provides data for the System.Windows.Forms.DataGridView.CellStateChanged event. DataGridViewCellStateChangedEventArgs(dataGridViewCell: DataGridViewCell,stateChanged: DataGridViewElementStates) """ @staticmethod def __new__(self, ...
class Datagridviewcellstatechangedeventargs(EventArgs): """ Provides data for the System.Windows.Forms.DataGridView.CellStateChanged event. DataGridViewCellStateChangedEventArgs(dataGridViewCell: DataGridViewCell,stateChanged: DataGridViewElementStates) """ @staticmethod def __new__(self, dataGridVi...
description = 'Verify the user cannot log in if password value is missing' pages = ['login'] def test(data): navigate(data.env.url) send_keys(login.username_input, 'admin') click(login.login_button) capture('Verify the correct error message is shown') verify_text_in_element(login.error_list, 'Pas...
description = 'Verify the user cannot log in if password value is missing' pages = ['login'] def test(data): navigate(data.env.url) send_keys(login.username_input, 'admin') click(login.login_button) capture('Verify the correct error message is shown') verify_text_in_element(login.error_list, 'Passw...
####################################################################### # Copyright (C) 2017 Shangtong Zhang(zhangshangtong.cpp@gmail.com) # # Permission given to modify the code as long as you keep this # # declaration at the top # ################################...
class Constantschedule: def __init__(self, val): self.val = val def __call__(self, steps=1): return self.val class Linearschedule: def __init__(self, start, end=None, steps=None): if end is None: end = start steps = 1 self.inc = (end - start) / flo...
"""Version details for python-marketman This file shamelessly taken from the requests library""" __title__ = 'python-marketman' __description__ = 'A basic Marketman.com REST API client.' __url__ = 'https://github.com/LukasKlement/python-marketman' __version__ = '0.1' __author__ = 'Lukas Klement' __author_email__ = 'lu...
"""Version details for python-marketman This file shamelessly taken from the requests library""" __title__ = 'python-marketman' __description__ = 'A basic Marketman.com REST API client.' __url__ = 'https://github.com/LukasKlement/python-marketman' __version__ = '0.1' __author__ = 'Lukas Klement' __author_email__ = 'luk...
def forward(w,s,b,y): Yhat= w * s + b output = (Yhat-y)**2 return output, Yhat def derivative_W(x, output, Yhat, y): return ((2 * output) * (Yhat - y)) * x # w def derivative_B(b, output, Yhat, y): return ((2 * output) * (Yhat - y)) * b #bias def main(): w = 1.0 #weight x = 2.0 #samp...
def forward(w, s, b, y): yhat = w * s + b output = (Yhat - y) ** 2 return (output, Yhat) def derivative_w(x, output, Yhat, y): return 2 * output * (Yhat - y) * x def derivative_b(b, output, Yhat, y): return 2 * output * (Yhat - y) * b def main(): w = 1.0 x = 2.0 b = 1.0 y = 2.0 * ...
# -*- coding: utf-8 -*- """Top-level package for Test.""" __author__ = """Lana Maidenbaum""" __email__ = 'lana.maidenbaum@zeel.com' __version__ = '0.1.1'
"""Top-level package for Test.""" __author__ = 'Lana Maidenbaum' __email__ = 'lana.maidenbaum@zeel.com' __version__ = '0.1.1'
""" SpEC ~~~~~~~~~~~~~~~~~~~ Sparsity, Explainability, and Communication :copyright: (c) 2019 by Marcos Treviso :licence: MIT, see LICENSE for more details """ # Generate your own AsciiArt at: # patorjk.com/software/taag/#f=Calvin%20S&t=SpEC __banner__ = """ _____ _____ _____ | __|___| __| | |__ | . | ...
""" SpEC ~~~~~~~~~~~~~~~~~~~ Sparsity, Explainability, and Communication :copyright: (c) 2019 by Marcos Treviso :licence: MIT, see LICENSE for more details """ __banner__ = '\n _____ _____ _____\n| __|___| __| |\n|__ | . | __| --|\n|_____| _|_____|_____|\n |_|\n' __prog__ = 'spec' __title__ = '...
def banner(message, length, header='=', footer='*'): print() print(header * length) print((' ' * (length//2 - len(message)//2)), message) print(footer * length) def banner_v2(length, footer='-'): print(footer * length) print()
def banner(message, length, header='=', footer='*'): print() print(header * length) print(' ' * (length // 2 - len(message) // 2), message) print(footer * length) def banner_v2(length, footer='-'): print(footer * length) print()
# Soft-serve Damage Skin success = sm.addDamageSkin(2434951) if success: sm.chat("The Soft-serve Damage Skin has been added to your account's damage skin collection.")
success = sm.addDamageSkin(2434951) if success: sm.chat("The Soft-serve Damage Skin has been added to your account's damage skin collection.")
num1 = 100 num2 = 200 num3 = 300 num4 = 400 num5 = 500 mum6 = 600 num7 = 700 num8 = 800
num1 = 100 num2 = 200 num3 = 300 num4 = 400 num5 = 500 mum6 = 600 num7 = 700 num8 = 800
# Link - https://leetcode.com/problems/implement-strstr/ """ 28. Implement strStr() Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Clarification: What should we return when needle is an empty string? This is a great question to ask during...
""" 28. Implement strStr() Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Clarification: What should we return when needle is an empty string? This is a great question to ask during an interview. For the purpose of this problem, we will ...
def required_model(name: object, kwargs: object) -> object: required_fields = kwargs['required_fields'] if 'required_fields' in kwargs else [] task_f = kwargs['required_task_fields'] if 'required_task_fields' in kwargs else [] proc_f = kwargs['required_proc_fields'] if 'required_proc_fields' in kwargs else [] disp...
def required_model(name: object, kwargs: object) -> object: required_fields = kwargs['required_fields'] if 'required_fields' in kwargs else [] task_f = kwargs['required_task_fields'] if 'required_task_fields' in kwargs else [] proc_f = kwargs['required_proc_fields'] if 'required_proc_fields' in kwargs else ...
#!/usr/bin/env python # -*- coding: utf-8 -*- class Unit: def __init__(self, x, y, color, name): self.x = x self.y = y self.color = color self.name = name self.taken = False class OpUnit(Unit): def __init__(self, x, y, color, name): super().__init__(x, y, color...
class Unit: def __init__(self, x, y, color, name): self.x = x self.y = y self.color = color self.name = name self.taken = False class Opunit(Unit): def __init__(self, x, y, color, name): super().__init__(x, y, color, name) self.blue = 0.0
#!/usr/bin/env python #coding: utf-8 class Node: def __init__(self, elem=None, next=None): self.elem = elem self.next = next if __name__ == "__main__": n1 = Node(1, None) n2 = Node(2, None) n1.next = n2
class Node: def __init__(self, elem=None, next=None): self.elem = elem self.next = next if __name__ == '__main__': n1 = node(1, None) n2 = node(2, None) n1.next = n2
def test_check_sanity(client): resp = client.get('/sanity') assert resp.status_code == 200 assert 'Sanity check passed.' == resp.data.decode() # 'list collections' tests def test_get_api_root(client): resp = client.get('/', content_type='application/json') assert resp.status_code == 200 resp_d...
def test_check_sanity(client): resp = client.get('/sanity') assert resp.status_code == 200 assert 'Sanity check passed.' == resp.data.decode() def test_get_api_root(client): resp = client.get('/', content_type='application/json') assert resp.status_code == 200 resp_data = resp.get_json() as...
''' Single perceptron can replicate a NAND gate https://en.wikipedia.org/wiki/NAND_logic inputs | output 0 0 1 0 1 1 1 0 1 1 1 0 ''' def dot_product(vec1,vec2): if (len(vec1) != len(vec2)): print("input vector lengths are not equal") print(len(vec1)) print(len(vec2)) reslt=0 for...
""" Single perceptron can replicate a NAND gate https://en.wikipedia.org/wiki/NAND_logic inputs | output 0 0 1 0 1 1 1 0 1 1 1 0 """ def dot_product(vec1, vec2): if len(vec1) != len(vec2): print('input vector lengths are not equal') print(len(vec1)) print(len(vec2)) ...
# you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(A): # write your code in Python 3.6 dictionary = {} for number in A: if dictionary.get(number) == None: dictionary[number] = 1 else: dictionary[number] += 1 for ke...
def solution(A): dictionary = {} for number in A: if dictionary.get(number) == None: dictionary[number] = 1 else: dictionary[number] += 1 for key in dictionary.keys(): if dictionary.get(key) % 2 == 1: return key
print(4+3); print("Hello"); print('Who are you'); print('This is Pradeep\'s python program'); print(r'C:\Users\N51254\Documents\NetBeansProjects'); print("Pradeep "*5);
print(4 + 3) print('Hello') print('Who are you') print("This is Pradeep's python program") print('C:\\Users\\N51254\\Documents\\NetBeansProjects') print('Pradeep ' * 5)
class Bank(): def __init__(self): pass def reduce(self, source, to): return source.reduce(to)
class Bank: def __init__(self): pass def reduce(self, source, to): return source.reduce(to)
""" Solution to Word in Reverse """ if __name__ == '__main__': while True: word = input('Enter a word: ') word = str(word) i = len(word) reversed_word = '' while i > 0: reversed_word += word[i - 1] i -= 1 print('{reversed_wo...
""" Solution to Word in Reverse """ if __name__ == '__main__': while True: word = input('Enter a word: ') word = str(word) i = len(word) reversed_word = '' while i > 0: reversed_word += word[i - 1] i -= 1 print('{reversed_word}\n'.format(re...