content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
COUNT = 100 class Stack: def __init__(self, value): self.value = value; self.next = None def test(): top = None for i in range(0, COUNT): curr = Stack(f'Hello #{i}') curr.next = top top = curr print(stackSize(top)) def stackSize(stack): size = 0 if s...
count = 100 class Stack: def __init__(self, value): self.value = value self.next = None def test(): top = None for i in range(0, COUNT): curr = stack(f'Hello #{i}') curr.next = top top = curr print(stack_size(top)) def stack_size(stack): size = 0 if st...
class Solution(object): def checkRecord(self, s): """ :type s: str :rtype: bool """ return s.count('A') <=1 and 'LLL' not in s """ You are given a string representing an attendance record for a student. The record only contains the following three c...
class Solution(object): def check_record(self, s): """ :type s: str :rtype: bool """ return s.count('A') <= 1 and 'LLL' not in s '\n You are given a string representing an attendance record for a student. The record only contains the following\n three chara...
''' Author: Maciej Kaczkowski 26.03-13.04.2021 ''' # configuration file with constans, etc. # using "reversi convention" - black has first move, # hence BLACK is Max player, while WHITE is Min player WHITE = -1 BLACK = 1 EMPTY = 0 # player's codenames RANDOM = 'random' ALGO = 'minmax' # min-max parameters MAX_DEPT...
""" Author: Maciej Kaczkowski 26.03-13.04.2021 """ white = -1 black = 1 empty = 0 random = 'random' algo = 'minmax' max_depth = 4 northeast = (-1, 1) north = (-1, 0) northwest = (-1, -1) west = (0, -1) southwest = (1, -1) south = (1, 0) southeast = (1, 1) east = (0, 1)
def replace_string_in_file(filepath, searched, replaced): with open(filepath) as f: file_source = f.read() # replace all occurences replace_string = file_source.replace(searched, replaced) with open(filepath, "w") as f: f.write(replace_string)
def replace_string_in_file(filepath, searched, replaced): with open(filepath) as f: file_source = f.read() replace_string = file_source.replace(searched, replaced) with open(filepath, 'w') as f: f.write(replace_string)
class Fail(Exception): pass class InvalidArgument(Fail): pass
class Fail(Exception): pass class Invalidargument(Fail): pass
# -*- coding: utf-8 -*- def main(): n = int(input()) a = list(map(int, input().split())) inf = 1 << 30 ans = inf for bit in range(1 << n - 1): candidate = 0 inner = 0 for j in range(n): inner |= a[j] if (bit >> j) & 1: candidate ^=...
def main(): n = int(input()) a = list(map(int, input().split())) inf = 1 << 30 ans = inf for bit in range(1 << n - 1): candidate = 0 inner = 0 for j in range(n): inner |= a[j] if bit >> j & 1: candidate ^= inner inner = ...
# Addition and subtraction print(5 + 5) print(5 - 5) # Multiplication and division print(3 * 5) print(10 / 2) # Exponentiation print(4 ** 2) # Modulo print(18 % 7)
print(5 + 5) print(5 - 5) print(3 * 5) print(10 / 2) print(4 ** 2) print(18 % 7)
""" File: basic_permutations.py Name: Sharon ----------------------------- This program finds all the 3-digits binary permutations by calling a recursive function binary_permutations. Students will find a helper function useful in advanced recursion problems. """ def main(): binary_permutations(5) def binary_permu...
""" File: basic_permutations.py Name: Sharon ----------------------------- This program finds all the 3-digits binary permutations by calling a recursive function binary_permutations. Students will find a helper function useful in advanced recursion problems. """ def main(): binary_permutations(5) def binary_perm...
#!/usr/bin/env python # -*- coding: utf-8 -*- '''A simple module to store the user's style preferences.''' INDENT_PREFERENCE = {'indent': ' '} def get_indent_preference(): '''str: How the user prefers their indentation. Default: " ".''' return INDENT_PREFERENCE['indent'] def register_indent_prefere...
"""A simple module to store the user's style preferences.""" indent_preference = {'indent': ' '} def get_indent_preference(): """str: How the user prefers their indentation. Default: " ".""" return INDENT_PREFERENCE['indent'] def register_indent_preference(text): """Set indentation that will be used...
''' StaticRoute Genie Ops Object Outputs for IOSXE. ''' class StaticRouteOutput(object): # 'show ipv4 static route' output showIpv4StaticRoute = { 'vrf': { 'VRF1': { 'address_family': { 'ipv4': { 'routes': { ...
""" StaticRoute Genie Ops Object Outputs for IOSXE. """ class Staticrouteoutput(object): show_ipv4_static_route = {'vrf': {'VRF1': {'address_family': {'ipv4': {'routes': {'2.2.2.2/32': {'route': '2.2.2.2/32', 'next_hop': {'next_hop_list': {1: {'index': 1, 'active': True, 'next_hop': '10.1.2.2', 'outgoing_interfac...
''' Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". Example 1: Input: ["flower","flow","flight"] Output: "fl" Example 2: Input: ["dog","racecar","car"] Output: "" Explanation: There is no common prefix among the input st...
""" Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". Example 1: Input: ["flower","flow","flight"] Output: "fl" Example 2: Input: ["dog","racecar","car"] Output: "" Explanation: There is no common prefix among the input st...
#=============================================================================== """ Optional features config. """ #=============================================================================== # Enter mail below to receive real-time email alerts # e.g., 'email@gmail.com' MAIL = '' # Enter the ip camera url (e....
""" Optional features config. """ mail = '' url = '' alert = False threshold = 10 thread = False log = False scheduler = False timer = False
datos= [0,0,0,0,0,0,0,0,0,0,0,0,0 ,1,1,1,1,1,1,1,1,1,1 ,2,2,2,2,2,2,2 ,3,3,3,3,3,3 ,4,4] def media(datos): return sum(datos)/len(datos) def mediana(datos): if(len(datos)%2 == 0): return (datos[int(len(datos)/2)] + datos[int((len(datos)+1)/2)]) / 2 else: retu...
datos = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4] def media(datos): return sum(datos) / len(datos) def mediana(datos): if len(datos) % 2 == 0: return (datos[int(len(datos) / 2)] + datos[int((len(datos) + 1) / 2)]) / 2 else: ...
while True: b=input().split() X,M=b X=int(X) M=int(M) if(X==0 and M==0): break else: E=X*M print(E)
while True: b = input().split() (x, m) = b x = int(X) m = int(M) if X == 0 and M == 0: break else: e = X * M print(E)
first = ['Bucky', 'Tom', 'Taylor'] last = ['Roberts', 'Hanks', 'Swift'] names = zip(first, last) for a, b in names: print(a, b)
first = ['Bucky', 'Tom', 'Taylor'] last = ['Roberts', 'Hanks', 'Swift'] names = zip(first, last) for (a, b) in names: print(a, b)
'''To find Symmetric Difference between two Sets.''' #Example INPUT: ''' 4 2 4 5 9 4 2 4 11 12 ''' #OUTPUT: (Symmetric difference in ascending order) ''' 5 9 11 12 ''' #Code n=int(input()) a=[int(i) for i in input().split()] m=int(input()) b=[int(i) for i in input().split()] a1=set(a) b1=set(b) t=...
"""To find Symmetric Difference between two Sets.""" '\n4\n2 4 5 9\n4\n2 4 11 12\n' '\n5\n9\n11\n12\n' n = int(input()) a = [int(i) for i in input().split()] m = int(input()) b = [int(i) for i in input().split()] a1 = set(a) b1 = set(b) t = a1.union(b1) f = t - a1.intersection(b1) tt = list(f) tt.sort() for i in tt: ...
class EditorFactory(object): __registeredEditors = [] def __init__(self): super(EditorFactory, self).__init__() @classmethod def registerEditorClass(cls, widgetClass): cls.__registeredEditors.append(widgetClass) @classmethod def constructEditor(cls, valueController, parent=...
class Editorfactory(object): __registered_editors = [] def __init__(self): super(EditorFactory, self).__init__() @classmethod def register_editor_class(cls, widgetClass): cls.__registeredEditors.append(widgetClass) @classmethod def construct_editor(cls, valueController, parent...
def rev(j): rev = 0 while (j > 0): remainder = j % 10 rev = (rev * 10) + remainder j = j // 10 return rev def emirp(j): if j <= 1: return False else: for i in range(2, rev(j)): if j % i == 0 or rev(j) % i == 0: print(j, "Is not e...
def rev(j): rev = 0 while j > 0: remainder = j % 10 rev = rev * 10 + remainder j = j // 10 return rev def emirp(j): if j <= 1: return False else: for i in range(2, rev(j)): if j % i == 0 or rev(j) % i == 0: print(j, 'Is not emirp n...
""" LeetCode Problem: 766. Toeplitz Matrix Link: https://leetcode.com/problems/toeplitz-matrix/ Language: Python Written by: Mostofa Adib Shakib """ # Optimal Solution # Time Complexity: O(M*N) # Space Complexity: O(1) class Solution: def isToeplitzMatrix(self, matrix: List[List[int]]) -> bool: rows = le...
""" LeetCode Problem: 766. Toeplitz Matrix Link: https://leetcode.com/problems/toeplitz-matrix/ Language: Python Written by: Mostofa Adib Shakib """ class Solution: def is_toeplitz_matrix(self, matrix: List[List[int]]) -> bool: rows = len(matrix) columns = len(matrix[0]) for r in range(row...
x = 0 y = 0 def setup(): size(400, 400) def draw(): global x, y background(255) ellipse(x, y, 30, 30) x += (mouseX - x) / 10 y += (mouseY - y) / 10
x = 0 y = 0 def setup(): size(400, 400) def draw(): global x, y background(255) ellipse(x, y, 30, 30) x += (mouseX - x) / 10 y += (mouseY - y) / 10
class SignupsException(Exception): """Base class for PvP Signups exceptions.""" class CancelBooking(SignupsException): """User requested or timeout based booking cancellation.""" class BadConfig(SignupsException): """Value in config.json invalid.""" class ChannelNotFound(SignupsException): """Chan...
class Signupsexception(Exception): """Base class for PvP Signups exceptions.""" class Cancelbooking(SignupsException): """User requested or timeout based booking cancellation.""" class Badconfig(SignupsException): """Value in config.json invalid.""" class Channelnotfound(SignupsException): """Channel...
def parse_from_file(filename, parser): with open(filename,"r") as f: string=f.read() args=parser.parse_args(string.split()) return args
def parse_from_file(filename, parser): with open(filename, 'r') as f: string = f.read() args = parser.parse_args(string.split()) return args
#Problem Set 02 print('Problem Set 02') # Problem 01 (20 points) print('\nProblem 1') cases = [70, 75, 126, 144, 170] cases_latest = None #TODO Replace # Problem 02 (20 points) print('\nProblem 2') tests = None #TODO Replace tests_last_three = None #TODO Replace tests_reverse = None #TODO Replace # Problem 03 ...
print('Problem Set 02') print('\nProblem 1') cases = [70, 75, 126, 144, 170] cases_latest = None print('\nProblem 2') tests = None tests_last_three = None tests_reverse = None print('\nProblem 3') vaccines = ' 39,896-41,826-44,154-46,458-48,634-50,090 ' vaccines_list = None print('\nProblem 4') dates = ['January 31st...
"""Top-level package for CY Widgets.""" try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: __path__ = __import__('pkgutil').extend_path(__path__, __name__) __author__ = """CY Gatro""" __email__ = 'cragodn@gmail.com' __version__ = '0.4.35'
"""Top-level package for CY Widgets.""" try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: __path__ = __import__('pkgutil').extend_path(__path__, __name__) __author__ = 'CY Gatro' __email__ = 'cragodn@gmail.com' __version__ = '0.4.35'
class Mesh: def __init__(self): self.vertexs = [] def setName(self, name): self.name = name def addVertex(self, x, y, z): self.vertexs.append([x, y, z]) def read(self): print(self.name) print(self.vertexs) def getVertexs(self): return self.vertexs ...
class Mesh: def __init__(self): self.vertexs = [] def set_name(self, name): self.name = name def add_vertex(self, x, y, z): self.vertexs.append([x, y, z]) def read(self): print(self.name) print(self.vertexs) def get_vertexs(self): return self.vert...
#!/usr/bin/env python3 class RunfileFormatError(Exception): pass class RunfileNotFoundError(Exception): def __init__(self, path): self.path = path class TargetNotFoundError(Exception): def __init__(self, target=None): self.target = target class TargetExecutionError(Exception): de...
class Runfileformaterror(Exception): pass class Runfilenotfounderror(Exception): def __init__(self, path): self.path = path class Targetnotfounderror(Exception): def __init__(self, target=None): self.target = target class Targetexecutionerror(Exception): def __init__(self, exit_cod...
count= 0 fname= input("Enter the file name:") if fname== "na na boo boo": print("NA NA BOO BOO TO YOU- You have been punk'd") exit() else: try: fhand= open(fname) except: print("File cannot be opened", fname) exit() for line in fhand: if line.startswith("Subj...
count = 0 fname = input('Enter the file name:') if fname == 'na na boo boo': print("NA NA BOO BOO TO YOU- You have been punk'd") exit() else: try: fhand = open(fname) except: print('File cannot be opened', fname) exit() for line in fhand: if line.startswith('Subject'): ...
input_data = input() symbols = {} def count_symbols(data): for symbol in data: if symbol not in symbols: symbols[symbol] = 0 symbols[symbol] += 1 return dict(sorted(symbols.items(), key=lambda s: s[0])) def print_data(symbols): for symbol, count in symbols.items(): pri...
input_data = input() symbols = {} def count_symbols(data): for symbol in data: if symbol not in symbols: symbols[symbol] = 0 symbols[symbol] += 1 return dict(sorted(symbols.items(), key=lambda s: s[0])) def print_data(symbols): for (symbol, count) in symbols.items(): pr...
def userinfo(claims, user): claims["name"] = user.username claims["preferred_username"] = user.username return claims
def userinfo(claims, user): claims['name'] = user.username claims['preferred_username'] = user.username return claims
#%% 6-misol lst=list(input().split()) lst=[int(i) for i in lst] print(lst) k=0 son=list() for i in range(len(lst)-1): if lst[i]>lst[i+1]: if son!=[]: son.append(lst[i]) print(*son) son=list() k+=1 #%% 7-misol son=int(input("son=")) list1=list() while son!=0: ...
lst = list(input().split()) lst = [int(i) for i in lst] print(lst) k = 0 son = list() for i in range(len(lst) - 1): if lst[i] > lst[i + 1]: if son != []: son.append(lst[i]) print(*son) son = list() k += 1 son = int(input('son=')) list1 = list() while son != 0:...
class Utils(object): ''' keep values between -180 and 180 degrees input and output parameters are in degrees ''' def normalize_angle(self, degrees: float) -> float: degrees = degrees % 360 if degrees > 180: return degrees - 360 return degrees
class Utils(object): """ keep values between -180 and 180 degrees input and output parameters are in degrees """ def normalize_angle(self, degrees: float) -> float: degrees = degrees % 360 if degrees > 180: return degrees - 360 return degrees
# The following is an implementation of the hex helper # from Electrum - lightweight Bitcoin client, which is # subject to the following license. # # Copyright (C) 2011 thomasv@gitorious # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation fil...
class Hexxer: bfh = bytes.fromhex @classmethod def bh2u(self, x: bytes) -> str: return x.hex() @classmethod def rev_hex(self, s: str) -> str: return self.bh2u(self.bfh(s)[::-1]) @classmethod def int_to_hex(self, i: int, length: int=1) -> str: if not isinstance(i, i...
num = input("Please enter a num: ") while not num.isdigit(): num = input("Please enter a num: ") print("Your num: %s" % num)
num = input('Please enter a num: ') while not num.isdigit(): num = input('Please enter a num: ') print('Your num: %s' % num)
class ModulationException(Exception): pass class EncodingException(ModulationException): pass class DecodingException(ModulationException): pass
class Modulationexception(Exception): pass class Encodingexception(ModulationException): pass class Decodingexception(ModulationException): pass
class RedisMock(): def __init__(self): self.incoming_queue = [] self.in_progress_queue = [] def brpoplpush(self, *args): if self.incoming_queue: item = self.incoming_queue.pop(0) self.in_progress_queue.append(item) return item else: ...
class Redismock: def __init__(self): self.incoming_queue = [] self.in_progress_queue = [] def brpoplpush(self, *args): if self.incoming_queue: item = self.incoming_queue.pop(0) self.in_progress_queue.append(item) return item else: ...
def solve(matrix, target): possible_results = [] for r, row in enumerate(matrix): start = 0 end = len(row) - 1 while start <= end: mid = (start + end) // 2 if row[mid] == target: possible_results.append((r + 1) * 1009 + mid + 1) ...
def solve(matrix, target): possible_results = [] for (r, row) in enumerate(matrix): start = 0 end = len(row) - 1 while start <= end: mid = (start + end) // 2 if row[mid] == target: possible_results.append((r + 1) * 1009 + mid + 1) b...
P1_CHAR = "1" P2_CHAR = "2" class ChessPiece(object): """ This class is used entirely for inheretence for other chess piece classes. """ def __init__(self, row, col, player): assert 0 <= row < 8 assert 0 <= col < 8 assert player in (P1_CHAR, P2_CHAR), "player: {} error".format(...
p1_char = '1' p2_char = '2' class Chesspiece(object): """ This class is used entirely for inheretence for other chess piece classes. """ def __init__(self, row, col, player): assert 0 <= row < 8 assert 0 <= col < 8 assert player in (P1_CHAR, P2_CHAR), 'player: {} error'.format(...
class Solution: def pivotIndex(self, nums: List[int]) -> int: for i in range(0, len(nums)): if sum(nums[:i]) == sum(nums[i+1:]): return i return -1
class Solution: def pivot_index(self, nums: List[int]) -> int: for i in range(0, len(nums)): if sum(nums[:i]) == sum(nums[i + 1:]): return i return -1
class Solution: def longestOnes(self, A: List[int], K: int) -> int: maxLen = zero = start = 0 for i, a in enumerate(A): if a == 0: zero += 1 while zero > K: if A[start] == 0: zero -= 1 start += 1 ...
class Solution: def longest_ones(self, A: List[int], K: int) -> int: max_len = zero = start = 0 for (i, a) in enumerate(A): if a == 0: zero += 1 while zero > K: if A[start] == 0: zero -= 1 start += 1 ...
"""simtk pydra tasks and workflows.""" # __all__ = [ # 'load_image_task' # ] # import numpy as np # from pydra import mark # import itk # from simtk import load_image # load_image_annotated = mark.annotate({'filename': str, 'nphases': int, # 'norientations': int, 'spacing': np.ndarray, 'return': itk.VectorImage })(...
"""simtk pydra tasks and workflows."""
# Fill all this out with your information patreon_client_id = None patreon_client_secret = None patreon_creator_refresh_token = None patreon_creator_access_token = None patreon_creator_id = None patreon_redirect_uri = None
patreon_client_id = None patreon_client_secret = None patreon_creator_refresh_token = None patreon_creator_access_token = None patreon_creator_id = None patreon_redirect_uri = None
# Initialize Global Variables VERSION = '1.4' TITLE = 'RO:X Next Generation - Auto Fishing version' PID = '' SCREEN_WIDTH = 0 SCREEN_HEIGHT = 0 IS_ACTIVE = False HOLD = True FRAME = None PREV_TIME = 0 CURRENT_TIME = 0 LIMIT = 0 LOOP = 0 IS_FISHING = True LAST_CLICK_TIME = 0 COUNT = 0 BOUNDING_BOX = {'top': 0, 'left...
version = '1.4' title = 'RO:X Next Generation - Auto Fishing version' pid = '' screen_width = 0 screen_height = 0 is_active = False hold = True frame = None prev_time = 0 current_time = 0 limit = 0 loop = 0 is_fishing = True last_click_time = 0 count = 0 bounding_box = {'top': 0, 'left': 0, 'width': 240, 'height': 250}...
class Node: next_node = None data = 0 def __init__(self, value): self.data = value def run(input_data): if input_data is None or input_data.next_node is None: return False input_data.data = input_data.next_node.data input_data.next_node = input_data.next_node.next_node retu...
class Node: next_node = None data = 0 def __init__(self, value): self.data = value def run(input_data): if input_data is None or input_data.next_node is None: return False input_data.data = input_data.next_node.data input_data.next_node = input_data.next_node.next_node retu...
# File to automate the conversion of the glosary to txt file text_file = open("glossory.txt", "r") glossory = text_file.readlines() word = [] deffinition = [] for i in range(len(glossory)): if (i % 2) == 0: word.append(glossory[i]) else: deffinition.append(glossory[i]) word[:] = [line.rstrip(...
text_file = open('glossory.txt', 'r') glossory = text_file.readlines() word = [] deffinition = [] for i in range(len(glossory)): if i % 2 == 0: word.append(glossory[i]) else: deffinition.append(glossory[i]) word[:] = [line.rstrip('\n') for line in word] deffinition[:] = [line.rstrip('\n') for li...
class CronExecutor(object): def __init__(self): # cron cache key is {<Date String YYY-mm-dd>: {<timestamp>: [<string command 1>...]} self._cache = {}
class Cronexecutor(object): def __init__(self): self._cache = {}
# connect-4 # Define the board's Width and Height as constant WIDTH = 7 HEIGHT = 6 def init_board(): b = [] for x in range(0, WIDTH): b.append([]) for y in range(0, HEIGHT): b[x].append(0) return b def player1_move(board, x, y): board[x][y] = 1 def player2_move(board, ...
width = 7 height = 6 def init_board(): b = [] for x in range(0, WIDTH): b.append([]) for y in range(0, HEIGHT): b[x].append(0) return b def player1_move(board, x, y): board[x][y] = 1 def player2_move(board, x, y): board[x][y] = 2 def print_board(board): for y in r...
class _BaseStateError(BaseException): '''Base class for state-related exceptions. Accepts only one param which must be a list of strings.''' def __init__(self, message=None): message = message or [] if not isinstance(message, list): raise TypeError('{} takes a list of errors not ...
class _Basestateerror(BaseException): """Base class for state-related exceptions. Accepts only one param which must be a list of strings.""" def __init__(self, message=None): message = message or [] if not isinstance(message, list): raise type_error('{} takes a list of errors no...
P1_TWO_SUMS = """ Example 1: Input: nums = [2,7,11,15], target = 9 Output: [0,1] Output: Because nums[0] + nums[1] == 9, we return [0, 1]. Example 2: Input: nums = [3,2,4], target = 6 Output: [1,2] Example 3: Input: nums = [3,3], target = 6 Output: [0,1] """ P10_REGEXP_MATCHING = """ The matching should cover the...
p1_two_sums = '\nExample 1:\n\nInput: nums = [2,7,11,15], target = 9\nOutput: [0,1]\nOutput: Because nums[0] + nums[1] == 9, we return [0, 1].\nExample 2:\n\nInput: nums = [3,2,4], target = 6\nOutput: [1,2]\nExample 3:\n\nInput: nums = [3,3], target = 6\nOutput: [0,1]\n \n' p10_regexp_matching = '\nThe matching should ...
# # PySNMP MIB module EATON-EPDU-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EATON-EPDU-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:44:24 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, value_size_constraint, constraints_intersection, value_range_constraint) ...
# -*- coding: utf-8 -*- # URI Judge - Problema 1013 a, b, c = map(int, input().split()) if a > (b and c): print(str(a) + " eh o maior") elif b > c: print(str(b) + " eh o maior") else: print(str(c) + " eh o maior")
(a, b, c) = map(int, input().split()) if a > (b and c): print(str(a) + ' eh o maior') elif b > c: print(str(b) + ' eh o maior') else: print(str(c) + ' eh o maior')
#reg add HKEY_CURRENT_USER\Console /v VirtualTerminalLevel /t REG_DWORD /d 0x00000001 /f colors = {\ 'OKBLUE' : '\033[94m', 'OKGREEN' : '\033[92m', 'WARNING' : '\033[93m', 'RED' : '\033[1;31;40m', } def colorText(text): for color in colors: text = text.replace("[[" + color + "]...
colors = {'OKBLUE': '\x1b[94m', 'OKGREEN': '\x1b[92m', 'WARNING': '\x1b[93m', 'RED': '\x1b[1;31;40m'} def color_text(text): for color in colors: text = text.replace('[[' + color + ']]', colors[color]) return text hola = '\n\n\n[[OKGREEN]] \n_ _ ____ _ _ ____ \n/ )( ( _ \\/ )( ( _ \\ /\\ /) /\\ /...
#function to check whether a number is in a given range. def test_range(n): if n in range(3,9): print( " %s is in the range"%str(n)) else : print("The number is outside the given range.") test_range(5)
def test_range(n): if n in range(3, 9): print(' %s is in the range' % str(n)) else: print('The number is outside the given range.') test_range(5)
ans = 0 for _ in range(5): a, b, c = sorted([int(x) for x in input().split()]) if a + b > c: ans += 1 print(ans)
ans = 0 for _ in range(5): (a, b, c) = sorted([int(x) for x in input().split()]) if a + b > c: ans += 1 print(ans)
def move_cars(current, final): if len(current) <= 1: return 0 if len(current) == 2 and current[0] == final[0]: return 0 moves = 0 for i, car in enumerate(current): if car == final[i]: if car == '_': # need to move car to this spot first ...
def move_cars(current, final): if len(current) <= 1: return 0 if len(current) == 2 and current[0] == final[0]: return 0 moves = 0 for (i, car) in enumerate(current): if car == final[i]: if car == '_': moves += 1 else: moves += 1 ...
def get_letter_frequency(word): chars_dict = {} for letter in word: if letter in chars_dict: chars_dict[letter] += 1 else: chars_dict[letter] = 1 return chars_dict def number_of_deletions(a, b): count = 0 chars_of_a = get_letter_frequency(a) chars_of_b = ...
def get_letter_frequency(word): chars_dict = {} for letter in word: if letter in chars_dict: chars_dict[letter] += 1 else: chars_dict[letter] = 1 return chars_dict def number_of_deletions(a, b): count = 0 chars_of_a = get_letter_frequency(a) chars_of_b = ...
""" mcpython - a minecraft clone written in python licenced under the MIT-licence (https://github.com/mcpython4-coding/core) Contributors: uuk, xkcdjerry (inactive) Based on the game of fogleman (https://github.com/fogleman/Minecraft), licenced under the MIT-licence Original game "minecraft" by Mojang Studios (www.m...
""" mcpython - a minecraft clone written in python licenced under the MIT-licence (https://github.com/mcpython4-coding/core) Contributors: uuk, xkcdjerry (inactive) Based on the game of fogleman (https://github.com/fogleman/Minecraft), licenced under the MIT-licence Original game "minecraft" by Mojang Studios (www.m...
def repeat(chars: str, count: int) -> str: """Return a string of repeated characters. :param chars: The characters to repeat. :param count: The number of times to repeat. :return: The string of repeated characters. """ return chars * count def truncate(source, max_len: int, el: str = "...", a...
def repeat(chars: str, count: int) -> str: """Return a string of repeated characters. :param chars: The characters to repeat. :param count: The number of times to repeat. :return: The string of repeated characters. """ return chars * count def truncate(source, max_len: int, el: str='...', alig...
# -*- coding: utf-8 -*- # Created at 03/10/2020 __author__ = 'raniys' class HomeData: home_url = "https://www.python.org/" search_text = "pycon"
__author__ = 'raniys' class Homedata: home_url = 'https://www.python.org/' search_text = 'pycon'
def get_db_uri(dbinfo): username = dbinfo.get('user') or "root" password = dbinfo.get('pwd') or "123456" host = dbinfo.get('host') or "localhost" port = dbinfo.get('port') or "3306" database = dbinfo.get('dbname') or "pythonixf" driver = dbinfo.get('driver') or "pymysql" dialect = dbinfo.get...
def get_db_uri(dbinfo): username = dbinfo.get('user') or 'root' password = dbinfo.get('pwd') or '123456' host = dbinfo.get('host') or 'localhost' port = dbinfo.get('port') or '3306' database = dbinfo.get('dbname') or 'pythonixf' driver = dbinfo.get('driver') or 'pymysql' dialect = dbinfo.get...
expected_output = { "vrf": { "L3VPN-1538": { "index": {1: {"address_type": "Interface", "ip_address": "192.168.10.254"}} } } }
expected_output = {'vrf': {'L3VPN-1538': {'index': {1: {'address_type': 'Interface', 'ip_address': '192.168.10.254'}}}}}
fib = {1: 1, 2: 1, 3: 2, 4: 3} print(fib.get(4, 0) + fib.get(7, 5)) ## get(4,0) is 3 because as you can see, 4:3, in the key 4, you can 3. ## Since there is not key 7, this will just equivalent to 5. ## 3 + 5 = 8 ## output is 8
fib = {1: 1, 2: 1, 3: 2, 4: 3} print(fib.get(4, 0) + fib.get(7, 5))
contPares = 0 print('Numeros pares: ',end='') for i in range(1,51): if i % 2 == 0: print(i, end=' ')
cont_pares = 0 print('Numeros pares: ', end='') for i in range(1, 51): if i % 2 == 0: print(i, end=' ')
# encoding: utf-8 # module SingleNameSpace.Some.Deep calls itself Deep # from SingleNameSpace, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null # by generatorXXX # no doc # no imports # no functions # classes class WeHaveClass(object): """ WeHaveClass() """ MyClass = None
class Wehaveclass(object): """ WeHaveClass() """ my_class = None
__author__ = 'Meemaw' def isPalindrome(x, i): zacetek = 0 konec = len(x)-1 while zacetek <= konec: if x[zacetek] != x[konec]: return 0 zacetek+=1 konec-=1 return 1 vsota = 0 print("Please insert upper bound:") x = int(input()) for i in range(1,x+1): if isPalind...
__author__ = 'Meemaw' def is_palindrome(x, i): zacetek = 0 konec = len(x) - 1 while zacetek <= konec: if x[zacetek] != x[konec]: return 0 zacetek += 1 konec -= 1 return 1 vsota = 0 print('Please insert upper bound:') x = int(input()) for i in range(1, x + 1): if ...
class NestedIterator: def __init__(self, nestedList): self.l = [] self.i = 0 def search(l): for e in l: if e.isInteger(): self.l.append(e.getInteger()) else: search(e.getList()) search(nestedList) ...
class Nestediterator: def __init__(self, nestedList): self.l = [] self.i = 0 def search(l): for e in l: if e.isInteger(): self.l.append(e.getInteger()) else: search(e.getList()) search(nestedList) ...
def _copy_libs_impl(ctx): # Get a list of the input files in_files = ctx.files.libs # Declare the output files out_files = [ctx.actions.declare_file(f.basename) for f in in_files] ctx.actions.run_shell( # Input files visible to the action. inputs = in_files, # Output files...
def _copy_libs_impl(ctx): in_files = ctx.files.libs out_files = [ctx.actions.declare_file(f.basename) for f in in_files] ctx.actions.run_shell(inputs=in_files, outputs=out_files, progress_message='Copying libs for target %s' % ctx.attr.name, command='cp -a %s %s' % (' '.join([f.path for f in in_files]), out...
#https://www.hackerrank.com/challenges/quicksort1 def partition(a, first, last): pivot = a[first] wall = last+1 for j in range(last, first,-1): if a[j] > pivot: wall -= 1 if j!=wall: a[j],a[wall] = a[wall], a[j] #saves time. in case lik [3,2,4,1] do its partition and s...
def partition(a, first, last): pivot = a[first] wall = last + 1 for j in range(last, first, -1): if a[j] > pivot: wall -= 1 if j != wall: (a[j], a[wall]) = (a[wall], a[j]) (a[wall - 1], a[first]) = (a[first], a[wall - 1]) return a n = int(input()) a = ...
# -*- coding: utf-8 -*- """ Advent of Code 2021 @author marc """ with open("input-day06", 'r') as f: # with open("input-day06-test", 'r') as f: lines = f.readlines() fish = lines[0][:-1].split(',') fish = [(int(i),1) for i in fish] def run(fish, nrEpochs): for i in range(nrEpochs): spawncoun...
""" Advent of Code 2021 @author marc """ with open('input-day06', 'r') as f: lines = f.readlines() fish = lines[0][:-1].split(',') fish = [(int(i), 1) for i in fish] def run(fish, nrEpochs): for i in range(nrEpochs): spawncount = sum((f[1] for f in fish if f[0] == 0)) fish = [(f[0] - ...
prompt = input('Enter the file name: ') try: prompt = open(prompt) except: print('File cannot be opened:', prompt) exit() total = 0 count = 0 # reading through the file for line in prompt: if line.startswith("X-DSPAM-Confidence:"): # removes lines after and before a sentence line = line....
prompt = input('Enter the file name: ') try: prompt = open(prompt) except: print('File cannot be opened:', prompt) exit() total = 0 count = 0 for line in prompt: if line.startswith('X-DSPAM-Confidence:'): line = line.strip() pos = line.index(':') f_num = float(line[pos + 1:]) ...
""" A simple bencoding implementation in pure Python. Consult help(encode) and help(decode) for more info. >>> encode(42) == b'i42e' True >>> decode(b'i42e') 42 """ class Bencached(): __slots__ = ['bencoded'] def __init__(self, s): self.bencoded = s def encode_bencached(x, r): r.append(x.benco...
""" A simple bencoding implementation in pure Python. Consult help(encode) and help(decode) for more info. >>> encode(42) == b'i42e' True >>> decode(b'i42e') 42 """ class Bencached: __slots__ = ['bencoded'] def __init__(self, s): self.bencoded = s def encode_bencached(x, r): r.append(x.bencoded) ...
SOLUTIONS = { "LC": [ [0, 0, 1, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], ], "WASTE": [ [0, 0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0],...
solutions = {'LC': [[0, 0, 1, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]], 'WASTE': [[0, 0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0], [...
number = [1,3,6,2,7,5,8,9,0] result = filter(lambda x:x>5,number) print("Number List",number) print("Number Smaller than 5 in the list are:",list(result))
number = [1, 3, 6, 2, 7, 5, 8, 9, 0] result = filter(lambda x: x > 5, number) print('Number List', number) print('Number Smaller than 5 in the list are:', list(result))
# # PySNMP MIB module NETGEAR-REF-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NETGEAR-REF-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:19:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, constraints_union, constraints_intersection, value_size_constraint) ...
""" Low-level methods for handling a MiCADO master with Occopus """ class OccopusLauncher: """For launching a MiCADO Master with Occopus """
""" Low-level methods for handling a MiCADO master with Occopus """ class Occopuslauncher: """For launching a MiCADO Master with Occopus """
my_host = 'localhost' my_port = 10000 is_emulation = False emulator_host = '0.0.0.0' emulator_port = 4390 apis_web_host = '0.0.0.0' apis_web_budo_emulator_port = 43830 apis_web_api_server_port = 9999 #apis_log_group_address = 'FF02:0:0:0:0:0:0:1' apis_log_group_address = '224.2.2.4' apis_log_port = 8888 units = [...
my_host = 'localhost' my_port = 10000 is_emulation = False emulator_host = '0.0.0.0' emulator_port = 4390 apis_web_host = '0.0.0.0' apis_web_budo_emulator_port = 43830 apis_web_api_server_port = 9999 apis_log_group_address = '224.2.2.4' apis_log_port = 8888 units = [{'id': 'E001', 'name': 'E001', 'host': '0.0.0.0', 'dc...
def primes(): i, f = 2, 1 while True: if (f + 1) % i == 0: yield i f, i = f * i, i + 1
def primes(): (i, f) = (2, 1) while True: if (f + 1) % i == 0: yield i (f, i) = (f * i, i + 1)
mypass = input() if ("1234" or "qwerty" in mypass) or (len(mypass) < 8): print("Bad password") elif ("1" or "2" or "3" or "4" or "5" or "6" or "7" or "8" or "9" or "0") not in mypass: print("Bad password") else: print("Good password")
mypass = input() if ('1234' or 'qwerty' in mypass) or len(mypass) < 8: print('Bad password') elif ('1' or '2' or '3' or '4' or '5' or '6' or '7' or '8' or '9' or '0') not in mypass: print('Bad password') else: print('Good password')
n, m = map(int, input().split()) matches = [] for i in range(m): matches.append(list(map(int, input().split()))) matches.sort(key=lambda container: container[1], reverse=True) count = 0 i = 0 j = 0 while i <= n and j < m: if matches[j][0] < n - i: i += matches[j][0] count += matches[j][0] * mat...
(n, m) = map(int, input().split()) matches = [] for i in range(m): matches.append(list(map(int, input().split()))) matches.sort(key=lambda container: container[1], reverse=True) count = 0 i = 0 j = 0 while i <= n and j < m: if matches[j][0] < n - i: i += matches[j][0] count += matches[j][0] * ma...
# 'guinea pig' is appended to the animals list animals.append('guinea pig') # Updated animals list print('Updated animals list: ', animals)
animals.append('guinea pig') print('Updated animals list: ', animals)
# Copyright (c) 2022 Jakub Vesely # This software is published under MIT license. Full text of the license is available at https://opensource.org/licenses/MIT class RemoteKeyboardBase: """ this class is a base class for remote keyboards/controls (IR or the BLE one) example of usage can be found in examples/___...
class Remotekeyboardbase: """ this class is a base class for remote keyboards/controls (IR or the BLE one) example of usage can be found in examples/___remote_control """ def __init__(self, address_bit_tolerance=2) -> None: """ The variable "address_bit_tolerance" is a workaround for quite co...
maze = ' ******* * **** * **** * *** *# *** *** *** *********' g = '' s = '' for i in range(0, len(maze)): g += maze[i] if (i+1)%8==0: g += s + '\n' s = '' print(g)
maze = ' ******* * **** * **** * *** *# *** *** *** *********' g = '' s = '' for i in range(0, len(maze)): g += maze[i] if (i + 1) % 8 == 0: g += s + '\n' s = '' print(g)
class Error(Exception): pass class FieldLookupError(Error): pass class BadValueError(Error): pass class DocumentClassRequiredError(Error): pass class FieldError(Error): pass
class Error(Exception): pass class Fieldlookuperror(Error): pass class Badvalueerror(Error): pass class Documentclassrequirederror(Error): pass class Fielderror(Error): pass
# pylint: disable=missing-docstring,too-few-public-methods class AbstractFoo: def kwonly_1(self, first, *, second, third): "Normal positional with two positional only params." def kwonly_2(self, *, first, second): "Two positional only parameter." def kwonly_3(self, *, first, second): ...
class Abstractfoo: def kwonly_1(self, first, *, second, third): """Normal positional with two positional only params.""" def kwonly_2(self, *, first, second): """Two positional only parameter.""" def kwonly_3(self, *, first, second): """Two positional only params.""" def kwon...
#paste your api_hash and api_id from my.telegram.org api_hash = "exxxxxxxxxx" api_id = xxxx entity = "tgcloud"
api_hash = 'exxxxxxxxxx' api_id = xxxx entity = 'tgcloud'
# Server Specific Configurations server = { 'port': '8558', 'host': '0.0.0.0' } # Pecan Application Configurations app = { 'root': 'vouch.controllers.root.RootController', 'modules': ['vouch'], 'debug': False, # this 'guess' also strips off the extension from the resource path. 'guess_cont...
server = {'port': '8558', 'host': '0.0.0.0'} app = {'root': 'vouch.controllers.root.RootController', 'modules': ['vouch'], 'debug': False, 'guess_content_type_from_ext': False} logging = {'loggers': {'vouch': {'level': 'DEBUG', 'handlers': ['console']}, 'keystonemiddleware': {'level': 'DEBUG', 'handlers': ['console']},...
def shakehand(): rest() i01.startedGesture() ##move arm and hand i01.setHandSpeed("left", 0.65, 0.65, 0.65, 0.65, 0.65, 1.0) i01.setHandSpeed("right", 0.65, 0.65, 0.65, 0.65, 0.65, 1.0) i01.setArmSpeed("right", 0.75, 0.85, 0.95, 0.85) i01.setArmSpeed("left", 0.75, 0.85, 0.95, 0.85) i01.setHeadSpeed(1.0,...
def shakehand(): rest() i01.startedGesture() i01.setHandSpeed('left', 0.65, 0.65, 0.65, 0.65, 0.65, 1.0) i01.setHandSpeed('right', 0.65, 0.65, 0.65, 0.65, 0.65, 1.0) i01.setArmSpeed('right', 0.75, 0.85, 0.95, 0.85) i01.setArmSpeed('left', 0.75, 0.85, 0.95, 0.85) i01.setHeadSpeed(1.0, 1.0) ...
# Copyright (c) 2013 Huan Do, http://huan.do class FrameContextManager(object): def __init__(self, frame, visitor): self.frame = frame self.visitor = visitor def __enter__(self): self.visitor.current_frame = self.frame return self.frame def __exit__(self, *_): sel...
class Framecontextmanager(object): def __init__(self, frame, visitor): self.frame = frame self.visitor = visitor def __enter__(self): self.visitor.current_frame = self.frame return self.frame def __exit__(self, *_): self.visitor.withdraw_frame()
# wczytanie napisow with open('../dane/NAPIS.TXT') as f: data = [] for word in f.readlines(): data.append(word[:-1]) # zbior slow rosnacych growing = [] # przejscie po slowach for word in data: # przejscie po literach i sprawdzenie czy aktualna wartosc ASCII litery jest wieksza niz poprzednej ...
with open('../dane/NAPIS.TXT') as f: data = [] for word in f.readlines(): data.append(word[:-1]) growing = [] for word in data: isgrowing = True prevnum = 0 for char in word: if prevnum >= ord(char): isgrowing = False break prevnum = ord(char) if i...
sum = lambda a, b : a + b print(sum(3,4)) def sum1(a, b): return a + b print(sum1(4, 5)) myList = [lambda a, b : a + b, lambda a, b : a * b] print(myList) print(myList[0]) print(myList[0](3, 4)) print(myList[1](3, 4))
sum = lambda a, b: a + b print(sum(3, 4)) def sum1(a, b): return a + b print(sum1(4, 5)) my_list = [lambda a, b: a + b, lambda a, b: a * b] print(myList) print(myList[0]) print(myList[0](3, 4)) print(myList[1](3, 4))
# pylint: disable=missing-docstring def baz(): # [disallowed-name] pass
def baz(): pass
# c:\Users\i341972\Desktop\git_repos\enaml\enaml\core\parse_tab\parsetab.py # This file is automatically generated. Do not edit. _tabversion = '3.2' _lr_method = 'LALR' _lr_signature = '\x7f\xdd\xc1Pb\x9c\xa9\xeb\xac\xc9\xad\xb5=\x06\x80j' _lr_action_items = {'LPAR':([0,1,6,7,9,13,14,16,18,24,28,29,30,31,33,35,...
_tabversion = '3.2' _lr_method = 'LALR' _lr_signature = '\x7fÝÁPb\x9c©ë¬É\xadµ=\x06\x80j' _lr_action_items = {'LPAR': ([0, 1, 6, 7, 9, 13, 14, 16, 18, 24, 28, 29, 30, 31, 33, 35, 39, 42, 43, 44, 47, 49, 52, 54, 55, 57, 61, 63, 64, 65, 67, 72, 73, 74, 82, 83, 85, 86, 89, 90, 95, 96, 97, 102, 103, 104, 106, 109, 112, 116...
repeat = int(input()) for x in range(repeat): div1, div2, uplim = map(int, input().split()) divisor = div1 * div2 for i in range(divisor, uplim + 1, divisor): print(i) if x != repeat - 1: print()
repeat = int(input()) for x in range(repeat): (div1, div2, uplim) = map(int, input().split()) divisor = div1 * div2 for i in range(divisor, uplim + 1, divisor): print(i) if x != repeat - 1: print()
""" Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the nodes in each of the two partitions. Example 1: Input: list = null, x = 0 Output: null Explanation: The empty list Satisfy the cond...
""" Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the nodes in each of the two partitions. Example 1: Input: list = null, x = 0 Output: null Explanation: The empty list Satisfy the cond...
DFLT_TOURN_PART_NAME = 'Unknown' GANG_LEADER = 'Gang Leader' GROUP_NAMES = {'Thug 1': 'Thugs', 'Robber 1': 'Robbers'} SURNAME_PARTS = [ 'bai', 'cai', 'cao', 'chang', 'chen', 'cheng', 'cui', 'dai', 'deng', 'ding', 'dong', 'du', 'duan', 'fan', 'fang', 'fen...
dflt_tourn_part_name = 'Unknown' gang_leader = 'Gang Leader' group_names = {'Thug 1': 'Thugs', 'Robber 1': 'Robbers'} surname_parts = ['bai', 'cai', 'cao', 'chang', 'chen', 'cheng', 'cui', 'dai', 'deng', 'ding', 'dong', 'du', 'duan', 'fan', 'fang', 'feng', 'fu', 'gao', 'gong', 'gu', 'guo', 'han', 'hao', 'he', 'hou', 'h...
''' Created on 07.11.2019 @author: JM ''' class TMC4361_register_variant: " ===== TMC4361 register variants ===== " "..."
""" Created on 07.11.2019 @author: JM """ class Tmc4361_Register_Variant: """ ===== TMC4361 register variants ===== """ '...'
load( "//:repositories.bzl", "com_github_scalapb_scalapb", "io_bazel_rules_scala", "io_grpc_grpc_java", "scalapb_runtime", "scalapb_runtime_grpc", "scalapb_lenses", "rules_proto_grpc_repos", ) def scala_repos(**kwargs): rules_proto_grpc_repos(**kwargs) io_grpc_grpc_java(**kwargs...
load('//:repositories.bzl', 'com_github_scalapb_scalapb', 'io_bazel_rules_scala', 'io_grpc_grpc_java', 'scalapb_runtime', 'scalapb_runtime_grpc', 'scalapb_lenses', 'rules_proto_grpc_repos') def scala_repos(**kwargs): rules_proto_grpc_repos(**kwargs) io_grpc_grpc_java(**kwargs) com_github_scalapb_scalapb(**...
def scope_demo(): # definition of variable is local to do_local(), and so doesn't survive # when method goes out of scope. (This draws a weak warning that the local # variable is not used.) def do_local(): spam = "local spam" # definition of variable is specifically not local to do_nonlo...
def scope_demo(): def do_local(): spam = 'local spam' def do_nonlocal(): nonlocal spam spam = 'nonlocal spam' def do_global(): global spam spam = 'global spam' spam = 'test spam' do_local() print('After local assignment:', spam) do_nonlocal() pr...
# WAP to demonstrate simple exception handling in Python def ExceptionHandling(): try: a += 10 except NameError as e: print(e) def main(): ExceptionHandling() if __name__ == "__main__": main()
def exception_handling(): try: a += 10 except NameError as e: print(e) def main(): exception_handling() if __name__ == '__main__': main()
SECRET_KEY = 'gk2ptgp9mB' SALT = 'SALT' PERM_FILE = 'perms.json' UPLOAD_FOLDER = 'uploads' DB_FILE = 'db.db'
secret_key = 'gk2ptgp9mB' salt = 'SALT' perm_file = 'perms.json' upload_folder = 'uploads' db_file = 'db.db'
TURTLEBOT_RADIUS = 0.176 # loaded config default_config = { 'PLANE_URDF': ".\\data\\py_data\\plane.urdf", 'BLOCK_URDF': ".\\data\\py_data\\boston_box.urdf", 'BLOCK_DYN_URDF': ".\\data\\py_data\\boston_box_fl.urdf", 'TURTLEBOT_URDF': ".\\data\\py_data\\turtlebot.urdf", ...
turtlebot_radius = 0.176 default_config = {'PLANE_URDF': '.\\data\\py_data\\plane.urdf', 'BLOCK_URDF': '.\\data\\py_data\\boston_box.urdf', 'BLOCK_DYN_URDF': '.\\data\\py_data\\boston_box_fl.urdf', 'TURTLEBOT_URDF': '.\\data\\py_data\\turtlebot.urdf', 'SPHERO_URDF': '.\\data\\py_data\\sphero.urdf', 'PORT_GUI_2_ALL': 17...