content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
#!/usr/bin/env python3 names = ['Alice', 'Bob', 'John'] for name in names: print(name)
names = ['Alice', 'Bob', 'John'] for name in names: print(name)
''' Exception classes for cr-vision library ''' # Definitive guide to Python exceptions https://julien.danjou.info/python-exceptions-guide/ class CRVError(Exception): '''Base exception class''' class InvalidNumDimensionsError(CRVError): '''Invalid number of dimensions error''' class InvalidNumChannelsErro...
""" Exception classes for cr-vision library """ class Crverror(Exception): """Base exception class""" class Invalidnumdimensionserror(CRVError): """Invalid number of dimensions error""" class Invalidnumchannelserror(CRVError): """ Invalid number of channels error""" def __init__(self, expected_chann...
# pylint: disable=too-many-instance-attributes # number of attributes is reasonable in this case class Skills: def __init__(self): self.acrobatics = Skill() self.animal_handling = Skill() self.arcana = Skill() self.athletics = Skill() self.deception = Skill() self.h...
class Skills: def __init__(self): self.acrobatics = skill() self.animal_handling = skill() self.arcana = skill() self.athletics = skill() self.deception = skill() self.history = skill() self.insight = skill() self.intimidation = skill() self.i...
class TestResult: def __init__(self, test_case) -> None: self.__test_case = test_case self.__failed = False self.__reason = None def record_failure(self, reason: str): self.__reason = reason self.__failed = True def test_case(self) -> str: return type(self._...
class Testresult: def __init__(self, test_case) -> None: self.__test_case = test_case self.__failed = False self.__reason = None def record_failure(self, reason: str): self.__reason = reason self.__failed = True def test_case(self) -> str: return type(self....
# -*- coding: utf-8 -*- def get_tokens(line): """tokenize a line""" return line.split() def read_metro_map_file(filename): """read ressources from a metro map input file""" sections = ('[Vertices]', '[Edges]') vertices = dict(); edges = list(); line_number = 0 section = None wit...
def get_tokens(line): """tokenize a line""" return line.split() def read_metro_map_file(filename): """read ressources from a metro map input file""" sections = ('[Vertices]', '[Edges]') vertices = dict() edges = list() line_number = 0 section = None with open(filename, 'r') as input...
#!/usr/bin/python #-*-coding:utf-8-*- '''This packge contains the UCT algorithem of the UAV searching. The algorithem conform to the standard OperateInterface defined in the PlatForm class.''' __all__ = ['UCTControl', 'UCTSearchTree', 'UCTTreeNode']
"""This packge contains the UCT algorithem of the UAV searching. The algorithem conform to the standard OperateInterface defined in the PlatForm class.""" __all__ = ['UCTControl', 'UCTSearchTree', 'UCTTreeNode']
# --- Starting python tests --- #Funct def functione(x,y): return x*y # call print(format(functione(2,3)))
def functione(x, y): return x * y print(format(functione(2, 3)))
# # CLASS MEHTODS # class Employee: # company ="camel" # salary = 100 # location = "mumbai" # def ChangeSalary(self, sal): # self.__class__.salary = sal # # THE EASY METHOD FOR THE ABOVE STATEMENT AND FOR THE CLASS ATTRIBUTE IS # @classmethod # def ChangeSalary(cls, sal): # ...
class Employee: company = 'Bharat Gas' salary = 4500 salary_bonus = 500 @property def total_salary(self): return self.salary + self.salaryBonus @totalSalary.setter def total_salary(self, val): self.salaryBonus = val - self.salary e = employee() print(e.totalSalary) e.totalS...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def bubble_sort(arr): for n in range(len(arr)-1, 0, -1): for k in range(n): if r[k] > r[k+1]: tmp = r[k] r[k] = r[k+1] r[k+1] = tmp if __name__ == '__main__': r = [5, 4, 2, 3, 1] bubble_sor...
def bubble_sort(arr): for n in range(len(arr) - 1, 0, -1): for k in range(n): if r[k] > r[k + 1]: tmp = r[k] r[k] = r[k + 1] r[k + 1] = tmp if __name__ == '__main__': r = [5, 4, 2, 3, 1] bubble_sort(r) print(r)
# Let's say you have a dictionary matchinhg your friends' names # with their favorite flowers: fav_flowers = {'Alex': 'field flowers', 'Kate': 'daffodil', 'Eva': 'artichoke flower', 'Daniel': 'tulip'} # Your new friend Alice likes orchid the most: add this info to the # fav_flowers dict and print the di...
fav_flowers = {'Alex': 'field flowers', 'Kate': 'daffodil', 'Eva': 'artichoke flower', 'Daniel': 'tulip'} fav_flowers['Alice'] = 'orchid' print(fav_flowers)
num1 = float(input("Enter 1st number: ")) op = input("Enter operator: ") num2 = float(input("Enter 2nd number: ")) if op == "+": val = num1 + num2 elif op == "-": val = num1 - num2 elif op == "*" or op == "x": val = num1 * num2 elif op == "/": val = num1 / num2 print(val)
num1 = float(input('Enter 1st number: ')) op = input('Enter operator: ') num2 = float(input('Enter 2nd number: ')) if op == '+': val = num1 + num2 elif op == '-': val = num1 - num2 elif op == '*' or op == 'x': val = num1 * num2 elif op == '/': val = num1 / num2 print(val)
def count_substring(string, sub_string): times = 0 length = len(sub_string) for letter in range(0, len(string)): if string[letter:letter+length] == sub_string: times += 1 return times
def count_substring(string, sub_string): times = 0 length = len(sub_string) for letter in range(0, len(string)): if string[letter:letter + length] == sub_string: times += 1 return times
#!/usr/bin/pthon3 # Time complexity: O(N) def solution(A): count = {} size_A = len(A) leader = None for i, a in enumerate(A): count[a] = count.get(a, 0) + 1 if count[a] > size_A // 2: leader = a equi_leader = 0 before = 0 for i in range(size_A)...
def solution(A): count = {} size_a = len(A) leader = None for (i, a) in enumerate(A): count[a] = count.get(a, 0) + 1 if count[a] > size_A // 2: leader = a equi_leader = 0 before = 0 for i in range(size_A): if A[i] == leader: before += 1 ...
class Solution: def isHappy(self, n): """ :type n: int :rtype: bool """ tried = set() while n not in tried and n != 1: tried.add(n) n2 = 0 while n > 0: n2, n = n2 + (n % 10) ** 2, n // 10 n = n2 r...
class Solution: def is_happy(self, n): """ :type n: int :rtype: bool """ tried = set() while n not in tried and n != 1: tried.add(n) n2 = 0 while n > 0: (n2, n) = (n2 + (n % 10) ** 2, n // 10) n = n2 ...
n1 = int(input('digite um valor >>')) n2 = int(input('digite outro vaor >>')) n3 = int(input('digite outro valor >>')) #menor menor = n1 if n2 < n1 and n2 < n3: menor = n2 if n3 < n1 and n3 < n2: menor = n3 #maior maior = n1 if n2 > n1 and n2 > n3: maior = n2 if n3 > n1 and n3 > n2: maior = n3 print('o ...
n1 = int(input('digite um valor >>')) n2 = int(input('digite outro vaor >>')) n3 = int(input('digite outro valor >>')) menor = n1 if n2 < n1 and n2 < n3: menor = n2 if n3 < n1 and n3 < n2: menor = n3 maior = n1 if n2 > n1 and n2 > n3: maior = n2 if n3 > n1 and n3 > n2: maior = n3 print('o maior numero e...
def fahrenheit_to_celsius(deg_F): """Convert degrees Fahrenheit to Celsius.""" return (5 / 9) * (deg_F - 32) def celsius_to_fahrenheit(deg_C): """Convert degrees Celsius to Fahrenheit.""" return (9 / 5) * deg_C + 32 def celsius_to_kelvin(deg_C): """Convert degree Celsius to Kelvin.""" return...
def fahrenheit_to_celsius(deg_F): """Convert degrees Fahrenheit to Celsius.""" return 5 / 9 * (deg_F - 32) def celsius_to_fahrenheit(deg_C): """Convert degrees Celsius to Fahrenheit.""" return 9 / 5 * deg_C + 32 def celsius_to_kelvin(deg_C): """Convert degree Celsius to Kelvin.""" return deg_C...
class TypeFactory(object): def __init__(self, client): self.client = client def create(self, transport_type, *args, **kwargs): klass = self.classes[transport_type] cls = klass(*args, **kwargs) cls._client = self.client return cls
class Typefactory(object): def __init__(self, client): self.client = client def create(self, transport_type, *args, **kwargs): klass = self.classes[transport_type] cls = klass(*args, **kwargs) cls._client = self.client return cls
# Copyright 2020-present Kensho Technologies, LLC. """Tools for constructing high-performance query interpreters over arbitrary schemas. While GraphQL compiler's database querying capabilities are sufficient for many use cases, there are many types of data querying for which the compilation-based approach is unsuitabl...
"""Tools for constructing high-performance query interpreters over arbitrary schemas. While GraphQL compiler's database querying capabilities are sufficient for many use cases, there are many types of data querying for which the compilation-based approach is unsuitable. A few examples: - data accessible via a simple A...
length = float(input("Enter the length of a side of the cube: ")) total_surface_area = 6 * length ** 2 volume = 3 * length ** 2 print("The surface area of the cube is", total_surface_area) print("The volume of the cube is", volume) close = input("Press X to exit") # The above code keeps the program op...
length = float(input('Enter the length of a side of the cube: ')) total_surface_area = 6 * length ** 2 volume = 3 * length ** 2 print('The surface area of the cube is', total_surface_area) print('The volume of the cube is', volume) close = input('Press X to exit')
#========================================================================================= class Task(): """Task is a part of Itinerary """ def __init__(self, aName, aDuration, aMachine): self.name = aName self.duration = aDuration self.machine = aMachine self.taskChanged = Fals...
class Task: """Task is a part of Itinerary """ def __init__(self, aName, aDuration, aMachine): self.name = aName self.duration = aDuration self.machine = aMachine self.taskChanged = False def export_to_dict(self): """Serialize information about Task into dictionary"...
""" lec 4, tuple and dictionary """ my_tuple='a','b','c','d','e' print(my_tuple) my_2nd_tuple=('a','b','c','d','e') print(my_2nd_tuple) test='a' print(type(test)) #not a tuple bc no comma Test='a', print(type(Test)) print(my_tuple[1]) print(my_tuple[-1]) print(my_tuple[1:3]) print(my_tuple[1:]) print(my_tuple[:3]) ...
""" lec 4, tuple and dictionary """ my_tuple = ('a', 'b', 'c', 'd', 'e') print(my_tuple) my_2nd_tuple = ('a', 'b', 'c', 'd', 'e') print(my_2nd_tuple) test = 'a' print(type(test)) test = ('a',) print(type(Test)) print(my_tuple[1]) print(my_tuple[-1]) print(my_tuple[1:3]) print(my_tuple[1:]) print(my_tuple[:3]) my_car = ...
def generate(): class Spam: count = 1 def method(self): print(count) return Spam() generate().method()
def generate(): class Spam: count = 1 def method(self): print(count) return spam() generate().method()
def add(a, b): """Adds a and b.""" return a + b if __name__ == '__main__': assert add(2, 5) == 7, '2 and 5 are not 7' assert add(-2, 5) == 3, '-2 and 5 are not 3' print('This executes only if I am main!')
def add(a, b): """Adds a and b.""" return a + b if __name__ == '__main__': assert add(2, 5) == 7, '2 and 5 are not 7' assert add(-2, 5) == 3, '-2 and 5 are not 3' print('This executes only if I am main!')
# Title : Generators in python # Author : Kiran raj R. # Date : 31:10:2020 def printNum(): num = 0 while True: yield num num += 1 result = printNum() print(next(result)) print(next(result)) print(next(result)) result = (num for num in range(10000)) print(result) print(next(result)) print(...
def print_num(): num = 0 while True: yield num num += 1 result = print_num() print(next(result)) print(next(result)) print(next(result)) result = (num for num in range(10000)) print(result) print(next(result)) print(next(result)) print(next(result))
""" Given a non-negative integer numRows, generate the first numRows of Pascal's triangle. """ class Solution(object): def generate(self, numRows): """ :type numRows: int :rtype: List[List[int]] """ if numRows==0: return [] if numRows==1: retu...
""" Given a non-negative integer numRows, generate the first numRows of Pascal's triangle. """ class Solution(object): def generate(self, numRows): """ :type numRows: int :rtype: List[List[int]] """ if numRows == 0: return [] if numRows == 1: ...
def funcion(nums,n): print(nums) res = [] for i in range(len(nums)): suma = 0 aux = [] suma += nums[i] for j in range(i+1,len(nums)): print(i,j) if suma + nums[j] == n: aux.append(nums[i]) aux.append(nums[j]) ...
def funcion(nums, n): print(nums) res = [] for i in range(len(nums)): suma = 0 aux = [] suma += nums[i] for j in range(i + 1, len(nums)): print(i, j) if suma + nums[j] == n: aux.append(nums[i]) aux.append(nums[j]) ...
class Solution: def findRadius(self, houses, heaters): """ :type houses: List[int] :type heaters: List[int] :rtype: int """ houses.sort() heaters.sort() radius = 0 i = 0 for house in houses: while i < len(heaters) and heater...
class Solution: def find_radius(self, houses, heaters): """ :type houses: List[int] :type heaters: List[int] :rtype: int """ houses.sort() heaters.sort() radius = 0 i = 0 for house in houses: while i < len(heaters) and heat...
""" A list of the custom settings used on the site. Many of the external libraries have their own settings, see library documentation for details. """ VAVS_EMAIL_FROM = 'address shown in reply-to field of emails' VAVS_EMAIL_TO = 'list of staff addresses to send reports to' VAVS_EMAIL_SURVEYS = 'address to send s...
""" A list of the custom settings used on the site. Many of the external libraries have their own settings, see library documentation for details. """ vavs_email_from = 'address shown in reply-to field of emails' vavs_email_to = 'list of staff addresses to send reports to' vavs_email_surveys = 'address to send su...
class TestHLD: # edges = [ # (0, 1), # (0, 6), # (0, 10), # (1, 2), # (1, 5), # (2, 3), # (2, 4), # (6, 7), # (7, 8), # (7, 9), # (10, 11), # ] # root = 0 # get_lca = lca_hld(edges, root) # print(get_lca(3, 5))...
class Testhld: ...
input = """ ok:- #count{V:b(V)}=X, not p(X). b(1). p(2). """ output = """ ok:- #count{V:b(V)}=X, not p(X). b(1). p(2). """
input = '\nok:- #count{V:b(V)}=X, not p(X).\n\nb(1).\np(2).\n' output = '\nok:- #count{V:b(V)}=X, not p(X).\n\nb(1).\np(2).\n'
# # PySNMP MIB module OVERLAND-NEXTGEN (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/OVERLAND-NEXTGEN # Produced by pysmi-0.3.4 at Wed May 1 14:35:46 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, value_range_constraint, value_size_constraint, constraints_intersection) ...
class Solution(object): def XXX(self, x): """ :type x: int :rtype: int """ if x==0: return 0 x = (x//abs(x)) * int(str(abs(x))[::-1]) if -2 ** 31 < x < 2 ** 31 - 1: return x return 0
class Solution(object): def xxx(self, x): """ :type x: int :rtype: int """ if x == 0: return 0 x = x // abs(x) * int(str(abs(x))[::-1]) if -2 ** 31 < x < 2 ** 31 - 1: return x return 0
class Solution: def diStringMatch(self, S: str): l = 0 r = len(S) ret = [] for i in S: if i == "I": ret.append(l) l += 1 else: ret.append(r) r -= 1 ret.append(r) return ret slu =...
class Solution: def di_string_match(self, S: str): l = 0 r = len(S) ret = [] for i in S: if i == 'I': ret.append(l) l += 1 else: ret.append(r) r -= 1 ret.append(r) return ret slu ...
#CONSIDER: composable authorizations class Authorization(object): ''' Base authorization class, defaults to full authorization ''' #CONSIDER: how is this notified about filtering, ids, etc def __init__(self, identity, endpoint): self.identity = identity self.endpoint = endpoint ...
class Authorization(object): """ Base authorization class, defaults to full authorization """ def __init__(self, identity, endpoint): self.identity = identity self.endpoint = endpoint def process_queryset(self, queryset): return queryset def is_authorized(self): ...
# Len of signature in write signed packet SIGNATURE_LEN = 12 # Attribute Protocol Opcodes OP_ERROR = 0x01 OP_MTU_REQ = 0x02 OP_MTU_RESP = 0x03 OP_FIND_INFO_REQ = 0x04 OP_FIND_INFO_RESP = 0x05 OP_FIND_BY_TYPE_REQ = 0x06 OP_FIND_BY_TYPE_RESP= 0x07 OP_READ_BY_TYPE_REQ = 0x08 OP_READ_BY_TYPE_RESP = 0x09 OP_READ_REQ = 0x0...
signature_len = 12 op_error = 1 op_mtu_req = 2 op_mtu_resp = 3 op_find_info_req = 4 op_find_info_resp = 5 op_find_by_type_req = 6 op_find_by_type_resp = 7 op_read_by_type_req = 8 op_read_by_type_resp = 9 op_read_req = 10 op_read_resp = 11 op_read_blob_req = 12 op_read_blob_resp = 13 op_read_multi_req = 14 op_read_multi...
''' Description: ------------ When objects are instantiated, the object itself is passed into the self parameter. The Object is passed into the self parameter so that the object can keep hold of its own data. ''' print(__doc__) print('-'*25) class State(object): def __init__(self): global x...
""" Description: ------------ When objects are instantiated, the object itself is passed into the self parameter. The Object is passed into the self parameter so that the object can keep hold of its own data. """ print(__doc__) print('-' * 25) class State(object): def __init__(self): global x ...
# # @lc app=leetcode id=611 lang=python3 # # [611] Valid Triangle Number # # https://leetcode.com/problems/valid-triangle-number/description/ # # algorithms # Medium (49.73%) # Likes: 1857 # Dislikes: 129 # Total Accepted: 109.5K # Total Submissions: 222.7K # Testcase Example: '[2,2,3,4]' # # Given an integer ar...
class Solution: def triangle_number(self, nums: List[int]) -> int: if not nums or len(nums) <= 2: return 0 nums.sort() count = 0 for i in range(len(nums) - 1, 1, -1): delta = self.two_sum_greater(nums, 0, i - 1, nums[i]) count += delta ret...
""" Objects dealing with EBUS boundaries for plotting, statistics, etc. Functions --------- - `visual_bounds` : lat/lon bounds for close-up shots of our regions. - `latitude_bounds` : lat bounds for statistical analysis To do ----- - `full_scope_bounds` : regions pulled from Chavez paper for lat/lon to show full system...
""" Objects dealing with EBUS boundaries for plotting, statistics, etc. Functions --------- - `visual_bounds` : lat/lon bounds for close-up shots of our regions. - `latitude_bounds` : lat bounds for statistical analysis To do ----- - `full_scope_bounds` : regions pulled from Chavez paper for lat/lon to show full system...
# Computers are fast, so we can implement a brute-force search to directly solve the problem. def compute(): PERIMETER = 1000 for a in range(1, PERIMETER + 1): for b in range(a + 1, PERIMETER + 1): c = PERIMETER - a - b if a * a + b * b == c * c: # It is now implied that b < c, because we have a > 0 r...
def compute(): perimeter = 1000 for a in range(1, PERIMETER + 1): for b in range(a + 1, PERIMETER + 1): c = PERIMETER - a - b if a * a + b * b == c * c: return str(a * b * c) if __name__ == '__main__': print(compute())
{ "targets": [ { "target_name": "yolo", "sources": [ "src/yolo.cc" ] } ] }
{'targets': [{'target_name': 'yolo', 'sources': ['src/yolo.cc']}]}
class Docs(object): def __init__(self, conn): self.client = conn.client def size(self): r = self.client.get('/docs/size') return int(r.text) def add(self, name, content): self.client.post('/docs', files={'upload': (name, content)}) def clear(self): self.client....
class Docs(object): def __init__(self, conn): self.client = conn.client def size(self): r = self.client.get('/docs/size') return int(r.text) def add(self, name, content): self.client.post('/docs', files={'upload': (name, content)}) def clear(self): self.client...
class SlowDisjointSet: def __init__(self, N): self.N = N self._bubbles = [] for i in range(N): self._bubbles.append({i}) self._operations = 0 self._calls = 0 def _find_i(self, i): """ Find the index of the bubble that holds a particular ...
class Slowdisjointset: def __init__(self, N): self.N = N self._bubbles = [] for i in range(N): self._bubbles.append({i}) self._operations = 0 self._calls = 0 def _find_i(self, i): """ Find the index of the bubble that holds a particular ...
#!/bin/env python3 option = input("[E]ncryption, [D]ecryption, or [Q]uit -- ") def key_generation(a, b, a1, b1): M = a * b - 1 e = a1 * M + a d = b1 * M + b n = (e * d - 1) / M return int(e), int(d), int(n) def encryption(a, b, a1, b1): e, d, n = key_generation(a, b, a1, b1) print("You ma...
option = input('[E]ncryption, [D]ecryption, or [Q]uit -- ') def key_generation(a, b, a1, b1): m = a * b - 1 e = a1 * M + a d = b1 * M + b n = (e * d - 1) / M return (int(e), int(d), int(n)) def encryption(a, b, a1, b1): (e, d, n) = key_generation(a, b, a1, b1) print('You may publish your p...
#!/usr/bin/env python # coding: utf-8 # # Seldon Kafka Integration Example with CIFAR10 Model # # In this example we will run SeldonDeployments for a CIFAR10 Tensorflow model which take their inputs from a Kafka topic and push their outputs to a Kafka topic. We will experiment with both REST and gRPC Seldon graphs. F...
get_ipython().system('pip install -r requirements.txt') get_ipython().system('helm repo add strimzi https://strimzi.io/charts/') get_ipython().system('helm install my-release strimzi/strimzi-kafka-operator') cluster_type = 'kind' if clusterType == 'kind': get_ipython().system('kubectl apply -f cluster-kind.yaml') e...
# Code generated by ./release.sh. DO NOT EDIT. """Package version""" __version__ = "0.9.5-dev"
"""Package version""" __version__ = '0.9.5-dev'
# Creates the file nonsilence_phones.txt which contains # all the phonemes except sil. source = open("slp_lab2_data/lexicon.txt", 'r') phones = [] # Get all the separate phonemes from lexicon.txt. for line in source: line_phones = line.split(' ')[1:] for phone in line_phones: phone = phone.strip(' ') ...
source = open('slp_lab2_data/lexicon.txt', 'r') phones = [] for line in source: line_phones = line.split(' ')[1:] for phone in line_phones: phone = phone.strip(' ') phone = phone.strip('\n') if phone not in phones and phone != 'sil': phones.append(phone) source.close() phones...
""" A basic doubly linked list implementation @author taylor.osmun """ class LinkedList(object): """ Internal object representing a node in the linked list @author taylor.osmun """ class _Node(object): def __init__(self, _data=None, _next=None, _prev=None): self.data = _data ...
""" A basic doubly linked list implementation @author taylor.osmun """ class Linkedlist(object): """ Internal object representing a node in the linked list @author taylor.osmun """ class _Node(object): def __init__(self, _data=None, _next=None, _prev=None): self.data = _data ...
class Computer(): def __init__(self, model, memory): self.mo = model self.me = memory c = Computer('Dell', '500gb') print(c.mo,c.me)
class Computer: def __init__(self, model, memory): self.mo = model self.me = memory c = computer('Dell', '500gb') print(c.mo, c.me)
""" add 2 number """ def add(x, y): return x + y """ substract y from x """ def substract(x, y): return y - x
""" add 2 number """ def add(x, y): return x + y ' substract y from x ' def substract(x, y): return y - x
#!/usr/bin/env python files = [ "dpx_nuke_10bits_rgb.dpx", "dpx_nuke_16bits_rgba.dpx" ] for f in files: command += rw_command (OIIO_TESTSUITE_IMAGEDIR, f) # Additionally, test for regressions for endian issues with 16 bit DPX output # (related to issue #354) command += oiio_app("oiiotool") + " src/input_rgb_matt...
files = ['dpx_nuke_10bits_rgb.dpx', 'dpx_nuke_16bits_rgba.dpx'] for f in files: command += rw_command(OIIO_TESTSUITE_IMAGEDIR, f) command += oiio_app('oiiotool') + ' src/input_rgb_mattes.tif -o output_rgb_mattes.dpx >> out.txt;' command += oiio_app('idiff') + ' src/input_rgb_mattes.tif output_rgb_mattes.dpx >> out....
# https://leetcode.com/problems/remove-nth-node-from-end-of-list/ # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # @param {ListNode} head # @param {integer} n # @return {ListNode} def removeNthFromEn...
class Solution: def remove_nth_from_end(self, head, n): def remove_nth_from_end_rec(head, n): if not head: return 0 my_pos = remove_nth_from_end_rec(head.next, n) + 1 if my_pos - 1 == n: head.next = head.next.next return my_po...
def validate_required_kwargs_are_not_empty(args_list, kwargs): """ This function checks whether all passed keyword arguments are present and that they have truthy values. ::args:: args_list - This is a list or tuple that contains all the arguments you want to query for. The arguments are strings seperat...
def validate_required_kwargs_are_not_empty(args_list, kwargs): """ This function checks whether all passed keyword arguments are present and that they have truthy values. ::args:: args_list - This is a list or tuple that contains all the arguments you want to query for. The arguments are strings seperat...
__author__ = 'roeiherz' """ Design a method to find the frequency of occurrences of any given word in a book. What if we were running this algorithm multiplies times. """ def create_hashmap(book): hash_map = {} words = book.split(' ') for word in words: process_word = word.lower().replace(',', '...
__author__ = 'roeiherz' '\nDesign a method to find the frequency of occurrences of any given word in a book. \nWhat if we were running this algorithm multiplies times.\n' def create_hashmap(book): hash_map = {} words = book.split(' ') for word in words: process_word = word.lower().replace(',', '')....
def get_url(): return None result = get_url().text print(result)
def get_url(): return None result = get_url().text print(result)
myStr = input("Enter a String: ") count = 0 for letter in myStr: count += 1 print (count)
my_str = input('Enter a String: ') count = 0 for letter in myStr: count += 1 print(count)
a = 1 b = 2 c = 3 def foo(): a = 1 b = 2 c = 3 foo() print('TEST SUCEEDED')
a = 1 b = 2 c = 3 def foo(): a = 1 b = 2 c = 3 foo() print('TEST SUCEEDED')
train = [[1,2],[2,3],[1,1],[2,2],[3,3],[4,2],[2,5],[5,5],[4,1],[4,4]] weights = [1,1,1] def perceptron_predict(inputs, weights): activation = weights[0] for i in range(len(inputs)-1): activation += weights[i+1] * inputs[i] return 1.0 if activation >= 0.0 else 0.0 for inputs in train: print(p...
train = [[1, 2], [2, 3], [1, 1], [2, 2], [3, 3], [4, 2], [2, 5], [5, 5], [4, 1], [4, 4]] weights = [1, 1, 1] def perceptron_predict(inputs, weights): activation = weights[0] for i in range(len(inputs) - 1): activation += weights[i + 1] * inputs[i] return 1.0 if activation >= 0.0 else 0.0 for in...
def msg_retry(self, buf): print("retry") return buf[1:] MESSAGES = {1: msg_retry}
def msg_retry(self, buf): print('retry') return buf[1:] messages = {1: msg_retry}
print("WELCOME!\nTHIS IS A NUMBER GUESSING QUIZ ") num = 30 num_of_guesses = 1 guess = input("ARE YOU A KID?\n") while(guess != num): guess = int(input("ENTER THE NUMBER TO GUESS\n")) if guess > num: print("NOT CORRECT") print("LOWER NUMBER PLEASE!") num_of_guesses += 1 elif guess...
print('WELCOME!\nTHIS IS A NUMBER GUESSING QUIZ ') num = 30 num_of_guesses = 1 guess = input('ARE YOU A KID?\n') while guess != num: guess = int(input('ENTER THE NUMBER TO GUESS\n')) if guess > num: print('NOT CORRECT') print('LOWER NUMBER PLEASE!') num_of_guesses += 1 elif guess < n...
""" A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below). How many possible unique paths are there? ![...
""" A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below). How many possible unique paths are there? ![...
MAX_FOOD_ON_BOARD = 25 # Max food on board EAT_RATIO = 0.50 # Ammount of snake length absorbed FOOD_SPAWN_RATE = 3 # Number of turns per food spawn HUNGER_THRESHOLD = 100 # Turns of inactivity before snake starvation SNAKE_STARTING_LENGTH = 3 # Snake starting size TURNS_PER_GOLD = 20 # Turns between the spawn of ...
max_food_on_board = 25 eat_ratio = 0.5 food_spawn_rate = 3 hunger_threshold = 100 snake_starting_length = 3 turns_per_gold = 20 gold_victory = 5 turns_per_wall = 5 wall_start_turn = 50 health_decay_rate = 1 food_value = 30
# https://codeforces.com/problemset/problem/1399/A t = int(input()) for _ in range(t): length_a = int(input()) list_a = [int(x) for x in input().split()] list_a.sort() while True: if len(list_a) == 1: print('YES') break elif abs(list_a[0] - list_a[1]) <= 1: ...
t = int(input()) for _ in range(t): length_a = int(input()) list_a = [int(x) for x in input().split()] list_a.sort() while True: if len(list_a) == 1: print('YES') break elif abs(list_a[0] - list_a[1]) <= 1: list_a.pop(0) else: print...
sentence = input().split() latin = "" for word in sentence: latin += word[1:] + word[0]+"ay " print(latin,end="")
sentence = input().split() latin = '' for word in sentence: latin += word[1:] + word[0] + 'ay ' print(latin, end='')
modulename = "Help" creator = "YtnomSnrub" sd_structure = {}
modulename = 'Help' creator = 'YtnomSnrub' sd_structure = {}
class DeBracketifyMiddleware(object): def __init__(self, get_response): self.get_response = get_response def __call__(self, request): cleaned = request.GET.copy() for key in cleaned: if key.endswith('[]'): val = cleaned.pop(key) cleaned_key = ...
class Debracketifymiddleware(object): def __init__(self, get_response): self.get_response = get_response def __call__(self, request): cleaned = request.GET.copy() for key in cleaned: if key.endswith('[]'): val = cleaned.pop(key) cleaned_key =...
def trace_wire(wire_dirs): last_pos = [0, 0] grid_dict = {} length = 0 for direction in wire_dirs: way = direction[0] amount = int(direction[1:]) if way == 'R': for x in range(1,amount+1): grid_pos = '{}_{}'.format(last_pos[0]+x, last_pos[1]) ...
def trace_wire(wire_dirs): last_pos = [0, 0] grid_dict = {} length = 0 for direction in wire_dirs: way = direction[0] amount = int(direction[1:]) if way == 'R': for x in range(1, amount + 1): grid_pos = '{}_{}'.format(last_pos[0] + x, last_pos[1]) ...
#Linear Seach Algorithm def linearSearch(data, number): found = False for index in range(0, len(data)): if (data[index] == number): found = True break if found: print("Element is present in the array", index) else: print("Element is not present in the ar...
def linear_search(data, number): found = False for index in range(0, len(data)): if data[index] == number: found = True break if found: print('Element is present in the array', index) else: print('Element is not present in the array.')
i = 1 # valor inicial de I j = aux = 7 # valor inicial de J while i < 10: # equanto for menor que 10: for x in range(3): # loop: mostra as linhas consecutivas print('I={} J={}' .forma...
i = 1 j = aux = 7 while i < 10: for x in range(3): print('I={} J={}'.format(i, j)) j -= 1 i += 2 aux += 2 j = aux
IOSXE_TEST = { "host": "172.18.0.11", "username": "vrnetlab", "password": "VR-netlab9", "device_type": "cisco_xe", "test_commands": ["show run", "show version"], } NXOS_TEST = { "host": "172.18.0.12", "username": "vrnetlab", "password": "VR-netlab9", "device_type": "cisco_nxos", ...
iosxe_test = {'host': '172.18.0.11', 'username': 'vrnetlab', 'password': 'VR-netlab9', 'device_type': 'cisco_xe', 'test_commands': ['show run', 'show version']} nxos_test = {'host': '172.18.0.12', 'username': 'vrnetlab', 'password': 'VR-netlab9', 'device_type': 'cisco_nxos', 'test_commands': ['show run', 'show version'...
def rotate_left(list_f, step): for _ in range(step): list_f.append(list_f.pop(0)) list_s = list_f[:] return list_s
def rotate_left(list_f, step): for _ in range(step): list_f.append(list_f.pop(0)) list_s = list_f[:] return list_s
times = [{'writing_data': 6.627535581588745, 'ndvi_pc10': 27.36231303215027, 'loading_data': 109.62806057929993, 'ndvi_pc90': 21.421257734298706, 'ndvi_pc50': 27.33169937133789}, {'writing_data': 6.443411588668823, 'ndvi_pc10': 39.16243243217468, 'loading_data': 123.19368815422058, 'ndvi_pc90': 38.72961163520813, 'ndvi...
times = [{'writing_data': 6.627535581588745, 'ndvi_pc10': 27.36231303215027, 'loading_data': 109.62806057929993, 'ndvi_pc90': 21.421257734298706, 'ndvi_pc50': 27.33169937133789}, {'writing_data': 6.443411588668823, 'ndvi_pc10': 39.16243243217468, 'loading_data': 123.19368815422058, 'ndvi_pc90': 38.72961163520813, 'ndvi...
#!/usr/bin/env python3 class InitializationException(Exception): """Raise when initialization errors occur.""" class ChallengeNotFound(Exception): """Raise when challenge not found.""" class ChallengeNotCovered(Exception): """Raise when challenge not found.""" class TestNotFound(Exception): """R...
class Initializationexception(Exception): """Raise when initialization errors occur.""" class Challengenotfound(Exception): """Raise when challenge not found.""" class Challengenotcovered(Exception): """Raise when challenge not found.""" class Testnotfound(Exception): """Raise when test not found."""...
fname = input("Enter file name: ") fh = open(fname) total = 0.0 count = 0.0 for line in fh: if line.startswith("X-DSPAM-Confidence:"): total += float(line[line.find(":") + 1:]) count += 1 lf = total/count else: continue print('Average spam confidence: ',"{0:.12f}".format(round(l...
fname = input('Enter file name: ') fh = open(fname) total = 0.0 count = 0.0 for line in fh: if line.startswith('X-DSPAM-Confidence:'): total += float(line[line.find(':') + 1:]) count += 1 lf = total / count else: continue print('Average spam confidence: ', '{0:.12f}'.format(round...
def selectmenuitem(window,object): #log("{} :not implemented yet".format(sys._getframe().f_code.co_name)) object = object.split(";") if len(object) == 2: objectHandle = getobjecthandle(window,object[0])['handle'] mousemove(window,object[0],handle=objectHandle) ldtp_extend_mouse_click...
def selectmenuitem(window, object): object = object.split(';') if len(object) == 2: object_handle = getobjecthandle(window, object[0])['handle'] mousemove(window, object[0], handle=objectHandle) ldtp_extend_mouse_click_here() time.sleep(1) object_handle = getobjecthandle(...
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None def kAltReverse(head, k) : current = head next = None prev = None count = 0 #1) reverse first k nodes of the linked list while (current != None ...
def k_alt_reverse(head, k): current = head next = None prev = None count = 0 while current != None and count < k: next = current.next current.next = prev prev = current current = next count = count + 1 if head != None: head.next = current count...
_base_ = "./FlowNet512_1.5AugCosyAAEGray_AggressiveV2_Flat_Pbr_01_ape.py" OUTPUT_DIR = "output/deepim/lmPbrSO/FlowNet512_1.5AugCosyAAEGray_AggressiveV2_Flat_lmPbr_SO/cat" DATASETS = dict(TRAIN=("lm_pbr_cat_train",), TEST=("lm_real_cat_test",)) # bbnc5 # objects cat Avg(1) # ad_2 19.26 19.26 # ad_5 62.48...
_base_ = './FlowNet512_1.5AugCosyAAEGray_AggressiveV2_Flat_Pbr_01_ape.py' output_dir = 'output/deepim/lmPbrSO/FlowNet512_1.5AugCosyAAEGray_AggressiveV2_Flat_lmPbr_SO/cat' datasets = dict(TRAIN=('lm_pbr_cat_train',), TEST=('lm_real_cat_test',))
def main(): with open('input.txt') as f: inputs = [line.split() for line in f.readlines()] pos = (0, 0) # horiz, depth for cmd, amount in inputs: amount = int(amount) match cmd: case 'forward': pos = (pos[0] + amount, pos[1]) case 'down': ...
def main(): with open('input.txt') as f: inputs = [line.split() for line in f.readlines()] pos = (0, 0) for (cmd, amount) in inputs: amount = int(amount) match cmd: case 'forward': pos = (pos[0] + amount, pos[1]) case 'down': po...
# Python Lists # @IdiotInside_ print ("Creating List:") colors = ['red', 'blue', 'green'] print (colors[0]) ## red print (colors[1]) ## blue print (colors[2]) ## green print (len(colors)) ## 3 print ("Append to the List") colors.append("orange") print (colors[3]) ##orange print ("Insert to the List") colors....
print('Creating List:') colors = ['red', 'blue', 'green'] print(colors[0]) print(colors[1]) print(colors[2]) print(len(colors)) print('Append to the List') colors.append('orange') print(colors[3]) print('Insert to the List') colors.insert(3, 'yellow') print(colors[3]) print(colors[4]) print('Remove from the List') prin...
class Solution: def find_averages(self, k, arr): result = [] window_sum = 0 window_start = 0 for window_end in range(len(arr)): window_sum += arr[window_end] if window_end >= k - 1: result.append(window_sum / k) window_sum -= ar...
class Solution: def find_averages(self, k, arr): result = [] window_sum = 0 window_start = 0 for window_end in range(len(arr)): window_sum += arr[window_end] if window_end >= k - 1: result.append(window_sum / k) window_sum -= a...
# calculting factorial using recursion def Fact(n): return (n * Fact(n-1) if (n > 1) else 1.0) #main num = int(input("n = ")) print(Fact(num))
def fact(n): return n * fact(n - 1) if n > 1 else 1.0 num = int(input('n = ')) print(fact(num))
# https://www.hackerrank.com/challenges/ctci-lonely-integer def lonely_integer(a): bitArray = 0b0 for ele in a: bitArray = bitArray ^ ele # print(ele, bin(bitArray)) return int(bitArray)
def lonely_integer(a): bit_array = 0 for ele in a: bit_array = bitArray ^ ele return int(bitArray)
""" MiniAuth ~~~~~~~~ Simple program and library for local user authentication. :license: This software is released under the terms of MIT license. See LICENSE file for more details. """ __version__ = '0.2.0'
""" MiniAuth ~~~~~~~~ Simple program and library for local user authentication. :license: This software is released under the terms of MIT license. See LICENSE file for more details. """ __version__ = '0.2.0'
class StatusesHelper(object): """ An helper on statuses operations """ values = { 0: ('none','Not Moderated',), 1: ('moderated','Being Moderated',), 2: ('accepted','Accepted',), 3: ('refused','Refused',), } @classmethod def encode(_class, enc_status_name): ...
class Statuseshelper(object): """ An helper on statuses operations """ values = {0: ('none', 'Not Moderated'), 1: ('moderated', 'Being Moderated'), 2: ('accepted', 'Accepted'), 3: ('refused', 'Refused')} @classmethod def encode(_class, enc_status_name): """ Encode a status strin...
andmed = [] nimekiri = open("nimekiri.txt", encoding="UTF-8") for rida in nimekiri: f = open(rida.strip() + ".txt", encoding="UTF-8") kirje = {} for attr in f: osad = attr.strip().split(": ") kirje[osad[0]] = osad[1] f.close() andmed.append(kirje) nimekiri.close() uus...
andmed = [] nimekiri = open('nimekiri.txt', encoding='UTF-8') for rida in nimekiri: f = open(rida.strip() + '.txt', encoding='UTF-8') kirje = {} for attr in f: osad = attr.strip().split(': ') kirje[osad[0]] = osad[1] f.close() andmed.append(kirje) nimekiri.close() uus_failinimi = inp...
# window's attributes TITLE = 'Arkanoid.py' WIDTH = 640 HEIGHT = 400 ICON = 'images/ball.png'
title = 'Arkanoid.py' width = 640 height = 400 icon = 'images/ball.png'
elemDictInv = { 100:'TrivialElement', 101:'PolyElement', 102:'NullElement', 110:'DirichletNode', 111:'DirichletNodeLag', 112:'zeroVariable', 120:'NodalForce', 121:'NodalForceLine', 130:'setMaterialParam', 131:'setDamageParam', 132:'IncrementVariables', 133:'insertDeformation', 134:'insertDeformationGeneral', 140:'p...
elem_dict_inv = {100: 'TrivialElement', 101: 'PolyElement', 102: 'NullElement', 110: 'DirichletNode', 111: 'DirichletNodeLag', 112: 'zeroVariable', 120: 'NodalForce', 121: 'NodalForceLine', 130: 'setMaterialParam', 131: 'setDamageParam', 132: 'IncrementVariables', 133: 'insertDeformation', 134: 'insertDeformationGenera...
""" Problem: Find the number of 1s in the binary representation of a number. For example: num_ones(2) = 1 --> since "10" is the binary representation of the number "2". num_ones(5) = 2 --> since "101" is the binary representation of the number "5" etc. """ # num = 2 num = 5 # num = 11 print(bin(num)) # Approach 1 ...
""" Problem: Find the number of 1s in the binary representation of a number. For example: num_ones(2) = 1 --> since "10" is the binary representation of the number "2". num_ones(5) = 2 --> since "101" is the binary representation of the number "5" etc. """ num = 5 print(bin(num)) one_sum = 0 bin_rep = bin(num)[2:] f...
"""Handler class. All handlers must inherit from it.""" class Handler: def __init__(self, alert: str): self.broker = None self.alert = alert def alert_on(self): """Will be run when alert pops up.""" pass def alert_off(self): """Will be run when alert disappears.""...
"""Handler class. All handlers must inherit from it.""" class Handler: def __init__(self, alert: str): self.broker = None self.alert = alert def alert_on(self): """Will be run when alert pops up.""" pass def alert_off(self): """Will be run when alert disappears.""...
tupla = ('python', 'estudar', 'linguagem', 'curso', 'viajar', 'cinema', 'pipoca', 'futuro', 'programador', 'mercado') for c in tupla: print(f'\nNa palavra {c} temos as vogais:', end=' ') for vogais in c: if vogais.lower() in 'aeiou': print(vogais, end=' ')
tupla = ('python', 'estudar', 'linguagem', 'curso', 'viajar', 'cinema', 'pipoca', 'futuro', 'programador', 'mercado') for c in tupla: print(f'\nNa palavra {c} temos as vogais:', end=' ') for vogais in c: if vogais.lower() in 'aeiou': print(vogais, end=' ')
# Funcion de evaluacion de calidad de codigo. Devuelve un entero con un numero que representa la calidad. Cuanto mas cercano a 0 esten los valores, mayor sera la calidad. def evaluateCode(listOfRefactors): # Good code -> Close to 0 # Bad code -> Far from 0 codeQuality = 0 for refactor in listOfRe...
def evaluate_code(listOfRefactors): code_quality = 0 for refactor in listOfRefactors: code_quality = refactor['nPriority'] + codeQuality return codeQuality
DIRECTIONS = { "U": (0, 1), "D": (0, -1), "L": (-1, 0), "R": (1, 0) } def wire_to_point_set(wire): s = set() d = dict() x, y, steps = 0, 0, 0 for w in wire: dx, dy = DIRECTIONS[w[0]] dist = int(w[1:]) for _ in range(dist): x += dx y += d...
directions = {'U': (0, 1), 'D': (0, -1), 'L': (-1, 0), 'R': (1, 0)} def wire_to_point_set(wire): s = set() d = dict() (x, y, steps) = (0, 0, 0) for w in wire: (dx, dy) = DIRECTIONS[w[0]] dist = int(w[1:]) for _ in range(dist): x += dx y += dy ...
def main(): print("Welcome To play Ground") # Invocation if __name__ == "__main__": main() myInt = 5 myFloat = 13.2 myString = "Hello" myBool = True myList = [0, 1, "Two", 3.4, 78, 89, 45, 67] myTuple = (0, 1, 2) myDict = {"one": 1, "Two": 2} # Random print Statements print(myDict) print(myTuple) print(myIn...
def main(): print('Welcome To play Ground') if __name__ == '__main__': main() my_int = 5 my_float = 13.2 my_string = 'Hello' my_bool = True my_list = [0, 1, 'Two', 3.4, 78, 89, 45, 67] my_tuple = (0, 1, 2) my_dict = {'one': 1, 'Two': 2} print(myDict) print(myTuple) print(myInt) print(myList) print(myFloat) prin...
expected_output = { "version": 3, "interfaces": { "GigabitEthernet1/0/9": { "interface": "GigabitEthernet1/0/9", "max_start": 3, "pae": "supplicant", "credentials": "switch4", "supplicant": {"eap": {"profile": "EAP-METH"}}, "timeout...
expected_output = {'version': 3, 'interfaces': {'GigabitEthernet1/0/9': {'interface': 'GigabitEthernet1/0/9', 'max_start': 3, 'pae': 'supplicant', 'credentials': 'switch4', 'supplicant': {'eap': {'profile': 'EAP-METH'}}, 'timeout': {'held_period': 60, 'start_period': 30, 'auth_period': 30}}}, 'system_auth_control': Tru...
def isintersect(a,b): for i in a: for j in b: if i==j: return True return False class RopChain(object): def __init__(self): self.chains = [] self.dump_str = None self.payload = b"" self.base_addr = 0 self.next_call = None s...
def isintersect(a, b): for i in a: for j in b: if i == j: return True return False class Ropchain(object): def __init__(self): self.chains = [] self.dump_str = None self.payload = b'' self.base_addr = 0 self.next_call = None ...
def triplets_with_sum(number): triplets = [] for a in range(1, number // 3): l = a + 1 r = (number - a - 1) // 2 while l <= r: b = (l + r) // 2 c = number - a - b if a * a + b * b < c * c: l = b + 1 elif a * a + b * b > c...
def triplets_with_sum(number): triplets = [] for a in range(1, number // 3): l = a + 1 r = (number - a - 1) // 2 while l <= r: b = (l + r) // 2 c = number - a - b if a * a + b * b < c * c: l = b + 1 elif a * a + b * b > c * ...
class ChangeTextState: def __init__(self): self.prev_tail = '' self.context = None _change_text_state = None def init(): global _change_text_state _change_text_state = ChangeTextState() init() def get_state() -> ChangeTextState: global _change_text_state if _change_text_state...
class Changetextstate: def __init__(self): self.prev_tail = '' self.context = None _change_text_state = None def init(): global _change_text_state _change_text_state = change_text_state() init() def get_state() -> ChangeTextState: global _change_text_state if _change_text_state is...
""" flask-wow ~~~~~~~~~ A simple CLI Generator to create flask app. :copyright: 2020 Cove :license: BSD 3-Clause License """ __version__ = '0.2.1' # def demo(): # # if args.cmd == 'addapp': # print(f'Will create Flask app with name "{args.name}"') # dir_name = os.path.dirnam...
""" flask-wow ~~~~~~~~~ A simple CLI Generator to create flask app. :copyright: 2020 Cove :license: BSD 3-Clause License """ __version__ = '0.2.1'
Size = (512, 748) ScaleFactor = 0.33 ZoomLevel = 1.0 Orientation = -90 Mirror = True NominalPixelSize = 0.002325 filename = '' ImageWindow.Center = (680, 512) ImageWindow.ViewportCenter = (1.1904, 1.5774772727272726) ImageWindow.crosshair_color = (255, 0, 255) ImageWindow.boxsize = (0.1, 0.06) ImageWindow.box_color = (...
size = (512, 748) scale_factor = 0.33 zoom_level = 1.0 orientation = -90 mirror = True nominal_pixel_size = 0.002325 filename = '' ImageWindow.Center = (680, 512) ImageWindow.ViewportCenter = (1.1904, 1.5774772727272726) ImageWindow.crosshair_color = (255, 0, 255) ImageWindow.boxsize = (0.1, 0.06) ImageWindow.box_color...
"""Constants defining gameplay.""" # dimensions SCREEN_WIDTH = 1280 SCREEN_HEIGHT = 1024 PLAYER_SPRITE_HEIGHT = 20 PLAYER_SPRITE_HOVER = 100 PLAYER_SPRITE_PADDING = 20 CLOSE_CALL_POSITION = (200, 200) # display TARGET_FRAMERATE = 60 GAME_TITLE = "Dodge" SCORE_POSITION = (20, SCREEN_HEIGHT - 50) # colors SCREEN_FILL_...
"""Constants defining gameplay.""" screen_width = 1280 screen_height = 1024 player_sprite_height = 20 player_sprite_hover = 100 player_sprite_padding = 20 close_call_position = (200, 200) target_framerate = 60 game_title = 'Dodge' score_position = (20, SCREEN_HEIGHT - 50) screen_fill_color = (0, 0, 0) player_sprite_col...
#! /usr/bin/env python3 def analyse_pattern(ls) : corresponds = {2:1,7:8,4:4,3:7} dct = {corresponds[len(i)]:i for i in ls if len(i) in [2, 3, 4, 7]} for i in range(10) : s = len(ls[i]) if s == 6 : #0 6 9 if sum(ls[i][j] in dct[4] for j in range(s)) == 3 : if sum...
def analyse_pattern(ls): corresponds = {2: 1, 7: 8, 4: 4, 3: 7} dct = {corresponds[len(i)]: i for i in ls if len(i) in [2, 3, 4, 7]} for i in range(10): s = len(ls[i]) if s == 6: if sum((ls[i][j] in dct[4] for j in range(s))) == 3: if sum((ls[i][j] in dct[1] for j...