content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def test_verify_all_contacts_on_home_page(app, orm): if len(orm.get_contact_list()) == 0: app.contact.create_one_contact() contacts_ui = sorted(app.contact.get_contact_list(), key=app.utils.id_or_max) contacts_db = sorted(orm.get_contact_list(), key=app.utils.id_or_max) assert len(contacts_ui)...
def test_verify_all_contacts_on_home_page(app, orm): if len(orm.get_contact_list()) == 0: app.contact.create_one_contact() contacts_ui = sorted(app.contact.get_contact_list(), key=app.utils.id_or_max) contacts_db = sorted(orm.get_contact_list(), key=app.utils.id_or_max) assert len(contacts_ui) =...
''' Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,2,4,5,6,7] might become: [4,5,6,7,0,1,2] if it was rotated 4 times. [0,1,2,4,5,6,7] if it was rotated 7 times. Notice that rotating an array [a[0], a[1], a[2], ..., a[n-1]] 1 time results in ...
""" Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,2,4,5,6,7] might become: [4,5,6,7,0,1,2] if it was rotated 4 times. [0,1,2,4,5,6,7] if it was rotated 7 times. Notice that rotating an array [a[0], a[1], a[2], ..., a[n-1]] 1 time results in ...
time = 0 _input_id = 0 def get_input_id(): global _input_id input_id = _input_id _input_id += 1 return input_id
time = 0 _input_id = 0 def get_input_id(): global _input_id input_id = _input_id _input_id += 1 return input_id
DEFINITIONS = { "default": { "class_name": "CodeXGlueTcTextToCode", "dataset_type": "Text-Code", "description": "CodeXGLUE text-to-code dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Text-Code/text-to-code", "dir_name": "text-to-code", "name": "default...
definitions = {'default': {'class_name': 'CodeXGlueTcTextToCode', 'dataset_type': 'Text-Code', 'description': 'CodeXGLUE text-to-code dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Text-Code/text-to-code', 'dir_name': 'text-to-code', 'name': 'default', 'project_url': 'https://github.com/madlag/C...
with open("input.txt") as f: data = f.read().split("\n") x = 0 y = 0 facing = 90 for d in data: if d[0] == "L": new_direction = facing - int(d[1:]) facing = new_direction if new_direction >= 0 else abs(abs(new_direction) - 360) elif d[0] == "R": facing = abs(facing + int(d[1:])) % ...
with open('input.txt') as f: data = f.read().split('\n') x = 0 y = 0 facing = 90 for d in data: if d[0] == 'L': new_direction = facing - int(d[1:]) facing = new_direction if new_direction >= 0 else abs(abs(new_direction) - 360) elif d[0] == 'R': facing = abs(facing + int(d[1:])) % 36...
jam_info = { "KA091": { "1542291592000.jpg": [ True, False ], "1542292095000.jpg": [ True, False ], "1542292155000.jpg": [ True, True ], "1542292214000.jpg": [ True, False ], "1542292274000.jpg": [ True, False ], "1542292334000.jpg": [ False, False ], "1542292...
jam_info = {'KA091': {'1542291592000.jpg': [True, False], '1542292095000.jpg': [True, False], '1542292155000.jpg': [True, True], '1542292214000.jpg': [True, False], '1542292274000.jpg': [True, False], '1542292334000.jpg': [False, False], '1542292395000.jpg': [False, False], '1542292515000.jpg': [True, False], '15422925...
# # @lc app=leetcode id=118 lang=python3 # # [118] Pascal's Triangle # class Solution: def generate(self, numRows: int) -> List[List[int]]: if numRows == 0: return [] result = [[1]] for n in range(2, numRows + 1): last_layer, new_layer = result[-1], [] for...
class Solution: def generate(self, numRows: int) -> List[List[int]]: if numRows == 0: return [] result = [[1]] for n in range(2, numRows + 1): (last_layer, new_layer) = (result[-1], []) for i in range(n): if i == 0 or i == n - 1: ...
def get_multiline_input(prompt): print(prompt + '\n***To end input, write nothing just press Enter (New line)***\n') content = '' while True: temp = input(':') if temp == '': break else: content += temp + '\n' return content[:-1]
def get_multiline_input(prompt): print(prompt + '\n***To end input, write nothing just press Enter (New line)***\n') content = '' while True: temp = input(':') if temp == '': break else: content += temp + '\n' return content[:-1]
def check_list_equality(list1, list2): if len(list1) != len(list2): return False for x, y in zip(list1, list2): if x != y: return False return True def generate_config(deck1, deck2): config = "" config += ",".join([str(x) for x in deck1]) config += "v" config +=...
def check_list_equality(list1, list2): if len(list1) != len(list2): return False for (x, y) in zip(list1, list2): if x != y: return False return True def generate_config(deck1, deck2): config = '' config += ','.join([str(x) for x in deck1]) config += 'v' config +...
def test_index(test_client): response = test_client.get('/') assert response.status_code == 200 assert b'About the author & Contacts' in response.data def test_alt_index(test_client): response = test_client.get('/index') assert response.status_code == 200 assert b'About the author & Contacts' ...
def test_index(test_client): response = test_client.get('/') assert response.status_code == 200 assert b'About the author & Contacts' in response.data def test_alt_index(test_client): response = test_client.get('/index') assert response.status_code == 200 assert b'About the author & Contacts' i...
DB_VERSION = "0.0.6" METADATA_DB = "tsdb.sqlite" DEFAULT_META_ID = 0 METADATA_MISSING_VALUE = 9999 MISSING_VALUE = -9999
db_version = '0.0.6' metadata_db = 'tsdb.sqlite' default_meta_id = 0 metadata_missing_value = 9999 missing_value = -9999
size(700, 700) # A foliage generator! # The foliage are actually green stars with random # inner and outer radii and a random number of points. # They are skewed to make it look more random. translate(50,50) # By using HSB colormode, we can change the saturation and brightness # of the leaves to get more natural colo...
size(700, 700) translate(50, 50) colormode(HSB) for (x, y) in grid(50, 50, 12, 12): push() fill(0.3, random(), random(0.2, 0.6), 0.8) skew(random(-50, 50)) star(x + random(-5, 5), y + random(-5, 5), random(10), random(1, 40), 15) pop()
# You would like to count the number of fruits in your basket. # In order to do this, you have the following dictionary and list of # fruits. Use the dictionary and list to count the total number # of fruits, but you do not want to count the other items in your basket. result = 0 # initializes the result basket_item...
result = 0 basket_items = {'apples': 4, 'oranges': 19, 'kites': 3, 'sandwiches': 8} fruits = ['apples', 'oranges', 'pears', 'peaches', 'grapes', 'bananas'] for (item, value) in basket_items.items(): if item in fruits: result += value print(result)
# pylint: disable=missing-function-docstring, missing-module-docstring/ #$ header class Point(public) #$ header method __init__(Point, double, double) #$ header method __del__(Point) #$ header method translate(Point, double|int, double|int) class Point(object): def __init__(self, x, y): self.x = x ...
class Point(object): def __init__(self, x, y): self.x = x self.y = y def __del__(self): pass def translate(self, a, b): self.x = self.x + a self.y = self.y + b
def relative_change(new_value,reference): return abs((new_value-reference)/reference) class Report: def __init__(self, validation_base, run_base, configuration=None): self.run_base = run_base self.validation_base = {} self.status = {} for p in validation_base["Packs"]: ...
def relative_change(new_value, reference): return abs((new_value - reference) / reference) class Report: def __init__(self, validation_base, run_base, configuration=None): self.run_base = run_base self.validation_base = {} self.status = {} for p in validation_base['Packs']: ...
output = '<int %r id=%#0x val=%d>' w = x = y = z = 1 def f1(): x = y = z = 2 def f2(): y = z = 3 def f3(): z = 4 print(output % ('w', id(w), w)) print(output % ('x', id(x), x)) print(output % ('y', id(y), y)) print(output % ('z', id(z), z)) clo = f3.__closure__ if clo: print('f3 closure var...
output = '<int %r id=%#0x val=%d>' w = x = y = z = 1 def f1(): x = y = z = 2 def f2(): y = z = 3 def f3(): z = 4 print(output % ('w', id(w), w)) print(output % ('x', id(x), x)) print(output % ('y', id(y), y)) print(output % ('z', id(...
# 2 sum data = '''1046 1565 1179 1889 1683 1837 1973 1584 1581 192 1857 1373 1715 1473 1770 1907 1918 1909 1880 1903 1835 1887 1511 1844 1628 1688 1545 1469 1620 1751 1893 1861 511 1201 1641 1874 1946 1701 1777 1829 1609 1805 1678 1928 1398 1555 1675 1798 1485 1911 1974 1663 1919 1635 195 1441 1525 1490 1151 1406 1408 ...
data = '1046\n1565\n1179\n1889\n1683\n1837\n1973\n1584\n1581\n192\n1857\n1373\n1715\n1473\n1770\n1907\n1918\n1909\n1880\n1903\n1835\n1887\n1511\n1844\n1628\n1688\n1545\n1469\n1620\n1751\n1893\n1861\n511\n1201\n1641\n1874\n1946\n1701\n1777\n1829\n1609\n1805\n1678\n1928\n1398\n1555\n1675\n1798\n1485\n1911\n1974\n1663\n19...
#Serie fibonacci # 1 + 1 = 2 # 1 + 2 = 3 # 2 + 3 = 5 # 3 + 5 = 8 # 5 + 8 = 13 # 8 + 13 = 21 # A + B = C # b + c = D #Valores A = 1 B = 1 C = 0 limite = int(input("Digite el limite de veces: ")) interructor = 0 if limite < 1: print("Error") elif limite == 1: print(A) else: while interructor < limite: ...
a = 1 b = 1 c = 0 limite = int(input('Digite el limite de veces: ')) interructor = 0 if limite < 1: print('Error') elif limite == 1: print(A) else: while interructor < limite: print(A, end=', ') c = A + B interructor += 1 a = B b = C
# # PySNMP MIB module TPLINK-IP-SOURCE-GUARD-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPLINK-IP-SOURCE-GUARD-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:24:56 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version ...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, value_size_constraint, constraints_intersection, value_range_constraint) ...
# # This file contains the Python code from Program 10.17 of # "Data Structures and Algorithms # with Object-Oriented Design Patterns in Python" # by Bruno R. Preiss. # # Copyright (c) 2003 by Bruno R. Preiss, P.Eng. All rights reserved. # # http://www.brpreiss.com/books/opus7/programs/pgm10_17.txt # class MWayTree(Se...
class Mwaytree(SearchTree): def insert(self, obj): if self.isEmpty: self._subtree[0] = m_way_tree(self.m) self._key[1] = obj self._subtree[1] = m_way_tree(self.m) self._count = 1 else: index = self.findIndex(obj) if index != 0 ...
class Column: ID = 0 VALUE = 1 TAG = 3 PARENT = 6 RELATION = 7
class Column: id = 0 value = 1 tag = 3 parent = 6 relation = 7
def rotate(list): newMatrix = [[0 for x in range(N)] for y in range(N)] for x in range(N): for y in range(N): newMatrix[x][y] = list[y][N-x-1] return newMatrix if __name__ == '__main__': toRotate = True N = int(input()) matrix = [[0 for x in range(N)] for y in range(N)] ...
def rotate(list): new_matrix = [[0 for x in range(N)] for y in range(N)] for x in range(N): for y in range(N): newMatrix[x][y] = list[y][N - x - 1] return newMatrix if __name__ == '__main__': to_rotate = True n = int(input()) matrix = [[0 for x in range(N)] for y in range(N)]...
def toFloat(arg: str) -> float: try: return float(arg) except ValueError: raise Exception("String is not convertible to number") def sum(arg1: str, arg2: str) -> float: if isinstance(arg1, str): arg1 = toFloat(arg1) if isinstance(arg2, str): arg2 = toFloat(arg2) try...
def to_float(arg: str) -> float: try: return float(arg) except ValueError: raise exception('String is not convertible to number') def sum(arg1: str, arg2: str) -> float: if isinstance(arg1, str): arg1 = to_float(arg1) if isinstance(arg2, str): arg2 = to_float(arg2) t...
a=str(input('Enter number ')) b=a[::-1] print('Reverse number =',b) if a==b: print(a,'is in palindrome.') else: print(a,'is not in palindrome.')
a = str(input('Enter number ')) b = a[::-1] print('Reverse number =', b) if a == b: print(a, 'is in palindrome.') else: print(a, 'is not in palindrome.')
class Node: __slots__ = ['val', 'levels'] def __init__(self, val, n): self.val = val self.levels = [None] * n class Skiplist: def __init__(self): self.head = Node(-1, 16) def _iter(self, target): cur = self.head for level in range(15, -1, -1): ...
class Node: __slots__ = ['val', 'levels'] def __init__(self, val, n): self.val = val self.levels = [None] * n class Skiplist: def __init__(self): self.head = node(-1, 16) def _iter(self, target): cur = self.head for level in range(15, -1, -1): whil...
#!/usr/bin/env python3 # https://abc066.contest.atcoder.jp/tasks/arc077_a n = int(input()) a = input().split() b = [0] * n for i in range(n % 2, n, 2): b[(n + i) // 2] = a[i] for i in range(n - 1, -1, -2): b[(n - i - 1) // 2] = a[i] print(' '.join(b))
n = int(input()) a = input().split() b = [0] * n for i in range(n % 2, n, 2): b[(n + i) // 2] = a[i] for i in range(n - 1, -1, -2): b[(n - i - 1) // 2] = a[i] print(' '.join(b))
# Author: Jesus Minjares # Master of Science in Computer Engineering # Date 01-07-22 # use Micropython terminal print("Hello world!")
print('Hello world!')
def multi(num1,num2,t=0): if num2 == 0: return t else: t+=num1 return multi(num1,num2 - 1,t) print(multi(4,100))
def multi(num1, num2, t=0): if num2 == 0: return t else: t += num1 return multi(num1, num2 - 1, t) print(multi(4, 100))
text = input() vowels = ['a', 'u', 'e', 'i', 'o', 'A', 'U', 'E', 'I', 'O'] no_vowels = ''.join([x for x in text if x not in vowels]) print(no_vowels)
text = input() vowels = ['a', 'u', 'e', 'i', 'o', 'A', 'U', 'E', 'I', 'O'] no_vowels = ''.join([x for x in text if x not in vowels]) print(no_vowels)
''' Create a function named divisors/Divisors that takes an integer n > 1 and returns an array with all of the integer's divisors(except for 1 and the number itself), from smallest to largest. If the number is prime return the string '(integer) is prime' (null in C#) (use Either String a in Haskell and Result<Vec<u32...
""" Create a function named divisors/Divisors that takes an integer n > 1 and returns an array with all of the integer's divisors(except for 1 and the number itself), from smallest to largest. If the number is prime return the string '(integer) is prime' (null in C#) (use Either String a in Haskell and Result<Vec<u32...
class Sentence(object): def _init_(self,subject,verb,obj): self.subject=subject[1] self.object=obj[1]
class Sentence(object): def _init_(self, subject, verb, obj): self.subject = subject[1] self.object = obj[1]
n=int(input()) arr=list(map(int,input().split())) m=[] for i in range(n): add=0 l=list(map(int,input().split())) add=sum(l)*5 + len(l)*15 m.append(add) print(min(m))
n = int(input()) arr = list(map(int, input().split())) m = [] for i in range(n): add = 0 l = list(map(int, input().split())) add = sum(l) * 5 + len(l) * 15 m.append(add) print(min(m))
''' Date: 2021-07-12 14:25:59 LastEditors: Liuliang LastEditTime: 2021-07-12 14:49:11 Description: ''' t = (20, 8) c = divmod(*t) print(c)
""" Date: 2021-07-12 14:25:59 LastEditors: Liuliang LastEditTime: 2021-07-12 14:49:11 Description: """ t = (20, 8) c = divmod(*t) print(c)
'''Simple Generator for fibonacci number in Fibonacci series new number is generated by adding previous two number first two fibonacci numbers are 0 and 1. so fibonacci series 0, 1 , 1 , 2 , 3, 5, 8, 13, 21, 34....... ''' def sub(limit): #initializing first two fibonacci number a, b = 0, 1 #one by one yield next fi...
"""Simple Generator for fibonacci number in Fibonacci series new number is generated by adding previous two number first two fibonacci numbers are 0 and 1. so fibonacci series 0, 1 , 1 , 2 , 3, 5, 8, 13, 21, 34....... """ def sub(limit): (a, b) = (0, 1) while a < limit: yield a (a, b) = (b, a +...
# Copyright 2007,2008,2009,2011 Everyblock LLC, OpenPlans, and contributors # # This file is part of ebdata # # ebdata is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License,...
""" .. _ebdata-nlp: nlp === The nlp package contains utilities for detecting locations in text. This package is used by :py:mod:`ebdata.blobs`, but if you want to use it directly, check out the docstrings for the functions in :py:mod:`ebdata.parsing.addresses`. """
files_c=[ 'C/7zCrc.c', 'C/7zCrcOpt.c', 'C/Alloc.c', 'C/CpuArch.c', 'C/Ppmd7.c', 'C/Ppmd7Dec.c', ] files_cpp=[ 'CPP/7zip/Common/InBuffer.cpp', 'CPP/7zip/Common/OutBuffer.cpp', 'CPP/7zip/Common/StreamUtils.cpp', 'CPP/7zip/Compress/CodecExports.cpp', 'CPP/7zip/Compress/DllExportsCompress.cpp', 'CPP/7zip/Comp...
files_c = ['C/7zCrc.c', 'C/7zCrcOpt.c', 'C/Alloc.c', 'C/CpuArch.c', 'C/Ppmd7.c', 'C/Ppmd7Dec.c'] files_cpp = ['CPP/7zip/Common/InBuffer.cpp', 'CPP/7zip/Common/OutBuffer.cpp', 'CPP/7zip/Common/StreamUtils.cpp', 'CPP/7zip/Compress/CodecExports.cpp', 'CPP/7zip/Compress/DllExportsCompress.cpp', 'CPP/7zip/Compress/LzOutWind...
def hows_the_parrot(): print("He's pining for the fjords!") hows_the_parrot() def lumberjack(name, pronoun): print("{} is a lumberjack and {} OK!".format(name, pronoun)) def average_of_two_nums(num1, num2): return (num1 + num2) / 2 avg_of_4_and_2 = average_of_two_nums(4,2) lumberjack('Rich', "he's") lumberjack(...
def hows_the_parrot(): print("He's pining for the fjords!") hows_the_parrot() def lumberjack(name, pronoun): print('{} is a lumberjack and {} OK!'.format(name, pronoun)) def average_of_two_nums(num1, num2): return (num1 + num2) / 2 avg_of_4_and_2 = average_of_two_nums(4, 2) lumberjack('Rich', "he's") lumb...
class Solution: def XXX(self, root: TreeNode) -> List[List[int]]: ress = [] stack = [] if root: stack.append(root) while stack: res = [] size = len(stack) for _ in range(size): node = stack.pop(0) res.app...
class Solution: def xxx(self, root: TreeNode) -> List[List[int]]: ress = [] stack = [] if root: stack.append(root) while stack: res = [] size = len(stack) for _ in range(size): node = stack.pop(0) res.ap...
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@io_istio_proxy//bazel:wasm.bzl", "wasm_dependencies") load("@bazel_skylib//rules:copy_file.bzl", "copy_file") load( "@io_bazel_rules_docker//container:container.bzl", "container_image", "container_push", ) def wasm_libraries(): ...
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') load('@io_istio_proxy//bazel:wasm.bzl', 'wasm_dependencies') load('@bazel_skylib//rules:copy_file.bzl', 'copy_file') load('@io_bazel_rules_docker//container:container.bzl', 'container_image', 'container_push') def wasm_libraries(): http_archive(n...
#!/usr/bin/python # This is reverse Cipher # Author savio # Chapter 4 of CCWP message = "This is string to be reversed, This is " + \ "encryption we don't want" def reverseString(string): lengthOfString = len(string) - 1 reversed = "" while lengthOfString >= 0: reversed = reversed + string[le...
message = 'This is string to be reversed, This is ' + "encryption we don't want" def reverse_string(string): length_of_string = len(string) - 1 reversed = '' while lengthOfString >= 0: reversed = reversed + string[lengthOfString] length_of_string -= 1 return reversed if __name__ == '__m...
days = input('How many days"s temperature? ') assert days.isdecimal(), "Uh, Oh! Invalid input!" days = int(days) step = 1 temps = [] while step <= days: temp = input('Day ' + str(step) + '"s temp: ') assert float(temp), "Uh, Oh! Invalid input!" temps.append(float(temp)) step += 1 avg = sum(temps) / le...
days = input('How many days"s temperature? ') assert days.isdecimal(), 'Uh, Oh! Invalid input!' days = int(days) step = 1 temps = [] while step <= days: temp = input('Day ' + str(step) + '"s temp: ') assert float(temp), 'Uh, Oh! Invalid input!' temps.append(float(temp)) step += 1 avg = sum(temps) / len(...
# All The Longest # Given an array of strings, # return a new array containing all those elements # that have the same largest-number of characters # e.g. # for ['I', 'am', 'cat', 'dog'] # output: ['cat', 'dog'] # User's (Problem) # We Have: # a list of strings # We Need: # longest(length) strings in the same ...
def all_longest_strings(input_list_of_stings): length_of_longest = 0 length_dict = {} for this_string in input_list_of_stings: if len(this_string) > length_of_longest: length_of_longest = len(this_string) if len(this_string) not in length_dict: length_dict[len(this_st...
prs = { 'compiler': [ { 'closed': u'2013-02-02T05:36:26Z', 'delta': 1, 'opened': u'2013-02-01T04:02:43Z', 'title': 'Topic/no main', 'url': u'https://github.com/elm/compiler/pull/84'}, { 'closed': u'2013-02-03T09:32:29Z...
prs = {'compiler': [{'closed': u'2013-02-02T05:36:26Z', 'delta': 1, 'opened': u'2013-02-01T04:02:43Z', 'title': 'Topic/no main', 'url': u'https://github.com/elm/compiler/pull/84'}, {'closed': u'2013-02-03T09:32:29Z', 'delta': 0, 'opened': u'2013-02-03T00:43:22Z', 'title': 'Changed type signature of JSON.fromString; add...
filename = 'menu.py' with open(filename) as in_file: text = '\n'.join([line.rstrip() for line in in_file.readlines()]) + '\n' with open(filename, 'w') as out_file: out_file.writelines(text)
filename = 'menu.py' with open(filename) as in_file: text = '\n'.join([line.rstrip() for line in in_file.readlines()]) + '\n' with open(filename, 'w') as out_file: out_file.writelines(text)
class Solution: def remove_duplicates(self, nums): total = 0 if not nums: return total for index, num in enumerate(nums[:]): if index != 0 and num != nums[total]: total += 1 nums[total] = nums[index] return total + 1
class Solution: def remove_duplicates(self, nums): total = 0 if not nums: return total for (index, num) in enumerate(nums[:]): if index != 0 and num != nums[total]: total += 1 nums[total] = nums[index] return total + 1
# # PySNMP MIB module CISCO-FCSP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-FCSP-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:58:28 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, constraints_union, single_value_constraint, value_size_constraint) ...
# # PySNMP MIB module Nortel-Magellan-Passport-FrameRelayNniMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-FrameRelayNniMIB # Produced by pysmi-0.3.4 at Wed May 1 14:27:17 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user da...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, value_range_constraint, constraints_intersection, value_size_constraint) ...
# examples used are 2020 taxes SINGLE_TAX_BRACKETS = [ {'min': 0, 'max': 9875, 'tax_rate': .1}, {'min': 9876, 'max': 40125, 'tax_rate': .12}, {'min': 40126, 'max': 85525, 'tax_rate': .22}, {'min': 85526, 'max': 163300, 'tax_rate': .24}, {'min': 163301, 'max': 207350, 'tax_rate': .32}, {'min': 207351, 'max':...
single_tax_brackets = [{'min': 0, 'max': 9875, 'tax_rate': 0.1}, {'min': 9876, 'max': 40125, 'tax_rate': 0.12}, {'min': 40126, 'max': 85525, 'tax_rate': 0.22}, {'min': 85526, 'max': 163300, 'tax_rate': 0.24}, {'min': 163301, 'max': 207350, 'tax_rate': 0.32}, {'min': 207351, 'max': 518400, 'tax_rate': 0.35}, {'min': 518...
class Solution: def removeInvalidParentheses(self, s: str) -> List[str]: def isValid(s): stack = [] for i in s: if i == '(': stack.append(i) elif i == ')': if len(stack) > 0 and stack[-1] == '(': ...
class Solution: def remove_invalid_parentheses(self, s: str) -> List[str]: def is_valid(s): stack = [] for i in s: if i == '(': stack.append(i) elif i == ')': if len(stack) > 0 and stack[-1] == '(': ...
class Renderer(object): def __init__(self, project_info, context, renderer_factory, node_factory, state, document, domain_handler, target_handler ): self.project_info = project_info self.co...
class Renderer(object): def __init__(self, project_info, context, renderer_factory, node_factory, state, document, domain_handler, target_handler): self.project_info = project_info self.context = context self.data_object = context.node_stack[0] self.renderer_factory = renderer_facto...
# Find numbers represented as sum of two cubes for two different pairs N = 100000 def main(): cubes = {} for i in range(1, N): cubes[i] = i ** 3 sums = {} for i1 in cubes: for i2 in cubes: if i1 == i2: continue cube_sum = cubes[i1] + cubes[i2] ...
n = 100000 def main(): cubes = {} for i in range(1, N): cubes[i] = i ** 3 sums = {} for i1 in cubes: for i2 in cubes: if i1 == i2: continue cube_sum = cubes[i1] + cubes[i2] if cube_sum > N: break numbers = s...
name = "Alisha" num = len(name)*9 print("Hi "+name +" Your Lucky number is : "+ str(num)) name = "Priyanka" num = len(name)*9 print("Hi "+name +" Your Lucky number is : "+ str(num)) #We are printing and declaring same things again and again better way is to use function to do the same def Lucky_Number(name...
name = 'Alisha' num = len(name) * 9 print('Hi ' + name + ' Your Lucky number is : ' + str(num)) name = 'Priyanka' num = len(name) * 9 print('Hi ' + name + ' Your Lucky number is : ' + str(num)) def lucky__number(name): number = len(name) * 9 print('Hi ' + name + ' Your Lucky number is : ' + str(number)) lucky_...
def maiorab(a, b): return (a + b + abs(a - b)) / 2 tokens = input().split(" ") a = int(tokens[0]) b = int(tokens[1]) c = int(tokens[2]) first = maiorab(a, b) result = maiorab(first, c) print(int(result), "eh o maior")
def maiorab(a, b): return (a + b + abs(a - b)) / 2 tokens = input().split(' ') a = int(tokens[0]) b = int(tokens[1]) c = int(tokens[2]) first = maiorab(a, b) result = maiorab(first, c) print(int(result), 'eh o maior')
# md5 : e4d92ee9e51d571e98231351d2b9aa6d # sha1 : f28d4e3190863734ac8a6759692cf3b5c9e210a8 # sha256 : a6939c20ced2c6ac4f4b0eb4294044094ab00c6303133c696ccdfb43d4bc3c16 ord_names = { 20: b'??0Link@@QAE@ABV0@@Z', 21: b'??0Link@@QAE@XZ', 22: b'??0Stack@@QAE@GG@Z', 23: b'??1Stack@@QAE@XZ', 24: b'??4Link...
ord_names = {20: b'??0Link@@QAE@ABV0@@Z', 21: b'??0Link@@QAE@XZ', 22: b'??0Stack@@QAE@GG@Z', 23: b'??1Stack@@QAE@XZ', 24: b'??4Link@@QAEAAV0@ABV0@@Z', 25: b'?Call@Link@@QAEJPAX@Z', 26: b'?Count@Container@@QBEKXZ', 27: b'?Count@Stack@@QBEKXZ', 28: b'?GetObject@Stack@@QBEPAXK@Z', 29: b'?Pop@Stack@@QAEPAXXZ', 30: b'?Push@...
#!/usr/bin/env python x = True y = True print(x and y) print(not x or y) print(x or y)
x = True y = True print(x and y) print(not x or y) print(x or y)
#!/usr/bin/python3 # Open a file fo = open("./foo.txt", "r+") print ("Name of the file: ", fo.name) print ("Closed or not : ", fo.closed) print ("Opening mode : ", fo.mode) sstr = fo.read() print ("Read String is : ", sstr) fo.close()
fo = open('./foo.txt', 'r+') print('Name of the file: ', fo.name) print('Closed or not : ', fo.closed) print('Opening mode : ', fo.mode) sstr = fo.read() print('Read String is : ', sstr) fo.close()
def accum(s): c, res = 0, [] for x in [x for x in s]: res.append(x * (c + 1)) c += 1 return "-".join([x[0].upper() + x[1:].lower() for x in res])
def accum(s): (c, res) = (0, []) for x in [x for x in s]: res.append(x * (c + 1)) c += 1 return '-'.join([x[0].upper() + x[1:].lower() for x in res])
#from abc import ABCMeta, abstractmethod # TODO: make this class abstract class FlipFlop(object): def __init__(self, Q_init): self.Q = Q_init self.Q_bar = not self.Q class DFlipFlop(FlipFlop): def __init__(self, Q_init=0, D_init=0): FlipFlop.__init__(self, Q_init) self.D = D_in...
class Flipflop(object): def __init__(self, Q_init): self.Q = Q_init self.Q_bar = not self.Q class Dflipflop(FlipFlop): def __init__(self, Q_init=0, D_init=0): FlipFlop.__init__(self, Q_init) self.D = D_init def cycle(self): if not self.D: self.Q = 0 ...
def sum(number1, number2): sum = number1 + number2 result = "The result is" return print(result, sum) first_number = int(input("Enter the first number\n")) second_number = int(input("Enter the second number\n")) sum(first_number,second_number)
def sum(number1, number2): sum = number1 + number2 result = 'The result is' return print(result, sum) first_number = int(input('Enter the first number\n')) second_number = int(input('Enter the second number\n')) sum(first_number, second_number)
class ExpiredJwtToken(Exception): pass class ExpiredJwtRefreshToken(Exception): pass class InvalidatedJwtRefreshToken(Exception): pass class LoginFailed(Exception): pass class EmailAlreadyTaken(Exception): def __init__(self, msg="email already taken", *args, **kwargs): super().__init...
class Expiredjwttoken(Exception): pass class Expiredjwtrefreshtoken(Exception): pass class Invalidatedjwtrefreshtoken(Exception): pass class Loginfailed(Exception): pass class Emailalreadytaken(Exception): def __init__(self, msg='email already taken', *args, **kwargs): super().__init__(...
for beta in betas: f = lambda k: (alpha*k**beta + (1-alpha))**(1/beta) obj_kss = lambda kss: kss - (s*f(kss) + (1-delta)*kss)/((1+g)*(1+n)) result = optimize.root_scalar(obj_kss,bracket=[0.1,100],method='brentq') print(f'for beta = {beta:.3f} the steady state for k is',result.root)
for beta in betas: f = lambda k: (alpha * k ** beta + (1 - alpha)) ** (1 / beta) obj_kss = lambda kss: kss - (s * f(kss) + (1 - delta) * kss) / ((1 + g) * (1 + n)) result = optimize.root_scalar(obj_kss, bracket=[0.1, 100], method='brentq') print(f'for beta = {beta:.3f} the steady state for k is', result...
CONF_MAINNET = { "fullnode": "https://infragrid.v.network", "event": "https://infragrid.v.network", } # testNet Maintained by the official team CONF_VIPONEER = { "fullnode": "https://vpioneer.infragrid.v.network/", "event": "https://vpioneer.infragrid.v.network/", } ALL = { "mainnet": CONF_MAINNET...
conf_mainnet = {'fullnode': 'https://infragrid.v.network', 'event': 'https://infragrid.v.network'} conf_viponeer = {'fullnode': 'https://vpioneer.infragrid.v.network/', 'event': 'https://vpioneer.infragrid.v.network/'} all = {'mainnet': CONF_MAINNET, 'vpioneer': CONF_VIPONEER} def conf_for_name(name: str) -> dict: ...
#!/usr/bin/env python3 ''' Advent of code 2019 -- Solution # 2 ''' def alarm(): arr = [1, 12, 2, 3, 1, 1, 2, 3, 1, 3, 4, 3, 1, 5, 0, 3, 2, 13, 1, 19, 1, 10, 19, 23, 1, 6, 23, 27, 1, 5, 27, 31, 1, 10, 31, 35, 2, 10, 35, 39, 1, 39, 5, 43, 2, 43, 6, 47, 2, 9, 47, 51, 1, 51, 5, 55, 1, 5, 55, 59, 2, 10, 59, 63, 1, ...
""" Advent of code 2019 -- Solution # 2 """ def alarm(): arr = [1, 12, 2, 3, 1, 1, 2, 3, 1, 3, 4, 3, 1, 5, 0, 3, 2, 13, 1, 19, 1, 10, 19, 23, 1, 6, 23, 27, 1, 5, 27, 31, 1, 10, 31, 35, 2, 10, 35, 39, 1, 39, 5, 43, 2, 43, 6, 47, 2, 9, 47, 51, 1, 51, 5, 55, 1, 5, 55, 59, 2, 10, 59, 63, 1, 5, 63, 67, 1, 67, 10, 71,...
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") load("@bazelrio//:deps_utils.bzl", "filegroup_all") def setup_toolchains_2022_1_dependencies(): # C++ maybe( http_archive, "__bazelrio_roborio_toolchain_macos", ...
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'maybe') load('@bazelrio//:deps_utils.bzl', 'filegroup_all') def setup_toolchains_2022_1_dependencies(): maybe(http_archive, '__bazelrio_roborio_toolchain_macos', url='https://github.com/wpili...
#!/usr/bin/env python name = input("Name: ") occupation = input("Occupation: ") location = input("Location: ") print("Hello {0}, being a {1} in {2} must be exciting.".format(name, occupation, location)) response = input("Is it?") if (response in ("yes", "y", "yeah")): print("How exciting.") elif (response in ("no", ...
name = input('Name: ') occupation = input('Occupation: ') location = input('Location: ') print('Hello {0}, being a {1} in {2} must be exciting.'.format(name, occupation, location)) response = input('Is it?') if response in ('yes', 'y', 'yeah'): print('How exciting.') elif response in ('no', 'n', 'nope'): print(...
# # PySNMP MIB module HP-ICF-CONFIG-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-ICF-CONFIG-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:20:57 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, value_size_constraint, single_value_constraint, constraints_union) ...
#power in time:O(log(n)) def power(p,n,mod): if n==0: return 1 temp=power(p,n//2,mod)%mod if n%2==0: return (temp*temp)%mod else: return (((temp*temp)%mod)*p)%mod #gcd in time:o(log(min(a,b))) def gcd(a,b): if b==0: return a else: return gcd(b,a%b) ...
def power(p, n, mod): if n == 0: return 1 temp = power(p, n // 2, mod) % mod if n % 2 == 0: return temp * temp % mod else: return temp * temp % mod * p % mod def gcd(a, b): if b == 0: return a else: return gcd(b, a % b)
file = open('c:/Users/home/Desktop/PYTON/manipularStrig/valor.csv','w+') x = [1,2,3,4,5,6] y = 0 for i in range(len(x)) : y = 2 * x[i] + 6 file.writelines(str(x[i]) + ", " + str(y) + '\n' ) file.close()
file = open('c:/Users/home/Desktop/PYTON/manipularStrig/valor.csv', 'w+') x = [1, 2, 3, 4, 5, 6] y = 0 for i in range(len(x)): y = 2 * x[i] + 6 file.writelines(str(x[i]) + ', ' + str(y) + '\n') file.close()
n = int(input()) narr = list(map(int,input().split())) div = int(input()) narr.sort() narr = narr[::-1] for i in narr: if i%div==0: print(i) break
n = int(input()) narr = list(map(int, input().split())) div = int(input()) narr.sort() narr = narr[::-1] for i in narr: if i % div == 0: print(i) break
class testClass(): def __init__(self): pass def testCall(self,args): return args
class Testclass: def __init__(self): pass def test_call(self, args): return args
# Heliodex 2020/10/08 # Last edited 2021/12/03 -- new program style # first program i wrote during maths class lmao print("Calculates original price based off current price and discount") while True: print(" ") c = input("1 for add, 2 for subtract ") if (c == "1"): val = float(input("Current value...
print('Calculates original price based off current price and discount') while True: print(' ') c = input('1 for add, 2 for subtract ') if c == '1': val = float(input('Current value? ')) per = float(input('Percentage added? ')) print(' ') print('Original price:') print...
op=open('G:\Arquivo.txt', 'a') print(op.write('buceta'))
op = open('G:\\Arquivo.txt', 'a') print(op.write('buceta'))
class Config(object): # Hyperparameters n_epochs = 100 batch_size = 1000 n_steps = 30 n_clusters = 1 # number of clusters for GAN-clustering; currently no used dim_clusters = 64 sigma_clusters = 1 reg_strength_d = 0.0 reg_strength_g = 0.0 dropout_d = 0.0 d...
class Config(object): n_epochs = 100 batch_size = 1000 n_steps = 30 n_clusters = 1 dim_clusters = 64 sigma_clusters = 1 reg_strength_d = 0.0 reg_strength_g = 0.0 dropout_d = 0.0 dropout_g = 0.0 learning_rate_g = 0.001 learning_rate_d = 0.001 n_hidden_units_d = 300 ...
# Build external deps. { 'variables': {'target_arch%': 'x64'}, 'target_defaults': { 'default_configuration': 'Debug', 'configuration': { 'Debug': { 'defines': ['DEBUG', '_DEBUG'], 'msvs_settings': { 'VSSLCompilerTool': { ...
{'variables': {'target_arch%': 'x64'}, 'target_defaults': {'default_configuration': 'Debug', 'configuration': {'Debug': {'defines': ['DEBUG', '_DEBUG'], 'msvs_settings': {'VSSLCompilerTool': {'RuntimeLibrary': 1}}}, 'Release': {'defines': ['NODEBUG'], 'msvs_settings': {'VSSLCompilerTool': {'RuntimeLibrary': 0}}}}, 'msv...
def get_the_ans(current_list, length): m = min(current_list) min_ops = 10**9 min_list = [x for x in range(m, m-3,-1)]#m,m-1,m-2 (these may be -ve) for m in min_list: diff_list = [x-m for x in current_list] number_of_ops = 0 #op=operation for i in diff_list: multiple_5...
def get_the_ans(current_list, length): m = min(current_list) min_ops = 10 ** 9 min_list = [x for x in range(m, m - 3, -1)] for m in min_list: diff_list = [x - m for x in current_list] number_of_ops = 0 for i in diff_list: multiple_5 = i // 5 multiple_2 = i...
# # Copyright (c) 2015-2017 EpiData, Inc. # class Transformation(object): def __init__( self, func, args=[], destination="measurements_cleansed", datastore="cassandra"): self._func = func self._destination = destination self._arg...
class Transformation(object): def __init__(self, func, args=[], destination='measurements_cleansed', datastore='cassandra'): self._func = func self._destination = destination self._args = args self._datastore = datastore def apply(self, df, sqlCtx): return self._func(df...
''' Consider a list (list = []). You can perform the following commands: insert i e: Insert integer e at position i. print: Print the list. remove e: Delete the first occurrence of integer e. append e: Insert integer e at the end of the list. sort: Sort the list. pop: Pop the last element from the list. reverse: Rever...
""" Consider a list (list = []). You can perform the following commands: insert i e: Insert integer e at position i. print: Print the list. remove e: Delete the first occurrence of integer e. append e: Insert integer e at the end of the list. sort: Sort the list. pop: Pop the last element from the list. reverse: Rever...
# # PySNMP MIB module ZHONE-PHY-LINE-TYPES (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZHONE-PHY-LINE-TYPES # Produced by pysmi-0.3.4 at Mon Apr 29 21:41:35 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, value_size_constraint, constraints_intersection, single_value_constraint) ...
while True: input() x=sorted(list(map(int,input().split()))) if x[0]>8:print('N');break aux=True for i in range(1,len(x)): if x[i]-x[i-1]>8:print('N');aux=False;break if aux:print('S') break
while True: input() x = sorted(list(map(int, input().split()))) if x[0] > 8: print('N') break aux = True for i in range(1, len(x)): if x[i] - x[i - 1] > 8: print('N') aux = False break if aux: print('S') break
# # PySNMP MIB module HP-ICF-USBPORT (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-ICF-USBPORT # Produced by pysmi-0.3.4 at Wed May 1 13:35:48 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, value_size_constraint, single_value_constraint, constraints_intersection) ...
def acos(x): pass def acosh(x): pass def asin(x): pass def asinh(x): pass def atan(x): pass def atan2(y, x): pass def atanh(x): pass def ceil(x): pass def copysign(x, y): pass def cos(x): pass def cosh(x): pass def degrees(x): pass def erf(x): pass def erfc(x): pass def exp(x): pass def expm1(x): pass d...
def acos(x): pass def acosh(x): pass def asin(x): pass def asinh(x): pass def atan(x): pass def atan2(y, x): pass def atanh(x): pass def ceil(x): pass def copysign(x, y): pass def cos(x): pass def cosh(x): pass def degrees(x): pass def erf(x): pass def er...
data={0: {'username': 'admin', 'password': 'benjo234', 'role': 'Admin'}, 1: {'username': 'Kumar', 'password': 'Lvnbs:4', 'role': 'Customer'}, 2: {'username': 'Praveen', 'password': 'qsjodf', 'role': 'Customer'}} for i in data: print(data[i],len(data),data[i]['username']) inventry = {1:{'Item Name':'Dove','C...
data = {0: {'username': 'admin', 'password': 'benjo234', 'role': 'Admin'}, 1: {'username': 'Kumar', 'password': 'Lvnbs:4', 'role': 'Customer'}, 2: {'username': 'Praveen', 'password': 'qsjodf', 'role': 'Customer'}} for i in data: print(data[i], len(data), data[i]['username']) inventry = {1: {'Item Name': 'Dove', 'Ca...
# Simple example to package as a single binary __version__ = "1.0.0" print("Hello world!")
__version__ = '1.0.0' print('Hello world!')
# import os.path DEBUG = True # basedir = os.path.abspath(os.path.dirname(__file__)) # SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db') SQLALCHEMY_DATABASE_URI = 'sqlite+pysqlite:///app.db' SQLALCHEMY_TRACK_MODIFICATIONS = True SECRET_KEY = 'senha-para-usar-o-form'
debug = True sqlalchemy_database_uri = 'sqlite+pysqlite:///app.db' sqlalchemy_track_modifications = True secret_key = 'senha-para-usar-o-form'
def is_nice_string(string) -> bool: bad_strings = ("ab", "cd", "pq", "xy") for bad_string in bad_strings: if bad_string in string: return False vowel_count = 0 vowels = ("a", "e", "i", "o", "u") for vowel in vowels: vowel_count += string.count(vowel) if vowel_count >= 3: break if vowel_count < 3: ...
def is_nice_string(string) -> bool: bad_strings = ('ab', 'cd', 'pq', 'xy') for bad_string in bad_strings: if bad_string in string: return False vowel_count = 0 vowels = ('a', 'e', 'i', 'o', 'u') for vowel in vowels: vowel_count += string.count(vowel) if vowel_coun...
# TUPLAS lanche = ('Hamburguer', 'Suco', 'Pizza', 'Pudim') # printar em linhas # usar variavel composta(tupla) for comida in lanche: print(f'Eu vou comer {comida}') print('Comi pra caramba!!!') print(len(lanche))
lanche = ('Hamburguer', 'Suco', 'Pizza', 'Pudim') for comida in lanche: print(f'Eu vou comer {comida}') print('Comi pra caramba!!!') print(len(lanche))
# MIT (c) jtankersley 2019-05-18 def bubble_sort(list): # Only viable for very short lists def _swap_list_items(list, a, b): saved = list[a] list[a] = list[b] list[b] = saved for i in range(0, len(list)): for j in range(i, len(list)): if list[i] > list[j]: ...
def bubble_sort(list): def _swap_list_items(list, a, b): saved = list[a] list[a] = list[b] list[b] = saved for i in range(0, len(list)): for j in range(i, len(list)): if list[i] > list[j]: _swap_list_items(list, i, j) return list def merge_sort(l...
def clustering(X): n_clusters = choose_n(X) kmeans = KMeans(n_clusters = n_clusters, max_iter = 200).fit(X) pred_y = kmeans.fit_predict(X) return kmeans,pred_y,n_clusters
def clustering(X): n_clusters = choose_n(X) kmeans = k_means(n_clusters=n_clusters, max_iter=200).fit(X) pred_y = kmeans.fit_predict(X) return (kmeans, pred_y, n_clusters)
def main(): # input A, B, C = map(int, input().split()) # compute X = max(A, B, C) Y = min(A, B, C) W = A + B + C - X -Y # output if X - W == W - Y: print("Yes") else: print("No") if __name__ == '__main__': main()
def main(): (a, b, c) = map(int, input().split()) x = max(A, B, C) y = min(A, B, C) w = A + B + C - X - Y if X - W == W - Y: print('Yes') else: print('No') if __name__ == '__main__': main()
class BaseServiceMixin: def __init__(self, *args, **kwargs): pass @classmethod def call(cls, *args, **kwargs): instance = cls(*args, **kwargs) instance.exec() def exec(self): raise NotImplementedError
class Baseservicemixin: def __init__(self, *args, **kwargs): pass @classmethod def call(cls, *args, **kwargs): instance = cls(*args, **kwargs) instance.exec() def exec(self): raise NotImplementedError
age = input("enter ur age:\n") if age <= 12: print("u are a kid") elif age in range(13,20): print("u are a teenager") else: print("time to grow up")
age = input('enter ur age:\n') if age <= 12: print('u are a kid') elif age in range(13, 20): print('u are a teenager') else: print('time to grow up')
line = input().split() c1 = int(line[0]) c2 = int(line[1]) c3 = int(line[2]) ans = max(c1,c2,c3) - min(c1,c2,c3) print(str(ans))
line = input().split() c1 = int(line[0]) c2 = int(line[1]) c3 = int(line[2]) ans = max(c1, c2, c3) - min(c1, c2, c3) print(str(ans))
#LoginPageLocators txtEmail = "id: email" txtPassword = "id: password" btnLogin = "css: #form-login > div.form-actions > button"
txt_email = 'id: email' txt_password = 'id: password' btn_login = 'css: #form-login > div.form-actions > button'
class Solution: def threeConsecutiveOdds(self, arr: List[int]) -> bool: for i in range(1,len(arr)-1): if arr[i]%2!=0 and arr[i-1]%2!=0 and arr[i+1]%2!=0: return True
class Solution: def three_consecutive_odds(self, arr: List[int]) -> bool: for i in range(1, len(arr) - 1): if arr[i] % 2 != 0 and arr[i - 1] % 2 != 0 and (arr[i + 1] % 2 != 0): return True
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' # Using memoization as decorator (decorator-class) class MemoizeClass: def __init__(self, func): self.func = func self.memo = dict() def __call__(self, *arg): if arg not in self.memo: self.memo[arg] = ...
__author__ = 'ipetrash' class Memoizeclass: def __init__(self, func): self.func = func self.memo = dict() def __call__(self, *arg): if arg not in self.memo: self.memo[arg] = self.func(*arg) return self.memo[arg] @MemoizeClass def fib(n): (a, b) = (1, 1) fo...
__all__ = ["cancerGenomeInterpreterConfig", "drugbankConfig", "hmdbConfig", "oncokbConfig", "siderConfig", "disgenetConfig", "gwasCatalogConfig", "intactConfig", "pathwayCommonsConfig", "stringConfig", ...
__all__ = ['cancerGenomeInterpreterConfig', 'drugbankConfig', 'hmdbConfig', 'oncokbConfig', 'siderConfig', 'disgenetConfig', 'gwasCatalogConfig', 'intactConfig', 'pathwayCommonsConfig', 'stringConfig', 'drugGeneInteractionDBConfig', 'hgncConfig', 'internalDBsConfig', 'refseqConfig', 'uniprotConfig']
''' Author: ZHAO Zinan Created: 26-May-2019 1051. Height Checker ''' class Solution: def heightChecker(self, heights: List[int]) -> int: right = sorted(heights) return sum([right[i] != heights[i] for i in range(len(right))])
""" Author: ZHAO Zinan Created: 26-May-2019 1051. Height Checker """ class Solution: def height_checker(self, heights: List[int]) -> int: right = sorted(heights) return sum([right[i] != heights[i] for i in range(len(right))])
__all__ = [ 'order_request', 'order_response', 'order_status', 'result', ]
__all__ = ['order_request', 'order_response', 'order_status', 'result']
''' Remove Zero Sum Consecutive Nodes from Linked List: Explanation: An algorithm called as prefix sum or accumalated sum is used. Here we start off with sum 0 and iterate through the linked list accumalate the sum. Consider an example: 3 -> 4 -> 2 -> -6 -> 1 -> 1 -> 5 -> -6 its corresponding prefix sum is: 0 ...
""" Remove Zero Sum Consecutive Nodes from Linked List: Explanation: An algorithm called as prefix sum or accumalated sum is used. Here we start off with sum 0 and iterate through the linked list accumalate the sum. Consider an example: 3 -> 4 -> 2 -> -6 -> 1 -> 1 -> 5 -> -6 its corresponding prefix sum is: 0 ...
class animal(): def __init__(self,oviparo,mamifero,): self.oviparo = oviparo self.mamifero = mamifero def oviparo(): print("Animales oviparos:") print("pollo") print("ornitorrinco") def mamifero(): print("Animales mamiferos:") print("gato") print("Ejer...
class Animal: def __init__(self, oviparo, mamifero): self.oviparo = oviparo self.mamifero = mamifero def oviparo(): print('Animales oviparos:') print('pollo') print('ornitorrinco') def mamifero(): print('Animales mamiferos:') print('gato') print('Ej...