content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# John McDonough # github - movinalot # Advent of Code 2015 testing = 0 debug = 0 day = "02" year = "2015" part = "1" answer = None with open("puzzle_data_" + day + "_" + year + ".txt") as f: puzzle_data = f.read() if testing: puzzle_data = "2x3x4\n"\ "1x1x10\n" if de...
testing = 0 debug = 0 day = '02' year = '2015' part = '1' answer = None with open('puzzle_data_' + day + '_' + year + '.txt') as f: puzzle_data = f.read() if testing: puzzle_data = '2x3x4\n1x1x10\n' if debug: print(puzzle_data) puzzle_data = puzzle_data.splitlines() wrapping_paper = 0 for dimensions in puzz...
class UserProfile: def __init__(self, name: str = None): self.name = name def __str__(self): return f"name:{self.name}"
class Userprofile: def __init__(self, name: str=None): self.name = name def __str__(self): return f'name:{self.name}'
# Guess the encoding in .sav files created with SPSS v14 or earlier. # Encoding information was added to the .sav file header in SPSS v15. Unicode support appeared in SPSS v16 # If the file is created on Windows [1], with SPSS v14 or older [2], and then opened on Linux/MacOS, the dict # below is used to look up the Wi...
locale2codepage = {'af': '1252', 'af_ZA': '1252', 'am_ET': None, 'ar': '1256', 'arn_CL': '1252', 'ar_AE': '1256', 'ar_BH': '1256', 'ar_DZ': '1256', 'ar_EG': '1256', 'ar_IQ': '1256', 'ar_JO': '1256', 'ar_KW': '1256', 'ar_LB': '1256', 'ar_LY': '1256', 'ar_MA': '1256', 'ar_OM': '1256', 'ar_QA': '1256', 'ar_SA': '1256', 'a...
class Result: def __init__(self, text, value): self.text = text self.value = value
class Result: def __init__(self, text, value): self.text = text self.value = value
expected_output = { 'our_address': { '10.229.1.2': { 'neighbor_address': { '10.229.1.1': { 'demand_mode': 0, 'elapsed_time_watermarks': '0 0', 'elapsed_time_watermarks_last': 0, 'handle': 1, ...
expected_output = {'our_address': {'10.229.1.2': {'neighbor_address': {'10.229.1.1': {'demand_mode': 0, 'elapsed_time_watermarks': '0 0', 'elapsed_time_watermarks_last': 0, 'handle': 1, 'hello': 500, 'hello_hits': 544, 'holddown': 2561, 'holddown_hits': 0, 'interface': 'GigabitEthernet2', 'last_packet': {'c_bit': 1, 'd...
# https://leetcode.com/problems/check-if-a-string-is-a-valid-sequence-from-root-to-leaves-path-in-a-binary-tree # 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...
class Treenode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def __init__(self): self.ans = False def backtrack(self, node, index): if self.ans: return if index == len(self...
SECRET_KEY = '00000000' INSTALLED_APPS = [ 'django.contrib.auth', 'django.contrib.contenttypes', 'news' ]
secret_key = '00000000' installed_apps = ['django.contrib.auth', 'django.contrib.contenttypes', 'news']
#!/usr/bin/env python3 # -*- coding: utf-8 -*- a = [1, 2, 3] b = [*a, 4, 5, 6] if __name__ == '__main__': print(b)
a = [1, 2, 3] b = [*a, 4, 5, 6] if __name__ == '__main__': print(b)
difference_list=[] prime_num=open("/home/grey/Desktop/Primenum/prime.txt","r") prime_list = prime_num.readlines() length_of_primelist=len(prime_list) def get_patterns(prime_list): size_of_list=len(prime_list) i=0 while(i<size_of_list-1): d=int(prime_list[i+1])-int(prime_list[i]) difference_...
difference_list = [] prime_num = open('/home/grey/Desktop/Primenum/prime.txt', 'r') prime_list = prime_num.readlines() length_of_primelist = len(prime_list) def get_patterns(prime_list): size_of_list = len(prime_list) i = 0 while i < size_of_list - 1: d = int(prime_list[i + 1]) - int(prime_list[i])...
DEPS = [ 'depot_tools/depot_tools', 'depot_tools/gsutil', 'flutter/os_utils', 'flutter/zip', 'recipe_engine/buildbucket', 'recipe_engine/file', 'recipe_engine/path', 'recipe_engine/properties', 'recipe_engine/runtime', 'recipe_engine/step', 'recipe_engine/uuid', ]
deps = ['depot_tools/depot_tools', 'depot_tools/gsutil', 'flutter/os_utils', 'flutter/zip', 'recipe_engine/buildbucket', 'recipe_engine/file', 'recipe_engine/path', 'recipe_engine/properties', 'recipe_engine/runtime', 'recipe_engine/step', 'recipe_engine/uuid']
class Solution: def minTransfers(self, transactions: List[List[int]]) -> int: balance = [0] * 21 for u, v, amount in transactions: balance[u] -= amount balance[v] += amount debt = [b for b in balance if b] def dfs(s: int) -> int: while s < len(debt) and not debt[s]: s += 1...
class Solution: def min_transfers(self, transactions: List[List[int]]) -> int: balance = [0] * 21 for (u, v, amount) in transactions: balance[u] -= amount balance[v] += amount debt = [b for b in balance if b] def dfs(s: int) -> int: while s < len...
_base_ = [ '../common/mstrain-poly_3x_coco_instance.py', '../_base_/models/mask_rcnn_r50_fpn.py' ] model = dict(pretrained='torchvision://resnet101', backbone=dict(depth=101))
_base_ = ['../common/mstrain-poly_3x_coco_instance.py', '../_base_/models/mask_rcnn_r50_fpn.py'] model = dict(pretrained='torchvision://resnet101', backbone=dict(depth=101))
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def reverseBetween(self, head: ListNode, m: int, n: int) -> ListNode: if not head: return head prevNode, curr ...
class Listnode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def reverse_between(self, head: ListNode, m: int, n: int) -> ListNode: if not head: return head (prev_node, curr) = (None, head) while m > 1: p...
# 103. Binary Tree Zigzag Level Order Traversal # Runtime: 28 ms, faster than 91.36% of Python3 online submissions for Binary Tree Zigzag Level Order Traversal. # Memory Usage: 14.5 MB, less than 42.40% of Python3 online submissions for Binary Tree Zigzag Level Order Traversal. # Definition for a binary tree node. ...
class Solution: def zigzag_level_order(self, root: TreeNode) -> list[list[int]]: if root is None: return [] ans = [] def dfs(node: TreeNode, lvl: int) -> None: if lvl >= len(ans): ans.append([node.val]) elif lvl % 2 == 0: ...
def extractEachKth(inputArray, k): index = [] z = [x for x in range(0,len(inputArray)) if (x+1)%k!=0] [index.append(inputArray[z[y]]) for y in range(len(z))] return(index)
def extract_each_kth(inputArray, k): index = [] z = [x for x in range(0, len(inputArray)) if (x + 1) % k != 0] [index.append(inputArray[z[y]]) for y in range(len(z))] return index
class intCodeVM(): def __init__(self, inp : str): self.__input = inp self.__instructionList = [int(i) for i in open(inp).read().split(",")] self.__programCounter = 0 self.__correspondingInputs = { 1:3, 2:3, 3:1, 4:1, 5:2, ...
class Intcodevm: def __init__(self, inp: str): self.__input = inp self.__instructionList = [int(i) for i in open(inp).read().split(',')] self.__programCounter = 0 self.__correspondingInputs = {1: 3, 2: 3, 3: 1, 4: 1, 5: 2, 6: 2, 7: 3, 8: 3, 99: 0} def add(inp): ...
DATA_DIR = "C:/Users/udiyo/OneDrive - mail.tau.ac.il/Research/data" EXTENSION = "csv.gz" COMPRESSION = "infer" COL_NAMES = { 0: "_id", 1: "raw_time", 2: "temperature", 3: "pressure", 4: "humidity", 5: "light", 6: "magnetic_tot", 7: "magnetic_x", 8: "magnetic_y", 9: "magnetic_z", ...
data_dir = 'C:/Users/udiyo/OneDrive - mail.tau.ac.il/Research/data' extension = 'csv.gz' compression = 'infer' col_names = {0: '_id', 1: 'raw_time', 2: 'temperature', 3: 'pressure', 4: 'humidity', 5: 'light', 6: 'magnetic_tot', 7: 'magnetic_x', 8: 'magnetic_y', 9: 'magnetic_z', 10: 'acc_tot', 11: 'acc_x', 12: 'acc_y', ...
class Settings(): class QQ(): position_a = (10,10) position_c = (1500,10) size = (300,400)
class Settings: class Qq: position_a = (10, 10) position_c = (1500, 10) size = (300, 400)
# CollatzSequence # Objective: When entering in any number, the Collatz Sequence will evaluate down to 1. def collatz(): try: number = int(input("Enter number: ")) while True: if number == 1 or number == 0: break elif number % 2 == 0: numbe...
def collatz(): try: number = int(input('Enter number: ')) while True: if number == 1 or number == 0: break elif number % 2 == 0: number = number // 2 print(number) elif number % 2 == 1: number = 3 * n...
class Solution: def exclusiveTime(self, n: int, logs: List[str]) -> List[int]: ftimes = [0]*n stack = [] pre_start_time = 0 for log in logs: f_id, which, f_time = log.split(":") f_id, f_time = int(f_id), int(f_time) i...
class Solution: def exclusive_time(self, n: int, logs: List[str]) -> List[int]: ftimes = [0] * n stack = [] pre_start_time = 0 for log in logs: (f_id, which, f_time) = log.split(':') (f_id, f_time) = (int(f_id), int(f_time)) if which == 'start': ...
def part1(rows): return go(rows, 1) def part2(rows): return go(rows, 2) def go(rows, part): position = 0 depth = 0 aim = 0 for row in rows: command, arg = row.split() match command, int(arg): case "forward", value: position += value ...
def part1(rows): return go(rows, 1) def part2(rows): return go(rows, 2) def go(rows, part): position = 0 depth = 0 aim = 0 for row in rows: (command, arg) = row.split() match (command, int(arg)): case ['forward', value]: position += value ...
class Solution: # @param A : list of integers # @return an integer def merge(self,A, aux, low, mid, high): k = i = low j=mid+1 inversionCount = 0 while i <= mid and j <= high: if A[i] <= A[j]: aux[k] = A[i] i = i + 1 els...
class Solution: def merge(self, A, aux, low, mid, high): k = i = low j = mid + 1 inversion_count = 0 while i <= mid and j <= high: if A[i] <= A[j]: aux[k] = A[i] i = i + 1 else: aux[k] = A[j] j =...
lista_Itens = ['a', 'b', 'c'] #Lista Criada for itens in lista_Itens: #for para imprimir itens da lista print (itens) lista_Itens.append('d') lista_Itens.extend(['e', 'f', 'g']) for itens in lista_Itens: print (itens) print ("Resultado final: {}, {}, {}, {}, {}, {}, {}.".format(lista_Itens[0], lista_Itens[1], l...
lista__itens = ['a', 'b', 'c'] for itens in lista_Itens: print(itens) lista_Itens.append('d') lista_Itens.extend(['e', 'f', 'g']) for itens in lista_Itens: print(itens) print('Resultado final: {}, {}, {}, {}, {}, {}, {}.'.format(lista_Itens[0], lista_Itens[1], lista_Itens[2], lista_Itens[3], lista_Itens[4], lis...
# generated from genmsg/cmake/pkg-genmsg.context.in messages_str = "/home/abiantorres/Documentos/tfg/autonomous-vehicles-system-simulation/low_level_simulation/src/rosbridge_suite/rosapi/msg/TypeDef.msg" services_str = "/home/abiantorres/Documentos/tfg/autonomous-vehicles-system-simulation/low_level_simulation/src/ros...
messages_str = '/home/abiantorres/Documentos/tfg/autonomous-vehicles-system-simulation/low_level_simulation/src/rosbridge_suite/rosapi/msg/TypeDef.msg' services_str = '/home/abiantorres/Documentos/tfg/autonomous-vehicles-system-simulation/low_level_simulation/src/rosbridge_suite/rosapi/srv/DeleteParam.srv;/home/abianto...
# -*- coding: utf-8 -*- def sample() -> str: return "hoge" def main() -> None: print("Hello Python") if __name__ == "__main__": main()
def sample() -> str: return 'hoge' def main() -> None: print('Hello Python') if __name__ == '__main__': main()
class Context(object): @staticmethod def click(x, y, new_context, ctrl): ctrl.move(x=x, y=y) ctrl.click() return new_context class MainMenu(Context): @classmethod def click_play(cls, ctrl): return cls.click(x=270, y=210, new_context=LevelMenu, ctrl=ctrl) class Lev...
class Context(object): @staticmethod def click(x, y, new_context, ctrl): ctrl.move(x=x, y=y) ctrl.click() return new_context class Mainmenu(Context): @classmethod def click_play(cls, ctrl): return cls.click(x=270, y=210, new_context=LevelMenu, ctrl=ctrl) class Levelme...
class Atoi(): def myatoi(self, s: str) -> int: start = True ret = "" for i in list(s): if i == " ": if not start: break elif i == "+" or i == "-": if start: start = False ret =...
class Atoi: def myatoi(self, s: str) -> int: start = True ret = '' for i in list(s): if i == ' ': if not start: break elif i == '+' or i == '-': if start: start = False ret = ...
LIST_OF_STATES = ["AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "S...
list_of_states = ['AL', 'AK', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DC', 'DE', 'FL', 'GA', 'HI', 'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MD', 'MA', 'MI', 'MN', 'MS', 'MO', 'MT', 'NE', 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR', 'PA', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'W...
# Given the head of a linked list and an integer val, remove all the nodes of the linked list that has Node.val == val, and return the new head. # def removeElements(head,val): # while head and head.val == val: # head = head.next # q = head # p = q.next # while p: # if p.val == val: # ...
class Listnode: def __init__(self, val=0, next=None): self.val = val self.next = next def remove_elements(head, val): starter = list_node() starter.next = head prev = starter curr = head while curr: if curr.val == val: prev.next = curr.next else: ...
def main() -> None: print("Yes" if sorted(input()) < sorted(input(), reverse=1) else "No") if __name__ == "__main__": main()
def main() -> None: print('Yes' if sorted(input()) < sorted(input(), reverse=1) else 'No') if __name__ == '__main__': main()
# What are Functions? # # Functions are a convenient way to divide your code into useful blocks. # That way we can reuse the code. # Python uses indentation to define code blocks, instead of brackets # def myFunction(): # print("Hello From My Function!") # print("Hi") # # myFunction() # def myFunctionWithArgs...
def sum_two_numbers(a, b): return a + b if __name__ == '__main__': result = sum_two_numbers(5, 3) print(result) print(not False) print((not False) == False)
# A collection of functions to create displays of different ABI RGB # products and band subtractions. # abitrucol is derived from McIDAS-X's ABITRUCOL function # which creates an ABI RGB by deriving a green band # McIDAS-X's ABITRUCOL is based on the CIMSS Natural True Color method # http://cimss.ssec.wisc.edu/goes/OC...
def abi_tru_col_rgb(red, grn, blu): red_coef = red * 0.45 grn_coef = grn * 0.1 blu_coef = blu * 0.45 comb_grn = redCoef + grnCoef + bluCoef red_masked = mask(red, '<', 33, 0) * red comb_grn_masked = mask(combGrn, '<', 40, 0) * combGrn blu_masked = mask(blu, '<', 50, 0) * blu red_scaled1 ...
class Category: def __init__(self, categoryId, name): self.categoryId = categoryId self.name = name
class Category: def __init__(self, categoryId, name): self.categoryId = categoryId self.name = name
# demonstrate function scope spam = "global spam" # local scope def do_local(): spam = "local spam" print(spam) do_local() print(spam)
spam = 'global spam' def do_local(): spam = 'local spam' print(spam) do_local() print(spam)
class NCoverage(): # Model under test def __init__(self, threshold = 0.2, exclude_layer=['pool', 'fc', 'flatten'], only_layer = ""): self.cov_dict = {} self.threshold = threshold def scale(self, layer_outputs, rmax=1, rmin=0): ''' scale the intermediate lay...
class Ncoverage: def __init__(self, threshold=0.2, exclude_layer=['pool', 'fc', 'flatten'], only_layer=''): self.cov_dict = {} self.threshold = threshold def scale(self, layer_outputs, rmax=1, rmin=0): """ scale the intermediate layer's output between 0 and 1 :param lay...
class Question: # Defines the init function that is called each time a new object is created def __init__(self, text, correct_answer): # The attribute text is initialized with the value of the parameter text self.text = text # The attribute answer is initialized with the value of the p...
class Question: def __init__(self, text, correct_answer): self.text = text self.answer = correct_answer
''' This is the __init__.py file for the PyCSW common scripts. author :kballantyne date :20190304 version :1.1 python_version :2.7.5 #================================================================================================================ ''' __all__ = ['pycsw_func']
""" This is the __init__.py file for the PyCSW common scripts. author :kballantyne date :20190304 version :1.1 python_version :2.7.5 #================================================================================================================ """ __all__ = ['pycsw_func']
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def sortList(self, head: Optional[ListNode]) -> Optional[ListNode]: if not head or not head.next: return head arr = [] ...
class Solution: def sort_list(self, head: Optional[ListNode]) -> Optional[ListNode]: if not head or not head.next: return head arr = [] while head: arr.append(head.val) head = head.next arr.sort() new = cur = list_node() for ele in...
i = 10 while i >= 0: print(i) i = i - 1
i = 10 while i >= 0: print(i) i = i - 1
# # Copyright (c) 2017, Massachusetts Institute of Technology All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # Redistributions of source code must retain the above copyright notice, this # list o...
mc = __import__('MARTE2_COMPONENT', globals()) @MC.BUILDER('TestGAM', MC.MARTE2_COMPONENT.MODE_GAM) class Marte2_Gam(MC.MARTE2_COMPONENT): inputs = [{'name': 'Input1', 'type': 'int32', 'dimensions': 0, 'parameters': {}}, {'name': 'Input2', 'type': 'int32', 'dimensions': 0, 'parameters': {}}, {'name': 'Input3', 'ty...
# opaflib/parsetab_pdf_brute_end.py # This file is automatically generated. Do not edit. _tabversion = '3.2' _lr_method = 'LALR' _lr_signature = 'v\xc8s\x99\xa0\x80\x10\xa9\xcbe\x07\xb2\x86\xf3\xc42' _lr_action_items = {'DOUBLE_GREATER_THAN_SIGN':([5,7,9,11,12,13,14,15,16,17,19,20,21,22,26,],[-17,9,-15,-10,-6,-...
_tabversion = '3.2' _lr_method = 'LALR' _lr_signature = 'vÈs\x99\xa0\x80\x10©Ëe\x07²\x86óÄ2' _lr_action_items = {'DOUBLE_GREATER_THAN_SIGN': ([5, 7, 9, 11, 12, 13, 14, 15, 16, 17, 19, 20, 21, 22, 26], [-17, 9, -15, -10, -6, -13, -7, -16, -8, -12, -14, -11, -9, -5, -2]), 'XREF': ([0], [1]), 'FALSE': ([9, 10, 11, 12, 13,...
# # PySNMP MIB module XYLAN-CSM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XYLAN-CSM-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:38:25 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, constraints_union, constraints_intersection, value_range_constraint) ...
def create_printer(): my_favourite_number = 123 def printer(): print(f"My Favourite Number is {my_favourite_number}") return printer # Closure # As we can see, the output will be 123. Which means my_printer can still access to my_favourite_number which is outer scope. # this is what Closure is my...
def create_printer(): my_favourite_number = 123 def printer(): print(f'My Favourite Number is {my_favourite_number}') return printer my_printer = create_printer() my_printer()
# # PySNMP MIB module DC-RTM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DC-RTM-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:44:32 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:...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, value_size_constraint, constraints_intersection, single_value_constraint) ...
n = int(input()) ans = 0 cnt = [[0] * 9 for _ in range(9)] for i in range(1, n + 1): one = str(i) if one[-1] == '0': continue cnt[int(one[0]) - 1][int(one[-1]) - 1] += 1 for i in range(9): for j in range(9): ans += cnt[i][j] * cnt[j][i] print(ans)
n = int(input()) ans = 0 cnt = [[0] * 9 for _ in range(9)] for i in range(1, n + 1): one = str(i) if one[-1] == '0': continue cnt[int(one[0]) - 1][int(one[-1]) - 1] += 1 for i in range(9): for j in range(9): ans += cnt[i][j] * cnt[j][i] print(ans)
def overview(bot, c, e, args): if len(args) >= 1: command = None for module in bot.loaded_modules.values(): try: for comm in module['object'].commands(): if comm[0] == args[0]: command = comm except AttributeError: ...
def overview(bot, c, e, args): if len(args) >= 1: command = None for module in bot.loaded_modules.values(): try: for comm in module['object'].commands(): if comm[0] == args[0]: command = comm except AttributeError: ...
PARAMS = { # max length of junction read overlap to consider a target site duplication "tsd=" : 20 }
params = {'tsd=': 20}
# ----------------------------------------------------------------------------- # @brief: Define some signals used during parallel # ----------------------------------------------------------------------------- # it makes the main trpo agent push its weights into the tunnel START_SIGNAL = 1 # it ends the training E...
start_signal = 1 end_signal = -1 end_rollout_signal = -2 agent_collect_filter_info = 23 agent_synchronize_filter = 233 agent_set_policy_weights = 2333 agent_evolution_train = 23333 agent_evolution_start = 233333
def primes(value): for num in range(value): res = True for k in range(2, num): if k != 0: if num % k == 0: res = False if res == True: print(num) primes(100)
def primes(value): for num in range(value): res = True for k in range(2, num): if k != 0: if num % k == 0: res = False if res == True: print(num) primes(100)
# # PySNMP MIB module IBMIROC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IBMIROC-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:51:37 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, 0...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, value_size_constraint, single_value_constraint, value_range_constraint) ...
## Declare file path STYLE_AURORA= 'static/img/aurora.jpg' STYLE_CHINESE = 'static/img/chinese.jpg' STYLE_CHINGMIN = 'static/img/chingmin.jpg' STYLE_COLORFUL = 'static/img/colorful.jpg' STYLE_CRYSTAL = 'static/img/crystal.jpg' STYLE_DES_GLANEUSES = 'static/img/des_glaneuses.jpg' STYLE_FIRE = 'static/img/fire.jpg' STYLE...
style_aurora = 'static/img/aurora.jpg' style_chinese = 'static/img/chinese.jpg' style_chingmin = 'static/img/chingmin.jpg' style_colorful = 'static/img/colorful.jpg' style_crystal = 'static/img/crystal.jpg' style_des_glaneuses = 'static/img/des_glaneuses.jpg' style_fire = 'static/img/fire.jpg' style_jingdo = 'static/im...
def parallel_play_test(par_env): obs = par_env.reset() assert isinstance(obs, dict) assert set(obs.keys()).issubset(set(par_env.agents)) for i in range(1000): actions = {agent:space.sample() for agent, space in par_env.action_spaces.items()} obs, rew, done, info = par_env.step(actions)...
def parallel_play_test(par_env): obs = par_env.reset() assert isinstance(obs, dict) assert set(obs.keys()).issubset(set(par_env.agents)) for i in range(1000): actions = {agent: space.sample() for (agent, space) in par_env.action_spaces.items()} (obs, rew, done, info) = par_env.step(actio...
class BattleshAPIException(Exception): pass class GameNotStartedException(BattleshAPIException): pass class NotYourTurnException(BattleshAPIException): pass class AlreadyRegisteredException(BattleshAPIException): pass class ShipInTheWayException(BattleshAPIException): pass class Insufficie...
class Battleshapiexception(Exception): pass class Gamenotstartedexception(BattleshAPIException): pass class Notyourturnexception(BattleshAPIException): pass class Alreadyregisteredexception(BattleshAPIException): pass class Shipinthewayexception(BattleshAPIException): pass class Insufficientfun...
MALE = "male" FEMALE = "female" OTHER = "other" GENDERS = ((MALE, MALE), (FEMALE, FEMALE), (OTHER, OTHER)) MEMBER = "member" LEADER = "leader" CO_LEADER = "co-leader" TREASURER = "treasurer" RECRUITING = "recruiting" DEVELOPMENT = "development" EDITOR = "editor" RETIREE = "retiree" MEDIA_RELATIONS = "media_relations"...
male = 'male' female = 'female' other = 'other' genders = ((MALE, MALE), (FEMALE, FEMALE), (OTHER, OTHER)) member = 'member' leader = 'leader' co_leader = 'co-leader' treasurer = 'treasurer' recruiting = 'recruiting' development = 'development' editor = 'editor' retiree = 'retiree' media_relations = 'media_relations' a...
_NO_DEFAULT = object() class Record(dict): def __getitem__(self, key): try: return dict.__getitem__(self, key) except TypeError: return Record({k: dict.__getitem__(self, k) for k in key}) def __setitem__(self, key, value): try: dict.__setitem__(self, ...
_no_default = object() class Record(dict): def __getitem__(self, key): try: return dict.__getitem__(self, key) except TypeError: return record({k: dict.__getitem__(self, k) for k in key}) def __setitem__(self, key, value): try: dict.__setitem__(self...
class Calculation: def __init__(self): self.checks = [] self.max_ratio_index = 0 self.show_max_ratio_calc = False def add_item(self, location, name, check_item, check_force, unit): self.checks.append([location, name, check_item["result"], check_force, ...
class Calculation: def __init__(self): self.checks = [] self.max_ratio_index = 0 self.show_max_ratio_calc = False def add_item(self, location, name, check_item, check_force, unit): self.checks.append([location, name, check_item['result'], check_force, check_item['equations'], c...
for i in range(1,10): for j in range(1,i+1): print('{}*{} = {}''\t'.format(i,j,i*j),end = '') print()
for i in range(1, 10): for j in range(1, i + 1): print('{}*{} = {}\t'.format(i, j, i * j), end='') print()
''' Bayesian machine learning models with sklearn api ================================================= IMPLEMENTED ALGORITHMS: ----------------------- ** Linear Models - Type II ML Bayesian Logistic Regression with Laplace Approximation (EBLogisticRegression) - Type II ML Bayesian...
""" Bayesian machine learning models with sklearn api ================================================= IMPLEMENTED ALGORITHMS: ----------------------- ** Linear Models - Type II ML Bayesian Logistic Regression with Laplace Approximation (EBLogisticRegression) - Type II ML Bayesian...
#0.04s user 0.02s system 63% cpu 0.086 total numbers = '731671765313306249192251196744265747423553491949349698352031277450632623957831801698480186947885184385861560789112949495459501737958331952853208805511125406987471585238630507156932909632952274430435576689664895044524452316173185640309871112172238311362229893423380...
numbers = '731671765313306249192251196744265747423553491949349698352031277450632623957831801698480186947885184385861560789112949495459501737958331952853208805511125406987471585238630507156932909632952274430435576689664895044524452316173185640309871112172238311362229893423380308135336276614282806444486645238749303589072...
# from pokemon import Pokemon class Trainer: def __init__(self, name): self.name = name self.pokemon = [] def add_pokemon(self, pokemon): repeats = [owned_pokemon for owned_pokemon in self.pokemon if pokemon.name == owned_pokemon.name] if not repeats: self.pokemon...
class Trainer: def __init__(self, name): self.name = name self.pokemon = [] def add_pokemon(self, pokemon): repeats = [owned_pokemon for owned_pokemon in self.pokemon if pokemon.name == owned_pokemon.name] if not repeats: self.pokemon.append(pokemon) ret...
class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: diffs = {} for i in range(len(nums)): if nums[i] in diffs: return [diffs[nums[i]], i] diffs.update({ target - nums[i]: i })
class Solution: def two_sum(self, nums: List[int], target: int) -> List[int]: diffs = {} for i in range(len(nums)): if nums[i] in diffs: return [diffs[nums[i]], i] diffs.update({target - nums[i]: i})
S = input() d = {} for c in S: d.setdefault(c, 0) d[c] += 1 if all(map(lambda x: x == 1, d.values())): print('YES') else: print('NO')
s = input() d = {} for c in S: d.setdefault(c, 0) d[c] += 1 if all(map(lambda x: x == 1, d.values())): print('YES') else: print('NO')
var = 0 print(var == 0) print(var == 0.) var = 1 print(var == 0) print(var != 1.1)
var = 0 print(var == 0) print(var == 0.0) var = 1 print(var == 0) print(var != 1.1)
nome = input("Insira seu nome: ") nota1 = float(input("Insira sua nota da primeira prova: ")) nota2 = float(input("Insira sua nota da segunda prova: ")) div = (nota1 + nota2) / 2 print(f"a media de {nome} foi {div:.2f} ao final das provas.")
nome = input('Insira seu nome: ') nota1 = float(input('Insira sua nota da primeira prova: ')) nota2 = float(input('Insira sua nota da segunda prova: ')) div = (nota1 + nota2) / 2 print(f'a media de {nome} foi {div:.2f} ao final das provas.')
dictionary = dict( edep = r'$\mathrm{E}_\mathrm{dep}$', edep_unit = 'MeV', evis = r'$\mathrm{E}_\mathrm{vis}$', evis_unit = 'MeV', eres_sigma_rel = r'$\sigma_E/E$', eres_sigma_rel_unit = '%', )
dictionary = dict(edep='$\\mathrm{E}_\\mathrm{dep}$', edep_unit='MeV', evis='$\\mathrm{E}_\\mathrm{vis}$', evis_unit='MeV', eres_sigma_rel='$\\sigma_E/E$', eres_sigma_rel_unit='%')
class GameWorldMixin(): def __init__(self): self.init_game = None self._worlds = None self.gameworld = None def add_world(self, world_name, **kwargs): self._worlds[world_name] = GameWorld(world_name, **kwargs) self.gameworld.init_gameworld([], callback=self.init_game) c...
class Gameworldmixin: def __init__(self): self.init_game = None self._worlds = None self.gameworld = None def add_world(self, world_name, **kwargs): self._worlds[world_name] = game_world(world_name, **kwargs) self.gameworld.init_gameworld([], callback=self.init_game) c...
BOT_NAME = 'transparencia' SPIDER_MODULES = ['transparencia.spiders'] NEWSPIDER_MODULE = 'transparencia.spiders' USER_AGENT = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0' ROBOTSTXT_OBEY = False RETRY_TIMES = 5 RETRY_HTTP_CODES = [500, 502, 503, 504, 522, 524, 403, 404, 408]
bot_name = 'transparencia' spider_modules = ['transparencia.spiders'] newspider_module = 'transparencia.spiders' user_agent = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0' robotstxt_obey = False retry_times = 5 retry_http_codes = [500, 502, 503, 504, 522, 524, 403, 404, 408]
def collect_args(obj): i = 0 items = [] while True: key = '_{n}'.format(n=i) if key not in obj: break items.append(obj[key]) i += 1 return items
def collect_args(obj): i = 0 items = [] while True: key = '_{n}'.format(n=i) if key not in obj: break items.append(obj[key]) i += 1 return items
ALL_LAYERS = ('A', 'B', 'C', 'D', 'E', 'F') def seconds_to_readable_time(seconds): seconds = seconds if seconds > 0 else 0 return f'{int(seconds // 60)}:{seconds % 60:04.1f}'
all_layers = ('A', 'B', 'C', 'D', 'E', 'F') def seconds_to_readable_time(seconds): seconds = seconds if seconds > 0 else 0 return f'{int(seconds // 60)}:{seconds % 60:04.1f}'
# -*- coding: utf-8 -*- # this file is released under public domain and you can use without limitations # ------------------------------------------------------------------------- # This is a sample controller # - index is the default action of any application # - user is required for authentication and authorization ...
def index(): return dict() def products(): form = SQLFORM.grid(db.products) return dict(form=form) def user(): return dict(form=auth()) @cache.action() def download(): return response.download(request, db) def call(): return service()
class Matrix: def __init__(self, matrix): self.matrix = list(matrix) def number_of_row(self): return len(self.matrix) def number_of_column(self): return len(self.matrix[0]) def __add__(self, other): if (self.number_of_row() != other.number_of_row() or self.n...
class Matrix: def __init__(self, matrix): self.matrix = list(matrix) def number_of_row(self): return len(self.matrix) def number_of_column(self): return len(self.matrix[0]) def __add__(self, other): if self.number_of_row() != other.number_of_row() or self.number_of_co...
destination = 0 new_savings = 0 savings = 0 while destination != "End": destination = input() if destination == "End": break min_budget = float(input()) while min_budget >= new_savings: savings = float(input()) new_savings += savings if new_savings >= min_budget: ...
destination = 0 new_savings = 0 savings = 0 while destination != 'End': destination = input() if destination == 'End': break min_budget = float(input()) while min_budget >= new_savings: savings = float(input()) new_savings += savings if new_savings >= min_budget: ...
# coding: utf-8 n, x = [int(i) for i in input().split()] current = 1 ans = 0 for i in range(n): l, r = [int(i) for i in input().split()] ans += (l-current)%x + (r-l+1) current = r+1 print(ans)
(n, x) = [int(i) for i in input().split()] current = 1 ans = 0 for i in range(n): (l, r) = [int(i) for i in input().split()] ans += (l - current) % x + (r - l + 1) current = r + 1 print(ans)
#print("Hello World") print("Hello World") a= 5 b =5 c = [9, 5,3] if a == a: print("Hello") if a == c : print("Hello") if a > b: print('Hello') while True : print ( "Hello" ) break print ( a + b )
print('Hello World') a = 5 b = 5 c = [9, 5, 3] if a == a: print('Hello') if a == c: print('Hello') if a > b: print('Hello') while True: print('Hello') break print(a + b)
#!/usr/bin/python3 def add(a, b): i = a j = b return(i + j)
def add(a, b): i = a j = b return i + j
#DictExample2.py employee = {"Name":"Suprit","Age":22,"Company":"Wipro","Location":"Wipro"} print("---------------------------------------------------") print("Employee Name : ",employee['Name']) print("Employee age : ",employee['Age']) print("Employee Company : ",employee['Company']) print("Company Locatio...
employee = {'Name': 'Suprit', 'Age': 22, 'Company': 'Wipro', 'Location': 'Wipro'} print('---------------------------------------------------') print('Employee Name : ', employee['Name']) print('Employee age : ', employee['Age']) print('Employee Company : ', employee['Company']) print('Company Location : ', employee['Lo...
#Four Fours #Zero print("Zero is ", 44-44) # One print("One is ", 4/4 * 4/4) # Two print("Two is ", (4*4)/(4+4) ) # Three print("Three is ", (4 + 4 + 4)/4) # Four print("Four is ", (4-4)/4 + 4)
print('Zero is ', 44 - 44) print('One is ', 4 / 4 * 4 / 4) print('Two is ', 4 * 4 / (4 + 4)) print('Three is ', (4 + 4 + 4) / 4) print('Four is ', (4 - 4) / 4 + 4)
IMAGES_FOLDER = 'visual_images' ACTUAL_IMAGE_BASE_FOLDER = 'actual' DIFF_IMAGE_BASE_FOLDER = 'diff' BASELINE_IMAGE_BASE_FOLDER = 'baseline' MODE_TEST = 'test' MODE_BASELINE = 'baseline' REPORT_FILE = 'visualReport.html' REPORT_EXPIRATION_THRESHOLD = 10 IMAGE_EXTENSIONS = ['png', 'jpg', 'jpeg', 'bmp', 'raw', 'pdf'] ROBO...
images_folder = 'visual_images' actual_image_base_folder = 'actual' diff_image_base_folder = 'diff' baseline_image_base_folder = 'baseline' mode_test = 'test' mode_baseline = 'baseline' report_file = 'visualReport.html' report_expiration_threshold = 10 image_extensions = ['png', 'jpg', 'jpeg', 'bmp', 'raw', 'pdf'] robo...
print("a(x**2) + b(x) + c = 0") print("Enter the values of a,b,c") a = int(input("Enter the value of a:")) b = int(input("Enter the value of b:")) c = int(input("Enter the value of c:")) d = b**2 - 4*(a*c) x = (-b - (d**0.5))/(2*a) y = (-b + (d**0.5))/(2*a) print("The roots of the equation are :",x,"and", y)
print('a(x**2) + b(x) + c = 0') print('Enter the values of a,b,c') a = int(input('Enter the value of a:')) b = int(input('Enter the value of b:')) c = int(input('Enter the value of c:')) d = b ** 2 - 4 * (a * c) x = (-b - d ** 0.5) / (2 * a) y = (-b + d ** 0.5) / (2 * a) print('The roots of the equation are :', x, 'and...
with open('input.txt') as file: data = [int(line.strip()) for line in file.readlines()] # to speed things up a little bit... data = list(sorted(data)) def part1(): for i in range(len(data)): for j in range(i + 1, len(data)): if data[i] + data[j] == 2020: return data[i] * da...
with open('input.txt') as file: data = [int(line.strip()) for line in file.readlines()] data = list(sorted(data)) def part1(): for i in range(len(data)): for j in range(i + 1, len(data)): if data[i] + data[j] == 2020: return data[i] * data[j] return 0 def part2(): f...
x = 0 if x < 1000 and x % 3 == 0: print(x, "is a multiple of 3!") x += 1 if x < 1000 and x % 3 == 0: print(x, "is a multiple of 3!") x += 1 if x < 1000 and x % 3 == 0: print(x, "is a multiple of 3!") x += 1 if x < 1000 and x % 3 == 0: print(x, "is a multiple of 3!") x += 1
x = 0 if x < 1000 and x % 3 == 0: print(x, 'is a multiple of 3!') x += 1 if x < 1000 and x % 3 == 0: print(x, 'is a multiple of 3!') x += 1 if x < 1000 and x % 3 == 0: print(x, 'is a multiple of 3!') x += 1 if x < 1000 and x % 3 == 0: print(x, 'is a multiple of 3!') x += 1
class PythonPackageTemplate(object): def __unicode__(self): return "just a template" @staticmethod def ping(): return "pong"
class Pythonpackagetemplate(object): def __unicode__(self): return 'just a template' @staticmethod def ping(): return 'pong'
class ageError(Exception):#Creating a new exception class def __init__(self,message): Exception.__init__(self,message) class nameError(Exception): def __init(self,message): Exception.__init__(self,message) class marksError(Exception): def __init__(self,message): Exception.__init__(se...
class Ageerror(Exception): def __init__(self, message): Exception.__init__(self, message) class Nameerror(Exception): def __init(self, message): Exception.__init__(self, message) class Markserror(Exception): def __init__(self, message): Exception.__init__(self, message) try: ...
# https://www.hackerrank.com/challenges/absolute-permutation/problem def absolutePermutation(n, k): arr = list(range(1,n+1)) j = 0 l = -1 while(j<n): l *= -1 for _ in range(max([1,k])): arr[j] += l*k j +=1 if(j==n): break return st...
def absolute_permutation(n, k): arr = list(range(1, n + 1)) j = 0 l = -1 while j < n: l *= -1 for _ in range(max([1, k])): arr[j] += l * k j += 1 if j == n: break return str(arr).replace(',', '')[1:-1] if sorted(arr) == list(range(1...
try: liczba1 = int (input()) except: print("zjebales") try: liczba2 = int (input()) except: print("zjebales") try: print (f"Twoja liczba to: {liczba1+liczba2}") except: print("zjebales")
try: liczba1 = int(input()) except: print('zjebales') try: liczba2 = int(input()) except: print('zjebales') try: print(f'Twoja liczba to: {liczba1 + liczba2}') except: print('zjebales')
class Problem: def __init__(self, inp): self.data = [{}, {}, {}, {}, {}, {}, {}, {}] for line in inp.read().strip().split("\n"): for i, char in enumerate(line): self.data[i][char] = self.data[i].get(char, 0) + 1 def step1(self): return ''.join(map(lambda m: s...
class Problem: def __init__(self, inp): self.data = [{}, {}, {}, {}, {}, {}, {}, {}] for line in inp.read().strip().split('\n'): for (i, char) in enumerate(line): self.data[i][char] = self.data[i].get(char, 0) + 1 def step1(self): return ''.join(map(lambda m...
db.define_table( 'di_order', *bucket_generic_fields ) db.define_table( 'di_order_outbox', Field('parent', 'reference di_order'), *bucket_outbox_generic_fields ) # IMPORTANT - always set not required fields to default = "", or else != operator in queries will return wrong values # #http...
db.define_table('di_order', *bucket_generic_fields) db.define_table('di_order_outbox', field('parent', 'reference di_order'), *bucket_outbox_generic_fields) db.define_table('di_order_note', field('parent', 'reference di_order'), *bucket_note_generic_fields)
# -*- coding: utf-8 -*- i=1 j=60 while j>-1: print("I=%i J=%i"%(i,j)) i+=3 j-=5
i = 1 j = 60 while j > -1: print('I=%i J=%i' % (i, j)) i += 3 j -= 5
''' Xldlib/Onstart ______________ Modules to initializes XL Discoverer. :copyright: (c) 2015 The Regents of the University of California. :license: GNU GPL, see licenses/GNU GPLv3.txt for more details. ''' __all__ = [ 'app', 'args', 'check_imports', 'error', 'launch', 'mai...
""" Xldlib/Onstart ______________ Modules to initializes XL Discoverer. :copyright: (c) 2015 The Regents of the University of California. :license: GNU GPL, see licenses/GNU GPLv3.txt for more details. """ __all__ = ['app', 'args', 'check_imports', 'error', 'launch', 'main', 'process', 'registers'...
s = input() r = input() t = "" for i in range(1, len(s) + 1): t += s[-i] if r == t: print("YES") else: print("NO")
s = input() r = input() t = '' for i in range(1, len(s) + 1): t += s[-i] if r == t: print('YES') else: print('NO')
n = int(input('Enter number of levels: ')) for i in range(1, n + 1): string = "\t" * (n - i) for j in range(i): string += '*\t' print(string)
n = int(input('Enter number of levels: ')) for i in range(1, n + 1): string = '\t' * (n - i) for j in range(i): string += '*\t' print(string)
n = int(input()) my_list = [] is_balanced = True old_line = '' for i in range(n): line = input() if line == '(' and old_line == '(': is_balanced = False my_list.append(line) old_line = line if my_list.count('(') == my_list.count(')') and is_balanced: print('BALANCED') else: print('UNBA...
n = int(input()) my_list = [] is_balanced = True old_line = '' for i in range(n): line = input() if line == '(' and old_line == '(': is_balanced = False my_list.append(line) old_line = line if my_list.count('(') == my_list.count(')') and is_balanced: print('BALANCED') else: print('UNBALA...
# Python program to print prime numbers in an interval def print_primes(lower_limit: int, upper_limit: int) -> None: # iterating the lower interval till it reaches the upper interval for i in range(lower_limit, upper_limit + 1): if lower_limit > 1: interval = 2 # now as 2 is al...
def print_primes(lower_limit: int, upper_limit: int) -> None: for i in range(lower_limit, upper_limit + 1): if lower_limit > 1: interval = 2 for j in range(interval, i + 1): if i % j == 0: break else: print(i) lower = in...
a=0 b=1 input_n = int(input("Enter the number till you want to find fiboncci:")) print(a,b,end=' ') for i in range(2,input_n): # Since two numbers are already printed so now we will start range from 2 c= a+b print(c,end= ' ') a = b b =c print("\n\nFibonacci number of ",input_n," is ",c)
a = 0 b = 1 input_n = int(input('Enter the number till you want to find fiboncci:')) print(a, b, end=' ') for i in range(2, input_n): c = a + b print(c, end=' ') a = b b = c print('\n\nFibonacci number of ', input_n, ' is ', c)
#!/usr/bin/env python3 # GUI def required_option_not_set(option_name): readable_name = option_name.replace('_', ' ').title() return 'Option {0} is required but not set'.format(readable_name) # Scraping SCRAPE_INVALID_PLATFORM = 'You must provide a valid platform (emulated system) to enable scraping' SCRAPE_...
def required_option_not_set(option_name): readable_name = option_name.replace('_', ' ').title() return 'Option {0} is required but not set'.format(readable_name) scrape_invalid_platform = 'You must provide a valid platform (emulated system) to enable scraping' scrape_invalid_module = 'You must provide a valid s...
def read_matrix(): matrix_size = int(input()) matrix = [] for _ in range(matrix_size): matrix.append(input().split()) return matrix matrix = read_matrix() symbol = input() is_found = False for col in range(len(matrix)): if symbol in matrix[col][0]: index, column = matrix[col][0...
def read_matrix(): matrix_size = int(input()) matrix = [] for _ in range(matrix_size): matrix.append(input().split()) return matrix matrix = read_matrix() symbol = input() is_found = False for col in range(len(matrix)): if symbol in matrix[col][0]: (index, column) = (matrix[col][0].i...
class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: d={} for i,n in enumerate(nums): d_n=target-n if d_n in d: return [d[d_n],i] d[n]=i return [None,None]
class Solution: def two_sum(self, nums: List[int], target: int) -> List[int]: d = {} for (i, n) in enumerate(nums): d_n = target - n if d_n in d: return [d[d_n], i] d[n] = i return [None, None]
#!/usr/bin/env python3 def search_insert(nums, target: int) -> int: start = 0 end = len(nums) - 1 mid = 0 while start <= end: mid = (start + end) // 2 curr = nums[mid] if curr == target: return mid if target < curr: end = mid - 1 else: ...
def search_insert(nums, target: int) -> int: start = 0 end = len(nums) - 1 mid = 0 while start <= end: mid = (start + end) // 2 curr = nums[mid] if curr == target: return mid if target < curr: end = mid - 1 else: start = mid + 1...
class ProcessorProperty: def __init__(self, label, default_value, min_value=None, max_value=None): self.label = label self.value = default_value self.default_value = default_value self._type = type(default_value) self.min_value = min_value self.max_value = max_value ...
class Processorproperty: def __init__(self, label, default_value, min_value=None, max_value=None): self.label = label self.value = default_value self.default_value = default_value self._type = type(default_value) self.min_value = min_value self.max_value = max_value ...
## Tower of Hanoi # Given the number of disks and the three towers labels, the program will displays the moves required to solve. def TowerOfHanoi(numDisks, source, intermediate, destination): if(numDisks == 1): print("Move Disk 1 From Pole {} to Pole {}".format(source, destination)) # if there is onl...
def tower_of_hanoi(numDisks, source, intermediate, destination): if numDisks == 1: print('Move Disk 1 From Pole {} to Pole {}'.format(source, destination)) return tower_of_hanoi(numDisks - 1, source, destination, intermediate) print('Move Disk {} From Pole {} to Pole {}'.format(numDisks, sou...