content
stringlengths
7
1.05M
N, C = map(int, input().split()) l = [tuple(map(int, input().split())) for i in range(N)] s = set() for a, b, c in l: s.add(a) s.add(b + 1) d = {} s = sorted(list(s)) for i, j in enumerate(s): d[j] = i m = [0] * (len(s) + 1) for a, b, c in l: m[d[a]] += c m[d[b + 1]] -= c ans = 0 for i in range(len(...
print( 1 == 1 or 2 == 2 ) print( 1 == 1 or 2 == 3 ) print( 1 != 1 or 2 == 2 ) print( 2 < 1 or 3 > 6 )
class Node: def __init__(self, data): self.data = data self.next = None class llist: def __init__(self): self.head = None def reverse(self, head): if head is None or head.next is None: return head rest = self.reverse(head.next) head.next.next ...
class Funcionario: def __init__(self, nome, cpf, salario): self._nome = nome self._cpf = cpf self._salario = salario def get_bonificacao(self): return self._salario * 0.10 + 1000.0 class Gerente(Funcionario): def __init__(self, nome, cpf, salario, senha, q...
texto = input("Ingrese su texto: ") def SpaceToDash(texto): return texto.replace(" ", "-") print (SpaceToDash(texto))
nome = 'Fabio Rodrigues Dias' cores = {'limpa':'\033[m', 'azul':'\033[1;7;34m', 'amarelo':'\033[33m', 'pretoebranco': '\033[7;30m'} print('Ola!! Muito prazer em te conhecer, {}{}{}'.format(cores['azul'], nome , cores['limpa']))
"""Warnings""" # Authors: Jeffrey Wang # License: BSD 3 clause class ConvergenceWarning(UserWarning): """ Custom warning to capture convergence issues. """ class InitializationWarning(UserWarning): """ Custom warning to capture initialization issues. """ class StabilizationWarning(UserWarning): """ Custom w...
# Copyright (c) 2018, the R8 project authors. Please see the AUTHORS file # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. def CheckDoNotMerge(input_api, output_api): for l in input_api.change.FullDescriptionText().splitlines(): ...
# I wouldn't be able to say if this question was hard or easy. It uses the fundamental stuff. No modules. # However changing the rules of math was mind-boggling def Part1(part2): calc = list() with open("Day18.txt") as f: for line in f: operation = line.strip().replace(" ", "") ...
class VCard(): def __init__(self, filename:str): self.filename = filename def create(self, display_name:list, full_name:str, number:str, email:str=None): '''Create a vcf card''' bp = [1, 2, 0] pp = [0, 1, 2] rn = [] for i, j in zip(bp, pp): rn.insert(i, display_name[j]+";") fd = self.fi...
#!/usr/bin/env python3 """genomehubs version.""" __version__ = "2.2.0"
# # Copyright (c) 2017 Joy Diamond. All rights reserved. # @gem('Quartz.Parse1') def gem(): require_gem('Quartz.Match') require_gem('Quartz.Core') show = true @share def parse1_mysql_from_path(path): data = read_text_from_path(path) many = [] append = many.append ...
#!/usr/bin/env python3 """Front Back. Given a string, return a new string where the first and last chars have been exchanged. front_back('code') == 'eodc' front_back('a') == 'a' front_back('ab') == 'ba' """ def front_back(str_: str) -> str: """Swap the first and last characters of a string.""" if len(str_)...
# https://leetcode.com/problems/encode-and-decode-strings/ class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str """ return ''.join(s.replace('|', '||') + ' | ' for s in strs) def decode(self, s): ...
a = range(2, 10, 2) b = list(a) c = [a] print('')
stages = [''' +---+ | | O | /|\ | / \ | | ========= ''', ''' +---+ | | O | /|\ | / | | ========= ''', ''' +---+ | | O | /|\ | | | ========= ''', ''' +---+ | | O | /| | | | =========''', ''' +---+ | | O | | | |...
"""Preço e desconto""" # Operadores aritmeticos preco = int(input('Digite o preço do produto: ')) off = (price * 5) / 100 precofinal = price - off print('O preço final do produto com 5% de desconto é: R$ {}'.format(pricef))
# This si a hello worls script # written in Python def main(): print("Hello, world") if __name__ == "__main__": main()
## To modify by developper(s) of the plugin SHORT_PLUGIN_NAME = 'amplitude' #for instance daqmx package_url = 'https://github.com/CEMES-CNRS/pymodaq_plugins_amplitude' #to modify description = 'Set of PyMoDAQ plugins for Amplitude Systems Lasers' author = 'Sébastien Weber' author_email = 'sebastien.weber@cemes.fr' #...
# Your code below: number_list = range(9) print(list(number_list)) zero_to_seven = range(8) print(list(zero_to_seven))
# Solution to problem 6 # #Student: Niamh O'Leary# #ID: G00376339# #Write a program that takes a user input string and outputs every second word# string = "The quick broen fox jumps over the lazy dog" even_words = string.split(' ')[::2] #split the original string. Then use slice to select every second word# ...
# # This file is part of pySMT. # # Copyright 2014 Andrea Micheli and Marco Gario # # 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 ...
def left(i): return 2*i+1 def right(i): return 2*i+2 def max_heapify(data, size, i): l = left(i) r = right(i) val = data[i] largest = i if l < size and data[l] > data[largest]: largest = l if r < size and data[r] > data[largest]: largest = r if largest != i: ...
# Calculate the standard deviation by taking the square root port_standard_dev = np.sqrt(np.dot(weights.T, np.dot(cov_matrix, weights))) # Print the results print(str(np.round(port_standard_dev, 4) * 100) + '%')
class Solution: def diameterOfBinaryTree(self, root: TreeNode) -> int: if not root: return 0 self.res = 0 self.dfs(root) return self.res-1 def dfs(self, root): if not root: return 0 left = self.dfs(root.left) right = self.dfs(r...
def partida_ajedrez(nombrefichero): tablero_inicial = '♜\t♞\t♝\t♛\t♚\t♝\t♞\t♜\n♟\t♟\t♟\t♟\t♟\t♟\t♟\t♟\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n♙\t♙\t♙\t♙\t♙\t♙\t♙\t♙\n♖\t♘\t♗\t♕\t♔\t♗\t♘\t♖' tablero = [] for i in tablero_inicial.split('\n'): tablero.append(i.split('\t')) ...
def _set_status(task_list, task_name, status): task = task_list.get_task(task_name) task.status = status def done(task_list, args): _set_status(task_list, args.task, "completed") return def start(task_list, args): _set_status(task_list, args.task, "started") return def pause(task_list, arg...
# coding: utf-8 class ArrayBasedQueue: def __init__(self): self.array = [] def __len__(self): return len(self.array) def __iter__(self): for item in self.array: yield item # O(1) def enqueue(self, value): self.array.append(value) # O(n) def deq...
# -*- coding:utf-8 -*- class Trade(object): """ 交易模块基类,根据模型预测的涨跌信号和实时数据发出交易指令 """ def __init__(self): self.tradeinfo = [] def trade(self, signal, dataset): """ 交易 :param signal: 模型预测的涨跌信号(+-1,0) :param dataset: 实时行情,DataSet基类 :return: 交易指令 """ pass def rcvtrade(self, trade): print(*trade) ...
#1. Create a greeting for your program. print("\nSimple Name Generator\n") #2. Ask the user for the city that they grew up in. #raw_input() for python v2 , input() for python v3 # Make sure the input cursor shows on a new line raw_input("Press enter : ") print("\nSimple Name Generator\n") city = raw_input("What is the ...
class Solution: def solve(self, height, blacklist): blacklist = set(blacklist) if height in blacklist: return 0 dp = [[0,1]] MOD = int(1e9+7) for i in range(1,height+1): if height-i in blacklist: dp.append([0,0]) continue ...
""" [A. Is it rated?](https://codeforces.com/contest/1331/problem/A) """ print("No") # The contest was not rated
def addFeatureDataStruc(data): data['LenCarName']=data['car name'].apply(lambda x: len(x.split())) newFeat=[ 'cylinders', 'displacement', 'horsepower', 'weight','acceleration','lrScore','LenCarName'] return data[newFeat],data[['mpg']]
#!/usr/bin/env python # encoding: utf-8 ''' @author: Jason Lee @license: (C) Copyright @ Jason Lee @contact: jiansenll@163.com @file: min_heap.py @time: 2019/4/29 20:23 @desc: ''' # please see the comments in max_heap.py def min_heap(array): if not array: return None length = len(array) ...
# -*- coding: utf-8 -*- #Lists myList = [1, 2, 3, 4, 5, "Hello"] print(myList) print(myList[2]) print(myList[-1]) myList.append("Simo") print(myList) #Tuples - like lists, but you cannot modify their values. monthsOf = ("Jan","Feb","Mar","Apr") print(monthsOf) #Dictionary - a collection of related data PAIRS myDict ...
cobranca_sob_ameaca = [ """ DECISÃO 1) Preenchidos os requisitos legais, defiro a gratuidade de justiça requerida pela parte autora, uma vez demonstrada a sua situação de hipossuficiência econômica, através dos documentos acostados junto à petição inicial. ANOTE-SE ONDE C$ 2) Pretende a parte autora o deferimento...
SCAN_COMMANDS = {'arp', 'arp-scan', 'fping', 'nmap'} def rule(event): # Filter out commands if event['event'] == 'session.command' and not event.get('argv'): return False # Check that the program is in our watch list return event.get('program') in SCAN_COMMANDS def title(event): return '...
def getPeopleHarvest(req): try: # result = req.get("result") # username = "pescettoe@amvbbdo.com" # password = "Welcome1!" # top_level_url = "https://xlaboration.harvestapp.com/people/1514150" # # # create an authorization handler # p = urllib.request.HTTPPass...
""" URL: https://codeforces.com/problemset/problem/1421/A Author: Safiul Kabir [safiulanik at gmail.com] Tags: bitmasks, math """ t = int(input()) for _ in range(t): a, b = map(int, input().split()) print(a ^ b)
ASCII = [c for c in (chr(i) for i in range(32, 127))] def cipher(text, key, decode): op = '' for i, j in enumerate(text): if j not in ASCII: op += j else: text_index = ASCII.index(j) k = key[i % len(key)] key_index = ASCII.index(k) if...
# Exercício Python 01 - Aprovando Empréstimo #Exercício: 01 Escreva um programa para aprovar o empréstimo bancário para a compra de uma casa. Pergunte o valor da casa, o salário do comprador e em quantos anos ele vai pagar. A prestação mensal não pode exceder 30% do salário ou então o empréstimo será negado. casa = ...
"""This is a 'Hello, world' program.""" def hello(): """Say, hello.""" print("Hello, World!") if __name__ == "__main__": hello()
''' Write a code which accepts a sequence of words as input and prints the words in a sequence after sorting them alphabetically. Hint: In case of input data being supplied to the question, it should be assumed to be a console input. ''' print('Input number word for : ') n = input() mp = list(map(lambda x: ord(...
class subject (): def __init__(self): x=[] self.students=[] def addstudents(self): n=int(input("Enter No. Of Students :- ")) for i in range (n): self.name=input("Enter Name :- ") self.rno=input("Enter Roll No. :- ") self.marks=input("E...
def make_dot(count, left, right): if left == "" and right == "": return count * "." if right == "": if left == "L": return '.'*count else: return 'R'*count if left == "": if right == "L": return count * "L" else: retur...
{ 'FONTS': [ ('杨任东竹石体-Regular.ttf', '杨任东竹石体-Regular'), ('杨任东竹石体-Semibold.ttf', '杨任东竹石体-Semibold') ], }
"""Do a one-time build of default.png""" # Copyright (c) 2001-2009 ElevenCraft Inc. # See LICENSE for details. if __name__ == '__main__': f = file('default.png', 'rb') default_png = f.read() f.close() f = file('_default_png.py', 'wU') f.write('DEFAULT_PNG = %r\n' % default_png) f.close()
""" docsting of empty_all module. """ __all__ = [] def foo(): """docstring""" def bar(): """docstring""" def baz(): """docstring"""
load( "@io_bazel_rules_dotnet//dotnet/private:context.bzl", "dotnet_context", ) load( "@io_bazel_rules_dotnet//dotnet/private:providers.bzl", "DotnetLibrary", "DotnetResource", ) load( "@io_bazel_rules_dotnet//dotnet/private:rules/launcher_gen.bzl", "dotnet_launcher_gen", ) def _core_bina...
if sys.version_info.minor > 9: phr = {"user_id": user_id} | content else: z = {"user_id": user_id} phr = {**z, **content}
class Solution: def numSubarrayProductLessThanK(self, nums: List[int], k: int) -> int: if k <= 1 : return 0 prod =1 res = 0 i,j = 0, 0 while j < len(nums): prod *= nums[j] if prod < k : res += (j-i+1) elif prod...
""" This module defines the learner interface. """ class Learner: """ A learner ingests data, manipulates internal state by learning off this data, supplies agents for taking further actions, and provides an opaque interface to internal evaluation. """ def train(self, data, timesteps): ...
# helpers def create_data_list(dic): """ This function creates a list from a data dictionary where all user data is stored """ lst = [] lst.append(dic['cough']) lst.append(dic['fever']) lst.append(dic['sore_throat']) lst.append(dic['shortness_of_breath']) lst.append(dic['head_ache']) lst.append(int(dic['age']))...
# -*- coding: utf-8 -*- # ScrollBar part codes # Left arrow of horizontal scroll bar. # @see ScrollBar::scrollStep sbLeftArrow = 0 # Right arrow of horizontal scroll bar. # @see ScrollBar::scrollStep sbRightArrow = 1 # Left paging area of horizontal scroll bar. # @see ScrollBar::scrollStep sbPageLeft = 2 # Right pag...
BLACK = u"\u001b[30m" RED = u"\u001b[31m" GREEN = u"\u001b[32m" YELLOW = u"\u001b[33m" BLUE = u"\u001b[34m" MAGENTA = u"\u001b[35m" CYAN = u"\u001b[36m" WHITE = u"\u001b[37m" BBLACK = u"\u001b[30;1m" BRED = u"\u001b[31;1m" BGREEN = u"\u001b[32;1m" BYELLOW = u"\u001b[33;1m" BBLUE = u"\u001b[34;1m" BMAGENTA = u"\u001b[3...
""" Modulo -> apenas um arquivo python Pacote -> pe um diretório contendo um coleção de módulos OBS.: Nas versões do python abaixo de 3, os pacotes deveriam conter um arquivo chamado __init__.py Nas versões acima de 3, não é mais necessário. """
''' module for implementation of merge sort ''' def merge_sort(arr: list): if len(arr) > 1: mid = len(arr) // 2 L = arr[:mid] R = arr[mid:] merge_sort(L) merge_sort(R) i, j, k = 0, 0, 0 while (i < len(L) and j < len(R)): if (L[i] < R[j])...
#!/usr/bin/env python3 class MessageBroadcast: def __init__(self, friend_graph, start_person): self.friend_graph = friend_graph self.start_person = start_person self.people_without_message = list(friend_graph.keys()) self.step_number = 0 self.new_people_with_message_in_last...
''' pythagorean_triples.py: When given the sides of a triangle, tells the user whether the triangle is a right triangle. Based on https://www.redd.it/19jwi6 ''' while True: sides = input('Enter the three sides of a triangle, separated by spaces: ') try: sides = [int(x) for x in sides.split()] e...
# -*- coding: utf-8 -*- # Copyright (c) 2012 Fabian Barkhau <fabian.barkhau@gmail.com> # License: MIT (see LICENSE.TXT file) ID = r"[0-9]+" SLUG = r"[a-z0-9\-]+" USERNAME = r"[\w.@+-]+" # see django.contrib.auth.forms.UserCreationForm def _build_arg(name, pattern): return "(?P<%s>%s)" % (name...
""" (C) Copyright 2020 Scott Wiederhold, s.e.wiederhold@gmail.com https://community.openglow.org SPDX-License-Identifier: MIT """ _decode_step_codes = { 'LE': {'mask': 0b00010000, 'test': 0b00010000}, # Laser Enable (ON) 'LP': {'mask': 0b10000000, 'test': 0b01111111}, # Laser Power Setting 'XP': {'mas...
translations = { "startMessage": "I can help you see all of your EqualHash.pt statistics\n\nYou can control me by " "sending these " "commands:\n\n/newaddr - Add new address\n/myaddrs - View all address\n\n*Edit " "Addresses*\n/setname - Ch...
# A Python program to demonstrate need # of packing and unpacking # A sample function that takes 4 arguments # and prints them. def fun(a, b, c, d): print(a, b, c, d) # Driver Code my_list = [1, 2, 3, 4] # This doesn't work fun(my_list)
# coding=utf-8 __author__ = "Gina Häußge <osd@foosel.net>, Christopher Bright <christopher.bright@gmail.com>" __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' class reverse_proxied(object): """ Wrap the application in this middleware and configure the front-end server to add ...
''' 1. Write a Python program for binary search. Binary Search : In computer science, a binary search or half-interval search algorithm finds the position of a target value within a sorted array. The binary search algorithm can be classified as a dichotomies divide-and-conquer search algorithm and executes in logarith...
nums = int(input()) points = [] for i in range(0, nums): read_list = list(map(int, input().split())) # read_list = [int(i) for i in input().split()] points.append((read_list[0], read_list[1])) print(points) """ 3 1 2 23 4 4 5 [(1, 2), (23, 4), (4, 5)] """
# uncompyle6 version 2.9.10 # Python bytecode 2.7 (62211) # Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10) # [GCC 6.2.0 20161005] # Embedded file name: __init__.py MCL_OS_ARCH_I386 = 0 MCL_OS_ARCH_SPARC = 1 MCL_OS_ARCH_ALPHA = 2 MCL_OS_ARCH_ARM = 3 MCL_OS_ARCH_PPC = 4 MCL_OS_ARCH_HPPA1 = 5 MCL_OS_ARC...
#!/usr/bin/python ''' --- Part Two --- "Great work; looks like we're on the right track after all. Here's a star for your effort." However, the program seems a little worried. Can programs be worried? "Based on what we're seeing, it looks like all the User wanted is some information about the evenly divisible values...
class Restaurant: """Beskriva saker om restauranger och deras typ av kök""" def __init__(self, restaurant_name, cuisine_type): """Ta in parameter för vilken namn och typ av kök restaurangen har""" self.restaurant_name = restaurant_name self.cuisine_type = cuisine_type def describe...
File1 = open(input("File path of first list in text file:"), "rt") File2 = open(input("File path of second list in text file:"), "rt") file = open("Compared_List.txt", "a+") suffix_sp = [] #a list of genuses with "sp." suffix to denote the entire genus species = [] #list of species from File1 if __name__ =...
class Solution: def zigzagLevelOrder(self, root): if root is None: return [] res = [] res.append([root.val]) queue = [] queue.append(root) level_nodes = [] level_node_count = 1 next_level_node_count = 0 left_to_right = True ...
"""Adding routes for the configuration to find.""" def includeme(config): config.add_static_view('static', 'static', cache_max_age=3600) config.add_route('list', '/') config.add_route('profile', '/profile/{id:\d+}') config.add_route('login', '/login') config.add_route('logout', '/logout') conf...
# The guess API is already defined for you. # @param num, your guess # @return -1 if my number is lower, 1 if my number is higher, otherwise return 0 # def guess(num): class Solution(object): def guessNumber(self, n, lo=0): """ :type n: int :rtype: int """ if lo >= n: ...
############################################################################################### # 直接暴力,遍历一次,每次要排序 ########### # 时间复杂度:O(n*klogk),n为strs长度,k为每个串的长度 # 空间复杂度:O(nk),哈希表存放全部字符串 ############################################################################################### class Solution: def group...
"""Figure size settings.""" # Some useful constants _GOLDEN_RATIO = (5.0 ** 0.5 - 1.0) / 2.0 _INCHES_PER_POINT = 1.0 * 72.27 # Double-column formats def icml2022_half(**kwargs): """Double-column (half-width) figures for ICML 2022.""" return _icml2022_and_aistats2022_half(**kwargs) def icml2022_full(**kwar...
""" 1: Client Message 2: Phase1A 3: Phase1B 4: Phase2A 5: Phase2B 6: Decision 7: Leader 8: Catchup 9: Catchup_Answer """ class Message: def __init__(self, msg_type, message=0, instance=0, iid=0, c_rnd=0, c_val=0, rnd=0, v_val=0, v_rnd=0, current_leader=0, prop_id=0, msg_memory=None, ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Python for AHDA. Part 1, Example 9. """ # Deduplication of a list rhyme = ['Peter', 'Piper', 'picked', 'a', 'piece', 'of', 'pickled', 'pepper', 'A', 'piece', 'of', 'pickled', 'pepper', 'Peter', 'Piper', 'picked'] deduplicated_rhyme = set(rhyme) print(deduplicated_rhy...
class Solution: # @param {int[]} nums an integer array # @return nothing, do this in-place def moveZeroes(self, nums): # Write your code here i = 0 for j in xrange(len(nums)): if nums[j]: num = nums[j] nums[j] = 0 nums[i] = ...
''' key-value methods in dictionary ''' # Keys key_dictionary = { 'sector': 'Keys method', 'variable': 'dictionary' } print(key_dictionary.keys()) # Values value_dictionary = { 'sector': 'Values method', 'variable': 'dictionary' } print(value_dictionary.values()) # Key-value key_value_dictionary =...
for _ in range(int(input())): tr = int(input()) ram_task = list(map(int, input().split(' '))) dr = int(input()) ram_dare = list(map(int, input().split(' '))) ts = int(input()) sham_task = list(map(int, input().split(' '))) ds = int(input()) sham_dare = list(map(int, input().split(' '))) ...
q1 = 1 q2 = -2 q3 = 4 state = (q1, q2, q3) state = (-state[0], -state[1], -state[2]) #str(state[0]) = '33' print(state)
def dfs(at, graph, visited): if visited[at]: return visited[at] = True print(at, end=" -> ") neighbours = graph[at] for next in neighbours: dfs(next, graph, visited) if __name__ == "__main__": n = int(input("No. of Nodes : ")) graph = [] for i in range(n): graph...
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES") load( "@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl", "feature", "flag_group", "flag_set", "tool_path", ) all_link_actions = [ ACTION_NAMES.cpp_link_executable, ACTION_NAMES.cpp_link_dynamic_library, ACTIO...
class Solution: """ @param nums: A list of integers @return: A integer indicate the sum of max subarray """ def maxSubArray(self, nums): n = len(nums) prefixSum = [0 for _ in range(n + 1)] minIdx = 0 largeSum = -sys.maxsize - 1 for i in range(1, n + 1): ...
def predicate(h, n): ''' Returns True if we can build a triangle of height h using n coins, else returns False ''' return h*(h+1)//2 <= n t = int(input()) for __ in range(t): n = int(input()) # binary search for the greatest height which can be reached using n coins lo = 0 hi = n wh...
class Solution: def hammingDistance(self, x: int, y: int) -> int: count = 0 for i in range(30, -1, -1): mask = 1 << i digitX = x & mask digitY = y & mask if digitX != digitY: count += 1 return count
''' import tkinter as tk window = tk.Tk() window.geometry ("800x450+0+0") window.title ('Conversor de base') des = 'Desafio-037 estrutura condição aninhada-002' print ('{}'.format(des)) ''' #Escreva um programa em Python que leia um número inteiro qualquer e peça para o usuário escolher qual s...
# https://javl.github.io/image2cpp/ # 40x40 CALENDAR_40_40 = bytearray([ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x1c, 0x00, 0x00, 0x38, 0x00, 0x1c, 0x00, 0x00, 0x3c, 0x00, 0x1c, 0x00, 0x01, 0xff, 0xff, 0xff, 0x80, 0x03, 0xff, 0xff, 0xff, 0xc0, 0x07, 0xff, 0xff, 0xff,...
class Category: """ Categories of vehicles sold. """ NEW = "new" DEMO = "demo" USED = "preowned" class VehicleType: """ Types of vehicles sold. """ CARGO_VAN = "CARGO VAN" CAR = "Car" SUV = "SUV" TRUCK = "Truck" VAN = "Van"
#Ввести с клавиатуры строку, проверить является ли строка палиндромом и вывести результат (yes/no) на экран. Палиндром - это слово или фраза, которые одинаково читаются слева направо и справа налево polin = str(input( "Введите слово: ")) polin_test = polin[::-1] if polin == polin_test: print("YES") else: pri...
class BaseObject(object): """ A base class to provide common features to all models. """
expected_output = { "interfaces": { "GigabitEthernet1/0/17": { "mac_address": { "0024.9bff.0ac8": { "acct_session_id": "0x0000008d", "common_session_id": "0A8628020000007168945FE6", "current_policy": "Test_DOT1X-DEFAULT_...
def my_plot(df, case_type, case_thres=50000): m = Basemap(projection='cyl') m.fillcontinents(color='peru', alpha=0.3) groupby_columns = ['Country/Region', 'Province/State', 'Lat', 'Long'] max_num_cases = df[case_type].max() for k, g in df.groupby(groupby_columns): country_region, provi...
class Review: all_reviews = [] def __init__(self,news_id,title,name,author,description,url, urlToImage,publishedAt,content): self.new_id = new_id self.title = title self.name= name self.author=author self.description=description self.url=link self. urlT...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """HMC5883L: Surface-mount, multi-chip module designed for low-field magnetic sensing with a digital interface for applications such as lowcost compassing and magnetometry""" __author__ = "ChISL" __copyright__ = "TBD" __credits__ = ["Honeywell"] __license__ = "...
class Solution: def countBits(self, num: int) -> List[int]: ans=[] for i in range(num+1): ans.append(bin(i).count('1')) return ans
def change(img2_head_mask, img2, cv2, convexhull2, result): (x, y, w, h) = cv2.boundingRect(convexhull2) center_face2 = (int((x + x + w) / 2), int((y + y + h) / 2)) #can change it to Mix_clone seamlessclone = cv2.seamlessClone(result, img2, img2_head_mask, center_face2, cv2.NORMAL_CLONE) re...
# Created by MechAviv # Map ID :: 100000000 # NPC ID :: 9110000 # Perry maps = [["Showa Town", 100000000], ["Ninja Castle", 100000000], ["Six Path Crossway", 100000000]]# TODO sm.setSpeakerID(9110000) selection = sm.sendNext("Welcome! Where to?\r\n#L0# To Showa Town#l\r\n#L1# To Ninja Castle#l\r\n#L2# To Six Path Cross...
'''input 98 56 Worse 12 34 Better ''' # -*- coding: utf-8 -*- # AtCoder Beginner Contest # Problem A if __name__ == '__main__': x, y = list(map(int, input().split())) if x < y: print('Better') else: print('Worse')
INVALID_ARGUMENT = 'invalid argument' PERMISSION_DENIED = 'permission denied' UNKNOWN = 'unknown' NOT_FOUND = 'not found' INTERNAL = 'internal error' TOO_MANY_REQUESTS = 'too many requests' SERVER_UNAVAILABLE = 'service unavailable' BAD_REQUEST = 'bad request' AUTH_ERROR = 'authorization error' class TRError(Exceptio...