content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license # This is a nullcontext for both sync and async. 3.7 has a nullcontext, # but it is only for sync use. class NullContext: def __init__(self, enter_result=None): self.enter_result = enter_result def __enter__(self): r...
class Nullcontext: def __init__(self, enter_result=None): self.enter_result = enter_result def __enter__(self): return self.enter_result def __exit__(self, exc_type, exc_value, traceback): pass async def __aenter__(self): return self.enter_result async def __aexi...
class AyaChanBotError(Exception): pass class AnimeImageSearchingError(AyaChanBotError): pass
class Ayachanboterror(Exception): pass class Animeimagesearchingerror(AyaChanBotError): pass
# lc697.py # LeetCode 697. Degree of an Array `E` # acc | 100% | 41' # A~0g29 class Solution: def findShortestSubArray(self, nums: List[int]) -> int: if len(nums) == len(set(nums)): return 1 count = Counter(nums) deg = max(count.values()) ans = len(nums) for k,...
class Solution: def find_shortest_sub_array(self, nums: List[int]) -> int: if len(nums) == len(set(nums)): return 1 count = counter(nums) deg = max(count.values()) ans = len(nums) for (k, v) in count.items(): if v == deg: ans = min(len...
cnt = 0 c = int(input()) a = [] for i in range(c): x = int(input()) a.append(x) for x in a: cnt += x print(cnt)
cnt = 0 c = int(input()) a = [] for i in range(c): x = int(input()) a.append(x) for x in a: cnt += x print(cnt)
{ "targets": [ { "include_dirs": [ "<!(node -e \"require('nan')\")" ], "target_name": "cppaddon", "sources": [ "src/lib.cpp" ] } ] }
{'targets': [{'include_dirs': ['<!(node -e "require(\'nan\')")'], 'target_name': 'cppaddon', 'sources': ['src/lib.cpp']}]}
# # @lc app=leetcode id=276 lang=python3 # # [276] Paint Fence # # @lc code=start class Solution: def numWays(self, n: int, k: int): if n == 0: return 0 if n == 1: return k same = 0 diff = k for _ in range(1, n): tmp = diff dif...
class Solution: def num_ways(self, n: int, k: int): if n == 0: return 0 if n == 1: return k same = 0 diff = k for _ in range(1, n): tmp = diff diff = (same + diff) * (k - 1) same = tmp return same + diff
load("@rules_pkg//:providers.bzl", "PackageVariablesInfo") def _debvars_impl(ctx): return PackageVariablesInfo(values = { "package": ctx.attr.package, "version": ctx.attr.version, "arch": ctx.attr.arch, }) debvars = rule( implementation = _debvars_impl, attrs = { "packa...
load('@rules_pkg//:providers.bzl', 'PackageVariablesInfo') def _debvars_impl(ctx): return package_variables_info(values={'package': ctx.attr.package, 'version': ctx.attr.version, 'arch': ctx.attr.arch}) debvars = rule(implementation=_debvars_impl, attrs={'package': attr.string(doc='Placeholder for our final produc...
test = { 'name': '', 'points': 1, 'suites': [ { 'cases': [ { 'code': r""" >>> a [1, 8, 7, 20, 13, 32, 19, 44, 25, 56, 31, 68, 37, 80, 43, 92, 49, 104, 55, 116, 61, 128, 67, 140, 73, 152, 79, 164, 85, 176, 91, 188, 97, 200] """, 'hidden': False, ...
test = {'name': '', 'points': 1, 'suites': [{'cases': [{'code': '\n >>> a\n [1, 8, 7, 20, 13, 32, 19, 44, 25, 56, 31, 68, 37, 80, 43, 92, 49, 104, 55, 116, 61, 128, 67, 140, 73, 152, 79, 164, 85, 176, 91, 188, 97, 200]\n ', 'hidden': False, 'locked': False}], 'scored': True, 'setup': '', 'tea...
class Solution: #description: Given an integer n, return the number of trailing zeroes in n!. def trailingZeroes(self, n: int) -> int: nFactorial = self.factorial(n) total = 0 while nFactorial%10 == 0 and nFactorial > 0: total += 1 nFactorial = nFactorial//10 ...
class Solution: def trailing_zeroes(self, n: int) -> int: n_factorial = self.factorial(n) total = 0 while nFactorial % 10 == 0 and nFactorial > 0: total += 1 n_factorial = nFactorial // 10 return total def factorial(self, n: int) -> int: total = ...
class MyHashSet(object): def __init__(self): """ Initialize your data structure here. """ self.num_buckets = 100 self.buckets = [[] for _ in range(self.num_buckets)] def hash_func(self, inp): return inp%self.num_buckets def add(self, key): "...
class Myhashset(object): def __init__(self): """ Initialize your data structure here. """ self.num_buckets = 100 self.buckets = [[] for _ in range(self.num_buckets)] def hash_func(self, inp): return inp % self.num_buckets def add(self, key): """ ...
class ClassFairnessMetadata(object): # :brief Store metadata for an update needed to guarantee class-based fairness # :param num_classes [int] total no. of classes # :param class_id_to_num_examples_dict [dict<int, int>] maps class id to no. of examples in class def __init__(self, num_classes, class_id_t...
class Classfairnessmetadata(object): def __init__(self, num_classes, class_id_to_num_examples_dict): self.num_classes = num_classes self.class_id_to_num_examples_dict = class_id_to_num_examples_dict
class OblioAlg(object): def __init__(self): self.known_tuples = {} def put(self, attempted_tuple, response): # This is a callback that the oblio engine feeds the results # of your guess to. self.known_tuples.update({attempted_tuple: response}) def produce(self): rai...
class Oblioalg(object): def __init__(self): self.known_tuples = {} def put(self, attempted_tuple, response): self.known_tuples.update({attempted_tuple: response}) def produce(self): raise NotImplemented
class BaseParser: """ This class is the abstract for the different parser objects. Like the miseq and directory parser, a new parser class needs the following static methods find_single_run(directory) find_runs(directory) get_required_file_list() get_sample_sheet(direc...
class Baseparser: """ This class is the abstract for the different parser objects. Like the miseq and directory parser, a new parser class needs the following static methods find_single_run(directory) find_runs(directory) get_required_file_list() get_sample_sheet(direc...
N40H = { 'magnet_material' : "Arnold/Reversible/N40H", 'magnet_material_density' : 7450, # kg/m3 'magnet_youngs_modulus' : 160E9, # Pa 'magnet_poission_ratio' :.24, 'magnet_material_cost' : 712756, # $/m3 'magnetization_direction' : 'Parallel', 'B_r' ...
n40_h = {'magnet_material': 'Arnold/Reversible/N40H', 'magnet_material_density': 7450, 'magnet_youngs_modulus': 160000000000.0, 'magnet_poission_ratio': 0.24, 'magnet_material_cost': 712756, 'magnetization_direction': 'Parallel', 'B_r': 1.285, 'mu_r': 1.062, 'magnet_max_temperature': 80, 'magnet_max_rad_stress': 0, 'ma...
# class Tree: # def __init__(self, val, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def solve(self, preorder, inorder): pi = 0 n = len(preorder) def helper(i,j): nonlocal pi if i > j: ...
class Solution: def solve(self, preorder, inorder): pi = 0 n = len(preorder) def helper(i, j): nonlocal pi if i > j: return node = tree(preorder[pi]) pi += 1 for k in range(i, j + 1): if inorder[k] ...
# -*- coding: utf-8 -*- # DATA DATAFILE_PATH = "./data/" INVENTORY_AV_EXPORT = "data.txt" BACKLOG_EXPORT = "bl.txt" HFR_EXPORT = "hfr.txt" SCHEDULE_URL = "https://www.toki.co.jp/purchasing/TLIHTML.files/sheet001.htm" VALIDATION_DB = "validate.csv" TRANSLATION_DB = "translate.csv" OUTFILE = "_materials.xlsx" # SHIPPIN...
datafile_path = './data/' inventory_av_export = 'data.txt' backlog_export = 'bl.txt' hfr_export = 'hfr.txt' schedule_url = 'https://www.toki.co.jp/purchasing/TLIHTML.files/sheet001.htm' validation_db = 'validate.csv' translation_db = 'translate.csv' outfile = '_materials.xlsx' shipping_dates = [] shipping_width = 0 sch...
class FrameData(object): def __init__(self, number, name, box_count, boxes): self.number = number self.name = name self.box_count = box_count self.boxes = boxes def to_serialize(self): return { "number": self.number, "name": self.name, ...
class Framedata(object): def __init__(self, number, name, box_count, boxes): self.number = number self.name = name self.box_count = box_count self.boxes = boxes def to_serialize(self): return {'number': self.number, 'name': self.name, 'box_count': self.box_count, 'boxes...
# # Copyright 2013 Quantopian, 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 wr...
class Ziplineerror(Exception): msg = None def __init__(self, *args, **kwargs): self.args = args self.kwargs = kwargs self.message = str(self) def __str__(self): msg = self.msg.format(**self.kwargs) return msg __unicode__ = __str__ __repr__ = __str__ class W...
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def isSubtree(self, s, t): """ :type s: TreeNode :type t: TreeNode :rtype: bool "...
class Solution(object): def is_subtree(self, s, t): """ :type s: TreeNode :type t: TreeNode :rtype: bool """ if not s or not t: return not s and (not t) if self.check(s, t): return True return self.isSubtree(s.left, t) or self....
# Time: O(n) # Space: O(n) class Solution(object): def pushDominoes(self, dominoes): """ :type dominoes: str :rtype: str """ force = [0]*len(dominoes) f = 0 for i in range(len(dominoes)): if dominoes[i] == 'R': f = len(dominoes)...
class Solution(object): def push_dominoes(self, dominoes): """ :type dominoes: str :rtype: str """ force = [0] * len(dominoes) f = 0 for i in range(len(dominoes)): if dominoes[i] == 'R': f = len(dominoes) elif dominoes[...
"""Information tracking the latest published configs.""" bazel = "0.26.0" registry = "marketplace.gcr.io" repository = "google/rbe-ubuntu16-04" digest = "sha256:94d7d8552902d228c32c8c148cc13f0effc2b4837757a6e95b73fdc5c5e4b07b" configs_version = "9.0.0"
"""Information tracking the latest published configs.""" bazel = '0.26.0' registry = 'marketplace.gcr.io' repository = 'google/rbe-ubuntu16-04' digest = 'sha256:94d7d8552902d228c32c8c148cc13f0effc2b4837757a6e95b73fdc5c5e4b07b' configs_version = '9.0.0'
def swap(d, k1, k2): value1 = d[k1] value2 = d[k2] d[k1] = value2 d[k2] = value1
def swap(d, k1, k2): value1 = d[k1] value2 = d[k2] d[k1] = value2 d[k2] = value1
def area(l, w): if (l <0 or w< 0): raise ValueError("Only positive integers, please") return l*w
def area(l, w): if l < 0 or w < 0: raise value_error('Only positive integers, please') return l * w
class APIException(Exception): """The API server returned an error.""" def __init__(self, code, msg): super(APIException, self).__init__(msg) self.code = code class KeepException(Exception): """Generic Keep error.""" pass class LoginException(KeepException): """Login exception.""" ...
class Apiexception(Exception): """The API server returned an error.""" def __init__(self, code, msg): super(APIException, self).__init__(msg) self.code = code class Keepexception(Exception): """Generic Keep error.""" pass class Loginexception(KeepException): """Login exception."""...
""" Longest Common Prefix Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". Example 1: Input: ["flower","flow","flight"] Output: "fl" Example 2: Input: ["dog","racecar","car"] Output: "" Explanation: There is no common pr...
""" Longest Common Prefix Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". Example 1: Input: ["flower","flow","flight"] Output: "fl" Example 2: Input: ["dog","racecar","car"] Output: "" Explanation: There is no common pr...
class VALInstanceStatus(object): """ Model which represents the status of an VAL instance. Possible status values are: * name * image_name * created_at * status * ip * used_memory * used_cpu * network_tx_bytes * network_rx_bytes """ def __init__(self): ...
class Valinstancestatus(object): """ Model which represents the status of an VAL instance. Possible status values are: * name * image_name * created_at * status * ip * used_memory * used_cpu * network_tx_bytes * network_rx_bytes """ def __init__(self): ...
def comp_fill_factor(self): """Compute the fill factor of the winding""" if self.winding is None: return 0 else: (Nrad, Ntan) = self.winding.get_dim_wind() S_slot_wind = self.slot.comp_surface_wind() S_wind_act = ( self.winding.conductor.comp_surface_active() ...
def comp_fill_factor(self): """Compute the fill factor of the winding""" if self.winding is None: return 0 else: (nrad, ntan) = self.winding.get_dim_wind() s_slot_wind = self.slot.comp_surface_wind() s_wind_act = self.winding.conductor.comp_surface_active() * self.winding.Ntc...
abr = {'Alaska':'AK', 'Alabama':'AL', 'Arkansas':'AR', 'Arizona':'AZ', 'California':'CA', 'Colorado':'CO', 'Connecticut':'CT', 'District of Columbia':'DC', 'Delaware':'DE', 'Florida':'FL', 'Georgia':'GA', 'Hawaii':'HI', 'Iow...
abr = {'Alaska': 'AK', 'Alabama': 'AL', 'Arkansas': 'AR', 'Arizona': 'AZ', 'California': 'CA', 'Colorado': 'CO', 'Connecticut': 'CT', 'District of Columbia': 'DC', 'Delaware': 'DE', 'Florida': 'FL', 'Georgia': 'GA', 'Hawaii': 'HI', 'Iowa': 'IA', 'Idaho': 'ID', 'Illinois': 'IL', 'Indiana': 'IN', 'Kansas': 'KS', 'Kentuck...
class Photo: def __init__(self, id, user_id, upload_time, latitude_ref, latitude, longitude_ref, longitude, filename, is_featured): self.id = id self.user_id = user_id self.upload_time = upload_time self.latitude_ref = latitude_ref self.latitude = latitude self.longit...
class Photo: def __init__(self, id, user_id, upload_time, latitude_ref, latitude, longitude_ref, longitude, filename, is_featured): self.id = id self.user_id = user_id self.upload_time = upload_time self.latitude_ref = latitude_ref self.latitude = latitude self.longi...
def pad(n): if(n>=10): return "" + str(n) return "0" + str(n) class Time: def __init__(self,hour,minute): self.hour=hour self.minute=minute def __str__(self): if self.hour<=11: return "{0}:{1} AM".format(pad( self.hour),pad(sel...
def pad(n): if n >= 10: return '' + str(n) return '0' + str(n) class Time: def __init__(self, hour, minute): self.hour = hour self.minute = minute def __str__(self): if self.hour <= 11: return '{0}:{1} AM'.format(pad(self.hour), pad(self.minute)) if...
input_program = [line.strip() for line in open("input.txt")] #Pass 1 macro_name_table,mdtable = [],[] macro = 0 for linenumber,line in enumerate(input_program): if line == "MACRO": continue elif input_program[linenumber-1] == "MACRO": macro_name_table.append(line) mdtable.append(line) ...
input_program = [line.strip() for line in open('input.txt')] (macro_name_table, mdtable) = ([], []) macro = 0 for (linenumber, line) in enumerate(input_program): if line == 'MACRO': continue elif input_program[linenumber - 1] == 'MACRO': macro_name_table.append(line) mdtable.append(line)...
class Mappings: """Class with mapping, one for the condensed games (cg) and another for the recap of the games (hl). The dictionaries' keys are the teams' names and the values are the keywords for each of the type of videos. """ team_cg_map = { "Los Angeles Angels": "laa", "Houston ...
class Mappings: """Class with mapping, one for the condensed games (cg) and another for the recap of the games (hl). The dictionaries' keys are the teams' names and the values are the keywords for each of the type of videos. """ team_cg_map = {'Los Angeles Angels': 'laa', 'Houston Astros': 'hou', 'O...
K = int(input()) N = 1 << K R = [int(input()) for _ in range(N)] def winp(rp, rq): return 1. / (1 + 10 ** ((rq - rp) / 400.)) dp = [1.0] * N for i in range(K): _dp = [0.0] * N for l in range(0, N, 1 << (i + 1)): for j in range(l, l + (1 << (i + 1))): start = l + (1 << i) if j - l < (1...
k = int(input()) n = 1 << K r = [int(input()) for _ in range(N)] def winp(rp, rq): return 1.0 / (1 + 10 ** ((rq - rp) / 400.0)) dp = [1.0] * N for i in range(K): _dp = [0.0] * N for l in range(0, N, 1 << i + 1): for j in range(l, l + (1 << i + 1)): start = l + (1 << i) if j - l < 1 << i...
class PubSub(object): def __init__(self): self._subscriptions = {} def publish(self, data=None, source=None): heard = [] if source in self._subscriptions.keys(): for listener in self._subscriptions[source]: listener(data, source) heard.append(listener) if None in self._subscri...
class Pubsub(object): def __init__(self): self._subscriptions = {} def publish(self, data=None, source=None): heard = [] if source in self._subscriptions.keys(): for listener in self._subscriptions[source]: listener(data, source) heard.append...
#!/usr/bin/python3 with open('input.txt') as f: input = f.read().splitlines() lights = [] for i in range(1000): lights.append([]) for j in range(1000): lights[i].append(0) for command in input: offset = 0 if command.startswith('turn on'): offset = 8 elif command.startswith('turn off'): offse...
with open('input.txt') as f: input = f.read().splitlines() lights = [] for i in range(1000): lights.append([]) for j in range(1000): lights[i].append(0) for command in input: offset = 0 if command.startswith('turn on'): offset = 8 elif command.startswith('turn off'): offs...
# Rule class used by the grammar parser to represent a rule class Rule: def __init__(self, left, right): self.label = left.label self.op = right.op self.priority = right.priority self.condition = left.condition if left.paramNames != None: self.op.addParams...
class Rule: def __init__(self, left, right): self.label = left.label self.op = right.op self.priority = right.priority self.condition = left.condition if left.paramNames != None: self.op.addParams(left.paramNames) class Right: def __init__(self, op, priorit...
# source: http://www.usb.org/developers/docs/devclass_docs/CDC1.2_WMC1.1_012011.zip, 2017-01-08 class SUBCLASS: DIRECT_LINE_CONTROL_MODEL = 0x01 ABSTRACT_CONTROL_MODEL = 0x02 TELEPHONE_CONTROL_MODEL = 0x03 MUTLI_CHANNEL_CONTROL_MODEL = 0x04 CAPI_CONTROL_MODEL = 0x05 ETHERNET_NETWORKING_CONTROL...
class Subclass: direct_line_control_model = 1 abstract_control_model = 2 telephone_control_model = 3 mutli_channel_control_model = 4 capi_control_model = 5 ethernet_networking_control_model = 6 atm_networking_control_model = 7 wireless_handset_control_model = 8 device_management = 9 ...
def power(x, b, n): a = x y = 1 while b > 0: if b % 2 != 0: y = (y * a) %n b = b >> 1 a = (a * a) % n return y if __name__ == '__main__': x = power(7, 21, 100) for m in range(30, 2000): if power(100, 293, m) == 21: print(m) brea...
def power(x, b, n): a = x y = 1 while b > 0: if b % 2 != 0: y = y * a % n b = b >> 1 a = a * a % n return y if __name__ == '__main__': x = power(7, 21, 100) for m in range(30, 2000): if power(100, 293, m) == 21: print(m) break ...
def test_something(space): assert space.w_None is space.w_None class AppTestSomething: def test_method_app(self): assert 23 == 23 def test_code_in_docstring_failing(self): """ assert False # failing test """ def test_code_in_docstring_ignored(self): """ ...
def test_something(space): assert space.w_None is space.w_None class Apptestsomething: def test_method_app(self): assert 23 == 23 def test_code_in_docstring_failing(self): """ assert False # failing test """ def test_code_in_docstring_ignored(self): """ ...
""" Created on Tue Mar 19 09:32:52 2019 @author: Amanda Judy Andrade """ def writefile(x): i=0 for i in range(1,5,1): text=input("Enter a string:") x.write(text) x.close() def openfile(): x=open("sample.txt",'w') return x x=openfile() writefile(x)
""" Created on Tue Mar 19 09:32:52 2019 @author: Amanda Judy Andrade """ def writefile(x): i = 0 for i in range(1, 5, 1): text = input('Enter a string:') x.write(text) x.close() def openfile(): x = open('sample.txt', 'w') return x x = openfile() writefile(x)
option_list = BaseCommand.option_list + ( make_option('-d', '--db', dest='db', metavar='DB_ID', help='Mandatory: DATABASES setting key for database'), make_option('-p', '--project', dest='project', default='UNGA', me...
option_list = BaseCommand.option_list + (make_option('-d', '--db', dest='db', metavar='DB_ID', help='Mandatory: DATABASES setting key for database'), make_option('-p', '--project', dest='project', default='UNGA', metavar='PROJECT_LABEL', help='Project to use (can specify "any"). Default: "UNGA"'), make_option('-b', '--...
## @file moMapDefs.py ## @brief Definition of the map that is the VIM API. """ Definition of the map that is the VIM API. The map consists of a list of definitions that describe how classes refer to other classes through property paths as well as a managed object class hierarchy. Relevant managed object class hierar...
""" Definition of the map that is the VIM API. The map consists of a list of definitions that describe how classes refer to other classes through property paths as well as a managed object class hierarchy. Relevant managed object class hierarchy:: <class name>: [ <derived class0> <derived class1> ... ] """ class...
print(42 == 42) print(3 != 3) print(3 >= 4) print(0 < 6) print(6 < 0)
print(42 == 42) print(3 != 3) print(3 >= 4) print(0 < 6) print(6 < 0)
#MenuTitle: Change LayerColor to Grey font = Glyphs.font selectedLayers = font.selectedLayers for thisLayer in selectedLayers: thisGlyph = thisLayer.parent thisGlyph.layers[font.selectedFontMaster.id].color = 10
font = Glyphs.font selected_layers = font.selectedLayers for this_layer in selectedLayers: this_glyph = thisLayer.parent thisGlyph.layers[font.selectedFontMaster.id].color = 10
class Solution: def prefixesDivBy5(self, A: List[int]) -> List[bool]: res, r = [], 0 for a in A: r = (r * 2 + a) % 5 res.append(r == 0) return res
class Solution: def prefixes_div_by5(self, A: List[int]) -> List[bool]: (res, r) = ([], 0) for a in A: r = (r * 2 + a) % 5 res.append(r == 0) return res
# -*- Python -*- load("//tensorflow:tensorflow.bzl", "tf_py_test") # Create a benchmark test target of a TensorFlow C++ test (tf_cc_*_test) def tf_cc_logged_benchmark( name=None, target=None, benchmarks="..", tags=[], test_log_output_prefix="", benchmark_type="cpp_microbenchmark"): if not na...
load('//tensorflow:tensorflow.bzl', 'tf_py_test') def tf_cc_logged_benchmark(name=None, target=None, benchmarks='..', tags=[], test_log_output_prefix='', benchmark_type='cpp_microbenchmark'): if not name: fail('Must provide a name') if not target: fail('Must provide a target') if not ':' in...
def product(values) : n = 1 for val in values: n *= val return n
def product(values): n = 1 for val in values: n *= val return n
[print(i) for i in range(int(input())+1)] [print(n**2) for n in range(0, int(input()), 2)] s = 0 while(True): a = input() if a == 'The End': print(s) break s += int(a) # or print(sum(map(int, iter(input, 'The End')))) for word in input().split(): if word[0] != '*': print(word) #or [p...
[print(i) for i in range(int(input()) + 1)] [print(n ** 2) for n in range(0, int(input()), 2)] s = 0 while True: a = input() if a == 'The End': print(s) break s += int(a) for word in input().split(): if word[0] != '*': print(word) a = int(input()) for i in range(2, a): if a %...
# # Loop Version --- Iterations in Python # # Array Initialization for Inner Values iv = np.zeros((M + 1, M + 1), dtype=np.float) z = 0 for j in range(0, M + 1, 1): for i in range(z + 1): iv[i, j] = max(S[i, j] - K, 0) z += 1 # # Vectorized Version --- Iterations on NumPy Level # # Array Initialization...
iv = np.zeros((M + 1, M + 1), dtype=np.float) z = 0 for j in range(0, M + 1, 1): for i in range(z + 1): iv[i, j] = max(S[i, j] - K, 0) z += 1 pv = maximum(S - K, 0)
# coding: utf-8 # In[1]: class Match(object): def __init__(self, price, volume, isLong, step): self.price = price self.volume = volume self.isLong = isLong self.step = step
class Match(object): def __init__(self, price, volume, isLong, step): self.price = price self.volume = volume self.isLong = isLong self.step = step
# Copyright 2017 - 2018 Modoolar <info@modoolar.com> # Copyright 2018 Brainbean Apps # Copyright 2020 Manuel Calero # Copyright 2020 CorporateHub (https://corporatehub.eu) # License LGPLv3.0 or later (https://www.gnu.org/licenses/lgpl-3.0.en.html). { "name": "Web Actions Multi", "summary": "Enables triggering ...
{'name': 'Web Actions Multi', 'summary': 'Enables triggering of more than one action on ActionManager', 'category': 'Web', 'version': '13.0.1.0.0', 'license': 'LGPL-3', 'author': 'Modoolar, CorporateHub, Odoo Community Association (OCA)', 'website': 'https://github.com/OCA/web/', 'depends': ['web'], 'data': ['views/web...
def dict_filter(dic, keys: list) -> list: """ Get values from a dict given a list of keys :param dic: dictionary to be filtered :param keys: list of keys to be used as filter :return: """ return [(dic[i]) for i in keys if i in list(dic.keys())]
def dict_filter(dic, keys: list) -> list: """ Get values from a dict given a list of keys :param dic: dictionary to be filtered :param keys: list of keys to be used as filter :return: """ return [dic[i] for i in keys if i in list(dic.keys())]
# ActivitySim # See full license in LICENSE.txt. __version__ = '0.9.5.2' __doc__ = 'Activity-Based Travel Modeling'
__version__ = '0.9.5.2' __doc__ = 'Activity-Based Travel Modeling'
if condition: pass else: assert something another_statement()
if condition: pass else: assert something another_statement()
""" Discrete Meyer (FIR Approximation) wavelet """ class Meyer: """ Properties ---------- near symmetric, orthogonal, biorthogonal All values are from http://wavelets.pybytes.com/wavelet/dmey/ """ __name__ = "Meyer Wavelet" __motherWaveletLength__ = 62 # length of the mother wavele...
""" Discrete Meyer (FIR Approximation) wavelet """ class Meyer: """ Properties ---------- near symmetric, orthogonal, biorthogonal All values are from http://wavelets.pybytes.com/wavelet/dmey/ """ __name__ = 'Meyer Wavelet' __mother_wavelet_length__ = 62 __transform_wavelet_lengt...
def code(x): return { '61' : 'Brasilia', '71' : 'Salvador', '11' : 'Sao Paulo', '21' : 'Rio de Janeiro', '32' : 'Juiz de Fora', '19' : 'Campinas', '27' : 'Vitoria', '31' : 'Belo Horizonte' }.get(x, 'DDD nao cadastrado') print(f"{code(input())}")
def code(x): return {'61': 'Brasilia', '71': 'Salvador', '11': 'Sao Paulo', '21': 'Rio de Janeiro', '32': 'Juiz de Fora', '19': 'Campinas', '27': 'Vitoria', '31': 'Belo Horizonte'}.get(x, 'DDD nao cadastrado') print(f'{code(input())}')
class Anagram: @staticmethod def is_anagram(a, b): if (a is b): return False f = lambda c: c not in [' ', '\n'] a_arr = list(filter(f, list(a))) b_arr = list(filter(f, list(b))) a_len = len(a_arr) b_len = len(b_arr) if (a_len != b_len): ...
class Anagram: @staticmethod def is_anagram(a, b): if a is b: return False f = lambda c: c not in [' ', '\n'] a_arr = list(filter(f, list(a))) b_arr = list(filter(f, list(b))) a_len = len(a_arr) b_len = len(b_arr) if a_len != b_len: ...
# Zip Function list1 = [1,2,3] list2 = [10,10,30] #print(list(zip(list1, list2))) print(list(zip('abc', list1, list2)))
list1 = [1, 2, 3] list2 = [10, 10, 30] print(list(zip('abc', list1, list2)))
def email_domain_loader(): return [ "0-mail.com", "0815.ru", "0815.su", "0clickemail.com", "0sg.net", "0wnd.net", "0wnd.org", "10mail.org", "10minutemail.cf", "10minutemail.com", "10minutemail.de", "10minutemail.ga", ...
def email_domain_loader(): return ['0-mail.com', '0815.ru', '0815.su', '0clickemail.com', '0sg.net', '0wnd.net', '0wnd.org', '10mail.org', '10minutemail.cf', '10minutemail.com', '10minutemail.de', '10minutemail.ga', '10minutemail.gq', '10minutemail.ml', '123-m.com', '12hourmail.com', '12minutemail.com', '1ce.us', '...
# -*- coding: utf-8 -*- BANCO_DO_BRASIL = { 'valid_combinations': [ {'bank_code': '001', 'branch': '0395', 'branch_digit': '6', 'account': '45939', 'account_digit': '9'}, {'bank_code': '001', 'branch': '2995', 'branch_digit': '5', 'account': '14728', 'account_digit': '1'}, {'bank_code': '00...
banco_do_brasil = {'valid_combinations': [{'bank_code': '001', 'branch': '0395', 'branch_digit': '6', 'account': '45939', 'account_digit': '9'}, {'bank_code': '001', 'branch': '2995', 'branch_digit': '5', 'account': '14728', 'account_digit': '1'}, {'bank_code': '001', 'branch': '7071', 'branch_digit': '8', 'account': '...
""" camply __version__ file """ __version__ = "0.2.3" __camply__ = "camply"
""" camply __version__ file """ __version__ = '0.2.3' __camply__ = 'camply'
# This is to find the sum of digits of a number until it is a single digit def sum_of_digits(n): n = int(input()) # here n is the number if n % 9 != 0: print(n % 9) else: print("9") # This method reduces time complexity by a factor of n and also without using any loop
def sum_of_digits(n): n = int(input()) if n % 9 != 0: print(n % 9) else: print('9')
class Layover: """This class defines a layover period between two legs of a trip. """ def __init__(self, arr_leg, dept_leg, conn_time): """Initialises the Layover object. Args: arr_leg (Leg): the leg on which pax arrived at the layover airport. ...
class Layover: """This class defines a layover period between two legs of a trip. """ def __init__(self, arr_leg, dept_leg, conn_time): """Initialises the Layover object. Args: arr_leg (Leg): the leg on which pax arrived at the layover airport. ...
s = input() searched = "" no_match = False for i in range(len(s)): if s[i] in searched: continue else: counter = 0 no_match = True for j in range(i+1, len(s)): if s[j] == s[i]: no_match = False break if no_match: ...
s = input() searched = '' no_match = False for i in range(len(s)): if s[i] in searched: continue else: counter = 0 no_match = True for j in range(i + 1, len(s)): if s[j] == s[i]: no_match = False break if no_match: p...
try: arr= [] print(" Enter the integer inputs and type 'stop' when you are done\n" ) while True: arr.append(int(input())) except:# if the input is not-integer, just continue to the next step l = len(arr) print("Enter the values of a,b and c \n") a=int(input()) b=int(input()) c=i...
try: arr = [] print(" Enter the integer inputs and type 'stop' when you are done\n") while True: arr.append(int(input())) except: l = len(arr) print('Enter the values of a,b and c \n') a = int(input()) b = int(input()) c = int(input()) t = 0 count = 0 answers = [] ...
#!/bin/false -- # do not execute! # # foxLanguagesBase.py - base class for foxLanguages classes. # class foxLanguagesBase(object): # # define the names that all foxLanguages* classes must define: # # comment -> either a single string for comment-line-start, # or a tuple of ( comment-block-start, com...
class Foxlanguagesbase(object): comment = None extension = None language = None lexer_output = None parser_output = None @classmethod def convert(var, value): return value @classmethod def process_template(self, template, vars): stream = StringIO.StringIO() ...
def list_sum(L): s = 0 for l in L: s += l return s def list_product(L): s = 1 for l in L: s *= l return s V = [1, 2, 3, 4, 5, 6] print(list_sum(V)) print(list_product(V))
def list_sum(L): s = 0 for l in L: s += l return s def list_product(L): s = 1 for l in L: s *= l return s v = [1, 2, 3, 4, 5, 6] print(list_sum(V)) print(list_product(V))
class Solution: def shiftGrid(self, grid: List[List[int]], k: int) -> List[List[int]]: nums = sum(grid, []) k %= len(nums) nums = nums[-k:] + nums[:-k] col = len(grid[0]) return [nums[i:i + col] for i in range(0, len(nums), col)]
class Solution: def shift_grid(self, grid: List[List[int]], k: int) -> List[List[int]]: nums = sum(grid, []) k %= len(nums) nums = nums[-k:] + nums[:-k] col = len(grid[0]) return [nums[i:i + col] for i in range(0, len(nums), col)]
# Time: O(n) # Space: O(n) class Solution(object): def maxNonOverlapping(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ lookup = {0:-1} result, accu, right = 0, 0, -1 for i, num in enumerate(nums): accu +...
class Solution(object): def max_non_overlapping(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ lookup = {0: -1} (result, accu, right) = (0, 0, -1) for (i, num) in enumerate(nums): accu += num i...
class Trie(object): def __init__(self): self.nexts = collections.defaultdict(Trie) self.valid = False class WordDictionary(object): def __init__(self): """ initialize your data structure here. """ self.root=Trie() def addWord(self, word): """ ...
class Trie(object): def __init__(self): self.nexts = collections.defaultdict(Trie) self.valid = False class Worddictionary(object): def __init__(self): """ initialize your data structure here. """ self.root = trie() def add_word(self, word): """ ...
firstAioConfigDefault = { 'db': { 'host': 'localhost', 'port': 3306, 'user': 'root', 'password': 'root', 'db': 'fastormtest', 'is_use': True }, 'http': { 'host': '0.0.0.0', 'port': 8080, 'templates': 'C:\\Users\\admin\\Deskt...
first_aio_config_default = {'db': {'host': 'localhost', 'port': 3306, 'user': 'root', 'password': 'root', 'db': 'fastormtest', 'is_use': True}, 'http': {'host': '0.0.0.0', 'port': 8080, 'templates': 'C:\\Users\\admin\\Desktop\\github\\fast\\trunk\\fast_http_test\\templates', 'static': 'C:\\Users\\admin\\Desktop\\github...
n, m, k = [int(x) for x in input().split()] applicants = [int(x) for x in input().split()] apartments = [int(x) for x in input().split()] applicants.sort() apartments.sort() total = 0 i = 0 j = 0 while i < n and j < m: # print(i,j) if applicants[i]-k <= apartments[j] <= applicants[i]+k: total += 1 ...
(n, m, k) = [int(x) for x in input().split()] applicants = [int(x) for x in input().split()] apartments = [int(x) for x in input().split()] applicants.sort() apartments.sort() total = 0 i = 0 j = 0 while i < n and j < m: if applicants[i] - k <= apartments[j] <= applicants[i] + k: total += 1 i += 1 ...
# Basic colors defined here White = (255, 255, 255) Black = (0, 0, 0) Red = (255, 0, 0) Green = (0, 255, 0) snakeGreen = (0, 127, 0) Blue = (0, 0, 255) Yellow = (255, 255, 0) Magenta = (255, 0, 255) Cyan = (0, 255, 255)
white = (255, 255, 255) black = (0, 0, 0) red = (255, 0, 0) green = (0, 255, 0) snake_green = (0, 127, 0) blue = (0, 0, 255) yellow = (255, 255, 0) magenta = (255, 0, 255) cyan = (0, 255, 255)
""" Shared settings IMPORTANT NOTE: These settings are described with docstrings for the purpose of automated documentation. You may find reading some of the docstrings easier to understand or read in the documentation itself. http://earthgecko-skyline.readthedocs.io/en/latest/skyline.html#module-settings """ RED...
""" Shared settings IMPORTANT NOTE: These settings are described with docstrings for the purpose of automated documentation. You may find reading some of the docstrings easier to understand or read in the documentation itself. http://earthgecko-skyline.readthedocs.io/en/latest/skyline.html#module-settings """ redi...
class Starrable: """ Represents an object that can be starred. """ __slots__ = () _graphql_fields = { "stargazer_count": "stargazerCount", "viewer_has_starred": "viewerHasStarred", } @property def stargazer_count(self): """ The number of stars on the st...
class Starrable: """ Represents an object that can be starred. """ __slots__ = () _graphql_fields = {'stargazer_count': 'stargazerCount', 'viewer_has_starred': 'viewerHasStarred'} @property def stargazer_count(self): """ The number of stars on the starrable. :type: ...
def _add_to_dict_if_present(dict, key, value): if value: dict[key] = value objc_merge_keys = [ "sdk_dylib", "sdk_framework", "weak_sdk_framework", "imported_library", "force_load_library", "source", "link_inputs", "linkopt", "library", ] def _merge_objc_providers_dict(p...
def _add_to_dict_if_present(dict, key, value): if value: dict[key] = value objc_merge_keys = ['sdk_dylib', 'sdk_framework', 'weak_sdk_framework', 'imported_library', 'force_load_library', 'source', 'link_inputs', 'linkopt', 'library'] def _merge_objc_providers_dict(providers, transitive=[], merge_keys=objc...
class BaitSegment(object): def __init__(self, chromosome, start, stop, strand, isoform_exons, bait_length): self.label = None self.chromosome = chromosome self.start = start # 1-based self.stop = stop # 1-based self.strand = strand # Strand of the isoforms for this segme...
class Baitsegment(object): def __init__(self, chromosome, start, stop, strand, isoform_exons, bait_length): self.label = None self.chromosome = chromosome self.start = start self.stop = stop self.strand = strand self.comparitor_tuple = (self.chromosome, self.start, s...
def binary_classification_metrics(prediction, ground_truth): precision = 0 recall = 0 accuracy = 0 f1 = 0 # TODO: implement metrics! tp = np.sum(np.logical_and(prediction, ground_truth)) fp = np.sum(np.greater(prediction, ground_truth)) fn = np.sum(np.less(prediction, ground_truth)...
def binary_classification_metrics(prediction, ground_truth): precision = 0 recall = 0 accuracy = 0 f1 = 0 tp = np.sum(np.logical_and(prediction, ground_truth)) fp = np.sum(np.greater(prediction, ground_truth)) fn = np.sum(np.less(prediction, ground_truth)) precision = tp / (tp + fp) ...
"""f451 Communications module.""" __version__ = "0.1.1" __app_name__ = "f451-comms"
"""f451 Communications module.""" __version__ = '0.1.1' __app_name__ = 'f451-comms'
class Config: DEBUG = True SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:@localhost:3306/focusplus' SQLALCHEMY_TRACK_MODIFICATIONS = False SECRET_KEY = 'super-secret-key' JWT_ERROR_MESSAGE_KEY = 'message' JWT_BLACKLIST_ENABLED = True JWT_BLACKLIST_TOKEN_CHECKS = ['access', 'refresh']
class Config: debug = True sqlalchemy_database_uri = 'mysql+pymysql://root:@localhost:3306/focusplus' sqlalchemy_track_modifications = False secret_key = 'super-secret-key' jwt_error_message_key = 'message' jwt_blacklist_enabled = True jwt_blacklist_token_checks = ['access', 'refresh']
{ "targets": [ { "target_name": "sharedMemory", "include_dirs": [ "<!(node -e \"require('napi-macros')\")" ], "sources": [ "./src/sharedMemory.cpp" ], "libraries": [], }, { "target_name": "messaging", "cflags!": [ "-fno-exceptions" ], "cflags_cc!":...
{'targets': [{'target_name': 'sharedMemory', 'include_dirs': ['<!(node -e "require(\'napi-macros\')")'], 'sources': ['./src/sharedMemory.cpp'], 'libraries': []}, {'target_name': 'messaging', 'cflags!': ['-fno-exceptions'], 'cflags_cc!': ['-fno-exceptions'], 'include_dirs': ['<!@(node -p "require(\'node-addon-api\').inc...
# Copyright 2020 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
"""Rules for importing and registering JDKs from http archive. Rule remote_java_repository imports and registers JDK with the toolchain resolution. """ load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') def _toolchain_config_impl(ctx): ctx.file('WORKSPACE', 'workspace(name = "{name}")\n'.format(...
# this default context will only work in the build time # during the flow/task run, will use context in flow/task as the initial context DEFAULT_CONTEXT = { 'default_flow_config': { 'check_cancellation_interval': 5, 'test__': { 'test__': [1, 2, 3] }, 'log_stdout': True, ...
default_context = {'default_flow_config': {'check_cancellation_interval': 5, 'test__': {'test__': [1, 2, 3]}, 'log_stdout': True, 'log_stderr': True}, 'default_task_config': {'executor_type': 'dask', 'test__': {'test__': [1, 2, 3]}, 'timeout': 0, 'log_stdout': True, 'log_stderr': True}, 'logging': {'fmt': '[{levelname}...
""" This file contains quick demonstrations of how to use xdoctest CommandLine: xdoctest -m xdoctest.demo xdoctest -m xdoctest.demo --verbose 0 xdoctest -m xdoctest.demo --silent xdoctest -m xdoctest.demo --quiet """ def myfunc(): """ Demonstrates how to write a doctest. Prefix with `>>>...
""" This file contains quick demonstrations of how to use xdoctest CommandLine: xdoctest -m xdoctest.demo xdoctest -m xdoctest.demo --verbose 0 xdoctest -m xdoctest.demo --silent xdoctest -m xdoctest.demo --quiet """ def myfunc(): """ Demonstrates how to write a doctest. Prefix with `>>>`...
niz = [4,1,2,3,5,10,7,3,5,1] print(sorted(niz)) for el in range(1,20): print(el)
niz = [4, 1, 2, 3, 5, 10, 7, 3, 5, 1] print(sorted(niz)) for el in range(1, 20): print(el)
"""Map file definitions for postfix.""" class DomainsMap(object): """Map to list all domains.""" filename = 'sql-domains.cf' mysql = ( "SELECT name FROM admin_domain " "WHERE name='%s' AND type='domain' AND enabled=1" ) postgres = ( "SELECT name FROM admin_domain " ...
"""Map file definitions for postfix.""" class Domainsmap(object): """Map to list all domains.""" filename = 'sql-domains.cf' mysql = "SELECT name FROM admin_domain WHERE name='%s' AND type='domain' AND enabled=1" postgres = "SELECT name FROM admin_domain WHERE name='%s' AND type='domain' AND enabled" ...
#t3.py module pix = 134 def pipi(a='aasasa'): print(a)
pix = 134 def pipi(a='aasasa'): print(a)
# build decoder model latent_inputs = kl.Input(shape=(latent_dim,), name='z_sampling') x = kl.Dense(intermediate_dim, activation='relu')(latent_inputs) outputs = kl.Dense(n_input, activation='sigmoid')(x) # instantiate decoder model decoder = km.Model(latent_inputs, outputs, name='decoder')
latent_inputs = kl.Input(shape=(latent_dim,), name='z_sampling') x = kl.Dense(intermediate_dim, activation='relu')(latent_inputs) outputs = kl.Dense(n_input, activation='sigmoid')(x) decoder = km.Model(latent_inputs, outputs, name='decoder')
class Solution: def bagOfTokensScore(self, tokens, P): tokens.sort() l, r, score = 0, len(tokens) - 1, 0 while l <= r: if P >= tokens[l]: P -= tokens[l] score += 1 l += 1 elif score and l != r: P += token...
class Solution: def bag_of_tokens_score(self, tokens, P): tokens.sort() (l, r, score) = (0, len(tokens) - 1, 0) while l <= r: if P >= tokens[l]: p -= tokens[l] score += 1 l += 1 elif score and l != r: p ...
# list, row, column and box initalizations lst = [ [ [ False, '-', [], 0 ] for col in range(9)] for row in range(9)] row = [[ False, 9, [c for c in range(1, 10)] ] for r in range(9)] col = [[ False, 9, [c for c in range(1, 10)] ] for r in range(9)] box = [[ False, 9, [c for c in range(1, 10)] ] for r in range(9)] ...
lst = [[[False, '-', [], 0] for col in range(9)] for row in range(9)] row = [[False, 9, [c for c in range(1, 10)]] for r in range(9)] col = [[False, 9, [c for c in range(1, 10)]] for r in range(9)] box = [[False, 9, [c for c in range(1, 10)]] for r in range(9)] print(row)
""" Main module, launches foo daemon """ def main(): pass if __name__ == 'main': main()
""" Main module, launches foo daemon """ def main(): pass if __name__ == 'main': main()
#!/usr/bin/env python3 # This was adopted from sq2hex.py from https://github.com/davidar/subleq/blob/master/util/sq2hex.py by Josh Ellis. # Copyright (c) 2009 David Roberts <d@vidr.cc> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation file...
"""Converts sqasm output to format accepted by Logisim.""" print('v2.0 raw') while True: try: for val in input().split(): if val == '#OUT' or val == '#IN': val = -1 else: val = int(val) if val < 0: val += 16777216 ...
# Time: O(log(n)) # Space: O(log(n)) class Solution(object): def convertToTitle(self, n): """ :type n: int :rtype: str """ col_num = [] while n>0: cur_char = chr(int((n-1)%26)+ord('A')) col_num.append(cur_char) n = (n-1)//26 ...
class Solution(object): def convert_to_title(self, n): """ :type n: int :rtype: str """ col_num = [] while n > 0: cur_char = chr(int((n - 1) % 26) + ord('A')) col_num.append(cur_char) n = (n - 1) // 26 return ''.join(col_nu...
#DFS using Recursion class Node(): def __init__(self,value=None): self.value = value self.left = None self.right = None def get_value(self): return self.value def set_value(self,value): self.value = value def set_left_child(self,le...
class Node: def __init__(self, value=None): self.value = value self.left = None self.right = None def get_value(self): return self.value def set_value(self, value): self.value = value def set_left_child(self, left): self.left = left def set_right_...
config = { "beta1": 0.9, "beta2": 0.999, "epsilon": [ 1.7193559220924876e-07, 0.00019809119366335256, 1.4745363724867889e-08, 3.0370342703184836e-05, ], "lr": [ 0.000592992422167547, 0.00038001447767611315, 7.373656030831236e-06, 1.0011...
config = {'beta1': 0.9, 'beta2': 0.999, 'epsilon': [1.7193559220924876e-07, 0.00019809119366335256, 1.4745363724867889e-08, 3.0370342703184836e-05], 'lr': [0.000592992422167547, 0.00038001447767611315, 7.373656030831236e-06, 1.0011818742335523e-06], 'out_dir': 'logs/cifar/BPConv', 'network_type': 'BPConvCIFAR', 'initia...
# Solution to Project Euler Problem 3 def sol(): n = 600851475143 i = 2 while i <= n: if i < n and n % i == 0: n //= i i += 1 return str(n) if __name__ == "__main__": print(sol())
def sol(): n = 600851475143 i = 2 while i <= n: if i < n and n % i == 0: n //= i i += 1 return str(n) if __name__ == '__main__': print(sol())
sql92_dialect = { "dialect": "sql", "insert_sql": "INSERT INTO {table} ({columns}) VALUES ({values})", "select_sql": ("SELECT{distinct} {columns} FROM {table}" "{where}{groupby}{having}{orderby}{limit}"), "update_sql": "UPDATE {table} SET {set_columns}", "delete_sql": "DELETE FROM...
sql92_dialect = {'dialect': 'sql', 'insert_sql': 'INSERT INTO {table} ({columns}) VALUES ({values})', 'select_sql': 'SELECT{distinct} {columns} FROM {table}{where}{groupby}{having}{orderby}{limit}', 'update_sql': 'UPDATE {table} SET {set_columns}', 'delete_sql': 'DELETE FROM {table}', 'column_schema': 'SELECT * FROM IN...
def menor_nome(nomes): menor = nomes[0] menor.strip() for nome in nomes: comparado = nome.strip() if len(comparado) < len(menor): menor = comparado menor.lower() return menor.capitalize()
def menor_nome(nomes): menor = nomes[0] menor.strip() for nome in nomes: comparado = nome.strip() if len(comparado) < len(menor): menor = comparado menor.lower() return menor.capitalize()
# a program to compute employee fee hours = int(input('Enter hours:')) rate = float(input('Enter rate:')) # calculating hours above 40 eth = (hours - 40) # for hours above forty if hours > 40: pay = ((eth * 1.5 * rate) + (40 * rate)) print(pay) # for hours less than or equal to 40 else: pay2 = (rate * hours...
hours = int(input('Enter hours:')) rate = float(input('Enter rate:')) eth = hours - 40 if hours > 40: pay = eth * 1.5 * rate + 40 * rate print(pay) else: pay2 = rate * hours print(pay2)
# -*- coding: utf-8 -*- """ @author: salimt """ NUM_ROWS = 3 NUM_COLS = 5 # construct a matrix my_matrix = {} for row in range(NUM_ROWS): row_dict = {} for col in range(NUM_COLS): row_dict[col] = row * col my_matrix[row] = row_dict print(my_matrix) # print the matrix for ...
""" @author: salimt """ num_rows = 3 num_cols = 5 my_matrix = {} for row in range(NUM_ROWS): row_dict = {} for col in range(NUM_COLS): row_dict[col] = row * col my_matrix[row] = row_dict print(my_matrix) for row in range(NUM_ROWS): for col in range(NUM_COLS): print(my_matrix[row][col], e...