content
stringlengths
7
1.05M
# Copyright 2017 The Forseti Security 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 ap...
class Node: def __init__(self, data): self.data = data self.next = None class Solution: def insert(self, head, data): p = Node(data) if head == None: head = p elif head.next == None: head.next = p else: start = head ...
# The name of the panel to be added to HORIZON_CONFIG. Required. PANEL = 'overview_project' # The name of the dashboard the PANEL associated with. Required. PANEL_DASHBOARD = 'conveyor' # The slug of the panel group the PANEL is associated with. PANEL_GROUP = 'overview' # Python panel class of the PANEL to be added....
class Canvas(): def __init__(self, cell_size, speed=0.6, shift=3.7, divide=4, spread1=0.05, spread2=0.5): self.cell_size = cell_size self.cells = [] self.n_cell_x = int(width * 1.0 / self.cell_size) self.n_cell_y...
''' There is a ball in a maze with empty spaces and walls. The ball can go through empty spaces by rolling up, down, left or right, but it won't stop rolling until hitting a wall. When the ball stops, it could choose the next direction. Given the ball's start position, the destination and the maze, determine whether t...
def binary_search(item_list,item): first = 0 last = len(item_list)-1 flag = False while( first<=last and not flag): temp = (first + last)//2 if item_list[temp] == item : flag = True else: if item < item_list[temp]: last = temp - 1 else: first = temp + 1 return flag message = binary_search...
# Source : https://leetcode.com/problems/divide-two-integers/ # Author : zheyuuu # Date : 2020-07-27 ##################################################################################################### # # Given two integers dividend and divisor, divide two integers without using multiplication, division # and mo...
""" Test module for napoleon PEP 526 compatibility with google style """ module_level_var: int = 99 """This is an example module level variable""" class PEP526GoogleClass: """Sample class with PEP 526 annotations and google docstring Attributes: attr1: Attr1 description. attr2: Attr2 descrip...
dataset_type = 'CocoDataset' img_size = (864, 864) img_norm_cfg = dict(mean=[0, 0, 0], std=[255, 255, 255], to_rgb=True) train_pipeline = [ dict(type='LoadImageFromFile', to_float32=True), dict(type='LoadAnnotations', with_bbox=True), dict( type='PhotoMetricDistortion', brightness_delta=32,...
## # Copyright (c) 2007-2013 Cyrus Daboo. 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 ...
"""Internal payload handling library - Detects. _______ __ _______ __ __ __ | _ .----.-----.--.--.--.--| | _ | |_.----|__| |--.-----. |. 1___| _| _ | | | | _ | 1___| _| _| | <| -__| |. |___|__| |_____|________|_____|____ |____|__| |__|__|__|_____| |: 1...
class Solution: def generate(self, numRows: int) -> List[List[int]]: if numRows==1: return [[1]] else: output=[[1], [1,1]] for i in range(numRows-2): dp=[1] for idx in range(len(output[-1])-1): dp.append(output[-...
LAUNCHER_ERROR = 0 LAUNCHER_VERSION_UPDATE = 1 LAUNCHER_REQUEST_TFA = 2 LAUNCHER_STATUS = 3 LAUNCHER_PROGRESS = 4 LAUNCHER_PLAY_RETRY = 5 LAUNCHER_ENABLE_CONTROLS = 6 LAUNCHER_CLEAR_PASSWORD = 7 LAUNCHER_HIDE = 997 LAUNCHER_SHOW = 998 LAUNCHER_EXIT = 999
# message parameters GLOBAL_ID = 'global_id' LOCAL_ID = 'local_id' DEV_TYPE = 'type' DEV_HW_ADDRESS = 'dev_hw_addr' DEV_IP = 'dev_ip' TYPE = 'type' CONN_TYPE = 'conn_type' PING_MSG = 'ping_msg' HOST = 'host' ERROR = 'error' # adapter parameter ADAPTER_CONF = 'adapter_conf' TIMEOUT = 'timeout' PINSET = 'pinset' # Conn...
# Created by MechAviv # ID :: [865020001] # Commerci Republic : Canal 1 sm.forcedInput(0) sm.setSpeakerID(0) sm.removeEscapeButton() sm.flipDialoguePlayerAsSpeaker() sm.setSpeakerType(8) sm.sendNext("You, there! Stop!") sm.setSpeakerID(9390223) sm.removeEscapeButton() sm.flipDialogue() sm.setSpeakerType(8) sm.sendSay...
def setup(): size(300, 300) smooth() strokeWeight(3) background(0) i = 0 k = 1 flug = 1 def upDate(): global i, k, flug i +=k if i == 255: k=-1 if i == 0: k=1 def draw(): global i, k, flug stroke(i,20) if flug == 1: line(...
# Question 1 # Greatest common divisor of 2 positive integers num1 = int(input("Enter 1st integer: ")) num2 = int(input("Enter 2nd integer: ")) if num1 > num2: if num1 % num2 == 0: gcd1 = num2 a = num2 elif num2 > num1: if num2 % num1 == 0: gcd1 = num1 a = num1 gcd2 = 1 for i in range(2, a+1): if num1 % i =...
# File name: car.py # Author: Steve Hommy # Description: Create a Car Class class Car: def __init__(self, brand, model, boot_size): self.__brand = brand self.__model = model self.__boot_size = boot_size self.__owner = None def set_brand(self): self.__brand = input("Wha...
class VigenereCipher: def __init__(self) -> None: pass @staticmethod def encrypt(msg: str, key: str) -> str: msg, key = msg.upper(), key.upper() if len(msg) > len(key): # Generates the key in a cyclic manner until it's length equal to the length of text for...
S = input().strip() try: n = int(S) print(n) except ValueError: print("Bad String")
# Copyright 2004-2008 Roman Yakovenko. # Distributed under the Boost Software License, Version 1.0. (See # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) """ defines class that will keep results of different calculations. """ class declaration_algs_cache_t( object ): def __i...
n = int(input('Digite um numero: ')) if n % 2 == 0: print('{} é par'.format(n)) else: print('{} é impar'.format(n))
class Target(object): """ Target that Ion Impacts Parameters ---------- layers : list list of :class:`srim.core.layer.Layer` to construct Target Examples -------- Lets construct a SiC target. While only one layer is shown an arbitrary number of them can be used. >>> Target...
# find one idx for the matched sequence def find_index(all_array, element): all_array = all_array.tolist() element = element.tolist() if element in all_array: return all_array.index(element)
"""Constants for the homekit_controller component.""" DOMAIN = "homekit_controller" KNOWN_DEVICES = "{}-devices".format(DOMAIN) CONTROLLER = "{}-controller".format(DOMAIN) ENTITY_MAP = "{}-entity-map".format(DOMAIN) HOMEKIT_DIR = ".homekit" PAIRING_FILE = "pairing.json" # Mapping from Homekit type to component. HOME...
SUPPORTED_RECORDS = [ '$ORIGIN', '$TTL', 'SOA', 'NS', 'A', 'AAAA', 'CNAME', 'ALIAS', 'MX', 'PTR', 'TXT', 'SRV', 'SPF', 'URI', ] DEFAULT_TEMPLATE = """ {$origin}\n\ {$ttl}\n\ \n\ {soa} \n\ {ns}\n\ \n\ {mx}\n\ \n\ {a}\n\ \n\ {aaaa}\n\ \n\ {cname}\n\ \n\ {alias}\n\ \n\ {ptr}\n\ \n\ {txt}\n\ \n\ {srv}\n\ \n\ {spf}...
souradnice_hada = [(0, 0), (1, 0), (2, 0)] souradnice_potravy = [(2, 3)] def vytvor_pole(pocet_radku, pocet_sloupcu): """ vytvori dvojrozmerne pole (matice, seznam v seznamu) dle zadane sirky a delky a vyplni se kazde mi sto "." """ seznam_radku = [] for y in range(pocet_radku): radek ...
"""Assignment 12""" #Here we are observing the addresses of variable x and y x = 10 y = x print("Address of x is: ",id(x)) print("Address of y is: ",id(y))
class Error(Exception): "Base class for KoL Exceptions." def __init__(self, message): self.message = message def __str__(self): return self.message ################ # Login Errors # ################ class LoginError(Error): "A generic exception raised during login." def __init__(self, message, timeToWait=60...
n = int(input()) even_set = set() odd_set = set() for row in range(1, n + 1): name = input() number = 0 for ch in name: number += ord(ch) number //= row if number % 2 == 0: even_set.add(number) else: odd_set.add(number) if sum(even_set) == sum(odd_set): print('...
class Stack(object): def __init__(self): """Initialize an empty stack""" self.items = [] def push(self, item): """Push a new item onto the stack""" self.items.append(item) def pop(self): """Remove and return the last item""" # If the stack is empty, return ...
""" Problem 22 ========== Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name, multiply this value by its alphabetical position in the list to obtain a n...
items = ['sss', 'sss', 'asda', 'asdasd', 'sfsdf'] prefix = 's' filteredlist = list(filter(lambda x: x.startswith(prefix), items)) print(filteredlist)
""" Destaque, caroucel com as novidades do PET banner : endereço do arquivo do banner (recomendado 1080x1080) link: link para redirecionar quando clicar type: 'gdrive' (link do google drive), 'web' (link da web), 'local' (armazenado na pasta img) id: nome do item """ destaque = [ {'type': 'local', 'link': './concurs...
#!/usr/bin/env python #coding=utf-8 ######################################################################### # File Name: Params.py # Author: Mark Chen # mail: zhenchentl@gmail.com # Created Time: 2014年12月12日 星期五 16时46分12秒 ######################################################################### FILE_DIR = '/home/zhe...
load("@rules_proto//proto:defs.bzl", "ProtoInfo") load("//scala/private:common.bzl", "write_manifest_file") load("//scala/private:dependency.bzl", "legacy_unclear_dependency_info_for_protobuf_scrooge") load("//scala/private:rule_impls.bzl", "compile_scala") load("//scala/private/toolchain_deps:toolchain_deps.bzl", "fin...
class Solution: def oddEvenList(self, head: Optional[ListNode]) -> Optional[ListNode]: new1 = l1 = ListNode() new2 = l2 = ListNode() while head : l1.next = head l2.next = head.next l1 = l1.next l2 = l2.next ...
rooms = ['hallway','kitchen', 'living room', 'bedroom','bathroom'] areas = [14.35, 15.0, 19.0, 12.5, 8.75] # Code the for loop for room, area in ___(_____, _____): print(___(____) + ' area is ' + ___(____) + 'm')
def source1(env, factory): yield env.timeout(1) yield 1 def function1(env, item, machine, factory): yield env.timeout(1) def function2(env, item, machine, factory): yield env.timeout(1)
""" character.py by lcordell a blue print of things like weaknesses, skills, traits etc, that are used within the game and offered as an option on character creation. """ resistances = { "cold" : 0, "thirst" : 0, "heat" : 0, "hunger" : 0, "pain" : 0, "fear" ...
journey_cost = float(input()) months_count = int(input()) saved_money = 0 for m in range(1, months_count + 1): if m > 1 and m % 2 != 0: saved_money -= saved_money * 0.16 if m % 4 == 0: saved_money += saved_money * 0.25 saved_money += 0.25 * journey_cost if saved_money >= journey_cost: ...
# ------------------------------------------------------------------------------- # Copyright 2006-2021 UT-Battelle, LLC. See LICENSE for more information. # ------------------------------------------------------------------------------- """ Node structures for RM are implemented here for convenience. """ # local vers...
# -*- coding: utf-8 -*- class Solution: def firstMissingPositive(self, nums): i = 0 while i < len(nums): if 0 <= nums[i] - 1 < len(nums) and nums[i] != nums[nums[i] - 1]: nums[nums[i] - 1], nums[i] = nums[i], nums[nums[i] - 1] else: i += 1 ...
# Python program to encode a word to a Pig Latin. def isVowel(c): return (c == 'A' or c == 'E' or c == 'I' or c == 'O' or c == 'U' or c == 'a' or c == 'e' or c == 'i' or c == 'o' or c == 'u'); def pigLatin(s): # the index of the first vowel is stored. length = len(s); index = -1; for i i...
description = 'The mini-chopper for YMIR' pv_root = 'Utg-Ymir:Chop-Drv-0101:' devices = dict( mini_chopper_status=device( 'nicos.devices.epics.EpicsStringReadable', description='The chopper status.', readpv='{}Chop_Stat'.format(pv_root), lowlevel=True, ), mini_chopper_contr...
""" ============== Binary Search ============== Time Complexity Worst Case : O(log(n)) Average Case : O(log(n)) Best Case : O(1) Space Complexity : O(1) Binary Search is a sorting algorithm in which we select the middle sample and compare key to the middle sample if key is smaller then we search before midd...
def is_valid_bound(row, col): if 0 <= row < n and 0 <= col < n: return True return False def calculate_kills(matrix, row, col): kills = 0 rows = [-2, -2, 2, 2, 1, 1, -1, -1] cols = [-1, 1, -1, 1, -2, 2, -2, 2] for index in range(len(rows)): potential_row = row+rows[index] ...
class A: def __init__(self): print("At A init") def feature1(self): print("Feature 1 working") def feature2(self): print("Feature 2 working") class B(A): def feature3(self): print("Feature 3 working") def feature4(self): print("Feature 4 working") b1 = ...
""" link: https://leetcode.com/problems/happy-number problem: 定义函数f为一个数字n的每位数字平方和,给数字问能否通过有限次f得到1 solution: 模拟 """ class Solution: def isHappy(self, n: int) -> bool: s = set() while True: m = n n = 0 while m: n += (m % 10) * (m % 10) ...
class Solution: # u2takey2 def validateStackSequences(self, pushed, popped): """ :type pushed: List[int] :type popped: List[int] :rtype: bool """ s, i = [], 0 for a in pushed: s.append(a) while s and s[-1] == popped[i]: ...
""" Control Apache Traffic Server ============================= .. versionadded:: 2015.8.0 """ def __virtual__(): """ Only load if the Traffic Server module is available in __salt__ """ if "trafficserver.set_config" in __salt__: return "trafficserver" return (False, "trafficserver module ...
"""Constants for sms Component.""" DOMAIN = "sms" SMS_GATEWAY = "SMS_GATEWAY" SMS_STATE_UNREAD = "UnRead" CONF_BAUD_SPEED = "baud_speed" DEFAULT_BAUD_SPEED = "0" DEFAULT_BAUD_SPEEDS = [ {"value": DEFAULT_BAUD_SPEED, "label": "Auto"}, {"value": "50", "label": "50"}, {"value": "75", "label": "75"}, {"val...
test = { 'name': 'Question 3', 'points': 1, 'suites': [ { 'cases': [ { 'code': r""" >>> take_turn(2, 0, make_test_dice(4, 6, 1)) 70e71b420a966665c548a3bb2cb30d7d # locked """, 'hidden': False, 'locked': True }, ...
class Solution: # Greedy Two Pointers (Accepted), O(n) time, O(1) space def canThreePartsEqualSum(self, arr: List[int]) -> bool: if len(arr) < 3: return False total = sum(arr) target = total / 3 a, b = 0, len(arr)-1 a_tot = b_tot = 0 while a_tot != tar...
load("@fbsource//tools/build_defs:default_platform_defs.bzl", "ANDROID", "APPLE") load("@fbsource//tools/build_defs:fb_native_wrapper.bzl", "fb_native") load( "//tools/build_defs/oss:rn_defs.bzl", "react_native_xplat_target", "rn_xplat_cxx_library", ) def rn_codegen_test( fixture_name = ""): ge...
{ "targets": [ { "target_name": "shm-buffer", "sources": [ "src/shm-buffer.cc" ], "include_dirs": [ "<!(node -e \"require('nan')\")" ] } ] }
# from sqlalchemy import create_engine class DB(object): """ DB connection helper class like standard flask 3-rd party libraries """ def __init__(self, app=None): if app is not None: self.init_app(app) def init_app(self, app): pass
class Solution: def exist(self, board, word): # write your code here m, n = len(board), len(board[0]) for i in range(m): for j in range(n): if board[i][j] == word[0]: if self.helper(board, i, j, 1, word, set()): return T...
# -*- coding: utf-8 -*- """ Created on Fri May 15 01:33:48 2020 @author: Dilay Ercelik """ # Practice # Given a number n, return True if n is in the range 1..10, inclusive. # Unless outside_mode is True, # in which case return True if the number is less or equal to 1, # or greater or equal to 10. ...
user_inp = str(input("Enter a Phrase: ")) text = user_inp.split() a = " " for i in text: a = a+str(i[0]).upper() print(a)
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution(object): def hasPathSum(self, root, targetSum): """ :type root: TreeNode :typ...
lista: tuple = ('lapiz', 1.34, 'Borracha', 2, 'Caderno', 32.45, 'Estojo', 25, 'Compasso', 10, 'Mochila', 120, 'Caneta', 23.97, 'Livro', 123, 'Regra', 2.75) print('---' * 15) print(f'\033[7;30m{"Listagem de Preços":^45}\033[m') print('---' * 15) for tabela in range(0, len(lista), 2): print(f'{lista[t...
# Python Program for n-th Fibonacci number def fibonacci(n): f = [0,1] if n <= 0: return "Enter a valid number" elif n == 1 or n == 2: return n-1 else: for i in range(n-2): fn = f[0] + f[1] f[0] = f[1] f[1] = fn return fn if __name__ ...
DATE_TIME = 'M j, g:i' DATE_AT_TIME = 'F j, Y \\a\\t g:i A T' TIME = 'g:i A T' WEEKDATE = 'l, F j, Y' WEEKDATE_AT_TIME = 'l, F j, Y \\a\\t g:i A T'
def metade(n): return n / 2 def dobro(n): return n * 2 def aumentar(n, p): r = 1 + (p / 100) return n * r def diminuir(n, p): r = 1 - (p / 100) return n * r def moeda(p): res = str(p).replace('.', ',') + '0' return res
billy = { 'tipo': 'papagaio', 'dono': 'joão', } lessie = { 'tipo': 'cachorro', 'dono': 'william', } bela = { 'tipo': 'gato', 'dono': 'kelly', } john = { 'tipo': 'coelho', 'dono': 'gabriela', } luke = { 'tipo': 'gato', 'dono': 'bia', } pets = [billy, lessie, b...
""" A string is said to be a special string if either of two conditions is met: - All of the characters are the same, e.g. aaa. - All characters except the middle one are the same, e.g. aadaa. A special substring is any substring of a string which meets one of those criteria. Given a string, determ...
#-*- coding:utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved # mga@openerp.com # # This program is free software: you can redistribute it and/or mo...
# Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at # the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights # reserved. See files LICENSE and NOTICE for details. # # This file is part of CEED, a collection of benchmarks, miniapps, software # libraries and APIs for efficient h...
# # PySNMP MIB module NBS-OTNPM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NBS-OTNPM-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:07:37 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
test = { 'name': 'Question 5', 'points': 2, 'suites': [ { 'cases': [ { 'answer': 'While score0 and score1 are both less than goal', 'choices': [ 'While score0 and score1 are both less than goal', 'While at least one of score0 or score1 is less than goa...
# # CSCS ReFrame CI settings # class ReframeSettings: job_poll_intervals = [1, 2, 3] job_submit_timeout = 60 checks_path = ['checks/'] checks_path_recurse = True site_configuration = { 'systems': { 'daint': { 'descr': 'Piz Daint CI nodes', 'hostn...
class TwelveMonthCycle(QCAlgorithm): def Initialize(self): self.SetStartDate(2013, 1, 1) self.SetEndDate(2018, 8, 1) self.SetCash(100000) self.AddEquity("SPY", Resolution.Daily) self.Schedule.On(self.DateRules.MonthStart("SPY"), self.TimeRules.AfterMarketOpen("SPY"), s...
# Obtem o arquivo de saida de um teste e o exibe. percentages = [] with open('test_out', 'r') as out: for line in out: if line.startswith('Percentage of NIC rate:'): percentages.append(line.split()[-1]) experiment_order = ['| Jellyfish | TCP 1 Flow | ECMP |', '| Jellyfish | T...
#!/bin/python3 def lg(x): return x.bit_length()-1 if __name__=="__main__": raise RuntimeError("This file is importable, but not executable")
# Berechne molare Masse anhand chemischer Summenformel periodensystem={ 'H' : 1.0079, 'He' : 4.0026, 'Li' : 6.941, 'Be' : 9.0122, 'B' : 10.811, 'C' : 12.011, 'N' : 14.007, 'O' : 15.999, 'F' : 18.988, 'Ne' : 20.180, 'Na' : 22.990, 'Mg' : 24.305, 'Al' : 26.982, 'Si' : 28.086, 'P' : 30.9...
""" Convert soft selection to skin weights. .. figure:: _images/soft-selection-to-weights-example.png :align: center `Link to Video <https://vimeo.com/121190357>`_ Installation ============ * Extract the content of the .rar file anywhere on disk. * Drag the skinning-tools.mel file in Maya to permanently install t...
# -*- coding: utf-8 -*- """ Copyright 2021 huhui, Inc. All Rights Reserved. @author: huhui @software: PyCharm @project: keras-yolo3 @file: __init__.py @version: v1.0 @time: 2021/3/2 下午9:28 @setting: ------------------------------------------------- Description : 工程文件说明: """
inputRow = int(input("Masukkan Angka : ")) for x in range(1, inputRow+1): for y in range(1, x + 1): print(x * y, end=" ") print()
GIFTS = ['twelve Drummers Drumming', 'eleven Pipers Piping', 'ten Lords-a-Leaping', 'nine Ladies Dancing', 'eight Maids-a-Milking', 'seven Swans-a-Swimming', 'six Geese-a-Laying', 'five Gold Rings', 'four Calling Birds', 'three French Hens...
# Given as solution.. subsetspecies = survey_data[survey_data["name"].isin(['Dipodomys merriami', 'Dipodomys ordii', 'Reithrodontomys megalotis', 'Chaetodipus baileyi'])] month_evolution = subsetspecies.groupby("name").resample('M', on='eventDate').size().rename("co...
class ClassComparator: def __init__(self, user=None, business=None): self.user = user self.business = business def wifi(self): factor = 0.0 for data in self.user.wifi: if self.business.wifi == data[0]: factor = data[1] break re...
headers = [ 'Export.hpp', 'Keys.hpp', 'Salts.hpp', 'RobTopCipher.hpp', 'DataCipher.hpp', 'CheckGenerator.hpp' ] includes = [ 'vector', 'string', 'iostream' ] #Helpers def findHeaderBegin(lines): for i in range(len(lines)): if lines[i].startswith('namespace gdcrypto'): ...
a, b = 0, 1 while a < 10: print(a) a, b = b, a + b print() for ch in "string": if ch == "i": break print(ch) for ch in "string": if ch == "i": continue print(ch)
ax = opcsim.plots.histplot( opc.evaluate(d, weight='volume'), opc.bins) ax.set_ylabel("$dV/dlogD_p$") sns.despine()
#Tuples #data structure, can store any type of data #Tuples are immutable #data inside tuple String = ('word1','word2','word3')#we not use[] #Tuples not perform method append,insert,pop,remove #Tuples Methods #count,Index, Len Function,Slicing([:2]) days = ('monday','tuesday')#like that data not be change #tuples are ...
#Create a calculator that asks the user for two numbers m = "multiplication" d = "division" a = "addition" s = "subtraction" #function for multiplication def multiplication(): num1 = input("Okay, enter a number: ") num2 = input("Okay enter another number: ") print(float(num1) * float(num2)) #function f...
COMPUTE_SLA_TEMPLATE = { "type": "Compute", "templateId": "", "name": "dataAssetComputeExecutionAgreement", "description": "", "creator": "", "serviceAgreementTemplate": { "contractName": "EscrowComputeExecutionTemplate", "events": [ { "name": "AgreementCreated", "actorType": "...
## 1. Probability basics ## # Print the first two rows of the data. print(flags[:2]) most_bars_country = flags['name'][flags['bars'].idxmax()] highest_population_country = flags['name'][flags['population'].idxmax()] ## 2. Calculating probability ## total_countries = flags.shape[0] orange_probability = len(flags[flag...
""" PASSENGERS """ numPassengers = 3607 passenger_arriving = ( (5, 9, 8, 5, 2, 0, 4, 11, 3, 3, 2, 0), # 0 (4, 14, 9, 5, 2, 0, 10, 8, 1, 6, 3, 0), # 1 (4, 6, 10, 5, 5, 0, 8, 7, 6, 8, 3, 0), # 2 (9, 11, 12, 0, 4, 0, 5, 14, 6, 4, 1, 0), # 3 (4, 9, 13, 4, 1, 0, 2, 10, 7, 8, 1, 0), # 4 (1, 10, 4, 1, 0, 0, 9, 9...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/11/20 2:48 PM # @Author : Insomnia # @Desc : TODO # @File : ListNode.py # @Software: PyCharm class Node(object): def __init__(self, val, p = None): self.val = val self.next = p def generateListNode(arr): if len(arr) == 0: ...
# # PySNMP MIB module Nortel-MsCarrier-MscPassport-SourceRouteEndStationMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-SourceRouteEndStationMIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:21:56 2019 # On host DAVWANG4-M-1475 platform Darwin v...
def resolve(): ''' code here ''' N, M = [int(item) for item in input().split()] bridges = [[int(item) for item in input().split()] for _ in range(M)] bridges = sorted(bridges, key=lambda x:x[1]) res = 1 prev = bridges[0][1] for a, b in bridges: if a >= prev: re...
HOST = 'localhost' PORT = 8000 TIMEOUT = 500 DEBUG = True BATCHER_PRIVATE_KEY_FILE_NAME = 'clientWEB'
""" SleekXMPP: The Sleek XMPP Library Copyright (C) 2011 Nathanael C. Fritz This file is part of SleekXMPP. See the file LICENSE for copying permission. """ __all__ = [ 'feature_starttls', 'feature_mechanisms', 'feature_bind', 'feature_session', 'feature_rosterver', 'feature_p...
def hcfnaive(a,b): if(b==0): return a else: return hcfnaive(b,a%b) a = 60 b= 48 # prints 12 print ("The gcd of 60 and 48 is : ",end="") print (hcfnaive(60,48))
n, m = [int(i) for i in input().split(" ")] lines = n nodes = n nodes -= m lines -= (m*2) # 7 - 2*2 = 3 # nodes: 5 ans = -1 if m == 0 or m == 1: if n == 0: ans = 0 else: ans = 1 elif lines <= 0: ans = n - m else: ans = nodes - lines print(ans)
score = input("Enter Score: ") s = float(score) if s < 0.0: print("Error! score less 0.0") quit() if s > 1.0: print("Error! score grater 1.0") quit() if s >= 0.9: print("A") elif s >= 0.8: print("B") elif s >= 0.7: print("C") elif s >= 0.6: print("D") elif s < 0.6: print("F")
'''Crie um programa que peça ao usuario dois numeros e mostre a soma entre eles''' n1 = int(input('Digite um numero inteiro: ')) n2 = int(input('Digite outro numero inteiro: ')) print('A soma entre {} e {} é {}'.format(n1, n2, n1+n2))
def templateEntity(template) -> dict: return{ "_id": str(template['_id']), "name": template['name'], "subject": template["subject"], "content": template["content"], } def templateEntities(templates) -> list: return [templateEntity(template) for template in templates]