content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class CourseType(): __doc__ = "Type of degree, e.g. BA, BEng, BSc" possibleCourseTypes = ["BA", "BSc"] #TODO extend to values from http://typesofdegrees.org/ def __init__(self, name, accepts, singleHons = 0, jointHons = 0): if self.checkName(name): self._name = name self.accepts = accepts self.singleHons = singleHons self.jointHons = jointHons @property def name(self): return self._name @name.setter def name(self, value): if self.checkName(value): self._name = name # Must be one of possibleCourseTypes def checkName(self, name): if (name in self.possibleCourseTypes): return True else: raise ValueError("Name must be one of: ", self.possibleCourseTypes)
class Coursetype: __doc__ = 'Type of degree, e.g. BA, BEng, BSc' possible_course_types = ['BA', 'BSc'] def __init__(self, name, accepts, singleHons=0, jointHons=0): if self.checkName(name): self._name = name self.accepts = accepts self.singleHons = singleHons self.jointHons = jointHons @property def name(self): return self._name @name.setter def name(self, value): if self.checkName(value): self._name = name def check_name(self, name): if name in self.possibleCourseTypes: return True else: raise value_error('Name must be one of: ', self.possibleCourseTypes)
def collatz_len(n): ct = 1 while n != 1: if n % 2 == 0: n = n/2 else: n = 3*n+1 ct += 1 return ct len_max = i_max = 0 for i in range(1, 1000001): current_len = collatz_len(i) if current_len > len_max: len_max = current_len i_max = i print(i_max)
def collatz_len(n): ct = 1 while n != 1: if n % 2 == 0: n = n / 2 else: n = 3 * n + 1 ct += 1 return ct len_max = i_max = 0 for i in range(1, 1000001): current_len = collatz_len(i) if current_len > len_max: len_max = current_len i_max = i print(i_max)
# Sorts a Python list in ascending order using the quick sort # algorithm def quickSort(theList): n = len(theList) recQuickSort(theList, 0, n-1) # The recursive "in-place" implementation def recQuickSort(theList, first, last): # Check the base case (range is trivially sorted) if first >= last: return else: # Partition the list and obtain the pivot position pos = partitionSeq(theList, first, last) # Repeat the process on the two sublists recQuickSort(theList, first, pos - 1) recQuickSort(theList, pos + 1, last) # Partitions the list using the first key as the pivot def partitionSeq(theList, first, last): # Save a copy of the pivot value. pivot = theList[first] # first element of range is pivot # Find the pivot position and move the elements around it left = first + 1 # will scan rightward right = last # will scan leftward while left <= right: # Scan until reaches value equal or larger than pivot (or # right marker) while left <= right and theList[left] < pivot: left += 1 # Scan until reaches value equal or smaller than pivot (or # left marker) while left <= right and theList[right] > pivot: right -= 1 # Scans did not strictly cross if left <= right: # swap values theList[left], theList[right] = theList[right], theList[left] # Shrink range (Recursion: Progress towards base case) left += 1 right -= 1 # Put the pivot in the proper position (marked by the right index) theList[first] , theList[right] = theList[right] , pivot # Return the index position of the pivot value. return right # Test code list_of_numbers = [12, 7, 9, 24, 7, 29, 5, 3, 11, 7] print('Input List:', list_of_numbers) quickSort(list_of_numbers) print('Sorted List:', list_of_numbers)
def quick_sort(theList): n = len(theList) rec_quick_sort(theList, 0, n - 1) def rec_quick_sort(theList, first, last): if first >= last: return else: pos = partition_seq(theList, first, last) rec_quick_sort(theList, first, pos - 1) rec_quick_sort(theList, pos + 1, last) def partition_seq(theList, first, last): pivot = theList[first] left = first + 1 right = last while left <= right: while left <= right and theList[left] < pivot: left += 1 while left <= right and theList[right] > pivot: right -= 1 if left <= right: (theList[left], theList[right]) = (theList[right], theList[left]) left += 1 right -= 1 (theList[first], theList[right]) = (theList[right], pivot) return right list_of_numbers = [12, 7, 9, 24, 7, 29, 5, 3, 11, 7] print('Input List:', list_of_numbers) quick_sort(list_of_numbers) print('Sorted List:', list_of_numbers)
class Time: max_hours = 23 max_minutes = 59 max_seconds = 59 def __init__(self, hours: int, minutes: int, seconds: int): self.hours = hours self.minutes = minutes self.seconds = seconds def set_time(self, hours, minutes, seconds): self.hours = hours self.minutes = minutes self.seconds = seconds def get_time(self): hh = str(self.hours) mm = str(self.minutes) ss = str(self.seconds) return f"{hh.zfill(2)}:{mm.zfill(2)}:{ss.zfill(2)}" def next_second(self): self.seconds = (self.seconds + 1) % 60 self.minutes = (self.minutes + int(self.seconds == 0)) % 60 self.hours = (self.hours + int(self.minutes == 0 and self.seconds == 0)) % 24 return self.get_time() # time = Time(9, 30, 59) # print(time.next_second()) # time = Time(10, 59, 59) # print(time.next_second()) time = Time(24, 59, 59) print(time.get_time()) print(time.next_second()) print(time.next_second()) print(time.next_second()) print(time.next_second()) print(time.next_second()) print(time.next_second())
class Time: max_hours = 23 max_minutes = 59 max_seconds = 59 def __init__(self, hours: int, minutes: int, seconds: int): self.hours = hours self.minutes = minutes self.seconds = seconds def set_time(self, hours, minutes, seconds): self.hours = hours self.minutes = minutes self.seconds = seconds def get_time(self): hh = str(self.hours) mm = str(self.minutes) ss = str(self.seconds) return f'{hh.zfill(2)}:{mm.zfill(2)}:{ss.zfill(2)}' def next_second(self): self.seconds = (self.seconds + 1) % 60 self.minutes = (self.minutes + int(self.seconds == 0)) % 60 self.hours = (self.hours + int(self.minutes == 0 and self.seconds == 0)) % 24 return self.get_time() time = time(24, 59, 59) print(time.get_time()) print(time.next_second()) print(time.next_second()) print(time.next_second()) print(time.next_second()) print(time.next_second()) print(time.next_second())
# 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 isValidBST(self, root: Optional[TreeNode]) -> bool: def subfun(root, minimal, maximal): if not root: return if root.val >= maximal or root.val <= minimal: self.out = False else: subfun(root.left, minimal, root.val) if self.out: subfun(root.right, root.val, maximal) self.out = True subfun(root, -inf, inf) return self.out
class Solution: def is_valid_bst(self, root: Optional[TreeNode]) -> bool: def subfun(root, minimal, maximal): if not root: return if root.val >= maximal or root.val <= minimal: self.out = False else: subfun(root.left, minimal, root.val) if self.out: subfun(root.right, root.val, maximal) self.out = True subfun(root, -inf, inf) return self.out
# Lambda funkcie # # Tato sekcia sluzi na precvicenie si lambda vyrazov # # Uloha 1: def make_square(): return(lambda x: x*x) # Uloha 2: def make_upper(): return(lambda x: x.upper()) # Uloha 3: def make_power(): return(lambda x, N: x ** N) # Uloha 4: def make_power2(N): return(lambda x: x ** N) # Uloha 5: def call_name(): return(lambda x, name: getattr(x, name)())
def make_square(): return lambda x: x * x def make_upper(): return lambda x: x.upper() def make_power(): return lambda x, N: x ** N def make_power2(N): return lambda x: x ** N def call_name(): return lambda x, name: getattr(x, name)()
def forever2(): pass forever(forever2)
def forever2(): pass forever(forever2)
def retrieve_page(page): if page > 3: return {"next_page": None, "items": []} return {"next_page": page + 1, "items": ["A", "B", "C"]} items = [] page = 1 while page is not None: page_result = retrieve_page(page) items += page_result["items"] page = page_result["next_page"] print(items) # ["A", "B", "C", "A", "B", "C", "A", "B", "C"]
def retrieve_page(page): if page > 3: return {'next_page': None, 'items': []} return {'next_page': page + 1, 'items': ['A', 'B', 'C']} items = [] page = 1 while page is not None: page_result = retrieve_page(page) items += page_result['items'] page = page_result['next_page'] print(items)
# SIEL type compliance cases require a specific control code prefixes. currently: (0 to 9)D, (0 to 9)E, ML21, ML22. COMPLIANCE_CASE_ACCEPTABLE_GOOD_CONTROL_CODES = "(^[0-9][DE].*$)|(^ML21.*$)|(^ML22.*$)" class ComplianceVisitTypes: FIRST_CONTACT = "first_contact" FIRST_VISIT = "first_visit" ROUTINE_VISIT = "routine_visit" REVISIT = "revisit" choices = [ (FIRST_CONTACT, "First contact"), (FIRST_VISIT, "First visit"), (ROUTINE_VISIT, "Routine visit"), (REVISIT, "Revisit"), ] @classmethod def to_str(cls, visit_type): return next(choice[1] for choice in cls.choices if choice[0] == visit_type) class ComplianceRiskValues: VERY_LOW = "very_low" LOWER = "lower" MEDIUM = "medium" HIGHER = "higher" HIGHEST = "highest" choices = ( (VERY_LOW, "Very low risk"), (LOWER, "Lower risk"), (MEDIUM, "Medium risk"), (HIGHER, "Higher risk"), (HIGHEST, "Highest risk"), ) @classmethod def to_str(cls, risk_value): for value, label in cls.choices: if value == risk_value: return label return ""
compliance_case_acceptable_good_control_codes = '(^[0-9][DE].*$)|(^ML21.*$)|(^ML22.*$)' class Compliancevisittypes: first_contact = 'first_contact' first_visit = 'first_visit' routine_visit = 'routine_visit' revisit = 'revisit' choices = [(FIRST_CONTACT, 'First contact'), (FIRST_VISIT, 'First visit'), (ROUTINE_VISIT, 'Routine visit'), (REVISIT, 'Revisit')] @classmethod def to_str(cls, visit_type): return next((choice[1] for choice in cls.choices if choice[0] == visit_type)) class Complianceriskvalues: very_low = 'very_low' lower = 'lower' medium = 'medium' higher = 'higher' highest = 'highest' choices = ((VERY_LOW, 'Very low risk'), (LOWER, 'Lower risk'), (MEDIUM, 'Medium risk'), (HIGHER, 'Higher risk'), (HIGHEST, 'Highest risk')) @classmethod def to_str(cls, risk_value): for (value, label) in cls.choices: if value == risk_value: return label return ''
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def mergeInBetween(self, list1: ListNode, a: int, b: int, list2: ListNode) -> ListNode: k=-1 pre=ListNode(-1000,list1) x=ListNode() y=ListNode() while pre: if pre.next and k==a-1: x=pre while k!=b: pre=pre.next k+=1 y=pre.next k+=1 pre=pre.next x.next=list2 print(x.val,y.val) while list2: if list2.next: list2=list2.next else: list2.next=y break return list1
class Solution: def merge_in_between(self, list1: ListNode, a: int, b: int, list2: ListNode) -> ListNode: k = -1 pre = list_node(-1000, list1) x = list_node() y = list_node() while pre: if pre.next and k == a - 1: x = pre while k != b: pre = pre.next k += 1 y = pre.next k += 1 pre = pre.next x.next = list2 print(x.val, y.val) while list2: if list2.next: list2 = list2.next else: list2.next = y break return list1
class Stack: def __init__(self): self.items = [] def push(self, item): self.items.append(item) def pop(self): return self.items.pop() def peek(self): return self.items[-1] def size(self): return len(self.items) def get_max(self): return max(self.items) def is_correct_bracket_seq(line): if len(line) % 2 != 0: return False stack = Stack() # opening_brackets = ('{','[','(') opening_brackets = { '{': 0, '[': 1, '(': 2 } # closing_brackets = ('}',']',')') closing_brackets = { '}': 0, ']': 1, ')': 2 } for ch in line: if ch in closing_brackets.keys() and stack.size() == 0: return False if ch in opening_brackets.keys(): stack.push(ch) if ch in closing_brackets.keys(): index_stack = opening_brackets[stack.peek()] index_new = closing_brackets[ch] # print(stack.peek(), ch) if index_new != index_stack: return False else: stack.pop() return True def main(): line = input().strip() print(is_correct_bracket_seq(line)) main()
class Stack: def __init__(self): self.items = [] def push(self, item): self.items.append(item) def pop(self): return self.items.pop() def peek(self): return self.items[-1] def size(self): return len(self.items) def get_max(self): return max(self.items) def is_correct_bracket_seq(line): if len(line) % 2 != 0: return False stack = stack() opening_brackets = {'{': 0, '[': 1, '(': 2} closing_brackets = {'}': 0, ']': 1, ')': 2} for ch in line: if ch in closing_brackets.keys() and stack.size() == 0: return False if ch in opening_brackets.keys(): stack.push(ch) if ch in closing_brackets.keys(): index_stack = opening_brackets[stack.peek()] index_new = closing_brackets[ch] if index_new != index_stack: return False else: stack.pop() return True def main(): line = input().strip() print(is_correct_bracket_seq(line)) main()
def palindrome(word, index): left = index right = len(word) - 1 - index if left >= right: return f"{word} is a palindrome" right_letter = word[len(word)-1-index] left_letter = word[index] if left_letter != right_letter: return f"{word} is not a palindrome" return palindrome(word, index + 1) print(palindrome("abcba", 0)) print((palindrome("peter", 0)))
def palindrome(word, index): left = index right = len(word) - 1 - index if left >= right: return f'{word} is a palindrome' right_letter = word[len(word) - 1 - index] left_letter = word[index] if left_letter != right_letter: return f'{word} is not a palindrome' return palindrome(word, index + 1) print(palindrome('abcba', 0)) print(palindrome('peter', 0))
# # PySNMP MIB module CISCO-HEALTH-MONITOR-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-HEALTH-MONITOR-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:59:45 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, SingleValueConstraint, ValueRangeConstraint, ConstraintsUnion, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ConstraintsIntersection") ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt") entPhysicalIndex, = mibBuilder.importSymbols("ENTITY-MIB", "entPhysicalIndex") SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString") ObjectGroup, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup") ModuleIdentity, TimeTicks, Bits, iso, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, MibIdentifier, IpAddress, Counter32, Unsigned32, Gauge32, Integer32, Counter64 = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "TimeTicks", "Bits", "iso", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "MibIdentifier", "IpAddress", "Counter32", "Unsigned32", "Gauge32", "Integer32", "Counter64") TruthValue, DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "DisplayString", "TextualConvention") ciscoHealthMonitorMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 243)) ciscoHealthMonitorMIB.setRevisions(('2003-09-12 12:30',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: ciscoHealthMonitorMIB.setRevisionsDescriptions(('Initial version of this MIB module.',)) if mibBuilder.loadTexts: ciscoHealthMonitorMIB.setLastUpdated('200309121230Z') if mibBuilder.loadTexts: ciscoHealthMonitorMIB.setOrganization('Cisco Systems, Inc.') if mibBuilder.loadTexts: ciscoHealthMonitorMIB.setContactInfo(' Cisco Systems Customer Service Postal: 170 W. Tasman Drive San Jose, CA 95134 USA Tel: +1 800 553-NETS E-mail: cs-healthmonitor@cisco.com') if mibBuilder.loadTexts: ciscoHealthMonitorMIB.setDescription("Health Monitor MIB module. The Health Monitor uses a model based on events of varying severity and frequency, and predefined rules, to generate a metric that represents a system's (and its subsystems') level of health. The events are typically internally generated notifications in response to detrimental or correctional changes in the state of the hardware or software of the system. Detrimental events are classified under one of the following severity levels: Catastrophic - Causes or leads to system failure Critical - Major subsystem or functionality failure High - Potential for major impact to important functions Medium - Potential for minor impact to functionality Low - Negligible impact to functionality Whilst correctional events fall under the following classification: Positive - Not a fault event. May cause or lead to the return of functionality This MIB module provides information for tracking occurrences of the above events, and presents the associated health metric for the system and its component subsystems.") ciscoHealthMonitorMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 243, 1)) class HealthLevel(TextualConvention, Gauge32): description = 'Reflects the health of a system or subsystem based on system events and predefined rules, expressed as a percentage. The UNITS clause associated with each object will indicate the degree of precision.' status = 'current' subtypeSpec = Gauge32.subtypeSpec + ValueRangeConstraint(0, 10000) ciscoHealthMonitorTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1), ) if mibBuilder.loadTexts: ciscoHealthMonitorTable.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorTable.setDescription('This table contains Health Monitor statistics for physical entities and their constituent hardware and/or software subsystems. The Health Monitor statistics present in each row provide information such as the computed health of the indicated subsystem and the number of faults it has experienced.') ciscoHealthMonitorEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1, 1), ).setIndexNames((0, "ENTITY-MIB", "entPhysicalIndex"), (1, "CISCO-HEALTH-MONITOR-MIB", "ciscoHealthMonitorSubsysName")) if mibBuilder.loadTexts: ciscoHealthMonitorEntry.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorEntry.setDescription('A Health Monitor statistics entry. The entPhysicalIndex identifies the physical entity (chassis or container), while the ciscoHealthMonitorSubsysName identifies by name the appropriate subsystem for which these statistics apply. If there are other entities such as peer routers or line cards then, in the context of this MIB, these are also defined to be in the same system. If these entities also run an instance of the Health Monitor then the summary information from the distributed Health Monitors is obtained here.') ciscoHealthMonitorSubsysName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1, 1, 1), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(1, 128))) if mibBuilder.loadTexts: ciscoHealthMonitorSubsysName.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorSubsysName.setDescription("A textual string containing the name of the hardware or software subsystem. A management station wishing to obtain summary statistics for a physical entity should use a value of 'system' for this object.") ciscoHealthMonitorHealth = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1, 1, 2), HealthLevel()).setUnits('0.01 percent').setMaxAccess("readonly") if mibBuilder.loadTexts: ciscoHealthMonitorHealth.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorHealth.setDescription('The computed current health of this subsystem on the specified entity. This health metric is based on predefined rules that specify how the health should be adjusted in response to certain events of varying severity and frequency. As these events are encountered by each subsystem or physical entity, the appropriate rules are applied and the health is modified accordingly.') ciscoHealthMonitorHealthNotifyEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1, 1, 3), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: ciscoHealthMonitorHealthNotifyEnable.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorHealthNotifyEnable.setDescription('Enables or disables health level notifications. When set to true(1), the ciscoHealthMonitorHealthLevel notification is enabled. When set to false(0), the ciscoHealthMonitorHealthLevel notification is disabled. If such a notification is desired, it is the responsibility of the management entity to ensure that the SNMP administrative model is configured in such a way as to allow the notification to be delivered.') ciscoHealthMonitorHealthNotifyHighThreshold = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1, 1, 4), HealthLevel().clone(10000)).setUnits('0.01 percent').setMaxAccess("readwrite") if mibBuilder.loadTexts: ciscoHealthMonitorHealthNotifyHighThreshold.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorHealthNotifyHighThreshold.setDescription('Specifies the health level at which a ciscoHealthMonitorHealthLevel notification will be generated for the specified subsystem and entity. A notification will only be generated if the health level had previously reached the low threshold level prior to reaching this high threshold level. Health levels oscillating within the high and the low threshold levels do not generate notifications. A health level going from low threshold (or below) to high threshold (or above) represents a return to normal health for the specified subsystem. Set your optimal health level to this threshold.') ciscoHealthMonitorHealthNotifyLowThreshold = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1, 1, 5), HealthLevel()).setUnits('0.01 percent').setMaxAccess("readwrite") if mibBuilder.loadTexts: ciscoHealthMonitorHealthNotifyLowThreshold.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorHealthNotifyLowThreshold.setDescription('Specifies the health level at which a ciscoHealthMonitorHealthLevel notification will be generated for the specified subsystem and entity. A notification will only be generated if the health level had previously reached the high threshold level prior to reaching this low threshold level. Health levels oscillating within the high and the low threshold levels do not generate notifications. A health level going from high threshold (or above) to low threshold (or below) represents a deterioration of the health for the specified subsystem. Set your unacceptable health level to this threshold.') ciscoHealthMonitorCatastrophicFaults = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ciscoHealthMonitorCatastrophicFaults.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorCatastrophicFaults.setDescription('The number of catastrophic faults that have occurred in this subsystem on the specified entity since the system was initialized.') ciscoHealthMonitorCriticalFaults = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ciscoHealthMonitorCriticalFaults.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorCriticalFaults.setDescription('The number of critical faults that have occurred in this subsystem on the specified entity since the system was initialized.') ciscoHealthMonitorHighSeverityFaults = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1, 1, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ciscoHealthMonitorHighSeverityFaults.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorHighSeverityFaults.setDescription('The number of high severity faults that have occurred in this subsystem on the specified entity since the system was initialized.') ciscoHealthMonitorMediumSeverityFaults = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1, 1, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ciscoHealthMonitorMediumSeverityFaults.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorMediumSeverityFaults.setDescription('The number of medium severity faults that have occurred in this subsystem on the specified entity since the system was initialized.') ciscoHealthMonitorLowSeverityFaults = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1, 1, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ciscoHealthMonitorLowSeverityFaults.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorLowSeverityFaults.setDescription('The number of low severity faults that have occurred in this subsystem on the specified entity since the system was initialized.') ciscoHealthMonitorPositiveEvents = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ciscoHealthMonitorPositiveEvents.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorPositiveEvents.setDescription('The number of positive events that have occurred in this subsystem on the specified entity since the system was initialized.') ciscoHealthMonitorMIBNotifs = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 243, 0)) ciscoHealthMonitorHealthLevel = NotificationType((1, 3, 6, 1, 4, 1, 9, 9, 243, 0, 1)).setObjects(("CISCO-HEALTH-MONITOR-MIB", "ciscoHealthMonitorHealth")) if mibBuilder.loadTexts: ciscoHealthMonitorHealthLevel.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorHealthLevel.setDescription('A ciscoHealthMonitorHealthLevel notification is sent when the health of a subsystem reaches either the ciscoHealthMonitorHealthNotifyLowThreshold or ciscoHealthMonitorHealthNotifyHighThreshold threshold as described above.') ciscoHealthMonitorMIBConform = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 243, 2)) ciscoHealthMonitorMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 243, 2, 1)) ciscoHealthMonitorMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 243, 2, 2)) ciscoHealthMonitorMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 243, 2, 1, 1)).setObjects(("CISCO-HEALTH-MONITOR-MIB", "ciscoHealthMonitorGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoHealthMonitorMIBCompliance = ciscoHealthMonitorMIBCompliance.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorMIBCompliance.setDescription('The compliance statement for entities which implement the Cisco Health Monitor MIB') ciscoHealthMonitorGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 243, 2, 2, 1)).setObjects(("CISCO-HEALTH-MONITOR-MIB", "ciscoHealthMonitorHealth"), ("CISCO-HEALTH-MONITOR-MIB", "ciscoHealthMonitorHealthNotifyEnable"), ("CISCO-HEALTH-MONITOR-MIB", "ciscoHealthMonitorHealthNotifyHighThreshold"), ("CISCO-HEALTH-MONITOR-MIB", "ciscoHealthMonitorHealthNotifyLowThreshold"), ("CISCO-HEALTH-MONITOR-MIB", "ciscoHealthMonitorCatastrophicFaults"), ("CISCO-HEALTH-MONITOR-MIB", "ciscoHealthMonitorCriticalFaults"), ("CISCO-HEALTH-MONITOR-MIB", "ciscoHealthMonitorHighSeverityFaults"), ("CISCO-HEALTH-MONITOR-MIB", "ciscoHealthMonitorMediumSeverityFaults"), ("CISCO-HEALTH-MONITOR-MIB", "ciscoHealthMonitorLowSeverityFaults"), ("CISCO-HEALTH-MONITOR-MIB", "ciscoHealthMonitorPositiveEvents")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoHealthMonitorGroup = ciscoHealthMonitorGroup.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorGroup.setDescription('The collection of objects providing health information.') ciscoHealthMonitorMIBNotificationGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 9, 9, 243, 2, 2, 2)).setObjects(("CISCO-HEALTH-MONITOR-MIB", "ciscoHealthMonitorHealthLevel")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoHealthMonitorMIBNotificationGroup = ciscoHealthMonitorMIBNotificationGroup.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorMIBNotificationGroup.setDescription('Set of notifications implemented in this module.') mibBuilder.exportSymbols("CISCO-HEALTH-MONITOR-MIB", ciscoHealthMonitorCatastrophicFaults=ciscoHealthMonitorCatastrophicFaults, ciscoHealthMonitorEntry=ciscoHealthMonitorEntry, ciscoHealthMonitorPositiveEvents=ciscoHealthMonitorPositiveEvents, HealthLevel=HealthLevel, ciscoHealthMonitorHealthNotifyHighThreshold=ciscoHealthMonitorHealthNotifyHighThreshold, ciscoHealthMonitorMIBGroups=ciscoHealthMonitorMIBGroups, ciscoHealthMonitorMIBConform=ciscoHealthMonitorMIBConform, ciscoHealthMonitorHighSeverityFaults=ciscoHealthMonitorHighSeverityFaults, ciscoHealthMonitorCriticalFaults=ciscoHealthMonitorCriticalFaults, ciscoHealthMonitorHealth=ciscoHealthMonitorHealth, ciscoHealthMonitorHealthNotifyEnable=ciscoHealthMonitorHealthNotifyEnable, ciscoHealthMonitorMIB=ciscoHealthMonitorMIB, ciscoHealthMonitorGroup=ciscoHealthMonitorGroup, ciscoHealthMonitorMIBNotificationGroup=ciscoHealthMonitorMIBNotificationGroup, PYSNMP_MODULE_ID=ciscoHealthMonitorMIB, ciscoHealthMonitorLowSeverityFaults=ciscoHealthMonitorLowSeverityFaults, ciscoHealthMonitorSubsysName=ciscoHealthMonitorSubsysName, ciscoHealthMonitorMIBNotifs=ciscoHealthMonitorMIBNotifs, ciscoHealthMonitorMIBCompliances=ciscoHealthMonitorMIBCompliances, ciscoHealthMonitorHealthNotifyLowThreshold=ciscoHealthMonitorHealthNotifyLowThreshold, ciscoHealthMonitorMediumSeverityFaults=ciscoHealthMonitorMediumSeverityFaults, ciscoHealthMonitorMIBObjects=ciscoHealthMonitorMIBObjects, ciscoHealthMonitorHealthLevel=ciscoHealthMonitorHealthLevel, ciscoHealthMonitorMIBCompliance=ciscoHealthMonitorMIBCompliance, ciscoHealthMonitorTable=ciscoHealthMonitorTable)
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, value_range_constraint, constraints_union, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'SingleValueConstraint', 'ValueRangeConstraint', 'ConstraintsUnion', 'ConstraintsIntersection') (cisco_mgmt,) = mibBuilder.importSymbols('CISCO-SMI', 'ciscoMgmt') (ent_physical_index,) = mibBuilder.importSymbols('ENTITY-MIB', 'entPhysicalIndex') (snmp_admin_string,) = mibBuilder.importSymbols('SNMP-FRAMEWORK-MIB', 'SnmpAdminString') (object_group, module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ObjectGroup', 'ModuleCompliance', 'NotificationGroup') (module_identity, time_ticks, bits, iso, notification_type, mib_scalar, mib_table, mib_table_row, mib_table_column, object_identity, mib_identifier, ip_address, counter32, unsigned32, gauge32, integer32, counter64) = mibBuilder.importSymbols('SNMPv2-SMI', 'ModuleIdentity', 'TimeTicks', 'Bits', 'iso', 'NotificationType', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ObjectIdentity', 'MibIdentifier', 'IpAddress', 'Counter32', 'Unsigned32', 'Gauge32', 'Integer32', 'Counter64') (truth_value, display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'TruthValue', 'DisplayString', 'TextualConvention') cisco_health_monitor_mib = module_identity((1, 3, 6, 1, 4, 1, 9, 9, 243)) ciscoHealthMonitorMIB.setRevisions(('2003-09-12 12:30',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: ciscoHealthMonitorMIB.setRevisionsDescriptions(('Initial version of this MIB module.',)) if mibBuilder.loadTexts: ciscoHealthMonitorMIB.setLastUpdated('200309121230Z') if mibBuilder.loadTexts: ciscoHealthMonitorMIB.setOrganization('Cisco Systems, Inc.') if mibBuilder.loadTexts: ciscoHealthMonitorMIB.setContactInfo(' Cisco Systems Customer Service Postal: 170 W. Tasman Drive San Jose, CA 95134 USA Tel: +1 800 553-NETS E-mail: cs-healthmonitor@cisco.com') if mibBuilder.loadTexts: ciscoHealthMonitorMIB.setDescription("Health Monitor MIB module. The Health Monitor uses a model based on events of varying severity and frequency, and predefined rules, to generate a metric that represents a system's (and its subsystems') level of health. The events are typically internally generated notifications in response to detrimental or correctional changes in the state of the hardware or software of the system. Detrimental events are classified under one of the following severity levels: Catastrophic - Causes or leads to system failure Critical - Major subsystem or functionality failure High - Potential for major impact to important functions Medium - Potential for minor impact to functionality Low - Negligible impact to functionality Whilst correctional events fall under the following classification: Positive - Not a fault event. May cause or lead to the return of functionality This MIB module provides information for tracking occurrences of the above events, and presents the associated health metric for the system and its component subsystems.") cisco_health_monitor_mib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 243, 1)) class Healthlevel(TextualConvention, Gauge32): description = 'Reflects the health of a system or subsystem based on system events and predefined rules, expressed as a percentage. The UNITS clause associated with each object will indicate the degree of precision.' status = 'current' subtype_spec = Gauge32.subtypeSpec + value_range_constraint(0, 10000) cisco_health_monitor_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1)) if mibBuilder.loadTexts: ciscoHealthMonitorTable.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorTable.setDescription('This table contains Health Monitor statistics for physical entities and their constituent hardware and/or software subsystems. The Health Monitor statistics present in each row provide information such as the computed health of the indicated subsystem and the number of faults it has experienced.') cisco_health_monitor_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1, 1)).setIndexNames((0, 'ENTITY-MIB', 'entPhysicalIndex'), (1, 'CISCO-HEALTH-MONITOR-MIB', 'ciscoHealthMonitorSubsysName')) if mibBuilder.loadTexts: ciscoHealthMonitorEntry.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorEntry.setDescription('A Health Monitor statistics entry. The entPhysicalIndex identifies the physical entity (chassis or container), while the ciscoHealthMonitorSubsysName identifies by name the appropriate subsystem for which these statistics apply. If there are other entities such as peer routers or line cards then, in the context of this MIB, these are also defined to be in the same system. If these entities also run an instance of the Health Monitor then the summary information from the distributed Health Monitors is obtained here.') cisco_health_monitor_subsys_name = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1, 1, 1), snmp_admin_string().subtype(subtypeSpec=value_size_constraint(1, 128))) if mibBuilder.loadTexts: ciscoHealthMonitorSubsysName.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorSubsysName.setDescription("A textual string containing the name of the hardware or software subsystem. A management station wishing to obtain summary statistics for a physical entity should use a value of 'system' for this object.") cisco_health_monitor_health = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1, 1, 2), health_level()).setUnits('0.01 percent').setMaxAccess('readonly') if mibBuilder.loadTexts: ciscoHealthMonitorHealth.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorHealth.setDescription('The computed current health of this subsystem on the specified entity. This health metric is based on predefined rules that specify how the health should be adjusted in response to certain events of varying severity and frequency. As these events are encountered by each subsystem or physical entity, the appropriate rules are applied and the health is modified accordingly.') cisco_health_monitor_health_notify_enable = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1, 1, 3), truth_value().clone('false')).setMaxAccess('readwrite') if mibBuilder.loadTexts: ciscoHealthMonitorHealthNotifyEnable.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorHealthNotifyEnable.setDescription('Enables or disables health level notifications. When set to true(1), the ciscoHealthMonitorHealthLevel notification is enabled. When set to false(0), the ciscoHealthMonitorHealthLevel notification is disabled. If such a notification is desired, it is the responsibility of the management entity to ensure that the SNMP administrative model is configured in such a way as to allow the notification to be delivered.') cisco_health_monitor_health_notify_high_threshold = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1, 1, 4), health_level().clone(10000)).setUnits('0.01 percent').setMaxAccess('readwrite') if mibBuilder.loadTexts: ciscoHealthMonitorHealthNotifyHighThreshold.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorHealthNotifyHighThreshold.setDescription('Specifies the health level at which a ciscoHealthMonitorHealthLevel notification will be generated for the specified subsystem and entity. A notification will only be generated if the health level had previously reached the low threshold level prior to reaching this high threshold level. Health levels oscillating within the high and the low threshold levels do not generate notifications. A health level going from low threshold (or below) to high threshold (or above) represents a return to normal health for the specified subsystem. Set your optimal health level to this threshold.') cisco_health_monitor_health_notify_low_threshold = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1, 1, 5), health_level()).setUnits('0.01 percent').setMaxAccess('readwrite') if mibBuilder.loadTexts: ciscoHealthMonitorHealthNotifyLowThreshold.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorHealthNotifyLowThreshold.setDescription('Specifies the health level at which a ciscoHealthMonitorHealthLevel notification will be generated for the specified subsystem and entity. A notification will only be generated if the health level had previously reached the high threshold level prior to reaching this low threshold level. Health levels oscillating within the high and the low threshold levels do not generate notifications. A health level going from high threshold (or above) to low threshold (or below) represents a deterioration of the health for the specified subsystem. Set your unacceptable health level to this threshold.') cisco_health_monitor_catastrophic_faults = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1, 1, 6), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: ciscoHealthMonitorCatastrophicFaults.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorCatastrophicFaults.setDescription('The number of catastrophic faults that have occurred in this subsystem on the specified entity since the system was initialized.') cisco_health_monitor_critical_faults = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1, 1, 7), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: ciscoHealthMonitorCriticalFaults.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorCriticalFaults.setDescription('The number of critical faults that have occurred in this subsystem on the specified entity since the system was initialized.') cisco_health_monitor_high_severity_faults = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1, 1, 8), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: ciscoHealthMonitorHighSeverityFaults.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorHighSeverityFaults.setDescription('The number of high severity faults that have occurred in this subsystem on the specified entity since the system was initialized.') cisco_health_monitor_medium_severity_faults = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1, 1, 9), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: ciscoHealthMonitorMediumSeverityFaults.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorMediumSeverityFaults.setDescription('The number of medium severity faults that have occurred in this subsystem on the specified entity since the system was initialized.') cisco_health_monitor_low_severity_faults = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1, 1, 10), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: ciscoHealthMonitorLowSeverityFaults.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorLowSeverityFaults.setDescription('The number of low severity faults that have occurred in this subsystem on the specified entity since the system was initialized.') cisco_health_monitor_positive_events = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 243, 1, 1, 1, 11), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: ciscoHealthMonitorPositiveEvents.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorPositiveEvents.setDescription('The number of positive events that have occurred in this subsystem on the specified entity since the system was initialized.') cisco_health_monitor_mib_notifs = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 243, 0)) cisco_health_monitor_health_level = notification_type((1, 3, 6, 1, 4, 1, 9, 9, 243, 0, 1)).setObjects(('CISCO-HEALTH-MONITOR-MIB', 'ciscoHealthMonitorHealth')) if mibBuilder.loadTexts: ciscoHealthMonitorHealthLevel.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorHealthLevel.setDescription('A ciscoHealthMonitorHealthLevel notification is sent when the health of a subsystem reaches either the ciscoHealthMonitorHealthNotifyLowThreshold or ciscoHealthMonitorHealthNotifyHighThreshold threshold as described above.') cisco_health_monitor_mib_conform = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 243, 2)) cisco_health_monitor_mib_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 243, 2, 1)) cisco_health_monitor_mib_groups = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 243, 2, 2)) cisco_health_monitor_mib_compliance = module_compliance((1, 3, 6, 1, 4, 1, 9, 9, 243, 2, 1, 1)).setObjects(('CISCO-HEALTH-MONITOR-MIB', 'ciscoHealthMonitorGroup')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_health_monitor_mib_compliance = ciscoHealthMonitorMIBCompliance.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorMIBCompliance.setDescription('The compliance statement for entities which implement the Cisco Health Monitor MIB') cisco_health_monitor_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 243, 2, 2, 1)).setObjects(('CISCO-HEALTH-MONITOR-MIB', 'ciscoHealthMonitorHealth'), ('CISCO-HEALTH-MONITOR-MIB', 'ciscoHealthMonitorHealthNotifyEnable'), ('CISCO-HEALTH-MONITOR-MIB', 'ciscoHealthMonitorHealthNotifyHighThreshold'), ('CISCO-HEALTH-MONITOR-MIB', 'ciscoHealthMonitorHealthNotifyLowThreshold'), ('CISCO-HEALTH-MONITOR-MIB', 'ciscoHealthMonitorCatastrophicFaults'), ('CISCO-HEALTH-MONITOR-MIB', 'ciscoHealthMonitorCriticalFaults'), ('CISCO-HEALTH-MONITOR-MIB', 'ciscoHealthMonitorHighSeverityFaults'), ('CISCO-HEALTH-MONITOR-MIB', 'ciscoHealthMonitorMediumSeverityFaults'), ('CISCO-HEALTH-MONITOR-MIB', 'ciscoHealthMonitorLowSeverityFaults'), ('CISCO-HEALTH-MONITOR-MIB', 'ciscoHealthMonitorPositiveEvents')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_health_monitor_group = ciscoHealthMonitorGroup.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorGroup.setDescription('The collection of objects providing health information.') cisco_health_monitor_mib_notification_group = notification_group((1, 3, 6, 1, 4, 1, 9, 9, 243, 2, 2, 2)).setObjects(('CISCO-HEALTH-MONITOR-MIB', 'ciscoHealthMonitorHealthLevel')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_health_monitor_mib_notification_group = ciscoHealthMonitorMIBNotificationGroup.setStatus('current') if mibBuilder.loadTexts: ciscoHealthMonitorMIBNotificationGroup.setDescription('Set of notifications implemented in this module.') mibBuilder.exportSymbols('CISCO-HEALTH-MONITOR-MIB', ciscoHealthMonitorCatastrophicFaults=ciscoHealthMonitorCatastrophicFaults, ciscoHealthMonitorEntry=ciscoHealthMonitorEntry, ciscoHealthMonitorPositiveEvents=ciscoHealthMonitorPositiveEvents, HealthLevel=HealthLevel, ciscoHealthMonitorHealthNotifyHighThreshold=ciscoHealthMonitorHealthNotifyHighThreshold, ciscoHealthMonitorMIBGroups=ciscoHealthMonitorMIBGroups, ciscoHealthMonitorMIBConform=ciscoHealthMonitorMIBConform, ciscoHealthMonitorHighSeverityFaults=ciscoHealthMonitorHighSeverityFaults, ciscoHealthMonitorCriticalFaults=ciscoHealthMonitorCriticalFaults, ciscoHealthMonitorHealth=ciscoHealthMonitorHealth, ciscoHealthMonitorHealthNotifyEnable=ciscoHealthMonitorHealthNotifyEnable, ciscoHealthMonitorMIB=ciscoHealthMonitorMIB, ciscoHealthMonitorGroup=ciscoHealthMonitorGroup, ciscoHealthMonitorMIBNotificationGroup=ciscoHealthMonitorMIBNotificationGroup, PYSNMP_MODULE_ID=ciscoHealthMonitorMIB, ciscoHealthMonitorLowSeverityFaults=ciscoHealthMonitorLowSeverityFaults, ciscoHealthMonitorSubsysName=ciscoHealthMonitorSubsysName, ciscoHealthMonitorMIBNotifs=ciscoHealthMonitorMIBNotifs, ciscoHealthMonitorMIBCompliances=ciscoHealthMonitorMIBCompliances, ciscoHealthMonitorHealthNotifyLowThreshold=ciscoHealthMonitorHealthNotifyLowThreshold, ciscoHealthMonitorMediumSeverityFaults=ciscoHealthMonitorMediumSeverityFaults, ciscoHealthMonitorMIBObjects=ciscoHealthMonitorMIBObjects, ciscoHealthMonitorHealthLevel=ciscoHealthMonitorHealthLevel, ciscoHealthMonitorMIBCompliance=ciscoHealthMonitorMIBCompliance, ciscoHealthMonitorTable=ciscoHealthMonitorTable)
class ListNode: def __init__(self, key=None, value=None, next_node=None): self.key = key self.val = value self.next = next_node class MyHashMap: def __init__(self): self.size = 8 self.used = 0 self.threshold = 0.618 self.buckets = [None] * self.size def _resize(self): self.size *= 2 self.used = 0 new_buckets = [None] * self.size for b in self.buckets: current = b while current: h = self._hash(current.key) new_buckets[h] = ListNode(current.key, current.val, new_buckets[h]) self.used += 1 current = current.next self.buckets = new_buckets # print("Resizing: current size: {} current used: {} new size {}".format(self.size // 2, self.used, self.size)) def _check_capacity_and_resize(self): capacity = self.used / self.size if capacity > self.threshold: self._resize() def _hash(self, key): return key % self.size def _find_node_return_previous_and_current(self, key): h = self._hash(key) current = previous = self.buckets[h] while current and current.key != key: previous = current current = current.next return previous, current def put(self, key: int, value: int) -> None: self._check_capacity_and_resize() previous, current = self._find_node_return_previous_and_current(key) if current is None and previous is None: self.buckets[self._hash(key)] = ListNode(key, value) self.used += 1 elif previous is not None and current is not None: current.val = value elif previous is not None and current is None: previous.next = ListNode(key, value) self.used += 1 def get(self, key: int) -> int: previous, current = self._find_node_return_previous_and_current(key) return -1 if not previous or not current else current.val def remove(self, key: int) -> None: previous, current = self._find_node_return_previous_and_current(key) if current is None: return elif previous == current: self.buckets[self._hash(key)] = current.next else: previous.next = current.next self.used -= 1 op = ["MyHashMap", "put", "put", "put", "remove", "get", "put", "put", "get", "put", "put", "put", "put", "put", "put", "put", "put", "put", "put", "put", "put", "remove", "put", "remove", "put", "put", "remove", "put", "get", "put", "get", "put", "put", "put", "put", "put", "get", "put", "remove", "put", "remove", "put", "put", "put", "put", "put", "remove", "put", "put", "remove", "put", "put", "put", "get", "get", "put", "remove", "put", "put", "put", "get", "put", "put", "put", "remove", "put", "put", "put", "put", "put", "get", "put", "put", "get", "get", "put", "remove", "remove", "get", "put", "remove", "put", "remove", "put", "put", "put", "get", "put", "put", "put", "remove", "put", "put", "get", "put", "put", "get", "remove", "get", "get", "put"] param = [[], [24, 31], [58, 35], [59, 88], [84], [62], [2, 22], [44, 70], [24], [24, 42], [58, 99], [74, 29], [40, 66], [55, 83], [21, 27], [31, 25], [78, 19], [86, 70], [71, 73], [39, 95], [6, 96], [76], [62, 22], [78], [53, 51], [66, 53], [44], [14, 46], [77], [15, 32], [22], [53, 79], [35, 21], [73, 57], [18, 67], [96, 61], [73], [58, 77], [6], [5, 58], [17], [25, 14], [16, 13], [4, 37], [47, 43], [14, 79], [35], [7, 13], [78, 85], [27], [73, 33], [95, 87], [31, 21], [20], [64], [90, 22], [16], [77, 50], [55, 41], [33, 62], [44], [73, 16], [13, 54], [41, 5], [71], [81, 6], [20, 98], [35, 64], [15, 35], [74, 31], [90], [32, 15], [44, 79], [37], [53], [22, 80], [24], [10], [7], [53, 61], [65], [63, 99], [47], [97, 68], [7, 0], [9, 25], [97], [93, 13], [92, 43], [83, 73], [74], [41, 78], [39, 28], [52], [34, 16], [93, 63], [82], [77], [16], [50], [68, 47]] hm = MyHashMap() for i in range(len(op)): if op[i] == "MyHashMap": hm = MyHashMap() continue if op[i] == "put": print(hm.put(param[i][0], param[i][1])) if op[i] == "get": print(hm.get(param[i][0])) if op[i] == "remove": print(hm.remove(param[i][0])) print("simple test") hm = MyHashMap() for i in range(0, 10): hm.put(i, i) hm.remove(2) hm.remove(11) print(hm.get(1)) print(hm.get(2)) print("test resizing") hm = MyHashMap() for i in range(0, 10): hm.put(i * 8, i * 8) print(hm.buckets) c = hm.buckets[0] while c: print(c.val) c = c.next c = hm.buckets[8] while c: print(c.val) c = c.next
class Listnode: def __init__(self, key=None, value=None, next_node=None): self.key = key self.val = value self.next = next_node class Myhashmap: def __init__(self): self.size = 8 self.used = 0 self.threshold = 0.618 self.buckets = [None] * self.size def _resize(self): self.size *= 2 self.used = 0 new_buckets = [None] * self.size for b in self.buckets: current = b while current: h = self._hash(current.key) new_buckets[h] = list_node(current.key, current.val, new_buckets[h]) self.used += 1 current = current.next self.buckets = new_buckets def _check_capacity_and_resize(self): capacity = self.used / self.size if capacity > self.threshold: self._resize() def _hash(self, key): return key % self.size def _find_node_return_previous_and_current(self, key): h = self._hash(key) current = previous = self.buckets[h] while current and current.key != key: previous = current current = current.next return (previous, current) def put(self, key: int, value: int) -> None: self._check_capacity_and_resize() (previous, current) = self._find_node_return_previous_and_current(key) if current is None and previous is None: self.buckets[self._hash(key)] = list_node(key, value) self.used += 1 elif previous is not None and current is not None: current.val = value elif previous is not None and current is None: previous.next = list_node(key, value) self.used += 1 def get(self, key: int) -> int: (previous, current) = self._find_node_return_previous_and_current(key) return -1 if not previous or not current else current.val def remove(self, key: int) -> None: (previous, current) = self._find_node_return_previous_and_current(key) if current is None: return elif previous == current: self.buckets[self._hash(key)] = current.next else: previous.next = current.next self.used -= 1 op = ['MyHashMap', 'put', 'put', 'put', 'remove', 'get', 'put', 'put', 'get', 'put', 'put', 'put', 'put', 'put', 'put', 'put', 'put', 'put', 'put', 'put', 'put', 'remove', 'put', 'remove', 'put', 'put', 'remove', 'put', 'get', 'put', 'get', 'put', 'put', 'put', 'put', 'put', 'get', 'put', 'remove', 'put', 'remove', 'put', 'put', 'put', 'put', 'put', 'remove', 'put', 'put', 'remove', 'put', 'put', 'put', 'get', 'get', 'put', 'remove', 'put', 'put', 'put', 'get', 'put', 'put', 'put', 'remove', 'put', 'put', 'put', 'put', 'put', 'get', 'put', 'put', 'get', 'get', 'put', 'remove', 'remove', 'get', 'put', 'remove', 'put', 'remove', 'put', 'put', 'put', 'get', 'put', 'put', 'put', 'remove', 'put', 'put', 'get', 'put', 'put', 'get', 'remove', 'get', 'get', 'put'] param = [[], [24, 31], [58, 35], [59, 88], [84], [62], [2, 22], [44, 70], [24], [24, 42], [58, 99], [74, 29], [40, 66], [55, 83], [21, 27], [31, 25], [78, 19], [86, 70], [71, 73], [39, 95], [6, 96], [76], [62, 22], [78], [53, 51], [66, 53], [44], [14, 46], [77], [15, 32], [22], [53, 79], [35, 21], [73, 57], [18, 67], [96, 61], [73], [58, 77], [6], [5, 58], [17], [25, 14], [16, 13], [4, 37], [47, 43], [14, 79], [35], [7, 13], [78, 85], [27], [73, 33], [95, 87], [31, 21], [20], [64], [90, 22], [16], [77, 50], [55, 41], [33, 62], [44], [73, 16], [13, 54], [41, 5], [71], [81, 6], [20, 98], [35, 64], [15, 35], [74, 31], [90], [32, 15], [44, 79], [37], [53], [22, 80], [24], [10], [7], [53, 61], [65], [63, 99], [47], [97, 68], [7, 0], [9, 25], [97], [93, 13], [92, 43], [83, 73], [74], [41, 78], [39, 28], [52], [34, 16], [93, 63], [82], [77], [16], [50], [68, 47]] hm = my_hash_map() for i in range(len(op)): if op[i] == 'MyHashMap': hm = my_hash_map() continue if op[i] == 'put': print(hm.put(param[i][0], param[i][1])) if op[i] == 'get': print(hm.get(param[i][0])) if op[i] == 'remove': print(hm.remove(param[i][0])) print('simple test') hm = my_hash_map() for i in range(0, 10): hm.put(i, i) hm.remove(2) hm.remove(11) print(hm.get(1)) print(hm.get(2)) print('test resizing') hm = my_hash_map() for i in range(0, 10): hm.put(i * 8, i * 8) print(hm.buckets) c = hm.buckets[0] while c: print(c.val) c = c.next c = hm.buckets[8] while c: print(c.val) c = c.next
n=int(input());ans=0 def s(x,h): global ans for i in range(3): if i==0 and x==0: continue if x==n: if h%3==0: ans+=1;return else: s(x+1,h+i) s(0,0) print(ans)
n = int(input()) ans = 0 def s(x, h): global ans for i in range(3): if i == 0 and x == 0: continue if x == n: if h % 3 == 0: ans += 1 return else: s(x + 1, h + i) s(0, 0) print(ans)
class NoChoice(Exception): def __init__(self): super().__init__("Took too long.") class PaginationError(Exception): pass class CannotEmbedLinks(PaginationError): def __init__(self): super().__init__("Bot cannot embed links in this channel.")
class Nochoice(Exception): def __init__(self): super().__init__('Took too long.') class Paginationerror(Exception): pass class Cannotembedlinks(PaginationError): def __init__(self): super().__init__('Bot cannot embed links in this channel.')
# This file is part of Indico. # Copyright (C) 2002 - 2021 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. def isStringHTML(s): if not isinstance(s, str): return False s = s.lower() return any(tag in s for tag in ('<p>', '<p ', '<br', '<li>'))
def is_string_html(s): if not isinstance(s, str): return False s = s.lower() return any((tag in s for tag in ('<p>', '<p ', '<br', '<li>')))
def assert_dict_equal(expected, actual): message = [] equal = True for k, v in expected.items(): if actual[k] != v: message.append(f"For key {k} want {v}, got {actual[k]}") equal = False for k, v in actual.items(): if not k in expected: message.append(f"Got extra key {k} with value {v}") equal = False assert equal, "\n".join(message)
def assert_dict_equal(expected, actual): message = [] equal = True for (k, v) in expected.items(): if actual[k] != v: message.append(f'For key {k} want {v}, got {actual[k]}') equal = False for (k, v) in actual.items(): if not k in expected: message.append(f'Got extra key {k} with value {v}') equal = False assert equal, '\n'.join(message)
x = int(input()) for j in range(x): q = int(input()) print("Case", j + 1, end=": ") for t in range(1, int(q / 2 + 1)): if q % t == 0: print(t, end=" ") print(q)
x = int(input()) for j in range(x): q = int(input()) print('Case', j + 1, end=': ') for t in range(1, int(q / 2 + 1)): if q % t == 0: print(t, end=' ') print(q)
class RobotStatus: def __init__(self): self.status = 'init' self.position = '' def isAvailable(self): if self.status == 'available': return True else: return False def isWaitEV(self): if self.status == 'waitEV': return True else: return False def isInEV(self): if self.status == 'inEV': return True else: return False def setAvailable(self): self.status = 'available' def setMoving(self): self.status = 'moving' def setWaitEV(self): self.status = 'waitEV' def setInEV(self): self.status = 'inEV' def getPosition(self): return self.position def setPosition(self,newPose): self.position = newPose
class Robotstatus: def __init__(self): self.status = 'init' self.position = '' def is_available(self): if self.status == 'available': return True else: return False def is_wait_ev(self): if self.status == 'waitEV': return True else: return False def is_in_ev(self): if self.status == 'inEV': return True else: return False def set_available(self): self.status = 'available' def set_moving(self): self.status = 'moving' def set_wait_ev(self): self.status = 'waitEV' def set_in_ev(self): self.status = 'inEV' def get_position(self): return self.position def set_position(self, newPose): self.position = newPose
# The language mapping for 2 and 3 character language code. language_dict = { "kn": "kannada", "kan": "kannada", "hi": "hindi", "hin": "hindi", }
language_dict = {'kn': 'kannada', 'kan': 'kannada', 'hi': 'hindi', 'hin': 'hindi'}
# Recursive Functions def iterTest(low, high): while low <= high: print(low) low=low+1 def recurTest(low,high): if low <= high: print(low) recurTest(low+1, high)
def iter_test(low, high): while low <= high: print(low) low = low + 1 def recur_test(low, high): if low <= high: print(low) recur_test(low + 1, high)
# find min. no. of sets an array (awards) can be divided into such that couple-wise difference of each element is at most k # ex: awards=[1,5,4,6,8,9,2], k=3, o/p=3 # [1,2][4,5,6][8,9] with max diff 1,2,1 respectively # int minimumGroups(int awards[n],int k) => o/p def max_diff(arr): return max(arr) - min(arr) def minimumGroups(awards, k): awards.sort() count = 1 n = len(awards) i, j = 0, 1 while j != n: # print(awards[i : j + 1], max_diff(awards[i : j + 1])) if max_diff(awards[i : j + 1]) >= k: count += 1 i = j j = i + 1 j = j + 1 return count def main(): awards = [1, 5, 4, 6, 8, 9, 2] k = 3 print(minimumGroups(awards, k)) if __name__ == "__main__": main()
def max_diff(arr): return max(arr) - min(arr) def minimum_groups(awards, k): awards.sort() count = 1 n = len(awards) (i, j) = (0, 1) while j != n: if max_diff(awards[i:j + 1]) >= k: count += 1 i = j j = i + 1 j = j + 1 return count def main(): awards = [1, 5, 4, 6, 8, 9, 2] k = 3 print(minimum_groups(awards, k)) if __name__ == '__main__': main()
class Solution: def countBits(self, n: int) -> List[int]: arr = [] for i in range(n+1): i_b = int(bin(i)[2:]) arr.append(self.calculate1(i_b)) return arr def calculate1(self, i): count = 0 while i >= 1: res = i%10 if res == 1: count += 1 i //= 10 return count
class Solution: def count_bits(self, n: int) -> List[int]: arr = [] for i in range(n + 1): i_b = int(bin(i)[2:]) arr.append(self.calculate1(i_b)) return arr def calculate1(self, i): count = 0 while i >= 1: res = i % 10 if res == 1: count += 1 i //= 10 return count
class Heap: def __init__(self, arr): self.arr = arr self.size = len(self.arr) def max_heapify(self, current_index): if not self.is_leaf(current_index): left_child = (2 * current_index) + 1 right_child = (2 * current_index) + 2 if right_child < self.size: if self.arr[left_child] > self.arr[current_index] or self.arr[right_child] > self.arr[current_index]: if self.arr[left_child] > self.arr[right_child]: self.arr[left_child], self.arr[current_index] = self.arr[current_index], self.arr[left_child] self.max_heapify(left_child) else: self.arr[right_child], self.arr[current_index] = self.arr[current_index], self.arr[right_child] self.max_heapify(right_child) else: if self.arr[left_child] > self.arr[current_index]: self.arr[left_child], self.arr[current_index] = self.arr[current_index], self.arr[left_child] self.max_heapify(left_child) def build_heap(self): for index in range((self.size//2) - 1, -1, -1): self.max_heapify(index) def is_leaf(self, current_index): if current_index >= self.size // 2 and current_index <= self.size - 1: return True return False def return_arr(self): return self.arr if __name__ == '__main__': heap = Heap([3, 6, 5, 0, 8, 2, 1, 9]) heap.build_heap() print(heap.return_arr())
class Heap: def __init__(self, arr): self.arr = arr self.size = len(self.arr) def max_heapify(self, current_index): if not self.is_leaf(current_index): left_child = 2 * current_index + 1 right_child = 2 * current_index + 2 if right_child < self.size: if self.arr[left_child] > self.arr[current_index] or self.arr[right_child] > self.arr[current_index]: if self.arr[left_child] > self.arr[right_child]: (self.arr[left_child], self.arr[current_index]) = (self.arr[current_index], self.arr[left_child]) self.max_heapify(left_child) else: (self.arr[right_child], self.arr[current_index]) = (self.arr[current_index], self.arr[right_child]) self.max_heapify(right_child) elif self.arr[left_child] > self.arr[current_index]: (self.arr[left_child], self.arr[current_index]) = (self.arr[current_index], self.arr[left_child]) self.max_heapify(left_child) def build_heap(self): for index in range(self.size // 2 - 1, -1, -1): self.max_heapify(index) def is_leaf(self, current_index): if current_index >= self.size // 2 and current_index <= self.size - 1: return True return False def return_arr(self): return self.arr if __name__ == '__main__': heap = heap([3, 6, 5, 0, 8, 2, 1, 9]) heap.build_heap() print(heap.return_arr())
# -*- coding: utf-8 -*- # @Author: Wenwen Yu # @Created Time: 7/8/2020 9:34 PM Entities_list = [ "date_echeance", "date_facture", "methode_payement", "numero_facture", "rib", "adresse", "contact", "nom_fournisseur", "matricule_fiscale", "total_ht", "total_ttc" ] # Entities_list = [ # "ticket_num", # "starting_station", # "train_num", # "destination_station", # "date", # "ticket_rates", # "seat_category", # "name" # ]
entities_list = ['date_echeance', 'date_facture', 'methode_payement', 'numero_facture', 'rib', 'adresse', 'contact', 'nom_fournisseur', 'matricule_fiscale', 'total_ht', 'total_ttc']
data = ( 'Guo ', # 0x00 'Yin ', # 0x01 'Hun ', # 0x02 'Pu ', # 0x03 'Yu ', # 0x04 'Han ', # 0x05 'Yuan ', # 0x06 'Lun ', # 0x07 'Quan ', # 0x08 'Yu ', # 0x09 'Qing ', # 0x0a 'Guo ', # 0x0b 'Chuan ', # 0x0c 'Wei ', # 0x0d 'Yuan ', # 0x0e 'Quan ', # 0x0f 'Ku ', # 0x10 'Fu ', # 0x11 'Yuan ', # 0x12 'Yuan ', # 0x13 'E ', # 0x14 'Tu ', # 0x15 'Tu ', # 0x16 'Tu ', # 0x17 'Tuan ', # 0x18 'Lue ', # 0x19 'Hui ', # 0x1a 'Yi ', # 0x1b 'Yuan ', # 0x1c 'Luan ', # 0x1d 'Luan ', # 0x1e 'Tu ', # 0x1f 'Ya ', # 0x20 'Tu ', # 0x21 'Ting ', # 0x22 'Sheng ', # 0x23 'Pu ', # 0x24 'Lu ', # 0x25 'Iri ', # 0x26 'Ya ', # 0x27 'Zai ', # 0x28 'Wei ', # 0x29 'Ge ', # 0x2a 'Yu ', # 0x2b 'Wu ', # 0x2c 'Gui ', # 0x2d 'Pi ', # 0x2e 'Yi ', # 0x2f 'Di ', # 0x30 'Qian ', # 0x31 'Qian ', # 0x32 'Zhen ', # 0x33 'Zhuo ', # 0x34 'Dang ', # 0x35 'Qia ', # 0x36 'Akutsu ', # 0x37 'Yama ', # 0x38 'Kuang ', # 0x39 'Chang ', # 0x3a 'Qi ', # 0x3b 'Nie ', # 0x3c 'Mo ', # 0x3d 'Ji ', # 0x3e 'Jia ', # 0x3f 'Zhi ', # 0x40 'Zhi ', # 0x41 'Ban ', # 0x42 'Xun ', # 0x43 'Tou ', # 0x44 'Qin ', # 0x45 'Fen ', # 0x46 'Jun ', # 0x47 'Keng ', # 0x48 'Tun ', # 0x49 'Fang ', # 0x4a 'Fen ', # 0x4b 'Ben ', # 0x4c 'Tan ', # 0x4d 'Kan ', # 0x4e 'Pi ', # 0x4f 'Zuo ', # 0x50 'Keng ', # 0x51 'Bi ', # 0x52 'Xing ', # 0x53 'Di ', # 0x54 'Jing ', # 0x55 'Ji ', # 0x56 'Kuai ', # 0x57 'Di ', # 0x58 'Jing ', # 0x59 'Jian ', # 0x5a 'Tan ', # 0x5b 'Li ', # 0x5c 'Ba ', # 0x5d 'Wu ', # 0x5e 'Fen ', # 0x5f 'Zhui ', # 0x60 'Po ', # 0x61 'Pan ', # 0x62 'Tang ', # 0x63 'Kun ', # 0x64 'Qu ', # 0x65 'Tan ', # 0x66 'Zhi ', # 0x67 'Tuo ', # 0x68 'Gan ', # 0x69 'Ping ', # 0x6a 'Dian ', # 0x6b 'Gua ', # 0x6c 'Ni ', # 0x6d 'Tai ', # 0x6e 'Pi ', # 0x6f 'Jiong ', # 0x70 'Yang ', # 0x71 'Fo ', # 0x72 'Ao ', # 0x73 'Liu ', # 0x74 'Qiu ', # 0x75 'Mu ', # 0x76 'Ke ', # 0x77 'Gou ', # 0x78 'Xue ', # 0x79 'Ba ', # 0x7a 'Chi ', # 0x7b 'Che ', # 0x7c 'Ling ', # 0x7d 'Zhu ', # 0x7e 'Fu ', # 0x7f 'Hu ', # 0x80 'Zhi ', # 0x81 'Chui ', # 0x82 'La ', # 0x83 'Long ', # 0x84 'Long ', # 0x85 'Lu ', # 0x86 'Ao ', # 0x87 'Tay ', # 0x88 'Pao ', # 0x89 '[?] ', # 0x8a 'Xing ', # 0x8b 'Dong ', # 0x8c 'Ji ', # 0x8d 'Ke ', # 0x8e 'Lu ', # 0x8f 'Ci ', # 0x90 'Chi ', # 0x91 'Lei ', # 0x92 'Gai ', # 0x93 'Yin ', # 0x94 'Hou ', # 0x95 'Dui ', # 0x96 'Zhao ', # 0x97 'Fu ', # 0x98 'Guang ', # 0x99 'Yao ', # 0x9a 'Duo ', # 0x9b 'Duo ', # 0x9c 'Gui ', # 0x9d 'Cha ', # 0x9e 'Yang ', # 0x9f 'Yin ', # 0xa0 'Fa ', # 0xa1 'Gou ', # 0xa2 'Yuan ', # 0xa3 'Die ', # 0xa4 'Xie ', # 0xa5 'Ken ', # 0xa6 'Jiong ', # 0xa7 'Shou ', # 0xa8 'E ', # 0xa9 'Ha ', # 0xaa 'Dian ', # 0xab 'Hong ', # 0xac 'Wu ', # 0xad 'Kua ', # 0xae '[?] ', # 0xaf 'Tao ', # 0xb0 'Dang ', # 0xb1 'Kai ', # 0xb2 'Gake ', # 0xb3 'Nao ', # 0xb4 'An ', # 0xb5 'Xing ', # 0xb6 'Xian ', # 0xb7 'Huan ', # 0xb8 'Bang ', # 0xb9 'Pei ', # 0xba 'Ba ', # 0xbb 'Yi ', # 0xbc 'Yin ', # 0xbd 'Han ', # 0xbe 'Xu ', # 0xbf 'Chui ', # 0xc0 'Cen ', # 0xc1 'Geng ', # 0xc2 'Ai ', # 0xc3 'Peng ', # 0xc4 'Fang ', # 0xc5 'Que ', # 0xc6 'Yong ', # 0xc7 'Xun ', # 0xc8 'Jia ', # 0xc9 'Di ', # 0xca 'Mai ', # 0xcb 'Lang ', # 0xcc 'Xuan ', # 0xcd 'Cheng ', # 0xce 'Yan ', # 0xcf 'Jin ', # 0xd0 'Zhe ', # 0xd1 'Lei ', # 0xd2 'Lie ', # 0xd3 'Bu ', # 0xd4 'Cheng ', # 0xd5 'Gomi ', # 0xd6 'Bu ', # 0xd7 'Shi ', # 0xd8 'Xun ', # 0xd9 'Guo ', # 0xda 'Jiong ', # 0xdb 'Ye ', # 0xdc 'Nian ', # 0xdd 'Di ', # 0xde 'Yu ', # 0xdf 'Bu ', # 0xe0 'Ya ', # 0xe1 'Juan ', # 0xe2 'Sui ', # 0xe3 'Pi ', # 0xe4 'Cheng ', # 0xe5 'Wan ', # 0xe6 'Ju ', # 0xe7 'Lun ', # 0xe8 'Zheng ', # 0xe9 'Kong ', # 0xea 'Chong ', # 0xeb 'Dong ', # 0xec 'Dai ', # 0xed 'Tan ', # 0xee 'An ', # 0xef 'Cai ', # 0xf0 'Shu ', # 0xf1 'Beng ', # 0xf2 'Kan ', # 0xf3 'Zhi ', # 0xf4 'Duo ', # 0xf5 'Yi ', # 0xf6 'Zhi ', # 0xf7 'Yi ', # 0xf8 'Pei ', # 0xf9 'Ji ', # 0xfa 'Zhun ', # 0xfb 'Qi ', # 0xfc 'Sao ', # 0xfd 'Ju ', # 0xfe 'Ni ', # 0xff )
data = ('Guo ', 'Yin ', 'Hun ', 'Pu ', 'Yu ', 'Han ', 'Yuan ', 'Lun ', 'Quan ', 'Yu ', 'Qing ', 'Guo ', 'Chuan ', 'Wei ', 'Yuan ', 'Quan ', 'Ku ', 'Fu ', 'Yuan ', 'Yuan ', 'E ', 'Tu ', 'Tu ', 'Tu ', 'Tuan ', 'Lue ', 'Hui ', 'Yi ', 'Yuan ', 'Luan ', 'Luan ', 'Tu ', 'Ya ', 'Tu ', 'Ting ', 'Sheng ', 'Pu ', 'Lu ', 'Iri ', 'Ya ', 'Zai ', 'Wei ', 'Ge ', 'Yu ', 'Wu ', 'Gui ', 'Pi ', 'Yi ', 'Di ', 'Qian ', 'Qian ', 'Zhen ', 'Zhuo ', 'Dang ', 'Qia ', 'Akutsu ', 'Yama ', 'Kuang ', 'Chang ', 'Qi ', 'Nie ', 'Mo ', 'Ji ', 'Jia ', 'Zhi ', 'Zhi ', 'Ban ', 'Xun ', 'Tou ', 'Qin ', 'Fen ', 'Jun ', 'Keng ', 'Tun ', 'Fang ', 'Fen ', 'Ben ', 'Tan ', 'Kan ', 'Pi ', 'Zuo ', 'Keng ', 'Bi ', 'Xing ', 'Di ', 'Jing ', 'Ji ', 'Kuai ', 'Di ', 'Jing ', 'Jian ', 'Tan ', 'Li ', 'Ba ', 'Wu ', 'Fen ', 'Zhui ', 'Po ', 'Pan ', 'Tang ', 'Kun ', 'Qu ', 'Tan ', 'Zhi ', 'Tuo ', 'Gan ', 'Ping ', 'Dian ', 'Gua ', 'Ni ', 'Tai ', 'Pi ', 'Jiong ', 'Yang ', 'Fo ', 'Ao ', 'Liu ', 'Qiu ', 'Mu ', 'Ke ', 'Gou ', 'Xue ', 'Ba ', 'Chi ', 'Che ', 'Ling ', 'Zhu ', 'Fu ', 'Hu ', 'Zhi ', 'Chui ', 'La ', 'Long ', 'Long ', 'Lu ', 'Ao ', 'Tay ', 'Pao ', '[?] ', 'Xing ', 'Dong ', 'Ji ', 'Ke ', 'Lu ', 'Ci ', 'Chi ', 'Lei ', 'Gai ', 'Yin ', 'Hou ', 'Dui ', 'Zhao ', 'Fu ', 'Guang ', 'Yao ', 'Duo ', 'Duo ', 'Gui ', 'Cha ', 'Yang ', 'Yin ', 'Fa ', 'Gou ', 'Yuan ', 'Die ', 'Xie ', 'Ken ', 'Jiong ', 'Shou ', 'E ', 'Ha ', 'Dian ', 'Hong ', 'Wu ', 'Kua ', '[?] ', 'Tao ', 'Dang ', 'Kai ', 'Gake ', 'Nao ', 'An ', 'Xing ', 'Xian ', 'Huan ', 'Bang ', 'Pei ', 'Ba ', 'Yi ', 'Yin ', 'Han ', 'Xu ', 'Chui ', 'Cen ', 'Geng ', 'Ai ', 'Peng ', 'Fang ', 'Que ', 'Yong ', 'Xun ', 'Jia ', 'Di ', 'Mai ', 'Lang ', 'Xuan ', 'Cheng ', 'Yan ', 'Jin ', 'Zhe ', 'Lei ', 'Lie ', 'Bu ', 'Cheng ', 'Gomi ', 'Bu ', 'Shi ', 'Xun ', 'Guo ', 'Jiong ', 'Ye ', 'Nian ', 'Di ', 'Yu ', 'Bu ', 'Ya ', 'Juan ', 'Sui ', 'Pi ', 'Cheng ', 'Wan ', 'Ju ', 'Lun ', 'Zheng ', 'Kong ', 'Chong ', 'Dong ', 'Dai ', 'Tan ', 'An ', 'Cai ', 'Shu ', 'Beng ', 'Kan ', 'Zhi ', 'Duo ', 'Yi ', 'Zhi ', 'Yi ', 'Pei ', 'Ji ', 'Zhun ', 'Qi ', 'Sao ', 'Ju ', 'Ni ')
FEATURES = {"DEBUG_MODE": False} def feature(feature_id: str) -> bool: if feature_id not in FEATURES: raise ValueError("Key not a valid feature") return FEATURES[feature_id]
features = {'DEBUG_MODE': False} def feature(feature_id: str) -> bool: if feature_id not in FEATURES: raise value_error('Key not a valid feature') return FEATURES[feature_id]
team_names = ['LA Chargers', 'LA Rams', 'NE Patriots', 'NY Giants', 'Chicago Bears'] locations = ['LA', 'NY', 'SF', 'CH', 'NE'] weeks = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
team_names = ['LA Chargers', 'LA Rams', 'NE Patriots', 'NY Giants', 'Chicago Bears'] locations = ['LA', 'NY', 'SF', 'CH', 'NE'] weeks = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
x = int(input("")) y = int(input("")) div = int(x/y) print(div) mod = int(x % y) print(mod) z = divmod(x, y) print(z)
x = int(input('')) y = int(input('')) div = int(x / y) print(div) mod = int(x % y) print(mod) z = divmod(x, y) print(z)
red = 'Red' blue = 'Blue' green = 'Green' spring_green = 'SpringGreen' hot_pink = 'HotPink' blue_violet = 'BlueViolet' cadet_blue = 'CadetBlue' chocolate = 'Chocolate' coral = 'Coral' dodger_blue = 'DodgerBlue' firebrick = 'Firebrick' golden_rod = 'GoldenRod' orange_red = 'OrangeRed' yellow_green = 'YellowGreen' sea_green = 'SeaGreen'
red = 'Red' blue = 'Blue' green = 'Green' spring_green = 'SpringGreen' hot_pink = 'HotPink' blue_violet = 'BlueViolet' cadet_blue = 'CadetBlue' chocolate = 'Chocolate' coral = 'Coral' dodger_blue = 'DodgerBlue' firebrick = 'Firebrick' golden_rod = 'GoldenRod' orange_red = 'OrangeRed' yellow_green = 'YellowGreen' sea_green = 'SeaGreen'
class Solution: def numSub(self, s: str) -> int: l = [int(i) for i in s] res = 0 i = 0 while i < len(l): if l[i] != 1: i += 1 continue count = 0 curr = 0 while i < len(l) and l[i] == 1: i += 1 count += 1 curr += count res += curr res %= 10**9+7 return res
class Solution: def num_sub(self, s: str) -> int: l = [int(i) for i in s] res = 0 i = 0 while i < len(l): if l[i] != 1: i += 1 continue count = 0 curr = 0 while i < len(l) and l[i] == 1: i += 1 count += 1 curr += count res += curr res %= 10 ** 9 + 7 return res
class conta_corrente: def __Init__(self, nome): self.nome = nome self.email = None self.telefone = None self._saldo = 0 def _checar_saldo(self, valor): return self._saldo >= valor def depositar(self, valor): self._saldo += valor def sacar(self, valor): if self._checar_saldo(valor): self._saldo -= valor return True else: return False def obter_saldo(self): return self._saldo
class Conta_Corrente: def ___init__(self, nome): self.nome = nome self.email = None self.telefone = None self._saldo = 0 def _checar_saldo(self, valor): return self._saldo >= valor def depositar(self, valor): self._saldo += valor def sacar(self, valor): if self._checar_saldo(valor): self._saldo -= valor return True else: return False def obter_saldo(self): return self._saldo
chromedriver_path='***' from_station='***' to_station='***' email='***' phone_num='***' full_name='***' card_num='***' exp='***' cvv='***'
chromedriver_path = '***' from_station = '***' to_station = '***' email = '***' phone_num = '***' full_name = '***' card_num = '***' exp = '***' cvv = '***'
# terrascript/data/camptocamp/jwt.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:19:50 UTC) __all__ = []
__all__ = []
mon_fichier = open("mdp.txt" , "r") crypt = mon_fichier.read() mon_fichier.close() mon_fichier = open("encrypt.txt" , "r") decrypt1 = mon_fichier.read() mon_fichier.close() def encrypt(crypt): number=input("donner une cle de cryptage (numero)") b=list(crypt) str(b) c=[ord(x)for x in(b)] d=[] for i in c: d.append(i+number) e=[chr(i) for i in (d)] e="".join(e) print ("ta cle est:", number,) mon_fichier = open("encrypt.txt" , "w") mon_fichier.write(e) mon_fichier.close() def decrypt(decrypt1): number=input("quelle est la cle de cryptage ?") b=list(decrypt1) str(b) c=[ord(x)for x in(b)] d=[] for i in c: d.append(i-number) e=[chr(i) for i in (d)] e="".join(e) mon_fichier = open("decrypt.txt" , "w") mon_fichier.write(e) mon_fichier.close() def menu(): print ("Que veut-tu faire ??") print ("1 pour Encrypter un document") print ("2 pour Decrypter un ducoment") choice=input("fait ton choix:") if choice=="1": run = encrypt(crypt) run menu() elif choice=="2": derun=decrypt(decrypt1) derun menu() menu()
mon_fichier = open('mdp.txt', 'r') crypt = mon_fichier.read() mon_fichier.close() mon_fichier = open('encrypt.txt', 'r') decrypt1 = mon_fichier.read() mon_fichier.close() def encrypt(crypt): number = input('donner une cle de cryptage (numero)') b = list(crypt) str(b) c = [ord(x) for x in b] d = [] for i in c: d.append(i + number) e = [chr(i) for i in d] e = ''.join(e) print('ta cle est:', number) mon_fichier = open('encrypt.txt', 'w') mon_fichier.write(e) mon_fichier.close() def decrypt(decrypt1): number = input('quelle est la cle de cryptage ?') b = list(decrypt1) str(b) c = [ord(x) for x in b] d = [] for i in c: d.append(i - number) e = [chr(i) for i in d] e = ''.join(e) mon_fichier = open('decrypt.txt', 'w') mon_fichier.write(e) mon_fichier.close() def menu(): print('Que veut-tu faire ??') print('1 pour Encrypter un document') print('2 pour Decrypter un ducoment') choice = input('fait ton choix:') if choice == '1': run = encrypt(crypt) run menu() elif choice == '2': derun = decrypt(decrypt1) derun menu() menu()
'''dom.py contains all referenced dom elements. Gathering all fragile dom elements in one config file makes it easier to maintain the code''' def dom(): dom = { 'loginButton': 'html/body/div[3]/header/div/div/div/div[2]/button/span', 'einverstandenButton': 'div.c-button--bold', 'usernameInput': 'Username' } return dom
"""dom.py contains all referenced dom elements. Gathering all fragile dom elements in one config file makes it easier to maintain the code""" def dom(): dom = {'loginButton': 'html/body/div[3]/header/div/div/div/div[2]/button/span', 'einverstandenButton': 'div.c-button--bold', 'usernameInput': 'Username'} return dom
''' 2. Write a Python Program to read the contents of a file and find how many upper case letters, lower case letters and digits existed in the file. ''' file = open('SampleCount.txt','r') data = file.read() print('Contents of a file is') print(data) digit = upper = lower = special = 0 for ch in data: if ch.islower(): lower += 1 elif ch.isupper(): upper += 1 elif ch.isdigit(): digit += 1 else: special += 1 print('Number of Upper Case Letters in a file is',upper) print('Number of Lower Case Letters in a file is',lower) print('Number of digits in a file is',digit) print('Number of Special Characters in a file is',special) file.close()
""" 2. Write a Python Program to read the contents of a file and find how many upper case letters, lower case letters and digits existed in the file. """ file = open('SampleCount.txt', 'r') data = file.read() print('Contents of a file is') print(data) digit = upper = lower = special = 0 for ch in data: if ch.islower(): lower += 1 elif ch.isupper(): upper += 1 elif ch.isdigit(): digit += 1 else: special += 1 print('Number of Upper Case Letters in a file is', upper) print('Number of Lower Case Letters in a file is', lower) print('Number of digits in a file is', digit) print('Number of Special Characters in a file is', special) file.close()
# Specialization: Google IT Automation with Python # Course 01: Crash Course with Python # Week 5 Module Part 2 Exercise 02 # Student: Shawn Solomon # Learning Platform: Coursera.org # Want to see this in action? # In this code, there's a Person class that has an attribute name, which gets set when constructing # the object. Fill in the blanks so that 1) when an instance of the class is created, the attribute # gets set correctly, and 2) when the greeting() method is called, the greeting states the assigned name. # class Person: # def __init__(self, name): # self.name = ___ # def greeting(self): # # Should return "hi, my name is " followed by the name of the Person. # return ___ # # Create a new instance with a name of your choice # some_person = ___ # # Call the greeting method # print(some_person.___) class Person: def __init__(self, name): self.name = name def greeting(self): # Should return "hi, my name is " followed by the name of the Person. return "hi, my name is {}".format(self.name) # Create a new instance with a name of your choice some_person = Person("Nobody") # Call the greeting method print(some_person.greeting())
class Person: def __init__(self, name): self.name = name def greeting(self): return 'hi, my name is {}'.format(self.name) some_person = person('Nobody') print(some_person.greeting())
def solve(data): result = 0 # Declares an unordered collection of unique elements unique_frequencies = set() while True: for number in data: result += number # Checks if current sum(result) already exists in the collection if result in unique_frequencies: # Breaks out of the function and returns the result return result # Adds current sum(result) to the collection unique_frequencies.add(result)
def solve(data): result = 0 unique_frequencies = set() while True: for number in data: result += number if result in unique_frequencies: return result unique_frequencies.add(result)
def next_13_numbers_product(num, start): if start + 13 > len(num): return 0 x = 1 for index in range(start, start + 13): x *= int(num[index]) return x number = "73167176531330624919225119674426574742355349194934\ 96983520312774506326239578318016984801869478851843\ 85861560789112949495459501737958331952853208805511\ 12540698747158523863050715693290963295227443043557\ 66896648950445244523161731856403098711121722383113\ 62229893423380308135336276614282806444486645238749\ 30358907296290491560440772390713810515859307960866\ 70172427121883998797908792274921901699720888093776\ 65727333001053367881220235421809751254540594752243\ 52584907711670556013604839586446706324415722155397\ 53697817977846174064955149290862569321978468622482\ 83972241375657056057490261407972968652414535100474\ 82166370484403199890008895243450658541227588666881\ 16427171479924442928230863465674813919123162824586\ 17866458359124566529476545682848912883142607690042\ 24219022671055626321111109370544217506941658960408\ 07198403850962455444362981230987879927244284909188\ 84580156166097919133875499200524063689912560717606\ 05886116467109405077541002256983155200055935729725\ 71636269561882670428252483600823257530420752963450" maxValue = 0 for i in range(0, len(number)): value = next_13_numbers_product(number, i) maxValue = value if value > maxValue else maxValue print(maxValue)
def next_13_numbers_product(num, start): if start + 13 > len(num): return 0 x = 1 for index in range(start, start + 13): x *= int(num[index]) return x number = '7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450' max_value = 0 for i in range(0, len(number)): value = next_13_numbers_product(number, i) max_value = value if value > maxValue else maxValue print(maxValue)
class Solution: def intervalIntersection(self, A: List[List[int]], B: List[List[int]]) -> List[List[int]]: ans = [] i = 0 j = 0 while i < len(A) and j < len(B): if A[i][0] <= B[j][0] and A[i][1] >= B[j][1]: C = [] C.append(B[j][0]) C.append(B[j][1]) ans.append(C) elif B[j][0] <= A[i][0] and B[j][1] >= A[i][1]: C = [] C.append(A[i][0]) C.append(A[i][1]) ans.append(C) elif A[i][0] <= B[j][0] and B[j][0] <= A[i][1] and A[i][1] <= B[j][1]: C = [] C.append(B[j][0]) C.append(A[i][1]) ans.append(C) elif B[j][0] <= A[i][0] and A[i][0] <= B[j][1] and B[j][1] <= A[i][1]: C = [] C.append(A[i][0]) C.append(B[j][1]) ans.append(C) if A[i][1] < B[j][1]: i += 1 else: j += 1 return ans
class Solution: def interval_intersection(self, A: List[List[int]], B: List[List[int]]) -> List[List[int]]: ans = [] i = 0 j = 0 while i < len(A) and j < len(B): if A[i][0] <= B[j][0] and A[i][1] >= B[j][1]: c = [] C.append(B[j][0]) C.append(B[j][1]) ans.append(C) elif B[j][0] <= A[i][0] and B[j][1] >= A[i][1]: c = [] C.append(A[i][0]) C.append(A[i][1]) ans.append(C) elif A[i][0] <= B[j][0] and B[j][0] <= A[i][1] and (A[i][1] <= B[j][1]): c = [] C.append(B[j][0]) C.append(A[i][1]) ans.append(C) elif B[j][0] <= A[i][0] and A[i][0] <= B[j][1] and (B[j][1] <= A[i][1]): c = [] C.append(A[i][0]) C.append(B[j][1]) ans.append(C) if A[i][1] < B[j][1]: i += 1 else: j += 1 return ans
def fibonacci(): a = 0 b = 1 while True: # keep going... yield a # report value, a, during this pass future = a + b a = b # this will be next value reported b = future # and subsequently this
def fibonacci(): a = 0 b = 1 while True: yield a future = a + b a = b b = future
X = int(input()) Y = int(input()) print(int(input())*60 + int(input())) a = int(input()) print(a//60) print(a%60) x=int(input()) h=int(input()) m=int(input()) print(h+(x+m)//60) print((x+m)%60)
x = int(input()) y = int(input()) print(int(input()) * 60 + int(input())) a = int(input()) print(a // 60) print(a % 60) x = int(input()) h = int(input()) m = int(input()) print(h + (x + m) // 60) print((x + m) % 60)
def confusion_matrix(yreal, ypred): n_classes = len(set(yreal)) new_matrix = [] print("len yreal: ", len(yreal)) print("len ypred: ", len(ypred)) print("n classes: ", n_classes) for i_class in range(n_classes): new_matrix.append([]) for _ in range(n_classes): #i_ypred new_matrix[i_class].append(0.0) for i_yreal in range(len(yreal)): new_matrix[yreal[i_yreal]][ypred[i_yreal]] += 1 return new_matrix def normalize(confusion_matrix): new_matrix = [] for irow in range(len(confusion_matrix)): new_matrix.append([]) sum_row = sum(confusion_matrix[irow]) for idata in range(len(confusion_matrix[irow])): if sum_row == 0: new_matrix[irow].append(0.0) else: new_matrix[irow].append(confusion_matrix[irow][idata]/float(sum_row)) return new_matrix
def confusion_matrix(yreal, ypred): n_classes = len(set(yreal)) new_matrix = [] print('len yreal: ', len(yreal)) print('len ypred: ', len(ypred)) print('n classes: ', n_classes) for i_class in range(n_classes): new_matrix.append([]) for _ in range(n_classes): new_matrix[i_class].append(0.0) for i_yreal in range(len(yreal)): new_matrix[yreal[i_yreal]][ypred[i_yreal]] += 1 return new_matrix def normalize(confusion_matrix): new_matrix = [] for irow in range(len(confusion_matrix)): new_matrix.append([]) sum_row = sum(confusion_matrix[irow]) for idata in range(len(confusion_matrix[irow])): if sum_row == 0: new_matrix[irow].append(0.0) else: new_matrix[irow].append(confusion_matrix[irow][idata] / float(sum_row)) return new_matrix
def quicksort(array): if len(array) < 2: return array print(quicksort([ ]))
def quicksort(array): if len(array) < 2: return array print(quicksort([]))
# # PySNMP MIB module Unisphere-Data-SONET-CONF (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-SONET-CONF # Produced by pysmi-0.3.4 at Wed May 1 15:32:59 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ConstraintsUnion, ValueRangeConstraint, ConstraintsIntersection, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ConstraintsUnion", "ValueRangeConstraint", "ConstraintsIntersection", "ValueSizeConstraint") ModuleCompliance, NotificationGroup, AgentCapabilities = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "AgentCapabilities") iso, ModuleIdentity, TimeTicks, Integer32, ObjectIdentity, Counter64, Gauge32, Unsigned32, Counter32, NotificationType, Bits, IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "iso", "ModuleIdentity", "TimeTicks", "Integer32", "ObjectIdentity", "Counter64", "Gauge32", "Unsigned32", "Counter32", "NotificationType", "Bits", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "MibIdentifier") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") sonetLineStuff2, sonetSectionStuff, sonetVTStuff2, sonetMediumTimeElapsed, sonetVTStuff, sonetMediumLineType, sonetMediumValidIntervals, sonetSectionStuff2, sonetPathStuff2, sonetFarEndPathStuff2, sonetFarEndVTStuff2, sonetFarEndLineStuff2, sonetMediumStuff2, sonetMediumStuff, sonetPathStuff, sonetLineStuff, sonetMediumLoopbackConfig, sonetMediumLineCoding = mibBuilder.importSymbols("SONET-MIB", "sonetLineStuff2", "sonetSectionStuff", "sonetVTStuff2", "sonetMediumTimeElapsed", "sonetVTStuff", "sonetMediumLineType", "sonetMediumValidIntervals", "sonetSectionStuff2", "sonetPathStuff2", "sonetFarEndPathStuff2", "sonetFarEndVTStuff2", "sonetFarEndLineStuff2", "sonetMediumStuff2", "sonetMediumStuff", "sonetPathStuff", "sonetLineStuff", "sonetMediumLoopbackConfig", "sonetMediumLineCoding") usDataAgents, = mibBuilder.importSymbols("Unisphere-Data-Agents", "usDataAgents") usdSonetGroup, usdSonetVirtualTributaryGroup, usdSonetPathGroup = mibBuilder.importSymbols("Unisphere-Data-SONET-MIB", "usdSonetGroup", "usdSonetVirtualTributaryGroup", "usdSonetPathGroup") usdSonetAgent = ModuleIdentity((1, 3, 6, 1, 4, 1, 4874, 5, 2, 40)) usdSonetAgent.setRevisions(('2002-02-04 21:35', '2001-04-03 22:35',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: usdSonetAgent.setRevisionsDescriptions(('Separate out the SONET VT support.', 'The initial release of this management information module.',)) if mibBuilder.loadTexts: usdSonetAgent.setLastUpdated('200202042135Z') if mibBuilder.loadTexts: usdSonetAgent.setOrganization('Unisphere Networks, Inc.') if mibBuilder.loadTexts: usdSonetAgent.setContactInfo(' Unisphere Networks, Inc. Postal: 10 Technology Park Drive Westford, MA 01886 USA Tel: +1 978 589 5800 E-mail: mib@UnisphereNetworks.com') if mibBuilder.loadTexts: usdSonetAgent.setDescription('The agent capabilities definitions for the SONET component of the SNMP agent in the Unisphere Routing Switch family of products.') usdSonetAgentV1 = AgentCapabilities((1, 3, 6, 1, 4, 1, 4874, 5, 2, 40, 1)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usdSonetAgentV1 = usdSonetAgentV1.setProductRelease('Version 1 of the SONET component of the Unisphere Routing Switch SNMP\n agent. This version of the SONET component was supported in the\n Unisphere RX 1.x system releases.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usdSonetAgentV1 = usdSonetAgentV1.setStatus('obsolete') if mibBuilder.loadTexts: usdSonetAgentV1.setDescription('The MIBs supported by the SNMP agent for the SONET application in the Unisphere Routing Switch. These capabilities became obsolete when support for the standard VT group was added.') usdSonetAgentV2 = AgentCapabilities((1, 3, 6, 1, 4, 1, 4874, 5, 2, 40, 2)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usdSonetAgentV2 = usdSonetAgentV2.setProductRelease('Version 2 of the SONET component of the Unisphere Routing Switch SNMP\n agent. This version of the SONET component was supported in the\n Unisphere RX 2.x system releases.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usdSonetAgentV2 = usdSonetAgentV2.setStatus('obsolete') if mibBuilder.loadTexts: usdSonetAgentV2.setDescription('The MIBs supported by the SNMP agent for the SONET application in the Unisphere Routing Switch. These capabilities became obsolete when support for the proprietary path and VT groups were added.') usdSonetAgentV3 = AgentCapabilities((1, 3, 6, 1, 4, 1, 4874, 5, 2, 40, 3)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usdSonetAgentV3 = usdSonetAgentV3.setProductRelease('Version 3 of the SONET component of the Unisphere Routing Switch SNMP\n agent. This version of the SONET component was supported in the\n Unisphere RX 3.0 and 3.1 system releases.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usdSonetAgentV3 = usdSonetAgentV3.setStatus('obsolete') if mibBuilder.loadTexts: usdSonetAgentV3.setDescription('The MIBs supported by the SNMP agent for the SONET application in the Unisphere Routing Switch. These capabilities became obsolete when support for the RFC-2558 version of the SONET-MIB and far-end statistics were added.') usdSonetAgentV4 = AgentCapabilities((1, 3, 6, 1, 4, 1, 4874, 5, 2, 40, 4)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usdSonetAgentV4 = usdSonetAgentV4.setProductRelease('Version 4 of the SONET component of the Unisphere Routing Switch SNMP\n agent. This version of the SONET component was supported in the\n Unisphere RX 3.2 system release.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usdSonetAgentV4 = usdSonetAgentV4.setStatus('obsolete') if mibBuilder.loadTexts: usdSonetAgentV4.setDescription('The MIBs supported by the SNMP agent for the SONET application in the Unisphere Routing Switch. These capabilities became obsolete when Virtual Tributary (VT) support was searated out into a separate capabilities statement.') usdSonetBasicAgent = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 5, 2, 40, 5)) usdSonetBasicAgentV1 = AgentCapabilities((1, 3, 6, 1, 4, 1, 4874, 5, 2, 40, 5, 1)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usdSonetBasicAgentV1 = usdSonetBasicAgentV1.setProductRelease('Version 1 of the basic SONET component of the Unisphere Routing Switch\n SNMP agent. It does not include Virtual Tributary (VT) support. This\n version of the basic SONET component is supported in the Unisphere RX\n 3.3 and subsequent system releases.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usdSonetBasicAgentV1 = usdSonetBasicAgentV1.setStatus('current') if mibBuilder.loadTexts: usdSonetBasicAgentV1.setDescription('The MIB conformance groups supported by the SNMP agent for the SONET application in the Unisphere Routing Switch.') usdSonetVTAgent = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 5, 2, 40, 6)) usdSonetVTAgentV1 = AgentCapabilities((1, 3, 6, 1, 4, 1, 4874, 5, 2, 40, 6, 1)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usdSonetVTAgentV1 = usdSonetVTAgentV1.setProductRelease('Version 1 of the SONET VT component of the Unisphere Routing Switch\n SNMP agent. This version of the SONET component is supported in the\n Unisphere RX 3.3 and subsequent system releases.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usdSonetVTAgentV1 = usdSonetVTAgentV1.setStatus('current') if mibBuilder.loadTexts: usdSonetVTAgentV1.setDescription('The MIB conformance groups supported by the SNMP agent for the SONET application in the Unisphere Routing Switch.') mibBuilder.exportSymbols("Unisphere-Data-SONET-CONF", usdSonetVTAgentV1=usdSonetVTAgentV1, usdSonetAgentV3=usdSonetAgentV3, usdSonetAgentV4=usdSonetAgentV4, usdSonetAgentV1=usdSonetAgentV1, usdSonetVTAgent=usdSonetVTAgent, usdSonetBasicAgent=usdSonetBasicAgent, usdSonetAgentV2=usdSonetAgentV2, usdSonetAgent=usdSonetAgent, PYSNMP_MODULE_ID=usdSonetAgent, usdSonetBasicAgentV1=usdSonetBasicAgentV1)
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, value_range_constraint, constraints_intersection, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ConstraintsUnion', 'ValueRangeConstraint', 'ConstraintsIntersection', 'ValueSizeConstraint') (module_compliance, notification_group, agent_capabilities) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup', 'AgentCapabilities') (iso, module_identity, time_ticks, integer32, object_identity, counter64, gauge32, unsigned32, counter32, notification_type, bits, ip_address, mib_scalar, mib_table, mib_table_row, mib_table_column, mib_identifier) = mibBuilder.importSymbols('SNMPv2-SMI', 'iso', 'ModuleIdentity', 'TimeTicks', 'Integer32', 'ObjectIdentity', 'Counter64', 'Gauge32', 'Unsigned32', 'Counter32', 'NotificationType', 'Bits', 'IpAddress', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'MibIdentifier') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') (sonet_line_stuff2, sonet_section_stuff, sonet_vt_stuff2, sonet_medium_time_elapsed, sonet_vt_stuff, sonet_medium_line_type, sonet_medium_valid_intervals, sonet_section_stuff2, sonet_path_stuff2, sonet_far_end_path_stuff2, sonet_far_end_vt_stuff2, sonet_far_end_line_stuff2, sonet_medium_stuff2, sonet_medium_stuff, sonet_path_stuff, sonet_line_stuff, sonet_medium_loopback_config, sonet_medium_line_coding) = mibBuilder.importSymbols('SONET-MIB', 'sonetLineStuff2', 'sonetSectionStuff', 'sonetVTStuff2', 'sonetMediumTimeElapsed', 'sonetVTStuff', 'sonetMediumLineType', 'sonetMediumValidIntervals', 'sonetSectionStuff2', 'sonetPathStuff2', 'sonetFarEndPathStuff2', 'sonetFarEndVTStuff2', 'sonetFarEndLineStuff2', 'sonetMediumStuff2', 'sonetMediumStuff', 'sonetPathStuff', 'sonetLineStuff', 'sonetMediumLoopbackConfig', 'sonetMediumLineCoding') (us_data_agents,) = mibBuilder.importSymbols('Unisphere-Data-Agents', 'usDataAgents') (usd_sonet_group, usd_sonet_virtual_tributary_group, usd_sonet_path_group) = mibBuilder.importSymbols('Unisphere-Data-SONET-MIB', 'usdSonetGroup', 'usdSonetVirtualTributaryGroup', 'usdSonetPathGroup') usd_sonet_agent = module_identity((1, 3, 6, 1, 4, 1, 4874, 5, 2, 40)) usdSonetAgent.setRevisions(('2002-02-04 21:35', '2001-04-03 22:35')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: usdSonetAgent.setRevisionsDescriptions(('Separate out the SONET VT support.', 'The initial release of this management information module.')) if mibBuilder.loadTexts: usdSonetAgent.setLastUpdated('200202042135Z') if mibBuilder.loadTexts: usdSonetAgent.setOrganization('Unisphere Networks, Inc.') if mibBuilder.loadTexts: usdSonetAgent.setContactInfo(' Unisphere Networks, Inc. Postal: 10 Technology Park Drive Westford, MA 01886 USA Tel: +1 978 589 5800 E-mail: mib@UnisphereNetworks.com') if mibBuilder.loadTexts: usdSonetAgent.setDescription('The agent capabilities definitions for the SONET component of the SNMP agent in the Unisphere Routing Switch family of products.') usd_sonet_agent_v1 = agent_capabilities((1, 3, 6, 1, 4, 1, 4874, 5, 2, 40, 1)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usd_sonet_agent_v1 = usdSonetAgentV1.setProductRelease('Version 1 of the SONET component of the Unisphere Routing Switch SNMP\n agent. This version of the SONET component was supported in the\n Unisphere RX 1.x system releases.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usd_sonet_agent_v1 = usdSonetAgentV1.setStatus('obsolete') if mibBuilder.loadTexts: usdSonetAgentV1.setDescription('The MIBs supported by the SNMP agent for the SONET application in the Unisphere Routing Switch. These capabilities became obsolete when support for the standard VT group was added.') usd_sonet_agent_v2 = agent_capabilities((1, 3, 6, 1, 4, 1, 4874, 5, 2, 40, 2)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usd_sonet_agent_v2 = usdSonetAgentV2.setProductRelease('Version 2 of the SONET component of the Unisphere Routing Switch SNMP\n agent. This version of the SONET component was supported in the\n Unisphere RX 2.x system releases.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usd_sonet_agent_v2 = usdSonetAgentV2.setStatus('obsolete') if mibBuilder.loadTexts: usdSonetAgentV2.setDescription('The MIBs supported by the SNMP agent for the SONET application in the Unisphere Routing Switch. These capabilities became obsolete when support for the proprietary path and VT groups were added.') usd_sonet_agent_v3 = agent_capabilities((1, 3, 6, 1, 4, 1, 4874, 5, 2, 40, 3)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usd_sonet_agent_v3 = usdSonetAgentV3.setProductRelease('Version 3 of the SONET component of the Unisphere Routing Switch SNMP\n agent. This version of the SONET component was supported in the\n Unisphere RX 3.0 and 3.1 system releases.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usd_sonet_agent_v3 = usdSonetAgentV3.setStatus('obsolete') if mibBuilder.loadTexts: usdSonetAgentV3.setDescription('The MIBs supported by the SNMP agent for the SONET application in the Unisphere Routing Switch. These capabilities became obsolete when support for the RFC-2558 version of the SONET-MIB and far-end statistics were added.') usd_sonet_agent_v4 = agent_capabilities((1, 3, 6, 1, 4, 1, 4874, 5, 2, 40, 4)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usd_sonet_agent_v4 = usdSonetAgentV4.setProductRelease('Version 4 of the SONET component of the Unisphere Routing Switch SNMP\n agent. This version of the SONET component was supported in the\n Unisphere RX 3.2 system release.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usd_sonet_agent_v4 = usdSonetAgentV4.setStatus('obsolete') if mibBuilder.loadTexts: usdSonetAgentV4.setDescription('The MIBs supported by the SNMP agent for the SONET application in the Unisphere Routing Switch. These capabilities became obsolete when Virtual Tributary (VT) support was searated out into a separate capabilities statement.') usd_sonet_basic_agent = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 5, 2, 40, 5)) usd_sonet_basic_agent_v1 = agent_capabilities((1, 3, 6, 1, 4, 1, 4874, 5, 2, 40, 5, 1)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usd_sonet_basic_agent_v1 = usdSonetBasicAgentV1.setProductRelease('Version 1 of the basic SONET component of the Unisphere Routing Switch\n SNMP agent. It does not include Virtual Tributary (VT) support. This\n version of the basic SONET component is supported in the Unisphere RX\n 3.3 and subsequent system releases.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usd_sonet_basic_agent_v1 = usdSonetBasicAgentV1.setStatus('current') if mibBuilder.loadTexts: usdSonetBasicAgentV1.setDescription('The MIB conformance groups supported by the SNMP agent for the SONET application in the Unisphere Routing Switch.') usd_sonet_vt_agent = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 5, 2, 40, 6)) usd_sonet_vt_agent_v1 = agent_capabilities((1, 3, 6, 1, 4, 1, 4874, 5, 2, 40, 6, 1)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usd_sonet_vt_agent_v1 = usdSonetVTAgentV1.setProductRelease('Version 1 of the SONET VT component of the Unisphere Routing Switch\n SNMP agent. This version of the SONET component is supported in the\n Unisphere RX 3.3 and subsequent system releases.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usd_sonet_vt_agent_v1 = usdSonetVTAgentV1.setStatus('current') if mibBuilder.loadTexts: usdSonetVTAgentV1.setDescription('The MIB conformance groups supported by the SNMP agent for the SONET application in the Unisphere Routing Switch.') mibBuilder.exportSymbols('Unisphere-Data-SONET-CONF', usdSonetVTAgentV1=usdSonetVTAgentV1, usdSonetAgentV3=usdSonetAgentV3, usdSonetAgentV4=usdSonetAgentV4, usdSonetAgentV1=usdSonetAgentV1, usdSonetVTAgent=usdSonetVTAgent, usdSonetBasicAgent=usdSonetBasicAgent, usdSonetAgentV2=usdSonetAgentV2, usdSonetAgent=usdSonetAgent, PYSNMP_MODULE_ID=usdSonetAgent, usdSonetBasicAgentV1=usdSonetBasicAgentV1)
name1=["ales","Mark","Deny","Hendry"] name2=name1 name3=name1[:] name1=["Anand"] name3=["Murugan"] sum=0 for ls in (name1,name2,name3): if ls[0]=="Anand": sum+=1 pass if ls[1]=="Murugan": sum+=5 print(sum) pass
name1 = ['ales', 'Mark', 'Deny', 'Hendry'] name2 = name1 name3 = name1[:] name1 = ['Anand'] name3 = ['Murugan'] sum = 0 for ls in (name1, name2, name3): if ls[0] == 'Anand': sum += 1 pass if ls[1] == 'Murugan': sum += 5 print(sum) pass
def solution(): def integers(): x = 1 while True: yield x x += 1 def halves(): for x in integers(): yield x / 2 def take(n, seq): result = [] for i in range(n): result.append(next(seq)) return result return take, halves, integers take = solution()[0] halves = solution()[1] print(take(5, halves()))
def solution(): def integers(): x = 1 while True: yield x x += 1 def halves(): for x in integers(): yield (x / 2) def take(n, seq): result = [] for i in range(n): result.append(next(seq)) return result return (take, halves, integers) take = solution()[0] halves = solution()[1] print(take(5, halves()))
# Copyright (c) 2017 Pieter Wuille # Copyright (c) 2018 Oskar Hladky # Copyright (c) 2018 Pavol Rusnak # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l" ADDRESS_TYPE_P2KH = 0 ADDRESS_TYPE_P2SH = 8 def cashaddr_polymod(values): generator = [0x98F2BC8E61, 0x79B76D99E2, 0xF33E5FB3C4, 0xAE2EABE2A8, 0x1E4F43E470] chk = 1 for value in values: top = chk >> 35 chk = ((chk & 0x07FFFFFFFF) << 5) ^ value for i in range(5): chk ^= generator[i] if (top & (1 << i)) else 0 return chk ^ 1 def prefix_expand(prefix): return [ord(x) & 0x1F for x in prefix] + [0] def calculate_checksum(prefix, payload): poly = cashaddr_polymod(prefix_expand(prefix) + payload + [0, 0, 0, 0, 0, 0, 0, 0]) out = list() for i in range(8): out.append((poly >> 5 * (7 - i)) & 0x1F) return out def verify_checksum(prefix, payload): return cashaddr_polymod(prefix_expand(prefix) + payload) == 0 def b32decode(inputs): out = list() for letter in inputs: out.append(CHARSET.find(letter)) return out def b32encode(inputs): out = "" for char_code in inputs: out += CHARSET[char_code] return out def convertbits(data, frombits, tobits, pad=True): acc = 0 bits = 0 ret = [] maxv = (1 << tobits) - 1 max_acc = (1 << (frombits + tobits - 1)) - 1 for value in data: if value < 0 or (value >> frombits): return None acc = ((acc << frombits) | value) & max_acc bits += frombits while bits >= tobits: bits -= tobits ret.append((acc >> bits) & maxv) if pad: if bits: ret.append((acc << (tobits - bits)) & maxv) elif bits >= frombits or ((acc << (tobits - bits)) & maxv): return None return ret def encode(prefix, version, payload): payload = bytes([version]) + payload payload = convertbits(payload, 8, 5) checksum = calculate_checksum(prefix, payload) return prefix + ":" + b32encode(payload + checksum) def decode(prefix, addr): addr = addr.lower() decoded = b32decode(addr) if not verify_checksum(prefix, decoded): raise ValueError("Bad cashaddr checksum") data = bytes(convertbits(decoded, 5, 8)) return data[0], data[1:-6]
charset = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l' address_type_p2_kh = 0 address_type_p2_sh = 8 def cashaddr_polymod(values): generator = [656907472481, 522768456162, 1044723512260, 748107326120, 130178868336] chk = 1 for value in values: top = chk >> 35 chk = (chk & 34359738367) << 5 ^ value for i in range(5): chk ^= generator[i] if top & 1 << i else 0 return chk ^ 1 def prefix_expand(prefix): return [ord(x) & 31 for x in prefix] + [0] def calculate_checksum(prefix, payload): poly = cashaddr_polymod(prefix_expand(prefix) + payload + [0, 0, 0, 0, 0, 0, 0, 0]) out = list() for i in range(8): out.append(poly >> 5 * (7 - i) & 31) return out def verify_checksum(prefix, payload): return cashaddr_polymod(prefix_expand(prefix) + payload) == 0 def b32decode(inputs): out = list() for letter in inputs: out.append(CHARSET.find(letter)) return out def b32encode(inputs): out = '' for char_code in inputs: out += CHARSET[char_code] return out def convertbits(data, frombits, tobits, pad=True): acc = 0 bits = 0 ret = [] maxv = (1 << tobits) - 1 max_acc = (1 << frombits + tobits - 1) - 1 for value in data: if value < 0 or value >> frombits: return None acc = (acc << frombits | value) & max_acc bits += frombits while bits >= tobits: bits -= tobits ret.append(acc >> bits & maxv) if pad: if bits: ret.append(acc << tobits - bits & maxv) elif bits >= frombits or acc << tobits - bits & maxv: return None return ret def encode(prefix, version, payload): payload = bytes([version]) + payload payload = convertbits(payload, 8, 5) checksum = calculate_checksum(prefix, payload) return prefix + ':' + b32encode(payload + checksum) def decode(prefix, addr): addr = addr.lower() decoded = b32decode(addr) if not verify_checksum(prefix, decoded): raise value_error('Bad cashaddr checksum') data = bytes(convertbits(decoded, 5, 8)) return (data[0], data[1:-6])
lines = open('input','r').readlines() size_linea = 12 unos = [0,0,0,0,0,0,0,0,0,0,0,0] for line in lines: for i in range(size_linea): if (line[i] == '1'): unos[i] += 1 media = len(lines)/2 gamma = 0 epsilon = 0 for i in range(size_linea): if (unos[i] > media): gamma += 2**(size_linea - (i+1)) else: epsilon += 2**(size_linea - (i+1)) print(gamma) print(epsilon) print(gamma*epsilon)
lines = open('input', 'r').readlines() size_linea = 12 unos = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] for line in lines: for i in range(size_linea): if line[i] == '1': unos[i] += 1 media = len(lines) / 2 gamma = 0 epsilon = 0 for i in range(size_linea): if unos[i] > media: gamma += 2 ** (size_linea - (i + 1)) else: epsilon += 2 ** (size_linea - (i + 1)) print(gamma) print(epsilon) print(gamma * epsilon)
# Using flag prompt = "\nTell me your name, and I will reprint your name: " prompt += "\nEnter 'quit' to end the program." active = True while active: message = input(prompt) if message == 'quit': active = False else: print(message)
prompt = '\nTell me your name, and I will reprint your name: ' prompt += "\nEnter 'quit' to end the program." active = True while active: message = input(prompt) if message == 'quit': active = False else: print(message)
print('Numeros pares!!!') print('=-=' * 15) for c in range(2, 52, 2): print(c) print('=-=' * 15) print('ACABOU.')
print('Numeros pares!!!') print('=-=' * 15) for c in range(2, 52, 2): print(c) print('=-=' * 15) print('ACABOU.')
class medicamento: def __init__(self, id, nombre, precio, descripcion, cantidad, rol): self.id = id self.nombre = nombre self.precio = precio self.descripcion = descripcion self.cantidad = cantidad self.rol = rol def actualizar_datos(self, id, nombre, precio, descripcion, cantidad, rol): self.id = id self.nombre = nombre self.precio = precio self.descripcion = descripcion self.cantidad = cantidad self.rol = rol def dump(self): return { 'id': self.id, 'nombre': self.nombre, 'precio': self.precio, 'cantidad': self.cantidad, 'rol': self.rol } def __str__(self): return f"Medicamento: [ id: {self.id}, nombre: {self.nombre}, precio: {self.precio}, cantidad: {self.cantidad}, rol: {self.rol}]"
class Medicamento: def __init__(self, id, nombre, precio, descripcion, cantidad, rol): self.id = id self.nombre = nombre self.precio = precio self.descripcion = descripcion self.cantidad = cantidad self.rol = rol def actualizar_datos(self, id, nombre, precio, descripcion, cantidad, rol): self.id = id self.nombre = nombre self.precio = precio self.descripcion = descripcion self.cantidad = cantidad self.rol = rol def dump(self): return {'id': self.id, 'nombre': self.nombre, 'precio': self.precio, 'cantidad': self.cantidad, 'rol': self.rol} def __str__(self): return f'Medicamento: [ id: {self.id}, nombre: {self.nombre}, precio: {self.precio}, cantidad: {self.cantidad}, rol: {self.rol}]'
def test_it(binbb, groups_cfg): for account, accgrp_cfg in groups_cfg.items(): bbcmd = ["groups", "--account", account] res = binbb.sysexec(*bbcmd) # very simple test of group names and member names being seen in output for group_name, members in accgrp_cfg.items(): assert group_name in res for member_name in members: assert member_name in res
def test_it(binbb, groups_cfg): for (account, accgrp_cfg) in groups_cfg.items(): bbcmd = ['groups', '--account', account] res = binbb.sysexec(*bbcmd) for (group_name, members) in accgrp_cfg.items(): assert group_name in res for member_name in members: assert member_name in res
def pattern_eighten(steps): ''' Pattern eighteen 9 8 7 6 5 4 3 2 1 9 8 7 6 5 4 3 2 9 8 7 6 5 4 3 9 8 7 6 5 4 9 8 7 6 5 9 8 7 6 9 8 7 9 8 9 ''' get_range = [str(i) for i in range(1, steps + 1)][::-1] for i in range(len(get_range), 0, -1): join = ' '.join(get_range[:i]) print(join) if __name__ == '__main__': try: pattern_eighten(9) except NameError: print('Integer was expected')
def pattern_eighten(steps): """ Pattern eighteen 9 8 7 6 5 4 3 2 1 9 8 7 6 5 4 3 2 9 8 7 6 5 4 3 9 8 7 6 5 4 9 8 7 6 5 9 8 7 6 9 8 7 9 8 9 """ get_range = [str(i) for i in range(1, steps + 1)][::-1] for i in range(len(get_range), 0, -1): join = ' '.join(get_range[:i]) print(join) if __name__ == '__main__': try: pattern_eighten(9) except NameError: print('Integer was expected')
# puck_properties_consts.py # # ~~~~~~~~~~~~ # # pyHand Constants File # # ~~~~~~~~~~~~ # # ------------------------------------------------------------------ # Authors : Chloe Eghtebas, # Brendan Ritter, # Pravina Samaratunga, # Jason Schwartz # # Last change: 08.08.2013 # # Language: Python 2.7 # ------------------------------------------------------------------ # # This version of pyHand is free software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation. # #PuckID FINGER1 = 11 FINGER2 = 12 FINGER3 = 13 SPREAD = 14 ALL_FINGERS=(FINGER1,FINGER2,FINGER3,SPREAD) GRASP=(FINGER1,FINGER2,FINGER3) #Property = ID ACCEL = 82 ADDR = 6 ANA0 = 18 ANA1 = 19 BAUD = 12 CMD = 29 CMD_LOAD=0 CMD_SAVE=1 CMD_RESET=2 CMD_DEF=3 CMD_GET=4 CMD_FIND=5 CMD_SET=6 CMD_HOME=7 CMD_KEEP=8 CMD_LOOP=9 CMD_PASS=10 CMD_VERS=11 CMD_ERR=12 CMD_HI=13 CMD_IC=14 CMD_IO=15 CMD_TC=16 CMD_TO=17 CMD_CLOSE=18 CMD_MOVE=19 CMD_OPEN=20 CMD_TERM=21 CMD_HELP=22 CMD_PPSINIT=23 CMD_TESTEE=24 CT = 56 CT2 = 57 CTS = 68 CTS2 = 69 DEF = 32 DIG0 = 14 DIG1 = 15 DP = 50 DP2 = 51 DS = 60 E = 52 E2 = 53 ECMAX = 101 ECMIN = 102 EN = 94 EN2 = 95 ERROR = 4 FET0 = 16 FET1 = 17 FIND = 33 GRPA = 26 GRPB = 27 GRPC = 28 HALLH = 88 HALLH2 = 89 HALLS = 87 HOLD = 77 HSG = 71 ID = 3 IHIT = 108 IKCOR = 93 IKI = 92 IKP = 91 ILOGIC = 24 IMOTOR = 22 IOFF = 74 IOFF2 = 75 IOFST = 62 IPNM = 86 IVEL = 73 JIDX = 85 JOFST = 98 JOFST2 = 99 JP = 96 JP2 = 97 KD = 80 KI = 81 KP = 79 LCTC = 104 LCVC = 105 LFLAGS = 103 LOAD = 31 LOCK = 13 LSG = 72 M = 58 M2 = 59 MAX_ENCODER_TICKS=195000.0 MAX_SPREAD_TICKS=36000.0 MAX_FINGERTIP_TICKS=78000.0 MCV = 46 MDS = 65 MECH = 66 MECH2 = 67 MODE = 8 MODE_IDLE=0 MODE_TORQUE=2 MODE_PID=3 MODE_VEL=4 MODE_TRAP=5 MOFST = 61 MOV = 47 MPE = 76 MT = 43 MV = 45 OD = 64 OT = 54 OT2 = 55 OTEMP = 11 P = 48 P2 = 49 PIDX = 70 POLES = 90 PTEMP = 10 ROLE = 1 SAVE = 30 SG = 25 SN = 2 STAT = 5 T = 42 TACT = 106 TACT_FULL=2 TACT_10=1 TACTID = 107 TACTID = 107 TEMP = 9 TENSO = 84 TENST = 83 THERM = 20 TIE = 100 TSTOP = 78 UPSECS = 63 V = 44 VALUE = 7 VBUS = 21 VERS = 0 VLOGIC = 23 X0 = 34 X1 = 35 X2 = 36 X3 = 37 X4 = 38 X5 = 39 X6 = 40 X7 = 41 FTS = 8 FTS_SG1 = 42 FTS_SG2 = 43 FTS_SG3 = 44 FTS_SG4 = 45 FTS_SG5 = 46 FTS_SG6 = 47 FTS_FX = 48 FTS_FY = 49 FTS_FZ = 50 FTS_TX = 51 FTS_TY = 52 FTS_TZ = 53 FTS_FT = 54 FTS_AX = 55 FTS_AY = 56 FTS_AZ = 57 FTS_GM = 58 FTS_OV = 59 FTS_LED = 60 FTS_T1 = 61 FTS_T2 = 62 FTS_T3 = 63 FTS_A = 64 NO_WRITE_PROPERTIES = [ANA0, ANA1, CT2, DP2, E2, EN2, ERROR, HALLH2, ILOGIC, IMOTOR, IOFF2, JOFST2, JP2, M2, MECH, MECH2, OT2, P2, SG, TEMP, THERM, VBUS, VLOGIC] NO_READ_PROPERTIES = [CMD, CT2, DEF, DP2, E2, EN2, FIND, HALLH2, IOFF2, JOFST2, JP2, LOAD, LOCK, M, M2, MECH2, OT2, P2, SAVE] LOCKED_PROPERTIES = [DIG0, DIG1, FET0, FET1, HALLH, HALLS, OD, PTEMP, ROLE, SN]
finger1 = 11 finger2 = 12 finger3 = 13 spread = 14 all_fingers = (FINGER1, FINGER2, FINGER3, SPREAD) grasp = (FINGER1, FINGER2, FINGER3) accel = 82 addr = 6 ana0 = 18 ana1 = 19 baud = 12 cmd = 29 cmd_load = 0 cmd_save = 1 cmd_reset = 2 cmd_def = 3 cmd_get = 4 cmd_find = 5 cmd_set = 6 cmd_home = 7 cmd_keep = 8 cmd_loop = 9 cmd_pass = 10 cmd_vers = 11 cmd_err = 12 cmd_hi = 13 cmd_ic = 14 cmd_io = 15 cmd_tc = 16 cmd_to = 17 cmd_close = 18 cmd_move = 19 cmd_open = 20 cmd_term = 21 cmd_help = 22 cmd_ppsinit = 23 cmd_testee = 24 ct = 56 ct2 = 57 cts = 68 cts2 = 69 def = 32 dig0 = 14 dig1 = 15 dp = 50 dp2 = 51 ds = 60 e = 52 e2 = 53 ecmax = 101 ecmin = 102 en = 94 en2 = 95 error = 4 fet0 = 16 fet1 = 17 find = 33 grpa = 26 grpb = 27 grpc = 28 hallh = 88 hallh2 = 89 halls = 87 hold = 77 hsg = 71 id = 3 ihit = 108 ikcor = 93 iki = 92 ikp = 91 ilogic = 24 imotor = 22 ioff = 74 ioff2 = 75 iofst = 62 ipnm = 86 ivel = 73 jidx = 85 jofst = 98 jofst2 = 99 jp = 96 jp2 = 97 kd = 80 ki = 81 kp = 79 lctc = 104 lcvc = 105 lflags = 103 load = 31 lock = 13 lsg = 72 m = 58 m2 = 59 max_encoder_ticks = 195000.0 max_spread_ticks = 36000.0 max_fingertip_ticks = 78000.0 mcv = 46 mds = 65 mech = 66 mech2 = 67 mode = 8 mode_idle = 0 mode_torque = 2 mode_pid = 3 mode_vel = 4 mode_trap = 5 mofst = 61 mov = 47 mpe = 76 mt = 43 mv = 45 od = 64 ot = 54 ot2 = 55 otemp = 11 p = 48 p2 = 49 pidx = 70 poles = 90 ptemp = 10 role = 1 save = 30 sg = 25 sn = 2 stat = 5 t = 42 tact = 106 tact_full = 2 tact_10 = 1 tactid = 107 tactid = 107 temp = 9 tenso = 84 tenst = 83 therm = 20 tie = 100 tstop = 78 upsecs = 63 v = 44 value = 7 vbus = 21 vers = 0 vlogic = 23 x0 = 34 x1 = 35 x2 = 36 x3 = 37 x4 = 38 x5 = 39 x6 = 40 x7 = 41 fts = 8 fts_sg1 = 42 fts_sg2 = 43 fts_sg3 = 44 fts_sg4 = 45 fts_sg5 = 46 fts_sg6 = 47 fts_fx = 48 fts_fy = 49 fts_fz = 50 fts_tx = 51 fts_ty = 52 fts_tz = 53 fts_ft = 54 fts_ax = 55 fts_ay = 56 fts_az = 57 fts_gm = 58 fts_ov = 59 fts_led = 60 fts_t1 = 61 fts_t2 = 62 fts_t3 = 63 fts_a = 64 no_write_properties = [ANA0, ANA1, CT2, DP2, E2, EN2, ERROR, HALLH2, ILOGIC, IMOTOR, IOFF2, JOFST2, JP2, M2, MECH, MECH2, OT2, P2, SG, TEMP, THERM, VBUS, VLOGIC] no_read_properties = [CMD, CT2, DEF, DP2, E2, EN2, FIND, HALLH2, IOFF2, JOFST2, JP2, LOAD, LOCK, M, M2, MECH2, OT2, P2, SAVE] locked_properties = [DIG0, DIG1, FET0, FET1, HALLH, HALLS, OD, PTEMP, ROLE, SN]
# # @lc app=leetcode id=680 lang=python3 # # [680] Valid Palindrome II # # https://leetcode.com/problems/valid-palindrome-ii/description/ # # algorithms # Easy (37.22%) # Total Accepted: 275.1K # Total Submissions: 737.9K # Testcase Example: '"aba"' # # Given a string s, return true if the s can be palindrome after deleting at # most one character from it. # # # Example 1: # # # Input: s = "aba" # Output: true # # # Example 2: # # # Input: s = "abca" # Output: true # Explanation: You could delete the character 'c'. # # # Example 3: # # # Input: s = "abc" # Output: false # # # # Constraints: # # # 1 <= s.length <= 10^5 # s consists of lowercase English letters. # # # class Solution: def validPalindrome(self, s: str) -> bool: head = 0 tail = len(s) - 1 while head < tail: if s[head] == s[tail]: head += 1 tail -= 1 else: return self.isPalindrome(s[head+1:tail+1]) or self.isPalindrome(s[head:tail]) return True def isPalindrome(self, s: str) -> bool: head = 0 tail = len(s) - 1 while head < tail: if s[head] == s[tail]: head += 1 tail -= 1 else: return False return True
class Solution: def valid_palindrome(self, s: str) -> bool: head = 0 tail = len(s) - 1 while head < tail: if s[head] == s[tail]: head += 1 tail -= 1 else: return self.isPalindrome(s[head + 1:tail + 1]) or self.isPalindrome(s[head:tail]) return True def is_palindrome(self, s: str) -> bool: head = 0 tail = len(s) - 1 while head < tail: if s[head] == s[tail]: head += 1 tail -= 1 else: return False return True
''' Module contains basic functions ''' def number_to_power(number, power): ''' :param number: number to be taken :param power: :return: number to power >>> number_to_power(3, 2) 9 >>> number_to_power(2, 3) 8 ''' return number**power def number_addition(number1, number2): return number1 + number2 def number_substract(number1, number2): return number1 - number2
""" Module contains basic functions """ def number_to_power(number, power): """ :param number: number to be taken :param power: :return: number to power >>> number_to_power(3, 2) 9 >>> number_to_power(2, 3) 8 """ return number ** power def number_addition(number1, number2): return number1 + number2 def number_substract(number1, number2): return number1 - number2
def mask_out(sentence, banned, substitutes): # write your answer between #start and #end #start return '' #end print('Test 1') print('Expected:abcd#') print('Actual :' + mask_out('abcde', 'e', '#')) print() print('Test 2') print('Expected:#$solute') print('Actual :' + mask_out('absolute', 'ab', '#$')) print() print('Test 3') print('Expected:121hon') print('Actual :' + mask_out('python', 'pyt', '12')) print()
def mask_out(sentence, banned, substitutes): return '' print('Test 1') print('Expected:abcd#') print('Actual :' + mask_out('abcde', 'e', '#')) print() print('Test 2') print('Expected:#$solute') print('Actual :' + mask_out('absolute', 'ab', '#$')) print() print('Test 3') print('Expected:121hon') print('Actual :' + mask_out('python', 'pyt', '12')) print()
def linear_search_recursive(arr, value, start, end): if start >= end: return -1 if arr[start] == value: return start if arr[end] == value: return end else: return linear_search_recursive(arr, value, start+1, end-1) test_list = [1,3,9,11,15,19,29] print(linear_search_recursive(test_list, 15, 0, len(test_list)-1)) #prints 4 print(linear_search_recursive(test_list, 29, 0, len(test_list)-1)) #prints 4 print(linear_search_recursive(test_list, 25, 0, len(test_list)-1)) #prints -1
def linear_search_recursive(arr, value, start, end): if start >= end: return -1 if arr[start] == value: return start if arr[end] == value: return end else: return linear_search_recursive(arr, value, start + 1, end - 1) test_list = [1, 3, 9, 11, 15, 19, 29] print(linear_search_recursive(test_list, 15, 0, len(test_list) - 1)) print(linear_search_recursive(test_list, 29, 0, len(test_list) - 1)) print(linear_search_recursive(test_list, 25, 0, len(test_list) - 1))
''' Joe Walter difficulty: 5% run time: 0:20 answer: 40730 *** 034 Digit Factorials 145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145. Find the sum of all numbers which are equal to the sum of the factorial of their digits. Note: as 1! = 1 and 2! = 2 are not sums they are not included. *** Observations After 1999999, numbers n are too large to be expressed as sum_fact_digits(n) ''' max = 19_999_999 f = {'0':1, '1':1, '2':2, '3':6, '4':24, '5':120, '6':720, '7':5040, '8':40320, '9':362880} # faster than a list def sum_fact_digits(n): return sum(f[d] for d in str(n)) def solve(): ans = 0 for n in range(10, max): if n == sum_fact_digits(n): ans += n return ans print(solve())
""" Joe Walter difficulty: 5% run time: 0:20 answer: 40730 *** 034 Digit Factorials 145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145. Find the sum of all numbers which are equal to the sum of the factorial of their digits. Note: as 1! = 1 and 2! = 2 are not sums they are not included. *** Observations After 1999999, numbers n are too large to be expressed as sum_fact_digits(n) """ max = 19999999 f = {'0': 1, '1': 1, '2': 2, '3': 6, '4': 24, '5': 120, '6': 720, '7': 5040, '8': 40320, '9': 362880} def sum_fact_digits(n): return sum((f[d] for d in str(n))) def solve(): ans = 0 for n in range(10, max): if n == sum_fact_digits(n): ans += n return ans print(solve())
config = { "bootstrap_servers": 'localhost:9092', "async_produce": False, "models": [ { "module_name": "image_classification.predict", "class_name": "ModelPredictor", } ] }
config = {'bootstrap_servers': 'localhost:9092', 'async_produce': False, 'models': [{'module_name': 'image_classification.predict', 'class_name': 'ModelPredictor'}]}
''' Have the function SimpleMode(arr) take the array of numbers stored in arr and return the number that appears most frequently (the mode). For example: if arr contains [10, 4, 5, 2, 4] the output should be 4. If there is more than one mode return the one that appeared in the array first (ie. [5, 10, 10, 6, 5] should return 5 because it appeared first). If there is no mode return -1. The array will not be empty. ''' def SimpleMode(arr): # dictionary that will store values from input array counter = {} # loop to count occurences of numbers in array for i in range(len(arr)): nr = arr[i] if nr in counter: counter[nr] += 1 else: counter[nr] = 1 # dictionary that will store mode of input array ans = {"number": '', "count": 1} # loop through counter dictionary to find first mode of input array for x in counter: if (counter[x] > ans["count"]): ans["count"] = counter[x] ans["number"] = x # if there are no duplicates return -1, else return first mode that appeard in input array if ans["count"] == 1: return -1 else: return ans["number"] test = [2,5,10,10,6,5] print(SimpleMode(test))
""" Have the function SimpleMode(arr) take the array of numbers stored in arr and return the number that appears most frequently (the mode). For example: if arr contains [10, 4, 5, 2, 4] the output should be 4. If there is more than one mode return the one that appeared in the array first (ie. [5, 10, 10, 6, 5] should return 5 because it appeared first). If there is no mode return -1. The array will not be empty. """ def simple_mode(arr): counter = {} for i in range(len(arr)): nr = arr[i] if nr in counter: counter[nr] += 1 else: counter[nr] = 1 ans = {'number': '', 'count': 1} for x in counter: if counter[x] > ans['count']: ans['count'] = counter[x] ans['number'] = x if ans['count'] == 1: return -1 else: return ans['number'] test = [2, 5, 10, 10, 6, 5] print(simple_mode(test))
class Pipe(object): def __init__(self, *args): self.functions = args self.state = {'error': '', 'result': None} def __call__(self, value): if not value: raise "Not any value for running" self.state['result'] = self.data_pipe(value) return self.state def _bind(self, value, function): try: if value: return function(value) else: return None except Exception as e: self.state['error'] = e def data_pipe(self, value): c_value = value for function in self.functions: c_value = self._bind(c_value, function) return c_value
class Pipe(object): def __init__(self, *args): self.functions = args self.state = {'error': '', 'result': None} def __call__(self, value): if not value: raise 'Not any value for running' self.state['result'] = self.data_pipe(value) return self.state def _bind(self, value, function): try: if value: return function(value) else: return None except Exception as e: self.state['error'] = e def data_pipe(self, value): c_value = value for function in self.functions: c_value = self._bind(c_value, function) return c_value
#code class Node : def __init__(self,data): self.data = data self.next = None class LinkedList : def __init__(self): self.head = None def Push(self,new_data): if(self.head== None): self.head = Node(new_data) else: new_node = Node(new_data) new_node.next = None temp = self.head while temp.next: temp = temp.next temp.next = new_node def PrintList(self): temp = self.head while temp: print(temp.data,end=" ") temp = temp.next print('') def DeleteLinkedList(self): temp = self.head while(temp): next = temp.next del temp.data temp = next print("Linked list deleted") if __name__ == '__main__': t = int(input()) for i in range(t): list1 = LinkedList() n = int(input()) #5 values = list(map(int, input().strip().split())) # 8 2 3 1 7 for i in values: list1.Push(i) k = int(input()) #any works for all list1.PrintList() list1.DeleteLinkedList()
class Node: def __init__(self, data): self.data = data self.next = None class Linkedlist: def __init__(self): self.head = None def push(self, new_data): if self.head == None: self.head = node(new_data) else: new_node = node(new_data) new_node.next = None temp = self.head while temp.next: temp = temp.next temp.next = new_node def print_list(self): temp = self.head while temp: print(temp.data, end=' ') temp = temp.next print('') def delete_linked_list(self): temp = self.head while temp: next = temp.next del temp.data temp = next print('Linked list deleted') if __name__ == '__main__': t = int(input()) for i in range(t): list1 = linked_list() n = int(input()) values = list(map(int, input().strip().split())) for i in values: list1.Push(i) k = int(input()) list1.PrintList() list1.DeleteLinkedList()
NONE = 0 HALT = 1 << 0 FAULT = 1 << 1 BREAK = 1 << 2
none = 0 halt = 1 << 0 fault = 1 << 1 break = 1 << 2
# Pascal's Triangle # @author unobatbayar # Input website link and download to a directory # @author unobatbayar just for comments not whole code this time # @program 10 # date 27-10-2018 print("Welcome to Pascal's Triangle!" + "\n") row = int(input('Please input a row number to which you want to see the triangle to' + '\n')) a=[] for i in range(row): a.append([]) a[i].append(1) #append(object) - Updates the list by adding an object to the list. append(): It is basically used in Python to add one element. #basically the 1's surrounding the triangle for j in range(1,i): a[i].append(a[i-1][j-1]+a[i-1][j]) #add what's in the headspace if(row!=0): a[i].append(1) #add another value if row doesn't equal to 0 for i in range(row): print(" "*(row-i),end=" ",sep=" ") for j in range(0,i+1): print('{0:6}'.format(a[i][j]),end=" ",sep=" ") print() ## REFERENCE: # Thanks to Sanfoundry for providing the main code, I initially tried to create it # on my own, however, my code was bad and wasn't working quite right. # link to the website: https://www.sanfoundry.com/python-program-print-pascal-triangle/
print("Welcome to Pascal's Triangle!" + '\n') row = int(input('Please input a row number to which you want to see the triangle to' + '\n')) a = [] for i in range(row): a.append([]) a[i].append(1) for j in range(1, i): a[i].append(a[i - 1][j - 1] + a[i - 1][j]) if row != 0: a[i].append(1) for i in range(row): print(' ' * (row - i), end=' ', sep=' ') for j in range(0, i + 1): print('{0:6}'.format(a[i][j]), end=' ', sep=' ') print()
class StorageDriverError(Exception): pass class ObjectDoesNotExistError(StorageDriverError): def __init__(self, driver, bucket, object_name): super().__init__( f"Bucket {bucket} does not contain {object_name} (driver={driver})" ) class AssetsManagerError(Exception): pass class AssetAlreadyExistsError(AssetsManagerError): def __init__(self, name): super().__init__(f"Asset {name} already exists, you should update it.") class AssetDoesNotExistError(AssetsManagerError): def __init__(self, name): super().__init__( f"Asset {name} does not exist" "Use `push_new_asset` to create it." ) class AssetMajorVersionDoesNotExistError(AssetsManagerError): def __init__(self, name, major): super().__init__( f"Asset major version `{major}` for `{name}` does not exist." "Use `push_new_asset` to push a new major version of an asset." ) class InvalidAssetSpecError(AssetsManagerError): def __init__(self, spec): super().__init__(f"Invalid asset spec `{spec}`") class InvalidVersionError(InvalidAssetSpecError): def __init__(self, version): super().__init__(f"Asset version `{version}` is not valid.") class InvalidNameError(InvalidAssetSpecError): def __init__(self, name): super().__init__(f"Asset name `{name}` is not valid.") class LocalAssetDoesNotExistError(AssetsManagerError): def __init__(self, name, version, local_versions): super().__init__( f"Asset version `{version}` for `{name}` does not exist locally. " f"Available asset versions: " + ", ".join(local_versions) ) class UnknownAssetsVersioningSystemError(AssetsManagerError): pass
class Storagedrivererror(Exception): pass class Objectdoesnotexisterror(StorageDriverError): def __init__(self, driver, bucket, object_name): super().__init__(f'Bucket {bucket} does not contain {object_name} (driver={driver})') class Assetsmanagererror(Exception): pass class Assetalreadyexistserror(AssetsManagerError): def __init__(self, name): super().__init__(f'Asset {name} already exists, you should update it.') class Assetdoesnotexisterror(AssetsManagerError): def __init__(self, name): super().__init__(f'Asset {name} does not existUse `push_new_asset` to create it.') class Assetmajorversiondoesnotexisterror(AssetsManagerError): def __init__(self, name, major): super().__init__(f'Asset major version `{major}` for `{name}` does not exist.Use `push_new_asset` to push a new major version of an asset.') class Invalidassetspecerror(AssetsManagerError): def __init__(self, spec): super().__init__(f'Invalid asset spec `{spec}`') class Invalidversionerror(InvalidAssetSpecError): def __init__(self, version): super().__init__(f'Asset version `{version}` is not valid.') class Invalidnameerror(InvalidAssetSpecError): def __init__(self, name): super().__init__(f'Asset name `{name}` is not valid.') class Localassetdoesnotexisterror(AssetsManagerError): def __init__(self, name, version, local_versions): super().__init__(f'Asset version `{version}` for `{name}` does not exist locally. Available asset versions: ' + ', '.join(local_versions)) class Unknownassetsversioningsystemerror(AssetsManagerError): pass
class Solution: def maximizeSweetness(self, sweetness: List[int], K: int) -> int: low, high = 1, sum(sweetness) // (K + 1) while low < high: mid = (low + high + 1) // 2 count = curr = 0 for s in sweetness: curr += s if curr >= mid: count += 1 if count >= K + 1: break curr = 0 if count >= K + 1: low = mid else: high = mid - 1 return low
class Solution: def maximize_sweetness(self, sweetness: List[int], K: int) -> int: (low, high) = (1, sum(sweetness) // (K + 1)) while low < high: mid = (low + high + 1) // 2 count = curr = 0 for s in sweetness: curr += s if curr >= mid: count += 1 if count >= K + 1: break curr = 0 if count >= K + 1: low = mid else: high = mid - 1 return low
taggable_resources = [ # API Gateway "aws_api_gateway_stage", # ACM "aws_acm_certificate", "aws_acmpca_certificate_authority", # CloudFront "aws_cloudfront_distribution", # CloudTrail "aws_cloudtrail", # AppSync "aws_appsync_graphql_api", # Backup "aws_backup_plan", "aws_backup_vault", # CloudFormation "aws_cloudformation_stack", "aws_cloudformation_stack_set", # Batch Compute "aws_batch_compute_environment", # CloudWatch "aws_cloudwatch_metric_alarm" "aws_cloudwatch_event_rule", "aws_cloudwatch_log_group", # CodeBuild "aws_codebuild_project", # CloudHSM "aws_cloudhsm_v2_cluster", # Cognito "aws_cognito_identity_pool", "aws_cognito_user_pool", # DirectoryServer "aws_directory_service_directory", # DirectConnect "aws_dx_connection", "aws_dx_lag", # IAM "aws_iam_user", "aws_iam_role", # AWS Config "aws_config_config_rule", # AWS Database Migration Service "aws_dms_certificate", "aws_dms_endpoint", "aws_dms_replication_instance", "aws_dms_replication_subnet_group", "aws_dms_replication_task", # DynamoDB "aws_dynamodb_table", # AWS Elastic Beanstalk "aws_elastic_beanstalk_application", "aws_elastic_beanstalk_application_version", "aws_elastic_beanstalk_configuration_template", "aws_elastic_beanstalk_environment" # Amazon Elastic Compute Cloud (Amazon EC2) "aws_ec2_capacity_reservation", "aws_eip", "aws_ami", "aws_instance", "aws_launch_template", "aws_ebs_volume", "aws_ebs_snapshot", "aws_ebs_snapshot_copy", "aws_ec2_client_vpn_endpoint", "aws_ami_copy", "aws_ec2_fleet", "aws_ec2_transit_gateway", "aws_ec2_transit_gateway_route_table", "aws_ec2_transit_gateway_vpc_attachment", "aws_ec2_transit_gateway_vpc_attachment_accepter", "aws_spot_fleet_request", "aws_spot_instance_request", "aws_volume_attachment" # Amazon Elastic Container Registry "aws_ecr_repository", # ECS "aws_ecs_cluster", "aws_ecs_service", "aws_ecs_task_definition", # EFS "aws_efs_file_system", # ElastiCache "aws_elasticache_cluster", "aws_elasticache_replication_group", # EMR "aws_emr_cluster", # Elasticsearch "aws_elasticsearch_domain", # Glacier "aws_glacier_vault", # Glue # Inspector "aws_inspector_resource_group", # IOT # KMS "aws_kms_external_key", "aws_kms_key", # Kinesis "aws_kinesis_analytics_application", "aws_kinesis_stream", "aws_kinesis_firehose_delivery_stream", # Lambda "aws_lambda_function", # Kafka "aws_msk_cluster", # MQ "aws_mq_broker", # Opsworks "aws_opsworks_stack", # Resource Access Manager (RAM) "aws_ram_resource_share", # RDS "aws_db_event_subscription", "aws_db_instance", "aws_db_option_group", "aws_db_parameter_group", "db_security_group", "aws_db_snapshot", "aws_db_subnet_group", "aws_rds_cluster", "aws_rds_cluster_instance", "aws_rds_cluster_parameter_group", # Redshift "aws_redshift_cluster", "aws_redshift_event_subscription", "aws_redshift_parameter_group", "aws_redshift_snapshot_copy_grant", "aws_redshift_subnet_group", # Resource Groups # RoboMaker "aws_route53_health_check", "aws_route53_zone", "aws_route53_resolver_endpoint", "aws_route53_resolver_rule", # Load Balancing "aws_elb", "aws_lb", "aws_lb_target_group", # SageMaker "aws_sagemaker_endpoint", "aws_sagemaker_endpoint_configuration", "aws_sagemaker_model", "aws_sagemaker_notebook_instance", # Service Catelog "aws_servicecatalog_portfolio", # S3 "aws_s3_bucket", "aws_s3_bucket_metric", "aws_s3_bucket_object", # Neptune "aws_neptune_parameter_group", "aws_neptune_subnet_group", "aws_neptune_cluster_parameter_group", "aws_neptune_cluster", "aws_neptune_cluster_instance", "aws_neptune_event_subscription", # Secrets Manager "aws_secretsmanager_secret", # VPC "aws_customer_gateway", "aws_default_network_acl", "aws_default_route_table", "aws_default_security_group", "aws_default_subnet", "aws_default_vpc", "aws_default_vpc_dhcp_options", "aws_vpc_endpoint", "aws_vpc_endpoint_service", "aws_vpc_peering_connection", "aws_vpc_peering_connection_accepter", "aws_vpn_connection", "aws_vpn_gateway", "aws_nat_gateway", "aws_network_acl", "aws_network_interface", "aws_route_table", "aws_security_group", "aws_subnet", "aws_vpc", "aws_vpc_dhcp_options", ]
taggable_resources = ['aws_api_gateway_stage', 'aws_acm_certificate', 'aws_acmpca_certificate_authority', 'aws_cloudfront_distribution', 'aws_cloudtrail', 'aws_appsync_graphql_api', 'aws_backup_plan', 'aws_backup_vault', 'aws_cloudformation_stack', 'aws_cloudformation_stack_set', 'aws_batch_compute_environment', 'aws_cloudwatch_metric_alarmaws_cloudwatch_event_rule', 'aws_cloudwatch_log_group', 'aws_codebuild_project', 'aws_cloudhsm_v2_cluster', 'aws_cognito_identity_pool', 'aws_cognito_user_pool', 'aws_directory_service_directory', 'aws_dx_connection', 'aws_dx_lag', 'aws_iam_user', 'aws_iam_role', 'aws_config_config_rule', 'aws_dms_certificate', 'aws_dms_endpoint', 'aws_dms_replication_instance', 'aws_dms_replication_subnet_group', 'aws_dms_replication_task', 'aws_dynamodb_table', 'aws_elastic_beanstalk_application', 'aws_elastic_beanstalk_application_version', 'aws_elastic_beanstalk_configuration_template', 'aws_elastic_beanstalk_environmentaws_ec2_capacity_reservation', 'aws_eip', 'aws_ami', 'aws_instance', 'aws_launch_template', 'aws_ebs_volume', 'aws_ebs_snapshot', 'aws_ebs_snapshot_copy', 'aws_ec2_client_vpn_endpoint', 'aws_ami_copy', 'aws_ec2_fleet', 'aws_ec2_transit_gateway', 'aws_ec2_transit_gateway_route_table', 'aws_ec2_transit_gateway_vpc_attachment', 'aws_ec2_transit_gateway_vpc_attachment_accepter', 'aws_spot_fleet_request', 'aws_spot_instance_request', 'aws_volume_attachmentaws_ecr_repository', 'aws_ecs_cluster', 'aws_ecs_service', 'aws_ecs_task_definition', 'aws_efs_file_system', 'aws_elasticache_cluster', 'aws_elasticache_replication_group', 'aws_emr_cluster', 'aws_elasticsearch_domain', 'aws_glacier_vault', 'aws_inspector_resource_group', 'aws_kms_external_key', 'aws_kms_key', 'aws_kinesis_analytics_application', 'aws_kinesis_stream', 'aws_kinesis_firehose_delivery_stream', 'aws_lambda_function', 'aws_msk_cluster', 'aws_mq_broker', 'aws_opsworks_stack', 'aws_ram_resource_share', 'aws_db_event_subscription', 'aws_db_instance', 'aws_db_option_group', 'aws_db_parameter_group', 'db_security_group', 'aws_db_snapshot', 'aws_db_subnet_group', 'aws_rds_cluster', 'aws_rds_cluster_instance', 'aws_rds_cluster_parameter_group', 'aws_redshift_cluster', 'aws_redshift_event_subscription', 'aws_redshift_parameter_group', 'aws_redshift_snapshot_copy_grant', 'aws_redshift_subnet_group', 'aws_route53_health_check', 'aws_route53_zone', 'aws_route53_resolver_endpoint', 'aws_route53_resolver_rule', 'aws_elb', 'aws_lb', 'aws_lb_target_group', 'aws_sagemaker_endpoint', 'aws_sagemaker_endpoint_configuration', 'aws_sagemaker_model', 'aws_sagemaker_notebook_instance', 'aws_servicecatalog_portfolio', 'aws_s3_bucket', 'aws_s3_bucket_metric', 'aws_s3_bucket_object', 'aws_neptune_parameter_group', 'aws_neptune_subnet_group', 'aws_neptune_cluster_parameter_group', 'aws_neptune_cluster', 'aws_neptune_cluster_instance', 'aws_neptune_event_subscription', 'aws_secretsmanager_secret', 'aws_customer_gateway', 'aws_default_network_acl', 'aws_default_route_table', 'aws_default_security_group', 'aws_default_subnet', 'aws_default_vpc', 'aws_default_vpc_dhcp_options', 'aws_vpc_endpoint', 'aws_vpc_endpoint_service', 'aws_vpc_peering_connection', 'aws_vpc_peering_connection_accepter', 'aws_vpn_connection', 'aws_vpn_gateway', 'aws_nat_gateway', 'aws_network_acl', 'aws_network_interface', 'aws_route_table', 'aws_security_group', 'aws_subnet', 'aws_vpc', 'aws_vpc_dhcp_options']
CREATE_VENV__CMD = b'UkVNIE5lY2Vzc2FyeSBGaWxlczoNClJFTSAtIHByZV9zZXR1cF9zY3JpcHRzLnR4dA0KUkVNIC0gcmVxdWlyZWRfcGVyc29uYWxfcGFja2FnZXMudHh0DQpSRU0gLSByZXF1aXJlZF9taXNjLnR4dA0KUkVNIC0gcmVxdWlyZWRfUXQudHh0DQpSRU0gLSByZXF1aXJlZF9mcm9tX2dpdGh1Yi50eHQNClJFTSAtIHJlcXVpcmVkX3Rlc3QudHh0DQpSRU0gLSByZXF1aXJlZF9kZXYudHh0DQpSRU0gLSBwb3N0X3N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1xQcm9ncmFtc1xHaXRodWJcTXlfUmVwb3NcR2lkX1ZzY29kZV9XcmFwcGVyLGdpZF92c2NvZGVfd3JhcHBlcg0KRDpcRHJvcGJveFxob2JieVxNb2RkaW5nXFByb2dyYW1zXEdpdGh1YlxNeV9SZXBvc1xHaWRfVmlld19tb2RlbHMsZ2lkX3ZpZXdfbW9kZWxzDQpEOlxEcm9wYm94XGhvYmJ5XE1vZGRpbmdcUHJvZ3JhbXNcR2l0aHViXE15X1JlcG9zXEdpZGNvbmZpZyxnaWRjb25maWc=' REQUIRED_QT__TXT = b'UHlRdDUNCnB5b3BlbmdsDQpQeVF0M0QNClB5UXRDaGFydA0KUHlRdERhdGFWaXN1YWxpemF0aW9uDQpQeVF0V2ViRW5naW5lDQpRU2NpbnRpbGxhDQpweXF0Z3JhcGgNCnBhcmNlcXQNClB5UXRkb2MNCnB5cXQ1LXRvb2xzDQpQeVF0NS1zdHVicw0KcHlxdGRlcGxveQ==' REQUIRED_TEST__TXT = b'cHl0ZXN0DQpweXRlc3QtcXQ=' root_folder_data = {'create_venv.cmd': CREATE_VENV__CMD, 'create_venv_extra_envvars.py': CREATE_VENV_EXTRA_ENVVARS__PY, } venv_setup_settings_folder_data = {'post_setup_scripts.txt': POST_SETUP_SCRIPTS__TXT, 'pre_setup_scripts.txt': PRE_SETUP_SCRIPTS__TXT, 'required_dev.txt': REQUIRED_DEV__TXT, 'required_from_github.txt': REQUIRED_FROM_GITHUB__TXT, 'required_misc.txt': REQUIRED_MISC__TXT, 'required_personal_packages.txt': REQUIRED_PERSONAL_PACKAGES__TXT, 'required_qt.txt': REQUIRED_QT__TXT, 'required_test.txt': REQUIRED_TEST__TXT, }
create_venv__cmd = b'UkVNIE5lY2Vzc2FyeSBGaWxlczoNClJFTSAtIHByZV9zZXR1cF9zY3JpcHRzLnR4dA0KUkVNIC0gcmVxdWlyZWRfcGVyc29uYWxfcGFja2FnZXMudHh0DQpSRU0gLSByZXF1aXJlZF9taXNjLnR4dA0KU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PTERIT01FX0ZPTERFUiVjcmVhdGVfdmVudl9leHRyYV9lbnZ2YXJzLnB5LCVPTERIT01FX0ZPTERFUiUgJVBST0pFQ1RfTkFNRSU=' pre_setup_scripts__txt = b'IkM6XFByb2dyYW0gRmlsZXMgKHg4NilcTWljcm9zb2Z0IFZpc3VhbCBTdHVkaW9cMjAxOVxDb21tdW5pdHlcVkNcQXV4aWxpYXJ5XEJ1aWxkXHZjdmFyc2FsbC5iYXQiLGFtZDY0DQpwc2tpbGw2NCxEcm9wYm94' required_dev__txt = b'aHR0cHM6Ly9naXRodWIuY29tL3B5aW5zdGFsbGVyL3B5aW5zdGFsbGVyL3RhcmJhbGwvZGV2ZWxvcA0KcGVwNTE3DQpudWl0a2ENCm1lbW9yeS1wcm9maWxlcg0KbWF0cGxvdGxpYg0KaW1wb3J0LXByb2ZpbGVyDQpvYmplY3RncmFwaA0KcGlwcmVxcw0KcHlkZXBzDQpudW1weT09MS4xOS4z' required_from_github__txt = b'aHR0cHM6Ly9naXRodWIuY29tL292ZXJmbDAvQXJtYWNsYXNzLmdpdA==' required_misc__txt = b'SmluamEyDQpweXBlcmNsaXANCnJlcXVlc3RzDQpuYXRzb3J0DQpiZWF1dGlmdWxzb3VwNA0KcGRma2l0DQpjaGVja3N1bWRpcg0KY2xpY2sNCm1hcnNobWFsbG93DQpyZWdleA0KcGFyY2UNCmpzb25waWNrbGUNCmZ1enp5d3V6enkNCmZ1enp5c2VhcmNoDQpweXRob24tTGV2ZW5zaHRlaW4NCg==' required_personal_packages__txt = b'RDpcRHJvcGJveFxob2JieVxNb2RkaW5nXFByb2dyYW1zXEdpdGh1YlxNeV9SZXBvc1xnaWR0b29sc191dGlscyxnaWR0b29scw0KRDpcRHJvcGJveFxob2JieVxNb2RkaW5nXFByb2dyYW1zXEdpdGh1YlxNeV9SZXBvc1xnaWRxdHV0aWxzLGdpZHF0dXRpbHMNCkQ6XERyb3Bib3hcaG9iYnlcTW9kZGluZ1xQcm9ncmFtc1xHaXRodWJcTXlfUmVwb3NcZ2lkbG9nZ2VyX3JlcCxnaWRsb2dnZXINCkQ6XERyb3Bib3hcaG9iYnlcTW9kZGluZ1xQcm9ncmFtc1xHaXRodWJcTXlfUmVwb3NcR2lkX1ZzY29kZV9XcmFwcGVyLGdpZF92c2NvZGVfd3JhcHBlcg0KRDpcRHJvcGJveFxob2JieVxNb2RkaW5nXFByb2dyYW1zXEdpdGh1YlxNeV9SZXBvc1xHaWRfVmlld19tb2RlbHMsZ2lkX3ZpZXdfbW9kZWxzDQpEOlxEcm9wYm94XGhvYmJ5XE1vZGRpbmdcUHJvZ3JhbXNcR2l0aHViXE15X1JlcG9zXEdpZGNvbmZpZyxnaWRjb25maWc=' required_qt__txt = b'UHlRdDUNCnB5b3BlbmdsDQpQeVF0M0QNClB5UXRDaGFydA0KUHlRdERhdGFWaXN1YWxpemF0aW9uDQpQeVF0V2ViRW5naW5lDQpRU2NpbnRpbGxhDQpweXF0Z3JhcGgNCnBhcmNlcXQNClB5UXRkb2MNCnB5cXQ1LXRvb2xzDQpQeVF0NS1zdHVicw0KcHlxdGRlcGxveQ==' required_test__txt = b'cHl0ZXN0DQpweXRlc3QtcXQ=' root_folder_data = {'create_venv.cmd': CREATE_VENV__CMD, 'create_venv_extra_envvars.py': CREATE_VENV_EXTRA_ENVVARS__PY} venv_setup_settings_folder_data = {'post_setup_scripts.txt': POST_SETUP_SCRIPTS__TXT, 'pre_setup_scripts.txt': PRE_SETUP_SCRIPTS__TXT, 'required_dev.txt': REQUIRED_DEV__TXT, 'required_from_github.txt': REQUIRED_FROM_GITHUB__TXT, 'required_misc.txt': REQUIRED_MISC__TXT, 'required_personal_packages.txt': REQUIRED_PERSONAL_PACKAGES__TXT, 'required_qt.txt': REQUIRED_QT__TXT, 'required_test.txt': REQUIRED_TEST__TXT}
n = int(input()) def sum_input(): _sum = 0 for i in range(n): _sum += int(input()) return _sum left_sum = sum_input() right_sum = sum_input() if left_sum == right_sum: print("Yes, sum =", left_sum) else: print("No, diff =", abs(left_sum - right_sum))
n = int(input()) def sum_input(): _sum = 0 for i in range(n): _sum += int(input()) return _sum left_sum = sum_input() right_sum = sum_input() if left_sum == right_sum: print('Yes, sum =', left_sum) else: print('No, diff =', abs(left_sum - right_sum))
a = int(input()) while(a): counti = 0 counte = 0 b = input() for i in b: if(i=='1'): counti+=1 elif(i=='2'): counte+=1 elif(i=='0'): counte+=1 counti+=1 if(counti>counte): print("INDIA") elif(counte>counti): print("ENGLAND") else: print("DRAW") a-=1
a = int(input()) while a: counti = 0 counte = 0 b = input() for i in b: if i == '1': counti += 1 elif i == '2': counte += 1 elif i == '0': counte += 1 counti += 1 if counti > counte: print('INDIA') elif counte > counti: print('ENGLAND') else: print('DRAW') a -= 1
text = input('Enter the text:\n') if ('make a lot of money' in text): spam = True elif ('buy now' in text): spam = True elif ('watch this' in text): spam = True elif ('click this' in text): spam = True elif ('subscribe this' in text): spam = True else: spam = False if (spam): print ('This text is spam.') else: print ('This text is not spam.')
text = input('Enter the text:\n') if 'make a lot of money' in text: spam = True elif 'buy now' in text: spam = True elif 'watch this' in text: spam = True elif 'click this' in text: spam = True elif 'subscribe this' in text: spam = True else: spam = False if spam: print('This text is spam.') else: print('This text is not spam.')
a=input() b=int(len(a)) for i in range(b): print(a[i])
a = input() b = int(len(a)) for i in range(b): print(a[i])
def second_largest(mylist): largest = None second_largest = None for num in mylist: if largest is None: largest = num elif num > largest: second_largest = largest largest = num elif second_largest is None: second_largest = num elif num > second_largest: second_largest = num return second_largest print(second_largest([1,3,4,5,0,2])) print(second_largest([-2,-1])) print(second_largest([2])) print(second_largest([]))
def second_largest(mylist): largest = None second_largest = None for num in mylist: if largest is None: largest = num elif num > largest: second_largest = largest largest = num elif second_largest is None: second_largest = num elif num > second_largest: second_largest = num return second_largest print(second_largest([1, 3, 4, 5, 0, 2])) print(second_largest([-2, -1])) print(second_largest([2])) print(second_largest([]))
# =========== # BoE # =========== class HP_IMDB_BOE: batch_size = 64 learning_rate = 1e-3 learning_rate_dpsgd = 1e-3 patience = 5 tgt_class = 1 sequence_length = 512 class HP_DBPedia_BOE: batch_size = 256 learning_rate = 1e-3 learning_rate_dpsgd = 1e-3 patience = 2 tgt_class = 1 # start from 0 sequence_length = 256 class HP_Trec50_BOE: batch_size = 128 learning_rate = 5e-4 learning_rate_dpsgd = 5e-4 patience = 10 tgt_class = 32 # start from 0 sequence_length = 128 class HP_Trec6_BOE: batch_size = 16 learning_rate = 1e-4 learning_rate_dpsgd = 1e-4 patience = 10 tgt_class = 1 # start from 0 sequence_length = 128 # =========== # CNN # =========== class HP_IMDB_CNN: batch_size = 64 learning_rate = 1e-3 learning_rate_dpsgd = 1e-3 patience = 5 tgt_class = 1 sequence_length = 512 class HP_DBPedia_CNN: batch_size = 32 learning_rate = 1e-3 learning_rate_dpsgd = 1e-3 patience = 2 tgt_class = 1 # start from 0 sequence_length = 256 class HP_Trec50_CNN: batch_size = 128 learning_rate = 5e-4 learning_rate_dpsgd = 5e-4 patience = 10 tgt_class = 32 # start from 0 sequence_length = 128 class HP_Trec6_CNN: batch_size = 16 learning_rate = 1e-4 learning_rate_dpsgd = 1e-4 patience = 10 tgt_class = 1 # start from 0 sequence_length = 128 # =========== # BERT # =========== class HP_IMDB_BERT: batch_size = 32 learning_rate = 1e-4 learning_rate_dpsgd = 1e-4 patience = 2 tgt_class = 1 sequence_length = 512 class HP_DBPedia_BERT: batch_size = 32 learning_rate = 1e-4 learning_rate_dpsgd = 1e-4 patience = 1 tgt_class = 1 # start from 0 sequence_length = 256 class HP_Trec50_BERT: batch_size = 128 learning_rate = 5e-4 learning_rate_dpsgd = 5e-4 patience = 10 tgt_class = 32 # start from 0 sequence_length = 128 class HP_Trec6_BERT: batch_size = 16 learning_rate = 1e-4 learning_rate_dpsgd = 1e-4 patience = 5 tgt_class = 1 # start from 0 sequence_length = 128
class Hp_Imdb_Boe: batch_size = 64 learning_rate = 0.001 learning_rate_dpsgd = 0.001 patience = 5 tgt_class = 1 sequence_length = 512 class Hp_Dbpedia_Boe: batch_size = 256 learning_rate = 0.001 learning_rate_dpsgd = 0.001 patience = 2 tgt_class = 1 sequence_length = 256 class Hp_Trec50_Boe: batch_size = 128 learning_rate = 0.0005 learning_rate_dpsgd = 0.0005 patience = 10 tgt_class = 32 sequence_length = 128 class Hp_Trec6_Boe: batch_size = 16 learning_rate = 0.0001 learning_rate_dpsgd = 0.0001 patience = 10 tgt_class = 1 sequence_length = 128 class Hp_Imdb_Cnn: batch_size = 64 learning_rate = 0.001 learning_rate_dpsgd = 0.001 patience = 5 tgt_class = 1 sequence_length = 512 class Hp_Dbpedia_Cnn: batch_size = 32 learning_rate = 0.001 learning_rate_dpsgd = 0.001 patience = 2 tgt_class = 1 sequence_length = 256 class Hp_Trec50_Cnn: batch_size = 128 learning_rate = 0.0005 learning_rate_dpsgd = 0.0005 patience = 10 tgt_class = 32 sequence_length = 128 class Hp_Trec6_Cnn: batch_size = 16 learning_rate = 0.0001 learning_rate_dpsgd = 0.0001 patience = 10 tgt_class = 1 sequence_length = 128 class Hp_Imdb_Bert: batch_size = 32 learning_rate = 0.0001 learning_rate_dpsgd = 0.0001 patience = 2 tgt_class = 1 sequence_length = 512 class Hp_Dbpedia_Bert: batch_size = 32 learning_rate = 0.0001 learning_rate_dpsgd = 0.0001 patience = 1 tgt_class = 1 sequence_length = 256 class Hp_Trec50_Bert: batch_size = 128 learning_rate = 0.0005 learning_rate_dpsgd = 0.0005 patience = 10 tgt_class = 32 sequence_length = 128 class Hp_Trec6_Bert: batch_size = 16 learning_rate = 0.0001 learning_rate_dpsgd = 0.0001 patience = 5 tgt_class = 1 sequence_length = 128
def get_azure_config(provider_config): config_dict = {} azure_storage_type = provider_config.get("azure_cloud_storage", {}).get("azure.storage.type") if azure_storage_type: config_dict["AZURE_STORAGE_TYPE"] = azure_storage_type azure_storage_account = provider_config.get("azure_cloud_storage", {}).get("azure.storage.account") if azure_storage_account: config_dict["AZURE_STORAGE_ACCOUNT"] = azure_storage_account azure_container = provider_config.get("azure_cloud_storage", {}).get( "azure.container") if azure_container: config_dict["AZURE_CONTAINER"] = azure_container azure_account_key = provider_config.get("azure_cloud_storage", {}).get( "azure.account.key") if azure_account_key: config_dict["AZURE_ACCOUNT_KEY"] = azure_account_key return config_dict def _get_node_info(node): node_info = {"node_id": node["name"].split("-")[-1], "instance_type": node["vm_size"], "private_ip": node["internal_ip"], "public_ip": node["external_ip"], "instance_status": node["status"]} node_info.update(node["tags"]) return node_info
def get_azure_config(provider_config): config_dict = {} azure_storage_type = provider_config.get('azure_cloud_storage', {}).get('azure.storage.type') if azure_storage_type: config_dict['AZURE_STORAGE_TYPE'] = azure_storage_type azure_storage_account = provider_config.get('azure_cloud_storage', {}).get('azure.storage.account') if azure_storage_account: config_dict['AZURE_STORAGE_ACCOUNT'] = azure_storage_account azure_container = provider_config.get('azure_cloud_storage', {}).get('azure.container') if azure_container: config_dict['AZURE_CONTAINER'] = azure_container azure_account_key = provider_config.get('azure_cloud_storage', {}).get('azure.account.key') if azure_account_key: config_dict['AZURE_ACCOUNT_KEY'] = azure_account_key return config_dict def _get_node_info(node): node_info = {'node_id': node['name'].split('-')[-1], 'instance_type': node['vm_size'], 'private_ip': node['internal_ip'], 'public_ip': node['external_ip'], 'instance_status': node['status']} node_info.update(node['tags']) return node_info
backslashes_test_text_001 = ''' string = 'string' ''' backslashes_test_text_002 = ''' string = 'string_start \\ string end' ''' backslashes_test_text_003 = ''' if arg_one is not None \\ and arg_two is None: pass ''' backslashes_test_text_004 = ''' string = \'\'\' text \\\\ text \'\'\' '''
backslashes_test_text_001 = "\nstring = 'string'\n" backslashes_test_text_002 = "\nstring = 'string_start \\\n string end'\n" backslashes_test_text_003 = '\nif arg_one is not None \\\n and arg_two is None:\n pass\n' backslashes_test_text_004 = "\nstring = '''\n text \\\\\n text\n'''\n"
# 1 def front_two_back_two(input_string): return '' if len(input_string) < 2 else input_string[:2] + input_string[-2:] # 2 def kelvin_to_celsius(k): return k - 273.15 # 2 def kelvin_to_fahrenheit(k): return kelvin_to_celsius(k) * 9.0 / 5.0 + 32.0 # 4 def min_max_sum(input_list): return [min(input_list), max(input_list), sum(input_list)] # 5 def print_square(): squares_map = {base: base * base for base in range(1, 16)} print(squares_map)
def front_two_back_two(input_string): return '' if len(input_string) < 2 else input_string[:2] + input_string[-2:] def kelvin_to_celsius(k): return k - 273.15 def kelvin_to_fahrenheit(k): return kelvin_to_celsius(k) * 9.0 / 5.0 + 32.0 def min_max_sum(input_list): return [min(input_list), max(input_list), sum(input_list)] def print_square(): squares_map = {base: base * base for base in range(1, 16)} print(squares_map)
class Data: def __init__(self, dia, mes, ano): self.dia = dia self.mes = mes self.ano = ano print(self) @classmethod def de_string(cls, data_string): dia, mes, ano = map(int, data_string.split('-')) data = cls(dia, mes, ano) return data @staticmethod def is_date_valid(data_string): dia, mes, ano = map(int, data_string.split('-')) return dia <= 31 and mes <= 12 and ano <= 2020 data = Data(31, 7, 1996) data1 = Data.de_string('31-07-1996') print(data1) print(data1.is_date_valid('31-07-1996'))
class Data: def __init__(self, dia, mes, ano): self.dia = dia self.mes = mes self.ano = ano print(self) @classmethod def de_string(cls, data_string): (dia, mes, ano) = map(int, data_string.split('-')) data = cls(dia, mes, ano) return data @staticmethod def is_date_valid(data_string): (dia, mes, ano) = map(int, data_string.split('-')) return dia <= 31 and mes <= 12 and (ano <= 2020) data = data(31, 7, 1996) data1 = Data.de_string('31-07-1996') print(data1) print(data1.is_date_valid('31-07-1996'))
# author: Fei Gao # # Evaluate Reverse Polish Notation # # Evaluate the value of an arithmetic expression in Reverse Polish Notation. # Valid operators are +, -, *, /. Each operand may be an integer or another expression. # Some examples: # ["2", "1", "+", "3", "*"] -> ((2 + 1) * 3) -> 9 # ["4", "13", "5", "/", "+"] -> (4 + (13 / 5)) -> 6 class Solution: # @param tokens, a list of string # @return an integer def evalRPN(self, tokens): if not tokens: return None op = {'+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: int(float(x) / y)} # note that python handle div differently! # py2, py3, and C/C++/Java may get all distinct results queue = list() for val in tokens: if isinstance(val, list): queue.append(self.evalRPN(val)) elif val in op: o2 = queue.pop() o1 = queue.pop() queue.append(op[val](o1, o2)) else: queue.append(int(val)) return queue[-1] def main(): solver = Solution() tests = [["2", "1", "+", "3", "*"], ["4", "13", "5", "/", "+"], [["2", "1", "+", "3", "*"], "13", "5", "/", "+"], ["10", "6", "9", "3", "+", "-11", "*", "/", "*", "17", "+", "5", "+"]] # 22 for test in tests: print(test) result = solver.evalRPN(test) print(' ->') print(result) print('~' * 10) pass if __name__ == '__main__': main() pass
class Solution: def eval_rpn(self, tokens): if not tokens: return None op = {'+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: int(float(x) / y)} queue = list() for val in tokens: if isinstance(val, list): queue.append(self.evalRPN(val)) elif val in op: o2 = queue.pop() o1 = queue.pop() queue.append(op[val](o1, o2)) else: queue.append(int(val)) return queue[-1] def main(): solver = solution() tests = [['2', '1', '+', '3', '*'], ['4', '13', '5', '/', '+'], [['2', '1', '+', '3', '*'], '13', '5', '/', '+'], ['10', '6', '9', '3', '+', '-11', '*', '/', '*', '17', '+', '5', '+']] for test in tests: print(test) result = solver.evalRPN(test) print(' ->') print(result) print('~' * 10) pass if __name__ == '__main__': main() pass
ROUTE_MIDDLEWARE = { 'test': 'app.http.middleware.MiddlewareTest.MiddlewareTest', 'middleware.test': [ 'app.http.middleware.MiddlewareTest.MiddlewareTest', 'app.http.middleware.AddAttributeMiddleware.AddAttributeMiddleware' ] }
route_middleware = {'test': 'app.http.middleware.MiddlewareTest.MiddlewareTest', 'middleware.test': ['app.http.middleware.MiddlewareTest.MiddlewareTest', 'app.http.middleware.AddAttributeMiddleware.AddAttributeMiddleware']}
# file creation myfile1 = open("truncate.txt", "w") # writing data to the file myfile1.write("Python is a user-friendly language for beginners") # file truncating to 30 bytes myfile1.truncate(30) # file is getting closed myfile1.close() # file reading and displaying the text myfile2 = open("truncate.txt", "r") print(myfile2.read()) # closing the file myfile2.close()
myfile1 = open('truncate.txt', 'w') myfile1.write('Python is a user-friendly language for beginners') myfile1.truncate(30) myfile1.close() myfile2 = open('truncate.txt', 'r') print(myfile2.read()) myfile2.close()
a = {'C', 'C++', 'Java'} b = {'C++', 'Java', 'Python'} c = {'java', 'Python', 'C', 'pascal'} # who known all three subject u = a.union(b).union(c) print("Union", u) # find subject known to A and not to B i = a.intersection(b) print("Intersection", i) diff1 = a.difference(b) print(a, b, "C-F", diff1) #find a subject who only know only one student studentswhoknowonlypascal=[] if "pascal " in a: studentswhoknowonlypascal.append("A") if "pascal" in b: studentswhoknowonlypascal.append("B") if "pascal" in c: studentswhoknowonlypascal.append("C") print(studentswhoknowonlypascal) # find a student who only know Python studentswhoknowpython=[] if "Python" in a: studentswhoknowpython.append("A") if "Python" in b: studentswhoknowpython.append("B") if "Python" in c: studentswhoknowpython.append("C") print(studentswhoknowpython) #find subject who known all three i = a.intersection(b).intersection(c) diff1 = a.difference(b).difference(c) print("C-F", diff1)
a = {'C', 'C++', 'Java'} b = {'C++', 'Java', 'Python'} c = {'java', 'Python', 'C', 'pascal'} u = a.union(b).union(c) print('Union', u) i = a.intersection(b) print('Intersection', i) diff1 = a.difference(b) print(a, b, 'C-F', diff1) studentswhoknowonlypascal = [] if 'pascal ' in a: studentswhoknowonlypascal.append('A') if 'pascal' in b: studentswhoknowonlypascal.append('B') if 'pascal' in c: studentswhoknowonlypascal.append('C') print(studentswhoknowonlypascal) studentswhoknowpython = [] if 'Python' in a: studentswhoknowpython.append('A') if 'Python' in b: studentswhoknowpython.append('B') if 'Python' in c: studentswhoknowpython.append('C') print(studentswhoknowpython) i = a.intersection(b).intersection(c) diff1 = a.difference(b).difference(c) print('C-F', diff1)
nk = input().split() n = int(nk[0]) k = int(nk[1]) r = int(input()) c = int(input()) o = [] z=0 for _ in range(k): o.append(list(map(int, input().rstrip().split()))) l=[] p=[] a=[] for i in range(n): l=l+[0] for i in range(n): l[i]=[0]*n l[r-1][c-1]=1 for i in range(len(o)): l[o[i][0]-1][o[i][1]-1]=2 print(l) for i in range(n): for j in range(n): if(l[i][j]==2): a.append(abs(r-i)) p.append(abs(c-j)) print(a) print(p) for i in a: if(i>1): for j in range(i): z=z+j print(z) for i in p: if(i>1): for j in range(i): z=z+j print(z) print(z)
nk = input().split() n = int(nk[0]) k = int(nk[1]) r = int(input()) c = int(input()) o = [] z = 0 for _ in range(k): o.append(list(map(int, input().rstrip().split()))) l = [] p = [] a = [] for i in range(n): l = l + [0] for i in range(n): l[i] = [0] * n l[r - 1][c - 1] = 1 for i in range(len(o)): l[o[i][0] - 1][o[i][1] - 1] = 2 print(l) for i in range(n): for j in range(n): if l[i][j] == 2: a.append(abs(r - i)) p.append(abs(c - j)) print(a) print(p) for i in a: if i > 1: for j in range(i): z = z + j print(z) for i in p: if i > 1: for j in range(i): z = z + j print(z) print(z)
def eig(a): # TODO(beam2d): Implement it raise NotImplementedError def eigh(a, UPLO='L'): # TODO(beam2d): Implement it raise NotImplementedError def eigvals(a): # TODO(beam2d): Implement it raise NotImplementedError def eigvalsh(a, UPLO='L'): # TODO(beam2d): Implement it raise NotImplementedError
def eig(a): raise NotImplementedError def eigh(a, UPLO='L'): raise NotImplementedError def eigvals(a): raise NotImplementedError def eigvalsh(a, UPLO='L'): raise NotImplementedError
# ex1116 Dividindo x por y n = int(input()) for c in range(1, n + 1): x, y = map(float, input().split()) if x > y and y != 0: divisao = x / y print('{:.1f}'.format(divisao)) elif x > y and y == 0: print('divisao impossivel') if x < y and y != 0: divisao = x / y print('{:.1f}'.format(divisao)) elif x == y and y != 0: divisao = x / y print('{:.1f}'.format(divisao)) if x < y and y == 0: print('divisao impossivel')
n = int(input()) for c in range(1, n + 1): (x, y) = map(float, input().split()) if x > y and y != 0: divisao = x / y print('{:.1f}'.format(divisao)) elif x > y and y == 0: print('divisao impossivel') if x < y and y != 0: divisao = x / y print('{:.1f}'.format(divisao)) elif x == y and y != 0: divisao = x / y print('{:.1f}'.format(divisao)) if x < y and y == 0: print('divisao impossivel')
# https://leetcode.com/problems/valid-perfect-square class Solution: def isPerfectSquare(self, num): if num == 1: return True l, r = 1, num while l <= r: mid = (l + r) // 2 if mid ** 2 == num: return True elif mid ** 2 < num: l = mid + 1 else: r = mid - 1 return False
class Solution: def is_perfect_square(self, num): if num == 1: return True (l, r) = (1, num) while l <= r: mid = (l + r) // 2 if mid ** 2 == num: return True elif mid ** 2 < num: l = mid + 1 else: r = mid - 1 return False
''' Color Pallette ''' # Generic Stuff BLACK = ( 0, 0, 0) WHITE = (255, 255, 255) # Pane Colors PANE1 = (236, 236, 236) PANE2 = (255, 255, 255) PANE3 = (236, 236, 236) # Player Color PLAYER_COLOR = BLACK # Reds RED_POMEGRANATE = (242, 38, 19) RED_THUNDERBIRD = (217, 30, 24) RED_FLAMINGO = (239, 72, 54) RED_RAZZMATAZZ = (219, 10, 91) RED_RADICALRED = (246, 36, 89) RED_ECSTASY = (249, 105, 14) RED_RYANRILEY = ( 15, 1, 12) RED = [ RED_POMEGRANATE, RED_THUNDERBIRD, RED_FLAMINGO, RED_RAZZMATAZZ, RED_RADICALRED, RED_ECSTASY, RED_RYANRILEY ] # Blues BLUE_REBECCAPURPLE = (102, 51, 153) BLUE_MEDIUMPURPLE = (191, 85, 236) BLUE_STUDIO = (142, 68, 173) BLUE_PICTONBLUE = ( 34, 167, 240) BLUE_EBONYCLUE = ( 34, 49, 63) BLUE_JELLYBEAN = ( 37, 116, 169) BLUE_JORDYBLUE = (137, 196, 244) BLUE_KELLYRIVERS = ( 0, 15, 112) BLUE = [ BLUE_REBECCAPURPLE, BLUE_MEDIUMPURPLE, BLUE_STUDIO, BLUE_PICTONBLUE, BLUE_EBONYCLUE, BLUE_JELLYBEAN, BLUE_JORDYBLUE, BLUE_KELLYRIVERS, ] # Greens GREEN_MALACHITE = ( 0, 230, 64) GREEN_TURQUOISE = ( 78, 205, 196) GREEN_EUCALYPTUS = ( 38, 166, 91) GREEN_MOUNTAIN = ( 27, 188, 155) GREEN_SHAMROCK = ( 46, 204, 113) GREEN_SALEM = ( 30, 130, 76) GREEN = [ GREEN_MALACHITE, GREEN_TURQUOISE, GREEN_EUCALYPTUS, GREEN_MOUNTAIN, GREEN_SHAMROCK, GREEN_SALEM ] COLORS = RED + BLUE + GREEN
""" Color Pallette """ black = (0, 0, 0) white = (255, 255, 255) pane1 = (236, 236, 236) pane2 = (255, 255, 255) pane3 = (236, 236, 236) player_color = BLACK red_pomegranate = (242, 38, 19) red_thunderbird = (217, 30, 24) red_flamingo = (239, 72, 54) red_razzmatazz = (219, 10, 91) red_radicalred = (246, 36, 89) red_ecstasy = (249, 105, 14) red_ryanriley = (15, 1, 12) red = [RED_POMEGRANATE, RED_THUNDERBIRD, RED_FLAMINGO, RED_RAZZMATAZZ, RED_RADICALRED, RED_ECSTASY, RED_RYANRILEY] blue_rebeccapurple = (102, 51, 153) blue_mediumpurple = (191, 85, 236) blue_studio = (142, 68, 173) blue_pictonblue = (34, 167, 240) blue_ebonyclue = (34, 49, 63) blue_jellybean = (37, 116, 169) blue_jordyblue = (137, 196, 244) blue_kellyrivers = (0, 15, 112) blue = [BLUE_REBECCAPURPLE, BLUE_MEDIUMPURPLE, BLUE_STUDIO, BLUE_PICTONBLUE, BLUE_EBONYCLUE, BLUE_JELLYBEAN, BLUE_JORDYBLUE, BLUE_KELLYRIVERS] green_malachite = (0, 230, 64) green_turquoise = (78, 205, 196) green_eucalyptus = (38, 166, 91) green_mountain = (27, 188, 155) green_shamrock = (46, 204, 113) green_salem = (30, 130, 76) green = [GREEN_MALACHITE, GREEN_TURQUOISE, GREEN_EUCALYPTUS, GREEN_MOUNTAIN, GREEN_SHAMROCK, GREEN_SALEM] colors = RED + BLUE + GREEN
lista = list() vezesInput = 0 while vezesInput < 6: valor = float(input()) if valor > 0: lista.append(valor) vezesInput += 1 print(f'{len(lista)} valores positivos')
lista = list() vezes_input = 0 while vezesInput < 6: valor = float(input()) if valor > 0: lista.append(valor) vezes_input += 1 print(f'{len(lista)} valores positivos')
# -*- coding: utf-8 -*- # This file is generated from NI Switch Executive API metadata version 19.1.0d1 enums = { 'ExpandAction': { 'values': [ { 'documentation': { 'description': 'Expand to routes' }, 'name': 'NISE_VAL_EXPAND_TO_ROUTES', 'value': 0 }, { 'documentation': { 'description': 'Expand to paths' }, 'name': 'NISE_VAL_EXPAND_TO_PATHS', 'value': 1 } ] }, 'MulticonnectMode': { 'values': [ { 'documentation': { 'description': 'Default' }, 'name': 'NISE_VAL_DEFAULT', 'value': -1 }, { 'documentation': { 'description': 'No multiconnect' }, 'name': 'NISE_VAL_NO_MULTICONNECT', 'value': 0 }, { 'documentation': { 'description': 'Multiconnect' }, 'name': 'NISE_VAL_MULTICONNECT', 'value': 1 } ] }, 'OperationOrder': { 'values': [ { 'documentation': { 'description': 'Break before make' }, 'name': 'NISE_VAL_BREAK_BEFORE_MAKE', 'value': 1 }, { 'documentation': { 'description': 'Break after make' }, 'name': 'NISE_VAL_BREAK_AFTER_MAKE', 'value': 2 } ] }, 'PathCapability': { 'values': [ { 'documentation': { 'description': 'Path needs hardwire' }, 'name': 'NISE_VAL_PATH_NEEDS_HARDWIRE', 'value': -2 }, { 'documentation': { 'description': 'Path needs config channel' }, 'name': 'NISE_VAL_PATH_NEEDS_CONFIG_CHANNEL', 'value': -1 }, { 'documentation': { 'description': 'Path available' }, 'name': 'NISE_VAL_PATH_AVAILABLE', 'value': 1 }, { 'documentation': { 'description': 'Path exists' }, 'name': 'NISE_VAL_PATH_EXISTS', 'value': 2 }, { 'documentation': { 'description': 'Path Unsupported' }, 'name': 'NISE_VAL_PATH_UNSUPPORTED', 'value': 3 }, { 'documentation': { 'description': 'Resource in use' }, 'name': 'NISE_VAL_RESOURCE_IN_USE', 'value': 4 }, { 'documentation': { 'description': 'Exclusion conflict' }, 'name': 'NISE_VAL_EXCLUSION_CONFLICT', 'value': 5 }, { 'documentation': { 'description': 'Channel not available' }, 'name': 'NISE_VAL_CHANNEL_NOT_AVAILABLE', 'value': 6 }, { 'documentation': { 'description': 'Channels hardwired' }, 'name': 'NISE_VAL_CHANNELS_HARDWIRED', 'value': 7 } ] } }
enums = {'ExpandAction': {'values': [{'documentation': {'description': 'Expand to routes'}, 'name': 'NISE_VAL_EXPAND_TO_ROUTES', 'value': 0}, {'documentation': {'description': 'Expand to paths'}, 'name': 'NISE_VAL_EXPAND_TO_PATHS', 'value': 1}]}, 'MulticonnectMode': {'values': [{'documentation': {'description': 'Default'}, 'name': 'NISE_VAL_DEFAULT', 'value': -1}, {'documentation': {'description': 'No multiconnect'}, 'name': 'NISE_VAL_NO_MULTICONNECT', 'value': 0}, {'documentation': {'description': 'Multiconnect'}, 'name': 'NISE_VAL_MULTICONNECT', 'value': 1}]}, 'OperationOrder': {'values': [{'documentation': {'description': 'Break before make'}, 'name': 'NISE_VAL_BREAK_BEFORE_MAKE', 'value': 1}, {'documentation': {'description': 'Break after make'}, 'name': 'NISE_VAL_BREAK_AFTER_MAKE', 'value': 2}]}, 'PathCapability': {'values': [{'documentation': {'description': 'Path needs hardwire'}, 'name': 'NISE_VAL_PATH_NEEDS_HARDWIRE', 'value': -2}, {'documentation': {'description': 'Path needs config channel'}, 'name': 'NISE_VAL_PATH_NEEDS_CONFIG_CHANNEL', 'value': -1}, {'documentation': {'description': 'Path available'}, 'name': 'NISE_VAL_PATH_AVAILABLE', 'value': 1}, {'documentation': {'description': 'Path exists'}, 'name': 'NISE_VAL_PATH_EXISTS', 'value': 2}, {'documentation': {'description': 'Path Unsupported'}, 'name': 'NISE_VAL_PATH_UNSUPPORTED', 'value': 3}, {'documentation': {'description': 'Resource in use'}, 'name': 'NISE_VAL_RESOURCE_IN_USE', 'value': 4}, {'documentation': {'description': 'Exclusion conflict'}, 'name': 'NISE_VAL_EXCLUSION_CONFLICT', 'value': 5}, {'documentation': {'description': 'Channel not available'}, 'name': 'NISE_VAL_CHANNEL_NOT_AVAILABLE', 'value': 6}, {'documentation': {'description': 'Channels hardwired'}, 'name': 'NISE_VAL_CHANNELS_HARDWIRED', 'value': 7}]}}
# Click trackpad of first controller by "C" key alvr.buttons[0][alvr.Id("trackpad_click")] = keyboard.getKeyDown(Key.C) alvr.buttons[0][alvr.Id("trackpad_touch")] = keyboard.getKeyDown(Key.C) # Move trackpad position by arrow keys if keyboard.getKeyDown(Key.LeftArrow): alvr.trackpad[0][0] = -1.0 alvr.trackpad[0][1] = 0.0 elif keyboard.getKeyDown(Key.UpArrow): alvr.trackpad[0][0] = 0.0 alvr.trackpad[0][1] = 1.0 elif keyboard.getKeyDown(Key.RightArrow): alvr.trackpad[0][0] = 1.0 alvr.trackpad[0][1] = 0.0 elif keyboard.getKeyDown(Key.DownArrow): alvr.trackpad[0][0] = 0.0 alvr.trackpad[0][1] = -1.0
alvr.buttons[0][alvr.Id('trackpad_click')] = keyboard.getKeyDown(Key.C) alvr.buttons[0][alvr.Id('trackpad_touch')] = keyboard.getKeyDown(Key.C) if keyboard.getKeyDown(Key.LeftArrow): alvr.trackpad[0][0] = -1.0 alvr.trackpad[0][1] = 0.0 elif keyboard.getKeyDown(Key.UpArrow): alvr.trackpad[0][0] = 0.0 alvr.trackpad[0][1] = 1.0 elif keyboard.getKeyDown(Key.RightArrow): alvr.trackpad[0][0] = 1.0 alvr.trackpad[0][1] = 0.0 elif keyboard.getKeyDown(Key.DownArrow): alvr.trackpad[0][0] = 0.0 alvr.trackpad[0][1] = -1.0
class Solution: def checkInclusion(self, s1: str, s2: str) -> bool: ''' T: O(n2 * n1 log n1); can be reduced to O(n2 * n1) by using char counter S: O(n1); can be reduced to O(26) = O(1) by using character counting array ''' n1, n2 = len(s1), len(s2) s1 = sorted(s1) for i in range(n2 - n1 + 1): if s1 == sorted(s2[i:i+n1]): return True return False
class Solution: def check_inclusion(self, s1: str, s2: str) -> bool: """ T: O(n2 * n1 log n1); can be reduced to O(n2 * n1) by using char counter S: O(n1); can be reduced to O(26) = O(1) by using character counting array """ (n1, n2) = (len(s1), len(s2)) s1 = sorted(s1) for i in range(n2 - n1 + 1): if s1 == sorted(s2[i:i + n1]): return True return False
#!/usr/bin/env python3 # MIT License # Copyright (c) 2020 pixelbubble # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # based on https://github.com/pixelbubble/ProtOSINT/blob/main/protosint.py def generate_accounts(): firstName = input("First name: ").lower() lastName = input("Last name: ").lower() yearOfBirth = input("Year of birth: ") pseudo = input("Username (optional): ").lower() zipCode = input("Zip code (optional): ") results_list = [] results_list.append(firstName+lastName) results_list.append(lastName+firstName) results_list.append(firstName[0]+lastName) results_list.append(lastName) results_list.append(firstName+lastName+yearOfBirth) results_list.append(firstName[0]+lastName+yearOfBirth) results_list.append(lastName+firstName+yearOfBirth) results_list.append(firstName+lastName+yearOfBirth[-2:]) results_list.append(firstName+lastName+yearOfBirth[-2:]) results_list.append(firstName[0]+lastName+yearOfBirth[-2:]) results_list.append(lastName+firstName+yearOfBirth[-2:]) results_list.append(firstName+lastName+zipCode) results_list.append(firstName[0]+lastName+zipCode) results_list.append(lastName+firstName+zipCode) results_list.append(firstName+lastName+zipCode[:2]) results_list.append(firstName[0]+lastName+zipCode[:2]) results_list.append(lastName+firstName+zipCode[:2]) if pseudo: results_list.append(pseudo) results_list.append(pseudo+zipCode) results_list.append(pseudo+zipCode[:2]) results_list.append(pseudo+yearOfBirth) results_list.append(pseudo+yearOfBirth[-2:]) results_list = list(set(results_list)) return results_list if __name__ == '__main__': results = generate_accounts() print('\n'.join(results))
def generate_accounts(): first_name = input('First name: ').lower() last_name = input('Last name: ').lower() year_of_birth = input('Year of birth: ') pseudo = input('Username (optional): ').lower() zip_code = input('Zip code (optional): ') results_list = [] results_list.append(firstName + lastName) results_list.append(lastName + firstName) results_list.append(firstName[0] + lastName) results_list.append(lastName) results_list.append(firstName + lastName + yearOfBirth) results_list.append(firstName[0] + lastName + yearOfBirth) results_list.append(lastName + firstName + yearOfBirth) results_list.append(firstName + lastName + yearOfBirth[-2:]) results_list.append(firstName + lastName + yearOfBirth[-2:]) results_list.append(firstName[0] + lastName + yearOfBirth[-2:]) results_list.append(lastName + firstName + yearOfBirth[-2:]) results_list.append(firstName + lastName + zipCode) results_list.append(firstName[0] + lastName + zipCode) results_list.append(lastName + firstName + zipCode) results_list.append(firstName + lastName + zipCode[:2]) results_list.append(firstName[0] + lastName + zipCode[:2]) results_list.append(lastName + firstName + zipCode[:2]) if pseudo: results_list.append(pseudo) results_list.append(pseudo + zipCode) results_list.append(pseudo + zipCode[:2]) results_list.append(pseudo + yearOfBirth) results_list.append(pseudo + yearOfBirth[-2:]) results_list = list(set(results_list)) return results_list if __name__ == '__main__': results = generate_accounts() print('\n'.join(results))
# MYSQL_CONFIG = { # 'host': '10.70.14.244', # 'port': 33044, # 'user': 'view', # 'password': '!@View123', # 'database': 'yjyg' # } MYSQL_CONFIG = { 'host': '127.0.0.1', 'port': 33004, 'user': 'root', 'password': 'q1w2e3r4', 'database': 'yjyg' }
mysql_config = {'host': '127.0.0.1', 'port': 33004, 'user': 'root', 'password': 'q1w2e3r4', 'database': 'yjyg'}
def cheapest_flour(input1,output1): a=[] b=[] with open(input1,"r") as input_file: number1=0 for i in input_file.readlines(): a.append(i.split()) b.append(int(a[number1][0])/int(a[number1][1])) number1+=1 b=sorted(b,reverse=True) with open(output1,"w") as output_file: for i in b: output_file.write(str(i)+"\n")
def cheapest_flour(input1, output1): a = [] b = [] with open(input1, 'r') as input_file: number1 = 0 for i in input_file.readlines(): a.append(i.split()) b.append(int(a[number1][0]) / int(a[number1][1])) number1 += 1 b = sorted(b, reverse=True) with open(output1, 'w') as output_file: for i in b: output_file.write(str(i) + '\n')
# config.py SEED = 42 EXTENSION = ".png" IMAGE_H = 28 IMAGE_W = 28 CHANNELS = 3 BATCH_SIZE = 30 EPOCHS = 400 LEARNING_RATE = 0.001 CIRCLES = "../input/shapes/circles/" SQUARES = "../input/shapes/squares/" TRIANGLES = "../input/shapes/triangles/" INPUT_FOLD = "../input/" OUTPUT_FOLD = "../output/" TRAIN_DATA = "../input/train_dataset.csv" VALID_DATA = "../input/valid_dataset.csv" ACCURACIES = "../output/accuracies.csv" LOSSES = "../output/losses.csv"
seed = 42 extension = '.png' image_h = 28 image_w = 28 channels = 3 batch_size = 30 epochs = 400 learning_rate = 0.001 circles = '../input/shapes/circles/' squares = '../input/shapes/squares/' triangles = '../input/shapes/triangles/' input_fold = '../input/' output_fold = '../output/' train_data = '../input/train_dataset.csv' valid_data = '../input/valid_dataset.csv' accuracies = '../output/accuracies.csv' losses = '../output/losses.csv'
# In one of the Chinese provinces, it was decided to build a series of machines to protect the # population against the coronavirus. The province can be visualized as an array of values 1 and 0, # which arr[i] = 1 means that in city [i] it is possible to build a machine and value 0 that it can't. # There is also a number k, which means that if we put the machine in the city [i], then the cities with # indices [j] such that that abs(i-j) < k are through it protected. Find the minimum number of machines # are needed to provide security in each city, or -1 if that is impossible. def machines_saving_people(T, k): count = 0 distance = -1 protected = distance + k while distance + k < len(T): if protected > len(T) - 1: protected = len(T) - 1 while T[protected] == 0 and protected >= distance + 1: protected -= 1 if protected == distance: return -1 else: distance = protected protected += 2 * k - 1 count += 1 return count T = [0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0] k = 4 print(machines_saving_people(T, k))
def machines_saving_people(T, k): count = 0 distance = -1 protected = distance + k while distance + k < len(T): if protected > len(T) - 1: protected = len(T) - 1 while T[protected] == 0 and protected >= distance + 1: protected -= 1 if protected == distance: return -1 else: distance = protected protected += 2 * k - 1 count += 1 return count t = [0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0] k = 4 print(machines_saving_people(T, k))