content
stringlengths
7
1.05M
material = [] for i in range(int(input())): material.append(int(input())) srted = sorted(material) if srted == material: print("YES") else: print("NO")
PALETTE = ( '#51A351', '#f89406', '#7D1935', '#4A96AD', '#DE1B1B', '#E9E581', '#A2AB58', '#FFE658', '#118C4E', '#193D4F', ) LABELS = { 'cpu_user': 'CPU time spent in user mode, %', 'cpu_nice': 'CPU time spent in user mode with low priority (nice), %', 'cpu_sys': 'CPU...
def alphabet_war(reinforces, airstrikes): n=len(reinforces[0]) r=[] for _ in range(n): r.append([]) for reinforce in reinforces: for i in range(n): r[i].append(reinforce[i]) a=[] for i in range(n): a.append(r[i].pop(0)) for airstrike in airstrikes: ...
class UnknownLogKind(ValueError): """Exception thrown when an unknown ``kind`` is passed.""" def __init__(self, value): """ Construct the exception. :param value: The invalid kind value passed in. """ message = "Unknown log entry kind %r" % value super(UnknownLo...
''' La función muestra como el código se ejecuta, qué espera y cuál es su salida. En caso de que no coincida, la prueba fallará ''' def multiply(a, b): """ >>> multiply(4, 3) 12 >>> multiply('a', 3) 'aaa' """ return a * b
# encoding: utf-8 """ ordereddict.py Created by Thomas Mangin on 2013-03-18. Copyright (c) 2009-2015 Exa Networks. All rights reserved. """ # ================================================================== OrderedDict # This is only an hack until we drop support for python version < 2.7 class OrderedDict(dict):...
# > \brief \b DROTMG # # =========== DOCUMENTATION =========== # # Online html documentation available at # http://www.netlib.org/lapack/explore-html/ # # Definition: # =========== # # def DROTMG(DD1,DD2,DX1,DY1,DPARAM) # # .. Scalar Arguments .. # DOUBLE PRECISION DD1,DD2,DX1,DY1 # ...
""" 10. Regular Expression Matching Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches zero or more of the preceding element. The matching should cover the entire input string (not partial). Note: s could be e...
#!/usr/bin/env python IRC_BASE = ["ircconnection", "irclib", "numerics", "baseircclient", "irctracker", "commandparser", "commands", "ircclient", "commandhistory", "nicknamevalidator", "ignorecontroller"] PANES = ["connect", "embed", "options", "about", "url"] UI_BASE = ["menuitems", "baseui", "baseuiwindow", "colour",...
#Q2.Make a list of ten students in your class. Print the name of each student whose name ends with ‘a’. word='a' list=['akriti','aman','benisha','bipin','bipesh','carin','carol','cavin','janisha','jeevan'] for i in range(0,10): if list[i][-1]==word: print(list[i])
#!/usr/env python class Queue: def __init__(self, size=16): self.queue = [] self.size = size self.front = 0 self.rear = 0 def is_empty(self): return self.rear == 0 def is_full(self): if (self.front - self.rear + 1) == self.size: return ...
class FenwickTree: data: [] def __init__(self, n: int): self.data = [0] * (n + 1) @staticmethod def __parent__(i: int) -> int: return i - (i & (-i)) def __str__(self): return str(self.data)
namesList = ['유나', '지은', '스튜어트', '케빈'] sentence = '우리 강아지는 소파 위에서 잔다' names = ';'.join(namesList) print(type(names), ':', names) wordList = sentence.split(' ') print((type(wordList)), ':', wordList) additionExample = '파이썬' + '파이썬' + '파이썬' multiplicationExample = '파이썬' * 2 print('텍스트 덧셈 :', additionExample) print('텍스...
party_size = int(input()) days = int(input()) coins = 0 for i in range(1, days + 1): coins += 50 if i % 10 == 0: party_size -= 2 if i % 15 == 0: party_size += 5 coins -= party_size * 2 if i % 3 == 0: coins -= party_size * 3 if i % 5 == 0: coins += party_size * 2...
''' Write a procedure called oddTuples, which takes a tuple as input, and returns a new tuple as output, where every other element of the input tuple is copied, starting with the first one. So if test is the tuple ('I', 'am', 'a', 'test', 'tuple'), then evaluating oddTuples on this input would return the tuple ('I', 'a...
def random_board(): ''' Creates the dice which have letters on each side --> Array of length 6 per die ''' self.cube_one = ["A","A","E","E","G","N"] self.cube_two = ["A","O","O","T","T","W"] self.cube_three = ["D","I","S","T","T","Y"] self.cube_four = ["E","I","O","S","S","T"] self.c...
# Print N reverse # https://www.acmicpc.net/problem/2742 print('\n'.join(list(map(str, [x for x in range(int(input()), 0, -1)]))))
class Camera: def __init__(): #Need to have all information necessary to calibrate camera input into here as arguements #Calibrate Camera - constant #Locate Camera Relative to Centerpoint - constant #Define GPIO pins for synchronization - constant #Change camera settings - tunable ...
# 33. Search in Rotated Sorted Array class Solution: def search(self, nums, target: int) -> int: def binSearchPiv(l, r, target): while l < r: m = (l+r)//2 if nums[m] > nums[m+1]: return m+1 if nums[m] > target: l = m+1 else: r = m ...
# # PySNMP MIB module Juniper-System-Clock-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-System-Clock-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:53:45 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7....
# # PySNMP MIB module CTRON-SFPS-CALL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-SFPS-CALL-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:15:09 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
""" Tuple as Data Structure """
class RPMReqException(Exception): msg_fmt = "An unknown error occurred" def __init__(self, msg=None, **kwargs): self.kwargs = kwargs if not msg: try: msg = self.msg_fmt % kwargs except Exception: msg = self.msg_fmt super(RPMReqExce...
# coding: utf-8 # In[43]: alist = [54,26,93,17,77,31,44,55,20] def bubbleSort(alist): for passnum in range(len(alist)-1,0,-1): for i in range(passnum): if alist[i]>alist[i+1]: temp = alist[i] alist[i] = alist[i+1] alist[i+1] = temp return a...
# Defining the Movie Class # Creates an instance of a movie with related details class Movie(): def __init__(self, movie_title, poster_image, trailer_id, movie_year, movie_rating, movie_release_date, movie_imdb_rating): self.title = movie_title self.poster_image_url = poster_imag...
# -*- coding: utf-8 -*- system_proxies = None; disable_proxies = {'http': None, 'https': None}; proxies_protocol = "http"; proxies_protocol = "socks5"; defined_proxies = { 'http': proxies_protocol+'://127.0.0.1:8888', 'https': proxies_protocol+'://127.0.0.1:8888', }; proxies = system_proxies; if __name_...
test = { 'name': 'multiples_3', 'points': 1, 'suites': [ { 'cases': [ { 'code': r""" scm> (car multiples-of-three) 3 scm> (list? (cdr multiples-of-three)) ; Check to make sure variable contains a stream #f scm> (list? (cdr (cdr-stream m...
# # 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 Wed May 1 14:17:31 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...
# Collin Pearce 100% # performance O(log(n)) # all states with less tables than the optimal are correct states # all states with more tables than the optimal are incorrect states # therefore, the state space can be binary searched # mid represents the number of tables produced # pockets available are total_po...
""" Write a function that takes an unsigned integer and returns the number of 1 bits it has. Example: The 32-bit integer 11 has binary representation 00000000000000000000000000001011 so the function should return 3. Note that since Java does not have unsigned int, use long for Java """ class Solution: # @param...
class Solution: def countSubstrings(self, s: str) -> int: count = 0 for center in range(len(s)*2 - 1): left = center // 2 right = left + (center&1) while left >= 0 and right < len(s) and s[left] == s[right]: count += 1 left -= 1 ...
expected_output={ "interfaces": { "Tunnel100": { "autoroute_announce": "enabled", "src_ip": "Loopback0", "tunnel_bandwidth": 500, "tunnel_dst": "2.2.2.2", "tunnel_mode": "mpls traffic-eng", "tunnel_path_option": { "1": { "path_type": "dynamic" ...
def act(robot): val = robot.ir_sensor.read() if val == 1: robot.forward(200) if val == 2: robot.forward_right(200) if val == 3: robot.reverse_right(200) if val == 4 or val == 5: robot.reverse(200) if val == 6: robot.reverse_left(200) if val == 7: ...
""" Module for representing PredPatt and UDS graphs This module represents PredPatt and UDS graphs using networkx. It incorporates the dependency parse-based graphs from the syntax module as subgraphs. """
"""{{ cookiecutter.package_name }} - {{ cookiecutter.package_description }}""" __version__ = '{{ cookiecutter.package_version }}' __author__ = '{{ cookiecutter.author_name }} <{{ cookiecutter.author_email }}>' __all__ = []
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def hasCycle(self, head: ListNode) -> bool: while head: if not hasattr(head, 'flag'): head.flag = False ...
#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @File : spanish.py @Time : 2021/05/12 @Author : Frikilinux & JavierSC @Version : 2.1 @Contact : @Desc : ''' class LangSpanish(object): SETTING = "AJUSTES" VALUE = "VALORES" SETTING_DOWNLOAD_PATH = "Ruta de descarga" SE...
#!/usr/bin/env python # encoding: utf-8 class Solution: def singleNumber(self, nums: List[int]) -> int: # 0001 XOR 0000 = 0001 # a XOR 0 = a # a XOR a = 0 # a XOR b XOR a = a XOR a XOR b = b a = 0 for num in nums: a ^= num return a
def remove_all(input_string,to_be_removed): ''' removes all instance of a substring from a string ''' while(to_be_removed in input_string): input_string = ''.join(input_string.split(to_be_removed)) return(input_string) if __name__ == '__main__': print(remove_all('hello world','l'))
# 1. The format_address function separates out parts of the address string # into new strings: house_number and street_name, and returns: "house # number X on street named Y". The format of the input string is: numeric # house number, followed by the street name which may contain numbers, # but never by the...
x=list(input()) y=list(input()) x.reverse() y.reverse() updi=False a=max(x,y) b=min(x,y) out=[] for i in range(len(a)): tem1=int(a[i]) try: tem2=int(b[i]) pass except : tem2=0 tem=tem1+tem2 tem= tem+1 if updi else tem out.insert(0,str(tem%10)) updi= tem/10>=1 if updi and len(a)-1==i: out.insert(0,str(1)...
sns.catplot(data=density_mean, kind="bar", x='Bacterial_genotype', y='optical_density', hue='Phage_t', row="experiment_time_h", sharey=False, aspect=3, height=3, palette="colorblind")
"""matriz = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] print(matriz[0][0]) print(matriz[0][1]) print(matriz[0][2]) print(matriz[1][0]) print(matriz[1][1]) print(matriz[1][2]) print(matriz[2][0]) print(matriz[2][1]) print(matriz[2][2]) print(matriz[0][0] + matriz[0][1] + matriz[0][2] + matriz[1][0] + matriz[1][1] + matriz[1][2] ...
# -*- coding:utf-8 -*- """This module is used to test call stack""" # def greet(name): # print(name) # fun(name) # print('bye bye !!!') # bye() # # # def fun(name): # print('how are you', name) # # # def bye(): # print('good bye') # # # greet('feifei') def fact(x): if x == 1: retu...
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
class WolphinException(Exception): """ Base class for wolphin related exceptions """ def __init__(self, message=None): """ WolphinException constructor :param message: error message for the exception """ self.message = message def __str__(self): ret...
def sub( _str:str, _from:int, _to:int=None ) -> str: _to = _from + 1 if _to == None else _to return _str[_from:_to] def tostr( val, _hex:bool=False ) -> str: return str(val) if not _hex else str(hex(val)) def tonum( _str:str ) -> float or int: try: return int(_str) ...
# Invert Binary Tree: https://leetcode.com/problems/invert-binary-tree/ # Given the root of a binary tree, invert the tree, and return its root. # Okay this is another problem where we use a dfs solution except we should just be flipping as we go down # Basic solution class Solution: def invertTree(self, root): ...
class FloatMana: def __init__(self, content): pass
# Applied once at the beginning of the algorithm. INITIAL_PERMUTATION = [ 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8, 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3, 61, 53, 45, 37, 29, 21, 13, 5, ...
# -*- coding:utf-8 -*- # coding=<utf8> # Оперативная память ROM_form_factors = (('SIMM', 'SIMM'), ('DIMM', 'DIMM'), ('FB-DIMM', 'FB-DIMM'), ('SODIMM', 'SODIMM'), ('MicroDIMM', 'MicroDIMM'), ('RIMM', 'RIMM')) ROM_type=(('DDR', 'DDR'), ('DDR2', 'DDR2'), ('DDR3', 'DDR3'), ('RDRAM', 'RDRAM'), ('SDRAM', 'SDRAM')) ROM_firm...
ultimo = 10 fila = list(range(1,ultimo+1)) while True: print(f"Existem {len(fila)} clientes na fila") print(f"Fila atual: {fila}") print("Digite F para adicionar um cliente ao final da fila. ") print("ou A para realizar o atendimento. S para sair ") operacao = input("Operação (F, A ou S): ") if...
width = 5.3 height = 3.67 triangle_area = (width * height) / 2 print("Pole trójkąta wynosi {triangle_area} cm^2") print(f"Pole trójkąta wynosi {triangle_area} cm^2") print("Pole trójkąta wynosi", triangle_area, "cm^2")
# Ordered (indexing is allowed): List, Tuple # Unordered (indexing is not allowed): Dictionary, and Set # Mutable (can be changed after creation): List, Dictionary, and Set # Immutable ((can not be changed after creation)): Tuple, and Frozen Set # LIST: is a mutable data type i.e items can be added to list later afte...
# Style # Uncomment the following code, then # fix the style in this file so that it runs properly # and there are comments explaining the program """ print("Hello World!") print("This is a Python program") age = input("Enter your age: ") print("Your age is " + age) """
#!/usr/bin/env python # -*- coding: utf-8 -*- def isPalindrome(n): return str(n) == str(n)[::-1] ans = 0 for i in range(100, 1000): for j in range(i, 1000): if (isPalindrome(i * j)): ans = max(ans, i * j) print(ans)
# string/validacion.py """ Validar que una cadena de texto {@param str} cumpla un mínimo de caracteres {@param min_length} Ejemplo: validate_min_length("Hola mundo", 3) -> True """ def validate_min_length(str, min_length): if str is None: return False return len(str)>=min_length """ Validar que u...
print('Me de um valor e eu te darei o seu dobro, triplo e sua raiz quadrada') n = int(input('Digite um número')) dob = n * 2 tri = n * 3 sr = pow(n, (1/2)) print('O dobro de {} é {} \nO triplo de {} é {} \nA raiz quadrada de {} é {:.6f}'.format(n, dob, n, tri, n, sr))
def initialize_3d_list(a, b, c): """ :param a: :param b: :param c: :return: """ lst = [[[None for _ in range(c)] for _ in range(b)] for _ in range(a)] return lst
def ld_env_arg_spec(): return dict( environment_key=dict(type="str", required=True, aliases=["key"]), color=dict(type="str"), name=dict(type="str"), default_ttl=dict(type="int"), tags=dict(type="list", elements="str"), confirm_changes=dict(type="bool"), requir...
font24 = { 0xe6b094: [0x00,0x00,0x00,0x00,0x80,0x70,0x3C,0x2C,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, 0x20,0xA0,0x20,0x30,0x20,0x00,0x00,0x00,0x00,0x08,0x04,0x03,0x01,0x08,0x08,0x09, 0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0xFD,0x09,0x01,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00...
# Link : https://leetcode.com/problems/valid-palindrome-ii/submissions/ # Two pointer approach # TC : O(n) class Solution(object): def validPalindrome(self, s): """ :type s: str :rtype: bool """ # Use two pointers at the start and end of the string # To iterate ove...
#!/usr/bin/env python # encoding: utf-8 """ search_in_rotated_array_ii.py Created by Shengwei on 2014-07-24. """ # https://oj.leetcode.com/problems/search-in-rotated-sorted-array-ii/ # tags: medium / hard, array, search, rotated, edge cases """ Follow up for "Search in Rotated Sorted Array": What if duplicates are a...
# the Node class - contains value and address to next node class Node(object): def __init__(self, val): self.val = val self.next = None def get_data(self): return self.val def set_data(self, val): self.val = val def get_next(self): return self.next def set...
def color(val): if val < 60: r = 0 g = 255 b = 0 if val >= 60: r = ((val - 60) / 20) * 255 g = 255 b = 120 if val >= 80: r = 255 g = 255 - (((val - 80) / 20) * 255) b = 120 - (((val - 80) / 20) * 120) return 'rgb({},{},{})'.format(...
class Music: def __init__(self): self._ch0 = [] self._ch1 = [] self._ch2 = [] self._ch3 = [] @property def ch0(self): return self._ch0 @property def ch1(self): return self._ch1 @property def ch2(self): return self._ch2 @property...
def regularized_MSE_loss(output, target, weights=None, L2_penalty=0, L1_penalty=0): """loss function for MSE Args: output (torch.Tensor): output of network target (torch.Tensor): neural response network is trying to predict weights (torch.Tensor): fully-connected layer weights of network (net.out_layer...
""" An Autoencoder accepts input, compresses it, and recreates it. On the other hand, VAEs assume that the source data has some underlying distribution and attempts to find the distribution parameters. So, VAEs are similar to GANs (but note that GANs work differently, as we will see in the next tutorials). """;
""" Hill Pattern """ print("") n = 5 # Method 1 print("Method 1") for a in range(n): for b in range(a, n): print(" ", end="") for c in range(a + 1): print(" * ", end="") for d in range(a): print(" * ", end="") print("") print("\n*~*~*~*~*~*~*~*~*~*~*...
n,m = map(int, input().split()) width = m msg = "WELCOME" design = ".|." #upper piece lines = int((n-1)/2) count = 1 for i in range(1,lines+1): a = design*count print(a.center(width,'-')) count += 2 #center piece print(msg.center(width,'-')) #bottom piece count = n-2 for i in range(1,lines+1): a = des...
class Animal: def __init__(self, nombre, tamaño): self.nombre = nombre self.tamaño = tamaño def get_nombre(self): return self.nombre def set_nombre(self, a): self.nombre = a
def lambda_curry2(func): """ Returns a Curried version of a two-argument function FUNC. >>> from operator import add >>> curried_add = lambda_curry2(add) >>> add_three = curried_add(3) >>> add_three(5) 8 """ "*** YOUR CODE HERE ***" return ______ def compose1(f, g): """Retu...
def percent_str( expected, received ): received = received*100 output = int(received/expected) return str(output) + "%" def modsendall( to_socket, content, expected_msg_bytes): record = 0 single_attempt_size = 1024 while True: try: ret = to_socket.send( content[record:record...
def hey(phrase): phrase = phrase.strip() if not phrase: return "Fine. Be that way!" elif phrase.isupper(): return "Whoa, chill out!" elif phrase.endswith("?"): return "Sure." else: return 'Whatever.'
# -*- coding: utf-8 -*- config = [ { 'id': 1, 'rpcusername': "testuser", 'rpcpassword': "testnet", 'rpchost': "localhost", 'rpcport': "7000", 'name': 'Bitcoin (BTC)', 'symbol': "฿", 'currency': 'BTC', }, { 'id': 2, 'rpcusername'...
# Created by MechAviv # High Noon Damage Skin | (2438671) if sm.addDamageSkin(2438671): sm.chat("'High Noon Damage Skin' Damage Skin has been added to your account's damage skin collection.") sm.consumeItem()
# Copyright 2014 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompa...
async def is_guild_admin(self, guildid, userid): settings = self.database.get_settings(guildid) guild = await self.fetch_guild(guildid) user = await guild.fetch_member(userid) if user.id == 110838934644211712: return True # This is so i can test and help without server admin /shrug for role...
# game settings: RENDER_MODE = True REF_W = 24*2 REF_H = REF_W REF_U = 1.5 # ground height REF_WALL_WIDTH = 1.0 # wall width REF_WALL_HEIGHT = 5 PLAYER_SPEED_X = 10*1.75 PLAYER_SPEED_Y = 10*1.35 MAX_BALL_SPEED = 15*1.5 TIMESTEP = 1/30. NUDGE = 0.1 FRICTION = 1.0 # 1 means no FRICTION, less means FRICTION INIT_DELAY_F...
distancia = int(input('qual a distância da sua viagem em km?: ')) if distancia <= 200: valor = distancia * 0.50 else: valor = distancia * 0.45 print('você esta preste a iniciar uma viagem de {}Km.'.format(distancia)) print('e o preço de sua viagem sera de {}'.format(valor))
class Generator: def __init__(self): self.buffer = "" self.ident = 0 def push_ident(self): self.ident = self.ident + 1 def pop_ident(self): self.ident = self.ident - 1 def emit(self, *code): if (''.join(code) == ""): self.buffer += "\n" else...
""" Problem Statement: If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3,5,6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below N. """ def solution(n): """Returns the sum of all the multiples of 3 or 5 below n. >>> solution(3) 0 >...
''' Explain the operation of Lists and basic operations of lists ''' l = [5, 6, 7, 8] print(l) #prints the element in position 1, remembering that it starts 0 print(l[2]) # List size use len () function print(len(l)) l.append(10) print("New list after adding 10 at the end = " + str(l)) position, value = 0, 20 ...
# encoding: utf-8 # module _symtable # from (built-in) # by generator 1.145 # no doc # no imports # Variables with simple values CELL = 5 DEF_BOUND = 134 DEF_FREE = 32 DEF_FREE_CLASS = 64 DEF_GLOBAL = 1 DEF_IMPORT = 128 DEF_LOCAL = 2 DEF_PARAM = 4 FREE = 4 GLOBAL_EXPLICIT = 2 GLOBAL_IMPLICIT = 3 LOCAL = 1 SCOP...
# Write a function that takes in a graph # represented as a list of tuples # and return a list of nodes that # you would follow on an Eulerian Tour # # For example, if the input graph was # [(1, 2), (2, 3), (3, 1)] # A possible Eulerian tour would be [1, 2, 3, 1] def find_eulerian_tour(graph): a = 0 graph2 = ...
load("@io_bazel_rules_dotnet//dotnet/private:rules/nuget.bzl", "nuget_package") def dotnet_repositories_nunit(): ### Generated by the tool nuget_package( name = "nunit", package = "nunit", version = "3.12.0", sha256 = "62b67516a08951a20b12b02e5d20b5045edbb687c3aabe9170286ec5bb90...
target_num = int(input()) sum_nums = 0 while sum_nums < target_num: input_num = int(input()) sum_nums += input_num print(sum_nums)
class Solution: def minPathSum(self, grid: List[List[int]]) -> int: if len(grid) <= 0 or grid is None: return 0 rows = len(grid) cols = len(grid[0]) for r in range(rows): for c in range(cols): if r==0 and c==0: con...
def extractNovelsJapan(item): """ 'Novels Japan' """ if item['title'].endswith(' (Sponsored)'): item['title'] = item['title'][:-1 * len(' (Sponsored)')] if item['title'].endswith(' and Announcement'): item['title'] = item['title'][:-1 * len(' and Announcement')] vol, chp, frag, postfix = extractVolChapterFrag...
""" Asked by: Amazon [Medium] Given a string s and an integer k, break up the string into multiple lines such that each line has a length of k or less. You must break it up so that words don't break across lines. Each line has to have the maximum possible amount of words. If there's no way to break the text up, the...
n1=input() def OddEvenSum(n1): listNum=[] for j in range(0,len(n1)): listNum.append(int(n1[j])) oddSum=0; evenSum=0 for k in range(0,len(listNum)): if listNum[k]%2==0: evenSum+=listNum[k] else: oddSum+=listNum[k] print(f"Odd sum = {oddSum}, ...
# -*- coding: utf-8 -*- ''' Created on Aug-31-19 10:07:28 @author: hustcc/webhookit ''' # This means: # When get a webhook request from `repo_name` on branch `branch_name`, # will exec SCRIPT on servers config in the array. WEBHOOKIT_CONFIGURE = { # a web hook request can trigger multiple servers. 'repo_name...
""" This file is part of the TheLMA (THe Laboratory Management Application) project. See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information. Resource base classes. """ __docformat__ = "reStructuredText en" __all__ = ['RELATION_BASE_URL', ] RELATION_BASE_URL = 'http://relations.thelm...
test = { 'name': 'FooBar', 'points': 0, 'suites': [ { 'cases': [ { 'code': r""" >>> class Foo: ... def print_one(self): ... print('foo') ... def print_two(): ... print('foofoo') >>> f = Foo() ...
# generated from genmsg/cmake/pkg-genmsg.context.in messages_str = "/home/lachlan/catkin_ws/devel/share/fetchit_challenge/msg/SchunkMachineAction.msg;/home/lachlan/catkin_ws/devel/share/fetchit_challenge/msg/SchunkMachineActionGoal.msg;/home/lachlan/catkin_ws/devel/share/fetchit_challenge/msg/SchunkMachineActionResult...
''' Lab 0, Task 2. Archakov Vsevolod GitHub link: https://github.com/SevkavTV/Lab0_Task2.git ''' def validate_lst(element: list) -> bool: ''' Return True if element is valid and False in other case >>> validate_lst([1, 1]) False ''' for item in range(1, 10): if element.count(item) > 1:...
print('-='*10) print('{:=^20}'.format('Desafio 1 - BOOTCAMP')) print('-='*10) #idade idade=int(input('Qual a sua idade:')) n_id=idade+1 print('No ano que vem você terá {} anos. '.format(n_id)) print('-='*20) #area do triangulo lado_a=35 lado_b=14.333333 area=(lado_a)*(lado_b) print('O retângulo de lado A =%f e lado B...
si, sj = map(int, input().split()) T = [] for i in range(50): t = list(map(int, input().split())) T.append(t) P = [] for i in range(50): p = list(map(int, input().split())) P.append(p) chack = [[0] * 50 for i in range(50)] chack[si][sj] = -1 move = [(1, 0), (-1, 0), (0, 1), (0, -1)] for i, j in move:...
num = int(input('Digite um número: ')) dobro = num * 2 triplo = num * 3 raiz = num ** (1/2) print('O dobro de {} é igual a {}.'.format(num, dobro)) print('O triplo de {} é igual a {}.'.format(num, triplo)) print('A raiz quadrada de {} é igual a {:.2f}.'.format(num, raiz))
""" error models for pybugsnag """ class PyBugsnagException(Exception): """base pybugsnag exception class""" def __init__(self, *args, **kwargs): extra = "" if args: extra = '\n| extra info: "{extra}"'.format(extra=args[0]) print( "[{exception}]: {doc}{extra}"....