content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
""" SCHARP Tools http://www.github.com/LloydAlbin/SCHARP_Tools """ # Use of this source code is govered by a Apache2 atyle license that can be # found in the LICENSE file. __author__ = "Lloyd Albin (lalbin@fredhutch.org, lloyd@thealbins.com)" __version__ = "0.0.1" __copyright__ = "Copyright (C) 2019 Fred Hutchinson...
""" SCHARP Tools http://www.github.com/LloydAlbin/SCHARP_Tools """ __author__ = 'Lloyd Albin (lalbin@fredhutch.org, lloyd@thealbins.com)' __version__ = '0.0.1' __copyright__ = 'Copyright (C) 2019 Fred Hutchinson Cancer Research Center' __license__ = 'MIT' __all__ = ['pgpass', 'threading', 'scharp_logging'] name = 'sch...
def isGood(listA, listB, k): n = len(listA) listA.sort() listB.sort(reverse=True) for i in range(n): if listA[i]+listB[i] < k: return False return True T = int(input().strip()) for i in range(T): [n, k] = [int(x) for x in input().strip().split()] listA = [int(x) for x in...
def is_good(listA, listB, k): n = len(listA) listA.sort() listB.sort(reverse=True) for i in range(n): if listA[i] + listB[i] < k: return False return True t = int(input().strip()) for i in range(T): [n, k] = [int(x) for x in input().strip().split()] list_a = [int(x) for x...
#Similar to arrays in JS #Indexed starting in 0 ninjas = ['Ryu', 'Scorpion', 'Ibuki'] my_list = ['4', ['list', 'in', 'a', 'list'], 987] empty_list = [] # In Python, the elements of a list do not have to be of the same data type fruits = ['apple', 'banana', 'orange', 'strawberry'] vegetables = ['lettuce', 'cucumber', '...
ninjas = ['Ryu', 'Scorpion', 'Ibuki'] my_list = ['4', ['list', 'in', 'a', 'list'], 987] empty_list = [] fruits = ['apple', 'banana', 'orange', 'strawberry'] vegetables = ['lettuce', 'cucumber', 'carrots'] fruits_and_vegetables = fruits + vegetables print(fruits_and_vegetables) salad = 3 * vegetables print(salad) drawer...
def missingWords(s, t): s = s.split(" ") t = t.split(" ") n = len(s) m = len(t) p_s = 0 p_t = 0 res = [] while p_t < m: while t[p_t] != s[p_s]: res.append(s[p_s]) p_s += 1 p_t += 1 while p_s < n: res.append(s[p_s]) p_s += 1 ...
def missing_words(s, t): s = s.split(' ') t = t.split(' ') n = len(s) m = len(t) p_s = 0 p_t = 0 res = [] while p_t < m: while t[p_t] != s[p_s]: res.append(s[p_s]) p_s += 1 p_t += 1 while p_s < n: res.append(s[p_s]) p_s += 1 ...
# Created by MechAviv # Quest ID :: 34938 # Not coded yet sm.setSpeakerID(3001500) sm.setSpeakerType(3) sm.removeEscapeButton() sm.flipDialogue() sm.setBoxChat() sm.boxChatPlayerAsSpeaker() sm.setBoxOverrideSpeaker() sm.flipBoxChat() sm.flipBoxChatPlayerAsSpeaker() sm.setColor(1) sm.sendNext("#face5#All right, I'll be...
sm.setSpeakerID(3001500) sm.setSpeakerType(3) sm.removeEscapeButton() sm.flipDialogue() sm.setBoxChat() sm.boxChatPlayerAsSpeaker() sm.setBoxOverrideSpeaker() sm.flipBoxChat() sm.flipBoxChatPlayerAsSpeaker() sm.setColor(1) sm.sendNext("#face5#All right, I'll be the bait. You all defend, okay?") sm.setSpeakerID(3001500)...
"""Given a 2D integer array nums where nums[i] is a non-empty array of distinct positive integers, return the list of integers that are present in each array of nums sorted in ascending order. Example 1: Input: nums = [[3,1,2,4,5],[1,2,3,4],[3,4,5,6]] Output: [3,4] Explanation: The only integers present in...
"""Given a 2D integer array nums where nums[i] is a non-empty array of distinct positive integers, return the list of integers that are present in each array of nums sorted in ascending order. Example 1: Input: nums = [[3,1,2,4,5],[1,2,3,4],[3,4,5,6]] Output: [3,4] Explanation: The only integers present in each of...
def check_extension(installed): def check(document): tr_item = document.find("tr", attrs={ "class": "item" }) td_name = tr_item.find("td", attrs={ "class": "name" }) testing.expect.check("Extension:", td_name.string) td_value = tr_item.find("td", attrs={ "class": "value" }) ...
def check_extension(installed): def check(document): tr_item = document.find('tr', attrs={'class': 'item'}) td_name = tr_item.find('td', attrs={'class': 'name'}) testing.expect.check('Extension:', td_name.string) td_value = tr_item.find('td', attrs={'class': 'value'}) span_n...
h, w, n=map(int, input().split()) n-=1 if n%2==1: ans=(n-1)*w/2 else: n+=1 ans=0 i=1 while i<n: ans+=i i+=2 ans=ans*w/n*2 print(ans)
(h, w, n) = map(int, input().split()) n -= 1 if n % 2 == 1: ans = (n - 1) * w / 2 else: n += 1 ans = 0 i = 1 while i < n: ans += i i += 2 ans = ans * w / n * 2 print(ans)
# One Away # O(n): AAG def OneAway(s1, s2): '''To Check If One String IS One Edit Away From Another Where Edit Can Be: Insert, Remove Or Replace ''' l1,l2 = len(s1),len(s2) if(l1==l2): return( sum([1 for i,j in zip(s1,s2) if i!=j]) <= 1) elif abs(l1-l2)==1: s1,s2 = (s...
def one_away(s1, s2): """To Check If One String IS One Edit Away From Another Where Edit Can Be: Insert, Remove Or Replace """ (l1, l2) = (len(s1), len(s2)) if l1 == l2: return sum([1 for (i, j) in zip(s1, s2) if i != j]) <= 1 elif abs(l1 - l2) == 1: (s1, s2) = (s1, s2) if l1 > l...
"A simple set of tests" def testTrue(): "Thruth-iness test" assert True == 1 def testFalse(): "Fact-brication test" assert False == 0
"""A simple set of tests""" def test_true(): """Thruth-iness test""" assert True == 1 def test_false(): """Fact-brication test""" assert False == 0
class MatrixFactorization(object): def __init__(self, data, K): ''' Arguments: - data : 2 dimensional rating matrix - K : number of latent dimensions ''' self.R = np.matrix(data) self.D = np.zeros( self.R.shape ) self.K = K ...
class Matrixfactorization(object): def __init__(self, data, K): """ Arguments: - data : 2 dimensional rating matrix - K : number of latent dimensions """ self.R = np.matrix(data) self.D = np.zeros(self.R.shape) self.K = K self.b = np....
class Url(object): def __init__(self, url, obj, name=None, namespace=None, namespace_descr=''): self.url = url self.obj = obj self.__name = name self.namespace = namespace self.namespace_descr = namespace_descr @property def name(self): return self.__name ...
class Url(object): def __init__(self, url, obj, name=None, namespace=None, namespace_descr=''): self.url = url self.obj = obj self.__name = name self.namespace = namespace self.namespace_descr = namespace_descr @property def name(self): return self.__name ...
# !/usr/bin/env python3 # Author: C.K # Email: theck17@163.com # DateTime:2021-09-12 11:58:12 # Description: class Solution: def reverseWords(self, s: str) -> str: word = "" words = "" s = s[::-1] for j, i in enumerate(s): if i != " " and word != "" and s[j - 1] == " ": ...
class Solution: def reverse_words(self, s: str) -> str: word = '' words = '' s = s[::-1] for (j, i) in enumerate(s): if i != ' ' and word != '' and (s[j - 1] == ' '): words += word + ' ' word = i elif i != ' ': ...
m, n, l = map(int, input().split()) shooters = list(map(int, input().split())) animals = [] for _ in range(n): x, y = map(int, input().split()) if y <= l: animals.append((x, y)) shooters.sort() animals.sort(key=lambda axis: axis[0]) ans = 0 idx = 0 for i in range(len(animals)): left, right = idx, le...
(m, n, l) = map(int, input().split()) shooters = list(map(int, input().split())) animals = [] for _ in range(n): (x, y) = map(int, input().split()) if y <= l: animals.append((x, y)) shooters.sort() animals.sort(key=lambda axis: axis[0]) ans = 0 idx = 0 for i in range(len(animals)): (left, right) = (...
def nothing(*args, **kwargs): pass def printer(result, description='Profile results', **kwargs): if kwargs: details = ' ' + str(kwargs) else: details = '' print(description+details, ':', result) _DEFAULT_CLB = printer def default(*args, **kwargs): """ Default callback, can be set ...
def nothing(*args, **kwargs): pass def printer(result, description='Profile results', **kwargs): if kwargs: details = ' ' + str(kwargs) else: details = '' print(description + details, ':', result) _default_clb = printer def default(*args, **kwargs): """ Default callback, can be set...
# -*- coding: utf-8 -*- """ @author: xingxingzaixian @create: 2020/9/6 @description: """
""" @author: xingxingzaixian @create: 2020/9/6 @description: """
class Queue(object): 'Queue' def __init__(self, build): self.data = [build] print("Stack :", self.data) def enqueue(self, new): self.data.append(new) print("Stack :", self.data) def dequeue(self): out = self.data.pop(0) print("Stack :", self.data) ...
class Queue(object): """Queue""" def __init__(self, build): self.data = [build] print('Stack :', self.data) def enqueue(self, new): self.data.append(new) print('Stack :', self.data) def dequeue(self): out = self.data.pop(0) print('Stack :', self.data) ...
# # PySNMP MIB module CISCO-SESS-BORDER-CTRLR-STATS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-SESS-BORDER-CTRLR-STATS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:55:14 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using P...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_union, constraints_intersection, value_range_constraint, single_value_constraint) ...
def main(): cases = int(input()) for _ in range(cases): candidates = int(input()) votes = [] for _ in range(candidates): votes.append(int(input())) # if majority is found, print the candidate if (max(votes) > sum(votes) / 2): print(f"majority winn...
def main(): cases = int(input()) for _ in range(cases): candidates = int(input()) votes = [] for _ in range(candidates): votes.append(int(input())) if max(votes) > sum(votes) / 2: print(f'majority winner {votes.index(max(votes)) + 1}') elif votes.c...
def appstr(s, a): """Safe appending strings.""" try: return s + a except: return None
def appstr(s, a): """Safe appending strings.""" try: return s + a except: return None
"""Init file for bimmer_connected.""" #import pkg_resources # part of setuptools #__version__ = pkg_resources.get_distribution("bimmer_connected").version
"""Init file for bimmer_connected."""
""" Test script for business logic. """ def get_state(cell_id): state = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] binary = '{0:09b}'.format(cell_id) index = 0 for char in binary: state[index // 3][index % 3] = int(char) index += 1 return state def get_id(state): cell_id = 0 expon...
""" Test script for business logic. """ def get_state(cell_id): state = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] binary = '{0:09b}'.format(cell_id) index = 0 for char in binary: state[index // 3][index % 3] = int(char) index += 1 return state def get_id(state): cell_id = 0 exponen...
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
_tabversion = '3.8' _lr_method = 'LALR' _lr_signature = 'm%\x1f\x13¨{\x7f±\x0f´\x8fr\x0cc\x8b\x0e' _lr_action_items = {'[': ([9, 10, 16, 17, 19, 20, 22, 26, 28, 29, 31, 37, 71, 72, 77, 78, 79, 80, 81, 83, 84, 85, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 103, 104, 105, 106, 107, 108, 109, 110, 111, 113,...
class Solution: def __init__(self): self.arr = [0] * (3 * int(1e4)) def findDuplicate(self, nums: List[int]) -> int: for i in range (len(nums)): self.arr[nums[i]] = self.arr[nums[i]] + 1 if self.arr[nums[i]] == 2: return nums[i] retur...
class Solution: def __init__(self): self.arr = [0] * (3 * int(10000.0)) def find_duplicate(self, nums: List[int]) -> int: for i in range(len(nums)): self.arr[nums[i]] = self.arr[nums[i]] + 1 if self.arr[nums[i]] == 2: return nums[i] return 0
# Copyright 2019 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 writing, ...
"""Test root module outputs.""" def test_vpc_ranges(plan): """VPC ranges should match input variables.""" ranges = plan.outputs['vpc_subnets'] for subnet in plan.variables['subnets']: assert ranges[subnet['subnet_name']] == subnet['subnet_ip'] def test_project_ids(plan): """Project ids should ...
"""677. Map Sum Pairs https://leetcode.com/problems/map-sum-pairs/ """ class MapSum: def __init__(self): self.store = dict() def insert(self, key: str, val: int) -> None: self.store[key] = val def sum(self, prefix: str) -> int: ret = 0 for k, v in self.store.items(): ...
"""677. Map Sum Pairs https://leetcode.com/problems/map-sum-pairs/ """ class Mapsum: def __init__(self): self.store = dict() def insert(self, key: str, val: int) -> None: self.store[key] = val def sum(self, prefix: str) -> int: ret = 0 for (k, v) in self.store.items(): ...
#!/usr/bin/env python3 #Antonio Karlo Mijares def read_file_string(file_name): # Takes a filename string, returns a string of all lines in the file f = open(file_name, 'r') read = f.read() return read def read_file_list(file_name): # Takes a filename string, returns a list of lines without new-l...
def read_file_string(file_name): f = open(file_name, 'r') read = f.read() return read def read_file_list(file_name): f2 = open(file_name, 'r') f2read = f2.read() linesplit = f2read.splitlines() return linesplit if __name__ == '__main__': file_name = 'data.txt' print(read_file_string...
"""Declare namespace packages.""" try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: __path__ = __import__('pkgutil').extend_path(__path__, __name__)
"""Declare namespace packages.""" try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: __path__ = __import__('pkgutil').extend_path(__path__, __name__)
{ "targets": [ { "target_name": "node-runtime-stats", "sources": [ "lib/nativeStats.cc" ], "include_dirs": [ "<!(node -e \"require('nan')\")" ], } ] }
{'targets': [{'target_name': 'node-runtime-stats', 'sources': ['lib/nativeStats.cc'], 'include_dirs': ['<!(node -e "require(\'nan\')")']}]}
print("Tejaswi") print("AM.EN.U4ECE18038") print("ECE") print("marvel roxx")
print('Tejaswi') print('AM.EN.U4ECE18038') print('ECE') print('marvel roxx')
def get_first_of_type(iterable, type_): # pragma: no cover return next(i for i in iterable if isinstance(i, type_)) def get_values_of_type(iterable, type_): return (i for i in iterable if isinstance(i, type_))
def get_first_of_type(iterable, type_): return next((i for i in iterable if isinstance(i, type_))) def get_values_of_type(iterable, type_): return (i for i in iterable if isinstance(i, type_))
APPLICATION = { "workspaces" : [{"id":1, "name":"WS-1", "dir":"d:/quark/WS-1"}, {"id":2, "name":"WS-2", "dir":"d:/quark/WS-2"}, {"id":3, "name":"WS-3", "dir":"d:/quark/WS-3"}], "user": { "name" : "John Doe", "email" : "john@doe.com" }, "repo_l...
application = {'workspaces': [{'id': 1, 'name': 'WS-1', 'dir': 'd:/quark/WS-1'}, {'id': 2, 'name': 'WS-2', 'dir': 'd:/quark/WS-2'}, {'id': 3, 'name': 'WS-3', 'dir': 'd:/quark/WS-3'}], 'user': {'name': 'John Doe', 'email': 'john@doe.com'}, 'repo_limit': 10, 'tags': ['Data Analytics 101', 'Artificial Intelligence', 'Arct...
secret = "1537" anzahl = 0 anzahlf = 0 raten = "" found = "" #will contain the positions of found numbers, to make sure that one number isn't found twice while not raten == secret: raten = input('Errate die vierstellige Ziffer: ') for i in range(4): if secret[i] == raten[i]: #print( 'Die ' + str(i+1...
secret = '1537' anzahl = 0 anzahlf = 0 raten = '' found = '' while not raten == secret: raten = input('Errate die vierstellige Ziffer: ') for i in range(4): if secret[i] == raten[i]: anzahl = anzahl + 1 if str(i) in found: anzahlf -= 1 found += str(i) ...
class ZigbeeMessage: def __init__(self, message): self.raw = message def get_signal_level(self): if ('linkquality' in self.raw): return int(int(self.raw['linkquality']) * 11 / 255) else: return None def get_battery_level(self): if ('battery' in self....
class Zigbeemessage: def __init__(self, message): self.raw = message def get_signal_level(self): if 'linkquality' in self.raw: return int(int(self.raw['linkquality']) * 11 / 255) else: return None def get_battery_level(self): if 'battery' in self.ra...
#!/usr/bin/python2.4 # Copyright 2010 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
"""Base classes that define services returned by service_factory.""" class Userinfo(object): """User information returned by the UserInfoService. Attributes: name: str user name. primary_email: str email to use for the user. title: str user work title. department: str name of the user's departme...
random_keys = {} random_keys["astring"] = "somestring" random_keys[5] = "aninteger" random_keys[25.2] = "floats work too" random_keys[("abc", 123)] = "so do tuples" class AnObject: def __init__(self, avalue): self.avalue = avalue my_object = AnObject(14) random_keys[my_object] = "We can even store object...
random_keys = {} random_keys['astring'] = 'somestring' random_keys[5] = 'aninteger' random_keys[25.2] = 'floats work too' random_keys['abc', 123] = 'so do tuples' class Anobject: def __init__(self, avalue): self.avalue = avalue my_object = an_object(14) random_keys[my_object] = 'We can even store objects'...
class artist(): name=None date=None area=None type=None gender=None score=None def __init__(self,ar,da,na,ge,ty,sc): self.name=na self.date=da self.area=ar self.type=ty self.gender=ge self.score=sc def __str__(self): return "[{...
class Artist: name = None date = None area = None type = None gender = None score = None def __init__(self, ar, da, na, ge, ty, sc): self.name = na self.date = da self.area = ar self.type = ty self.gender = ge self.score = sc def __str__(...
"""Base class for the "modules" of FavaLedger.""" class FavaModule: """Base class for the "modules" of FavaLedger.""" def __init__(self, ledger): self.ledger = ledger def load_file(self): """Gets called when the file has been (re)loaded."""
"""Base class for the "modules" of FavaLedger.""" class Favamodule: """Base class for the "modules" of FavaLedger.""" def __init__(self, ledger): self.ledger = ledger def load_file(self): """Gets called when the file has been (re)loaded."""
columns = { 'CreatedAt': 'createdAt', 'UpdatedAt': 'updatedAt', '_id': '_id', 'Name': 'name', 'Ref': 'ref', 'RefId': 'refId', 'RefIndustryId': 'refIndustryId', 'State': 'state', 'Ticker': 'ticker', '__v': '__v', 'StatsLastSyncedFilingsAt': 'stats.lastSyncedFilingsAt', 'St...
columns = {'CreatedAt': 'createdAt', 'UpdatedAt': 'updatedAt', '_id': '_id', 'Name': 'name', 'Ref': 'ref', 'RefId': 'refId', 'RefIndustryId': 'refIndustryId', 'State': 'state', 'Ticker': 'ticker', '__v': '__v', 'StatsLastSyncedFilingsAt': 'stats.lastSyncedFilingsAt', 'StatsLastSyncedEarningsAt': 'stats.lastSyncedEarnin...
def main(self): self.data["totalScore"] = 0 self.data["streak"] = 0 self.data["rank"] = 1 def GameResetHandler(): self.data["totalScore"] = 0 self.data["rank"] = 0 self.data["streak"] = 0 self.quiz = None self.on("GameReset",GameResetHandler) def QuestionStartHand...
def main(self): self.data['totalScore'] = 0 self.data['streak'] = 0 self.data['rank'] = 1 def game_reset_handler(): self.data['totalScore'] = 0 self.data['rank'] = 0 self.data['streak'] = 0 self.quiz = None self.on('GameReset', GameResetHandler) def question_sta...
class TestClass: def __init__(self): self.a = "text" self.b = 39 self.c = 42.8 self.d = 0b01100001 self.el = [1, 2, 3, 4] self.fd = {'a': 1, 'b': "text", 'c': 3.5, 'd': 0b01100011} TestDict = { 'a': 1, 'b': "text", 'c': 3.5, 'd': 0b01100011, "el": [1, 2, 3, 4], "fd": {'ia': 1, 'ib': "text", 'ic':...
class Testclass: def __init__(self): self.a = 'text' self.b = 39 self.c = 42.8 self.d = 97 self.el = [1, 2, 3, 4] self.fd = {'a': 1, 'b': 'text', 'c': 3.5, 'd': 99} test_dict = {'a': 1, 'b': 'text', 'c': 3.5, 'd': 99, 'el': [1, 2, 3, 4], 'fd': {'ia': 1, 'ib': 'text',...
# -*- coding: utf-8 -*- """CircBase - circular non-protein coding RNAs. .. seealso: http://www.circbase.org/cgi-bin/downloads.cgi """
"""CircBase - circular non-protein coding RNAs. .. seealso: http://www.circbase.org/cgi-bin/downloads.cgi """
def func01(): print("module01 - func01") def func02(): print("module01 - func02")
def func01(): print('module01 - func01') def func02(): print('module01 - func02')
''' Area() function write a program that inputs base and height of a triangle in main program and passes them to a function called area(b, h). b = base, h = height. The function finds the area of triangle and returns it to main program. The area should be displayed on the screen. Area = 1/2*bas...
""" Area() function write a program that inputs base and height of a triangle in main program and passes them to a function called area(b, h). b = base, h = height. The function finds the area of triangle and returns it to main program. The area should be displayed on the screen. Area = 1/2*bas...
class HashMap: def __init__(self, array_size): self.array_size = array_size self.array = [None for i in range(self.array_size)] def hash(self, key, collisions=0): key_bytes = str(key).encode() hash_code = sum(key_bytes) return hash_code + collisions def compressor(...
class Hashmap: def __init__(self, array_size): self.array_size = array_size self.array = [None for i in range(self.array_size)] def hash(self, key, collisions=0): key_bytes = str(key).encode() hash_code = sum(key_bytes) return hash_code + collisions def compressor(...
def test_get_persons(client): rs = client.get("/person/") assert rs.status_code == 200 all_persons = rs.json assert len(all_persons) > 0 selected_person = all_persons[0] rs = client.get("/person/" + str(selected_person['id'])) assert rs.status_code == 200 person = rs.json assert p...
def test_get_persons(client): rs = client.get('/person/') assert rs.status_code == 200 all_persons = rs.json assert len(all_persons) > 0 selected_person = all_persons[0] rs = client.get('/person/' + str(selected_person['id'])) assert rs.status_code == 200 person = rs.json assert pers...
class Card: def confirmation_card(question, action, confirmation_item, message_to_confirm): confirmation_card = { "cards": [{ "header": { "title": "Iago", "subtitle": "Confirmation !", "imageUrl": "https://iago.aliction.com/avatar.png", "imageStyle...
class Card: def confirmation_card(question, action, confirmation_item, message_to_confirm): confirmation_card = {'cards': [{'header': {'title': 'Iago', 'subtitle': 'Confirmation !', 'imageUrl': 'https://iago.aliction.com/avatar.png', 'imageStyle': 'IMAGE'}, 'sections': [{'widgets': [{'keyValue': {'icon': '...
# number: integer age = 20 # number: float (decimals e.g. 1.23) price = 100.13 #String: can be defined with single or double quotes msg = ' Hello world!' msg2 = "Hello world!" #Hello world with a variable print(msg) #Concatenation (combining strings) firstName = 'albert' lastName = 'einstein' fullName = firstNam...
age = 20 price = 100.13 msg = ' Hello world!' msg2 = 'Hello world!' print(msg) first_name = 'albert' last_name = 'einstein' full_name = firstName + ' ' + lastName print(fullName) print('My name is {0}, I am {1} years old'.format(fullName, age)) my_true = True my_false = False print(myTrue) print(not myFalse) user_age =...
x3d = { 'aliceblue': '0.941 0.973 1.000', 'antiquewhite': '0.980 0.922 0.843', 'aqua': '0.000 1.000 1.000', 'aquamarine': '0.498 1.000 0.831', 'azure': '0.941 1.000 1.000', 'beige': '0.961 0.961 0.863', 'bisque': ...
x3d = {'aliceblue': '0.941 0.973 1.000', 'antiquewhite': '0.980 0.922 0.843', 'aqua': '0.000 1.000 1.000', 'aquamarine': '0.498 1.000 0.831', 'azure': '0.941 1.000 1.000', 'beige': '0.961 0.961 0.863', 'bisque': '1.000 0.894 0.769', 'black': '0.000 0.000 0.000', 'blanchedalmond': '1.000 0.922 0.804', 'blue': '0.000 0.0...
__author__="ijt3cd" if __name__ == '__main__': print("more junk")
__author__ = 'ijt3cd' if __name__ == '__main__': print('more junk')
#-*- coding:utf-8 -*- class ParseException(Exception): pass class ThroughLoop(Exception): pass
class Parseexception(Exception): pass class Throughloop(Exception): pass
class LogManager: def __init__(): pass def getLogger(loggerName): logger = log.setup_custom_logger(loggerName) logger = logging.getLogger('root')
class Logmanager: def __init__(): pass def get_logger(loggerName): logger = log.setup_custom_logger(loggerName) logger = logging.getLogger('root')
# Copyright (c) 2019 Cable Television Laboratories, Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
class Shortestpath: def __init__(self, path_edges): self.neighbors = {} for edge in path_edges: self.add_edge(*edge) def add_edge(self, a, b): if a not in self.neighbors: self.neighbors[a] = [] if b not in self.neighbors[a]: self.neighbors[a]...
# # See ../LICENSE # # This file is used to form a consistent base used by the specific field implementations. # It was intended to, implementation might differ. # # class Record: def __init__(self, henk): self.fields = {} self.origin = 0 #in file location self.raw_length = 0 sel...
class Record: def __init__(self, henk): self.fields = {} self.origin = 0 self.raw_length = 0 self.score = None
''' The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
""" The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
''' https://www.geeksforgeeks.org/calculate-square-of-a-number-without-using-and-pow/ Calculate square of a number without using *, / and pow() Difficulty Level : Medium Last Updated : 23 Feb, 2021 Geek Week Given an integer n, calculate the square of a number without using *, / and pow(). Examples : Input: n = 5 O...
""" https://www.geeksforgeeks.org/calculate-square-of-a-number-without-using-and-pow/ Calculate square of a number without using *, / and pow() Difficulty Level : Medium Last Updated : 23 Feb, 2021 Geek Week Given an integer n, calculate the square of a number without using *, / and pow(). Examples : Input: n = 5 O...
""" Function for evaluate OVAL operators. """ def oval_operator_and(result): """ The AND operator produces a true result if every argument is true. If one or more arguments are false, the result of the AND is false. If one or more of the arguments are unknown, and if none of the argume...
""" Function for evaluate OVAL operators. """ def oval_operator_and(result): """ The AND operator produces a true result if every argument is true. If one or more arguments are false, the result of the AND is false. If one or more of the arguments are unknown, and if none of the argumen...
#!/usr/bin/python """ @file callback_interface.py @author Woong Gyu La a.k.a Chris. <juhgiyo@gmail.com> <http://github.com/juhgiyo/pyserver> @date March 10, 2016 @brief Callback Interfaces @version 0.1 @section LICENSE The MIT License (MIT) Copyright (c) 2016 Woong Gyu La <juhgiyo@gmail.com> Permission is h...
""" @file callback_interface.py @author Woong Gyu La a.k.a Chris. <juhgiyo@gmail.com> <http://github.com/juhgiyo/pyserver> @date March 10, 2016 @brief Callback Interfaces @version 0.1 @section LICENSE The MIT License (MIT) Copyright (c) 2016 Woong Gyu La <juhgiyo@gmail.com> Permission is hereby granted, fre...
if foo(): qu = 1 else: qu = 2 y = qu
if foo(): qu = 1 else: qu = 2 y = qu
# -*- coding: utf-8 -*- # write.text.test.py with open("hello.txt", "w") as file: file.write("hello world") with open("hello.txt", "a") as file: file.write("\ngood bye, world")
with open('hello.txt', 'w') as file: file.write('hello world') with open('hello.txt', 'a') as file: file.write('\ngood bye, world')
###################################################### ## Global settings class Config: AMQP_HOST = 'localhost'
class Config: amqp_host = 'localhost'
expected_output = { 'vrf': { 'default': { 'address': { '10.4.1.1': { 'type': 'server'} } }, 'management': { 'address': { '10.4.1.1': { 'type': 'server'} } } }...
expected_output = {'vrf': {'default': {'address': {'10.4.1.1': {'type': 'server'}}}, 'management': {'address': {'10.4.1.1': {'type': 'server'}}}}}
def makeAnagram(a, b): countA = [0] * 26 countB = [0] * 26 index = 0 while index<len(a): countA[ord(a[index]) - 97]+=1 index+=1 index = 0 while index<len(b): countB[ord(b[index]) - 97]+=1 index+=1 res = 0 for i in range(len(countA)): res += abs(countA[i] - countB[i]) return res if __name__ == ...
def make_anagram(a, b): count_a = [0] * 26 count_b = [0] * 26 index = 0 while index < len(a): countA[ord(a[index]) - 97] += 1 index += 1 index = 0 while index < len(b): countB[ord(b[index]) - 97] += 1 index += 1 res = 0 for i in range(len(countA)): ...
""" constant """ # coding: UTF-8 NONE_STR = "---" REGRESSION_MODELS = { # https://pycaret.readthedocs.io/en/latest/api/regression.html#pycaret.regression.create_model "Linear Regression": "lr", "Lasso Regression": "lasso", "Ridge Regression": "ridge", "Elastic Net": "en", "Least Angle...
""" constant """ none_str = '---' regression_models = {'Linear Regression': 'lr', 'Lasso Regression': 'lasso', 'Ridge Regression': 'ridge', 'Elastic Net': 'en', 'Least Angle Regression': 'lar', 'Lasso Least Angle Regression': 'llar', 'Orthogonal Matching Pursuit': 'omp', 'Bayesian Ridge': 'br', 'Automatic Relevance Det...
''' Spiral Matrix Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example, Given the following matrix: [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] [ [ 1, 2, 3 , 4], [ 5, 6, 7, 8], [ 9, 10, 11, 12], [13, 14, 15, 16] ] You should return [1,2,3,6,9,8,7...
""" Spiral Matrix Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example, Given the following matrix: [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] [ [ 1, 2, 3 , 4], [ 5, 6, 7, 8], [ 9, 10, 11, 12], [13, 14, 15, 16] ] You should return [1,2,3,6,9,8,7...
# 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 maxPathSum(self, root: TreeNode) -> int: self.ans = float(-inf) def search(root): ...
class Solution: def max_path_sum(self, root: TreeNode) -> int: self.ans = float(-inf) def search(root): if root is None: return 0 left_max = search(root.left) right_max = search(root.right) self.ans = max(max(leftMax, 0) + max(rightMa...
var1 = 2 var2 = '''hello this is raj i am dying''' for num in range(0,3): file = open(f"orders/file{num}.txt",'w') file.write(f"hello x{num}"+'\n'+str(var1)+'\n'+var2) file.close
var1 = 2 var2 = 'hello\nthis is raj\ni am dying' for num in range(0, 3): file = open(f'orders/file{num}.txt', 'w') file.write(f'hello x{num}' + '\n' + str(var1) + '\n' + var2) file.close
class FlockMessage: __slots__ = ("type", "body") # Acceptable types for a shepherd/sheep to send or sheep/shepherd to # receive. shepherd_types = ("bloot", "identify", "request") sheep_types = ("bleet", "environment", "distress", "result") def __init__(self, type, body): self.type = ty...
class Flockmessage: __slots__ = ('type', 'body') shepherd_types = ('bloot', 'identify', 'request') sheep_types = ('bleet', 'environment', 'distress', 'result') def __init__(self, type, body): self.type = type self.body = body def __str__(self): return 'FlockMessage(type = "...
# link : https://www.codewars.com/kata/5390bac347d09b7da40006f6 def to_jaden_case(string): new_string = '' last_c = ' ' for c in string: new_string += c.upper() if last_c == ' ' else c last_c = c return new_string print(to_jaden_case("how can mirrors be real if our eyes aren't...
def to_jaden_case(string): new_string = '' last_c = ' ' for c in string: new_string += c.upper() if last_c == ' ' else c last_c = c return new_string print(to_jaden_case("how can mirrors be real if our eyes aren't real"))
#stripe patterns to follow #ideal 400x400 pattern_one = [2,1,2,1,4,2,2,1,4,2,4,2,1,2,1,4,2,4,2,2,4,2,4,2,4,3,4,2,4,2,1,4,3,2] pattern_one_width=[4,2,4,2,10,4,4,2,10,4,10,4,2,4,2,10,4,10,4,4,10,4,10,4,10,5,10,4,10,4,2,10,5,2] pattern_two_width = [30, 30, 30, 30, 30] #5x30 + 2x30black #originalstyle
pattern_one = [2, 1, 2, 1, 4, 2, 2, 1, 4, 2, 4, 2, 1, 2, 1, 4, 2, 4, 2, 2, 4, 2, 4, 2, 4, 3, 4, 2, 4, 2, 1, 4, 3, 2] pattern_one_width = [4, 2, 4, 2, 10, 4, 4, 2, 10, 4, 10, 4, 2, 4, 2, 10, 4, 10, 4, 4, 10, 4, 10, 4, 10, 5, 10, 4, 10, 4, 2, 10, 5, 2] pattern_two_width = [30, 30, 30, 30, 30]
''' from sys import * q = int(stdin.readline()) while q: q = q - 1 n = int(stdin.readline()) a = list(map(int, stdin.readline().split())) Hash = [0] * (n+1) for i in a: Hash[i] += 1 Hash.sort(reverse=True) res = 0 now = int(1e9) for i in Hash: now = max(min(now-1, i),...
""" from sys import * q = int(stdin.readline()) while q: q = q - 1 n = int(stdin.readline()) a = list(map(int, stdin.readline().split())) Hash = [0] * (n+1) for i in a: Hash[i] += 1 Hash.sort(reverse=True) res = 0 now = int(1e9) for i in Hash: now = max(min(now-1, i),...
def dtlayout(i, p, *rows): i["Layouts/SiStrip Layouts/" + p] = DQMItem(layout=rows) dtlayout(dqmitems, "SiStrip_Digi_Summary", ["SiStrip/MechanicalView/TIB/Summary_NumberOfDigis_in_TIB"], ["SiStrip/MechanicalView/TOB/Summary_NumberOfDigis_in_TOB"], ["SiStrip/MechanicalView/TID/MINUS/Summary_NumberOfDigis_in_MINU...
def dtlayout(i, p, *rows): i['Layouts/SiStrip Layouts/' + p] = dqm_item(layout=rows) dtlayout(dqmitems, 'SiStrip_Digi_Summary', ['SiStrip/MechanicalView/TIB/Summary_NumberOfDigis_in_TIB'], ['SiStrip/MechanicalView/TOB/Summary_NumberOfDigis_in_TOB'], ['SiStrip/MechanicalView/TID/MINUS/Summary_NumberOfDigis_in_MINUS'...
""" Windows 2000 - List of Locale IDs and Language Groups Original data table: http://www.microsoft.com/globaldev/reference/win2k/setup/lcid.mspx """ LANGUAGE_ID = { 0x0436: u"Afrikaans", 0x041c: u"Albanian", 0x0401: u"Arabic Saudi Arabia", 0x0801: u"Arabic Iraq", 0x0c01: u"Arabic Egypt", 0x10...
""" Windows 2000 - List of Locale IDs and Language Groups Original data table: http://www.microsoft.com/globaldev/reference/win2k/setup/lcid.mspx """ language_id = {1078: u'Afrikaans', 1052: u'Albanian', 1025: u'Arabic Saudi Arabia', 2049: u'Arabic Iraq', 3073: u'Arabic Egypt', 4097: u'Arabic Libya', 5121: u'Arabic Al...
def make_bezier(xys): # xys should be a sequence of 2-tuples (Bezier control points) n = len(xys) combinations = pascal_row(n-1) def bezier(ts): # This uses the generalized formula for bezier curves # http://en.wikipedia.org/wiki/B%C3%A9zier_curve#Generalization result = [] ...
def make_bezier(xys): n = len(xys) combinations = pascal_row(n - 1) def bezier(ts): result = [] for t in ts: tpowers = (t ** i for i in range(n)) upowers = reversed([(1 - t) ** i for i in range(n)]) coefs = [c * a * b for (c, a, b) in zip(combinations, tp...
power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate...
power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate Leakage': 0.00662954, 'Peak Dynamic': 0.0, 'Runtime Dynamic': 0.0, 'Subthres...
# -*- coding: utf-8 -*- """ Created on Mon May 18 12:22:28 2020 @author: aantao """ ##0,1,1,2,3,5,8 ##n = n-1 + n-2 def fibo_range(n = 10): fibo_list = [0,1] for i in range(2,n): fibo_list.append(fibo_list[i-1]+fibo_list[i-2]) return(fibo_list,fibo_list[n-1]) #Why n-1 and not n in fi...
""" Created on Mon May 18 12:22:28 2020 @author: aantao """ def fibo_range(n=10): fibo_list = [0, 1] for i in range(2, n): fibo_list.append(fibo_list[i - 1] + fibo_list[i - 2]) return (fibo_list, fibo_list[n - 1])
STATS = [ { "num_node_expansions": 159, "plan_cost": 66, "plan_length": 66, "search_time": 0.89, "total_time": 2.1 }, { "num_node_expansions": 219, "plan_cost": 67, "plan_length": 67, "search_time": 1.47, "total_time": 2.1 }...
stats = [{'num_node_expansions': 159, 'plan_cost': 66, 'plan_length': 66, 'search_time': 0.89, 'total_time': 2.1}, {'num_node_expansions': 219, 'plan_cost': 67, 'plan_length': 67, 'search_time': 1.47, 'total_time': 2.1}, {'num_node_expansions': 1950, 'plan_cost': 52, 'plan_length': 52, 'search_time': 2.28, 'total_time'...
# Amazon interiew Question def pascal_triangle(M): a =[[] for i in range(M)] for i in range(M): for j in range(i+1): if(j<i): if(j==0): a[i].append(1) else: a[i].append(a[i-1][j] + a[i-1][j-1]) ...
def pascal_triangle(M): a = [[] for i in range(M)] for i in range(M): for j in range(i + 1): if j < i: if j == 0: a[i].append(1) else: a[i].append(a[i - 1][j] + a[i - 1][j - 1]) elif j == i: a...
# https://leetcode.com/problems/add-two-numbers/ # Related Topics: Linked List, Math # Difficulty: Easy # Initial thoughts: # Creating a new linked list, we need to loop over the given # linked lists, adding their values and moving any remaining # carry to the next digit. # Keep in mind that some carry may remain ...
class Listnode: def __init__(self, x): self.val = x self.next = None class Solution: def add_two_numbers(self, l1: ListNode, l2: ListNode) -> ListNode: head = list_node(None) curr = head carry = 0 while l1 or l2: if l1: carry += l1.v...
for _ in range(int(input())): n,k = list(map(int,input().split())) ans = float('inf') for i in range(int(n**0.5+1),0,-1): if n%i==0 and i<=k: if n/i<=k : ans=min(ans,i) elif i<=k : ans=min(ans,n//i) print(ans)
for _ in range(int(input())): (n, k) = list(map(int, input().split())) ans = float('inf') for i in range(int(n ** 0.5 + 1), 0, -1): if n % i == 0 and i <= k: if n / i <= k: ans = min(ans, i) elif i <= k: ans = min(ans, n // i) print(ans)
a = float(input()) b = float(input()) plus = a + b minus = a - b multiple = a * b divide = a / b print(a, "+", b, "=", plus) print(a, "-", b, "=", minus) print(a, "*", b, "=", multiple) print(a, "/", b, "=", divide)
a = float(input()) b = float(input()) plus = a + b minus = a - b multiple = a * b divide = a / b print(a, '+', b, '=', plus) print(a, '-', b, '=', minus) print(a, '*', b, '=', multiple) print(a, '/', b, '=', divide)
temp_less_than_40 = ['Make sure to button up!', 'It\'s a bit cold out, don\'t forget your gloves!', 'Layers, layers, layers!' ] temp_above_40 = ['Enjoy your day!', ' ', 'Remember to smile :)', ...
temp_less_than_40 = ['Make sure to button up!', "It's a bit cold out, don't forget your gloves!", 'Layers, layers, layers!'] temp_above_40 = ['Enjoy your day!', ' ', 'Remember to smile :)', 'Be the change you wish to see.', 'You can do anything. Any Thing.']
def getParent(i): if parent[i] != i: parent[i] = getParent(parent[i]) return parent[i] N,M,D = map(int,input().split()) Edges = sorted([tuple(list(map(int,input().split()))+[1 if _ < N-1 else 0]) for _ in range(M)],key=lambda k:k[2]) #do kruskal MST = set() parent = [a for a in range(N+1)] rank = [1 for b in ra...
def get_parent(i): if parent[i] != i: parent[i] = get_parent(parent[i]) return parent[i] (n, m, d) = map(int, input().split()) edges = sorted([tuple(list(map(int, input().split())) + [1 if _ < N - 1 else 0]) for _ in range(M)], key=lambda k: k[2]) mst = set() parent = [a for a in range(N + 1)] rank = [1...
# To find the all the prime numbers between ( n and m ) n = int(input()) m = int(input()) for i in range(n, m+1): isPrime=1; for i in range(2, m/2): if i%j == 0: isPrime==0 if(isPrime == 1): print(i, "is a prime number.")
n = int(input()) m = int(input()) for i in range(n, m + 1): is_prime = 1 for i in range(2, m / 2): if i % j == 0: isPrime == 0 if isPrime == 1: print(i, 'is a prime number.')
def split_me(input_string): input_string = input_string.strip(" ") i = 0 split_me_list = [] while i < len(input_string): if input_string[i] != " ": word_start = i while i < len(input_string) and input_string[i] != " ": i += 1 split_me_list.appe...
def split_me(input_string): input_string = input_string.strip(' ') i = 0 split_me_list = [] while i < len(input_string): if input_string[i] != ' ': word_start = i while i < len(input_string) and input_string[i] != ' ': i += 1 split_me_list.appe...
""" recursive result TC: O(n) --->n in no of nodes in tree SC: O(h) --->h is height of tree """ class Node: def __init__(self, key): self.data = key self.left = None self.right = None def print_nodes_at_k_dist(root, k): if not root: return if k == 0: print(f"{roo...
""" recursive result TC: O(n) --->n in no of nodes in tree SC: O(h) --->h is height of tree """ class Node: def __init__(self, key): self.data = key self.left = None self.right = None def print_nodes_at_k_dist(root, k): if not root: return if k == 0: print(f'{root...
class NumericInterval(object): def __init__(self, size=1, offset=0): self.size = size self.offset = offset def __eq__(self, other): return all([isinstance(other, NumericInterval), self.size == other.size, self.offset == other.offset]) def __h...
class Numericinterval(object): def __init__(self, size=1, offset=0): self.size = size self.offset = offset def __eq__(self, other): return all([isinstance(other, NumericInterval), self.size == other.size, self.offset == other.offset]) def __hash__(self): return hash('Numer...
# Copyright 2021 Edoardo Riggio # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
class Heap: """ Class for the Binary Heap data structure. It contains data and metadata, as well as functions, of the data structure. """ heap: list def __init__(self): self.heap = [] def parent(self, element): """Calculate the parent of the given element. Args: ...
""" 4. Median of Two Sorted Arrays Hard There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). You may assume nums1 and nums2 cannot be both empty. Example 1: nums1 = [1, 3] nums2 = [2] The median ...
""" 4. Median of Two Sorted Arrays Hard There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). You may assume nums1 and nums2 cannot be both empty. Example 1: nums1 = [1, 3] nums2 = [2] The median ...
OAUTH2_SERVER_URL = 'http://localhost:8000/oauth2' OAUTH2_CLIENT_ID = 'Qv6vn7hxGGNyGuLxOU7DHtvPAykevYe1fKwy0eEP' OAUTH2_CLIENT_SECRET = '51SAwsXvhxjMTRUufxQdobMnqs2PrcmK4AEyajWTPfr2LCDt9ML7zeOWPirAhC5rvQW9hKfsjNPoraLV9meCHyLGomvM4H0y7eMXVS2eNFH1H3kJFekePBbbRBUFEsLt' REDIRECT_URL = 'http://localhost:8000/consumer/'
oauth2_server_url = 'http://localhost:8000/oauth2' oauth2_client_id = 'Qv6vn7hxGGNyGuLxOU7DHtvPAykevYe1fKwy0eEP' oauth2_client_secret = '51SAwsXvhxjMTRUufxQdobMnqs2PrcmK4AEyajWTPfr2LCDt9ML7zeOWPirAhC5rvQW9hKfsjNPoraLV9meCHyLGomvM4H0y7eMXVS2eNFH1H3kJFekePBbbRBUFEsLt' redirect_url = 'http://localhost:8000/consumer/'
def for_list(): for i in [0, 1, 2, 3]: print(i) for i in range(4): print(i) #for_list() def seq(n): x = [0 for i in range(n+1)] x[0] = 11.0/2.0 x[1] = 61.0/11.0 for i in range(2,n+1): x[i] = 111 - ( 1130 - 3000/x[i-2])/x[i-1] print(x) #seq(100) def matrix_add(A, B, n, m): ApB = [ [ 0 for...
def for_list(): for i in [0, 1, 2, 3]: print(i) for i in range(4): print(i) def seq(n): x = [0 for i in range(n + 1)] x[0] = 11.0 / 2.0 x[1] = 61.0 / 11.0 for i in range(2, n + 1): x[i] = 111 - (1130 - 3000 / x[i - 2]) / x[i - 1] print(x) def matrix_add(A, B, n, m):...
digits = 3 i = 0 for x in range(10 ** digits): for y in range(10 ** digits): p = str(x * y) if p == p[::-1] and int(p) > i: i = int(p) print(i)
digits = 3 i = 0 for x in range(10 ** digits): for y in range(10 ** digits): p = str(x * y) if p == p[::-1] and int(p) > i: i = int(p) print(i)
''' For two strings to be permutations of each other, they must contain the same: - characters characters include all possible characters in Unicode char set (whitespace etc) - number of characters Constraints: - case senstivity matters As...
""" For two strings to be permutations of each other, they must contain the same: - characters characters include all possible characters in Unicode char set (whitespace etc) - number of characters Constraints: - case senstivity matters As...
lines = { "what is that":"It's fabric from the uniform of an Army officer of Guilder.", "who's guilder":"The country across the sea. The sworn enemy of Florin.", "what's your plot":"Once the horse reaches the castle, the fabric will make the Prince suspect the Guilderians have abducted his love. When he finds her bo...
lines = {'what is that': "It's fabric from the uniform of an Army officer of Guilder.", "who's guilder": 'The country across the sea. The sworn enemy of Florin.', "what's your plot": 'Once the horse reaches the castle, the fabric will make the Prince suspect the Guilderians have abducted his love. When he finds her bod...
__author__ = "Sailik Sengupta" class MTD_Game(object): def __init__(self): self.S = [0, 1, 2, 3] self.A = [ # Row player (Attacker) actions corresponding to each state [ ['success'], #exploit success ['no-op', 'exp-ipfire'], #Attacker outside n/w ...
__author__ = 'Sailik Sengupta' class Mtd_Game(object): def __init__(self): self.S = [0, 1, 2, 3] self.A = [[['success'], ['no-op', 'exp-ipfire'], ['no-op', 'exp-win12', 'exp-win7', 'exp-ftp', 'exp-dns'], ['no-op', 'exp-ftp']], [['lost'], ['no-mon', 'mon-ipfire'], ['no-mon', 'mon-win12', 'mon-win7'...
CREATES = [('YV8R5Z', {'id': 'YV8R5Zxj9Pe7Ud74zNHL8k3YHDGgDSVpMMK9utj5BMqFpuX8kAe7M5kW93trT6cB'}, '1001a831-ce4e-56c7-954b-43d740ea56f4'), ('ZwfQge7', {'id': 'ZwfQge7KcmwuEqV8v58p2nmESZKHdv6aB7SYL4F4ABUQWt9QfaaRfxjGc43pR4n4'}, '1001a032-691f-5158-bf4e-3e95eddcdd67') ] REPLACES = [('YV8R5Z', {'id': 'YV8R5Zxj9Pe7Ud74zNH...
creates = [('YV8R5Z', {'id': 'YV8R5Zxj9Pe7Ud74zNHL8k3YHDGgDSVpMMK9utj5BMqFpuX8kAe7M5kW93trT6cB'}, '1001a831-ce4e-56c7-954b-43d740ea56f4'), ('ZwfQge7', {'id': 'ZwfQge7KcmwuEqV8v58p2nmESZKHdv6aB7SYL4F4ABUQWt9QfaaRfxjGc43pR4n4'}, '1001a032-691f-5158-bf4e-3e95eddcdd67')] replaces = [('YV8R5Z', {'id': 'YV8R5Zxj9Pe7Ud74zNHL8...
def double_char(s): new_list = "" for i in s: new_list += i + i return new_list str_double = input('enter the string - ') print(double_char(str_double))
def double_char(s): new_list = '' for i in s: new_list += i + i return new_list str_double = input('enter the string - ') print(double_char(str_double))
skiff = None def setSkiff(s): global skiff skiff = s class SkiffDomainRecord(object): """SkiffDomainRecord""" def __init__(self, domain, options=None, **kwargs): super(SkiffDomainRecord, self).__init__() if not options: options = kwargs self.__dict__.update(optio...
skiff = None def set_skiff(s): global skiff skiff = s class Skiffdomainrecord(object): """SkiffDomainRecord""" def __init__(self, domain, options=None, **kwargs): super(SkiffDomainRecord, self).__init__() if not options: options = kwargs self.__dict__.update(option...
nums = [int(x) for x in input().split()[1:]] prev = 0 total_time = 0 for i in range(len(nums)): diff = nums[i]-prev if diff >0: total_time += diff * 6 else: total_time -= diff * 4 prev = nums[i] total_time += len(nums)*5 print(total_time)
nums = [int(x) for x in input().split()[1:]] prev = 0 total_time = 0 for i in range(len(nums)): diff = nums[i] - prev if diff > 0: total_time += diff * 6 else: total_time -= diff * 4 prev = nums[i] total_time += len(nums) * 5 print(total_time)
class Some: def __init__(self): self.__x = 0 self.__y = 0 @property def x(self): return self.__x @property def y(self): return self.__y @x.setter def x(self, value): self.__x = value @x.getter def x(self): return self.__x + 2
class Some: def __init__(self): self.__x = 0 self.__y = 0 @property def x(self): return self.__x @property def y(self): return self.__y @x.setter def x(self, value): self.__x = value @x.getter def x(self): return self.__x + 2