content
stringlengths
7
1.05M
"""https://open.kattis.com/problems/missingnumbers""" n = int(input()) nums = [] for _ in range(n): nums.append(int(input())) if len(nums) == nums[-1]: print("good job") else: for i in range(1, nums[-1] + 1): if i not in nums: print(i)
class User(): def __init__(self, first_name, last_name, username, email, location): self.first_name = first_name.title() self.last_name = last_name.title() self.username = username self.email = email self.location = location.title() def describe_user(self): pr...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def findTilt(self, root: TreeNode) -> int: if root is None: return 0 # post order tree walk traversal ...
# Tree Node class Node: def __init__(self, val): self.right = None self.data = val self.left = None class Solution: # The given root is the root of the Binary Tree # Return the root of the generated BST def binaryTreeToBST_Util(self, root): if root is None: ...
#Defining function for Linear Search def Linear_Search(input_list, key): flag = 0 #Iterating each item in the list and comparing it with the key searching for for i in range(len(input_list)): if(input_list[i] == key): #If key matches with any of the list items flag = 1 ...
class Token(): def __init__(self, classe, lexema, tipo): self.classe = classe self.lexema = lexema self.tipo = tipo def __repr__(self) -> str: return 'classe: ' + self.classe + ', lexema: ' + self.lexema + ', tipo: ' + self.tipo
def program(): intProgram = [ 1,12,2,3,1,1,2,3,1,3, 4,3,1,5,0,3,2,1,10,19, 1,6,19,23,1,10,23,27,2,27, 13,31,1,31,6,35,2,6,35,39, 1,39,5,43,1,6,43,47,2,6, 47,51,1,51,5,55,2,55,9,59, 1,6,59,63,1,9,63,67,1,67, 10,71,2,9,71,75,1,6,75,79, 1,5,79,83,2,83,10,87,1,87, 5,91,1,91,9,95,1,6,95,99, ...
class Solution: def minSubArrayLen(self, s: int, nums: List[int]) -> int: ans = float('inf') left = 0 sum_ = 0 for right, num in enumerate(nums): sum_ += num while left <= right and sum_ >= s: ans = min(ans, right - left + 1) ...
class Solution: def res(self, a, b): count = 0 for i in range(1, len(a)): if a[i] != a[0] and b[i] != a[0]: return -1 elif a[i] != a[0]: a[i] = b[i] count += 1 return count def minDominoRotations(self, A: list, B: ...
class DatastoreRouter(object): def db_for_read(self, model, **hints): """ Reads go to a randomly-chosen replica. """ return 'datastore' def db_for_write(self, model, **hints): """ Writes always go to primary. """ return 'primary'
# STP2019 - FALL # Observable class Publisher(object): subscribers = set() def register(self, user): self.subscribers.add(user) def unregister(self, user): self.subscribers.discard(user) def send_notifications(self, message): for user in self.subscribers: user.up...
""" __init__ for package code """ # pylint: disable=invalid-name name = 'lazynumpy' # pylint: enable=invalid-name
# HASH TABLE # array with elements indexed by hashed key # associative arrays and dictionaries # objects # caches (memcached) # dynamic programming, memoization # send key through hashing function (MD5, SHA1, etc.), which converts to addressable space (index) # powerful for maps because now our key points to where our ...
def lee_entero(): while True: entrada = raw_input("Escribe un numero entero: ") try: entrada = int(entrada) return entrada except ValueError: print ("La entrada es incorrecta: escribe un numero entero")
''' The __init__.py file makes Python treat directories containing it as modules. Furthermore, this is the first file to be loaded in a module, so you can use it to execute code that you want to run each time a module is loaded, or specify the submodules to be exported. '''
# 数据库连接的配置文件 parameters = { 'host':'127.0.0.1', 'user':'root', 'password':'tom', 'port':3306, 'charset':'utf8', 'database':'py1905' }
class Exponentiation: @staticmethod def exponentiation(base, exponent): return base ** exponent
class Board: def __init__(self, id) -> None: self.id = id self.parts = [] #note will be array of arrays [part object, qty used per board] self.flag = False #True if stock issue def AddPart(self, part, qty): self.parts.append([part, qty]) def IsMatch(self, testid)...
convidados = float(input()) op1_inteira = int((32 / convidados)) op1_resto = 32 % convidados op2 = 32 / convidados print(f'Opção 1: {op1_inteira} fatias cada, {op1_resto:.0f} de resto') print(f'Opção 2: {op2:.2f} fatias cada')
coffee = 10 while True: money = int(input("돈을 넣어 주세요: ")) if money == 300: print("커피를 줍니다.") coffee = coffee - 1 elif money > 300: print("거스름돈 %d를 주고 커피를 줍니다." % (money - 300)) else: print("돈을 다시 돌려주고 커피를 주지 않습니다.") print("커피의 남은 양은 %d개 입니다." % coffee) if coff...
# hw01_05 print('3 + 4 =', end=' ') print(3 + 4) ''' 3 + 4 = 7 '''
def list_to_list_two_tuples(values: list): """ Convert a list of values to a list of tuples with for each value twice that same value e.g. [1,2,3] ==> [(1,1),(2,2),(3,3)] Parameters ---------- values : list list of values to convert into tuples Returns ------- list ...
f = open('text1.txt') v = open('text2.txt') list1 = [] list2 = [] result = [] for line in f: list1.append(line) for line in v: list2.append(line) for i in range(len(list1)): if list1[i] != list2[i]: a = str(list1[i]) + '!=' + str(list2[i]) result.append(a) print(result)
a = input("digite um numero em binario: ") for n in (len(a)): if n==1: x=1 b=x*len(a) print(b)
def find(arr,n,x): start=0 end=n-1 result=-1 res=-1 mid=start+(end-start)//2 while start<end: if arr[mid]==x: result=mid end=mid-1 elif arr[mid]>x: end=mid-1 else: start=mid+1 while start<end: if arr[mi...
"""Trivial test module for verifying that unit tests are running as expected.""" def test_health(): """ This health check test should pass no matter what. """ assert True
class Solution: def minCostClimbingStairs(self, cost: List[int]) -> int: min_cost = { 0: 0, 1: 0, } n = len(cost) for i in range(2, n+1): min_cost[i] = min(min_cost[i-1] + cost[i-1], min_cost[i-2] + cost[i-2]) return min_cost[n]
""" Basic Login Search - SOLUTION """ users = { 'person@email.com': 'PassWord', 'someone@email.com': 'p@$$w0rd', 'me@email.com': 'myPassword', 'anyone@email.com': 'p@ssw0rd', 'guy@email.com': 'pa$$word' # etc } # A user enters the below login info (email and password) for your app. Search your database of user ...
CONFIG = { 'api_key': 'to be filled out', 'api_key_secret': 'to be filled out', 'access_token': 'to be filled out', 'access_token_secret': 'to be filled out', 'images_base_folder': 'to be filled out', 'images_backlog_folder': 'to be filled out', 'telegram_token': 'to be filled out', '...
""" TODO: first insert analytical greeks in bs.py & then 1. write TEST for Black prices and implieds PUT f = 101.0 x = 102.0 t = .5 r = .01 sigma_price = 0.2 price = black(-1, f, x, t, r=0, sigma_price) expected_price = 6.20451158097 from expected price get implied of...
def final_multipy(num: int) -> int: if num < 10: return num n = 1 for i in str(num): n *= int(i) return final_multipy(n) def final_multipy2(num: int) -> int: return num if num < 10 else final_multipy2(reduce(lambda x, y: x*y, [int(i) for i in str(num)]))
# Copyright (c) Project Jupyter. # Distributed under the terms of the Modified BSD License. version_info = (0, 9, 0) __version__ = ".".join(map(str, version_info))
# ========================= SymbolTable CLASS class SymbolTable(object): """ Symbol table for the CompilationEngine of the Jack compiler. """ def __init__(self): self._file_name = '' self._class_table = {} self._subroutine_table = {} self._static_count = 0 self._...
def incorrectPasscodeAttempts(passcode, attempts): cnt = 0 for att in attempts: if att == passcode: cnt = 0 else: cnt += 1 if cnt >= 10: return True return False
options = [ "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "CNY", "HKD", "NZD", "SEK", "KRW", "SGD", "NOK", "MXN", "INR", "RUB", "ZAR", "TRY", "BRL", ] opt2=[ "USD", "EUR", "JPY", "GBP", "A...
#!/usr/bin/env python3 """ help.py This is a file to pull the help for all programs in bin. Each script must be added individually, some scripts use argparse, so -h is called, others do not, and so their __doc__ is printed. Based on spHelp written by Elena. 2020-06-08 DG Init, based on spHelp 2020-08-17 DG Adde...
# noinspection PyShadowingBuiltins,PyUnusedLocal def compute(x, y): if all(0 <= n <= 100 for n in (x, y)): return x + y else: raise ValueError('Please provide two integer numbers')
# # PySNMP MIB module IPFIX-EXPORTER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IPFIX-EXPORTER-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:55:56 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
# Advent of Code 2020, Day 6 with open("../input06", "r") as infile: lines = infile.readlines() # check if a line is blank def blank(l): b = True for c in l: b = b and (c == ' ' or c == '\n') return b group = [] groups = [] for l in lines: if blank(l): groups.append(group) group = [] else: ...
class Products: def __init__(self, product_name, displayed_price, product_number): self.product_name = product_name self.displayed_price = displayed_price self.product_number = product_number
def for_underscore(): for row in range(4): for col in range(6): if row==3 and col>0 and col<5 : print("*",end=" ") else: print(" ",end=" ") print() def while_underscore(): row=0 while row<4: col=0 while col<6...
""" __version__.py ~~~~~~~~~~~~~~ Metadata of the Module. """ __all__ = [ "__title__", "__description__", "__url__", "__version__", "__author__", "__license__", "__copyright__", ] __title__ = "sxcu" __description__ = "Python API wraper for sxcu.net" __url__ = "https://sxcu.syr...
def asTemplate(f): def wrapped(*args, **props): def execute(): return f(*args, **props) return execute return wrapped def renderProps(**props): result = [f' {key}="{value}"' if isinstance(value, str) else f' {key}={str(value)}' for key, value in props.items()] retur...
def render_template(gadget): RN = "\r\n" p = Payload() p.header = "__METHOD__ __ENDPOINT__?cb=__RANDOM__ HTTP/__HTTP_VERSION__" + RN p.header += gadget + RN p.header += "Host: __HOST__" + RN p.header += "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/...
CF=float(input("Quantos cigarros fumado por dia?: ")) TF=int(input("Há quantos anos você fuma?: ")) TPD=(CF*10)/60 DTP=TPD/24 DF=(TF*365) DPM=DF*DTP print("Tempo de vida perdido: %d Dias" % DPM)
class VmCustomParamsExtractor(object): def get_custom_param_value(self, custom_params, name): """Returns the value of the requested custom param :param custom_params: list[DeployDataHolder] array of VMCustomParams from the deployed app json :param name: (str) the name of the custom param t...
# Count inversions in a sequence of numbers def count_inversion(sequence): if (len(sequence) < 1 or len(sequence) > 199): return "Error1" for element in sequence: if (element < -99 or element > 199): return "Error2" sequencel = list(sequence); count = 0; ...
def grade(a): if a >= 90: print("A") else: if a >= 85: print("B+") else: if a >= 80: print("B") else: if a >= 75: print("C+") else: if a >= 70: print("C") else: if a >= 65: print("D+") ...
class DDH2Exception(Exception): def __init__(self, response): self.status_code = response.status_code self.text = response.text def __repr__(self): return 'DDH2Exception [{}]: {}'.format(self.status_code, self.text) def __str__(self): return self.text
# Escreva um programa que leia um número inteiro e peça para o usuário escolher qual será a base de conversão: # 1) Binário # 2) Octal # 3) Hexadecimal num = int(input('Digite um número inteiro: ')) print("""Escolha para qual base você quer converter: [1] Binário [2] Hexadecimal [3] Binário""") op = int(input('Sua opçã...
class Queue: def __init__(self): self.array = [] self.length = 0 # adding the data to the end of the array def enqueue(self, data): self.array.append(data) self.length += 1 return # popping the data to the start of the array def dequeue(self): poped ...
""" Module containing exceptions raised by the warden application """ class ActionNotAllowed(Exception): pass
class Script(object): START_MSG = """<b>Hy {}, Saya adalah Amoi Casino 24jam di group Anda! Amoi adalah Robot 24jam di group Anda :) tulis<i>/help</i> untuk arahan lebih lanjut.</b> """ HELP_MSG = """ <i>Tambah Amoi dalam Group anda untuk 24jam menjaga group anda :)</i> <b>Arahan Amoi;</b> /start - Sema...
def minimax(arr): arr.sort() max = 0 min = 0 for i in range(len(arr)): if i!=0: max += arr[i] if i!=4: min += arr[i] print(min,max) if __name__=="__main__": arr = list(map(int, input().rstrip().split())) minimax(arr)
# You need to print the value from 0 to 100 # whenever the number divisible by 3, then it should print as "fuzz" # If the number is divisible 5, it should display as "buzz # If the number id divided by 15, the result should be "fuzz_buzz" # Simple method for i in range(101): if i % 15 == 0: print("fuzz_buz...
#============================================================================== # # Copyright (c) 2019 Smells Like Donkey Software Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redist...
#!/usr/bin/env python3 def getMinimumCost(k, c): min_cost = 0 temp = 0 previous = 0 if k >= len(c): return sum(c) c = sorted(c) for x in reversed(c): if temp == k: temp = 0 previous += 1 min_cost += (previous + 1) * x temp += 1 ret...
POSTGRES_URL="****" POSTGRES_USER="****" POSTGRES_PW="****" POSTGRES_DB="****"
# # PySNMP MIB module ASCEND-MIBATMIF-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASCEND-MIBATMIF-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:26:28 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
#!/usr/bin/env pypy n = int(input()) F = [1] * -~n for i in range(2, n + 1): for j in range(i, n + 1, i): F[j] += 1 print(sum(e * v for e, v in enumerate(F)))
# Large sum x = 371072875339021027987979982208375902465101357402504637693767749000971264812489697007805041701826053874324986199524741059474233309513058123726617309629919422133635741615725224305633018110724061549082502306758820753934617117198031042104751377806324667689261670696623633820136378418383684178734361726757281...
# -*- coding: utf-8 -*- class GraphDSLSemantics(object): def digit(self, ast): return ast def symbol(self, ast): return ast def characters(self, ast): return ast def identifier(self, ast): return ast def string(self, ast): return ast[1] def natural(...
n = int(input()) nums = list(input()) sum = 0 for i in range(0, n): sum += int(nums[i]) print(sum)
test_secret = "seB388LNHgxcuvAcg1pOV20_VR7uJWNGAznE0fOqKxg=".encode('ascii') test_data = { 'valid': '{"tx_id":"0f534ffc-9442-414c-b39f-a756b4adc6cb", "case_id":"0f534ffc-9442-414c-b39f-a756b4adc6cb","collection":' '{"exercise_sid":"hfjdskf"},"metadata":{"user_id":"789473423","ru_ref":"12345678901A"...
''' Create a script that reads something and show the type and all informations about it. ''' something = input('Type something: ') print(f'The type of this value is \033[34m{type(something)}\033[m') print(f'Has only spaces? \033[34m{something.isspace()}\033[m') print(f'Is numeric? \033[34m{something.isnumeric()}\...
# # This file contains the Python code from Program 8.12 of # "Data Structures and Algorithms # with Object-Oriented Design Patterns in Python" # by Bruno R. Preiss. # # Copyright (c) 2003 by Bruno R. Preiss, P.Eng. All rights reserved. # # http://www.brpreiss.com/books/opus7/programs/pgm08_12.txt # class ChainedScatt...
"""Use 2-dimansional arrays to create a playable tic tac toe""" class TicTacToe: """Management of a Tic-Tac-Toe game (does not do strategy)""" def __init__(self) -> None: "Starts a new game" self._board = [[" "] * 3 for j in range(3)] self._player = "X" def __str__(self) -> str: ...
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None # inorder = [9,3,15,20,7] # postorder = [9,15,7,20,3] class Solution: def buildTree(self, inorder, postorder): """ :type inorder: List[int] ...
font = CurrentFont() min = 0 max = 0 for glyph in font: if glyph.bounds != None: if glyph.bounds[1] < min: min = glyph.bounds[1] if glyph.bounds[3] > max: max = glyph.bounds[3] print(min,max) font.info.openTypeOS2TypoAscender = font.info.ascender font.info.ope...
class AtomicappBuilderException(Exception): def __init__(self, cause): super(AtomicappBuilderException, self).__init__(cause) self.cause = cause def to_str(self): ret = str(self.cause) if hasattr(self.cause, 'output'): ret += ' Subprocess output: {0}'.format(self.cau...
""" Here because random is also a builtin module. """ a = set
class Employee: #the self paremeter is a reference #to the current instance of the class - w3schools/python def __init__(self,name,age): self.name = name self.age = age def compute_wage(self,hours, rate): return hours * rate
value = float(input()) print('NOTAS:') for cell in [100, 50, 20, 10, 5, 2]: print('{} nota(s) de R$ {},00'.format(int(value/cell), cell)) value = value % cell print('MOEDAS:') for coin in [1, 0.5, 0.25, 0.10, 0.05, 0.01]: print('{} moeda(s) de R$ {:.2f}'.format(int(value/coin), coin).replace('.',',')) v...
# ----------------------------------------------------------- # Copyright (c) 2021. Danil Smirnov # The football team recruits girls from 10 to 15 years old inclusive. # Write a program that asks for the age and gender of an applicant # using the gender designation m (for male) and f (for female) # to...
""" padding.py """ def pkcs7(bs, block_size): """ An implementation of pkcs#7 padding. """ # Find the amount needed to pad to correct length. pad = block_size - len(bs)%block_size if pad == 0: pad = block_size # Pad with padding length and return. return bytearray(bs) + bytear...
text_list = list(input()) length_matrix = int(input()) matrix = [] player_position = [] for i in range(length_matrix): row = list(input()) matrix.append(row) for j in range(length_matrix): if row[j] == 'P': player_position = [i, j] directions = { 'up': (-1, 0), 'right': (0, 1), ...
class Layer(object): def __init__(self): self.input_shape = None self.x =None self.z = None def initialize(self,folder): pass def train(self, inputs, train=True): pass def forward(self, inputs): pass def backward(self,delta_in,arg)...
""" DEV ~~~ .. data:: DEV Used to specify the development environment. PROD ~~~~ .. data:: PROD Used to specify the production environment. STAGING ~~~~~~~ .. data:: STAGING Used to specify the staging environment. TEST ~~~~ .. data:: TEST Used to specify the test environment. """ DEV = 'dev...
# https://www.hackerrank.com/challenges/three-month-preparation-kit-queue-using-two-stacks/problem class Queue: def __init__(self, s1=[], s2=[]): self.s1 = s1 self.s2 = s2 def isEmpty(self): if not self.s1 and not self.s2: return True return False def size(self): r...
# coding=utf-8 class Solution: """ 反转整数 """ @staticmethod def reverse(x: int) -> int: """ Time: O(k), Space: O(1) :param x: :return: """ is_negative = False if x < 0: x = -x is_negative = True y = 0 wh...
# Copyright (C) 2018 Intel Corporation # # SPDX-License-Identifier: MIT default_app_config = 'cvat.apps.annotation.apps.AnnotationConfig'
"""MQTT Topics""" TOPIC_BUTTON_PROXY = "sensor/button/_proxy" # Hardware button states TOPIC_COFFEE_BUTTON = "sensor/button/coffee" TOPIC_WATER_BUTTON = "sensor/button/water" TOPIC_STEAM_BUTTON = "sensor/button/steam" TOPIC_RED_BUTTON = "sensor/button/red" TOPIC_BLUE_BUTTON = "sensor/button/blue" TOPIC_WHITE_BUTTON ...
{ "targets": [ { "target_name": "irf", "sources": [ "irf/node.cpp", "irf/randomForest.h", "irf/randomForest.cpp", "irf/MurmurHash3.h", "irf/MurmurHash3.cpp" ], 'cflags': [ '<!@(pkg-config --cflags libsparsehash)' ], 'conditions': [ [ 'O...
# SLICE list = ['start', 'second', 'third', 'fourth', 'fifth'] list_fra = list[2] print(list) print(list_fra) print(list[1:3]) print(list[-3:-1]) print(list[-3:]) print(list[:-3])
""" Написать программу, которая выведет на экран все числа от 1 до 100 которые кратные n (n вводится с клавиатуры). """ n = int(input("Enter number: ")) for x in range(1, 101): if x % n ==0: print(x)
""" link: https://leetcode.com/problems/word-search problem: 给二维数组,求路径满足word solution: DFS搜 """ class Solution: def exist(self, board: List[List[str]], word: str) -> bool: if len(board) == 0: return False n, m = len(board), len(board[0]) visit = [[False] * m for _ in range(n)] ...
# -*- coding: utf-8 -*- # 条件判断 age = 20 # 根据Python的缩进规则,执行代码块 if age >= 28: print('大于27岁') print('条件判断内') if age >= 28: print('大于27岁') print('条件判断外') # 以上两段代码,最后一个打印语句缩进不同,执行结果不同 if age >= 20: print('大于20岁') elif age >= 30: print('大于30岁') else: print('未成年') # 练习 height = 1.75 #身高 weight = 80.5 #体重 bmi = we...
class Solution: def helper(self, n: int, k: int, first: int, curr: list, output: list) -> None: if len(curr)==k: output.append(curr[:]) else: for i in range(first, n+1): curr.append(i) self.helper(n, k, i+1, curr, output) curr.p...
#DESAFIO 006: Crie um algoritmo que leia um número e mostre o seu dobro, triplo e raiz quadrada. num = int(input('Digite um número: ')) print('O dobro de {} é {}'.format(num, 2*num)) print('O triplo de {} é {}'.format(num, 3*num)) print('A raiz quadrada de {} é {}'.format(num, num**0.5))
file1 = open('windows/contest.ppm','r') Lines = file1.readlines() count = 0 for line in Lines: a, b, c = line.split() count += 6 A = int(a) B = int(b) C = int(c) while A/10 >= 1 : count += 1 A /= 10 while B/10 >= 1 : count += 1 B /= 10 while ...
MONGODB_SETTINGS = { 'db': 'rsframgia', 'collection': 'viblo_posts', 'host': 'mongodb+srv://nhomanhemcututu:chubichthuy@cluster0.vnbw3.mongodb.net/rsframgia?authSource=admin&replicaSet=atlas-mi89bw-shard-0&w=majority&readPreference=primary&appname=MongoDB%20Compass&retryWrites=true&ssl=true' } PATH_DICTIONA...
# Anders Poirel # https://leetcode.com/problems/valid-parentheses # Runtime: 28 ms, faster than 71.23% of Python3 online submissions for Valid Parentheses. # Memory Usage: 12.8 MB, less than 100.00% of Python3 online submissions for Valid Parentheses. class Solution: def isValid(self, s: str) -> bool: st...
#2. Suppose the cover price of a book is **$24.95, but bookstores get a **40% discount. Shipping costs **$3 for the # first copy and **75 cents for each additional copy. What is the total wholesale cost for **60 copies? cover_price = 24.95 bkstore_dis = cover_price - (cover_price * 40)/100 ship_cost = 3 #only for t...
TITLE = "Сервак" STATEMENT_TEMPLATE = ''' Перед увольнением из фирмы ты скопировал все логи со всех серверов на флешку и забрал их с собой. Какого было твоё удивление, когда ты насчитал на 1 лог больше, чем количество серверов. Разберитесь в чём дело. [log.log](http://ctf.sicamp.ru/static/zq8wmxfhzqw/{0}.log) '''...
# # Author: Luke Hindman # Date: Mon Nov 6 16:13:43 MST 2017 # Description: Example of how to write to a file with Exception Handling # # Write a List of strings to a file # # Parameter # outputFile - A String with the name of the file to write to # dataList - A List of strings to write to the file # # Return ...
power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate...
# This file contains default error messages to be used. notFound = { "status": "error", "type": "404 Not found", "message": "Not found error" } serverError = { "status": "error", "type": "500 Server error", "message": "Unknown internal server error" } badRequest = { "status": "error", ...
# -*- coding: utf-8 -*- def main(): d = list(map(int, input().split())) j = list(map(int, input().split())) gold_amount = 0 for di, ji in zip(d, j): gold_amount += max(di, ji) print(gold_amount) if __name__ == '__main__': main()
''' For Admins: This Template class is to help developers add additional cloud platforms to the software ''' ''' class [Platform_NAME](object): def __init__(self): ## For attributes use convention [NAME]_[FUNCTION]_[PARAM] ## The below attributes are strongly recomended to have within ...
# Write a program to find the node at which the intersection of two singly linked lists begins. # # For example, the following two linked lists: # # A: a1 → a2 # ↘ # c1 → c2 → c3 # ↗ # B: b1 → b2 → b3 # # begin to intersect at node c1. # # Notes: ...