content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class BaseError(Exception): pass class AddQueryInvalid(Exception): def __init__(self, exception, message="Parameter Add condition is invalid"): self.message = message self.exception = exception super().__init__(self.message) def __str__(self): return f'{self.message}: {sel...
class Baseerror(Exception): pass class Addqueryinvalid(Exception): def __init__(self, exception, message='Parameter Add condition is invalid'): self.message = message self.exception = exception super().__init__(self.message) def __str__(self): return f'{self.message}: {sel...
""" Django Extras ~~~~~~~~~~~~~ Extensions for Django to solve common development situations not (or not yet) covered by the core Django framework. """ __version__ = '0.3'
""" Django Extras ~~~~~~~~~~~~~ Extensions for Django to solve common development situations not (or not yet) covered by the core Django framework. """ __version__ = '0.3'
lang1 = {'Hindi','Urdu'} lang2= {'Punjabi'} print("Original Set: ", lang2) lang2 = lang1.copy() print("Copied Set: ", lang2)
lang1 = {'Hindi', 'Urdu'} lang2 = {'Punjabi'} print('Original Set: ', lang2) lang2 = lang1.copy() print('Copied Set: ', lang2)
def datacfg(): datacfg = dict() datacfg['abalone'] = dict() datacfg['abalone']['filepath'] = '.\\data\\abalone.pkl' datacfg['abalone']['targets'] = ['rings'] datacfg['abalone']['probtype'] = ['regression', 'classification'] datacfg['autoMpg'] = dict() datacfg['autoMpg']['filepath'] = '.\\dat...
def datacfg(): datacfg = dict() datacfg['abalone'] = dict() datacfg['abalone']['filepath'] = '.\\data\\abalone.pkl' datacfg['abalone']['targets'] = ['rings'] datacfg['abalone']['probtype'] = ['regression', 'classification'] datacfg['autoMpg'] = dict() datacfg['autoMpg']['filepath'] = '.\\dat...
# Define echo def echo(n): """Return the inner_echo function.""" # Define inner_echo def inner_echo(word1): """Concatenate n copies of word1.""" echo_word = word1 * n return echo_word # Return inner_echo return inner_echo # Call echo: twice twice = echo(2) # Call echo: th...
def echo(n): """Return the inner_echo function.""" def inner_echo(word1): """Concatenate n copies of word1.""" echo_word = word1 * n return echo_word return inner_echo twice = echo(2) thrice = echo(3) print(twice('hello'), thrice('hello'))
def my_function(function): function() print(my_function(lambda : 99))
def my_function(function): function() print(my_function(lambda : 99))
class Tokenizer: def tokenize(self, text): # remove comments but keep empty lines instead # to preserve line numbers lines = text.splitlines() lines = [('' if line.strip().startswith(';') else line) for line in lines] t = '\n'.join(lines) # expand symbols for easier...
class Tokenizer: def tokenize(self, text): lines = text.splitlines() lines = ['' if line.strip().startswith(';') else line for line in lines] t = '\n'.join(lines) t = t.replace('(', ' ( ') t = t.replace(')', ' ) ') tokens = t.split() return tokens
#!/usr/bin/env python3 bicycles = ["trek", "cannondale", "redline", "specialized"] print("{}\n".format(bicycles)) print("{} Object type: {}".format("bicycles", type(bicycles))) print(bicycles[0]) for bike in bicycles: print(bike.title())
bicycles = ['trek', 'cannondale', 'redline', 'specialized'] print('{}\n'.format(bicycles)) print('{} Object type: {}'.format('bicycles', type(bicycles))) print(bicycles[0]) for bike in bicycles: print(bike.title())
def merge(a: list, b: list) -> list: i = 0 j = 0 c = [0 for _ in range(len(a) + len(b))] while i < len(a) or j < len(b): if j == len(b) or i < len(a) and a[i] < b[j]: c[i + j] = a[i] i += 1 else: c[i + j] = b[j] j += 1 return c ...
def merge(a: list, b: list) -> list: i = 0 j = 0 c = [0 for _ in range(len(a) + len(b))] while i < len(a) or j < len(b): if j == len(b) or (i < len(a) and a[i] < b[j]): c[i + j] = a[i] i += 1 else: c[i + j] = b[j] j += 1 return c def s...
class CORSMiddleware: def process_response(self, request, response): response['Access-Control-Allow-Origin'] = "*" return response
class Corsmiddleware: def process_response(self, request, response): response['Access-Control-Allow-Origin'] = '*' return response
# Copyright 2019, Kay Hayen, mailto:kay.hayen@gmail.com # # Python test originally created or extracted from other peoples work. The # parts from me are licensed as below. It is at least Free Software where # it's copied from other people. In these cases, that will normally be # indicated. # # L...
loops = 50000 class Record: def __init__(self, PtrComp=None, Discr=0, EnumComp=0, IntComp=0, StringComp=0): self.PtrComp = PtrComp self.Discr = Discr self.EnumComp = EnumComp self.IntComp = IntComp self.StringComp = StringComp def copy(self): return record(self...
# Write a Python program to # input a string and change its # case to Sentence case using capitalize() # function. It will convert only the first # (beginning)lower case letter to upper case. # it will capitalize only first letter # of a Sentence. # The user will enter String # during program execution # Start of the ...
str1 = input('Enter a string to convert into Sentence case:') sentence_string = str1.capitalize() print(str1, 'In sentence case =', sentence_string)
# SPDX-License-Identifier: BSD-2-Clause QEMU_SPECIAL_KEYS = { " " : "spc", "!" : "shift-1", '"' : "shift-apostrophe", "#" : "shift-3", "$" : "shift-4", "%" : "shift-5", "&" : "shift-7", "'" : "apostrophe", "(" : "shift-9", ")" : "shift-0", "*" : "shift-8", "+" : "shift-e...
qemu_special_keys = {' ': 'spc', '!': 'shift-1', '"': 'shift-apostrophe', '#': 'shift-3', '$': 'shift-4', '%': 'shift-5', '&': 'shift-7', "'": 'apostrophe', '(': 'shift-9', ')': 'shift-0', '*': 'shift-8', '+': 'shift-equal', ',': 'comma', '-': 'minus', '.': 'dot', '/': 'slash', ':': 'shift-semicolon', ';': 'semicolon',...
class XSDSimpleTypeFontSize(XSDSimpleType): """The font-size can be one of the CSS font sizes (xx-small, x-small, small, medium, large, x-large, xx-large) or a numeric point size. .. todo:: Better documentation. """ _UNION = [XSDSimpleTypeCssFontSize, XSDSimpleTypeDecimal] XSD_TREE = XSDTree...
class Xsdsimpletypefontsize(XSDSimpleType): """The font-size can be one of the CSS font sizes (xx-small, x-small, small, medium, large, x-large, xx-large) or a numeric point size. .. todo:: Better documentation. """ _union = [XSDSimpleTypeCssFontSize, XSDSimpleTypeDecimal] xsd_tree = xsd_tre...
# You are given two arrays (no duplicates): arr1 and arr2 where arr1 is a subset of arr2. # For each item x in arr1 find the first proceeding number, y, in arr2 such that y > x and # is to the right hand side of x in arr2. If such number does not exist, return -1. # # Ex. # arr1 = [4, 1, 2] # arr2 = [1, 3, 4, 2] # outp...
def next_greater_element(targetArr, numArr): dict = {} stack = [] for num in numArr: while stack and stack[len(stack) - 1] < num: dict.update({stack.pop(): num}) stack.append(num) for i in range(len(targetArr)): targetArr[i] = dict.get(targetArr[i], -1) return tar...
def solve(floor, room): pass if __name__ == '__main__': num_tc = int(input()) for _ in range(num_tc): k = int(input()) n = int(input()) print(solve(k, n))
def solve(floor, room): pass if __name__ == '__main__': num_tc = int(input()) for _ in range(num_tc): k = int(input()) n = int(input()) print(solve(k, n))
def getData(self, device): """ Returns a list of tuples like {controller, device, data} with data elements """ cam = self.Devices[device["id"]]['objOfCapture'] _, frame = cam.read() if frame is None: return [] height = np.size(frame, 0) width = np.size(frame, 1) deviceName = Misc....
def get_data(self, device): """ Returns a list of tuples like {controller, device, data} with data elements """ cam = self.Devices[device['id']]['objOfCapture'] (_, frame) = cam.read() if frame is None: return [] height = np.size(frame, 0) width = np.size(frame, 1) device_name = Misc...
class Solution: def getSkyline(self, buildings: List[List[int]]) -> List[List[int]]: n = len(buildings) if n == 0: return [] if n == 1: xLeft,xRight,y = buildings[0] return [[xLeft,y],[xRight,0]] leftSky = self.getSkyline(buildings[: n//2]...
class Solution: def get_skyline(self, buildings: List[List[int]]) -> List[List[int]]: n = len(buildings) if n == 0: return [] if n == 1: (x_left, x_right, y) = buildings[0] return [[xLeft, y], [xRight, 0]] left_sky = self.getSkyline(buildings[:n /...
for i in range(1, 100 + 1): text = '' if i % 3 == 0: text += 'Fizz' if i % 5 == 0: text += 'Buzz' if text == '': print(i) else: print(text)
for i in range(1, 100 + 1): text = '' if i % 3 == 0: text += 'Fizz' if i % 5 == 0: text += 'Buzz' if text == '': print(i) else: print(text)
def is_palindrome(n): if str(n) == str(n)[::-1]: return True return False # Examples: is_palindrome(101) # True is_palindrome(147) # False
def is_palindrome(n): if str(n) == str(n)[::-1]: return True return False is_palindrome(101) is_palindrome(147)
def rest_error_response(Status,Message,Format = 'XML',TwilioCode = None,TwilioMessage = None): response = { "Status" : Status, "Message" : Message } if TwilioCode is not None: response['Code'] = TwilioCode if TwilioMessage is not None: response['MoreInfo'] = TwilioMessage if Format == '' or Format == 'XML' o...
def rest_error_response(Status, Message, Format='XML', TwilioCode=None, TwilioMessage=None): response = {'Status': Status, 'Message': Message} if TwilioCode is not None: response['Code'] = TwilioCode if TwilioMessage is not None: response['MoreInfo'] = TwilioMessage if Format == '' or Fo...
# -*- coding: utf-8 -*- # Copyright 2019 Cohesity Inc. class ObjectClassEnum(object): """Implementation of the 'ObjectClass' enum. Specifies the object class of the principal (either 'kGroup' or 'kUser'). 'kUser' specifies a user object class. 'kGroup' specifies a group object class. 'kComputer' ...
class Objectclassenum(object): """Implementation of the 'ObjectClass' enum. Specifies the object class of the principal (either 'kGroup' or 'kUser'). 'kUser' specifies a user object class. 'kGroup' specifies a group object class. 'kComputer' specifies a computer object class. Attributes: ...
# Copyright 2020 AUI, Inc. Washington DC, USA # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
def shadow(vis_dataset, shadow_parms, storage_parms): """ .. todo:: This function is not yet implemented Flag all baselines for antennas that are shadowed beyond the specified tolerance. All antennas in the zarr-file metadata (and their corresponding diameters) will be considered f...
""" Simple BMW ConnectedDrive API. init file for backward compatibility """ # empty
""" Simple BMW ConnectedDrive API. init file for backward compatibility """
# -*- coding:utf-8 -*- class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def deleteNode(self, listNode, toDeleteNode): if listNode == None or toDeleteNode == None: return listNode if listNode == toDeleteNode: return list...
class Listnode: def __init__(self, x): self.val = x self.next = None class Solution: def delete_node(self, listNode, toDeleteNode): if listNode == None or toDeleteNode == None: return listNode if listNode == toDeleteNode: return listNode.next if...
def build_filter(args): return Filter(args) class Filter: def __init__(self, args): if args == '': message = b'<empty commit message>' else: message = args.encode('utf8') self.message = message def commit_message_filter(self,commit_data): # Only writ...
def build_filter(args): return filter(args) class Filter: def __init__(self, args): if args == '': message = b'<empty commit message>' else: message = args.encode('utf8') self.message = message def commit_message_filter(self, commit_data): if commit...
# Calculates the total cost of a restaurant bill # including the meal cost, tip amount, and sales tax # Declare variables tipRate = 0.18 # 18% salesTaxRate = 0.07 # 7% # Prompt user for cost of meal mealCost = float(input('\nEnter total cost of meal: $')) # Calculate and display total tip, # total sales...
tip_rate = 0.18 sales_tax_rate = 0.07 meal_cost = float(input('\nEnter total cost of meal: $')) tip_cost = mealCost * tipRate sales_tax_cost = mealCost * salesTaxRate total_bill = mealCost + tipCost + salesTaxCost print('\nWith 18% tip: $', format(tipCost, ',.2f'), sep='') print('With 7% sales tax: $',...
#!/usr/bin/env python __author__ = "yangyanzhan" __email__ = "yangyanzhan@gmail.com" __url__ = "https://github.com/yangyanzhan/code-camp" __blog__ = "https://yanzhan.site" __youtube__ = "https://www.youtube.com/channel/UCDkz-__gl3frqLexukpG0DA?view_as=subscriber" __twitter__ = "https://twitter.com/YangYanzhan" mappin...
__author__ = 'yangyanzhan' __email__ = 'yangyanzhan@gmail.com' __url__ = 'https://github.com/yangyanzhan/code-camp' __blog__ = 'https://yanzhan.site' __youtube__ = 'https://www.youtube.com/channel/UCDkz-__gl3frqLexukpG0DA?view_as=subscriber' __twitter__ = 'https://twitter.com/YangYanzhan' mapping = {} class Solution: ...
# Copyright (c) 2016 Ericsson AB. # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
rpc_api_version = '1.0' topic_dc_manager = 'dcmanager' patch_vault_dir = '/opt/patch-vault' system_controller_name = 'SystemController' default_region_name = 'RegionOne' management_unmanaged = 'unmanaged' management_managed = 'managed' availability_offline = 'offline' availability_online = 'online' sync_status_unknown ...
#!/usr/bin/python3 """Student to JSON""" class Student: """representation of a student""" def __init__(self, first_name, last_name, age): """instantiation of the student""" self.first_name = first_name self.last_name = last_name self.age = age def to_json(self): ""...
"""Student to JSON""" class Student: """representation of a student""" def __init__(self, first_name, last_name, age): """instantiation of the student""" self.first_name = first_name self.last_name = last_name self.age = age def to_json(self): """retrieves a dictio...
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- def get_package_data(): # pragma: no cover return { str(_PACKAGE_NAME_ + '.tags.core.tests'): ['data/*.yaml']}
def get_package_data(): return {str(_PACKAGE_NAME_ + '.tags.core.tests'): ['data/*.yaml']}
t = ( 10, 11, 12, 34, 99, 4, 98) print (t[0]) t1 = (1, 1, 1, 2, 3, 4, 65, 65, 3, 2) #tuple with single element print (t1.count(1)) print (t1.index(65))
t = (10, 11, 12, 34, 99, 4, 98) print(t[0]) t1 = (1, 1, 1, 2, 3, 4, 65, 65, 3, 2) print(t1.count(1)) print(t1.index(65))
connChoices=( {'name':'automatic', 'rate':{'min':0, 'max':5000, 'def': 0}, 'conn':{'min':0, 'max':100, 'def': 0}, 'automatic':1}, {'name':'unlimited', 'rate':{'min':0, 'max':5000, 'def': 0, 'div': 50}, 'conn':{'min':4, 'max':100, 'def': 4}}, {'name':'dialup/isdn', 'r...
conn_choices = ({'name': 'automatic', 'rate': {'min': 0, 'max': 5000, 'def': 0}, 'conn': {'min': 0, 'max': 100, 'def': 0}, 'automatic': 1}, {'name': 'unlimited', 'rate': {'min': 0, 'max': 5000, 'def': 0, 'div': 50}, 'conn': {'min': 4, 'max': 100, 'def': 4}}, {'name': 'dialup/isdn', 'rate': {'min': 3, 'max': 8, 'def': 5...
# apis_v1/documentation_source/voter_ballot_list_retrieve_doc.py # Brought to you by We Vote. Be good. # -*- coding: UTF-8 -*- def voter_ballot_list_retrieve_doc_template_values(url_root): """ Show documentation about voterBallotListRetrieve """ required_query_parameter_list = [ { ...
def voter_ballot_list_retrieve_doc_template_values(url_root): """ Show documentation about voterBallotListRetrieve """ required_query_parameter_list = [{'name': 'voter_device_id', 'value': 'string', 'description': 'An 88 character unique identifier linked to a voter record on the server'}, {'name': 'api...
# "sb" pytest fixture test in a method with no class def test_sb_fixture_with_no_class(sb): sb.open("https://google.com/ncr") sb.type('input[title="Search"]', "SeleniumBase GitHub\n") sb.click('a[href*="github.com/seleniumbase/SeleniumBase"]') sb.click('a[title="seleniumbase"]') # "sb" pytest fixture ...
def test_sb_fixture_with_no_class(sb): sb.open('https://google.com/ncr') sb.type('input[title="Search"]', 'SeleniumBase GitHub\n') sb.click('a[href*="github.com/seleniumbase/SeleniumBase"]') sb.click('a[title="seleniumbase"]') class Test_Sb_Fixture: def test_sb_fixture_inside_class(self, sb): ...
# Copyright 2017 The TensorFlow Authors All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
"""A convenience class replicating some lua table syntax with a python dict. In general, should behave like a dictionary except that we can use dot notation to access keys. Users should be careful to only provide keys suitable for instance variable names. Nota bene: do not use the key "keys" since it will collide w...
template = ' <!DOCTYPE html> \ <html lang="en"> \ <head> \ <title>AssiStudy</title> \ <meta charset="UTF-8"> \ <meta name="viewport" co ntent="width=device-width, initial-scale=1"> \ <!--===============================================================================================--> \ <link rel="icon" type...
template = ' <!DOCTYPE html> <html lang="en"> <head> \t<title>AssiStudy</title> \t<meta charset="UTF-8"> \t<meta name="viewport" co ntent="width=device-width, initial-scale=1"> <!--===============================================================================================--> \t<link rel="icon" type="image/png" href...
class Config: # dataset related exemplar_size = 127 # exemplar size instance_size = 255 # instance size context_amount = 0.5 # context amount # training related num_per_epoch = 53200 # num of samples per epoch train_r...
class Config: exemplar_size = 127 instance_size = 255 context_amount = 0.5 num_per_epoch = 53200 train_ratio = 0.9 frame_range = 100 train_batch_size = 8 valid_batch_size = 8 train_num_workers = 8 valid_num_workers = 8 lr = 0.01 momentum = 0.0 weight_decay = 0.0 s...
__all__ = ('indent_string',) def indent_string(s, num_spaces): add_newline = False if s[-1] == '\n': add_newline = True s = s[:-1] s = '\n'.join(num_spaces * ' ' + line for line in s.split('\n')) if add_newline: s += '\n' return s
__all__ = ('indent_string',) def indent_string(s, num_spaces): add_newline = False if s[-1] == '\n': add_newline = True s = s[:-1] s = '\n'.join((num_spaces * ' ' + line for line in s.split('\n'))) if add_newline: s += '\n' return s
# model settings model = dict( type='MAE', backbone=dict( type='MAEViT', arch='small', patch_size=16, mask_ratio=0.75), neck=dict( type='MAEPretrainDecoder', patch_size=16, in_chans=3, embed_dim=768, decoder_embed_dim=512, decoder_depth=6, # 3...
model = dict(type='MAE', backbone=dict(type='MAEViT', arch='small', patch_size=16, mask_ratio=0.75), neck=dict(type='MAEPretrainDecoder', patch_size=16, in_chans=3, embed_dim=768, decoder_embed_dim=512, decoder_depth=6, decoder_num_heads=16, mlp_ratio=4.0), head=dict(type='MAEPretrainHead', norm_pix=True, patch_size=16...
expected_output = { "report_id":{ "1634211151":{ "metric_name":"ENTITLEMENT", "feature_name":"dna-advantage", "metric_value":"regid.2017-05.com.cisco.c9300_dna_advantage,1.0_411773c3-2116-4c10-94a4-5d357fe6ff18", "udi":{ "pid":"C9300-24UX", "s...
expected_output = {'report_id': {'1634211151': {'metric_name': 'ENTITLEMENT', 'feature_name': 'dna-advantage', 'metric_value': 'regid.2017-05.com.cisco.c9300_dna_advantage,1.0_411773c3-2116-4c10-94a4-5d357fe6ff18', 'udi': {'pid': 'C9300-24UX', 'sn': 'FCW2303D16Y'}, 'previous_report_id': '0', 'next_report_id': '16342111...
""" Technique - Sum of all multiples of 3 + Sum of all those multiples of 5 that are not multiple of 3 - This Multiples of 15 should be subtracted as that has been added twice. - A Pythonic implementation which uses a list comprehension. Note - The optimisation that only those multiples of 5 are added which are not th...
""" Technique - Sum of all multiples of 3 + Sum of all those multiples of 5 that are not multiple of 3 - This Multiples of 15 should be subtracted as that has been added twice. - A Pythonic implementation which uses a list comprehension. Note - The optimisation that only those multiples of 5 are added which are not th...
''' Encrypt and decrypt a string ''' def encrypt(s): return s.encode('hex') def decrypt(s): return s.decode('hex')
""" Encrypt and decrypt a string """ def encrypt(s): return s.encode('hex') def decrypt(s): return s.decode('hex')
test = { 'name': 'List Indexing', 'points': 0, 'suites': [ { 'cases': [ { 'code': r""" >>> x = [1, 3, [5, 7], 9] # Write the expression that indexes into x to output the 7 3450d5df7f6d639c9dc883cf31cc62bd # locked >>> x = [[7]] # Write the expres...
test = {'name': 'List Indexing', 'points': 0, 'suites': [{'cases': [{'code': '\n >>> x = [1, 3, [5, 7], 9] # Write the expression that indexes into x to output the 7\n 3450d5df7f6d639c9dc883cf31cc62bd\n # locked\n >>> x = [[7]] # Write the expression that indexes into x to output the...
class NotFoundError(Exception): """ Class of custom Exception about Not Found Args: data (all types): input data """ def __init__(self, data): self.data = data def __str__(self): return f"Not Found {self.data}, please check the name again" class CollisionError(Exc...
class Notfounderror(Exception): """ Class of custom Exception about Not Found Args: data (all types): input data """ def __init__(self, data): self.data = data def __str__(self): return f'Not Found {self.data}, please check the name again' class Collisionerror(Excepti...
# Defines number of epochs n_epochs = 200 losses = [] for epoch in range(n_epochs): # inner loop loss = mini_batch(device, train_loader, train_step) losses.append(loss)
n_epochs = 200 losses = [] for epoch in range(n_epochs): loss = mini_batch(device, train_loader, train_step) losses.append(loss)
#----------------------------------------------------------------------------- # Runtime: 32ms # Memory Usage: # Link: #----------------------------------------------------------------------------- class Solution: def canJump(self, nums: [int]) -> bool: max_right = 0 for i, num in enumerate(nums...
class Solution: def can_jump(self, nums: [int]) -> bool: max_right = 0 for (i, num) in enumerate(nums): if i > max_right: return False else: max_right = max(max_right, i + num) return True
def floyd_warshall(start): d = [float("Inf") for i in range(n)] dist = [[graph[j][i] for i in range(n)] for j in range(n)] for k in range(n): for i in range(n): for j in range(n): dist[i][j] = min(dist[i][j], dist[j][k] + dist[k][j]) return dist if __name__ == "__ma...
def floyd_warshall(start): d = [float('Inf') for i in range(n)] dist = [[graph[j][i] for i in range(n)] for j in range(n)] for k in range(n): for i in range(n): for j in range(n): dist[i][j] = min(dist[i][j], dist[j][k] + dist[k][j]) return dist if __name__ == '__main...
__revision__ = '$Id: __init__.py,v 1.2 2006/08/12 15:56:26 jkloth Exp $' __all__ = ['XmlFormatter', 'ApiFormatter', 'ExtensionFormatter', 'CommandLineFormatter', ]
__revision__ = '$Id: __init__.py,v 1.2 2006/08/12 15:56:26 jkloth Exp $' __all__ = ['XmlFormatter', 'ApiFormatter', 'ExtensionFormatter', 'CommandLineFormatter']
display = { 0: 'ABCEFG', 1: 'CF', 2: 'ACDEG', 3: 'ACDFG', 4: 'BCDF', 5: 'ABDFG', 6: 'ABDEFG', 7: 'ACF', 8: 'ABCDEFG', 9: 'ABCDFG' } solve_it = { 'a': 'C', 'b': 'F', 'c': 'G', 'd': 'A', 'e': 'B', 'f': 'D', 'g': 'E' } def part1(input_str: str) -> None...
display = {0: 'ABCEFG', 1: 'CF', 2: 'ACDEG', 3: 'ACDFG', 4: 'BCDF', 5: 'ABDFG', 6: 'ABDEFG', 7: 'ACF', 8: 'ABCDEFG', 9: 'ABCDFG'} solve_it = {'a': 'C', 'b': 'F', 'c': 'G', 'd': 'A', 'e': 'B', 'f': 'D', 'g': 'E'} def part1(input_str: str) -> None: count = 0 for line in input_str.split('\n'): for output_...
n = input("value of n\n") n = int(n) if n < 5: print("n is less than 5") elif n == 5: print("n is equal to 5") else: print("n is greater than 5")
n = input('value of n\n') n = int(n) if n < 5: print('n is less than 5') elif n == 5: print('n is equal to 5') else: print('n is greater than 5')
""" Dictionary of supported JIRA events and output friendly format """ jira_events = { "project_created": "New Project Created", "jira:issue_created": "New Issue Created", "jira:issue_updated": "Issue Updated" } issue_events = { "issue_commented": "Comment Added", "issue_comment_edited": "Comment E...
""" Dictionary of supported JIRA events and output friendly format """ jira_events = {'project_created': 'New Project Created', 'jira:issue_created': 'New Issue Created', 'jira:issue_updated': 'Issue Updated'} issue_events = {'issue_commented': 'Comment Added', 'issue_comment_edited': 'Comment Edited', 'issue_comment_d...
''' practice qusestion from chapter 1 Module 5 of IBM Digital Nation Courses by Aashik J Krishnan/Aash Gates ''' #testing variable x = 8 print(x) x = "seven" #assigning the Sring to variable x print(x) x = 6 #end of the Program
""" practice qusestion from chapter 1 Module 5 of IBM Digital Nation Courses by Aashik J Krishnan/Aash Gates """ x = 8 print(x) x = 'seven' print(x) x = 6
class ApiKeyManager( object ): def __init__( self, app ): self.app = app def create_api_key( self, user ): guid = self.app.security.get_new_guid() new_key = self.app.model.APIKeys() new_key.user_id = user.id new_key.key = guid sa_session = self.app.model.conte...
class Apikeymanager(object): def __init__(self, app): self.app = app def create_api_key(self, user): guid = self.app.security.get_new_guid() new_key = self.app.model.APIKeys() new_key.user_id = user.id new_key.key = guid sa_session = self.app.model.context ...
class Solution(object): def uniquePathsWithObstacles(self, obstacleGrid): """ :type obstacleGrid: List[List[int]] :rtype: int """ rslt = [] for i in range(len(obstacleGrid)): r = [] for j in range(len(obstacleGrid[i])): if obsta...
class Solution(object): def unique_paths_with_obstacles(self, obstacleGrid): """ :type obstacleGrid: List[List[int]] :rtype: int """ rslt = [] for i in range(len(obstacleGrid)): r = [] for j in range(len(obstacleGrid[i])): if o...
totalSegundos = int(input()) quantidadeHoras = totalSegundos//60//60 segundosHoras = quantidadeHoras*60*60 restante = totalSegundos - segundosHoras quantidadeMinutos = restante//60 segundosMinutos = quantidadeMinutos*60 quantidadeSegundos = restante - segundosMinutos print('{}:{}:{}'.format(quantidadeHoras, quantidad...
total_segundos = int(input()) quantidade_horas = totalSegundos // 60 // 60 segundos_horas = quantidadeHoras * 60 * 60 restante = totalSegundos - segundosHoras quantidade_minutos = restante // 60 segundos_minutos = quantidadeMinutos * 60 quantidade_segundos = restante - segundosMinutos print('{}:{}:{}'.format(quantidade...
class Solution: def threeSumClosest(self, nums,target): nums.sort() out=0 for i in range(len(nums)-1): j=i+1 k=len(nums)-1 while j<k: # print(nums[i]+nums[j]+nums[k],out) if i==0 and j==1 and k==len(nums)-1: ...
class Solution: def three_sum_closest(self, nums, target): nums.sort() out = 0 for i in range(len(nums) - 1): j = i + 1 k = len(nums) - 1 while j < k: if i == 0 and j == 1 and (k == len(nums) - 1): out = nums[i] + nums[...
""" Test the health check endpoints """ def test_live(mini_sentry, relay): """Internal endpoint used by kubernetes """ relay = relay(mini_sentry) response = relay.get("/api/relay/healthcheck/live/") assert response.status_code == 200 def test_external_live(mini_sentry, relay): """Endpoint called...
""" Test the health check endpoints """ def test_live(mini_sentry, relay): """Internal endpoint used by kubernetes """ relay = relay(mini_sentry) response = relay.get('/api/relay/healthcheck/live/') assert response.status_code == 200 def test_external_live(mini_sentry, relay): """Endpoint called b...
# -*- coding: utf-8 -*- DDD_TABLE = { '61' : 'Brasilia', '71' : 'Salvador', '11' : 'Sao Paulo', '21' : 'Rio de Janeiro', '32' : 'Juiz de Fora', '19' : 'Campinas', '27' : 'Vitoria', '31' : 'Belo Horizonte' } def main(): ddd = input() if ddd in DDD_TABLE: print(DDD_TABLE...
ddd_table = {'61': 'Brasilia', '71': 'Salvador', '11': 'Sao Paulo', '21': 'Rio de Janeiro', '32': 'Juiz de Fora', '19': 'Campinas', '27': 'Vitoria', '31': 'Belo Horizonte'} def main(): ddd = input() if ddd in DDD_TABLE: print(DDD_TABLE[ddd]) else: print('DDD nao cadastrado') if __name__ == ...
minimal_message = """ { "$schema": "../../harmony/app/schemas/data-operation/0.7.0/data-operation-v0.7.0.json", "version": "0.7.0", "callback": "http://localhost/some-path", "stagingLocation": "s3://example-bucket/public/some-org/some-service/some-uuid/", "user": "jdoe", ...
minimal_message = '\n {\n "$schema": "../../harmony/app/schemas/data-operation/0.7.0/data-operation-v0.7.0.json",\n "version": "0.7.0",\n "callback": "http://localhost/some-path",\n "stagingLocation": "s3://example-bucket/public/some-org/some-service/some-uuid/",\n "user": "jdoe",\...
with open('09.txt') as fd: data = fd.readline().strip() pos = 0 current = [] stack = [] in_garbage = False garbage = 0 while pos < len(data): c = data[pos] pos += 1 if in_garbage: if c == '!': pos += 1 elif c == '>': in_garbage = False else: garbage += 1 else: if c == '{': ...
with open('09.txt') as fd: data = fd.readline().strip() pos = 0 current = [] stack = [] in_garbage = False garbage = 0 while pos < len(data): c = data[pos] pos += 1 if in_garbage: if c == '!': pos += 1 elif c == '>': in_garbage = False else: ga...
""" Test Case 1 def main(): LL = [] print('Original List: ', LL) LL.reverse() print('Reversed List: ', LL) """ """ Test Case 1 - Results Original List: [] Reversed List: [] """ """ Test Case 2 def main(): LL = [1, 2, 3] print('Original List:', LL) LL.reverse() print('Reversed List:', LL...
""" Test Case 1 def main(): LL = [] print('Original List: ', LL) LL.reverse() print('Reversed List: ', LL) """ '\nTest Case 1 - Results\nOriginal List: []\nReversed List: []\n' "\nTest Case 2\ndef main():\n LL = [1, 2, 3]\n print('Original List:', LL)\n LL.reverse()\n print('Reversed List:',...
f""" Temperature Conversions - SOLUTIONS """ # You're studying climate change, and over the last 3 years, you've recorded the temperature at noon every day in degrees Fahrenheit (F). The var sampleF holds a portion of those recordings. sampleF = [91.4, 82.4, 71.6, 107.6, 115.6] # Convert each item in this list into...
f'\nTemperature Conversions - SOLUTIONS\n' sample_f = [91.4, 82.4, 71.6, 107.6, 115.6] sample_temps = {} for f in sampleF: c = (f - 32) * (5 / 9) sample_temps.update({f: format(c, '.2f')}) for (k, v) in sample_temps.items(): print(f'{k} F -> {v} C') '\n91.4 F -> 33.00 C\n82.4 F -> 28.00 C\n71.6 F -> 22.00 C...
# Use the range function to loop through a code set 6 times. for x in range(6): print(x)
for x in range(6): print(x)
""" File for providing static messages or data """ def get_app_message(key): all_messages = { 'register_success': 'We will be working hard to process your request.', 'register_error': 'Invalid Data', 'register_error_message': 'Sorry, we are unable to process your request. Please make sure ...
""" File for providing static messages or data """ def get_app_message(key): all_messages = {'register_success': 'We will be working hard to process your request.', 'register_error': 'Invalid Data', 'register_error_message': 'Sorry, we are unable to process your request. Please make sure you fill out all required ...
def _kubectl_impl(ctx): executable = ctx.actions.declare_file(ctx.attr.name) contents = """ set -o errexit export KUBECTL="{kubectl}" export RESOURCE="{resource}" export NAMESPACE="{namespace}" "{script}" """.format( kubectl = ctx.executable._kubectl.short_pat...
def _kubectl_impl(ctx): executable = ctx.actions.declare_file(ctx.attr.name) contents = '\n set -o errexit\n export KUBECTL="{kubectl}"\n export RESOURCE="{resource}"\n export NAMESPACE="{namespace}"\n "{script}"\n '.format(kubectl=ctx.executable._kubectl.short_path, resour...
# -*- coding: utf-8 -*- """ Created on Tue Feb 22 14:50:22 2022 @author: Riedel """ # ============================================================================= # # import setuptools # from readreflex import _version # # with open("README.md", "r") as fh: # long_description = fh.read() # # setuptools.setup( ...
""" Created on Tue Feb 22 14:50:22 2022 @author: Riedel """
#!/bin/zsh while True: OldmanAge = input() def AgetoDays(age): result = int(age) * 365 return result print(AgetoDays(OldmanAge)) break
while True: oldman_age = input() def ageto_days(age): result = int(age) * 365 return result print(ageto_days(OldmanAge)) break
class JobDoesNotExist(RuntimeError): """The reduce mode job doesn't exist (set_total has not been run). """ class JobFailed(RuntimeError): """Skip, the reduce mode job has already been marked as failed. """ class ProgressTypeError(TypeError): """Progress argument is not of the correct type"""
class Jobdoesnotexist(RuntimeError): """The reduce mode job doesn't exist (set_total has not been run). """ class Jobfailed(RuntimeError): """Skip, the reduce mode job has already been marked as failed. """ class Progresstypeerror(TypeError): """Progress argument is not of the correct type"""
# -*- coding: utf-8 -*- class Solution: INTEGER_TO_ALPHABET = {n: chr(ord('a') + n - 1) for n in range(1, 27)} def freqAlphabets(self, s: str) -> str: i, result = 0, [] while i < len(s): if i + 2 < len(s) and s[i + 2] == '#': result.append(self.INTEGER_TO_ALPHABET[...
class Solution: integer_to_alphabet = {n: chr(ord('a') + n - 1) for n in range(1, 27)} def freq_alphabets(self, s: str) -> str: (i, result) = (0, []) while i < len(s): if i + 2 < len(s) and s[i + 2] == '#': result.append(self.INTEGER_TO_ALPHABET[int(s[i:i + 2])]) ...
def test_get_all_offices(fineract): offices = [office for office in fineract.get_offices()] assert len(offices) == 3 def test_get_single_office(fineract): office = fineract.get_offices(2) assert office assert office.name == 'Merida' def test_get_all_staff(fineract): staff = [staff for staff ...
def test_get_all_offices(fineract): offices = [office for office in fineract.get_offices()] assert len(offices) == 3 def test_get_single_office(fineract): office = fineract.get_offices(2) assert office assert office.name == 'Merida' def test_get_all_staff(fineract): staff = [staff for staff in...
print("\n\t\t-----> Welcome to Matias list changer <-----\t\t\n") listn = [1,2,3,4,5,6,7,8,9,10] print(f"\nThis is the list without changes ===> {listn}\n") listn[4] *= 2 listn[7] *= 2 listn[9] *= 2 print(f"\nThis is the modified list ===> {listn}\n")
print('\n\t\t-----> Welcome to Matias list changer <-----\t\t\n') listn = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] print(f'\nThis is the list without changes ===> {listn}\n') listn[4] *= 2 listn[7] *= 2 listn[9] *= 2 print(f'\nThis is the modified list ===> {listn}\n')
def shiftCalc(n): if n < 0x40: n = n - 1 n = n ^ 0x10 n = n + 1 else: n = n ^ 0x20 return n keys = """ 1 ! 2 " 3 # 4 $ 5 % 6 & 7 ' 8 ( 9 ) 0 @ : * - = ; + , < . > / ? """.replace("\t"," ").split("\n") keys = [x.strip() for x in keys if x.strip() != ""] for i in range(0,26): keys.append(...
def shift_calc(n): if n < 64: n = n - 1 n = n ^ 16 n = n + 1 else: n = n ^ 32 return n keys = '\n1\t!\n2\t"\n3\t#\n4\t$\n5\t%\n6\t&\n7\t\'\n8\t(\n9 \t)\n0 \t@\n:\t*\n- \t=\n; \t+\n,\t<\n. \t>\n/\t?\n'.replace('\t', ' ').split('\n') keys = [x.strip() for x in keys if x.strip()...
class PizzaDelivery: def __init__(self, name, price, ingredients): self.name = name self.price = price self.ingredients = ingredients self.ordered = False def add_extra(self, ingredient, quantity, price_per_ingredient): if self.ordered: return f"Pizza {self....
class Pizzadelivery: def __init__(self, name, price, ingredients): self.name = name self.price = price self.ingredients = ingredients self.ordered = False def add_extra(self, ingredient, quantity, price_per_ingredient): if self.ordered: return f"Pizza {self....
## CITIES cities = ['London', 'Constantinople', 'Sydney', 'Leningrad', 'Peking'] # Use bracket notation to change: # Constantinople to Istanbul # Leningrad to Saint Petersburg # Peking to Beijing cities[1] = 'Istanbul' cities[3] = 'Saint Petersburg' cities[4] = 'Beijing' ## DINOSAURS dinos = ['Tyrannosaurus rex', 'T...
cities = ['London', 'Constantinople', 'Sydney', 'Leningrad', 'Peking'] cities[1] = 'Istanbul' cities[3] = 'Saint Petersburg' cities[4] = 'Beijing' dinos = ['Tyrannosaurus rex', 'Torosaurus', 'Stegosaurus', 'Brontosaurus'] dinos[1] = 'Triceratops' dinos[3] = 'Apatosaurus' planets = ['Mercury', 'Venus', 'Earth', 'Mars', ...
class Constants: FW_VERSION = 4 LIGHT_TRANSITION_DURATION = 320 FAST_RECONNECT_WAIT_TIME_BEFORE_RESETING_LIGHTS = 5 HEARTBEAT_INTERVAL = 120 HEARTBEAT_MAX_RESPONSE_TIME = 5
class Constants: fw_version = 4 light_transition_duration = 320 fast_reconnect_wait_time_before_reseting_lights = 5 heartbeat_interval = 120 heartbeat_max_response_time = 5
class GoogleAnalyticsClientError(Exception): """ General Google Analytics error (error accessing GA) """ def __init__(self, reason): self.reason = reason def __repr__(self): return 'GAError: %s' % self.reason def __str__(self): return 'GAError: %s' % self.reason
class Googleanalyticsclienterror(Exception): """ General Google Analytics error (error accessing GA) """ def __init__(self, reason): self.reason = reason def __repr__(self): return 'GAError: %s' % self.reason def __str__(self): return 'GAError: %s' % self.reason
class UI_Draw: def draw(self, context): layout = self.layout layout.prop(self, 'auto_presets') layout.separator() split = layout.split() split.prop(self, 'handle', text='Handle') col = split.column(align=True) col.prop(self, 'handle_z_top', text='Top') if self.shape_rnd or self.shape_sq: col.pr...
class Ui_Draw: def draw(self, context): layout = self.layout layout.prop(self, 'auto_presets') layout.separator() split = layout.split() split.prop(self, 'handle', text='Handle') col = split.column(align=True) col.prop(self, 'handle_z_top', text='Top') ...
""" Basic Configurations """ def configs(): configs_dict = {} configs_dict['cdsign'] = '/' configs_dict['path_root'] = './VQA_Project/' configs_dict['path_datasets'] ...
""" Basic Configurations """ def configs(): configs_dict = {} configs_dict['cdsign'] = '/' configs_dict['path_root'] = './VQA_Project/' configs_dict['path_datasets'] = configs_dict['path_root'] + 'Datasets' + configs_dict['cdsign'] configs_dict['datasets'] = {} configs_dict['datasets']['VQAv1']...
TWITTER_DIR = "twitter_data" TWITTER_RAW_DIR = "raw" TWITTER_PARQUET_DIR = "parquet" TWITTER_RAW_SCHEMA = "twitter_schema.json"
twitter_dir = 'twitter_data' twitter_raw_dir = 'raw' twitter_parquet_dir = 'parquet' twitter_raw_schema = 'twitter_schema.json'
matriz = [] for i in range(2): matriz.append(list(map(int, input().split()))) linhaMaior, colMaior = 0, 0 for linha in range(len(matriz)): for elemento in range(len(matriz[linha])): if matriz[linha][elemento] > matriz[linhaMaior][colMaior]: linhaMaior, colMaior = linha, elemento...
matriz = [] for i in range(2): matriz.append(list(map(int, input().split()))) (linha_maior, col_maior) = (0, 0) for linha in range(len(matriz)): for elemento in range(len(matriz[linha])): if matriz[linha][elemento] > matriz[linhaMaior][colMaior]: (linha_maior, col_maior) = (linha, elemento) ...
SLIP39_WORDS = [ "academic", "acid", "acne", "acquire", "acrobat", "activity", "actress", "adapt", "adequate", "adjust", "admit", "adorn", "adult", "advance", "advocate", "afraid", "again", "agency", "agree", "aide", "aircraft", "ai...
slip39_words = ['academic', 'acid', 'acne', 'acquire', 'acrobat', 'activity', 'actress', 'adapt', 'adequate', 'adjust', 'admit', 'adorn', 'adult', 'advance', 'advocate', 'afraid', 'again', 'agency', 'agree', 'aide', 'aircraft', 'airline', 'airport', 'ajar', 'alarm', 'album', 'alcohol', 'alien', 'alive', 'alpha', 'alrea...
class Model: def __init__(self): self.SoC = 0.0 self.io = 0.0 def step(self, value): if self.SoC > 0.95 and self.io == 1.0: self.io = 0.0 if self.SoC < 0.05 and self.io == 0.0: self.io = 1.0
class Model: def __init__(self): self.SoC = 0.0 self.io = 0.0 def step(self, value): if self.SoC > 0.95 and self.io == 1.0: self.io = 0.0 if self.SoC < 0.05 and self.io == 0.0: self.io = 1.0
def is_valid_index(r, c, board_size): return r in range(board_size) and c in range(board_size) def calculate_kills(matrix, r, c): kills = 0 possible_moves = [ (-2, -1), (-2, 1), (-1, -2), (-1, 2), (1, -2), (2, -1), (2, 1), (1, 2) ] for idx in range(len(possible_moves)): row = r + p...
def is_valid_index(r, c, board_size): return r in range(board_size) and c in range(board_size) def calculate_kills(matrix, r, c): kills = 0 possible_moves = [(-2, -1), (-2, 1), (-1, -2), (-1, 2), (1, -2), (2, -1), (2, 1), (1, 2)] for idx in range(len(possible_moves)): row = r + possible_moves[i...
# settings.py # # aws-clean will not destroy things in the whitelist for global resources # please put under the global region. I recommend just adding to the lists provided # unless you are trying to provide a new cleaner. # # # What value do I put in for each resource> # # s3_buckets - BucketName # ec2_instances - In...
whitelist = {'global': {'s3_buckets': []}, 'us-east-1': {'ec2_instances': [], 'rds_instances': [], 'lambda_functions': [], 'dynamo_tables': [], 'redshift_clusters': [], 'ecs_clusters': [], 'efs': []}, 'us-east-2': {'ec2_instances': [], 'rds_instances': [], 'lambda_functions': [], 'dynamo_tables': [], 'redshift_clusters...
### YOUR CODE FOR openLocks() FUNCTION GOES HERE ### def openLocks(number_of_lockers , number_of_students): if type(number_of_lockers) == str or type(number_of_students) == str or number_of_lockers < 0 or number_of_students <0: return None if number_of_lockers == 0 or number_of_students == 0: re...
def open_locks(number_of_lockers, number_of_students): if type(number_of_lockers) == str or type(number_of_students) == str or number_of_lockers < 0 or (number_of_students < 0): return None if number_of_lockers == 0 or number_of_students == 0: return 0 locks = [1] * number_of_lockers ope...
test = { 'name': 'Question32', 'points': 1, 'suites': [ { 'cases': [ { 'code': r""" >>> from datascience import * >>> retweets_likes_age.num_rows 7 """, 'hidden': False, 'locked': False }, { 'code...
test = {'name': 'Question32', 'points': 1, 'suites': [{'cases': [{'code': '\n >>> from datascience import *\n >>> retweets_likes_age.num_rows\n 7\n ', 'hidden': False, 'locked': False}, {'code': '\n >>> from datascience import *\n >>> retweets_likes_age.num_columns\...
if __name__ == '__main__': n = int(input()) student_marks = {} for _ in range(n): name, *line = input().split() scores = list(map(float, line)) student_marks[name] = scores query_name = str(input()) if query_name in student_marks: l=list(student_marks[query_name]) sum=0 ...
if __name__ == '__main__': n = int(input()) student_marks = {} for _ in range(n): (name, *line) = input().split() scores = list(map(float, line)) student_marks[name] = scores query_name = str(input()) if query_name in student_marks: l = list(student_marks[query_name]) sum...
fname = input("Enter the file name: ") fh = open(fname) count = 0 for line in fh: line = line.rstrip() if line.startswith('From '): count = count + 1 words = line.split() emails = words[1] print(emails) print("There were",count, "lines in the file with From as the first word")
fname = input('Enter the file name: ') fh = open(fname) count = 0 for line in fh: line = line.rstrip() if line.startswith('From '): count = count + 1 words = line.split() emails = words[1] print(emails) print('There were', count, 'lines in the file with From as the first word')
def add_title(self): square = Square(side_length=2 * self.L) title = TextMobject("Brownian motion") title.scale(1.5) title.next_to(square, UP) self.add(square) self.add(title)
def add_title(self): square = square(side_length=2 * self.L) title = text_mobject('Brownian motion') title.scale(1.5) title.next_to(square, UP) self.add(square) self.add(title)
class Solution(object): def reverseBitsBitManipulation(self, n): """ Time - O(length(n)) = O(32) Space - O(1) :type n: integer :rtype: integer """ result = 0 for _ in range(32): result <<= 1 result |= n & 1 n >>= 1 ...
class Solution(object): def reverse_bits_bit_manipulation(self, n): """ Time - O(length(n)) = O(32) Space - O(1) :type n: integer :rtype: integer """ result = 0 for _ in range(32): result <<= 1 result |= n & 1 n >>=...
## PETRglobals.py [module] ## # Global variable initializations for the PETRARCH event coder # # SYSTEM REQUIREMENTS # This program has been successfully run under Mac OS 10.10; it is standard Python 2.7 # so it should also run in Unix or Windows. # # INITIAL PROVENANCE: # Programmer: Philip A. Schrodt # Parus Ana...
verb_dict = {'verbs': {}, 'phrases': {}, 'transformations': {}} actor_dict = {} actor_codes = [] agent_dict = {} discard_list = {} issue_list = [] issue_codes = [] config_file_name = 'PETR_config.ini' verb_file_name = '' actor_file_list = [] agent_file_name = '' discard_file_name = '' text_file_list = [] event_file_nam...
# pylint: disable=W0622 def sum(arg): total = 0 for val in arg: total += val return total
def sum(arg): total = 0 for val in arg: total += val return total
class Wallet(): def __init__(self, initial_amount = 0): self.balance = initial_amount def spend_cash(self, amount): if self.balance < amount: print("insuffienct amount") else: self.balance -= amount def add_cash(self, amount): self.balance += amount
class Wallet: def __init__(self, initial_amount=0): self.balance = initial_amount def spend_cash(self, amount): if self.balance < amount: print('insuffienct amount') else: self.balance -= amount def add_cash(self, amount): self.balance += amount
a = int(input("")) b = int(input("")) c = int(input("")) d = int(input("")) x = (a*b-c*d) print("DIFERENCA = %d" %x)
a = int(input('')) b = int(input('')) c = int(input('')) d = int(input('')) x = a * b - c * d print('DIFERENCA = %d' % x)
""" CSS Grid Template """ class CSSGridMixin(object): """ A mixin for adding css grid to any standard CBV """ grid_wrapper = None grid_template_columns = None grid_template_areas = None grid_gap = None def get_context_data(self, **kwargs): """ Insert the single object...
""" CSS Grid Template """ class Cssgridmixin(object): """ A mixin for adding css grid to any standard CBV """ grid_wrapper = None grid_template_columns = None grid_template_areas = None grid_gap = None def get_context_data(self, **kwargs): """ Insert the single object i...
# Webhook content types HTTP_CONTENT_TYPE_JSON = "application/json" # Registerable extras features EXTRAS_FEATURES = [ "config_context_owners", "custom_fields", "custom_links", "custom_validators", "export_template_owners", "export_templates", "graphql", "job_results", "relationship...
http_content_type_json = 'application/json' extras_features = ['config_context_owners', 'custom_fields', 'custom_links', 'custom_validators', 'export_template_owners', 'export_templates', 'graphql', 'job_results', 'relationships', 'statuses', 'webhooks'] job_log_max_grouping_length = 100 job_log_max_log_object_length =...
def _pretty_after(a, k): positional = ", ".join(repr(arg) for arg in a) keyword = ", ".join( "{}={!r}".format(name, value) for name, value in k.items() ) if positional: if keyword: return ", {}, {}".format(positional, keyword) else: return ", {}".format(po...
def _pretty_after(a, k): positional = ', '.join((repr(arg) for arg in a)) keyword = ', '.join(('{}={!r}'.format(name, value) for (name, value) in k.items())) if positional: if keyword: return ', {}, {}'.format(positional, keyword) else: return ', {}'.format(positional...
""" Global wikipedia excpetion and warning classes. """ class PageError(Exception): """Exception raised when no Wikipedia matched a query.""" def __init__(self, page_title): self.title = page_title def __str__(self): return "\"%s\" does not match any pages. Try another query!" % self.title class Disambiguati...
""" Global wikipedia excpetion and warning classes. """ class Pageerror(Exception): """Exception raised when no Wikipedia matched a query.""" def __init__(self, page_title): self.title = page_title def __str__(self): return '"%s" does not match any pages. Try another query!' % self.title ...
""" CONFIG module We put here things that we might vary depending on which machine we are running on, or whether we are in debugging mode, etc. """ COOKIE_KEY = "A random string would be better" DEBUG = True PORT = 5000 # The default Flask port; change for shared server machines
""" CONFIG module We put here things that we might vary depending on which machine we are running on, or whether we are in debugging mode, etc. """ cookie_key = 'A random string would be better' debug = True port = 5000