content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
SECRET_KEY='foobar' EMAIL_HOST='smtp.fastmail.com' EMAIL_PORT=465 EMAIL_HOST_USER='aa@example.com' EMAIL_HOST_PASSWORD='XXX' EMAIL_USE_SSL=True
secret_key = 'foobar' email_host = 'smtp.fastmail.com' email_port = 465 email_host_user = 'aa@example.com' email_host_password = 'XXX' email_use_ssl = True
#TODO deprecated #Get config file to load defaults from optionNum = -1 try: optionNum = sys.argv.index('-c') except ValueError: try: optionNum = sys.argv.index('--conf') except ValueError: pass if(optionNum != -1): CURRENT['config'] = sys.argv[optionNum+1] #Set argument parsing argvParser = argparse.ArgumentP...
option_num = -1 try: option_num = sys.argv.index('-c') except ValueError: try: option_num = sys.argv.index('--conf') except ValueError: pass if optionNum != -1: CURRENT['config'] = sys.argv[optionNum + 1] argv_parser = argparse.ArgumentParser(description='Monitor connection attempts.') a...
# Prime numbers def is_prime(num): for i in range(2, num): if (num % i) == 0: return False return True def getPrimes(max_number): list_of_primes = [] for num1 in range(2, max_number): if is_prime(num1): list_of_primes.append(num1) return list_of_primes ma...
def is_prime(num): for i in range(2, num): if num % i == 0: return False return True def get_primes(max_number): list_of_primes = [] for num1 in range(2, max_number): if is_prime(num1): list_of_primes.append(num1) return list_of_primes max_num_to_check = int(...
# Free index 11 def get_index_11(x): index = x[:, :, 0] return index
def get_index_11(x): index = x[:, :, 0] return index
# # PySNMP MIB module TRAPEZE-NETWORKS-CLUSTER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TRAPEZE-NETWORKS-CLUSTER-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:27:15 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python vers...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, value_range_constraint, single_value_constraint, constraints_union) ...
class ObjcetTxn: def __init__(self, CollectionTxn, MethodCallExpr): self.txn = CollectionTxn self.expr = MethodCallExpr def new(self,CollectionTxn, object_id): expr = expr_pb2.MethodExpr(object_id) return self.__init__(CollectionTxn,expr)
class Objcettxn: def __init__(self, CollectionTxn, MethodCallExpr): self.txn = CollectionTxn self.expr = MethodCallExpr def new(self, CollectionTxn, object_id): expr = expr_pb2.MethodExpr(object_id) return self.__init__(CollectionTxn, expr)
#!/usr/bin/env python # coding=utf-8 PLUGIN_NAME = "helloworld" PLUGIN_VERSION = "0.0.1"
plugin_name = 'helloworld' plugin_version = '0.0.1'
#5. Write a python program to count the number of each vowel. print("Enter the String:") text = input() vowela = ['a', 'A'] vowele = ['e', 'E'] voweli = ['i', 'I'] vowelo = ['o', 'O'] vowelu = ['u', 'U'] ca = 0 ce = 0 ci = 0 co = 0 cu = 0 for x in text: if x in vowela: ca = ca+1 elif x in vowele: ...
print('Enter the String:') text = input() vowela = ['a', 'A'] vowele = ['e', 'E'] voweli = ['i', 'I'] vowelo = ['o', 'O'] vowelu = ['u', 'U'] ca = 0 ce = 0 ci = 0 co = 0 cu = 0 for x in text: if x in vowela: ca = ca + 1 elif x in vowele: ce = ce + 1 elif x in voweli: ci = ci + 1 ...
class OneIndexedList(list): def __getitem__(self, i): return super().__getitem__(i - 1) def __setitem__(self, i, value): return super().__setitem__(i - 1, value)
class Oneindexedlist(list): def __getitem__(self, i): return super().__getitem__(i - 1) def __setitem__(self, i, value): return super().__setitem__(i - 1, value)
def showInstructions(): #print a main menu and the commands print("RPG Game") print("========") print("Commands:") print(" go [direction]") print(" get [item]") def showStatus(): #print the player's current status print("---------------------------") print("You are in...
def show_instructions(): print('RPG Game') print('========') print('Commands:') print(' go [direction]') print(' get [item]') def show_status(): print('---------------------------') print('You are in the ' + rooms[currentRoom]['name']) print('Inventory : ' + str(inventory)) if '...
class Solution: def romanToInt(self, s: str) -> int: map = {"I":1,"V":5,"X":10,"L":50, "C":100, "D":500, "M":1000 } result = 0 for i in range(len(s)): if i >0 and map[s[i]] > map[s[i-1]]: result += map[s[i]] - 2*map[s[i-1]] else: ...
class Solution: def roman_to_int(self, s: str) -> int: map = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} result = 0 for i in range(len(s)): if i > 0 and map[s[i]] > map[s[i - 1]]: result += map[s[i]] - 2 * map[s[i - 1]] else: ...
#!/usr/bin/python3 with open('06_input', 'r') as f: lines = f.readlines() states = [int(i) for i in lines[0].strip().split(',')] cache = {} def fish(timer, days): fishes = [timer] for i in range(days): new = fishes.count(0) fishes += [9] * new fishes = [f - 1 for f in fishes] ...
with open('06_input', 'r') as f: lines = f.readlines() states = [int(i) for i in lines[0].strip().split(',')] cache = {} def fish(timer, days): fishes = [timer] for i in range(days): new = fishes.count(0) fishes += [9] * new fishes = [f - 1 for f in fishes] fishes = [6 if f ...
# Copyright (c) 2003, Taro Ogawa. All Rights Reserved. # Copyright (c) 2016, Savoir-faire Linux inc. All Rights Reserved. # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # versi...
def to_s(val): try: return unicode(val) except NameError: return str(val)
#!/usr/bin/python3 def devide(x, y): try: result = x / y except ZeroDivisionError: print("devision by zero!") else: print("result: ", result) finally: print("executing finally clause") devide(2, 1) devide(2, 0) devide('2', '1')
def devide(x, y): try: result = x / y except ZeroDivisionError: print('devision by zero!') else: print('result: ', result) finally: print('executing finally clause') devide(2, 1) devide(2, 0) devide('2', '1')
def somar(x,y): return x+ y def subtrair (x,y): return x- y def mult(): pass
def somar(x, y): return x + y def subtrair(x, y): return x - y def mult(): pass
#!/usr/bin/env python3 # Read a full line of input from stdin and save it to our dynamically typed variable, input_string. input_string = input() # Print a string literal saying "Hello, World." to stdout. print('Hello, World.') print(input_string) # TODO: Write a line of code here that prints the contents of input_s...
input_string = input() print('Hello, World.') print(input_string)
file = open('input.txt', 'r') n = int(file.readline()) right = set(range(1, n + 1)) for line in file: if "YES" in line: right &= temp elif "NO" in line: right -= temp elif "HELP" not in line: temp = set(map(int, line.split())) file.close() file = open('output.txt', 'w') file.write(' ...
file = open('input.txt', 'r') n = int(file.readline()) right = set(range(1, n + 1)) for line in file: if 'YES' in line: right &= temp elif 'NO' in line: right -= temp elif 'HELP' not in line: temp = set(map(int, line.split())) file.close() file = open('output.txt', 'w') file.write(' ...
# -*- coding: utf-8 -*- # Copyright: (c) 2015, Ansible, Inc # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) class ModuleDocFragment(object): # EC2 only documentation fragment DOCUMENTATION = r''' options: region: description: - The AWS regio...
class Moduledocfragment(object): documentation = '\noptions:\n region:\n description:\n - The AWS region to use. If not specified then the value of the AWS_REGION or EC2_REGION environment variable, if any, is used.\n See U(http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_re...
# # @lc app=leetcode.cn id=146 lang=python3 # # [146] lru-cache # None # @lc code=end
None
class Solution: def shuffle(self, nums: List[int], n: int) -> List[int]: res = [] for i in range(n): res.append(nums[i]) res.append(nums[n+i]) return res nums = [2,5,1,3,4,7] n = 3 b = Solution() print(b.shuffle(nums, n))
class Solution: def shuffle(self, nums: List[int], n: int) -> List[int]: res = [] for i in range(n): res.append(nums[i]) res.append(nums[n + i]) return res nums = [2, 5, 1, 3, 4, 7] n = 3 b = solution() print(b.shuffle(nums, n))
class Calculator: def __init__(self,num): self.number = num def Square(self): print(f"The value of {self.number} square is {self.number ** 2}") def Cube(self): print(f"The value of {self.number} cube is {self.number**3}") def SquareRoot(self): print(f"...
class Calculator: def __init__(self, num): self.number = num def square(self): print(f'The value of {self.number} square is {self.number ** 2}') def cube(self): print(f'The value of {self.number} cube is {self.number ** 3}') def square_root(self): print(f'The value of...
__major__ = '0' __minor__ = '2' __update__ = '7' __version__ = '{0}.{1}'.format(__major__, __minor__) __release__ = '{0}.{1}'.format(__version__, __update__)
__major__ = '0' __minor__ = '2' __update__ = '7' __version__ = '{0}.{1}'.format(__major__, __minor__) __release__ = '{0}.{1}'.format(__version__, __update__)
class Solution: def isPerfectSquare(self, num: int) -> bool: l,r = 1,ceil(num/2) while l <= r: mid = (l+r)//2 square = mid**2 if square < num: l = mid+1 elif square > num: r = mid-1 else...
class Solution: def is_perfect_square(self, num: int) -> bool: (l, r) = (1, ceil(num / 2)) while l <= r: mid = (l + r) // 2 square = mid ** 2 if square < num: l = mid + 1 elif square > num: r = mid - 1 else:...
# jira_etl_constants JQL_SEARCH_URL = "https://company_url/jira/rest/api/2/search?jql={}" S3_ENG_BUCKET = '' #arn account number AWS_ACCOUNT_NUMBER = ''
jql_search_url = 'https://company_url/jira/rest/api/2/search?jql={}' s3_eng_bucket = '' aws_account_number = ''
# Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. DEPS = [ 'recipe_engine/context', 'recipe_engine/path', 'recipe_engine/properties', 'recipe_engine/step', 'run', 'vars', ] def myfunc(api, i):...
deps = ['recipe_engine/context', 'recipe_engine/path', 'recipe_engine/properties', 'recipe_engine/step', 'run', 'vars'] def myfunc(api, i): api.run(api.step, 'run %d' % i, cmd=['echo', str(i)]) def run_steps(api): api.vars.setup() try: api.run(api.step, 'fail', cmd=['false']) except api.step.S...
fname = input('Enter filename:') fhand = open(fname, 'r') keys = dict() for line in fhand: words = line.split() for word in words: keys[word] = None print(keys) while True: test = input('Enter a word to check for:') if test in keys: print(test, 'was found!') elif test == 'done': ...
fname = input('Enter filename:') fhand = open(fname, 'r') keys = dict() for line in fhand: words = line.split() for word in words: keys[word] = None print(keys) while True: test = input('Enter a word to check for:') if test in keys: print(test, 'was found!') elif test == 'done': ...
''' Custom exceptions and warnings for HeartPy ''' __all__ = ['BadSignalWarning'] class BadSignalWarning(UserWarning): ''' warning class to raise when no heart rate is detectable in supplied signal. This warning notifies the user that the supplied signal is of insufficient quality and/or does...
""" Custom exceptions and warnings for HeartPy """ __all__ = ['BadSignalWarning'] class Badsignalwarning(UserWarning): """ warning class to raise when no heart rate is detectable in supplied signal. This warning notifies the user that the supplied signal is of insufficient quality and/or does ...
class BaseGame(object): def __init__(self, buttons, matrix): self.buttons = buttons self.matrix = matrix self.width = self.matrix.width self.height = self.matrix.height def setup(self): pass # only needed if game requires init def reset(self): pa...
class Basegame(object): def __init__(self, buttons, matrix): self.buttons = buttons self.matrix = matrix self.width = self.matrix.width self.height = self.matrix.height def setup(self): pass def reset(self): pass
# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause...
def planner_group_delete_planner(client, group_id, if_match=None): return client.delete_planner(group_id=group_id, if_match=if_match) def planner_group_show_planner(client, group_id, select=None, expand=None): return client.get_planner(group_id=group_id, select=select, expand=expand) def planner_group_update_...
# -*- coding: utf-8 -*- description = 'Monochanger' group = 'optional' includes = ['system', 'motorbus1', 'motorbus4', 'motorbus7', 'motorbus9', 'monochromator', 'tas'] monostates = ['GE311', 'PG002', 'CU220', 'CU111', 'None'] monodevices = ['mono_ge311', 'mono_pg002', 'mono_cu220', 'mono_cu111', ...
description = 'Monochanger' group = 'optional' includes = ['system', 'motorbus1', 'motorbus4', 'motorbus7', 'motorbus9', 'monochromator', 'tas'] monostates = ['GE311', 'PG002', 'CU220', 'CU111', 'None'] monodevices = ['mono_ge311', 'mono_pg002', 'mono_cu220', 'mono_cu111', 'mono_dummy'] magazinepos = [(315.4, 8), (45.4...
class Action(object): '''Class for register action to special argument.''' def __init__(self, name='None'): self.name = name self.args = {} def register(self, cmd, action): if self.args.get(cmd, 'None') != 'None': raise ValueError('Command %s is already exists.' % cmd) if not callable(action): raise V...
class Action(object): """Class for register action to special argument.""" def __init__(self, name='None'): self.name = name self.args = {} def register(self, cmd, action): if self.args.get(cmd, 'None') != 'None': raise value_error('Command %s is already exists.' % cmd)...
class Vertex: def __init__(self, key) -> None: self.id = key self.connectedTo = {} self.color = 'white' self.getDistance = 0 self.pred = None def __str__(self) -> str: return str(self.id) + ' connectedTo: ' + str([x.id for x in self.connectedTo]) def ad...
class Vertex: def __init__(self, key) -> None: self.id = key self.connectedTo = {} self.color = 'white' self.getDistance = 0 self.pred = None def __str__(self) -> str: return str(self.id) + ' connectedTo: ' + str([x.id for x in self.connectedTo]) def add_ne...
CONFIG = { "db": "/home/ubuntu/storage/neorefs/neoref16s/rev6/neoRef16S_rev6_190325.acc", "out_dir": "/home/ubuntu/storage/neorefs/genomes/bacteria", "email": "vinicius.salazar@biome-hub.com", "api_key": "afb857c557897af55345e77a84def712cd08", }
config = {'db': '/home/ubuntu/storage/neorefs/neoref16s/rev6/neoRef16S_rev6_190325.acc', 'out_dir': '/home/ubuntu/storage/neorefs/genomes/bacteria', 'email': 'vinicius.salazar@biome-hub.com', 'api_key': 'afb857c557897af55345e77a84def712cd08'}
# 25. Reverse Nodes in k-Group # Runtime: 48 ms, faster than 76.25% of Python3 online submissions for Reverse Nodes in k-Group. # Memory Usage: 15.2 MB, less than 76.87% of Python3 online submissions for Reverse Nodes in k-Group. # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0,...
class Solution: def reverse_k_group(self, head: ListNode, k: int) -> ListNode: if head is None or k == 1: return head def reverse_between(left: ListNode, right: ListNode) -> ListNode: (curr, prev) = (left, None) while curr != right: next = curr.n...
number = int(input()) for i in range(1, number + 1): num = str(i) num1 = num[0] num2 = 0 try: num2 = num[1] except: hello_there = "hello_there" if int(num1) + int(num2) == 5 or int(num1) + int(num2) == 7 or int(num1) + int(num2) == 11: print(f"{num} -> True") else: ...
number = int(input()) for i in range(1, number + 1): num = str(i) num1 = num[0] num2 = 0 try: num2 = num[1] except: hello_there = 'hello_there' if int(num1) + int(num2) == 5 or int(num1) + int(num2) == 7 or int(num1) + int(num2) == 11: print(f'{num} -> True') else: ...
class AnalyzeCPUStats: def __init__(self, observer, metric_key): self.observer = observer observer.observer_instances[metric_key]["analyze"] = self def execute_analysis(self): self.check_uptime() def check_uptime(self): pass
class Analyzecpustats: def __init__(self, observer, metric_key): self.observer = observer observer.observer_instances[metric_key]['analyze'] = self def execute_analysis(self): self.check_uptime() def check_uptime(self): pass
class Node: def __init__(self, key, value=None): self.key = key self.value = value self.childs = {} def add(self, node): if node.key not in self.childs: self.childs[node.key] = node def get_child(self, key): return self.childs.get(key) class Tree: ...
class Node: def __init__(self, key, value=None): self.key = key self.value = value self.childs = {} def add(self, node): if node.key not in self.childs: self.childs[node.key] = node def get_child(self, key): return self.childs.get(key) class Tree: ...
print(4/2) #float divison print(4//2) print(2//4) print(2**3) print(2**0.5) print(round(2**0.5,4))
print(4 / 2) print(4 // 2) print(2 // 4) print(2 ** 3) print(2 ** 0.5) print(round(2 ** 0.5, 4))
expected_output = { 'event_num': { 1: { 'type': 'user', 'time_created': 'Tue Sep 14 15:10:07 2021', 'eemfile_name': 'eem_cli_exec_file.tcl' } } }
expected_output = {'event_num': {1: {'type': 'user', 'time_created': 'Tue Sep 14 15:10:07 2021', 'eemfile_name': 'eem_cli_exec_file.tcl'}}}
# # PySNMP MIB module CISCO-ENTITY-ASSET-CAPABILITY (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ENTITY-ASSET-CAPABILITY # Produced by pysmi-0.3.4 at Mon Apr 29 17:39:30 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python ve...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, value_size_constraint, single_value_constraint, value_range_constraint) ...
{ 'targets': [ { 'target_name': 'ffi_tests', 'type': 'shared_library', 'sources': [ 'ffi_tests.cc' ] } ] }
{'targets': [{'target_name': 'ffi_tests', 'type': 'shared_library', 'sources': ['ffi_tests.cc']}]}
f = open("input2.txt",'r') L = [] for item in f: L.append(item.strip()) groups = [] # stores key-value pairs (in string form): group = [] for item in L: # if empty line, append passport, and reinitialize passport variable: if item == "": groups.append(group) group = [] # otherwise, loop through current line an...
f = open('input2.txt', 'r') l = [] for item in f: L.append(item.strip()) groups = [] group = [] for item in L: if item == '': groups.append(group) group = [] if item != '': group.append(item) groups.append(group) count = 0 for group in groups: for letter in group[0]: in_a...
# # PySNMP MIB module ASCEND-MIBPLAN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASCEND-MIBPLAN-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:12:00 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
(configuration,) = mibBuilder.importSymbols('ASCEND-MIB', 'configuration') (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union...
#!/usr/bin/python3 test_pop = [[14, 26], [74, 38], [68, 63], [ 7, 68], [26, 87], [34, 30], [33, 27], [36, 41], [ 8, 96], [15, 96], [57, 76], [ 6, 59], [36, 54], [79, 19], [50, 92], [62, 90], [54, 57], [38, 13], [98, 54], [81, 55], [32, 70], [77, 30], [41, 14], [41, 30], [77, 45], [39, 40], [7...
test_pop = [[14, 26], [74, 38], [68, 63], [7, 68], [26, 87], [34, 30], [33, 27], [36, 41], [8, 96], [15, 96], [57, 76], [6, 59], [36, 54], [79, 19], [50, 92], [62, 90], [54, 57], [38, 13], [98, 54], [81, 55], [32, 70], [77, 30], [41, 14], [41, 30], [77, 45], [39, 40], [71, 78], [88, 34], [31, 53], [44, 85], [44, 13], [...
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: ret = ListNode(0) cur = ret carry = 0 while l1 or l2: x,...
class Solution: def add_two_numbers(self, l1: ListNode, l2: ListNode) -> ListNode: ret = list_node(0) cur = ret carry = 0 while l1 or l2: (x, l1) = (l1.val, l1.next) if l1 else (0, None) (y, l2) = (l2.val, l2.next) if l2 else (0, None) sum = carry...
# -- Project information ----------------------------------------------------- project = u"Greetings" copyright = u"2021, James Hetherington" author = "James Hetherington" # The full version, including alpha/beta/rc tags release = "0.1" # -- General configuration --------------------------------------------------- ...
project = u'Greetings' copyright = u'2021, James Hetherington' author = 'James Hetherington' release = '0.1' extensions = ['sphinx.ext.autodoc', 'sphinx.ext.coverage', 'sphinx.ext.mathjax', 'sphinx.ext.viewcode', 'numpydoc'] templates_path = ['_templates'] exclude_patterns = ['Thumbs.db', '.DS_Store'] source_suffix = '...
# create by neurons_dict_create.py #release_note: add command for smart servo # Wed Sep 23 09:05:24 2020 general_command_request_dict = {'assign_id': {'type': 16, 'subtype': None, 1: 'BYTE', 'para_num': 1}, 'reset_block': {'type': 17, 'subtype': None, 'para_num': 0}, 'query_version': {'type': 18, 'subtype': Non...
general_command_request_dict = {'assign_id': {'type': 16, 'subtype': None, 1: 'BYTE', 'para_num': 1}, 'reset_block': {'type': 17, 'subtype': None, 'para_num': 0}, 'query_version': {'type': 18, 'subtype': None, 'para_num': 0}, 'set_baud_rate': {'type': 19, 'subtype': None, 1: 'BYTE', 'para_num': 1}, 'test_traffic': {'ty...
# -*- coding: utf-8 -*- class VocabFilter(): def __init__(self, vw_file): self.lower_bound = 0 self.upper_bound = 1000000 self.upper_bound_relative = 1000000 self.documents_count = 0 self.total_terms_count = 0 self.minimal_length = 1 self.vocab = dict() ...
class Vocabfilter: def __init__(self, vw_file): self.lower_bound = 0 self.upper_bound = 1000000 self.upper_bound_relative = 1000000 self.documents_count = 0 self.total_terms_count = 0 self.minimal_length = 1 self.vocab = dict() with open(vw_file, 'r',...
default_config = dict( content_dim=128, class_dim=256, content_std=1, content_decay=0.001, n_adain_layers=4, adain_dim=256, perceptual_loss=dict( layers=[2, 5, 8, 13, 18], weights=[1, 1, 1, 1, 1], scales=[64, ] ), train=dict( batch_size=64, n_epochs=10 ), train_encoders=dict( batch_size=64, ...
default_config = dict(content_dim=128, class_dim=256, content_std=1, content_decay=0.001, n_adain_layers=4, adain_dim=256, perceptual_loss=dict(layers=[2, 5, 8, 13, 18], weights=[1, 1, 1, 1, 1], scales=[64]), train=dict(batch_size=64, n_epochs=10), train_encoders=dict(batch_size=64, n_epochs=200))
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may...
__author__ = 'Shamal Faily' class Dataflow: def __init__(self, dfName, envName, fromName, fromType, toName, toType, dfAssets): self.theName = dfName self.theEnvironmentName = envName self.theFromName = fromName self.theFromType = fromType self.theToName = toName sel...
SEAL_CHECKER = 9300535 SEAL_OF_TIME = 2159367 if not sm.hasQuest(25673): sm.showFieldEffect("lightning/screenMsg/6") sm.createQuestWithQRValue(25673, "1", False) if sm.hasQuest(25670) and sm.hasQuest(25671) and sm.hasQuest(25672): sm.spawnMob(SEAL_CHECKER, -54, -80, False) sm.spawnNpc(SEAL_...
seal_checker = 9300535 seal_of_time = 2159367 if not sm.hasQuest(25673): sm.showFieldEffect('lightning/screenMsg/6') sm.createQuestWithQRValue(25673, '1', False) if sm.hasQuest(25670) and sm.hasQuest(25671) and sm.hasQuest(25672): sm.spawnMob(SEAL_CHECKER, -54, -80, False) sm.spawnNpc(SEAL_O...
def num_counts(n): counts = dict() while n > 0: r = n % 10 counts[r] = counts.get(r, 0) + 1 n //= 10 return counts def is_growing(n): digit = 9 while n > 0: current_digit = n % 10 if current_digit > digit: return False digit = current_dig...
def num_counts(n): counts = dict() while n > 0: r = n % 10 counts[r] = counts.get(r, 0) + 1 n //= 10 return counts def is_growing(n): digit = 9 while n > 0: current_digit = n % 10 if current_digit > digit: return False digit = current_digi...
name = "Hello this is python programing langauge system and design by satyam" data = {} for word in name.split(" "): if word[0] in data: data[word[0]].append(word) else: data[word[0]] = [word] print(data)
name = 'Hello this is python programing langauge system and design by satyam' data = {} for word in name.split(' '): if word[0] in data: data[word[0]].append(word) else: data[word[0]] = [word] print(data)
class Solution: def reverseBits(self, n: int) -> int: res = 0 for _ in range(32): res = (res<<1) | (n&1) n>>=1 return res
class Solution: def reverse_bits(self, n: int) -> int: res = 0 for _ in range(32): res = res << 1 | n & 1 n >>= 1 return res
def symbolsPermutation(a, b): return sorted(a) == sorted(b) if __name__ == '__main__': input0 = ["abc", "aaaa", "sutr", "kscsa", "imazpsni", "ekufzjmk", "seha", "beicgzwj", "nbimwm", "ryqa"] input1 = ["cab", "aaa", "cybk", "ncwxt", "kbyafemd", "chhmjxmy", "zims", "pazofnfl", "xwidkg", "ayrq"] expectedOutput = [Tru...
def symbols_permutation(a, b): return sorted(a) == sorted(b) if __name__ == '__main__': input0 = ['abc', 'aaaa', 'sutr', 'kscsa', 'imazpsni', 'ekufzjmk', 'seha', 'beicgzwj', 'nbimwm', 'ryqa'] input1 = ['cab', 'aaa', 'cybk', 'ncwxt', 'kbyafemd', 'chhmjxmy', 'zims', 'pazofnfl', 'xwidkg', 'ayrq'] expected_...
class Solution: # @param {integer} n # @return {integer} def countPrimes(self, n): primes = [0, 0] + [1] * (n-2) for i in xrange(2, n): if primes[i] == 0: continue for j in xrange(i+i, n, i): primes[j] = 0 return sum(primes)
class Solution: def count_primes(self, n): primes = [0, 0] + [1] * (n - 2) for i in xrange(2, n): if primes[i] == 0: continue for j in xrange(i + i, n, i): primes[j] = 0 return sum(primes)
#198. House Robber #213. House Robber II #198. House Robber def house_robber(nums): dp = [nums[0]]*len(nums) if len(nums) <= 1: return nums[0] for i in range(1, len(nums)): if i == 1: dp[i] = max(dp[0], nums[i]) else: dp[i] = max(dp[i-1], dp[i-2]+nums[i]) ...
def house_robber(nums): dp = [nums[0]] * len(nums) if len(nums) <= 1: return nums[0] for i in range(1, len(nums)): if i == 1: dp[i] = max(dp[0], nums[i]) else: dp[i] = max(dp[i - 1], dp[i - 2] + nums[i]) return max(dp) def rob_from(index, newList, dataTab...
# -*- coding: utf-8 -*- ''' Created on 04/11/2016 ''' class Function(object): ''' classdocs ''' def __init__(self): ''' Constructor ''' def function(self, x): self.y = (x**2.) - 3.0 return self.y # funcoes criadas para realizar testes dos metodos implement...
""" Created on 04/11/2016 """ class Function(object): """ classdocs """ def __init__(self): """ Constructor """ def function(self, x): self.y = x ** 2.0 - 3.0 return self.y def function1(self, x): self.y = 7.0 * x ** 3.0 - 3 * x ** 2.0 + 0.2 *...
class CastlingRights: def __init__(self, can_castle_kingside, can_castle_queenside): self.can_castle_kingside = can_castle_kingside self.can_castle_queenside = can_castle_queenside
class Castlingrights: def __init__(self, can_castle_kingside, can_castle_queenside): self.can_castle_kingside = can_castle_kingside self.can_castle_queenside = can_castle_queenside
PACKAGE_VERSION = '3.4.2' # version of the client package PROTOCOL_VERSION = '1.2' # protocol version requested # The hash of the mnemonic seed must begin with this SEED_PREFIX = '01' # Standard wallet def seed_prefix(seed_type): assert seed_type == 'standard' return SEED_PREFIX
package_version = '3.4.2' protocol_version = '1.2' seed_prefix = '01' def seed_prefix(seed_type): assert seed_type == 'standard' return SEED_PREFIX
with open("input", 'r') as f: lines = f.readlines() lines = [x.strip("\n") for x in lines] fields = dict() # for line in lines[0:3]: #input_test.1 for line in lines[0:20]: #input # for line in lines[0:3]: #input_test.2 print(line) fields[line.split(':')[0]] = [int(line.split(': ')[1].split(' or ')[0].split('-')[0]...
with open('input', 'r') as f: lines = f.readlines() lines = [x.strip('\n') for x in lines] fields = dict() for line in lines[0:20]: print(line) fields[line.split(':')[0]] = [int(line.split(': ')[1].split(' or ')[0].split('-')[0]), int(line.split(': ')[1].split(' or ')[0].split('-')[1]), int(line.split(': ')...
# -*- coding: utf-8 -*- def main(): n = int(input()) w = input().split() d = {'b': '1', 'c': '1', 'd': '2', 'w': '2', 't': '3', 'j': '3', 'f': '4', 'q': '4', 'l': '5', 'v': '5', 's': '6', 'x': '6', 'p': '7', 'm': '7', 'h': '8', 'k': '8', ...
def main(): n = int(input()) w = input().split() d = {'b': '1', 'c': '1', 'd': '2', 'w': '2', 't': '3', 'j': '3', 'f': '4', 'q': '4', 'l': '5', 'v': '5', 's': '6', 'x': '6', 'p': '7', 'm': '7', 'h': '8', 'k': '8', 'n': '9', 'g': '9', 'z': '0', 'r': '0'} ans = list() for wi in w: number = '' ...
def is_pangram(sentence: str) -> bool: sentence = sentence.lower() for c in range(ord('a'), ord('z') + 1): if sentence.count(chr(c)) == 0: return False return True
def is_pangram(sentence: str) -> bool: sentence = sentence.lower() for c in range(ord('a'), ord('z') + 1): if sentence.count(chr(c)) == 0: return False return True
a, op, b = input().split() a = int(a) b = int(b) if "+" in op: ans = a + b else: ans = a - b print(ans)
(a, op, b) = input().split() a = int(a) b = int(b) if '+' in op: ans = a + b else: ans = a - b print(ans)
def remove_dollar_sign(s): s = s.replace("$","") return s print(remove_dollar_sign("This is $$$100,000$$$"))
def remove_dollar_sign(s): s = s.replace('$', '') return s print(remove_dollar_sign('This is $$$100,000$$$'))
# This program finds the maximum value of a function # # The problem goes like this: # # A calculator company produces a scientific calculator and a graphing calculator. Long-term # projections indicate an expected demand of at least 100 scientifc and 80 graphic calculators each day. # Because of limitations on produc...
def profit(scientific, graphing): return -2 * scientific + 5 * graphing def searchmax(f, min_scientific, min_graphing, max_scientific, max_graphing, sum): pmax = -1000000000000.0 ps = -100 pg = -100 for s in range(min_scientific, max_scientific + 1): for g in range(min_graphing, max_graphin...
grid = [] flashes = 0 while True: try: line = [int(x) for x in input()] except: break grid.append(line) w = len(grid[0]) h = len(grid) r = 1 while True: flashes = 0 flashed = [[False for _ in range(w)] for _ in range(h)] to_flash = [] for j in range(h): for i in ra...
grid = [] flashes = 0 while True: try: line = [int(x) for x in input()] except: break grid.append(line) w = len(grid[0]) h = len(grid) r = 1 while True: flashes = 0 flashed = [[False for _ in range(w)] for _ in range(h)] to_flash = [] for j in range(h): for i in range...
class Message: def __init__(self,type,title,body): self.__type=type self.__title=title self.__body=body def __str__(self): return '{0}\n {1}\n {2}\n'.format("<b>"+self.__type+"</b>","<b>"+self.__title+"</b>",self.__body)
class Message: def __init__(self, type, title, body): self.__type = type self.__title = title self.__body = body def __str__(self): return '{0}\n {1}\n {2}\n'.format('<b>' + self.__type + '</b>', '<b>' + self.__title + '</b>', self.__body)
# # PySNMP MIB module ASCEND-MIBATMSIG-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASCEND-MIBATMSIG-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:10:35 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(configuration,) = mibBuilder.importSymbols('ASCEND-MIB', 'configuration') (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_inters...
# This file declares all the constants for used in this app MAIN_URL = 'https://api.github.com/repos/' LABEL_HELP_WANTED = '/issues?labels=help_wanted&per_page=100' LABEL_HELPWANTED = '/issues?labels=helpwanted&per_page=100' LABEL_HELP_ESPACE_WANTED = '/issues?labels=help%20wanted&per_page=100' LABEL_GOOD_FIRST_ISSUE ...
main_url = 'https://api.github.com/repos/' label_help_wanted = '/issues?labels=help_wanted&per_page=100' label_helpwanted = '/issues?labels=helpwanted&per_page=100' label_help_espace_wanted = '/issues?labels=help%20wanted&per_page=100' label_good_first_issue = '/issues?labels=good_first_issue&per_page=100' label_goodfi...
class Person: class_property = "This is Class Property" def __init__(self, name: str = None): self.message = "Behave like a constructor" self.name = name def public_method(self, integer_input: int) -> str: return "Integer Input: " + str(integer_input) def _private_method(self...
class Person: class_property = 'This is Class Property' def __init__(self, name: str=None): self.message = 'Behave like a constructor' self.name = name def public_method(self, integer_input: int) -> str: return 'Integer Input: ' + str(integer_input) def _private_method(self): ...
# # PySNMP MIB module NOKIA-COMMON-MIB-OID-REGISTRATION-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NOKIA-COMMON-MIB-OID-REGISTRATION-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:23:22 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 #...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, constraints_union, value_size_constraint, constraints_intersection) ...
TOOL_ISS = 'https://localhost' FO = {'example.com': 'https://example.com'} OA = {'example.org': 'https://example.org'} IA = {'cs.example.org': 'https://cs.example.org'} EO = {'example.org.op': 'https://example.org/op'} SMS_DEF = { }
tool_iss = 'https://localhost' fo = {'example.com': 'https://example.com'} oa = {'example.org': 'https://example.org'} ia = {'cs.example.org': 'https://cs.example.org'} eo = {'example.org.op': 'https://example.org/op'} sms_def = {}
with open("input.txt") as fp: instructions = [(line.strip('\n')[0], int(line.strip('\n')[1:])) for line in fp] moves = {'E': 1, 'W': -1, 'N': 1, 'S': -1, 'R': 1, 'L': -1} sides = 'ESWN' current_direction = 'E' current_coords = (0, 0) for instruction in instructions: if instruction[0] == '...
with open('input.txt') as fp: instructions = [(line.strip('\n')[0], int(line.strip('\n')[1:])) for line in fp] moves = {'E': 1, 'W': -1, 'N': 1, 'S': -1, 'R': 1, 'L': -1} sides = 'ESWN' current_direction = 'E' current_coords = (0, 0) for instruction in instructions: if instruction[0] == 'F': instruction...
total_legs = 94 total_heads = 35 for hens in range(1,total_heads): goats = 35-hens if 2*hens + 4*goats == total_legs: print("Hens : {}\nGoats : {}".format(hens,goats))
total_legs = 94 total_heads = 35 for hens in range(1, total_heads): goats = 35 - hens if 2 * hens + 4 * goats == total_legs: print('Hens : {}\nGoats : {}'.format(hens, goats))
hi = [[1, 1, 1, 1], [1, 1, 1, 1]] check = [str(set(x)) for x in hi] print(set(check))
hi = [[1, 1, 1, 1], [1, 1, 1, 1]] check = [str(set(x)) for x in hi] print(set(check))
def sorted_manuscript_scores_descending(manuscript_scores_list): return list(reversed(sorted(manuscript_scores_list, key=lambda score: ( score['combined'] or 0, score['keyword'] or 0, score['similarity'] or 0 ))))
def sorted_manuscript_scores_descending(manuscript_scores_list): return list(reversed(sorted(manuscript_scores_list, key=lambda score: (score['combined'] or 0, score['keyword'] or 0, score['similarity'] or 0))))
input() s = 0 d = [1]*1001 n = input().split(' ') n = [int(i) for i in n] for i in range(len(n)): for j in range(0, i): if n[j] > n[i]: d[i] = max(d[i], d[j] + 1) s = max(s, d[i]) print(s)
input() s = 0 d = [1] * 1001 n = input().split(' ') n = [int(i) for i in n] for i in range(len(n)): for j in range(0, i): if n[j] > n[i]: d[i] = max(d[i], d[j] + 1) s = max(s, d[i]) print(s)
currentScene = None def init(): global currentScene currentScene = None
current_scene = None def init(): global currentScene current_scene = None
x = input() A = int(x[0]) B = int(x[1]) C = int(x[2]) D = int(x[3]) def cal(a, b, opx): if opx == "+": return a + b else: return a - b op = ["+", "-"] result = "" for op1 in op: for op2 in op: for op3 in op: if cal(cal(cal(A, B, op1),C, op2), D, op3) == 7: ...
x = input() a = int(x[0]) b = int(x[1]) c = int(x[2]) d = int(x[3]) def cal(a, b, opx): if opx == '+': return a + b else: return a - b op = ['+', '-'] result = '' for op1 in op: for op2 in op: for op3 in op: if cal(cal(cal(A, B, op1), C, op2), D, op3) == 7: ...
''' Aim: To replace the first character of all the words with their upper case characters. ''' # Complete the solve function below. def solve(s): # splitting the string into words for x in s[:].split(): # replacing the character with it's capital form s = s.replace(x, x.capitalize()) print...
""" Aim: To replace the first character of all the words with their upper case characters. """ def solve(s): for x in s[:].split(): s = s.replace(x, x.capitalize()) print('Updated string:', s) s = input('Enter string: ') solve(s) '\nCOMPLEXITY:\n\t\n\t Time Complexity -> O(N)\n\t Space Complexity -> O...
config = { 'data_path': '../dataset', 'test_data_path': '../dataset_test', 'model_path': '../model/CNN_epoch', ##### '../model/res18_epoch', '../model/wasteCNN_epoch', '../model/CNN_epoch' # 'preprocess_result_path': '', 'image_size': 128, # 256 'batch_size': 32, # 'test_percentage': 0.2, ...
config = {'data_path': '../dataset', 'test_data_path': '../dataset_test', 'model_path': '../model/CNN_epoch', 'image_size': 128, 'batch_size': 32, 'val_percentage': 0.2, 'lr': 0.001, 'epoch': 50, 'classifier_model': 'model'}
class Solution: def findWords(self, words): keybord = [ "qwertyuiop", "asdfghjkl", "zxcvbnm", ] helper = [] for word in words: for line in keybord: is_in_one = True for i in word: if ...
class Solution: def find_words(self, words): keybord = ['qwertyuiop', 'asdfghjkl', 'zxcvbnm'] helper = [] for word in words: for line in keybord: is_in_one = True for i in word: if i.lower() not in line: ...
# Task 02. Calculations def calculations(operation, first_operand, second_operand): operations = { 'multiply': first_operand * second_operand, 'divide': first_operand // second_operand, 'add': first_operand + second_operand, 'subtract': first_operand - second_operand } retur...
def calculations(operation, first_operand, second_operand): operations = {'multiply': first_operand * second_operand, 'divide': first_operand // second_operand, 'add': first_operand + second_operand, 'subtract': first_operand - second_operand} return operations[operation] input_operator = input() first_int = in...
dataset_type = 'CityscapesVPSDataset' data_root = 'data/cityscapes_vps/' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) train_pipeline = [ dict(type='LoadRefImageFromFile'), dict(type='LoadAnnotations', with_bbox=True, with_mask=True, with_seg=True, wi...
dataset_type = 'CityscapesVPSDataset' data_root = 'data/cityscapes_vps/' img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) train_pipeline = [dict(type='LoadRefImageFromFile'), dict(type='LoadAnnotations', with_bbox=True, with_mask=True, with_seg=True, with_pid=True, semantic2...
class divisibleBySeven: global start global end def __init__(object): object.start = 2000 object.end = 3200 def divisibleCheck(object): i = 2000 list1 = [] while i <= 3200: if(i%7 == 0): if(i%5 != 0): list1.append...
class Divisiblebyseven: global start global end def __init__(object): object.start = 2000 object.end = 3200 def divisible_check(object): i = 2000 list1 = [] while i <= 3200: if i % 7 == 0: if i % 5 != 0: list1.appe...
# -*- coding: utf-8 -*- def main(): s = input() n = int(input()) for i in range(n): left, right = map(int, input().split()) partly_s = s[left - 1:right] s = s[:left - 1] + partly_s[::-1] + s[right:] print(s) if __name__ == '__main__': main()
def main(): s = input() n = int(input()) for i in range(n): (left, right) = map(int, input().split()) partly_s = s[left - 1:right] s = s[:left - 1] + partly_s[::-1] + s[right:] print(s) if __name__ == '__main__': main()
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2019, Varun Chopra (@chopraaa) <v@chopraaa.com> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ANSIBLE_METADATA = { 'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community' } DOCU...
ansible_metadata = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} documentation = "\nmodule: win_format\nversion_added: '2.8'\nshort_description: Formats an existing volume or a new volume on an existing partition on Windows\ndescription:\n - The M(win_format) module formats an existin...
#!/usr/bin/python3 with open("flag-1.png", "rb") as fin: flag_bytes = fin.read() fh = open("Block_dev.img", "r+b") fh.seek(int(0x17d75c0)) # code cave on disk to dump data to fh.write(flag_bytes) fh.close()
with open('flag-1.png', 'rb') as fin: flag_bytes = fin.read() fh = open('Block_dev.img', 'r+b') fh.seek(int(24999360)) fh.write(flag_bytes) fh.close()
def shell_escape(s): repl = ('\\', '|', '&', ';', '(', ')', '<', '>', ' ', '\t', '\n', '$', "'", '"', "`") # (note, \\ must be first!) for x in repl: s = s.replace(x, '\\'+x) return s # escape a string that will appear inside double-quotes. def shell_escape_inside_quotes(s): rep...
def shell_escape(s): repl = ('\\', '|', '&', ';', '(', ')', '<', '>', ' ', '\t', '\n', '$', "'", '"', '`') for x in repl: s = s.replace(x, '\\' + x) return s def shell_escape_inside_quotes(s): repl = ('\\', '\t', '`', '"', '$') for x in repl: s = s.replace(x, '\\' + x) return s
x, y, z = 50, 20, 50 if x <= y <= z: print(x, y, z) elif x <= z <= y: print(x, z, y) elif y <= x <= z: print(y, x, z) elif y <= z <= x: print(y, z, x) elif z <= x <= y: print(z, x, y) else: print(z, y, x) # abc # acb # bac # bca # cab # cbc
(x, y, z) = (50, 20, 50) if x <= y <= z: print(x, y, z) elif x <= z <= y: print(x, z, y) elif y <= x <= z: print(y, x, z) elif y <= z <= x: print(y, z, x) elif z <= x <= y: print(z, x, y) else: print(z, y, x)
# Ouverture du fichier prenoms.txt f = open('input/prenoms.txt', 'r') #liste_prenoms=[] for line in f: print(line) # liste_prenoms.append(line.strip()) #la fonction .strip() permet de retirer le '\n' dans la liste # print(liste_prenoms) # Fermeture du fichier prenoms.txt f.close()
f = open('input/prenoms.txt', 'r') for line in f: print(line) f.close()
class Node: def __init__(self, value): self.value = value self.left = None self.right = None class BST: def __init__(self, root_val): self.root = Node(root_val) def insert(self, value): newnode = Node(value) if self.root==None: self.root = ne...
class Node: def __init__(self, value): self.value = value self.left = None self.right = None class Bst: def __init__(self, root_val): self.root = node(root_val) def insert(self, value): newnode = node(value) if self.root == None: self.root = ne...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright (C) 2020 The Project U-Ray Authors. # # Use of this source code is governed by a ISC-style # license that can be found in the LICENSE file or at # https://opensource.org/licenses/ISC # # SPDX-License-Identifier: ISC def ones(l): #return l + [x + '_1' f...
def ones(l): ret = [] for x in l: ret.append(x) ret.append(x + '_1') return ret ffprims_fall = ones(['FD', 'FDC', 'FDCE', 'FDE', 'FDP', 'FDPE', 'FDR', 'FDRE', 'FDS', 'FDSE']) ffprims_lall = ones(['LDC', 'LDCE', 'LDE', 'LDPE', 'LDP']) ffprims_f = ['FDRE', 'FDSE', 'FDCE', 'FDPE'] ffprims_l = [...
class Calculator: @staticmethod def add(*args): return sum(args) @staticmethod def multiply(*args): result = 1 for arg in args: result *= arg return result @staticmethod def divide(initial, *args): result = initial for arg in args: ...
class Calculator: @staticmethod def add(*args): return sum(args) @staticmethod def multiply(*args): result = 1 for arg in args: result *= arg return result @staticmethod def divide(initial, *args): result = initial for arg in args: ...
a="Programmer" c=0 z=0 x="" for i in range(len(a)): if a[i]=="r": c=c+1 if a[i]=="g": z=i-1 if a[i]!="m": x=x+a[i] else: x=x+"Y" print("occurence of "r":",c) print("position of g:",z) print("replaced string",x)
a = 'Programmer' c = 0 z = 0 x = '' for i in range(len(a)): if a[i] == 'r': c = c + 1 if a[i] == 'g': z = i - 1 if a[i] != 'm': x = x + a[i] else: x = x + 'Y' print('occurence of :', c) print('position of g:', z) print('replaced string', x)
test = True if test: READ_COMMAND = 'start echo "read for address: {}"' SEND_COMMAND = 'start echo Sender: {} Message: {} Receiver: {}' else: READ_COMMAND = "signal-cli -u {} receive" SEND_COMMAND = "signal-cli -u {} send -m '{}' {}"
test = True if test: read_command = 'start echo "read for address: {}"' send_command = 'start echo Sender: {} Message: {} Receiver: {}' else: read_command = 'signal-cli -u {} receive' send_command = "signal-cli -u {} send -m '{}' {}"
class BaseObject(object): def __init__(self, **kwargs): self.__dict__.update(**kwargs) def save(self): raise NotImplementedError def delete(self): raise NotImplementedError @classmethod def create(cls, **kwargs): item = cls(**kwargs) item.save() re...
class Baseobject(object): def __init__(self, **kwargs): self.__dict__.update(**kwargs) def save(self): raise NotImplementedError def delete(self): raise NotImplementedError @classmethod def create(cls, **kwargs): item = cls(**kwargs) item.save() re...
set1 = {"green", "red", "blue", "red"} # Create a set print(set1) set2 = set([7, 1, 2, 23, 2, 4, 5]) # Create a set from a list print(set2) print("Is red in set1?", "red" in set1) print("length is", len(set2)) # Use function len print("max is", max(set2)) # Use max print("min is", min(set2)) # Use min print("su...
set1 = {'green', 'red', 'blue', 'red'} print(set1) set2 = set([7, 1, 2, 23, 2, 4, 5]) print(set2) print('Is red in set1?', 'red' in set1) print('length is', len(set2)) print('max is', max(set2)) print('min is', min(set2)) print('sum is', sum(set2)) set3 = set1 | {'green', 'yellow'} print(set3) set3 = set1 - {'green', '...
class Property: def __init__(self, x=None, square=None, cubic=None): self.x = x self.square = square self.cubic = cubic @staticmethod def prompt_init(x): square = x ** 2 cubic = x ** 3 return Property(x, square, cubic) def __repr__(self): return ...
class Property: def __init__(self, x=None, square=None, cubic=None): self.x = x self.square = square self.cubic = cubic @staticmethod def prompt_init(x): square = x ** 2 cubic = x ** 3 return property(x, square, cubic) def __repr__(self): return...