content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# -*- coding:utf-8 -*- pizza = { 'crust': 'thick', 'toppings': ['mushrooms', 'extra cheese'], }
pizza = {'crust': 'thick', 'toppings': ['mushrooms', 'extra cheese']}
# You may remember by now that while loops use the condition to check when # to exit. The body of the while loop needs to make sure that the condition begin # checked will change. If it doesn't change, the loop may never finish and we get # what's called an infinite loop, a loop that keeps executing and never stops. # ...
def print_range(start, end): n = start while n <= end: print(n) n += 1 print_range(1, 5)
""" *Sounding State* A type describing state of data soundness. """ class SoundingState( StatefulPhantomClass, ): pass
""" *Sounding State* A type describing state of data soundness. """ class Soundingstate(StatefulPhantomClass): pass
""" Top level of MQTT IO package. """ VERSION = "2.1.4"
""" Top level of MQTT IO package. """ version = '2.1.4'
DOMAIN = "audiconnect" CONF_VIN = "vin" CONF_CARNAME = "carname" CONF_ACTION = "action" MIN_UPDATE_INTERVAL = 5 DEFAULT_UPDATE_INTERVAL = 10 CONF_SPIN = "spin" CONF_REGION = "region" CONF_SERVICE_URL = "service_url" CONF_MUTABLE = "mutable" SIGNAL_STATE_UPDATED = "{}.updated".format(DOMAIN) TRACKER_UPDATE = f"{DOMA...
domain = 'audiconnect' conf_vin = 'vin' conf_carname = 'carname' conf_action = 'action' min_update_interval = 5 default_update_interval = 10 conf_spin = 'spin' conf_region = 'region' conf_service_url = 'service_url' conf_mutable = 'mutable' signal_state_updated = '{}.updated'.format(DOMAIN) tracker_update = f'{DOMAIN}_...
def first_last6(list1: list) -> bool: """Return True if either/both first and last element are assigned a value of 6 >>> first_last6(test_list1) False >>> first_last6(test_list2) True >>> first_last6(test_list3) True """ if list1[0] or list1[5] == 6: return True ...
def first_last6(list1: list) -> bool: """Return True if either/both first and last element are assigned a value of 6 >>> first_last6(test_list1) False >>> first_last6(test_list2) True >>> first_last6(test_list3) True """ if list1[0] or list1[5] == 6: return True else: ...
class Mouse: __slots__=( '_system_cursor', 'has_mouse' ) def __init__(self): self._system_cursor = ez.window.panda_winprops.get_cursor_filename() self.has_mouse = ez.panda_showbase.mouseWatcherNode.has_mouse def hide(self): ez.window.panda_winprops.set_curso...
class Mouse: __slots__ = ('_system_cursor', 'has_mouse') def __init__(self): self._system_cursor = ez.window.panda_winprops.get_cursor_filename() self.has_mouse = ez.panda_showbase.mouseWatcherNode.has_mouse def hide(self): ez.window.panda_winprops.set_cursor_hidden(True) e...
n = int(input()) s = set(map(int, input().split())) for i in range(int(input())): f = input().split() if (f[0] == "pop"): s.pop() elif (f[0] == "remove"): s.remove(int(f[-1])) else: s.discard(int(f[-1])) print(sum(s))
n = int(input()) s = set(map(int, input().split())) for i in range(int(input())): f = input().split() if f[0] == 'pop': s.pop() elif f[0] == 'remove': s.remove(int(f[-1])) else: s.discard(int(f[-1])) print(sum(s))
# ------------------------------------------------------------------------------------ # Tutorial: Learn how to use Dictionaries in Python # ------------------------------------------------------------------------------------ # Dictionaries are a collection of key-value pairs. # Keys can only appear once in a dictiona...
my_dict = {'my_key': 'my value', 'your_key': 42, 5: 10, 'speed': 20.0} my_dict['their_key'] = 3.142 retrieved = my_dict['my_key'] print("Value of 'my_key': " + str(retrieved)) retrieved = my_dict.get('your_key') print("Value of 'your_key': " + str(retrieved)) retrieved = my_dict.get('non_existent_key', 'Not here.') pri...
def setup(): noLoop() size(500, 500) noStroke() smooth() def draw(): background(50) fill(94, 206, 40, 100) ellipse(250, 100, 160, 160) fill(94, 206, 40, 150) ellipse(250, 200, 160, 160) fill(94, 206, 40, 200) ellipse(250, 300, 160, 160) fill(94, 206, 4...
def setup(): no_loop() size(500, 500) no_stroke() smooth() def draw(): background(50) fill(94, 206, 40, 100) ellipse(250, 100, 160, 160) fill(94, 206, 40, 150) ellipse(250, 200, 160, 160) fill(94, 206, 40, 200) ellipse(250, 300, 160, 160) fill(94, 206, 40, 250) ellip...
def test_get_condition_new(): scraper = Scraper('Apple', 3000, 'new') result = scraper.condition_code assert result == 1000 def test_get_condition_used(): scraper = Scraper('Apple', 3000, 'used') result = scraper.condition_code assert result == 3000 def test_get_condition_error(): scraper = Scraper('A...
def test_get_condition_new(): scraper = scraper('Apple', 3000, 'new') result = scraper.condition_code assert result == 1000 def test_get_condition_used(): scraper = scraper('Apple', 3000, 'used') result = scraper.condition_code assert result == 3000 def test_get_condition_error(): scraper ...
""" Hao Ren 11 October, 2021 495. Teemo Attacking """ class Solution(object): def findPoisonedDuration(self, timeSeries, duration): """ :type timeSeries: List[int] :type duration: int :rtype: int """ time = 0 length = len(timeSeries) for i in range(le...
""" Hao Ren 11 October, 2021 495. Teemo Attacking """ class Solution(object): def find_poisoned_duration(self, timeSeries, duration): """ :type timeSeries: List[int] :type duration: int :rtype: int """ time = 0 length = len(timeSeries) for i in range...
def get_median( arr ): size = len(arr) mid_pos = size // 2 if size % 2 == 0: # size is even median = ( arr[mid_pos-1] + arr[mid_pos] ) / 2 else: # size is odd median = arr[mid_pos] return (median) def collect_Q1_Q2_Q3( arr ): # Preprocessing # in-pl...
def get_median(arr): size = len(arr) mid_pos = size // 2 if size % 2 == 0: median = (arr[mid_pos - 1] + arr[mid_pos]) / 2 else: median = arr[mid_pos] return median def collect_q1_q2_q3(arr): arr.sort() q2 = get_median(arr) size = len(arr) mid = size // 2 if size ...
class YamboSpectra(): """ Class to show optical absorption spectra """ def __init__(self,energies,data): self.energies = energies self.data = data
class Yambospectra: """ Class to show optical absorption spectra """ def __init__(self, energies, data): self.energies = energies self.data = data
def vowelCount(str): count = 0 for i in str: if i == "a" or i == "e" or i == "u" or i == "i" or i == "o": count += 1 print(count) exString = "Count the vowels in me!" vowelCount(exString)
def vowel_count(str): count = 0 for i in str: if i == 'a' or i == 'e' or i == 'u' or (i == 'i') or (i == 'o'): count += 1 print(count) ex_string = 'Count the vowels in me!' vowel_count(exString)
def test_add_two_params(): expected = 5 actual = add(2, 3) assert expected == actual def test_add_three_params(): expected = 9 actual = add(2, 3, 4) assert expected == actual def add(a, b, c=None): if c is None: return a + b else: return a + b + c
def test_add_two_params(): expected = 5 actual = add(2, 3) assert expected == actual def test_add_three_params(): expected = 9 actual = add(2, 3, 4) assert expected == actual def add(a, b, c=None): if c is None: return a + b else: return a + b + c
# pylint: disable=R0903 """test __init__ return """ __revision__ = 'yo' class MyClass(object): """dummy class""" def __init__(self): return 1 class MyClass2(object): """dummy class""" def __init__(self): return class MyClass3(object): """dummy class""" def __init__(self): ...
"""test __init__ return """ __revision__ = 'yo' class Myclass(object): """dummy class""" def __init__(self): return 1 class Myclass2(object): """dummy class""" def __init__(self): return class Myclass3(object): """dummy class""" def __init__(self): return None clas...
l = [58, 60, 67, 72, 76, 74, 79] s = '[' for ll in l: s += ' %i' % (ll + 9) s += ' ]' print(s)
l = [58, 60, 67, 72, 76, 74, 79] s = '[' for ll in l: s += ' %i' % (ll + 9) s += ' ]' print(s)
{ "variables": { "GTK_Root%": "c:\\gtk", "conditions": [ [ "OS == 'mac'", { "pkg_env": "PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig" }, { "pkg_env": "" }] ] }, "targets": [ { "target_name": "rsvg", "sources": [ "src/Rsvg.cc", "src/Enums.cc", "src/Autocrop.cc" ], "include_d...
{'variables': {'GTK_Root%': 'c:\\gtk', 'conditions': [["OS == 'mac'", {'pkg_env': 'PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig'}, {'pkg_env': ''}]]}, 'targets': [{'target_name': 'rsvg', 'sources': ['src/Rsvg.cc', 'src/Enums.cc', 'src/Autocrop.cc'], 'include_dirs': ['<!(node -e "require(\'nan\')")'], 'variables': {'packages'...
def is_even_with_return(i): print('with return') remainder = i % 2 return remainder == 0 print(is_even_with_return(132)) def is_even(i): return i % 2 == 0 print("All numbers between 0 and 20: even or not") for i in range(20): if is_even(i): print(i, "even") else: print(i, "odd...
def is_even_with_return(i): print('with return') remainder = i % 2 return remainder == 0 print(is_even_with_return(132)) def is_even(i): return i % 2 == 0 print('All numbers between 0 and 20: even or not') for i in range(20): if is_even(i): print(i, 'even') else: print(i, 'odd')...
class gbXMLBuildingOperatingSchedule(Enum,IComparable,IFormattable,IConvertible): """ Enumerations for gbXML (Green Building XML) format,used for energy analysis,schema version 0.34. enum gbXMLBuildingOperatingSchedule,values: DefaultOperatingSchedule (0),KindergartenThruTwelveGradeSchool (7),NoOfOpera...
class Gbxmlbuildingoperatingschedule(Enum, IComparable, IFormattable, IConvertible): """ Enumerations for gbXML (Green Building XML) format,used for energy analysis,schema version 0.34. enum gbXMLBuildingOperatingSchedule,values: DefaultOperatingSchedule (0),KindergartenThruTwelveGradeSchool (7),NoOfOper...
class Solution: def firstBadVersion(self, n): if n == 1: return 1 l, r = 2, n while l <= r: mid = (l + r) // 2 if isBadVersion(mid) and not isBadVersion(mid - 1): return mid elif isBadVersion(mid): r = mid - 1...
class Solution: def first_bad_version(self, n): if n == 1: return 1 (l, r) = (2, n) while l <= r: mid = (l + r) // 2 if is_bad_version(mid) and (not is_bad_version(mid - 1)): return mid elif is_bad_version(mid): ...
class Solution: def wordPatternMatch(self, pattern, text): """ :type pattern: str :type str: str :rtype: bool { "a": asd } asdasdasd 3 "" """ return self._find_match(pattern, text, 0, 0...
class Solution: def word_pattern_match(self, pattern, text): """ :type pattern: str :type str: str :rtype: bool { "a": asd } asdasdasd 3 "" """ return self._find_match(pattern, text, 0...
""" Time utilities for lux analysis and replay """ # Sunrise sunset data for Sunnyvale, CA, 2016. # From http://aa.usno.navy.mil/cgi-bin/aa_rstablew.pl?ID=AA&year=2016&task=0&state=CA&place=Sunnyvale # Eventually use ephem (https://pypi.python.org/pypi/pyephem/) to # compute the sunrise/sunset. sunrise_sunset_data =\ ...
""" Time utilities for lux analysis and replay """ sunrise_sunset_data = '01 0722 1701 0712 1732 0638 1803 0553 1831 0512 1858 0449 1924 0451 1933 0513 1915 0539 1836 0604 1750 0633 1709 0704 1650\n02 0723 1702 0711 1733 0637 1804 0551 1832 0511 1859 0449 1924 0452 1933 0514 1914 0540 1835 0605 17...
class Obstacle: def __init__(self, clearance): self.x = 10 self.y = 10 self.clearance = clearance self.robot_radius = 0.354 / 2 self.clearance = self.robot_radius + self.clearance self.dynamic_Obstacle = False # self.rect1_corner1_x = 3 # self.rect1...
class Obstacle: def __init__(self, clearance): self.x = 10 self.y = 10 self.clearance = clearance self.robot_radius = 0.354 / 2 self.clearance = self.robot_radius + self.clearance self.dynamic_Obstacle = False self.rect1_corner1_x = 0 self.rect1_corne...
""" Problem Given a list of integers, find the largest product you could make from 3 integers in the list Requirements You can assume that the list will always have at least 3 integers """ def get_largest_product(lst): if len(lst) < 3: raise ValueError("List is too short") high = max(lst[0], lst[1...
""" Problem Given a list of integers, find the largest product you could make from 3 integers in the list Requirements You can assume that the list will always have at least 3 integers """ def get_largest_product(lst): if len(lst) < 3: raise value_error('List is too short') high = max(lst[0], lst[1]...
"""Project metadata Information describing the project. """ # The package name, which is also the so-called "UNIX name" for the project. package = 'ecs' project = "Entity-Component-System" project_no_spaces = project.replace(' ', '') version = '0.1' description = 'An entity/component system library for games' authors...
"""Project metadata Information describing the project. """ package = 'ecs' project = 'Entity-Component-System' project_no_spaces = project.replace(' ', '') version = '0.1' description = 'An entity/component system library for games' authors = ['Sean Fisk', 'Kevin Ward'] authors_string = ', '.join(authors) emails = ['...
def f(*, b): return b def f(a, *, b): return a + b def f(a, *, b, c): return a + b + c def f(a, *, b=c): return a + b def f(a, *, b=c, c): return a + b + c def f(a, *, b=c, c=d): return a + b + c def f(a, *, b=c, c, d=e): return a + b + c + d def f(a=None, *, b=None): return a + b...
def f(*, b): return b def f(a, *, b): return a + b def f(a, *, b, c): return a + b + c def f(a, *, b=c): return a + b def f(a, *, b=c, c): return a + b + c def f(a, *, b=c, c=d): return a + b + c def f(a, *, b=c, c, d=e): return a + b + c + d def f(a=None, *, b=None): return a + b
# Sort the entries of medals: medals_sorted medals_sorted = medals.sort_index(level=0) # Print the number of Bronze medals won by Germany print(medals_sorted.loc[('bronze','Germany')]) # Print data about silver medals print(medals_sorted.loc['silver']) # Create alias for pd.IndexSlice: idx idx = pd.IndexSl...
medals_sorted = medals.sort_index(level=0) print(medals_sorted.loc['bronze', 'Germany']) print(medals_sorted.loc['silver']) idx = pd.IndexSlice print(medals_sorted.loc[idx[:, 'United Kingdom'], :])
class WebSocketDefine: Uri = "wss://sdstream.binance.com/stream" # testnet new spec # Uri = "wss://sdstream.binancefuture.com/stream" class RestApiDefine: Url = "https://dapi.binance.com" # testnet # Url = "https://testnet.binancefuture.com"
class Websocketdefine: uri = 'wss://sdstream.binance.com/stream' class Restapidefine: url = 'https://dapi.binance.com'
s = input() y, m, d = map(int, s.split('/')) f = False ( Heisei, TBD, )= ( 'Heisei', 'TBD', ) if y < 2019: print(Heisei) elif y == 2019: if(m < 4): print(Heisei) elif m == 4: if(d <= 30): print(Heisei) else : print(TBD) else : print...
s = input() (y, m, d) = map(int, s.split('/')) f = False (heisei, tbd) = ('Heisei', 'TBD') if y < 2019: print(Heisei) elif y == 2019: if m < 4: print(Heisei) elif m == 4: if d <= 30: print(Heisei) else: print(TBD) else: print(TBD) else: print(T...
""" The meat. Things to do: TaskFinder - querys a (file|db) for what sort of tasks to run Task - initialize from task data pulled by TaskFinder - enumerate the combination of args and kwargs to sent to this task - provide a function which takes *args and **kwargs to execute the task - ...
""" The meat. Things to do: TaskFinder - querys a (file|db) for what sort of tasks to run Task - initialize from task data pulled by TaskFinder - enumerate the combination of args and kwargs to sent to this task - provide a function which takes *args and **kwargs to execute the task - ...
rfm69SpiBus = 0 rfm69NSS = 5 # GPIO5 == pin 7 rfm69D0 = 9 # GPIO9 == pin 12 rfm69RST = 8 # GPIO8 == pin 11 am2302 = 22 # GPIO22 == pin 29 voltADC = 26 # GPIO26 == pin 31
rfm69_spi_bus = 0 rfm69_nss = 5 rfm69_d0 = 9 rfm69_rst = 8 am2302 = 22 volt_adc = 26
# Hack 3: create your own math function # Function is superfactorial: superfactorial is product of all factorials until n. # OOP method class superFactorial(): def __init__(self,n): self.n = n def factorial(self,y): y = self.n if y is None else y product = 1 for x in range(1,y...
class Superfactorial: def __init__(self, n): self.n = n def factorial(self, y): y = self.n if y is None else y product = 1 for x in range(1, y + 1): product *= x return product def __call__(self): product = 1 for x in range(1, self.n + 1...
class Settings(): "A class to store all settings for Football game." def __init__(self): """Initialize the game's settings.""" # Screen settings. self.screen_width = 1200 self.screen_height = 700 self.bg_color = (50, 205, 50) self.attacker_speed_factor = 1.5 ...
class Settings: """A class to store all settings for Football game.""" def __init__(self): """Initialize the game's settings.""" self.screen_width = 1200 self.screen_height = 700 self.bg_color = (50, 205, 50) self.attacker_speed_factor = 1.5 self.ball_speed_facto...
# -*- Mode:Python;indent-tabs-mode:nil; -*- # # File: psaExceptions.py # Created: 05/09/2014 # Author: BSC # # Description: # Custom execption class to manage error in the PSC # class psaExceptions( object ): class confRetrievalFailed( Exception ): pass
class Psaexceptions(object): class Confretrievalfailed(Exception): pass
class CategoryDefinition: """ Defines a category for labeling texts.""" def __init__(self, name): self.name = name class NamedEntityDefinition: """ Defines a named entity for annotating texts.""" def __init__(self, code, key_sequence = None, maincolor = None, backcolor = None, forecolor= Non...
class Categorydefinition: """ Defines a category for labeling texts.""" def __init__(self, name): self.name = name class Namedentitydefinition: """ Defines a named entity for annotating texts.""" def __init__(self, code, key_sequence=None, maincolor=None, backcolor=None, forecolor=None): ...
# multiply a list by a number def mul(row, num): return [x * num for x in row] # subtract one row from another def sub(row_left, row_right): return [a - b for (a, b) in zip(row_left, row_right)] # calculate the row echelon form of the matrix def echelonify(rw, i, m): for j, row in enum...
def mul(row, num): return [x * num for x in row] def sub(row_left, row_right): return [a - b for (a, b) in zip(row_left, row_right)] def echelonify(rw, i, m): for (j, row) in enumerate(m[i + 1:]): j += 1 if rw[i] != 0: m[j + i] = sub(row, mul(rw, row[i] / rw[i])) return rw ...
ans = 0 a=input() for _ in range(int(input())): s=input() for start in range(10): for j in range(len(a)): if a[j] != s[(start+j)%10]: break else: ans+=1 break print(ans)
ans = 0 a = input() for _ in range(int(input())): s = input() for start in range(10): for j in range(len(a)): if a[j] != s[(start + j) % 10]: break else: ans += 1 break print(ans)
#!/usr/bin/env python3 """ Problem : Double-Degree Array URL : http://rosalind.info/problems/ddeg/ Author : David P. Perkins """ if __name__=="__main__": with open("ddegIn.txt", "r") as infile, open("ddegOut.txt", "w") as outfile: nodeCount = int(infile.readline().split()[0]) adjl = {x:set(...
""" Problem : Double-Degree Array URL : http://rosalind.info/problems/ddeg/ Author : David P. Perkins """ if __name__ == '__main__': with open('ddegIn.txt', 'r') as infile, open('ddegOut.txt', 'w') as outfile: node_count = int(infile.readline().split()[0]) adjl = {x: set() for x in range(1, ...
# Easy # Runtime: 32 ms, faster than 73.01% of Python3 online submissions for Count and Say. # Memory Usage: 12.9 MB, less than 100.00% of Python3 online submissions for Count and Say. class Solution: def countAndSay(self, n: int) -> str: def count_and_say(n): if n == 1: return ...
class Solution: def count_and_say(self, n: int) -> str: def count_and_say(n): if n == 1: return '1' cur_s = '' idx = 0 cur_sum = 0 s = count_and_say(n - 1) for (i, ch) in enumerate(s): if ch != s[idx]: ...
class IBeacon(): def __init__(self, driver_instace) -> None: self.ble_driver_instace = driver_instace def setUUID(self, uuid : str) -> None: "uuid is 16 bytes should be represented as a string of hex-decimal format: XX XX XX XX ..." self.uuid = uuid def setMajor(self, major : str...
class Ibeacon: def __init__(self, driver_instace) -> None: self.ble_driver_instace = driver_instace def set_uuid(self, uuid: str) -> None: """uuid is 16 bytes should be represented as a string of hex-decimal format: XX XX XX XX ...""" self.uuid = uuid def set_major(self, major: st...
class PlannerEventHandler(object): pass def ProblemNotImplemented(self): return False def StartedPlanning(self): return True def SubmittedPipeline(self, pipeline): return True def RunningPipeline(self, pipeline): return True def CompletedPipeline(self, pipeli...
class Plannereventhandler(object): pass def problem_not_implemented(self): return False def started_planning(self): return True def submitted_pipeline(self, pipeline): return True def running_pipeline(self, pipeline): return True def completed_pipeline(self, ...
def minSubArrayLen(target, nums): length = list() for i in range(len(nums)): remain = target - nums[i] if remain <= 0: length.append(1) continue for j in range(i+1, len(nums)): remain = remain - nums[j] if remain <= 0: len...
def min_sub_array_len(target, nums): length = list() for i in range(len(nums)): remain = target - nums[i] if remain <= 0: length.append(1) continue for j in range(i + 1, len(nums)): remain = remain - nums[j] if remain <= 0: ...
''' Created on Apr 23, 2021 @author: Jimmy Palomino ''' def Region(main): """This function creates the region and set the boundaries to the machine analysis by FEM. Args: main (Dic): Main Dictionary than contain the necessary information. Returns: Dic: unmodified main dictionary. ...
""" Created on Apr 23, 2021 @author: Jimmy Palomino """ def region(main): """This function creates the region and set the boundaries to the machine analysis by FEM. Args: main (Dic): Main Dictionary than contain the necessary information. Returns: Dic: unmodified main dictionary. ...
# -*- coding: UTF-8 -*- class Shared(object): ''' Class used for /hana/shared attributes. Attributes and methods are passed to other LVM Classes. ''' name = 'shared' vg_physical_extent_size = '-s 1M' vg_data_alignment = '--dataalignment 1M' vg_args = vg_physical_extent...
class Shared(object): """ Class used for /hana/shared attributes. Attributes and methods are passed to other LVM Classes. """ name = 'shared' vg_physical_extent_size = '-s 1M' vg_data_alignment = '--dataalignment 1M' vg_args = vg_physical_extent_size + ' ' + vg_data_alignment lv_size = '-l 10...
class Solution: def longestCommonPrefix(self, strs: List[str]) -> str: shortest = min(strs, key=len) longest_common = "" for idx, char in enumerate(shortest): for word in strs: if word[idx] != char: return longest_common longest_co...
class Solution: def longest_common_prefix(self, strs: List[str]) -> str: shortest = min(strs, key=len) longest_common = '' for (idx, char) in enumerate(shortest): for word in strs: if word[idx] != char: return longest_common longes...
class Solution: def uniqueOccurrences(self, arr: List[int]) -> bool: dict = {} for i in arr : if i in dict : dict[i] += 1 else : dict[i] = 1 count = 0 s = set(dict.values()) ns = len(s) nl = len(...
class Solution: def unique_occurrences(self, arr: List[int]) -> bool: dict = {} for i in arr: if i in dict: dict[i] += 1 else: dict[i] = 1 count = 0 s = set(dict.values()) ns = len(s) nl = len(dict.values()) ...
test = { 'name': 'q1d', 'points': 1, 'suites': [ { 'cases': [ {'code': ">>> species_by_island.labels == ('species', 'Biscoe', 'Dream', 'Torgersen')\nTrue", 'hidden': False, 'locked': False}, {'code': ">>> np.all(species_by_island.column('Biscoe') == np.array([44, 0, 11...
test = {'name': 'q1d', 'points': 1, 'suites': [{'cases': [{'code': ">>> species_by_island.labels == ('species', 'Biscoe', 'Dream', 'Torgersen')\nTrue", 'hidden': False, 'locked': False}, {'code': ">>> np.all(species_by_island.column('Biscoe') == np.array([44, 0, 119]))\nTrue", 'hidden': False, 'locked': False}], 'score...
# objects here will be mixed into the dynamically created asset type classes # based on name. # This lets us extend certain asset types without having to give up the generic # dynamic meta implementation class Attachment(object): def set_blob(self, blob): return self._v1_v1meta.set_attachment_...
class Attachment(object): def set_blob(self, blob): return self._v1_v1meta.set_attachment_blob(self, blob) def get_blob(self): return self._v1_v1meta.get_attachment_blob(self) file_data = property(get_blob, set_blob) special_classes = locals()
LOG_EPOCH = 'epoch' LOG_TRAIN_LOSS = 'train_loss' LOG_TRAIN_ACC = 'train_acc' LOG_VAL_LOSS = 'val_loss' LOG_VAL_ACC = 'val_acc' LOG_FIELDS = [LOG_EPOCH, LOG_TRAIN_LOSS, LOG_TRAIN_ACC, LOG_VAL_LOSS, LOG_VAL_ACC] LOG_COLOR_HEADER = '\033[95m' LOG_COLOR_OKBLUE = '\033[94m' LOG_COLOR_OKCYAN = '\033[96m' LOG_COLOR_OKGREEN =...
log_epoch = 'epoch' log_train_loss = 'train_loss' log_train_acc = 'train_acc' log_val_loss = 'val_loss' log_val_acc = 'val_acc' log_fields = [LOG_EPOCH, LOG_TRAIN_LOSS, LOG_TRAIN_ACC, LOG_VAL_LOSS, LOG_VAL_ACC] log_color_header = '\x1b[95m' log_color_okblue = '\x1b[94m' log_color_okcyan = '\x1b[96m' log_color_okgreen =...
""" Test module for learning python packaging. """ def my_sum(arg): """ Sums the arguments and returns the sum. """ total = 0 for val in arg: total += val return total class MySum(object): # pylint: disable=too-few-public-methods """ MySum class """ @staticmethod ...
""" Test module for learning python packaging. """ def my_sum(arg): """ Sums the arguments and returns the sum. """ total = 0 for val in arg: total += val return total class Mysum(object): """ MySum class """ @staticmethod def my_sum(arg): """ Sums ...
def load(h): return ({'abbr': 1, 'code': 1, 'title': 'PRES Pressure [hPa]'}, {'abbr': 2, 'code': 2, 'title': 'psnm Pressure reduced to MSL [hPa]'}, {'abbr': 3, 'code': 3, 'title': 'tsps Pressure tendency [Pa/s]'}, {'abbr': 4, 'code': 4, 'title': 'var4 undefined'}, {'a...
def load(h): return ({'abbr': 1, 'code': 1, 'title': 'PRES Pressure [hPa]'}, {'abbr': 2, 'code': 2, 'title': 'psnm Pressure reduced to MSL [hPa]'}, {'abbr': 3, 'code': 3, 'title': 'tsps Pressure tendency [Pa/s]'}, {'abbr': 4, 'code': 4, 'title': 'var4 undefined'}, {'abbr': 5, 'code': 5, 'title': 'var5 undefined'}, ...
class Settings: params = () def __init__(self, params): self.params = params
class Settings: params = () def __init__(self, params): self.params = params
urlChatAdd = '/chat/add' urlUserAdd = '/chat/adduser' urlGetUsers = '/chat/getusers/' urlGetChats = '/chat/chats' urlPost = '/chat/post' urlHist = '/chat/hist' urlAuth = '/chat/auth'
url_chat_add = '/chat/add' url_user_add = '/chat/adduser' url_get_users = '/chat/getusers/' url_get_chats = '/chat/chats' url_post = '/chat/post' url_hist = '/chat/hist' url_auth = '/chat/auth'
""" This module contains the definitions for Bike and its subclasses Bicycle and Motorbike. """ class Bike: """ Class defining a bike that can be ridden and have its gear changed. Attributes: seats: number of seats the bike has gears: number of gears the bike has """ def __init__...
""" This module contains the definitions for Bike and its subclasses Bicycle and Motorbike. """ class Bike: """ Class defining a bike that can be ridden and have its gear changed. Attributes: seats: number of seats the bike has gears: number of gears the bike has """ def __init__(...
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the Li...
names = {'Cisco': 'cwom'} mappings = {'cwom': {'1.0': '5.8.3.1', '1.1': '5.9.1', '1.1.3': '5.9.3', '1.2.0': '6.0.3', '1.2.1': '6.0.6', '1.2.2': '6.0.9', '1.2.3': '6.0.11.1', '2.0.0': '6.1.1', '2.0.1': '6.1.6', '2.0.2': '6.1.8', '2.0.3': '6.1.12', '2.1.0': '6.2.2', '2.1.1': '6.2.7.1', '2.1.2': '6.2.10', '2.2': '6.3.2', ...
try: with open('../../../assets/img_cogwheel_argb.bin','rb') as f: cogwheel_img_data = f.read() except: try: with open('images/img_cogwheel_rgb565.bin','rb') as f: cogwheel_img_data = f.read() except: print("Could not find binary img_cogwheel file") # create the cogwheel image data cogwheel_im...
try: with open('../../../assets/img_cogwheel_argb.bin', 'rb') as f: cogwheel_img_data = f.read() except: try: with open('images/img_cogwheel_rgb565.bin', 'rb') as f: cogwheel_img_data = f.read() except: print('Could not find binary img_cogwheel file') cogwheel_img_dsc = l...
class Solution(object): def calculate(self, s): """ :type s: str :rtype: int """ if not s: return 0 s = s.replace(" ", "") n = len(s) stack = [] num = 0 sign = '+' for i in range(n): if s[i].isdigit(): ...
class Solution(object): def calculate(self, s): """ :type s: str :rtype: int """ if not s: return 0 s = s.replace(' ', '') n = len(s) stack = [] num = 0 sign = '+' for i in range(n): if s[i].isdigit(): ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Feb 23 13:11:49 2020 @author: abdulroqeeb """ host = "127.0.0.1" port = 7497 ticktypes = { 66: "Bid", 67: "Ask", 68: "Last", 69: "Bid Size", 70: "Ask Size", 71: "Last Size", 72: "High", ...
""" Created on Sun Feb 23 13:11:49 2020 @author: abdulroqeeb """ host = '127.0.0.1' port = 7497 ticktypes = {66: 'Bid', 67: 'Ask', 68: 'Last', 69: 'Bid Size', 70: 'Ask Size', 71: 'Last Size', 72: 'High', 73: 'Low', 74: 'Volume', 75: 'Prior Close', 76: 'Prior Open', 88: 'Timestamp'} account_details_params = ['AccountCo...
int1 = int(input('informe o inteiro 1 ')) int2 = int(input('informe o inteiro 2 ')) real = float(input('informe o real ')) print('a %2.f' %((int1*2)*(int2/2))) print('b %2.f' %((int1*3)+(real))) print('c %2.f' %(real**3))
int1 = int(input('informe o inteiro 1 ')) int2 = int(input('informe o inteiro 2 ')) real = float(input('informe o real ')) print('a %2.f' % (int1 * 2 * (int2 / 2))) print('b %2.f' % (int1 * 3 + real)) print('c %2.f' % real ** 3)
data = ( 'ruk', # 0x00 'rut', # 0x01 'rup', # 0x02 'ruh', # 0x03 'rweo', # 0x04 'rweog', # 0x05 'rweogg', # 0x06 'rweogs', # 0x07 'rweon', # 0x08 'rweonj', # 0x09 'rweonh', # 0x0a 'rweod', # 0x0b 'rweol', # 0x0c 'rweolg', # 0x0d 'rweolm', # 0x0e 'rweolb', ...
data = ('ruk', 'rut', 'rup', 'ruh', 'rweo', 'rweog', 'rweogg', 'rweogs', 'rweon', 'rweonj', 'rweonh', 'rweod', 'rweol', 'rweolg', 'rweolm', 'rweolb', 'rweols', 'rweolt', 'rweolp', 'rweolh', 'rweom', 'rweob', 'rweobs', 'rweos', 'rweoss', 'rweong', 'rweoj', 'rweoc', 'rweok', 'rweot', 'rweop', 'rweoh', 'rwe', 'rweg', 'rwe...
class PHPWriter: def __init__(self, constants): self.constants = constants def write(self, out): out.write("<?php\n") out.write("/* This file was generated by generate_constants. */\n\n") for enum in self.constants.enum_values.values(): out.write("\n") f...
class Phpwriter: def __init__(self, constants): self.constants = constants def write(self, out): out.write('<?php\n') out.write('/* This file was generated by generate_constants. */\n\n') for enum in self.constants.enum_values.values(): out.write('\n') f...
__version__ = "170130" __authors__ = "Ryo KOBAYASHI" __email__ = "kobayashi.ryo@nitech.ac.jp" class Machine(): """ Parent class of any other machine classes. """ QUEUES = { 'batch': {'num_nodes': 12, 'default_sec': 86400, 'limit_sec': 604800}, 'default':{'num_nodes': 12, 'default_se...
__version__ = '170130' __authors__ = 'Ryo KOBAYASHI' __email__ = 'kobayashi.ryo@nitech.ac.jp' class Machine: """ Parent class of any other machine classes. """ queues = {'batch': {'num_nodes': 12, 'default_sec': 86400, 'limit_sec': 604800}, 'default': {'num_nodes': 12, 'default_sec': 86400, 'limit_sec'...
Amount = float BenefitName = str Email = str Donor = Email PaymentId = str def isnotemptyinstance(value, type): if not isinstance(value, type): return False # None returns false if isinstance(value, str): return (len(value.strip()) != 0) elif isinstance(value, int): return (value...
amount = float benefit_name = str email = str donor = Email payment_id = str def isnotemptyinstance(value, type): if not isinstance(value, type): return False if isinstance(value, str): return len(value.strip()) != 0 elif isinstance(value, int): return value != 0 elif isinstance...
# model settings model = dict( type='ImageClassifier', backbone=dict( type='SVT', arch='base', in_channels=3, out_indices=(3, ), qkv_bias=True, norm_cfg=dict(type='LN'), norm_after_stage=[False, False, False, True], drop_rate=0.0, attn_drop...
model = dict(type='ImageClassifier', backbone=dict(type='SVT', arch='base', in_channels=3, out_indices=(3,), qkv_bias=True, norm_cfg=dict(type='LN'), norm_after_stage=[False, False, False, True], drop_rate=0.0, attn_drop_rate=0.0, drop_path_rate=0.3), neck=dict(type='GlobalAveragePooling'), head=dict(type='LinearClsHea...
nome = input('Digite seu nome: ') def saudar(x): print(f'Bem-vindo, {x}!') saudar(nome)
nome = input('Digite seu nome: ') def saudar(x): print(f'Bem-vindo, {x}!') saudar(nome)
"""Anagram utilities""" def find_anagrams(word: str, candidates: list) -> list: """Detect anagrams on a list against a reference word Args: word: the reference word candidates: the list of words to be compared Returns: A new list with the anagrams found. """ low_word =...
"""Anagram utilities""" def find_anagrams(word: str, candidates: list) -> list: """Detect anagrams on a list against a reference word Args: word: the reference word candidates: the list of words to be compared Returns: A new list with the anagrams found. """ low_word =...
class Solution: def sortedSquares(self, nums: List[int]) -> List[int]: sq_nums = [] for num in nums: sq_nums.append(num ** 2) sq_nums.sort() return sq_nums
class Solution: def sorted_squares(self, nums: List[int]) -> List[int]: sq_nums = [] for num in nums: sq_nums.append(num ** 2) sq_nums.sort() return sq_nums
class Stack(object): def __init__(self): self.items = [] self.min_value = None def push(self, item): if not self.min_value or self.min_value > item: self.min_value = item self.items.append(item) def pop(self): self.items.pop() def get_min_val...
class Stack(object): def __init__(self): self.items = [] self.min_value = None def push(self, item): if not self.min_value or self.min_value > item: self.min_value = item self.items.append(item) def pop(self): self.items.pop() def get_min_value(sel...
_base_ = [ '../../_base_/models/resnet50.py', '../../_base_/datasets/imagenet.py', '../../_base_/schedules/sgd_steplr-100e.py', '../../_base_/default_runtime.py', ] # model settings model = dict(backbone=dict(norm_cfg=dict(type='SyncBN'))) # dataset settings data = dict( imgs_per_gpu=64, # total ...
_base_ = ['../../_base_/models/resnet50.py', '../../_base_/datasets/imagenet.py', '../../_base_/schedules/sgd_steplr-100e.py', '../../_base_/default_runtime.py'] model = dict(backbone=dict(norm_cfg=dict(type='SyncBN'))) data = dict(imgs_per_gpu=64, train=dict(data_source=dict(ann_file='data/imagenet/meta/train_1percent...
def test_add_to_basket(browser): link = 'http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/' browser.get(link) assert browser.find_element_by_class_name('btn-add-to-basket').is_displayed(), f'Basket button not found'
def test_add_to_basket(browser): link = 'http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/' browser.get(link) assert browser.find_element_by_class_name('btn-add-to-basket').is_displayed(), f'Basket button not found'
class TaskAnswer: # list of tuple: (vertice_source, vertice_destination, moved_value) _steps = [] def get_steps(self) -> list: return self._steps def add_step(self, source: int, destination: int, value: float): step = (source, destination, value) self._steps.append(step) ...
class Taskanswer: _steps = [] def get_steps(self) -> list: return self._steps def add_step(self, source: int, destination: int, value: float): step = (source, destination, value) self._steps.append(step) def print(self): for step in self._steps: (source, de...
class Solution: def getDescentPeriods(self, prices: List[int]) -> int: curr = result = 1 for i in range(1, len(prices)): if prices[i] + 1 == prices[i-1]: curr += 1 else: curr = 1 result += curr return result
class Solution: def get_descent_periods(self, prices: List[int]) -> int: curr = result = 1 for i in range(1, len(prices)): if prices[i] + 1 == prices[i - 1]: curr += 1 else: curr = 1 result += curr return result
print("####################################################") print("#FILENAME:\t\ta1p1.py\t\t\t #") print("#ASSIGNMENT:\t\tHomework Assignment 1 Pt. 1#") print("#COURSE/SECTION:\tCIS 3389.251\t\t #") print("#DUE DATE:\t\tWednesday, 12.February 2020#") print("####################################################\n\...
print('####################################################') print('#FILENAME:\t\ta1p1.py\t\t\t #') print('#ASSIGNMENT:\t\tHomework Assignment 1 Pt. 1#') print('#COURSE/SECTION:\tCIS 3389.251\t\t #') print('#DUE DATE:\t\tWednesday, 12.February 2020#') print('####################################################\n\n...
#!/usr/bin/env python # encoding: utf-8 class Solution(object): def countBits(self, num): """ :type num: int :rtype: List[int] """ dp = [0]*(num+1) for i in xrange(num+1): dp[i] = dp[i/2] if i%2 == 0 else dp[i/2]+1 return dp
class Solution(object): def count_bits(self, num): """ :type num: int :rtype: List[int] """ dp = [0] * (num + 1) for i in xrange(num + 1): dp[i] = dp[i / 2] if i % 2 == 0 else dp[i / 2] + 1 return dp
#!/usr/local/bin/python3 # Python Challenge - 1 # http://www.pythonchallenge.com/pc/def/map.html # Keyword: ocr def main(): ''' Hint: K -> M O -> Q E -> G Everybody thinks twice before solving this. ''' cipher_text = ('g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcp' ...
def main(): """ Hint: K -> M O -> Q E -> G Everybody thinks twice before solving this. """ cipher_text = "g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. ...
def check_next_num(inp, j): for i in range(j, len(inp)): elm = inp[i] if len(inp) > i+1: if inp[i+1] == (elm+1): check_next_num(inp, i+1) else: if j == 0: return i return i else: return le...
def check_next_num(inp, j): for i in range(j, len(inp)): elm = inp[i] if len(inp) > i + 1: if inp[i + 1] == elm + 1: check_next_num(inp, i + 1) else: if j == 0: return i return i else: ret...
def rotate(str, d, mag): if (d=="L"): return str[mag:] + str[0:mag] elif (d=="R"): return str[len(str)-mag:] + str[0: len(str)-mag] def checkAnagram(str1, str2): if(sorted(str1)==sorted(str2)): return True else: return False def subString(s, n, ans): for i in r...
def rotate(str, d, mag): if d == 'L': return str[mag:] + str[0:mag] elif d == 'R': return str[len(str) - mag:] + str[0:len(str) - mag] def check_anagram(str1, str2): if sorted(str1) == sorted(str2): return True else: return False def sub_string(s, n, ans): for i in ...
""" You are asked to ensure that the first and last names of people begin with a capital letter in their passports. For example, alison heck should be capitalised correctly as Alison Heck. Given a full name, your task is to capitalize the name appropriately. Input Format A single line of input containing the full na...
""" You are asked to ensure that the first and last names of people begin with a capital letter in their passports. For example, alison heck should be capitalised correctly as Alison Heck. Given a full name, your task is to capitalize the name appropriately. Input Format A single line of input containing the full na...
number = int(input("Pick a number? ")) for i in range(5): number = number + number print(number)
number = int(input('Pick a number? ')) for i in range(5): number = number + number print(number)
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
maximum_secret_length = 20 maximum_container_app_name_length = 40 short_polling_interval_secs = 3 long_polling_interval_secs = 10 log_analytics_rp = 'Microsoft.OperationalInsights' container_apps_rp = 'Microsoft.App' max_env_per_location = 2 microsoft_secret_setting_name = 'microsoft-provider-authentication-secret' fac...
# Author=====>>>Nipun Garg<<<===== # Problem Statement - Given number of jobs and number of applicants # And for each applicant given that wether each applicant is # eligible to get the job or not in the form of matrix # Return 1 if a person can get the job def dfs(graph, applicant, visited, result,nApplicants,nJob...
def dfs(graph, applicant, visited, result, nApplicants, nJobs): for i in range(0, nJobs): if graph[applicant][i] == 1 and (not visited[i]): visited[i] = 1 if result[i] < 0 or dfs(graph, result[i], visited, result, nApplicants, nJobs): result[i] = applicant ...
# 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 tree2str(self, t: TreeNode) -> str: if t is None: return "" ...
class Solution: def tree2str(self, t: TreeNode) -> str: if t is None: return '' if t.left is None and t.right is None: return str(t.val) + '' if t.right is None: return str(t.val) + '(' + str(self.tree2str(t.left)) + ')' return str(t.val) + '(' + ...
# get distinct characters and their count in a String string = input("Enter String: ") c = 0 for i in range(65, 91): c = 0 for j in range(0, len(string)): if(string[j] == chr(i)): c += 1 if c > 0: print("", chr(i), " is ", c, " times.") c = 0 for i in range(97, 123): c = 0...
string = input('Enter String: ') c = 0 for i in range(65, 91): c = 0 for j in range(0, len(string)): if string[j] == chr(i): c += 1 if c > 0: print('', chr(i), ' is ', c, ' times.') c = 0 for i in range(97, 123): c = 0 for j in range(0, len(string)): if string[j] ...
class SearchPath: def __init__(self, path=None): if path is None: self._path = [] else: self._path = path def branch_off(self, label, p): path = self._path + [(label, p)] return SearchPath(path) @property def labels(self): return [label f...
class Searchpath: def __init__(self, path=None): if path is None: self._path = [] else: self._path = path def branch_off(self, label, p): path = self._path + [(label, p)] return search_path(path) @property def labels(self): return [label...
class Bot: ''' state - state of the game returns a move ''' def move(self, state, symbol): raise NotImplementedError('Abstractaaa') def get_name(self): raise NotImplementedError('Abstractaaa')
class Bot: """ state - state of the game returns a move """ def move(self, state, symbol): raise not_implemented_error('Abstractaaa') def get_name(self): raise not_implemented_error('Abstractaaa')
__author__ = 'shukkkur' ''' https://codeforces.com/problemset/problem/581/A A. Vasya the Hipster ''' red, blue = map(int, input().split()) total = red + blue a = min(red, blue) total -= 2 * a b = total // 2 print(a, b)
__author__ = 'shukkkur' '\nhttps://codeforces.com/problemset/problem/581/A\nA. Vasya the Hipster\n' (red, blue) = map(int, input().split()) total = red + blue a = min(red, blue) total -= 2 * a b = total // 2 print(a, b)
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def dnsmasq_dependencies(): http_archive( name = "dnsmasq", urls = ["http://www.thekelleys.org.uk/dnsmasq/dnsmasq-2.78.tar.xz"], sha256 = "89949f438c74b0c7543f06689c319484bd126cc4b1f8c745c742ab397681252b", build_fi...
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') def dnsmasq_dependencies(): http_archive(name='dnsmasq', urls=['http://www.thekelleys.org.uk/dnsmasq/dnsmasq-2.78.tar.xz'], sha256='89949f438c74b0c7543f06689c319484bd126cc4b1f8c745c742ab397681252b', build_file='//dnsmasq:BUILD.import')
file = open("input") lines = file.readlines() pattern_len = len(lines[0]) def part1(lines, right, down): count = 0 pattern_len = len(lines[0]) x = 0 y = 0 while y < len(lines) - down: x += right y += down if lines[y][x % (pattern_len - 1)] == "#": ...
file = open('input') lines = file.readlines() pattern_len = len(lines[0]) def part1(lines, right, down): count = 0 pattern_len = len(lines[0]) x = 0 y = 0 while y < len(lines) - down: x += right y += down if lines[y][x % (pattern_len - 1)] == '#': count += 1 ...
""" Expect Utility -------------- Regardless of comment type, all tests in this file will be detected. We will demonstrate that expect can handle several edge cases, accommodate regular doctest formats, and detect inline tests. >>> x = 4 >>> x 4 >>> 3+5 # comments 8 >>> 6+x # wrong! 5 >>> is_proper('()') True """ ...
""" Expect Utility -------------- Regardless of comment type, all tests in this file will be detected. We will demonstrate that expect can handle several edge cases, accommodate regular doctest formats, and detect inline tests. >>> x = 4 >>> x 4 >>> 3+5 # comments 8 >>> 6+x # wrong! 5 >>> is_proper('()') True """ ...
# input the length of array n = int(input()) # input the elements of array ar = [int(x) for x in input().strip().split(' ')] c = [0]*100 for a in ar : c[a] += 1 s = '' # print the sorted list as a single line of space-separated elements for x in range(0,100) : for i in range(0,c[x]) : s += ' ' + ...
n = int(input()) ar = [int(x) for x in input().strip().split(' ')] c = [0] * 100 for a in ar: c[a] += 1 s = '' for x in range(0, 100): for i in range(0, c[x]): s += ' ' + str(x) print(s[1:])
full_dict = { 'daterecieved': 'entry daterecieved', 'poploadslip' : 'entry poploadslip', 'count' : 'entry 1' , 'tm9_ticket' : 'entry tm9_ticket', 'disposition_fmanum' : 'entry disposition_fmanum', 'owner' : 'entry ownerName', '...
full_dict = {'daterecieved': 'entry daterecieved', 'poploadslip': 'entry poploadslip', 'count': 'entry 1', 'tm9_ticket': 'entry tm9_ticket', 'disposition_fmanum': 'entry disposition_fmanum', 'owner': 'entry ownerName', 'haulingcontractor': 'entry hauled by', 'numpcsreceived': 'entry num of pieces', 'blocknum': 'entry B...
"""smp_base/__init__.py .. todo:: remove actinf tag from base learners .. todo:: abstract class from andi / smp_control to check for api conformity? .. todo:: for module in rlspy igmm kohonone otl ; do git submodule ... """
"""smp_base/__init__.py .. todo:: remove actinf tag from base learners .. todo:: abstract class from andi / smp_control to check for api conformity? .. todo:: for module in rlspy igmm kohonone otl ; do git submodule ... """
# HEAD # Python Functions - *args # DESCRIPTION # Describes # capturing all arguments as *args (tuple) # # RESOURCES # # Arguments (any number during invocation) can also be # caught as a sequence of arguments - tuple using *args # Order does matter for unnamed arguments list and makes for # inde...
def print_unnamed_args(*args): print('3. printUnnamedArgs', args) for x in enumerate(args): print(x) print_unnamed_args([1, 2, 3], [4, 5, 6])
class Luhn: def __init__(self, card_num: str): self._reversed_card_num = card_num.replace(' ', '')[::-1] self._even_digits = self._reversed_card_num[1::2] self._odd_digits = self._reversed_card_num[::2] def valid(self) -> bool: if str.isnumeric(self._reversed_card_num) and len(s...
class Luhn: def __init__(self, card_num: str): self._reversed_card_num = card_num.replace(' ', '')[::-1] self._even_digits = self._reversed_card_num[1::2] self._odd_digits = self._reversed_card_num[::2] def valid(self) -> bool: if str.isnumeric(self._reversed_card_num) and len(...
""" Problem name: ThePalindrome Class: SRM 428, Division II Level One Description: https://community.topcoder.com/stat?c=problem_statement&pm=10182 """ def solve(args): """ Simply reverse the string and find a match. When the match is found, continue it to the end. If the end is reached, then the match...
""" Problem name: ThePalindrome Class: SRM 428, Division II Level One Description: https://community.topcoder.com/stat?c=problem_statement&pm=10182 """ def solve(args): """ Simply reverse the string and find a match. When the match is found, continue it to the end. If the end is reached, then the matchi...
"""Kata url: https://www.codewars.com/kata/51fc12de24a9d8cb0e000001.""" def valid_ISBN10(isbn: str) -> bool: if len(isbn) != 10: return False if not isbn[:-1].isdigit(): return False if not (isbn[-1].isdigit() or isbn[-1] == 'X'): return False return not sum( int(x, ...
"""Kata url: https://www.codewars.com/kata/51fc12de24a9d8cb0e000001.""" def valid_isbn10(isbn: str) -> bool: if len(isbn) != 10: return False if not isbn[:-1].isdigit(): return False if not (isbn[-1].isdigit() or isbn[-1] == 'X'): return False return not sum((int(x, 16) * (c + 1...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Apr 27 11:20:36 2019 @author: melzanaty """ #################################################### # Quiz: Check for Prime Numbers #################################################### # ''' # Write code to check if the numbers provided in the list check_...
""" Created on Sat Apr 27 11:20:36 2019 @author: melzanaty """ check_prime = [3, 26, 39, 51, 53, 57, 79, 85] for num in check_prime: for i in range(2, num): if num % i == 0: print('{} is NOT a prime number, because {} is a factor of {}'.format(num, i, num)) break if i == num...
# Copyright 2019-present, GraphQL Foundation # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. def title(s): '''Capitalize the first character of s.''' return s[0].capitalize() + s[1:] def camel(s): '''Lowercase the first charac...
def title(s): """Capitalize the first character of s.""" return s[0].capitalize() + s[1:] def camel(s): """Lowercase the first character of s.""" return s[0].lower() + s[1:] def snake(s): """Convert from title or camelCase to snake_case.""" if len(s) < 2: return s.lower() out = s[0...