content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
comp1 = (1, 2, 3) < (1, 2, 4) comp2 = [1, 2, 3] < [1, 2, 4] comp3 = 'ABC' < 'C' < 'Pascal' < 'Python' comp4 = (1, 2, 3, 4) < (1, 2, 4) comp5 = (1, 2) < (1, 2, -1) comp6 = (1, 2, 3) == (1.0, 2.0, 3.0) comp7 = (1, 2, ('aa', 'ab')) < (1, 2, ('abc', 'a'), 4)...
comp1 = (1, 2, 3) < (1, 2, 4) comp2 = [1, 2, 3] < [1, 2, 4] comp3 = 'ABC' < 'C' < 'Pascal' < 'Python' comp4 = (1, 2, 3, 4) < (1, 2, 4) comp5 = (1, 2) < (1, 2, -1) comp6 = (1, 2, 3) == (1.0, 2.0, 3.0) comp7 = (1, 2, ('aa', 'ab')) < (1, 2, ('abc', 'a'), 4) print(comp1, comp2, comp3, comp4, comp5, comp6, comp7)
CACHE = {} @profile def leonardo(number): if number in (0, 1): return 1 if number not in CACHE: result = leonardo(number - 1) + leonardo(number - 2) + 1 CACHE[number] = result return CACHE[number] NUMBER = 35000 for i in range(NUMBER + 1): print(f'leonardo[{i}] = {leonard...
cache = {} @profile def leonardo(number): if number in (0, 1): return 1 if number not in CACHE: result = leonardo(number - 1) + leonardo(number - 2) + 1 CACHE[number] = result return CACHE[number] number = 35000 for i in range(NUMBER + 1): print(f'leonardo[{i}] = {leonardo(i)}')
''' QUEUE IS A LINEAR DATASTRUCTURE , WHICH SIMULATES REALWORLD QUEUE PROGRAMATICALLY , IT REPRESENTS QUEUE OF ITEMS , WHERE NEW ITEMS CAN BE ENQUEUED AT REAR POSITION , WHILE EXIST ITEMS CAN BE DEQUEUED FROM FRONT POSITION ''' class queue: def __init__(self, lim=10): self.size = lim # alotting ...
""" QUEUE IS A LINEAR DATASTRUCTURE , WHICH SIMULATES REALWORLD QUEUE PROGRAMATICALLY , IT REPRESENTS QUEUE OF ITEMS , WHERE NEW ITEMS CAN BE ENQUEUED AT REAR POSITION , WHILE EXIST ITEMS CAN BE DEQUEUED FROM FRONT POSITION """ class Queue: def __init__(self, lim=10): self.size = lim self.q = [...
LANIA = 1032200 sm.lockInGameUI(True) sm.curNodeEventEnd(True) sm.forcedInput(4) sm.showEffect("Effect/OnUserEff.img/guideEffect/evanTutorial/evanBalloon401", 0, 0, 20, -2, -2, False, 0) sm.spawnNpc(LANIA, 800, -40) sm.showNpcSpecialActionByTemplateId(LANIA, "summon", 0) sm.reservedEffect("Effect/Direction8.img/lightn...
lania = 1032200 sm.lockInGameUI(True) sm.curNodeEventEnd(True) sm.forcedInput(4) sm.showEffect('Effect/OnUserEff.img/guideEffect/evanTutorial/evanBalloon401', 0, 0, 20, -2, -2, False, 0) sm.spawnNpc(LANIA, 800, -40) sm.showNpcSpecialActionByTemplateId(LANIA, 'summon', 0) sm.reservedEffect('Effect/Direction8.img/lightni...
#Calling a method multiple times by using explicit calls when a base uses super() class Vehicle(object): def __del__(self): recycle(self.base_parts) super(Vehicle, self).__del__() class Car(Vehicle): def __del__(self): recycle(self.car_parts) super(Car, self)...
class Vehicle(object): def __del__(self): recycle(self.base_parts) super(Vehicle, self).__del__() class Car(Vehicle): def __del__(self): recycle(self.car_parts) super(Car, self).__del__() class Sportscar(Car, Vehicle): def __del__(self): recycle(self.sports_car_p...
class KiveAuthException(Exception): pass class KiveClientException(Exception): pass class KiveServerException(Exception): pass class KiveMalformedDataException(Exception): pass class KiveRunFailedException(Exception): pass def is_client_error(code): return 400 <= code <= 499 def is_s...
class Kiveauthexception(Exception): pass class Kiveclientexception(Exception): pass class Kiveserverexception(Exception): pass class Kivemalformeddataexception(Exception): pass class Kiverunfailedexception(Exception): pass def is_client_error(code): return 400 <= code <= 499 def is_server_...
src =Split(''' ''') component =aos_component('lib_mico_ble_firmware', src) BT_CHIP = aos_global_config.get('BT_CHIP') BT_CHIP_REVISION = aos_global_config.get('BT_CHIP_REVISION') BT_CHIP_XTAL_FREQUENCY = aos_global_config.get('BT_CHIP_XTAL_FREQUENCY') if BT_CHIP_XTAL_FREQUENCY == None: src.add_sources( BT...
src = split(' \n') component = aos_component('lib_mico_ble_firmware', src) bt_chip = aos_global_config.get('BT_CHIP') bt_chip_revision = aos_global_config.get('BT_CHIP_REVISION') bt_chip_xtal_frequency = aos_global_config.get('BT_CHIP_XTAL_FREQUENCY') if BT_CHIP_XTAL_FREQUENCY == None: src.add_sources(BT_CHIP + BT_...
# San Francisco International # https://www.openstreetmap.org/way/23718192 assert_has_feature( 13, 1311, 3170, 'pois', { 'kind': 'aerodrome', 'iata': 'SFO' }) # Oakland airport # https://www.openstreetmap.org/way/54363486 assert_has_feature( 13, 1314, 3167, 'pois', { 'kind': 'aerodrome', 'i...
assert_has_feature(13, 1311, 3170, 'pois', {'kind': 'aerodrome', 'iata': 'SFO'}) assert_has_feature(13, 1314, 3167, 'pois', {'kind': 'aerodrome', 'iata': 'OAK'})
class AST(object): pass class String(AST): def __init__(self, value: str): self.value = value class Load(AST): def __init__(self, child: String): self.child = child class Create(AST): def __init__(self, child: String): self.child = child class Append(AST): def __init_...
class Ast(object): pass class String(AST): def __init__(self, value: str): self.value = value class Load(AST): def __init__(self, child: String): self.child = child class Create(AST): def __init__(self, child: String): self.child = child class Append(AST): def __init_...
# This file is part of P4wnP1. # # Copyright (c) 2017, Marcus Mengs. # # P4wnP1 is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any la...
class Config: def __init__(self, configfile): self.conf = Config.conf_to_dict(configfile) @staticmethod def conf_to_dict(filename): result_dict = {} lines = [] with open(filename, 'r') as f: lines = f.readlines() for l in lines: l = l.split('...
class CameraHandler: def __init__(self, resolution, zoom=1.0, camera_pos=(0, 0)): self.resolution = resolution self.zoom = zoom self.camera_pos = camera_pos def home(self): self.camera_pos = (0, 0) self.zoom = 1.0 def move_camera(self, x, y): self.camera_pos...
class Camerahandler: def __init__(self, resolution, zoom=1.0, camera_pos=(0, 0)): self.resolution = resolution self.zoom = zoom self.camera_pos = camera_pos def home(self): self.camera_pos = (0, 0) self.zoom = 1.0 def move_camera(self, x, y): self.camera_po...
class PermError(Exception): pass class ObjectNotPersisted(PermError): pass class IncorrectObject(PermError): pass class IncorrectContentType(PermError): pass class ImproperlyConfigured(PermError): pass
class Permerror(Exception): pass class Objectnotpersisted(PermError): pass class Incorrectobject(PermError): pass class Incorrectcontenttype(PermError): pass class Improperlyconfigured(PermError): pass
HOUR = range(24) # 0->23 DOW = range(1,8) # 1-6 SLOT = (0,12,13,24,25,30,36,37,48,49) SPOT_TYPE = [ "Live Read Promo", "Recorded Promo", "Live Read PSA", "Recorded PSA", "Underwriting Spot", "Pledge Liner", "Station ID", "Other" ] DAY = ( 'Monday', 'Tuesday', 'Wednes...
hour = range(24) dow = range(1, 8) slot = (0, 12, 13, 24, 25, 30, 36, 37, 48, 49) spot_type = ['Live Read Promo', 'Recorded Promo', 'Live Read PSA', 'Recorded PSA', 'Underwriting Spot', 'Pledge Liner', 'Station ID', 'Other'] day = ('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday') dow_choice...
class LastWord: def lengthOfLastWord(self, s: str) -> int: last=s.split() if len(last)==0: return 0 while s: last_word=last[-1] x=len(last_word) if x==0: return 0 else: return x break ...
class Lastword: def length_of_last_word(self, s: str) -> int: last = s.split() if len(last) == 0: return 0 while s: last_word = last[-1] x = len(last_word) if x == 0: return 0 else: return x ...
print( '-----------------------------------------\n'\ 'Practical python education || Exercise-19:\n'\ '-----------------------------------------\n' ) print( 'Task:\n'\ '-----------------------------------------\n'\ 'Write a Python program to get a new string from a given string where "Is" has been added ...
print('-----------------------------------------\nPractical python education || Exercise-19:\n-----------------------------------------\n') print('Task:\n-----------------------------------------\nWrite a Python program to get a new string from a given string where "Is" has been added to the front. If the given string ...
with open('myfile.csv') as fh: line = fh.readline() value = line.split('\t')[0] with open('other.txt',"w") as fw: fw.write(str(int(value)*.2))
with open('myfile.csv') as fh: line = fh.readline() value = line.split('\t')[0] with open('other.txt', 'w') as fw: fw.write(str(int(value) * 0.2))
text = "X-DSPAM-Confidence: 0.8475"; numbers = text.find(' ') decibel = text.find('5', numbers) floater = text[numbers + 1 : decibel + 1] floating = floater.strip() print(floating)
text = 'X-DSPAM-Confidence: 0.8475' numbers = text.find(' ') decibel = text.find('5', numbers) floater = text[numbers + 1:decibel + 1] floating = floater.strip() print(floating)
# # PySNMP MIB module HM2-USERMGMT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HM2-USERMGMT-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:32:24 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_range_constraint, value_size_constraint, constraints_intersection, single_value_constraint) ...
class RelPos(object): def __init__(self,row,col): assert(isinstance(row,int)) assert(isinstance(col,int)) self.__row = row self.__col = col def __str__(self): return str(self.__row) + 'x' + \ str(self.__col) def __repr__(self): return 'Stream...
class Relpos(object): def __init__(self, row, col): assert isinstance(row, int) assert isinstance(col, int) self.__row = row self.__col = col def __str__(self): return str(self.__row) + 'x' + str(self.__col) def __repr__(self): return 'Stream.RelPos(' + rep...
#!/usr/bin/env python # encoding: utf-8 def run(whatweb, pluginname): whatweb.recog_from_file(pluginname, "download.php","yonyouup")
def run(whatweb, pluginname): whatweb.recog_from_file(pluginname, 'download.php', 'yonyouup')
## first thing to do is to access the file ## r = read ## w = write ## a = append ## r++ = read and write ##open(" name of file + extension", "r" | "w" | "a", "r+") ## writing and appending to files ## writing new file and appending to existing ##employee_file = open("employees.txt", "a" ) #check if file is ...
employee_file = open('emploees1.txt', 'w') employee_file.write('\nJohn - Assistant Manager') employee_file.close()
''' Time : O(n) Space : O(n) ''' class Solution(object): def twoSum(self, nums, target): map = {} for i in range(0,len(nums)): goal = target - nums[i] if goal in map: return [map[goal], i] map[nums[i]] = i if __name__ == "__main__": ...
""" Time : O(n) Space : O(n) """ class Solution(object): def two_sum(self, nums, target): map = {} for i in range(0, len(nums)): goal = target - nums[i] if goal in map: return [map[goal], i] map[nums[i]] = i if __name__ == '__main__': sl = so...
a = ["1", 1, "1", 2] # ex-14: Remove duplicates from list a a = list(set(a)) print(a) # ex-15: Create a dictionary that contains the keys a and b and their respec # tive values 1 and 2 . my_dict = {"a":1, "b":2} print(my_dict) print(type(my_dict)) # Add "c":3 to dictionary my_dict["c"] = 3 print(my_dict) my_dict2...
a = ['1', 1, '1', 2] a = list(set(a)) print(a) my_dict = {'a': 1, 'b': 2} print(my_dict) print(type(my_dict)) my_dict['c'] = 3 print(my_dict) my_dict2 = dict([('a', 1), ('b', 2)]) print(my_dict2) d = {'a': 1, 'b': 2} print(d['b']) d = {'a': 1, 'b': 2, 'c': 3} sum = d['a'] + d['b'] print(sum) d = {'a': 1, 'b': 2} d['c']...
def main(): print("Hello GitHub!") print("Another Try") print("new branch") main()
def main(): print('Hello GitHub!') print('Another Try') print('new branch') main()
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'variables': { 'chromium_code': 1, }, 'includes': [ 'chromeos_tools.gypi' ], 'targets': [ { 'target_name': 'chromeos', ...
{'variables': {'chromium_code': 1}, 'includes': ['chromeos_tools.gypi'], 'targets': [{'target_name': 'chromeos', 'type': '<(component)', 'dependencies': ['../base/base.gyp:base', '../base/base.gyp:base_prefs', '../build/linux/system.gyp:dbus', '../build/linux/system.gyp:ssl', '../dbus/dbus.gyp:dbus', '../net/net.gyp:ne...
#!/usr/bin/python3 print('Content-Type: text/html; charset=UTF-8\n\n') my_var = 'Python' print('<h1>Hello World From ' + my_var + '</h1>')
print('Content-Type: text/html; charset=UTF-8\n\n') my_var = 'Python' print('<h1>Hello World From ' + my_var + '</h1>')
# The current volume of a water reservoir (in cubic metres) reservoir_volume = 4.445e8 # The amount of rainfall from a storm (in cubic metres) rainfall = 5e6 # decrease the rainfall variable by 10% to account for runoff rainfall *= ( 1 - 0.1 ) # add the rainfall variable to the reservoir_volume variable reservoir_vol...
reservoir_volume = 444500000.0 rainfall = 5000000.0 rainfall *= 1 - 0.1 reservoir_volume += rainfall reservoir_volume *= 1.05 reservoir_volume *= 0.95 reservoir_volume -= 250000.0 print(reservoir_volume)
# Define a list # Can add and remove elements l = ["Bob" , "Rolf", "Anne"] # Define a tuple # Can NOT add and remove elements # Cannot be modified after created t = ("Bob" , "Rolf", "Anne") # Define a Set # Cannot have duplicate values # Does not always keep the order s = {"Bob" , "Rolf", "Anne"} print( l[0] ) # p...
l = ['Bob', 'Rolf', 'Anne'] t = ('Bob', 'Rolf', 'Anne') s = {'Bob', 'Rolf', 'Anne'} print(l[0]) l.append('Smith') print(l) l.remove('Bob') print(l) s.add('Smith') print(s) s.add('Smith') print(s)
''' Description: Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. Note: A leaf is a node with no children. Example: Given the below binary tree and sum = 22, 5 / \ 4 8 / / \ 11 13 4 / \ ...
""" Description: Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. Note: A leaf is a node with no children. Example: Given the below binary tree and sum = 22, 5 / 4 8 / / 11 13 4 / \\ ...
a = set() print (type(a)) # adding values to an empty set a.add(4) a.add(5) # a.add([4, 5, 6]) You can not add list in a set a.add((1, 2, 3)) # but you can add tuple in a set # a.add({'amresh':'You are a hero'}) # dictionary can not be inserted in a set print (a) # Length of the set print (len(a))# show t...
a = set() print(type(a)) a.add(4) a.add(5) a.add((1, 2, 3)) print(a) print(len(a)) a.remove(5) print(a) print(a.pop()) print(a.clear())
t=int(input()) while(t): t=t-1 n,k=input().split() n,k=int(n),int(k) d=set() st=0 i=0 while(i<n): i=i+1 c=set(map(int,input().split()[1:])) d|=c f=len(d) if(f==k and i!=n): st=1 break while(i<n): i=i+1 c=inpu...
t = int(input()) while t: t = t - 1 (n, k) = input().split() (n, k) = (int(n), int(k)) d = set() st = 0 i = 0 while i < n: i = i + 1 c = set(map(int, input().split()[1:])) d |= c f = len(d) if f == k and i != n: st = 1 break ...
def fibonacci(): current = 0 previous = 1 while True: temp = current current = current + previous previous = temp yield current def main(): for index, element in enumerate(fibonacci()): if len(str(element)) >= 1000: answer = index + 1 #starts from 0 br...
def fibonacci(): current = 0 previous = 1 while True: temp = current current = current + previous previous = temp yield current def main(): for (index, element) in enumerate(fibonacci()): if len(str(element)) >= 1000: answer = index + 1 br...
''' See details at https://realpython.com/linked-lists-python/ ''' class Node: def __init__(self, data): self.data = data self.next = None def __repr__(self): return self.data class LinkedList: def __init__(self, nodes=None): self.head = None if nodes is not None:...
""" See details at https://realpython.com/linked-lists-python/ """ class Node: def __init__(self, data): self.data = data self.next = None def __repr__(self): return self.data class Linkedlist: def __init__(self, nodes=None): self.head = None if nodes is not None...
class Solution: def kLengthApart(self, nums: List[int], k: int) -> bool: lastOne = -1 for i, num in enumerate(nums): if num == 1: if lastOne != -1 and i - lastOne - 1 < k: return False lastOne = i return True
class Solution: def k_length_apart(self, nums: List[int], k: int) -> bool: last_one = -1 for (i, num) in enumerate(nums): if num == 1: if lastOne != -1 and i - lastOne - 1 < k: return False last_one = i return True
__all__ = ["SerializationError", "DeserializationError"] class SerializationError(TypeError): pass class DeserializationError(TypeError): pass
__all__ = ['SerializationError', 'DeserializationError'] class Serializationerror(TypeError): pass class Deserializationerror(TypeError): pass
# # PySNMP MIB module NBFLT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NBFLT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:07:15 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...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, constraints_union, value_range_constraint, constraints_intersection) ...
count = [1, 2, 3, 4, 5] fruits = ['apples', 'oranges', 'pears', 'apricots'] change = [1, 'pennies', 2, 'dimes', 3, 'quarters'] print(fruits[2]) #accessing list index print(change.index(2)) for number in count: print("Count:", number) for fruit in fruits: print("Fruit of type:", fruit) for i in change: ...
count = [1, 2, 3, 4, 5] fruits = ['apples', 'oranges', 'pears', 'apricots'] change = [1, 'pennies', 2, 'dimes', 3, 'quarters'] print(fruits[2]) print(change.index(2)) for number in count: print('Count:', number) for fruit in fruits: print('Fruit of type:', fruit) for i in change: print('I got:', i) elements...
class MockRobot: def __init__(self): self._axis = [ Axis(), Axis(), Axis(), Axis(), Axis(), Axis() ] self._target = list(map(lambda a: a.getPosition(), self._axis)) self._target.append(0) # Mock gripper def ...
class Mockrobot: def __init__(self): self._axis = [axis(), axis(), axis(), axis(), axis(), axis()] self._target = list(map(lambda a: a.getPosition(), self._axis)) self._target.append(0) def is_busy(self): return False def set_goal_target(self, points): self._target...
# Show the odd number in a given sequence odd = [x for x in input().split(',') if int(x) % 2 != 0] print(','.join(odd))
odd = [x for x in input().split(',') if int(x) % 2 != 0] print(','.join(odd))
class UDPPacket(object): def __init__(self, time, size, id, src, dst = None): self.time = time self.size = size self.id = id self.src = src self.dst = dst def __repr__(self): return "id: {}, src: {}, time: {}, size: {}".format(self.id, self.src, self.time, self.s...
class Udppacket(object): def __init__(self, time, size, id, src, dst=None): self.time = time self.size = size self.id = id self.src = src self.dst = dst def __repr__(self): return 'id: {}, src: {}, time: {}, size: {}'.format(self.id, self.src, self.time, self.si...
# Copyright 2021 Canonical Ltd. # See LICENSE file for licensing details. def pytest_addoption(parser): # not providing the "default" arg to addoption: the bundle template already specifies defaults parser.addoption("--alertmanager", action="store") parser.addoption("--prometheus", action="store") par...
def pytest_addoption(parser): parser.addoption('--alertmanager', action='store') parser.addoption('--prometheus', action='store') parser.addoption('--grafana', action='store') parser.addoption('--loki', action='store') parser.addoption('--avalanche', action='store') parser.addoption('--channel',...
# todas as classes derivam do object class (direta ou indiretamente) class Animal(object): def __init__(self): self.age = 1 def eat(self): print("eat") # Animal: parent, base # Mammal: Child, sub class Mammal(Animal): def walk(self): print("walk") class Fish(Animal): def swin(self): print...
class Animal(object): def __init__(self): self.age = 1 def eat(self): print('eat') class Mammal(Animal): def walk(self): print('walk') class Fish(Animal): def swin(self): print('swin') m = mammal() isinstance(m, Animal) isinstance(m, object) o = object() print(issub...
bash(''' echo "I am secure" ''', secure=True ) bash(''' echo "I am secure but I fail" exit 1 ''', secure=True )
bash('\necho "I am secure"\n', secure=True) bash('\necho "I am secure but I fail"\nexit 1\n', secure=True)
def solution(X,A): for i in range(len(A)): if(A[i]==X): #print(i) return(i) return(-1) A=[1,3,1,4,2,3,5,4] solution(A,11)
def solution(X, A): for i in range(len(A)): if A[i] == X: return i return -1 a = [1, 3, 1, 4, 2, 3, 5, 4] solution(A, 11)
def calcula_area(lado): return lado ** 2 if __name__ == '__main__': print(2 * calcula_area(int(input())))
def calcula_area(lado): return lado ** 2 if __name__ == '__main__': print(2 * calcula_area(int(input())))
class Piece: def __init__(self, row, column): self.player = '-' self.group = None self.ko = False self.liberties = 4 self.row = row self.column = column self.board = None def calculateLiberties(self): self.liberties = 4 # Check the upper...
class Piece: def __init__(self, row, column): self.player = '-' self.group = None self.ko = False self.liberties = 4 self.row = row self.column = column self.board = None def calculate_liberties(self): self.liberties = 4 if self.row == 0 ...
class BashPrompt(object): @staticmethod def attribute(attr): try: return Attributes[attr or "default"]["apply"] except KeyError as e: return attr @staticmethod def background(color): try: return BackgroundColor[color or "default"] excep...
class Bashprompt(object): @staticmethod def attribute(attr): try: return Attributes[attr or 'default']['apply'] except KeyError as e: return attr @staticmethod def background(color): try: return BackgroundColor[color or 'default'] exc...
def process_input(filename): lanternfish = { "8": 0, "7": 0, "6": 0, "5": 0, "4": 0, "3": 0, "2": 0, "1": 0, "0": 0 } with open(filename) as f: lanternfish_ages = [x.strip() for x in f.readline().split(",")] for age in ...
def process_input(filename): lanternfish = {'8': 0, '7': 0, '6': 0, '5': 0, '4': 0, '3': 0, '2': 0, '1': 0, '0': 0} with open(filename) as f: lanternfish_ages = [x.strip() for x in f.readline().split(',')] for age in lanternfish_ages: lanternfish[age] += 1 return lanternfish def...
# # PySNMP MIB module GMS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/GMS-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:19: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)...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint) ...
class ColumnDiagramPerimeter: def getPerimiter(self, a): l = len(a) return sum(abs(a[i] - a[i - 1]) for i in xrange(1, l)) + 2 * l + a[0] + a[-1]
class Columndiagramperimeter: def get_perimiter(self, a): l = len(a) return sum((abs(a[i] - a[i - 1]) for i in xrange(1, l))) + 2 * l + a[0] + a[-1]
class Circle(): def draw(self): print("Drawing Circle") class Rectangle(): def draw(self): print("Drawing Rectangle") class Triangle(): def draw(self): print("Drawing Triangle") class ShapeFactory(): def __init__(self): self.shape_choices = ['circle', 'rectangle', '...
class Circle: def draw(self): print('Drawing Circle') class Rectangle: def draw(self): print('Drawing Rectangle') class Triangle: def draw(self): print('Drawing Triangle') class Shapefactory: def __init__(self): self.shape_choices = ['circle', 'rectangle', 'triangl...
def get_summary(text): # Removing Square Brackets and Extra Spaces text = re.sub(r'\[[0-9]*\]', ' ', text) text = re.sub(r'\s+', ' ', text) # Removing special characters and digits formatted_text = re.sub('[^a-zA-Z]', ' ', text ) formatted_text = re.sub(r'\s+', ' ', formatted_text) ...
def get_summary(text): text = re.sub('\\[[0-9]*\\]', ' ', text) text = re.sub('\\s+', ' ', text) formatted_text = re.sub('[^a-zA-Z]', ' ', text) formatted_text = re.sub('\\s+', ' ', formatted_text) sentence_list = nltk.sent_tokenize(text) stopwords = nltk.corpus.stopwords.words('english') wo...
class Solution: def isNumber(self, s: str) -> bool: pattern = re.compile(r'^[+-]?(\d+|\d+\.\d*|\.\d+)([eE][+-]?\d+)?$') return pattern.match(s) is not None
class Solution: def is_number(self, s: str) -> bool: pattern = re.compile('^[+-]?(\\d+|\\d+\\.\\d*|\\.\\d+)([eE][+-]?\\d+)?$') return pattern.match(s) is not None
def ficha(a='DESCONHECIDO', b=0): print(f'O jogador {a} fez {b} gols') # programa principal nome = str(input('Nome do Jogador: ')) gol = str(input('Numero de gols: ')) if str.isalpha(nome) and str.isnumeric(gol): gol = int(gol) ficha(nome, gol) elif not str.isalpha(nome) and str.isnumeric(gol): gol =...
def ficha(a='DESCONHECIDO', b=0): print(f'O jogador {a} fez {b} gols') nome = str(input('Nome do Jogador: ')) gol = str(input('Numero de gols: ')) if str.isalpha(nome) and str.isnumeric(gol): gol = int(gol) ficha(nome, gol) elif not str.isalpha(nome) and str.isnumeric(gol): gol = int(gol) ficha(b=go...
# direct driver.actions # driver.get("http://www.python.org") # driver.title # driver.close() class InputKeys: def __init__(self): self.keys = {'ADD': '\ue025', 'ALT': '\ue00a', 'ARROW_DOWN': '\ue015', 'ARROW_LEFT': '\ue012', ...
class Inputkeys: def __init__(self): self.keys = {'ADD': '\ue025', 'ALT': '\ue00a', 'ARROW_DOWN': '\ue015', 'ARROW_LEFT': '\ue012', 'ARROW_RIGHT': '\ue014', 'ARROW_UP': '\ue013', 'BACKSPACE': '\ue003', 'BACK_SPACE': '\ue003', 'CANCEL': '\ue001', 'CLEAR': '\ue005', 'COMMAND': '\ue03d', 'CONTROL': '\ue009', ...
# # PySNMP MIB module ONEFS-SNAPSHOT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ONEFS-SNAPSHOT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:25:35 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_range_constraint, value_size_constraint, constraints_intersection, single_value_constraint) ...
def first_entry(): return "a"
def first_entry(): return 'a'
#!/bin/python3 a = [] for i in range(6): line = input() a.append([int(x) for x in line.split()]) def hourglass_sum(a, i, j): sum = a[i][j] + a[i][j + 1] + a[i][j + 2] i += 1 sum += a[i][j + 1] i += 1 sum += a[i][j] + a[i][j + 1] + a[i][j + 2] return sum def max_hourglasses(a): ...
a = [] for i in range(6): line = input() a.append([int(x) for x in line.split()]) def hourglass_sum(a, i, j): sum = a[i][j] + a[i][j + 1] + a[i][j + 2] i += 1 sum += a[i][j + 1] i += 1 sum += a[i][j] + a[i][j + 1] + a[i][j + 2] return sum def max_hourglasses(a): max = -9 * 36 f...
# # @lc app=leetcode id=142 lang=python3 # # [142] Linked List Cycle II # # @lc code=start # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def detectCycle(self, head: ListNode): if not head: r...
class Solution: def detect_cycle(self, head: ListNode): if not head: return None walked = set() while head.next: if head in walked: return head walked.add(head) head = head.next return None
class Solution: def findNumOfValidWords(self, words: List[str], puzzles: List[str]) -> List[int]: w = [frozenset(i) for i in words if len(set(i)) <= 7] d = {} res = [] for i in w: d[i] = d.get(i, 0) + 1 for p in puzzles: ct = 0 pr = (p[0],)...
class Solution: def find_num_of_valid_words(self, words: List[str], puzzles: List[str]) -> List[int]: w = [frozenset(i) for i in words if len(set(i)) <= 7] d = {} res = [] for i in w: d[i] = d.get(i, 0) + 1 for p in puzzles: ct = 0 pr = (p...
# Comment to avert black & flake8 disagreement def filter_for_value(driver, value, last=False): if last: xpath = '(//*[@data-testid="Search-iconButton"])[last()]' else: xpath = '//*[@data-testid="Search-iconButton"]' driver.click_xpath(xpath) search_input_xpath = "//input[@aria-label='...
def filter_for_value(driver, value, last=False): if last: xpath = '(//*[@data-testid="Search-iconButton"])[last()]' else: xpath = '//*[@data-testid="Search-iconButton"]' driver.click_xpath(xpath) search_input_xpath = "//input[@aria-label='Search']" search_input = driver.wait_for_xpat...
#!/usr/bin/python # Custom command for creating support tickets config.declare_permission("action.sap_openticket", _("Open Support Ticket"), _("Open a support ticket for this host/service"), [ "user", "admin" ]) def command_open_ticket(cmdtag, spec, row): if html.var("_sap_openticket"): ...
config.declare_permission('action.sap_openticket', _('Open Support Ticket'), _('Open a support ticket for this host/service'), ['user', 'admin']) def command_open_ticket(cmdtag, spec, row): if html.var('_sap_openticket'): comment = u'OPENTICKET:' + html.var_utf8('_sap_ticket_comment') broadcast = 0...
_version = 0 proj_default = {'symbol':'H', 'z':1, 'w':1.008, 'energy':10, 'angle':0} proj_example = \ {'symbol':'Si', 'z':14, 'w':29.977, 'energy':1000, 'angle':45} atomtbl_elem_default = \ {'symbol':'', 'z':0, 'w':0, 'stoich':1.0, 'disp':[0, 0, 0]} atomtbl_elem_example = \ {'symbol':'Si', 'z...
_version = 0 proj_default = {'symbol': 'H', 'z': 1, 'w': 1.008, 'energy': 10, 'angle': 0} proj_example = {'symbol': 'Si', 'z': 14, 'w': 29.977, 'energy': 1000, 'angle': 45} atomtbl_elem_default = {'symbol': '', 'z': 0, 'w': 0, 'stoich': 1.0, 'disp': [0, 0, 0]} atomtbl_elem_example = {'symbol': 'Si', 'z': 14, 'w': 28.08...
class Command: def __init__(self, drone_id, command, warehouse_id=0, product_type=0, number_of_items=0, customer_id=0, number_of_turns=0): self.drone_id = drone_id self.command = command self.warehouse_id = warehouse_id self.product_type = product_type self.number_of_items =...
class Command: def __init__(self, drone_id, command, warehouse_id=0, product_type=0, number_of_items=0, customer_id=0, number_of_turns=0): self.drone_id = drone_id self.command = command self.warehouse_id = warehouse_id self.product_type = product_type self.number_of_items =...
def is_prime(n): for i in range(2,n): if n % i == 0: return False return True def twin_primes(digits): start = 10 ** (digits - 1) end = 10 ** digits - 1 if start == 1: start = 3 twin_primes = '' for num in range(start, end, 1): if is_prime(num) and is_prime(num + 2): twin_primes +=...
def is_prime(n): for i in range(2, n): if n % i == 0: return False return True def twin_primes(digits): start = 10 ** (digits - 1) end = 10 ** digits - 1 if start == 1: start = 3 twin_primes = '' for num in range(start, end, 1): if is_prime(num) and is_pr...
# -*- coding: utf-8 -*- # !------------------------------------------------------------------------------ # ! IST/MARETEC, Water Modelling Group, Mohid modelling system # !------------------------------------------------------------------------------ # ! # ! TITLE : MXDMF_writer # ! PR...
class Mxdmfwriter: def __init__(self): self.filename = [] self.directory = [] def open_file(self, filename, directory): self.filename = filename self.directory = directory self.f = open(self.directory + '/' + self.filename + '.xdmf', 'w') self.writeHeader() ...
def get_json_response(success, data, error): return { "success": success, "data": data, "error": error }
def get_json_response(success, data, error): return {'success': success, 'data': data, 'error': error}
score = input() if score == 'A+': print(4.3) elif score == 'A0': print(4.0) elif score == 'A-': print(3.7) elif score == 'B+': print(3.3) elif score == 'B0': print(3.0) elif score == 'B-': print(2.7) elif score == 'C+': print(2.3) elif score == 'C0': print(2.0) elif score == 'C-': p...
score = input() if score == 'A+': print(4.3) elif score == 'A0': print(4.0) elif score == 'A-': print(3.7) elif score == 'B+': print(3.3) elif score == 'B0': print(3.0) elif score == 'B-': print(2.7) elif score == 'C+': print(2.3) elif score == 'C0': print(2.0) elif score == 'C-': pr...
# reversed Mendeleev table (i.e. Meyer table) periodic_numbers = [0, 1, 112, 2, 8, ...
periodic_numbers = [0, 1, 112, 2, 8, 82, 88, 94, 100, 106, 113, 3, 9, 83, 89, 95, 101, 107, 114, 4, 10, 14, 46, 50, 54, 58, 62, 66, 70, 74, 78, 84, 90, 96, 102, 108, 115, 5, 11, 15, 47, 51, 55, 59, 63, 67, 71, 75, 79, 85, 91, 97, 103, 109, 116, 6, 12, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 48, 52, ...
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next def make_list(arr): head = ListNode(arr[0]) temp = head for i in range(1, len(arr) -1): # print(i, head.val) head.next = ListNode(arr[i]) h...
class Listnode: def __init__(self, val=0, next=None): self.val = val self.next = next def make_list(arr): head = list_node(arr[0]) temp = head for i in range(1, len(arr) - 1): head.next = list_node(arr[i]) head = head.next return temp class Solution: def delet...
class ComponentLanguage: PYTHON = "Python" R = "R" JAVA = "Java" JUPYTER = "Jupyter"
class Componentlanguage: python = 'Python' r = 'R' java = 'Java' jupyter = 'Jupyter'
items = ( ("map", 9, 150, 1), ("compass", 13, 35, 1), ("water", 153, 200, 3), ("sandwich", 50, 60, 2), ("glucose", 15, 60, 2), ("tin", 68, 45, 3), ("banana", 27, 60, 3), ("apple", 39, 40, 3), ("cheese", 23, 30, 1), ("beer", 52, 10, 3), ("suntan cream",11, 70, 1), ("camera", 32, 30, 1), ("t-shirt", 24, 15...
items = (('map', 9, 150, 1), ('compass', 13, 35, 1), ('water', 153, 200, 3), ('sandwich', 50, 60, 2), ('glucose', 15, 60, 2), ('tin', 68, 45, 3), ('banana', 27, 60, 3), ('apple', 39, 40, 3), ('cheese', 23, 30, 1), ('beer', 52, 10, 3), ('suntan cream', 11, 70, 1), ('camera', 32, 30, 1), ('t-shirt', 24, 15, 2), ('trouser...
s1, s2, s3 = map(str, input().split()) if s1[-1] == s2[0] and s2[-1] == s3[0]: print("YES") else: print("NO")
(s1, s2, s3) = map(str, input().split()) if s1[-1] == s2[0] and s2[-1] == s3[0]: print('YES') else: print('NO')
CODON_TABLE = { "AUG": "Methionine", "UUU": "Phenylalanine", "UUC": "Phenylalanine", "UUA": "Leucine", "UUG": "Leucine", "UCU": "Serine", "UCC": "Serine", "UCA": "Serine", "UCG": "Serine", "UAU": "Tyrosine", "UAC": "Tyrosine", ...
codon_table = {'AUG': 'Methionine', 'UUU': 'Phenylalanine', 'UUC': 'Phenylalanine', 'UUA': 'Leucine', 'UUG': 'Leucine', 'UCU': 'Serine', 'UCC': 'Serine', 'UCA': 'Serine', 'UCG': 'Serine', 'UAU': 'Tyrosine', 'UAC': 'Tyrosine', 'UGU': 'Cysteine', 'UGC': 'Cysteine', 'UGG': 'Tryptophan', 'UAA': 'STOP', 'UAG': 'STOP', 'UGA'...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"get_most_severe_mutation_type": "00_core.ipynb", "get_residues": "00_core.ipynb", "get_median_residues": "00_core.ipynb"} modules = ["core.py"] doc_url = "https://gpprnd.github.io/poola_b...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'get_most_severe_mutation_type': '00_core.ipynb', 'get_residues': '00_core.ipynb', 'get_median_residues': '00_core.ipynb'} modules = ['core.py'] doc_url = 'https://gpprnd.github.io/poola_be/' git_url = 'https://github.com/gpprnd/poola_be/tree/master...
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class ListNodeEx: def __init__(self, node): self.node = node self.prev = None class Solution: def removeNthFromEnd(self, head: ListNode, n: int) -> List...
class Listnode: def __init__(self, x): self.val = x self.next = None class Listnodeex: def __init__(self, node): self.node = node self.prev = None class Solution: def remove_nth_from_end(self, head: ListNode, n: int) -> ListNode: prev = None cur_node = he...
# # PySNMP MIB module NLS-BBNIDENT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NLS-BBNIDENT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:07:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_size_constraint, constraints_union, value_range_constraint, single_value_constraint) ...
x=5 print(x) # error 2 y= 5 print(y) # error 3
x = 5 print(x) y = 5 print(y)
time = 15 *60 if "clear" in sm.getQRValue(62038): sm.warp(701220400) elif "1" in sm.getQRValue(62007): sm.warpInstanceIn(701220410) sm.createClockForMultiple(time, 701220410, 701220510) sm.invokeAfterDelay(time*1000, "warpInstanceOut", 701220300, 3)
time = 15 * 60 if 'clear' in sm.getQRValue(62038): sm.warp(701220400) elif '1' in sm.getQRValue(62007): sm.warpInstanceIn(701220410) sm.createClockForMultiple(time, 701220410, 701220510) sm.invokeAfterDelay(time * 1000, 'warpInstanceOut', 701220300, 3)
# # PySNMP MIB module DNOS-PORTSECURITY-PRIVATE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DNOS-PORTSECURITY-PRIVATE-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:51:56 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python ve...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, constraints_union, value_size_constraint, single_value_constraint) ...
class Solution: def removeElement(self, nums: List[int], val: int) -> int: count = 0 for numbers in range(len(nums)): i = nums[numbers] if nums[numbers] == val: nums.pop(numbers) nums.append(i) count = count +1 ...
class Solution: def remove_element(self, nums: List[int], val: int) -> int: count = 0 for numbers in range(len(nums)): i = nums[numbers] if nums[numbers] == val: nums.pop(numbers) nums.append(i) count = count + 1 print(...
# States mock_dispenser_state = { "log": 'INFO:app.BookKeeper.dispenser_state:{"time": {"sec": 1600, "nanosec": 0}, "guid": "coke_dispenser", "mode": 0, "request_guid_queue": [], "seconds_remaining": 0.0}\n', "stream": "stdout", "kubernetes": { "container_name": "app-that-writes-logs", "name...
mock_dispenser_state = {'log': 'INFO:app.BookKeeper.dispenser_state:{"time": {"sec": 1600, "nanosec": 0}, "guid": "coke_dispenser", "mode": 0, "request_guid_queue": [], "seconds_remaining": 0.0}\n', 'stream': 'stdout', 'kubernetes': {'container_name': 'app-that-writes-logs', 'namespace_name': 'default', 'pod_name': 'ap...
visited = [] visitedInv = [] adj = [] adjInv = [] stack = [] score = [] def dfs_1(u): if visited[u]: return visited[u] = 1 for i in range(len(adj[u])): dfs_1(adj[u][i]) stack.append(u) def dfs_2(u, counter): if visitedInv[u]: return visitedInv[u] = 1 for i in...
visited = [] visited_inv = [] adj = [] adj_inv = [] stack = [] score = [] def dfs_1(u): if visited[u]: return visited[u] = 1 for i in range(len(adj[u])): dfs_1(adj[u][i]) stack.append(u) def dfs_2(u, counter): if visitedInv[u]: return visitedInv[u] = 1 for i in rang...
x = 0 y = 0 n = 0 traps = [ 'polymorph', 'fire' ] lines = [ it.strip() for it in open('dat/vinstquest.des', 'r').readlines() ] gogo = False for it in lines: if not gogo: gogo = 'MAP' == it else: if 'ENDMAP' == it: break x = 0 for x in range(0, len(it)): if '#' == it[x]: print('TRAP:"%s",(%d,%d)' % (...
x = 0 y = 0 n = 0 traps = ['polymorph', 'fire'] lines = [it.strip() for it in open('dat/vinstquest.des', 'r').readlines()] gogo = False for it in lines: if not gogo: gogo = 'MAP' == it else: if 'ENDMAP' == it: break x = 0 for x in range(0, len(it)): if '#'...
# 1 create a new var x and assign value 10.5 x = 10.5 # 2 create a new variable y and assign it the value 4 y = 4 # 3 sum x and y and make x refer to the resulting value x = x + y print("x=",x) print("y=", y)
x = 10.5 y = 4 x = x + y print('x=', x) print('y=', y)
# Instagram password pw = 'XXXXXX' # Twitter Password pwT = 'XXXXXX'
pw = 'XXXXXX' pw_t = 'XXXXXX'
# recursive version 2 of power def recurPower2(base, exp): if exp == 0: return 1 elif exp % 2 != 0: return base * recurPower2(base, exp - 1) else: return recurPower2(base * base, exp / 2)
def recur_power2(base, exp): if exp == 0: return 1 elif exp % 2 != 0: return base * recur_power2(base, exp - 1) else: return recur_power2(base * base, exp / 2)
cars = [ {'make': 'Ford', 'model': 'Fiesta', 'mileage': 23000, 'fuel_consumed': 460}, {'make': 'Ford', 'model': 'Focus', 'mileage': 17000, 'fuel_consumed': 350}, {'make': 'Mazda', 'model': 'MX-5', 'mileage': 49000, 'fuel_consumed': 900}, {'make': 'Mini', 'model': 'Cooper', 'mileage': 31000, 'fuel_consu...
cars = [{'make': 'Ford', 'model': 'Fiesta', 'mileage': 23000, 'fuel_consumed': 460}, {'make': 'Ford', 'model': 'Focus', 'mileage': 17000, 'fuel_consumed': 350}, {'make': 'Mazda', 'model': 'MX-5', 'mileage': 49000, 'fuel_consumed': 900}, {'make': 'Mini', 'model': 'Cooper', 'mileage': 31000, 'fuel_consumed': 235}] def c...
def readFile(fileName): with open(fileName, "r") as f: lines = f.readlines() for i in range(0, len(lines)): lines[i] = lines[i].strip() for i in range(len(lines) - 1, -1, -1): isNote = 0 for j in range(0, len(lines[i])): if (lines[i][j] == "/"): ...
def read_file(fileName): with open(fileName, 'r') as f: lines = f.readlines() for i in range(0, len(lines)): lines[i] = lines[i].strip() for i in range(len(lines) - 1, -1, -1): is_note = 0 for j in range(0, len(lines[i])): if lines[i][j] == '/': is...
text = ''' <?xml version="1.0" encoding="utf-8" ?> <body copyright="All data copyright agencies listed below and NextBus Inc 2015."> <Error shouldRetry="false"> agency parameter "a" must be specified in query string </Error> </body> '''
text = '\n<?xml version="1.0" encoding="utf-8" ?> \n<body copyright="All data copyright agencies listed below and NextBus Inc 2015.">\n <Error shouldRetry="false">\n agency parameter "a" must be specified in query string\n</Error>\n</body>\n'
wt5_2_10 = {'192.168.122.110': [10.6037, 8.5437, 7.7737, 7.3215, 7.3115, 6.2924, 6.4081, 6.4018, 6.3524, 6.2639, 6.4049, 6.3275, 6.3022, 6.6374, 6.2736, 6.2103, 6.2187, 6.1754, 6.1615, 6.2147, 6.44, 6.1789, 6.2141, 6.1865, 5.9726, 5.9675, 5.9756, 5.9846, 5.9909, 5.9722, 5.9707, 5.9538, 6.1191, 6.12, 6.099, 6.0903, 6.0...
wt5_2_10 = {'192.168.122.110': [10.6037, 8.5437, 7.7737, 7.3215, 7.3115, 6.2924, 6.4081, 6.4018, 6.3524, 6.2639, 6.4049, 6.3275, 6.3022, 6.6374, 6.2736, 6.2103, 6.2187, 6.1754, 6.1615, 6.2147, 6.44, 6.1789, 6.2141, 6.1865, 5.9726, 5.9675, 5.9756, 5.9846, 5.9909, 5.9722, 5.9707, 5.9538, 6.1191, 6.12, 6.099, 6.0903, 6.08...
#!/usr/bin/env python ''' Copyright (C) 2020, WAFW00F Developers. See the LICENSE file for copying permission. ''' NAME = 'Huawei Cloud Firewall (Huawei)' def is_waf(self): schemes = [ self.matchCookie(r'^HWWAFSESID='), self.matchHeader(('Server', r'HuaweiCloudWAF')), self.matchContent(r'...
""" Copyright (C) 2020, WAFW00F Developers. See the LICENSE file for copying permission. """ name = 'Huawei Cloud Firewall (Huawei)' def is_waf(self): schemes = [self.matchCookie('^HWWAFSESID='), self.matchHeader(('Server', 'HuaweiCloudWAF')), self.matchContent('hwclouds\\.com'), self.matchContent('hws_security@')...
n = int(input()) ans = (n // 100) % 10 print(ans)
n = int(input()) ans = n // 100 % 10 print(ans)
__all__ = ['run','main'] __title__ = 'dockerDeployer' __version__ = '0.0.8' __author__ = 'stosc lee' __copyright__ = 'Copyright 2020 stosc lee' __serverName__='ddeployer' __daemonName__='ddd'
__all__ = ['run', 'main'] __title__ = 'dockerDeployer' __version__ = '0.0.8' __author__ = 'stosc lee' __copyright__ = 'Copyright 2020 stosc lee' __server_name__ = 'ddeployer' __daemon_name__ = 'ddd'
expected_output = { "router": { "FE80::FA7A:41FF:FE25:2502": { "interface": "Vlan100", "last_update": 0, "hops": 64, "lifetime": 200, "addr_flag": 0, "other_flag": 0, "mtu": 1500, "home_agent_flag": 0, "preference": "Low", "reachable_time": 0, "r...
expected_output = {'router': {'FE80::FA7A:41FF:FE25:2502': {'interface': 'Vlan100', 'last_update': 0, 'hops': 64, 'lifetime': 200, 'addr_flag': 0, 'other_flag': 0, 'mtu': 1500, 'home_agent_flag': 0, 'preference': 'Low', 'reachable_time': 0, 'retransmit_time': 0, 'prefix': {'111::/64': {'valid_lifetime': 12, 'preferred_...
# 2 to the 1000 value big = 2 for i in range(1,1000): big = big*2 # List of the dgits in 2^1000 numList = [int(m) for m in str(big)] # The sum s = 0 # Prints the number of digits - so that the next for loop doesn't error array out of bounds print (len(str(big))) for n in range (0,302): s = s + numList[n] p...
big = 2 for i in range(1, 1000): big = big * 2 num_list = [int(m) for m in str(big)] s = 0 print(len(str(big))) for n in range(0, 302): s = s + numList[n] print(s)
resp = 1 while resp == 1: X = int(input()) a=1 b=2 for i in range (1,X+1,1): if (i==1): print(1) if (i==2): print(2) if (i==3): c = (a*b)+1 print(c) if i > 3: a = b b = c d = (a*b)+1 ...
resp = 1 while resp == 1: x = int(input()) a = 1 b = 2 for i in range(1, X + 1, 1): if i == 1: print(1) if i == 2: print(2) if i == 3: c = a * b + 1 print(c) if i > 3: a = b b = c d = a * ...
target = "altera" action = "synthesis" syn_family = "CYCLONE 10 LP" syn_device = "10CL016Y" syn_grade = "C6G" syn_package = "U256" syn_top = "mkrvidor4000_top" syn_project = "i2c-demo" syn_tool = "quartus" quartus_preflow = "../../top/mkrvidor4000/pinout.tcl" quartus_postmodule = "../../top/mkrvidor4000/module.tcl" ...
target = 'altera' action = 'synthesis' syn_family = 'CYCLONE 10 LP' syn_device = '10CL016Y' syn_grade = 'C6G' syn_package = 'U256' syn_top = 'mkrvidor4000_top' syn_project = 'i2c-demo' syn_tool = 'quartus' quartus_preflow = '../../top/mkrvidor4000/pinout.tcl' quartus_postmodule = '../../top/mkrvidor4000/module.tcl' mod...
def hanoi(n, a, b, c): if n == 1: return [[a, c]] return hanoi(n-1, a, c, b) + [[a, c]] + hanoi(n-1, b, a, c) if __name__ == "__main__": num = int(input("Which floor should I run the Hanoi Tower?: ")) print(hanoi(num, 1, 2, 3))
def hanoi(n, a, b, c): if n == 1: return [[a, c]] return hanoi(n - 1, a, c, b) + [[a, c]] + hanoi(n - 1, b, a, c) if __name__ == '__main__': num = int(input('Which floor should I run the Hanoi Tower?: ')) print(hanoi(num, 1, 2, 3))
numbers = [int(n) for n in input().split()] average_number = sum(numbers) / len(numbers) answer = [] for n in range(len(numbers) - 1, -1, -1): if (len(answer)) == 5: break if numbers[n] > average_number: max_number = max(numbers) answer.append(max_number) numbers.remove(max_num...
numbers = [int(n) for n in input().split()] average_number = sum(numbers) / len(numbers) answer = [] for n in range(len(numbers) - 1, -1, -1): if len(answer) == 5: break if numbers[n] > average_number: max_number = max(numbers) answer.append(max_number) numbers.remove(max_number)...