content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
######################################## # QUESTION ######################################## # The goal of this exercise is to convert a string to a new string where each character in the new string is "(" if that character appears only once in the original string, or ")" if that character appears more than once in th...
def duplicate_encode(word): x = list(word.lower()) u = [] for k in x: if x.count(k) == 1: u.append('(') elif x.count(k) > 1: u.append(')') j = '' for k in u: j += k return j
try: None < 0 def NoneAndDictComparable(v): return v except TypeError: # comparator to allow comparisons against None and dict # comparisons (these were allowed in Python 2, but aren't allowed # in Python 3 any more) class NoneAndDictComparable(object): def __init__(self, value)...
try: None < 0 def none_and_dict_comparable(v): return v except TypeError: class Noneanddictcomparable(object): def __init__(self, value): self.value = value def __cmp__(self, other): if not isinstance(other, self.__class__): raise type_erro...
# pylint: disable=W0613, C0111, C0103, C0301 """ The software package. version: 4.1 ExtronLibraray version: 3.1r5 ControlScript version: 3.1.8 GlobalScripter version: 2.1.0.116 Release date: 13.11.2018 Author: Roni Starc (roni.starc@gmail.com) ChangeLog: v2.0 - Fixed some mistakes, updated GS v2.8.r3, a...
""" The software package. version: 4.1 ExtronLibraray version: 3.1r5 ControlScript version: 3.1.8 GlobalScripter version: 2.1.0.116 Release date: 13.11.2018 Author: Roni Starc (roni.starc@gmail.com) ChangeLog: v2.0 - Fixed some mistakes, updated GS v2.8.r3, added description texts for the entire library v3.0 - Updat...
class Transect: def __init__(self, name="Transect", files=[]): self.name = name self.files = files @property def numFiles(self): return len(self.files) @property def firstLastText(self): first = self.files[0] last = self.files[-1] return f"{first.nam...
class Transect: def __init__(self, name='Transect', files=[]): self.name = name self.files = files @property def num_files(self): return len(self.files) @property def first_last_text(self): first = self.files[0] last = self.files[-1] return f'{first...
def fib(n): if n == 0 or n == 1: return 1 else: answer = fib(n-1) + fib(n-2) return answer def memoise(f): memo = {} def g(n): if n in memo: return memo[n] else: answer = f(n) memo[n] = answer return answer re...
def fib(n): if n == 0 or n == 1: return 1 else: answer = fib(n - 1) + fib(n - 2) return answer def memoise(f): memo = {} def g(n): if n in memo: return memo[n] else: answer = f(n) memo[n] = answer return answer ...
f = open('input.txt') time = int(f.readline()[:-1]) busses = [[int(bus), i] for i, bus in enumerate(f.readline()[:-1].split(',')) if bus != 'x'] product = 1 for bus in busses: product *= bus[0] res = 0 for bus in busses: l = product / bus[0] % bus[0] k = 1 tmp = l while l % bus[0] != 1: ...
f = open('input.txt') time = int(f.readline()[:-1]) busses = [[int(bus), i] for (i, bus) in enumerate(f.readline()[:-1].split(',')) if bus != 'x'] product = 1 for bus in busses: product *= bus[0] res = 0 for bus in busses: l = product / bus[0] % bus[0] k = 1 tmp = l while l % bus[0] != 1: k ...
filepath = '/Users/royce/Dropbox/Documents/Memorize/web/blank.txt' with open(filepath, 'r') as f: card_count = 0 card = "" do_skip = False template = """@Tags: {} {} {} """ for line in f: in_html5 = 'Not supported in HTML5' not in line if line.strip(' ') != "\n": ...
filepath = '/Users/royce/Dropbox/Documents/Memorize/web/blank.txt' with open(filepath, 'r') as f: card_count = 0 card = '' do_skip = False template = '@Tags: {}\n{}\n\n{}\n\n' for line in f: in_html5 = 'Not supported in HTML5' not in line if line.strip(' ') != '\n': if no...
# # PySNMP MIB module ALCATEL-IND1-IPX-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALCATEL-IND1-IPX-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:18:07 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(routing_ind1_ipx,) = mibBuilder.importSymbols('ALCATEL-IND1-BASE', 'routingIND1Ipx') (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constra...
def importEXPH(fdata): ENCHVM = dict() MOTORI = dict() cline = 3 while cline < len(fdata): coduhe = fdata[cline][0:5].strip() nome = fdata[cline][5:18].strip() if fdata[cline][17:43].strip(): # Enchimento de Volume Morto iniench = fdata[cline][17:26].strip...
def import_exph(fdata): enchvm = dict() motori = dict() cline = 3 while cline < len(fdata): coduhe = fdata[cline][0:5].strip() nome = fdata[cline][5:18].strip() if fdata[cline][17:43].strip(): iniench = fdata[cline][17:26].strip() durmeses = fdata[cline][2...
with open('Chal08.txt','r') as f: sum = 0 for i in f.readlines(): i = i.strip().split(' | ') output = i[1].split() for i in output: if len(i) == 2 or len(i) == 4 or len(i) == 3 or len(i) == 7: sum += 1 print(sum)
with open('Chal08.txt', 'r') as f: sum = 0 for i in f.readlines(): i = i.strip().split(' | ') output = i[1].split() for i in output: if len(i) == 2 or len(i) == 4 or len(i) == 3 or (len(i) == 7): sum += 1 print(sum)
# -*- coding: utf-8 -*- """ Created on Sun Sep 1 19:39:48 2019 @author: amukher3 """ def remove_smallest(numbers): a=numbers[:] if a ==[]: return a else: a.remove(min(a)) return a
""" Created on Sun Sep 1 19:39:48 2019 @author: amukher3 """ def remove_smallest(numbers): a = numbers[:] if a == []: return a else: a.remove(min(a)) return a
class Solution(object): def maxProfit(self, prices): """ :type prices: List[int] :rtype: int """ if not prices: return 0 ans = 0 pre = prices[0] for i in range(1, len(prices)): pre = min(pre, prices[i]) a...
class Solution(object): def max_profit(self, prices): """ :type prices: List[int] :rtype: int """ if not prices: return 0 ans = 0 pre = prices[0] for i in range(1, len(prices)): pre = min(pre, prices[i]) ans = max(p...
#!/usr/bin/python # This file is used as a global config file while PCBmodE is running. # DO NOT EDIT THIS FILE cfg = {} # PCBmodE configuration brd = {} # board data stl = {} # style data pth = {} # path database msg = {} # message database stk = {} # stackup data
cfg = {} brd = {} stl = {} pth = {} msg = {} stk = {}
# -*- coding: utf-8 -*- """ [memo.py] Memory Use Illustration Plugin [Author] Abdur-Rahmaan Janhangeer, pythonmembers.club [About] responds to .memo, demo of a basic memory plugin [Commands] >>> .memo add <key> <value> >>> .memo rem <key> >>> .memo fetch <key> """ class Plugin: def __init__(self): pass...
""" [memo.py] Memory Use Illustration Plugin [Author] Abdur-Rahmaan Janhangeer, pythonmembers.club [About] responds to .memo, demo of a basic memory plugin [Commands] >>> .memo add <key> <value> >>> .memo rem <key> >>> .memo fetch <key> """ class Plugin: def __init__(self): pass def run(self, inco...
"""Blacklist particular articles from doing particular activities""" def publication_email_article_do_not_send_list(): """ Return list of do not send article DOI id """ do_not_send_list = [ "00003", "00005", "00007", "00011", "00012", "00013", "00031", "00036", "00047", "00048", "00049...
"""Blacklist particular articles from doing particular activities""" def publication_email_article_do_not_send_list(): """ Return list of do not send article DOI id """ do_not_send_list = ['00003', '00005', '00007', '00011', '00012', '00013', '00031', '00036', '00047', '00048', '00049', '00051', '00065...
class JSONDL(object): def __init__(self, jsondl_url=None, jsondl_data=None): pass def __attrMethod(self, method): class MethodCaller(object): #TODO: This implementation is horrible improve both code and apijson def __init__(self, ssp_instance, method): ...
class Jsondl(object): def __init__(self, jsondl_url=None, jsondl_data=None): pass def __attr_method(self, method): class Methodcaller(object): def __init__(self, ssp_instance, method): self.ssp_instance = ssp_instance api_instance = self.ssp_instan...
f = open("input", "r").read() f = f[:-1] # remove trailing char floor = 0 position = 1 entered_basement = False for i in f: if i == '(': floor = floor + 1 else: floor = floor - 1 if (floor < 0) and (entered_basement == False): print('entering basement on move ' + str(position)) ...
f = open('input', 'r').read() f = f[:-1] floor = 0 position = 1 entered_basement = False for i in f: if i == '(': floor = floor + 1 else: floor = floor - 1 if floor < 0 and entered_basement == False: print('entering basement on move ' + str(position)) entered_basement = True ...
def generate_instance_identity_document(instance): return { "instanceId": instance.id, }
def generate_instance_identity_document(instance): return {'instanceId': instance.id}
# iterating over a list print('-- list --') a = [1,2,3,4,5] for x in a: print(x) # iterating over a tuple print('-- tuple --') a = ('cats','dogs','squirrels') for x in a: print(x) # iterating over a dictionary # sort order in python is undefined, so need to sort the results # explictly before comparing output...
print('-- list --') a = [1, 2, 3, 4, 5] for x in a: print(x) print('-- tuple --') a = ('cats', 'dogs', 'squirrels') for x in a: print(x) print('-- dict keys --') a = {'a': 1, 'b': 2, 'c': 3} keys = [] for x in a.keys(): keys.append(x) keys.sort() for k in keys: print(k) print('-- dict values --') values...
def _get_combined_method(method_list): def new_func(*args, **kwargs): [m(*args, **kwargs) for m in method_list] return new_func def component_method(func): """ method decorator """ func._is_component_method = True return func class Component(object): """ data descriptor """ _is_com...
def _get_combined_method(method_list): def new_func(*args, **kwargs): [m(*args, **kwargs) for m in method_list] return new_func def component_method(func): """ method decorator """ func._is_component_method = True return func class Component(object): """ data descriptor """ _is_co...
# Se define la clase "piso" con 4 atributos class piso(): numero = 0 escalera = '' ventanas = 0 cuartos = 0 # Se le da la funcion "timbre" a cada piso def timbre(self): print("ding dong") # __init__ se usa para "llenar" los 4 atributos preestablecidos def __init__(s...
class Piso: numero = 0 escalera = '' ventanas = 0 cuartos = 0 def timbre(self): print('ding dong') def __init__(self, numero, ventanas, escaleras, cuartos): self.numero = numero self.ventanas = ventanas self.escaleras = escaleras self.cuartos = cuartos ...
''' Blockchain Backup version. Copyright 2020-2022 DeNova Last modified: 2022-02-01 ''' CURRENT_VERSION = '1.3.5'
""" Blockchain Backup version. Copyright 2020-2022 DeNova Last modified: 2022-02-01 """ current_version = '1.3.5'
for i in range(1, 5): print(" "*(4-i), end="") for j in range(1, 2*i): print("*", end="") print() for i in range(1, 4): print(" "*(i), end="") for j in range(7-2*i): print("*", end="") print()
for i in range(1, 5): print(' ' * (4 - i), end='') for j in range(1, 2 * i): print('*', end='') print() for i in range(1, 4): print(' ' * i, end='') for j in range(7 - 2 * i): print('*', end='') print()
class Lint: def __init__(self, file): pass
class Lint: def __init__(self, file): pass
def sort(keys): _sort(keys, 0, len(keys)-1, 0) def _sort(keys, lo, hi, start): if hi <= lo: return lt = lo gt = hi v = get_r(keys[lt], start) i = lt + 1 while i <= gt: c = get_r(keys[i], start) if c < v: keys[lt], keys[i] = keys[i], keys[lt] ...
def sort(keys): _sort(keys, 0, len(keys) - 1, 0) def _sort(keys, lo, hi, start): if hi <= lo: return lt = lo gt = hi v = get_r(keys[lt], start) i = lt + 1 while i <= gt: c = get_r(keys[i], start) if c < v: (keys[lt], keys[i]) = (keys[i], keys[lt]) ...
#!/usr/bin/python #coding = utf-8 class average: """ This is the base class of average. Inherit from this class will make attribute into the average version. """ def __init__(self,numberOfSamplesNum): self.numberOfSamples = numberOfSamplesNum def setNumberOfSamples(self,numberOfSamples...
class Average: """ This is the base class of average. Inherit from this class will make attribute into the average version. """ def __init__(self, numberOfSamplesNum): self.numberOfSamples = numberOfSamplesNum def set_number_of_samples(self, numberOfSamplesNum): self.numberOfSa...
c = get_config() # Add users here that are allowed admin access to JupyterHub. c.Authenticator.admin_users = ["instructor1"] # Add users here that are allowed to login to JupyterHub. c.Authenticator.whitelist = [ "instructor1", "instructor2", "student1", "student2", "student3" ]
c = get_config() c.Authenticator.admin_users = ['instructor1'] c.Authenticator.whitelist = ['instructor1', 'instructor2', 'student1', 'student2', 'student3']
# -*- coding: utf-8 -*- HOST = '0.0.0.0' PORT = 4999 DEBUG = 'true' APP_NAME = 'DingDing' DOMAIN = 'https://oapi.dingtalk.com/'
host = '0.0.0.0' port = 4999 debug = 'true' app_name = 'DingDing' domain = 'https://oapi.dingtalk.com/'
class Movie: def __init__(self, movie_id, category, title, genres, year, minutes, language, actors, director, imdb): self.id = movie_id self.category = category self.title = title self.genres = genres self.year = year self.minutes = minutes self.language = lan...
class Movie: def __init__(self, movie_id, category, title, genres, year, minutes, language, actors, director, imdb): self.id = movie_id self.category = category self.title = title self.genres = genres self.year = year self.minutes = minutes self.language = la...
#!/usr/bin/env python3 operations = { 'a': lambda a, b : a+b, 's': lambda a, b : a-b, 'm': lambda a, b : a*b, 'd': lambda a, b : a/b, } data = [ ['a', 4, 5], ['d', 0, 3], ['m', 4, 8], ['s', 1, 4], ] [el.append(operations[el[0]](el[1], el[2])) for el in...
operations = {'a': lambda a, b: a + b, 's': lambda a, b: a - b, 'm': lambda a, b: a * b, 'd': lambda a, b: a / b} data = [['a', 4, 5], ['d', 0, 3], ['m', 4, 8], ['s', 1, 4]] [el.append(operations[el[0]](el[1], el[2])) for el in data] [print(el) for el in data]
# -*- coding: utf-8 -*- __version__ = '3.0.0' __description__ = 'Password generator to generate a password based\ on the specified pattern.' __author__ = 'rgb-24bit' __author_email__ = 'rgb-24bit@foxmail.com' __license__ = 'MIT' __copyright__ = 'Copyright 2018 - 2019 rgb-24bit'
__version__ = '3.0.0' __description__ = 'Password generator to generate a password basedon the specified pattern.' __author__ = 'rgb-24bit' __author_email__ = 'rgb-24bit@foxmail.com' __license__ = 'MIT' __copyright__ = 'Copyright 2018 - 2019 rgb-24bit'
class C2: pass class C3: pass class C1(C2, C3): print("passing") class C1(C2, C3): """ If a class wants to guarantee that an attribute like name is always set in its instances, it more typically will fill out the attribute at construction time, like this: """ def __init__(self, who): # Set name when constructe...
class C2: pass class C3: pass class C1(C2, C3): print('passing') class C1(C2, C3): """ If a class wants to guarantee that an attribute like name is always set in its instances, it more typically will fill out the attribute at construction time, like this: """ def __init__(self, who): ...
def post_register_types(root_module): root_module.add_include('"ns3/propagation-module.h"')
def post_register_types(root_module): root_module.add_include('"ns3/propagation-module.h"')
class Cache(dict): def __init__(self): self['test_key'] = 'test_value'
class Cache(dict): def __init__(self): self['test_key'] = 'test_value'
def friends(n): arr = [0 for i in range(n + 1)] i = 0 while n+1 != 0: if i <= 2: arr[i] = i else: arr[i] = arr[i - 1] + (i - 1) * arr[i - 2] i += 1 n -= 1 return arr[n] if __name__ == '__main__': ## n = 1 ## n...
def friends(n): arr = [0 for i in range(n + 1)] i = 0 while n + 1 != 0: if i <= 2: arr[i] = i else: arr[i] = arr[i - 1] + (i - 1) * arr[i - 2] i += 1 n -= 1 return arr[n] if __name__ == '__main__': n = 10 print(friends(n))
'''https://leetcode.com/problems/n-queens/''' class Solution: def solveNQueens(self, n: int) -> List[List[str]]: board = [['.' for _ in range(n)] for _ in range(n)] ans = [] def placeQ(row, col): board[row][col] = 'Q' def removeQ(row, col): board...
"""https://leetcode.com/problems/n-queens/""" class Solution: def solve_n_queens(self, n: int) -> List[List[str]]: board = [['.' for _ in range(n)] for _ in range(n)] ans = [] def place_q(row, col): board[row][col] = 'Q' def remove_q(row, col): board[row][...
# Review: # Create a function called greet(). # Write 3 print statements inside the function. # Call the greet() function and run your code. name = input("What's your name? ") location = input("Where are you from? ") def greet(name, location): print(f"Hello Mr.{name}") print(f"{location} is a nice place!") ...
name = input("What's your name? ") location = input('Where are you from? ') def greet(name, location): print(f'Hello Mr.{name}') print(f'{location} is a nice place!') greet(name, location) greet(location=location, name=name)
# Licensed to Elasticsearch B.V. under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright # ownership. Elasticsearch B.V. licenses this file to you under # the Apache License, Version 2.0 (the "License"); you may # not use ...
class Testdataframedrop: def test_drop(self, df): df.drop(['Carrier', 'DestCityName'], axis=1) df.drop(columns=['Carrier', 'DestCityName']) df.drop(['1', '2']) df.drop(['1', '2'], axis=0) df.drop(index=['1', '2']) def test_drop_all_columns(self, df): all_columns...
# Basic Structure for Stack using Linked List class Node: def __init__(self,data): self.data = data self.next = None class Stack: def __init__(self): self.head = None def is_empty(self): if self.head == None: return True else: return False ...
class Node: def __init__(self, data): self.data = data self.next = None class Stack: def __init__(self): self.head = None def is_empty(self): if self.head == None: return True else: return False def push(self, data): if not sel...
# Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. # # WSO2 Inc. licenses this file to you 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/...
def encode_field(value, encode_function=str): """ Encodes a field value using encode_function :param value: :param encode_function: :return: """ if value is None: return None return encode_function(value) def decode_field(value, decode_function): """ Decodes a field v...
class Node(object): def __init__(self, *contents): self.contents = contents def __repr__(self): return "<{0} {1}>".format(self.__class__.__name__, ', '.join(map(repr, self.contents))) def __eq__(self, other): same_class = (isinstance(other, self.__...
class Node(object): def __init__(self, *contents): self.contents = contents def __repr__(self): return '<{0} {1}>'.format(self.__class__.__name__, ', '.join(map(repr, self.contents))) def __eq__(self, other): same_class = isinstance(other, self.__class__) or isinstance(self, other...
SEED_LIMIT = 20 MAX_PAGES_PER_SITE = 35 MAX_LOGICAL_DEPTH = 3 MAX_PHYSICAL_DEPTH = 3 TOTAL_MAX_PAGES = 500
seed_limit = 20 max_pages_per_site = 35 max_logical_depth = 3 max_physical_depth = 3 total_max_pages = 500
formdata = { 'deposittype': "", 'dates': {}, 'dissertation': { 'degreename': { 'Doctor of Musical Arts (DMA)', 'Doctor of Education (EDD)', 'Doctor of Philosophy (PhD)' }, 'degreetype': { 'dissertation': 'Dissertation', ...
formdata = {'deposittype': '', 'dates': {}, 'dissertation': {'degreename': {'Doctor of Musical Arts (DMA)', 'Doctor of Education (EDD)', 'Doctor of Philosophy (PhD)'}, 'degreetype': {'dissertation': 'Dissertation', 'essay': 'Doctoral Essay', 'treatise': 'Doctoral Treatise', 'lecture': 'Lecture Recital Essay'}, 'degrees...
def txttolist(filename): """Takes a txt file and makes a list with each line being an element""" return [line.split("\n")[0] for line in open(filename, "r")] def isstrlessthan(string, length): """Checks if string is below length""" return len(string) < length def errormsg(e): """Generates an error...
def txttolist(filename): """Takes a txt file and makes a list with each line being an element""" return [line.split('\n')[0] for line in open(filename, 'r')] def isstrlessthan(string, length): """Checks if string is below length""" return len(string) < length def errormsg(e): """Generates an error...
# Copyright (c) 2018 Gennadii Donchyts. All rights reserved. # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. # Contributors: # * 2018-08-01: Fedor Baart (f.baart@gmail.com) - added cmocean # * 2019-01-18: Justin Braaten (jstnbraaten@gmail.com) - ...
cmocean = {'Thermal': {'7': ['042333', '2c3395', '744992', 'b15f82', 'eb7958', 'fbb43d', 'e8fa5b']}, 'Haline': {'7': ['2a186c', '14439c', '206e8b', '3c9387', '5ab978', 'aad85c', 'fdef9a']}, 'Solar': {'7': ['331418', '682325', '973b1c', 'b66413', 'cb921a', 'dac62f', 'e1fd4b']}, 'Ice': {'7': ['040613', '292851', '3f4b96'...
valor = input().split(" ") a, b, c = valor maiorAB = ((int(a) + int(b)) + abs(int(a) - int(b)))/2 maiorAC = ((int(a) + int(c)) + abs(int(a) - int(c)))/2 maior = ((maiorAB + maiorAC) + abs(maiorAB - maiorAC))/2 print("%d eh o maior" % maior)
valor = input().split(' ') (a, b, c) = valor maior_ab = (int(a) + int(b) + abs(int(a) - int(b))) / 2 maior_ac = (int(a) + int(c) + abs(int(a) - int(c))) / 2 maior = (maiorAB + maiorAC + abs(maiorAB - maiorAC)) / 2 print('%d eh o maior' % maior)
''' Dutch National Flag Problem Given an input array consisting on only 0, 1, and 2, sort the array in a single traversal. You're not allowed to use any sorting function that Python provides. Note: O(n) does not necessarily mean single-traversal. For e.g. if you traverse the array twice, that would still be an O(n) so...
""" Dutch National Flag Problem Given an input array consisting on only 0, 1, and 2, sort the array in a single traversal. You're not allowed to use any sorting function that Python provides. Note: O(n) does not necessarily mean single-traversal. For e.g. if you traverse the array twice, that would still be an O(n) so...
""" Copyright (c) 2020, The Decred developers See LICENSE for details. mainnet holds mainnet parameters. Any values should mirror exactly https://github.com/btcsuite/btcd/blob/master/chaincfg/params.go """ Name = "mainnet" DefaultPort = "8333" DNSSeeds = [ ("seed.bitcoin.sipa.be", True), ("dnsseed.bluematt.me...
""" Copyright (c) 2020, The Decred developers See LICENSE for details. mainnet holds mainnet parameters. Any values should mirror exactly https://github.com/btcsuite/btcd/blob/master/chaincfg/params.go """ name = 'mainnet' default_port = '8333' dns_seeds = [('seed.bitcoin.sipa.be', True), ('dnsseed.bluematt.me', True)...
class Solution: def productExceptSelf(self, nums: list[int]) -> list[int]: products, it = [1] * len(nums), 1 for i in range(len(nums) - 1, -1, -1): products[i] = it it *= nums[i] it = 1 for i in range(len(products)): products[i] *= it i...
class Solution: def product_except_self(self, nums: list[int]) -> list[int]: (products, it) = ([1] * len(nums), 1) for i in range(len(nums) - 1, -1, -1): products[i] = it it *= nums[i] it = 1 for i in range(len(products)): products[i] *= it ...
# Misc functions def CountCombinations(n, m=1): """Number of ways to partition a number e.g 1+1+1, 2+1""" ans = 1 if n <= 1: return 1 for i in xrange(m, int(ceil(n/2.))): ans += comb(n-i, i) return ans def quicksort(r): return r if len(r)<2 else qs([i for i in r[1:] if i<r[0...
def count_combinations(n, m=1): """Number of ways to partition a number e.g 1+1+1, 2+1""" ans = 1 if n <= 1: return 1 for i in xrange(m, int(ceil(n / 2.0))): ans += comb(n - i, i) return ans def quicksort(r): return r if len(r) < 2 else qs([i for i in r[1:] if i < r[0]]) + [r[0]...
# # PySNMP MIB module APEX-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/APEX-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:23:23 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:1...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, constraints_union, value_size_constraint, value_range_constraint) ...
class ResultObject: def __init__(self, title: str, animeid: str): self.title = title self.animeid = animeid class MediaInfoObject: def __init__(self, title: str, year: int, other_names: str, season: str, status...
class Resultobject: def __init__(self, title: str, animeid: str): self.title = title self.animeid = animeid class Mediainfoobject: def __init__(self, title: str, year: int, other_names: str, season: str, status: str, genres: list, episodes: int, image_url: str, summary: str): self.tit...
#!/usr/bin/env python3 processors = 0 with open('/proc/cpuinfo') as cpufile: for line in cpufile: if line.find('core id') != -1: processors += 1 print("No. of processors are : %d " %processors)
processors = 0 with open('/proc/cpuinfo') as cpufile: for line in cpufile: if line.find('core id') != -1: processors += 1 print('No. of processors are : %d ' % processors)
files = { 'amy':{'num_1':5, 'num_2':2}, 'bob':{'num_1':6, 'num_2':8}, 'candy':{'num_1':9, 'num_2':6}, 'doby':{'num_1':1, 'num_2':5}, 'john':{'num_1':7, 'num_2':1}, } for name,num in files.items(): print('\nName: ' + name) favo_num = num['num_1'] + num['num_2'] print("Numb...
files = {'amy': {'num_1': 5, 'num_2': 2}, 'bob': {'num_1': 6, 'num_2': 8}, 'candy': {'num_1': 9, 'num_2': 6}, 'doby': {'num_1': 1, 'num_2': 5}, 'john': {'num_1': 7, 'num_2': 1}} for (name, num) in files.items(): print('\nName: ' + name) favo_num = num['num_1'] + num['num_2'] print('Number is ' + str(favo_nu...
""" Exception Payloads -> Exceptions can carry payload data. -> Most exceptions accept a single string in their constructor call. -> The most common exception you'll likely raise is ValueError. -> Most exception payloads are strings containing a helpful message. """
""" Exception Payloads -> Exceptions can carry payload data. -> Most exceptions accept a single string in their constructor call. -> The most common exception you'll likely raise is ValueError. -> Most exception payloads are strings containing a helpful message. """
class Solution: def getLastMoment(self, n: int, left: List[int], right: List[int]) -> int: left=sorted(left) right=sorted(right) answer=0 if len(right)>0: answer=max(answer, n-right[0]) if len(left)>0: answer=max(answer, left[-1]) retu...
class Solution: def get_last_moment(self, n: int, left: List[int], right: List[int]) -> int: left = sorted(left) right = sorted(right) answer = 0 if len(right) > 0: answer = max(answer, n - right[0]) if len(left) > 0: answer = max(answer, left[-1]) ...
# -*- coding: utf-8 -*- description = 'Sampletable complete' includes = ['system'] group = 'lowlevel' devices = dict( stt_step = device('nicos.devices.generic.VirtualMotor', unit = 'deg', abslimits = (-100, 130), speed = 4, lowlevel = True, ), stt_enc = device('nicos.dev...
description = 'Sampletable complete' includes = ['system'] group = 'lowlevel' devices = dict(stt_step=device('nicos.devices.generic.VirtualMotor', unit='deg', abslimits=(-100, 130), speed=4, lowlevel=True), stt_enc=device('nicos.devices.generic.VirtualCoder', motor='stt_step', unit='deg', lowlevel=True), stt=device('ni...
#Variables for drop, create, insert, and selection statements # DROP TABLES songplay_table_drop = "DROP TABLE IF EXISTS songplays" user_table_drop = "DROP TABLE IF EXISTS users" song_table_drop = "DROP TABLE IF EXISTS songs" artist_table_drop = "DROP TABLE IF EXISTS artists" time_table_drop = "DROP TABLE IF EXISTS ti...
songplay_table_drop = 'DROP TABLE IF EXISTS songplays' user_table_drop = 'DROP TABLE IF EXISTS users' song_table_drop = 'DROP TABLE IF EXISTS songs' artist_table_drop = 'DROP TABLE IF EXISTS artists' time_table_drop = 'DROP TABLE IF EXISTS time' songplay_table_create = 'CREATE TABLE IF NOT EXISTS songplays(\n ...
""" 0071. Simplify Path Medium Given a string path, which is an absolute path (starting with a slash '/') to a file or directory in a Unix-style file system, convert it to the simplified canonical path. In a Unix-style file system, a period '.' refers to the current directory, a double period '..' refers to the direc...
""" 0071. Simplify Path Medium Given a string path, which is an absolute path (starting with a slash '/') to a file or directory in a Unix-style file system, convert it to the simplified canonical path. In a Unix-style file system, a period '.' refers to the current directory, a double period '..' refers to the direc...
# Integers in Python can be as big as the bytes in your machine's memory. There is no limit in size as there is: # 2^31-1 (c++ int) or 2^63-1 (C++ long long int). # # As we know, the result of a^b grows really fast with increasing b. # # Let's do some calculations on very large integers. # # Task # Read four numbers, a...
a = int(input()) b = int(input()) c = int(input()) d = int(input()) print(pow(a, b) + pow(c, d))
class Node: def __init__(self, value, next = None): self.value = value self.next = next class LinkedQ: def __init__(self): self.__first = None self.__last = None def __str__(self): end_of_row = "" while not self.isEmpty(): char = sel...
class Node: def __init__(self, value, next=None): self.value = value self.next = next class Linkedq: def __init__(self): self.__first = None self.__last = None def __str__(self): end_of_row = '' while not self.isEmpty(): char = self.dequeue() ...
{ 'targets': [ { 'target_name': 'webaudio', 'sources': [ 'main.cpp', "<!@(node -p \"require('fs').readdirSync('./lib/src').map(f=>'lib/src/'+f).join(' ')\")" ], 'include_dirs': [ "<!(node -e \"require('nan')\")", '<(module_root_dir)/lib/include', '<(...
{'targets': [{'target_name': 'webaudio', 'sources': ['main.cpp', '<!@(node -p "require(\'fs\').readdirSync(\'./lib/src\').map(f=>\'lib/src/\'+f).join(\' \')")'], 'include_dirs': ['<!(node -e "require(\'nan\')")', '<(module_root_dir)/lib/include', '<(module_root_dir)/labsound/include', '<(module_root_dir)/labsound/third...
def isPalind_string(str): temp = str if str[::-1] == temp: return True else: return False
def is_palind_string(str): temp = str if str[::-1] == temp: return True else: return False
class Degree: def __init__(self, title, subject, institution, year): self.title = title; self.subject = subject; self.institution = institution; self.year = year; bs = Degree(title = "B.S.", subject = ...
class Degree: def __init__(self, title, subject, institution, year): self.title = title self.subject = subject self.institution = institution self.year = year bs = degree(title='B.S.', subject='Mathematics & Physics', institution='University of Arizona', year=2016) ms = degree(title...
""" This module just defines the current jaraf version. """ VERSION = "0.2.2"
""" This module just defines the current jaraf version. """ version = '0.2.2'
class Pet: def __init__(self, name): self.name = 'unknown' self._age = 10 def speak(self): self.bark() def _reset_age(self): self._age = 10 class Dog(Pet): def __init__(self): Pet.__init__(self,'') def bark(self): print ('barking') def se...
class Pet: def __init__(self, name): self.name = 'unknown' self._age = 10 def speak(self): self.bark() def _reset_age(self): self._age = 10 class Dog(Pet): def __init__(self): Pet.__init__(self, '') def bark(self): print('barking') def set_a...
__author__ = "Gawen Arab, Wes Mason" __copyright__ = "Copyright 2012, Gawen Arab" __credits__ = ["Gawen Arab", "Wes Mason"] __license__ = "Apache License, Version 2.0" __version__ = "1.0.2" __maintainer__ = "Gawen Arab" __email__ = "g@wenarab.com" __status__ = "Production"
__author__ = 'Gawen Arab, Wes Mason' __copyright__ = 'Copyright 2012, Gawen Arab' __credits__ = ['Gawen Arab', 'Wes Mason'] __license__ = 'Apache License, Version 2.0' __version__ = '1.0.2' __maintainer__ = 'Gawen Arab' __email__ = 'g@wenarab.com' __status__ = 'Production'
# -*- coding: utf-8 -*- """Storage time range objects.""" class TimeRange(object): """A class that defines a date and time range. The timestamp are integers containing the number of micro seconds since January 1, 1970, 00:00:00 UTC. Attributes: start_timestamp: integer containing the timestamp that marks...
"""Storage time range objects.""" class Timerange(object): """A class that defines a date and time range. The timestamp are integers containing the number of micro seconds since January 1, 1970, 00:00:00 UTC. Attributes: start_timestamp: integer containing the timestamp that marks ...
sLabNew = { "cdc": "cdc", "cnic": "cnic", "melb": "vidrl", "vidrl": "vidrl", "niid": "niid", "nimr": "crick", "crick": "crick", } sLabOld = { "cdc": "cdc", "cnic": "cnic", "melb": "melb", "vidrl": "melb", "niid": "niid", "nimr": "nimr", "crick": "nimr", }...
s_lab_new = {'cdc': 'cdc', 'cnic': 'cnic', 'melb': 'vidrl', 'vidrl': 'vidrl', 'niid': 'niid', 'nimr': 'crick', 'crick': 'crick'} s_lab_old = {'cdc': 'cdc', 'cnic': 'cnic', 'melb': 'melb', 'vidrl': 'melb', 'niid': 'niid', 'nimr': 'nimr', 'crick': 'nimr'} s_lab_display_name = {'cdc': 'CDC', 'cnic': 'CNIC', 'nimr': 'Crick...
# -*- coding: utf-8 -*- host = "127.0.0.1"; port = 3306; user = "root"; pwd = "root"; db = "test"; charset = "utf8"; if __name__ == '__main__': pass; #end
host = '127.0.0.1' port = 3306 user = 'root' pwd = 'root' db = 'test' charset = 'utf8' if __name__ == '__main__': pass
"""General utilities""" class BadRequestError(Exception): pass class NotAuthorizedError(Exception): pass
"""General utilities""" class Badrequesterror(Exception): pass class Notauthorizederror(Exception): pass
# 2020.03.25 # Problem Statement: # https://leetcode.com/problems/sort-list/ # I hate linked list! # https://leetcode.com/problems/sort-list/discuss/46714/Java-merge-sort-solution # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self....
class Solution: def sort_list(self, head: ListNode) -> ListNode: if not head or not head.next: return head (second_half, ptr, prev) = (head, head, None) while ptr and ptr.next: prev = second_half second_half = second_half.next ptr = ptr.next.n...
# GYP file to build pdfviewer. # # To build on Linux: # ./gyp_skia pdfviewer.gyp && make pdfviewer # { 'includes': [ 'apptype_console.gypi', ], 'targets': [ { 'target_name': 'libpdfviewer', 'type': 'static_library', 'sources': [ '../experimental/PdfViewer/SkPdfBasics.cpp', ...
{'includes': ['apptype_console.gypi'], 'targets': [{'target_name': 'libpdfviewer', 'type': 'static_library', 'sources': ['../experimental/PdfViewer/SkPdfBasics.cpp', '../experimental/PdfViewer/SkPdfFont.cpp', '../experimental/PdfViewer/SkPdfRenderer.cpp', '../experimental/PdfViewer/SkPdfUtils.cpp', '../experimental/Pdf...
# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries # # SPDX-License-Identifier: MIT """ `micropython` - MicroPython Specific Decorator Functions ======================================================== * Author(s): cefn """ def const(x): "Emulate making a constant" return x def...
""" `micropython` - MicroPython Specific Decorator Functions ======================================================== * Author(s): cefn """ def const(x): """Emulate making a constant""" return x def native(f): """Emulate making a native""" return f def viper(f): """User is attempting to use a vi...
class Utilities: # Thanks, Wikipedia! def inverse(self, a, n): t = 0 r = n newt = 1 newr = a while newr != 0: quot = r / newr t, newt = newt, t - quot * newt r, newr = newr, r - quot * newr if (r > 1): return "a not...
class Utilities: def inverse(self, a, n): t = 0 r = n newt = 1 newr = a while newr != 0: quot = r / newr (t, newt) = (newt, t - quot * newt) (r, newr) = (newr, r - quot * newr) if r > 1: return 'a not invertible' ...
# dataset settings dataset_type = 'ImageNetC' data_prefix = '/home/sjtu/scratch/zltan/datasets/imagenet-c' corruption = 'snow' severity = 5 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='LoadImageFromFile'), dict(type='Normalize...
dataset_type = 'ImageNetC' data_prefix = '/home/sjtu/scratch/zltan/datasets/imagenet-c' corruption = 'snow' severity = 5 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='LoadImageFromFile'), dict(type='Normalize', **img_norm_cfg), dict(type='Imag...
""" global application configuration parameters passed to Flask """ S3_BUCKET_NAME = 'ankur6ue-dev-ocr-data' REGION_NAME = 'us-east-1' ACL = 'private' LOCAL = 1 LOCAL_BASE_PATH = "/tmp/OCR/" MYSQL_DBNAME = "jobs"
""" global application configuration parameters passed to Flask """ s3_bucket_name = 'ankur6ue-dev-ocr-data' region_name = 'us-east-1' acl = 'private' local = 1 local_base_path = '/tmp/OCR/' mysql_dbname = 'jobs'
description = "neutronguide, leadblock" group = 'lowlevel' includes = ['nok_ref', 'zz_absoluts'] instrument_values = configdata('instrument.values') showcase_values = configdata('cf_showcase.showcase_values') tango_base = instrument_values['tango_base'] code_base = instrument_values['code_base'] devices = dict( ...
description = 'neutronguide, leadblock' group = 'lowlevel' includes = ['nok_ref', 'zz_absoluts'] instrument_values = configdata('instrument.values') showcase_values = configdata('cf_showcase.showcase_values') tango_base = instrument_values['tango_base'] code_base = instrument_values['code_base'] devices = dict(shutter_...
__author__ = 'Haarm-Pieter Duiker' __copyright__ = 'Copyright (C) 2016 - Duiker Research Corp' __license__ = '' __maintainer__ = 'Haarm-Pieter Duiker' __email__ = 'support@duikerresearch.org' __status__ = 'Production' __major_version__ = '1' __minor_version__ = '0' __change_version__ = '0' __version__ = '.'.join((__ma...
__author__ = 'Haarm-Pieter Duiker' __copyright__ = 'Copyright (C) 2016 - Duiker Research Corp' __license__ = '' __maintainer__ = 'Haarm-Pieter Duiker' __email__ = 'support@duikerresearch.org' __status__ = 'Production' __major_version__ = '1' __minor_version__ = '0' __change_version__ = '0' __version__ = '.'.join((__maj...
# Copyright 2016 Google Inc. # # 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 writing,...
"""A library of functions for working with web_test metadata files.""" load(':files.bzl', 'files') def _merge_files(ctx, merger, output, inputs): """Produces a merged web test metadata file. Args: ctx: a Skylark rule context. merger: the WTL metadata merger executable. output: a File o...
n = int(input("Quantos elementos vai ter o verto? ")) vet = [0 for x in range(n)] for i in range(n): vet[i] = int(input("Digite um numero: ")) soma = 0 pares = 0 for i in range(n): if vet[i] % 2 == 0: soma = soma + vet[i] pares = pares + 1 if pares == 0: print("NENHUM NUMERO PAR") else:...
n = int(input('Quantos elementos vai ter o verto? ')) vet = [0 for x in range(n)] for i in range(n): vet[i] = int(input('Digite um numero: ')) soma = 0 pares = 0 for i in range(n): if vet[i] % 2 == 0: soma = soma + vet[i] pares = pares + 1 if pares == 0: print('NENHUM NUMERO PAR') else: ...
""" Dayliopy module. This exists to let the linter run. """
""" Dayliopy module. This exists to let the linter run. """
# Script to redirect from long-obsolete URLs to current static-blog ones redirects = { "2010/11/From-Baselayout-to-Systemd-setup-on-Exherbo": "2010/11/05/from-baselayout-to-systemd-setup-on-exherbo.html", "2010/11/Moar-free-time": "2010/11/12/moar-free-time.html", "2010/12/Commandline-pulseaudio-mixer-tool": "2010/...
redirects = {'2010/11/From-Baselayout-to-Systemd-setup-on-Exherbo': '2010/11/05/from-baselayout-to-systemd-setup-on-exherbo.html', '2010/11/Moar-free-time': '2010/11/12/moar-free-time.html', '2010/12/Commandline-pulseaudio-mixer-tool': '2010/12/25/commandline-pulseaudio-mixer-tool.html', '2010/12/Further-improvements-o...
def test_setup_legacy_bus0(gpio, smbus, sn3218): gpio.RPI_REVISION = 1 sn3218.channel_gamma(0, [int(pow(255, float(i - 1) / 255)) for i in range(256)]) assert smbus.SMBus.called_once_with(0) sn3218.enable() def test_setup_legacy_bus1(gpio, smbus, sn3218): gpio.RPI_REVISION = 3 sn3218.channel_g...
def test_setup_legacy_bus0(gpio, smbus, sn3218): gpio.RPI_REVISION = 1 sn3218.channel_gamma(0, [int(pow(255, float(i - 1) / 255)) for i in range(256)]) assert smbus.SMBus.called_once_with(0) sn3218.enable() def test_setup_legacy_bus1(gpio, smbus, sn3218): gpio.RPI_REVISION = 3 sn3218.channel_ga...
colors = ['darkred', 'darkmagenta', 'darkolivegreen', 'darkorange', 'darkorchid', 'darkseagreen', 'darksalmon', 'darkslateblue', 'crimson', 'antiquewhite', 'aqua', 'aquamarine', 'azure', 'beige', 'bisque', 'blanchedalmond', 'blue','blueviolet', 'brown', 'burlywood', 'cadetblue', 'chartreuse', 'chocol...
colors = ['darkred', 'darkmagenta', 'darkolivegreen', 'darkorange', 'darkorchid', 'darkseagreen', 'darksalmon', 'darkslateblue', 'crimson', 'antiquewhite', 'aqua', 'aquamarine', 'azure', 'beige', 'bisque', 'blanchedalmond', 'blue', 'blueviolet', 'brown', 'burlywood', 'cadetblue', 'chartreuse', 'chocolate', 'coral']
def del_rep(): n=int(input("Enter the no of elements")) print("Enter the list elements") l=[] for i in range(n): l.append(input()) print(l) for i in l: c=int(l.count(i)) for j in l: if(i==j) and c >1: l.remove(j) c-=1 ...
def del_rep(): n = int(input('Enter the no of elements')) print('Enter the list elements') l = [] for i in range(n): l.append(input()) print(l) for i in l: c = int(l.count(i)) for j in l: if i == j and c > 1: l.remove(j) c -= 1 ...
class Ecosystem: def __init__(self, deer_0=1.5, wolves_0=1.5, deer_growth=2/3, deer_predation=4/3, wolves_predation=1.0, wolves_decay=1.0, dt=0.0): self.initialDeer = deer_0 self.initialWolves = wolves_0 self.currentDeer = deer_0 self.currentWolves = wolves_0 self.maxWolves =...
class Ecosystem: def __init__(self, deer_0=1.5, wolves_0=1.5, deer_growth=2 / 3, deer_predation=4 / 3, wolves_predation=1.0, wolves_decay=1.0, dt=0.0): self.initialDeer = deer_0 self.initialWolves = wolves_0 self.currentDeer = deer_0 self.currentWolves = wolves_0 self.maxWol...
class Seating: def __init__(self, layout: str): self.seats = [list(line) for line in layout.splitlines()] self.width = len(self.seats[0]) self.height = len(self.seats) def nr_neigbors(self, row: int, col: int) -> int: count = 0 for i in range(max(row - 1, 0), min(row+2, ...
class Seating: def __init__(self, layout: str): self.seats = [list(line) for line in layout.splitlines()] self.width = len(self.seats[0]) self.height = len(self.seats) def nr_neigbors(self, row: int, col: int) -> int: count = 0 for i in range(max(row - 1, 0), min(row + ...
"""Exceptions for Sleepi.""" class SleepiError(Exception): """Generic Sleepi exception.""" class SleepiConnectionError(SleepiError): """Sleepi connection exception.""" class SleepiGenericError(Exception): """Generic Sleepi exception."""
"""Exceptions for Sleepi.""" class Sleepierror(Exception): """Generic Sleepi exception.""" class Sleepiconnectionerror(SleepiError): """Sleepi connection exception.""" class Sleepigenericerror(Exception): """Generic Sleepi exception."""
string = [1, 2, 'ASD', 4, (1, 2, 3), '1', 'PY'] def get_string_list(lst): if type(lst) == str: return True else: return False only_string = filter(get_string_list, string) print(list(only_string))
string = [1, 2, 'ASD', 4, (1, 2, 3), '1', 'PY'] def get_string_list(lst): if type(lst) == str: return True else: return False only_string = filter(get_string_list, string) print(list(only_string))
_base_ = [ '../_base_/models/ocrnet_hr18.py', '../_base_/datasets/cityscapes_bs2x.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_40k_lr2x.py' ]
_base_ = ['../_base_/models/ocrnet_hr18.py', '../_base_/datasets/cityscapes_bs2x.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_40k_lr2x.py']
#pylint: disable=bad-continuation,invalid-name,missing-docstring # Basic test with a list TEST_LIST1 = ['a' 'b'] # [implicit-str-concat-in-sequence] # Testing with unicode strings in a tuple, with a comma AFTER concatenation TEST_LIST2 = (u"a" u"b", u"c") # [implicit-str-concat-in-sequence] # Testing with raw string...
test_list1 = ['ab'] test_list2 = (u'ab', u'c') test_list3 = {'a', 'bc'} test_list4 = ['a', 'bc', 'd'] print('a', 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccc') test_list5 = ('a', 'bc') test_list6 = 'abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ccc' test_list7 = [b'AB']
# Python allows empty class class EmptyClass: pass # Create an instance of the class obj_1 = EmptyClass() # Attrubutes can be added to an object dynamically obj_1.attribute1 = "The attribute 1" obj_1.attribute2 = "The attribute 2" print(obj_1.attribute1 + ' - ' + obj_1.attribute2) # The __dict__ has all the infor...
class Emptyclass: pass obj_1 = empty_class() obj_1.attribute1 = 'The attribute 1' obj_1.attribute2 = 'The attribute 2' print(obj_1.attribute1 + ' - ' + obj_1.attribute2) print('The __dict__:') print(obj_1.__dict__) del obj_1.attribute2 print(obj_1.__dict__) print()
""" MIT License Copyright (c) 2019 Sylte Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distrib...
""" MIT License Copyright (c) 2019 Sylte Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distrib...
# This sample tests type annotations on variables. array1 = [1, 2, 3] # This should generate an error because the LHS can't # have a declared type. array1[2] = 4 # type: int dict1 = {} # This should generate an error because the LHS can't # have a declared type. dict1["hello"] = 4 # type: int def...
array1 = [1, 2, 3] array1[2] = 4 dict1 = {} dict1['hello'] = 4 def foo(): a: int = 3 b: float = 4.5 c: str = '' d: int = (yield 42)
""" __init__.py This init script will initialize any needed logic for this package. This package will control parsing and access to the sqlite master schema files. """
""" __init__.py This init script will initialize any needed logic for this package. This package will control parsing and access to the sqlite master schema files. """
threePow19 = 1162261467 # 3**19 class Solution: def isPowerOfThree(self, n: int) -> bool: return n>0 and not (threePow19 % n)
three_pow19 = 1162261467 class Solution: def is_power_of_three(self, n: int) -> bool: return n > 0 and (not threePow19 % n)
__all__ = ["CLUSTER_ARGS", "EXAMPLE_DIRS", "EXTRA_ARGS"] ################################################################################ # Arguments used on the cluster # Any set to None are ignored and only used for getting the key names in _update_cluster_args CLUSTER_ARGS = { 'submit_cluster': None, 'submi...
__all__ = ['CLUSTER_ARGS', 'EXAMPLE_DIRS', 'EXTRA_ARGS'] cluster_args = {'submit_cluster': None, 'submit_qtype': 'SGE', 'submit_array': None, 'submit_pe_lsf': None, 'submit_pe_sge': 'smp', 'submit_queue': None} example_dirs = ['contact-example', 'homologs', 'ideal-helices', 'import-data', 'nmr.remodel', 'nmr.truncate',...
expected_output = { 'eigrp_instance': { '100': { 'vrf': { 'default': { 'address_family': { 'ipv6': { 'name': 'test', 'named_mode': True, 'eigrp_interf...
expected_output = {'eigrp_instance': {'100': {'vrf': {'default': {'address_family': {'ipv6': {'name': 'test', 'named_mode': True, 'eigrp_interface': {'GigabitEthernet0/0/0/1.90': {'eigrp_nbr': {'fe80::5c00:ff:fe02:7': {'peer_handle': 1, 'hold': 12, 'uptime': '01:36:14', 'srtt': 0.011, 'rto': 200, 'q_cnt': 0, 'last_seq_...
""" Get the difference between a given number and 17, if the number is greater than 17 return double the absolute difference """ number = int(input("please input the number : ")) new_number = 17 - number print(new_number) def ashi(): if number > 17: return (17 - number)*2 print(ashi()) ...
""" Get the difference between a given number and 17, if the number is greater than 17 return double the absolute difference """ number = int(input('please input the number : ')) new_number = 17 - number print(new_number) def ashi(): if number > 17: return (17 - number) * 2 print(ashi()) def difference(n...