content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# Time: O(n^2 * 2^n) # Space: O(1) # brute force, bitmask class Solution(object): def maximumGood(self, statements): """ :type statements: List[List[int]] :rtype: int """ def check(mask): return all(((mask>>j)&1) == statements[i][j] for i ...
class Solution(object): def maximum_good(self, statements): """ :type statements: List[List[int]] :rtype: int """ def check(mask): return all((mask >> j & 1 == statements[i][j] for i in xrange(len(statements)) if mask >> i & 1 for j in xrange(len(statements[i]))...
string = "Hello world" for char in string: print(char) length = len(string) print(length)
string = 'Hello world' for char in string: print(char) length = len(string) print(length)
expected_output = { 'vrf': { 'HIPTV': { 'address_family': { 'ipv4': { 'routes': { '172.25.254.37/32': { 'known_via': 'bgp 7992', 'ip': '172.25.254.3...
expected_output = {'vrf': {'HIPTV': {'address_family': {'ipv4': {'routes': {'172.25.254.37/32': {'known_via': 'bgp 7992', 'ip': '172.25.254.37', 'metric': 0, 'installed': {'date': 'Feb 6 13:12:22.999', 'for': '10w6d'}, 'next_hop': {'next_hop_list': {1: {'index': 1, 'metric': 0, 'next_hop': '172.25.253.121', 'from': '17...
class Search: def __init__(self): pass def execute(self): pass def __repr__(self): pass def __str__(self): pass class QueryBuilder: pass class Query: pass
class Search: def __init__(self): pass def execute(self): pass def __repr__(self): pass def __str__(self): pass class Querybuilder: pass class Query: pass
def double_exponential_smoothing(series, initial_level, initial_trend, level_smoothing, trend_smoothing): """ Fit the trend and level to the timeseries using double exponential smoothing Args: - series: series, time-series to perform double exponential smoothing on ...
def double_exponential_smoothing(series, initial_level, initial_trend, level_smoothing, trend_smoothing): """ Fit the trend and level to the timeseries using double exponential smoothing Args: - series: series, time-series to perform double exponential smoothing on Returns: - fit: serie...
''' You are given an integer n, the number of teams in a tournament that has strange rules: - If the current number of teams is even, each team gets paired with another team. A total of n / 2 matches are played, and n / 2 teams advance to the next round. - If the current ...
""" You are given an integer n, the number of teams in a tournament that has strange rules: - If the current number of teams is even, each team gets paired with another team. A total of n / 2 matches are played, and n / 2 teams advance to the next round. - If the current ...
# The purpose of __all__ is to define the public API of this module, and which # objects are imported if we call "from {{ cookiecutter.project_name }}.hello import *" __all__ = [ "HelloClass", "say_hello_lots", ] class HelloClass: """A class whose only purpose in life is to say hello""" def __init__(...
__all__ = ['HelloClass', 'say_hello_lots'] class Helloclass: """A class whose only purpose in life is to say hello""" def __init__(self, name: str): """ Args: name: The initial value of the name of the person who gets greeted """ self.name = name def format_gre...
"""This problem was asked by Quora. Given an absolute pathname that may have . or .. as part of it, return the shortest standardized path. For example, given "/usr/bin/../bin/./scripts/../", return "/usr/bin/". """
"""This problem was asked by Quora. Given an absolute pathname that may have . or .. as part of it, return the shortest standardized path. For example, given "/usr/bin/../bin/./scripts/../", return "/usr/bin/". """
def day23P1(): pullzle = "463528179" #pullzle = "389125467" cups = [int(x) for x in list(pullzle)] l = len(cups) startIdx = 0 for i in range(100): p1 = (startIdx + 1) % l p2 = (startIdx + 2) % l p3 = (startIdx + 3) % l p4 = (startIdx + 4) % l pickup = [cu...
def day23_p1(): pullzle = '463528179' cups = [int(x) for x in list(pullzle)] l = len(cups) start_idx = 0 for i in range(100): p1 = (startIdx + 1) % l p2 = (startIdx + 2) % l p3 = (startIdx + 3) % l p4 = (startIdx + 4) % l pickup = [cups[p1], cups[p2], cups[p3]...
#!/bin/python3 [n,k] = [int(x) for x in input().split()] k -= 1 factorial = [1 for _ in range(n+1)] for i in range(1,n+1): factorial[i] = factorial[i-1] * i ans = [] perm = [0] used = [False for _ in range(n)] for i in range(n-1): possible = [] for j in range(1,n): if not used[j]: po...
[n, k] = [int(x) for x in input().split()] k -= 1 factorial = [1 for _ in range(n + 1)] for i in range(1, n + 1): factorial[i] = factorial[i - 1] * i ans = [] perm = [0] used = [False for _ in range(n)] for i in range(n - 1): possible = [] for j in range(1, n): if not used[j]: possible.a...
class Solution: def searchInsert(self, nums: List[int], target: int) -> int: start_i = 0 end_i = len(nums) - 1 while start_i <= end_i: index = (start_i + end_i) // 2 if nums[index] == target: return index elif nums[index] > target:...
class Solution: def search_insert(self, nums: List[int], target: int) -> int: start_i = 0 end_i = len(nums) - 1 while start_i <= end_i: index = (start_i + end_i) // 2 if nums[index] == target: return index elif nums[index] > target: ...
## # IO Events ## CONNECT = 'connect' CONNECT_ERROR = 'connect_error' DISCONNECT = 'disconnect' ### # Client Events ### CLIENT_DATA = 'client_data' REGISTER_PLAYER = 'register_player' PLAYER_MOVE = 'player_move' ### # Server Events ### REQUEST_REGISTER = 'register_player_request' ...
connect = 'connect' connect_error = 'connect_error' disconnect = 'disconnect' client_data = 'client_data' register_player = 'register_player' player_move = 'player_move' request_register = 'register_player_request' server_data = 'server_data' request_move = 'request_move' move_result = 'move_result' board_state = 'boar...
__appname__ = 'qpropgen' __version__ = '0.1.0' __license__ = 'Apache 2.0' DESCRIPTION = """\ Generate a QML-friendly QObject-based C++ class from a class definition file. """
__appname__ = 'qpropgen' __version__ = '0.1.0' __license__ = 'Apache 2.0' description = 'Generate a QML-friendly QObject-based C++ class from a class definition file.\n'
class Product: def __init__(self, name, description, seller, price, availability): self.name = name self.description = description self.seller = seller self.reviews = [] self.price = price self.availability = availability def __str__(self): return f"Produ...
class Product: def __init__(self, name, description, seller, price, availability): self.name = name self.description = description self.seller = seller self.reviews = [] self.price = price self.availability = availability def __str__(self): return f'Prod...
class AuthFailed(Exception): pass class SearchFailed(Exception): pass
class Authfailed(Exception): pass class Searchfailed(Exception): pass
tilt_id = "a495bb30c5b14b44b5121370f02d74de" tilt_sg_adjust = 0 read_interval = 15 dropbox_token = "" dropbox_folder = "data" brewfatherCustomStreamURL = ""
tilt_id = 'a495bb30c5b14b44b5121370f02d74de' tilt_sg_adjust = 0 read_interval = 15 dropbox_token = '' dropbox_folder = 'data' brewfather_custom_stream_url = ''
str = "moam" str=str.casefold() #for case sensitive string str1=reversed(str) #reversed the string if list(str)==list(str1): print("it is palindrome string") else: print("It is not palindrome String")
str = 'moam' str = str.casefold() str1 = reversed(str) if list(str) == list(str1): print('it is palindrome string') else: print('It is not palindrome String')
input = "input1.txt" depthReadings = [] changes = [] # 1 = increase, 0 = no change, -1 = decrease with open(input) as f: for l in f: depthReadings.append(int(l.strip())) i = 1 changes.append(0) while i < len(depthReadings): if depthReadings[i] < depthReadings[i-1]: changes.append(-1) ...
input = 'input1.txt' depth_readings = [] changes = [] with open(input) as f: for l in f: depthReadings.append(int(l.strip())) i = 1 changes.append(0) while i < len(depthReadings): if depthReadings[i] < depthReadings[i - 1]: changes.append(-1) if depthReadings[i] > depthReadings[i - 1]: ...
ans = {} for i in range(10): n = int(input()) % 42 ans[n] = 1; print(len(ans))
ans = {} for i in range(10): n = int(input()) % 42 ans[n] = 1 print(len(ans))
__all__ = ['OptimizelyError', 'BadRequestError', 'UnauthorizedError', 'ForbiddenError', 'NotFoundError', 'TooManyRequestsError', 'ServiceUnavailableError', 'InvalidIDError'] class OptimizelyError(Exception): """ General exception for all Optimizely Experiments API related issues.""" pass...
__all__ = ['OptimizelyError', 'BadRequestError', 'UnauthorizedError', 'ForbiddenError', 'NotFoundError', 'TooManyRequestsError', 'ServiceUnavailableError', 'InvalidIDError'] class Optimizelyerror(Exception): """ General exception for all Optimizely Experiments API related issues.""" pass class Badrequesterror...
#Kunal Gautam #Codewars : @Kunalpod #Problem name: Find Factors Down to Limit #Problem level: 8 kyu def factors(integer, limit): return [x for x in range(limit,(integer//2)+1) if not integer%x] + ([integer] if integer>=limit else [])
def factors(integer, limit): return [x for x in range(limit, integer // 2 + 1) if not integer % x] + ([integer] if integer >= limit else [])
class SOAPError(Exception): """ **Custom SOAP exception** Custom SOAP exception class. Raised whenever an error response has been received during action invocation. """ def __init__(self, description, code): self.description = description self.error = code class ...
class Soaperror(Exception): """ **Custom SOAP exception** Custom SOAP exception class. Raised whenever an error response has been received during action invocation. """ def __init__(self, description, code): self.description = description self.error = code class Ig...
# File: signalfx_consts.py # Copyright (c) 2021 Splunk Inc. # # Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) # # Define your constants here # exception handling ERR_CODE_MSG = "Error code unavailable" ERR_MSG_UNAVAILABLE = "Error message unavailable. Please check the asset configuration ...
err_code_msg = 'Error code unavailable' err_msg_unavailable = 'Error message unavailable. Please check the asset configuration and|or action parameters' parse_err_msg = 'Unable to parse the error message. Please check the asset configuration and|or action parameters' valid_integer_msg = 'Please provide a valid integer ...
# # For loops # emails = ["email1@email.com", "email2@gmail.com", "email3@email.com"] # # for email in emails: # print(email) # pass # # For loops advance # emails = ["email1@email.com", "email2@gmail.com", "email3@email.com"] # for email in emails: # if 'gmail' in email: # print(email) # # el...
names = ['james\n', 'jhon\n', 'jack\n'] print(names) names = [i.replace('\n', '') for i in names] print(names)
# Copyright 2012-2020 James Geboski <jgeboski@gmail.com> # # 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,...
caution_base64 = 'iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw1AUhU/TSkUqgnYQ6ZChOlkQFXGUKhbBQmkrtOpg8tI/aNKQpLg4Cq4FB38Wqw4uzro6uAqC4A+Ik6OToouUeF9SaBHjhcf7OO+ew3v3AUKzylQzMAGommWkE3Exl18Vg68IQIAPg4hIzNSTmcUsPOvrnjqp7mI8y7vvz+pXCiYDfCLxHNMNi3iDeGbT0jnvE4dZWVKIz4nHDbog8SPXZZffOJccFn...
#!/usr/bin/python3 fo = open("1/input.txt", "r") input = [] for line in fo.readlines(): line = line.strip() input.append(int(line)) def part1(): #init prev = input[0] counter = 0 #calc for line in input[1:]: if line > prev: counter += 1 prev = li...
fo = open('1/input.txt', 'r') input = [] for line in fo.readlines(): line = line.strip() input.append(int(line)) def part1(): prev = input[0] counter = 0 for line in input[1:]: if line > prev: counter += 1 prev = line print(counter) def part2(): measures = input...
# -*- coding: utf-8 -*- def get_autosuggest_url(tag_type, language, geography): base_url = "https://" + geography + ".openfoodfacts.org" autosuggest = base_url + "/cgi/suggest.pl?lc=" + language autosuggest += "&tagtype=" + tag_type return autosuggest
def get_autosuggest_url(tag_type, language, geography): base_url = 'https://' + geography + '.openfoodfacts.org' autosuggest = base_url + '/cgi/suggest.pl?lc=' + language autosuggest += '&tagtype=' + tag_type return autosuggest
class Metrics: received_packets: int = 0 sent_packets: int = 0 forward_key_set: int = 0 forward_key_del: int = 0 lost_packet_count: int = 0 out_of_order_count: int = 0 delete_unknown_key_count: int = 0
class Metrics: received_packets: int = 0 sent_packets: int = 0 forward_key_set: int = 0 forward_key_del: int = 0 lost_packet_count: int = 0 out_of_order_count: int = 0 delete_unknown_key_count: int = 0
alcohol_cases = None with open('../static/alcohol_cases.txt', 'r') as f: alcohol_cases = f.readlines() smoke_cases = None with open('../static/smoke_cases.txt', 'r') as f: smoke_cases = f.readlines() with open('../static/alcohol_and_cig_cases.txt', 'w') as f: for i in smoke_cases: if i in alcohol_...
alcohol_cases = None with open('../static/alcohol_cases.txt', 'r') as f: alcohol_cases = f.readlines() smoke_cases = None with open('../static/smoke_cases.txt', 'r') as f: smoke_cases = f.readlines() with open('../static/alcohol_and_cig_cases.txt', 'w') as f: for i in smoke_cases: if i in alcohol_ca...
# Copyright (c) 2014 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style licence that can be # found in the LICENSE file. { 'variables': { 'custom_ld_target%': '', 'custom_ld_host%': '', }, 'conditions': [ ['"<(custom_ld_target)"!=""', { 'make_global_settings':...
{'variables': {'custom_ld_target%': '', 'custom_ld_host%': ''}, 'conditions': [['"<(custom_ld_target)"!=""', {'make_global_settings': [['LD', '<(custom_ld_target)']]}], ['"<(custom_ld_host)"!=""', {'make_global_settings': [['LD.host', '<(custom_ld_host)']]}]], 'targets': [{'target_name': 'make_global_settings_ld_test',...
def mean(data): """Return the sample arithmetic mean of data.""" n = len(data) if n < 1: raise ValueError('mean requires at least one data point') return sum(data)/n # in Python 2 use sum(data)/float(n) def _ss(data): """Return sum of square deviations of sequence data.""" c = ...
def mean(data): """Return the sample arithmetic mean of data.""" n = len(data) if n < 1: raise value_error('mean requires at least one data point') return sum(data) / n def _ss(data): """Return sum of square deviations of sequence data.""" c = mean(data) ss = sum(((x - c) ** 2 for x...
class Solution: """ @param nums: an array with positive and negative numbers @param k: an integer @return: the maximum average """ def maxAverage(self, nums, k): if not nums: return 0 min_num = min(nums) max_num = max(nums) while ...
class Solution: """ @param nums: an array with positive and negative numbers @param k: an integer @return: the maximum average """ def max_average(self, nums, k): if not nums: return 0 min_num = min(nums) max_num = max(nums) while min_num + 1e-06 < ma...
class Chess: tag = 0 camp = 0 x = 0 y = 0
class Chess: tag = 0 camp = 0 x = 0 y = 0
def test_even(): for i in range(0, 6): yield is_even, i def is_even(i): assert i % 2 == 0
def test_even(): for i in range(0, 6): yield (is_even, i) def is_even(i): assert i % 2 == 0
""" uci_bootcamp_2021/examples/while_loops.py Demonstrate basic while loop usage """ def get_valid_input( prompt: str, valid_minimum: int = 0, valid_maximum: int = 100 ) -> int: # initialize valid to False. valid = False result = -1 # loop while the user hasn't given us a suitable value. whi...
""" uci_bootcamp_2021/examples/while_loops.py Demonstrate basic while loop usage """ def get_valid_input(prompt: str, valid_minimum: int=0, valid_maximum: int=100) -> int: valid = False result = -1 while not valid: untrusted_input = input(prompt) if untrusted_input.isnumeric(): ...
# # PySNMP MIB module HP-SN-MPLS-TE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-SN-MIBS # Produced by pysmi-0.3.4 at Mon Apr 29 19:23:53 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 20...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, single_value_constraint, value_size_constraint, value_range_constraint) ...
contacts = {} while True: tokens = input() if 'Over' == tokens: break [first_value, second_value] = tokens.split(' : ') if second_value.isdigit(): contacts[first_value] = second_value else: contacts[second_value] = first_value print(("\n".join([f'{key} -> {value}' for key...
contacts = {} while True: tokens = input() if 'Over' == tokens: break [first_value, second_value] = tokens.split(' : ') if second_value.isdigit(): contacts[first_value] = second_value else: contacts[second_value] = first_value print('\n'.join([f'{key} -> {value}' for (key, va...
# Roll no.: # Registration no.: # Evaluate fibonacci numbers and calculate the limit of the numbers. def fibo(n): """Returns nth fibonacci number.""" a, b = 0, 1 for i in range(1, n): a, b = b, a+b return b def calc_ratio(): """Calculates the limit of the ratio of fibonacci numbers correct to 4th decimal place...
def fibo(n): """Returns nth fibonacci number.""" (a, b) = (0, 1) for i in range(1, n): (a, b) = (b, a + b) return b def calc_ratio(): """Calculates the limit of the ratio of fibonacci numbers correct to 4th decimal place.""" (c, d) = (1, 1) while True: phi = d / c (c...
""" @author: ctralie / IDS 301 Class Purpose: To show how to dynamically fill in a dictionary using loops, and also to make sure students are comfortable with nested dictionaries (dictionaries that have keys whose values are themselves dictionaries) """ # The main dictionary has th...
""" @author: ctralie / IDS 301 Class Purpose: To show how to dynamically fill in a dictionary using loops, and also to make sure students are comfortable with nested dictionaries (dictionaries that have keys whose values are themselves dictionaries) """ students = {} names = ['chris...
# coding=utf-8 """ Manages the server computer """
""" Manages the server computer """
# Params change with every run of the application and will be changed by the UI MEASUREMENT_ID = '' COMMENT = 'preliminary data' SONDE_NAME = '2015083012lin.txt' OVL_FILES = ['15083000_607.dat'] POLLY_FILES = ['2015_05_01_Fri_DWD_00_03_31.nc']
measurement_id = '' comment = 'preliminary data' sonde_name = '2015083012lin.txt' ovl_files = ['15083000_607.dat'] polly_files = ['2015_05_01_Fri_DWD_00_03_31.nc']
class LightSupport: EFFECT = 4 FLASH = 8 TRANSITION = 32
class Lightsupport: effect = 4 flash = 8 transition = 32
def flatten(iterable: list) -> list: """ A function that accepts an arbitrarily-deep nested list-like structure and returns a flattened structure without any nil/null values. For Example: input: [1,[2,3,null,4],[null],5] output: [1,2,3,4,5] :param iterable: :return: """...
def flatten(iterable: list) -> list: """ A function that accepts an arbitrarily-deep nested list-like structure and returns a flattened structure without any nil/null values. For Example: input: [1,[2,3,null,4],[null],5] output: [1,2,3,4,5] :param iterable: :return: """...
# -*- coding: utf-8 -*- """Basic Grid description: content: - SquareGrid - GridWithWeights reference: 1. https://www.redblobgames.com/pathfinding/a-star/implementation.html author: Shin-Fu (Kelvin) Wu latest update: 2019/05/10 """ class SquareGrid(object): def __init__(self, width, height): ...
"""Basic Grid description: content: - SquareGrid - GridWithWeights reference: 1. https://www.redblobgames.com/pathfinding/a-star/implementation.html author: Shin-Fu (Kelvin) Wu latest update: 2019/05/10 """ class Squaregrid(object): def __init__(self, width, height): """ Square Grid ...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def pruneTree(self, root: TreeNode) -> TreeNode: if not root: return None root....
class Solution: def prune_tree(self, root: TreeNode) -> TreeNode: if not root: return None root.left = self.pruneTree(root.left) root.right = self.pruneTree(root.right) if root.left is None and root.right is None and (root.val == 0): return None retur...
class Node(object): def __init__(self, data = None): self.left = None self.right = None self.data = data def setLeft(self, node): self.left = node def setRight(self, node): self.right = node def getLeft(self): return self.left def getRight(self): ...
class Node(object): def __init__(self, data=None): self.left = None self.right = None self.data = data def set_left(self, node): self.left = node def set_right(self, node): self.right = node def get_left(self): return self.left def get_right(self)...
"""Should raise SyntaxError: cannot assign to __debug__ in Py 3.8 and assignment to keyword before.""" __debug__ = 1
"""Should raise SyntaxError: cannot assign to __debug__ in Py 3.8 and assignment to keyword before.""" __debug__ = 1
load("//rust:rust_proto_compile.bzl", "rust_proto_compile") load("//rust:rust_proto_lib.bzl", "rust_proto_lib") load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library") def rust_proto_library(**kwargs): # Compile protos name_pb = kwargs.get("name") + "_pb" name_lib = kwargs.get("name") + "_lib" rust...
load('//rust:rust_proto_compile.bzl', 'rust_proto_compile') load('//rust:rust_proto_lib.bzl', 'rust_proto_lib') load('@io_bazel_rules_rust//rust:rust.bzl', 'rust_library') def rust_proto_library(**kwargs): name_pb = kwargs.get('name') + '_pb' name_lib = kwargs.get('name') + '_lib' rust_proto_compile(name=n...
message = "Hello charm" print(message) # called string methods print(message.title()) print(message.upper()) print(message.lower()) myint1 = 7 myint2 = 20 print(myint1 + myint2) myfloat1 = 1.5 myfloat2 = 2.5 print(myfloat1 + myfloat2) #convert int to str print("Happy " + str(myint2) + " birthday")
message = 'Hello charm' print(message) print(message.title()) print(message.upper()) print(message.lower()) myint1 = 7 myint2 = 20 print(myint1 + myint2) myfloat1 = 1.5 myfloat2 = 2.5 print(myfloat1 + myfloat2) print('Happy ' + str(myint2) + ' birthday')
""" Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ class Solution: """ @param root: the root @return: the second minimum value in the set made of all the nodes' value in the whole tree """ def findSecondMini...
""" Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ class Solution: """ @param root: the root @return: the second minimum value in the set made of all the nodes' value in the whole tree """ def find_second_m...
# Copyright (c) 2015 Joshua Coady # 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, distri...
class Card: """a single card in the deck""" __val = 0 __symbol = '' __suit = '' __visible = False def __init__(self, val, symbol, suit): self.__val = val self.__symbol = symbol self.__suit = suit def get_value(self): """getter for value""" return sel...
class RoutingPath: """Holds a list of block_ids and has section_id, list_item_id and list_name attributes""" def __init__(self, block_ids, section_id, list_item_id=None, list_name=None): self.block_ids = tuple(block_ids) self.section_id = section_id self.list_item_id = list_item_id ...
class Routingpath: """Holds a list of block_ids and has section_id, list_item_id and list_name attributes""" def __init__(self, block_ids, section_id, list_item_id=None, list_name=None): self.block_ids = tuple(block_ids) self.section_id = section_id self.list_item_id = list_item_id ...
def iterSects(activeOnly=True): for sect in sections: options = {} if type(sect) is tuple: sect, options = sect try: active = options['active'] except KeyError: active = True if active or not activeOnly: yield ...
def iter_sects(activeOnly=True): for sect in sections: options = {} if type(sect) is tuple: (sect, options) = sect try: active = options['active'] except KeyError: active = True if active or not activeOnly: yield (sect, options)
name = "Manish" age = 30 print("This is hello world!!!") print(name) print(float(age)) age = "31" print(age) print("this", "is", "cool", "and", "awesome!")
name = 'Manish' age = 30 print('This is hello world!!!') print(name) print(float(age)) age = '31' print(age) print('this', 'is', 'cool', 'and', 'awesome!')
def ficha(nome='desconhecido', gols=0 ): print(f'O jogador {nome} marcou {gols} no campeonato.') jogador = str(input('Nome do jogador: ')) golos = str(input('Quantos golos marcados: ')) if golos.isnumeric(): golos = int(golos) else: golos = 0 if jogador.strip() == '': ficha(gols=golos) els...
def ficha(nome='desconhecido', gols=0): print(f'O jogador {nome} marcou {gols} no campeonato.') jogador = str(input('Nome do jogador: ')) golos = str(input('Quantos golos marcados: ')) if golos.isnumeric(): golos = int(golos) else: golos = 0 if jogador.strip() == '': ficha(gols=golos) else: ...
try: x=int(input()) y=int(input()) if(x>y): print(x) else : print(y) except : # if error occurse then except will work print("Bokachoda") else : # else will run if no error occur print("All Done") finally : # finally will work if it has error or not print("D") # cant use...
try: x = int(input()) y = int(input()) if x > y: print(x) else: print(y) except: print('Bokachoda') else: print('All Done') finally: print('D')
# Copyright 2016 Ifwe 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, so...
""" Base class and helpers for tds.views """ class Base(object): """Base class and interface for a tds.views class.""" def __init__(self, output_format): """Initialize object.""" self.output_format = output_format def generate_result(self, view_name, tds_result): """ Creat...
# # PySNMP MIB module CASA-802-TAP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CASA-802-TAP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:29:27 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, value_range_constraint, value_size_constraint, single_value_constraint) ...
# # PySNMP MIB module DOCS-IETF-CABLE-DEVICE-NOTIFICATION-MIB (http://pysnmp.sf.net) # ASN.1 source http://mibs.snmplabs.com:80/asn1/DOCS-IETF-CABLE-DEVICE-NOTIFICATION-MIB # Produced by pysmi-0.0.7 at Sun Feb 14 00:09:52 2016 # On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose # Using Python ...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, constraints_intersection, constraints_union, value_size_constraint) ...
# # PySNMP MIB module MY-VLAN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MY-VLAN-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:16:48 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 0...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constraint, constraints_union, single_value_constraint, constraints_intersection) ...
name, age = "ansan p", 18 username = "ansanpsam710*" print ('Hello!') print("Name: {}\nAge: {}\nUsername: {}".format(name, age, username))
(name, age) = ('ansan p', 18) username = 'ansanpsam710*' print('Hello!') print('Name: {}\nAge: {}\nUsername: {}'.format(name, age, username))
class Stack: def __init__(self): self.items = [] def is_empty(self): return self.items == [] def push(self, data): self.items.append(data) def pop(self): return self.items.pop() def display(self): for data in reversed(self.items): print(data)...
class Stack: def __init__(self): self.items = [] def is_empty(self): return self.items == [] def push(self, data): self.items.append(data) def pop(self): return self.items.pop() def display(self): for data in reversed(self.items): print(data) ...
class BotError(RuntimeError): def __init__(self, message = "An unexpected error occurred with the bot!"): self.message = message class DataError(RuntimeError): def __init__(self, message = "An unexpected error occurred when accessing/saving data!"): self.message = message
class Boterror(RuntimeError): def __init__(self, message='An unexpected error occurred with the bot!'): self.message = message class Dataerror(RuntimeError): def __init__(self, message='An unexpected error occurred when accessing/saving data!'): self.message = message
print('='*8,'Tinta para Pintar Parede','='*8) l = float(input('Qual a largura da parede em metros?')) a = float(input('Qual a altura da parede em metros?')) a2 = a*l qt = a2/2 print('''As dimensoes dessa parede sao de {}x{}. A area desta parede equivale a {} metros quadrados. Para pinta-la serao necessarios cerca de {}...
print('=' * 8, 'Tinta para Pintar Parede', '=' * 8) l = float(input('Qual a largura da parede em metros?')) a = float(input('Qual a altura da parede em metros?')) a2 = a * l qt = a2 / 2 print('As dimensoes dessa parede sao de {}x{}.\nA area desta parede equivale a {} metros quadrados.\nPara pinta-la serao necessarios c...
# -*- coding: utf-8 -*- """ Created on Wed Sep 2 10:24:43 2020 @author: roger luo """ def fun_add(x, y): """add numbers .. _x-y-z: Parameters ---------- x : TYPE DESCRIPTION. y : TYPE DESCRIPTION. Returns ------- None. """ ...
""" Created on Wed Sep 2 10:24:43 2020 @author: roger luo """ def fun_add(x, y): """add numbers .. _x-y-z: Parameters ---------- x : TYPE DESCRIPTION. y : TYPE DESCRIPTION. Returns ------- None. """ return (x, y) def showpl...
def get_all_files_in_folder(folder, types): files_grabbed = [] for t in types: files_grabbed.extend(folder.rglob(t)) files_grabbed = sorted(files_grabbed, key=lambda x: x) return files_grabbed def yolo2voc(image_height, image_width, bboxes): """ yolo => [xmid, ymid, w, h] (normalized) ...
def get_all_files_in_folder(folder, types): files_grabbed = [] for t in types: files_grabbed.extend(folder.rglob(t)) files_grabbed = sorted(files_grabbed, key=lambda x: x) return files_grabbed def yolo2voc(image_height, image_width, bboxes): """ yolo => [xmid, ymid, w, h] (normalized) ...
# File: terraformcloud_consts.py # Copyright (c) 2020 Splunk Inc. # # Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) TERRAFORM_DEFAULT_URL = "https://app.terraform.io" TERRAFORM_BASE_API_ENDPOINT = "/api/v2" TERRAFORM_ENDPOINT_WORKSPACES = "/organizations/{organization_name}/workspaces" T...
terraform_default_url = 'https://app.terraform.io' terraform_base_api_endpoint = '/api/v2' terraform_endpoint_workspaces = '/organizations/{organization_name}/workspaces' terraform_endpoint_get_workspace_by_id = '/workspaces/{id}' terraform_endpoint_runs = '/runs' terraform_endpoint_list_runs = '/workspaces/{id}/runs' ...
# This problem was recently asked by Uber: # Imagine you are building a compiler. Before running any code, the compiler must check that the parentheses in the program are balanced. Every opening bracket must have a corresponding closing bracket. We can approximate this using strings. # Given a string containing just...
class Solution: def is_valid(self, s): stack = [] open_list = ['[', '{', '('] close_list = [']', '}', ')'] for i in s: if i in open_list: stack.append(i) elif i in close_list: pos = close_list.index(i) if len(st...
# result = {"Borough Park" : [[lat1, lon1], [lat2, lon2], ...]} """ polygons = { "Borough Park" : {Lat : [], Lon : []} "East Flushing" : {Lat : [], Lon : []} "Auburndale" : {Lat : [], Lon : []} . . . "Elmhurst" : {Lat : [], Lon : []} } """ def process_coordinates(result): """ A function read the dictionary co...
""" polygons = { "Borough Park" : {Lat : [], Lon : []} "East Flushing" : {Lat : [], Lon : []} "Auburndale" : {Lat : [], Lon : []} . . . "Elmhurst" : {Lat : [], Lon : []} } """ def process_coordinates(result): """ A function read the dictionary contains key: neighborhood value: list of coordinates (lat...
fin = open('Assignment-2-data.txt', 'r') data = fin.readlines() for n in range(len(data)): data[n] = data[n].split() fin.close() fout = open('Assignment-2-table.txt', 'w') for n in range(1, 75): fout.write(str(n) + ' & ' + data[n - 1][0] + ' & ' + data[n - 1][1] + ' & \\includegraphics[width=.3\\columnwidth]{...
fin = open('Assignment-2-data.txt', 'r') data = fin.readlines() for n in range(len(data)): data[n] = data[n].split() fin.close() fout = open('Assignment-2-table.txt', 'w') for n in range(1, 75): fout.write(str(n) + ' & ' + data[n - 1][0] + ' & ' + data[n - 1][1] + ' & \\includegraphics[width=.3\\columnwidth]{As...
def test_e1(): x: i32 s: str x = 0 s = 's' print(x+s)
def test_e1(): x: i32 s: str x = 0 s = 's' print(x + s)
def func(): print("func") func() # $ resolved=func class MyBase: def base_method(self): print("base_method", self) class MyClass(MyBase): def method1(self): print("method1", self) @classmethod def cls_method(cls): print("cls_method", cls) @staticmethod def stat...
def func(): print('func') func() class Mybase: def base_method(self): print('base_method', self) class Myclass(MyBase): def method1(self): print('method1', self) @classmethod def cls_method(cls): print('cls_method', cls) @staticmethod def static(): print...
frase =[] maiuscula= '' def maiusculas(frase): maiuscula= '' for i in frase: letra = i if letra.isalpha(): letra_m = letra.upper() if letra_m == letra.upper(): if letra == letra_m: maiuscula += letra print(maiuscula) return maiusc...
frase = [] maiuscula = '' def maiusculas(frase): maiuscula = '' for i in frase: letra = i if letra.isalpha(): letra_m = letra.upper() if letra_m == letra.upper(): if letra == letra_m: maiuscula += letra print(maiuscula) return maiuscula ma...
inp = """L.LL.LL.LL LLLLLLL.LL L.L.L..L.. LLLL.LL.LL L.LL.LL.LL L.LLLLL.LL ..L.L..... LLLLLLLLLL L.LLLLLL.L L.LLLLL.LL""" inp = """LLLLLLLLLL.LLLLLL.LLLLLLLLLLLL.LL.LLLL.LLLLL.LLLLLLL.LLLLLL.LLLLLL.LLLLLL.LLLLLLLLLLLLLLLLLL LLLLLLLLLLLLLLLLLLLLLLLLLLLLLL.LLLLLLL.LLLLL.LLLLLLL.LLLLLLLLLLLLL.LLLL.L.LLLLLLLLL...
inp = 'L.LL.LL.LL\nLLLLLLL.LL\nL.L.L..L..\nLLLL.LL.LL\nL.LL.LL.LL\nL.LLLLL.LL\n..L.L.....\nLLLLLLLLLL\nL.LLLLLL.L\nL.LLLLL.LL' inp = 'LLLLLLLLLL.LLLLLL.LLLLLLLLLLLL.LL.LLLL.LLLLL.LLLLLLL.LLLLLL.LLLLLL.LLLLLL.LLLLLLLLLLLLLLLLLL\nLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL.LLLLLLL.LLLLL.LLLLLLL.LLLLLLLLLLLLL.LLLL.L.LLLLLLLLLL.LLLLLLL...
''' Leetcode problem No 859 Buddy Strings Solution written by Xuqiang Fang on 24 June, 2018 ''' class Solution(object): def buddyStrings(self, A, B): if len(A) != len(B): return False dica = {} dicb = {} c = 0 for i in range(len(A)): a = A[i] ...
""" Leetcode problem No 859 Buddy Strings Solution written by Xuqiang Fang on 24 June, 2018 """ class Solution(object): def buddy_strings(self, A, B): if len(A) != len(B): return False dica = {} dicb = {} c = 0 for i in range(len(A)): a = A[i] ...
nin=input() x=[] for i in range(len(nin)): x.append(int(nin[i])) list_of_numbers=[] status='qualified' majority=0 for i in range(len(x)): status='qualified' if i==0: list_of_numbers.append([]) list_of_numbers[i].append(x[i]) else: for j in range(len(list_of_numbers)): ...
nin = input() x = [] for i in range(len(nin)): x.append(int(nin[i])) list_of_numbers = [] status = 'qualified' majority = 0 for i in range(len(x)): status = 'qualified' if i == 0: list_of_numbers.append([]) list_of_numbers[i].append(x[i]) else: for j in range(len(list_of_numbers)...
def index(): images = team_db().select(team_db.image.ALL, orderby=team_db.image.category_id) categories = team_db().select(team_db.category.ALL, orderby=team_db.category.priority) return dict(images=images, categories=categories) def download(): return response.download(request, team_db)
def index(): images = team_db().select(team_db.image.ALL, orderby=team_db.image.category_id) categories = team_db().select(team_db.category.ALL, orderby=team_db.category.priority) return dict(images=images, categories=categories) def download(): return response.download(request, team_db)
# -*- coding: utf-8 -*- value1 = input() value2 = input() prod = value1+value2 print("SOMA = " + str(prod))
value1 = input() value2 = input() prod = value1 + value2 print('SOMA = ' + str(prod))
""" NAME binary_search - binary search template DESCRIPTION This module implements the many version of binary search. * bisect binary search the only true occurrence * bisect_left binary search the left-most occurrence * bisect_rigth binary search the right-most occurrence * bisect_fi...
""" NAME binary_search - binary search template DESCRIPTION This module implements the many version of binary search. * bisect binary search the only true occurrence * bisect_left binary search the left-most occurrence * bisect_rigth binary search the right-most occurrence * bisect_fi...
class Solution: def minimumSize(self, nums: List[int], maxOperations: int) -> int: lo, hi = 1, 1_000_000_000 while lo < hi: mid = lo + hi >> 1 if sum((x-1)//mid for x in nums) <= maxOperations: hi = mid else: lo = mid + 1 return lo
class Solution: def minimum_size(self, nums: List[int], maxOperations: int) -> int: (lo, hi) = (1, 1000000000) while lo < hi: mid = lo + hi >> 1 if sum(((x - 1) // mid for x in nums)) <= maxOperations: hi = mid else: lo = mid + 1 ...
class sequenceObjects(object): """generate objects for each vertical and horizontal sequences""" def __init__(self, index, length, sumOfInts, isHorizontal): self.isFilled = False self.index = index self.lengthOfSequence = length self.sumOfInts = sumOfInts reverseIndex = reversed(self.inde...
class Sequenceobjects(object): """generate objects for each vertical and horizontal sequences""" def __init__(self, index, length, sumOfInts, isHorizontal): self.isFilled = False self.index = index self.lengthOfSequence = length self.sumOfInts = sumOfInts reverse_index =...
#!/usr/bin/python """ """ class Vegetable: """A vegetable is the main resource for making a great soup. More seriously, a vegtable represents the basic abstraction of a web page element. It provides default access operation over such element namely : * Finding element(s) from tag name using attribut...
""" """ class Vegetable: """A vegetable is the main resource for making a great soup. More seriously, a vegtable represents the basic abstraction of a web page element. It provides default access operation over such element namely : * Finding element(s) from tag name using attribute access operator. ...
# simple result class class SerfResult(object): """ Result object for responses from a Serf agent. """ def __init__(self, head=None, body=None): self.head, self.body = head, body def __iter__(self): """ Iterator. Used for assignment, i.e.:: head, bod...
class Serfresult(object): """ Result object for responses from a Serf agent. """ def __init__(self, head=None, body=None): (self.head, self.body) = (head, body) def __iter__(self): """ Iterator. Used for assignment, i.e.:: head, body = result "...
BINDIR = '/usr/local/bin' BLOCK_MESSAGE_KEYS = [] BUILD_TYPE = 'app' BUNDLE_NAME = 'pebble.pbw' DEFINES = ['RELEASE'] LIBDIR = '/usr/local/lib' LIB_DIR = 'node_modules' LIB_JSON = [] MESSAGE_KEYS = {} MESSAGE_KEYS_HEADER = '/mnt/files/scripts/pebble/pebble-navigation/pebble/build/include/message_keys.auto.h' NODE_PATH ...
bindir = '/usr/local/bin' block_message_keys = [] build_type = 'app' bundle_name = 'pebble.pbw' defines = ['RELEASE'] libdir = '/usr/local/lib' lib_dir = 'node_modules' lib_json = [] message_keys = {} message_keys_header = '/mnt/files/scripts/pebble/pebble-navigation/pebble/build/include/message_keys.auto.h' node_path ...
CONF = { "git_bash" : { "name": "Git BRanch on bash prompt", "commands": """ # ref: https://coderwall.com/p/fasnya/add-git-branch-name-to-bash-prompt parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' } export PS1="[\$(date +%k:%M:%S)] \\u@\h \[\033[3...
conf = {'git_bash': {'name': 'Git BRanch on bash prompt', 'commands': '\n# ref: https://coderwall.com/p/fasnya/add-git-branch-name-to-bash-prompt\nparse_git_branch() {\n git branch 2> /dev/null | sed -e \'/^[^*]/d\' -e \'s/* \\(.*\\)/ (\x01)/\'\n}\nexport PS1="[\\$(date +%k:%M:%S)] \\u@\\h \\[\x1b[32m\\]\\w\\[\x1b[...
""" Stores a Boolean indicating if the app should run in debug mode or not. This option can be set with -d or --debug on start. """ debug = False """ Variable storing a reference to the container backend implementation the API should use. This option can be set with --container-backend CONTAINER_BACKEND on start. "...
""" Stores a Boolean indicating if the app should run in debug mode or not. This option can be set with -d or --debug on start. """ debug = False '\nVariable storing a reference to the container backend implementation the API should use.\n\nThis option can be set with --container-backend CONTAINER_BACKEND on start.\n'...
test = dict( batch_size=8, num_workers=2, eval_func="default_test", clip_range=None, tta=dict( # based on the ttach lib enable=False, reducation="mean", # 'mean', 'gmean', 'sum', 'max', 'min', 'tsharpen' cfg=dict( HorizontalFlip=dict(), VerticalFlip=...
test = dict(batch_size=8, num_workers=2, eval_func='default_test', clip_range=None, tta=dict(enable=False, reducation='mean', cfg=dict(HorizontalFlip=dict(), VerticalFlip=dict(), Rotate90=dict(angles=[0, 90, 180, 270]), Scale=dict(scales=[0.75, 1, 1.5], interpolation='bilinear', align_corners=False), Add=dict(values=[0...
# Latihan menampilkan deret fibonacci dengan fungsi rekursif def fibonacci(n): if n == 0 or n == 1: return n else: return (fibonacci(n-1) + fibonacci(n-2)) input_nilai = 6 for i in range(input_nilai): print(fibonacci(i), end=' ')
def fibonacci(n): if n == 0 or n == 1: return n else: return fibonacci(n - 1) + fibonacci(n - 2) input_nilai = 6 for i in range(input_nilai): print(fibonacci(i), end=' ')
""" 34. Find First and Last Position of Element in Sorted Array Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value. If target is not found in the array, return [-1, -1]. Follow up: Could you write an algorithm with O(log n) runtime complexity? ...
""" 34. Find First and Last Position of Element in Sorted Array Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value. If target is not found in the array, return [-1, -1]. Follow up: Could you write an algorithm with O(log n) runtime complexity? ...
# Auth Constants TOKEN_HEADER = {"alg": "RS256", "typ": "JWT", "kid": "flask-jwt-oidc-test-client"} BASE_AUTH_CLAIMS = { "iss": "test_issuer", "sub": "43e6a245-0bf7-4ccf-9bd0-e7fb85fd18cc", "aud": "test_audience", "exp": 21531718745, "iat": 1531718745, "jti": "flask-jwt-oidc-test-support", ...
token_header = {'alg': 'RS256', 'typ': 'JWT', 'kid': 'flask-jwt-oidc-test-client'} base_auth_claims = {'iss': 'test_issuer', 'sub': '43e6a245-0bf7-4ccf-9bd0-e7fb85fd18cc', 'aud': 'test_audience', 'exp': 21531718745, 'iat': 1531718745, 'jti': 'flask-jwt-oidc-test-support', 'typ': 'Bearer', 'username': 'test-user', 'real...
# Works from Zero til One Thousand! def InWords(num): # We must define all unique numbers TillFifteen = {0: "zero", 1: "one", 2: "two", 3: "three", 4: "four", 5: "five", 6: "six", 7: "seven", 8: "eight", 9: "nine", 10: "ten", 11: "eleven", 12: "twelve", 13: "thirteen", 15: "fifteen"} # Mul...
def in_words(num): till_fifteen = {0: 'zero', 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine', 10: 'ten', 11: 'eleven', 12: 'twelve', 13: 'thirteen', 15: 'fifteen'} multiples_of_ten = {20: 'twenty', 30: 'thirty', 40: 'forty', 50: 'fifty', 60: 'sixty', 70: 'seven...
# # PySNMP MIB module MBG-SNMP-LT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MBG-SNMP-LT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:00:25 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, single_value_constraint, constraints_union, value_size_constraint) ...
"""A generate file containing all source files used to produce `cargo-bazel`""" # Each source file is tracked as a target so the `cargo_bootstrap_repository` # rule will know to automatically rebuild if any of the sources changed. CARGO_BAZEL_SRCS = [ "@rules_rust//crate_universe:src/cli.rs", "@rules_rust//cra...
"""A generate file containing all source files used to produce `cargo-bazel`""" cargo_bazel_srcs = ['@rules_rust//crate_universe:src/cli.rs', '@rules_rust//crate_universe:src/cli/generate.rs', '@rules_rust//crate_universe:src/cli/query.rs', '@rules_rust//crate_universe:src/cli/splice.rs', '@rules_rust//crate_universe:s...
""" File: boggle.py Name:Jacky ---------------------------------------- This program lets user to input alphabets which arrange on square. And this program will print words which combined on the neighbor alphabets. """ # This is the file name of the dictionary txt file # we will be checking if a word exists by searchi...
""" File: boggle.py Name:Jacky ---------------------------------------- This program lets user to input alphabets which arrange on square. And this program will print words which combined on the neighbor alphabets. """ file = 'dictionary.txt' size = 4 dictionary_list = {} def main(): """ boggle list let user inpu...
class Request(dict): def __init__(self, server_port=None, server_name=None, remote_addr=None, uri=None, query_string=None, script_name=None, scheme=None, method=None, headers={}, body=None): super().__init__({ "server_port": server_port, "server_nam...
class Request(dict): def __init__(self, server_port=None, server_name=None, remote_addr=None, uri=None, query_string=None, script_name=None, scheme=None, method=None, headers={}, body=None): super().__init__({'server_port': server_port, 'server_name': server_name, 'remote_addr': remote_addr, 'uri': uri, 's...
def factorial(n): if n == 0: return 1 return factorial(n-1) * n
def factorial(n): if n == 0: return 1 return factorial(n - 1) * n
def getalpha(schedule, step): alpha = 0.0 for (point, alpha_) in schedule: if step >= point: alpha = alpha_ else: break return alpha step_stage_0 = 0 step_stage_1 = 5e4 step_stage_2 = 7e4 step_stage_3 = 1e5 step_stage_4 = 2.5e5 step_stages = [step_stage_0, step_sta...
def getalpha(schedule, step): alpha = 0.0 for (point, alpha_) in schedule: if step >= point: alpha = alpha_ else: break return alpha step_stage_0 = 0 step_stage_1 = 50000.0 step_stage_2 = 70000.0 step_stage_3 = 100000.0 step_stage_4 = 250000.0 step_stages = [step_stag...
def nome_no_formulario(): nome = input() tamanho_de_caracteres = len(nome) if tamanho_de_caracteres > 80: print('NO') else: print('YES') nome_no_formulario()
def nome_no_formulario(): nome = input() tamanho_de_caracteres = len(nome) if tamanho_de_caracteres > 80: print('NO') else: print('YES') nome_no_formulario()
class Fib: def __init__(self,nn): print("inicjujemy") self.__n=nn self.__i=0 self.__p1=self.__p2=1 def __iter__(self): print('iter') return self def __next__(self): print('next') self.__i+=1 if self.__i>self.__n: ...
class Fib: def __init__(self, nn): print('inicjujemy') self.__n = nn self.__i = 0 self.__p1 = self.__p2 = 1 def __iter__(self): print('iter') return self def __next__(self): print('next') self.__i += 1 if self.__i > self.__n: ...
# (C) Datadog, Inc. 2018 # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) CORE_GAUGES = { 'system.disk.total': 5, 'system.disk.used': 4, 'system.disk.free': 1, 'system.disk.in_use': .80, } CORE_RATES = { 'system.disk.write_time_pct': 9.0, 'system.disk.read_time_p...
core_gauges = {'system.disk.total': 5, 'system.disk.used': 4, 'system.disk.free': 1, 'system.disk.in_use': 0.8} core_rates = {'system.disk.write_time_pct': 9.0, 'system.disk.read_time_pct': 5.0} unix_gauges = {'system.fs.inodes.total': 10, 'system.fs.inodes.used': 1, 'system.fs.inodes.free': 9, 'system.fs.inodes.in_use...