content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') googleapis_build_file = '\npackage(default_visibility = ["//visibility:public"])\n\nload("@com_google_protobuf//:protobuf.bzl", "cc_proto_library")\n\ncc_proto_library(\n name = "http_api_protos",\n srcs = [\n "google/api/annotations.prot...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def countNodes(self, root: TreeNode) -> int: if not root: return 0 queue = [roo...
class Solution: def count_nodes(self, root: TreeNode) -> int: if not root: return 0 queue = [root] count = 0 while queue: new_queue = [] for index in queue: if index.left: new_queue.append(index.left) ...
# Check for Prime Numbers check_prime = [26, 39, 51, 53, 57, 79, 85] # iterate through the check_prime list for num in check_prime: # search for factors, iterating through numbers ranging from 2 to the number itself for i in range(2, num): # number is not prime if modulo is 0 if (num % i) == 0: ...
check_prime = [26, 39, 51, 53, 57, 79, 85] for num in check_prime: for i in range(2, num): if num % i == 0: print('{} is NOT a prime number, because {} is a factor of {}'.format(num, i, num)) break if i == num - 1: print('{} IS a prime number'.format(num))
f=input('Enter file name: ') try: file=open(f,'r') except: print('File can not be opened: ',f) quit() print('File opened successfully!') file.close()
f = input('Enter file name: ') try: file = open(f, 'r') except: print('File can not be opened: ', f) quit() print('File opened successfully!') file.close()
count = 0 def tower(num , source , auxiliary , destination): global count if num == 1 : print("\nMove disk 1 from" , source , "to", destination ) # Base case count = count + 1 return tower(num-1 , source , destination , auxiliary) print("move disk" , num , "from" , source , "to" , destination) count = coun...
count = 0 def tower(num, source, auxiliary, destination): global count if num == 1: print('\nMove disk 1 from', source, 'to', destination) count = count + 1 return tower(num - 1, source, destination, auxiliary) print('move disk', num, 'from', source, 'to', destination) count...
def id_function(x): """ >>> id_function(10) 10 """ return x
def id_function(x): """ >>> id_function(10) 10 """ return x
class Player: """ A player. In addition to being a token that allows moves to happen, also has events that trigger on certain game states. """ def __init__(self, name, print_debug=False): self.name = name self.print_debug = print_debug def __str__(self): return self.na...
class Player: """ A player. In addition to being a token that allows moves to happen, also has events that trigger on certain game states. """ def __init__(self, name, print_debug=False): self.name = name self.print_debug = print_debug def __str__(self): return self.na...
def sudoku_printer(array): for i in range(len(array)): #print(i % 3 == 2) if (i % 3) != 0 or i == 0: print("%s %s %s|%s %s %s|%s %s %s|" % tuple(array[i])) else: print("-" * 18) print("%s %s %s|%s %s %s|%s %s %s|" % tuple(array[i]))
def sudoku_printer(array): for i in range(len(array)): if i % 3 != 0 or i == 0: print('%s %s %s|%s %s %s|%s %s %s|' % tuple(array[i])) else: print('-' * 18) print('%s %s %s|%s %s %s|%s %s %s|' % tuple(array[i]))
"""Globally defined colors for consistency in plots XKCD color reference: <https://xkcd.com/color/rgb/> Matplotlib list of named colors: <https://matplotlib.org/stable/gallery/color/named_colors.html> """ red = focal = 'tab:red' blue = visible = 'tab:blue' grey = occluded = invisible = 'xkcd:grey' lightgrey = shadow =...
"""Globally defined colors for consistency in plots XKCD color reference: <https://xkcd.com/color/rgb/> Matplotlib list of named colors: <https://matplotlib.org/stable/gallery/color/named_colors.html> """ red = focal = 'tab:red' blue = visible = 'tab:blue' grey = occluded = invisible = 'xkcd:grey' lightgrey = shadow = ...
construction_set = { 'type': 'ConstructionSetAbridged', 'name': 'Construction Set', 'wall_set': { 'type': 'WallSetAbridged', 'exterior_construction': 'Exterior Wall ASHRAE 2009' }, 'floor_set': { 'type': 'FloorSetAbridged', 'interior_construction': 'Internal Floor' ...
construction_set = {'type': 'ConstructionSetAbridged', 'name': 'Construction Set', 'wall_set': {'type': 'WallSetAbridged', 'exterior_construction': 'Exterior Wall ASHRAE 2009'}, 'floor_set': {'type': 'FloorSetAbridged', 'interior_construction': 'Internal Floor'}, 'roof_ceiling_set': {'type': 'RoofCeilingSetAbridged', '...
class Solution: def searchMatrix(self, matrix: List[List[int]], target: int) -> bool: if not matrix: return False row, col = len(matrix), len(matrix[0]) r, c = row - 1, 0 while r >= 0 and c < col: tmp = matrix[r][c] if tmp == target: ...
class Solution: def search_matrix(self, matrix: List[List[int]], target: int) -> bool: if not matrix: return False (row, col) = (len(matrix), len(matrix[0])) (r, c) = (row - 1, 0) while r >= 0 and c < col: tmp = matrix[r][c] if tmp == target: ...
#!/usr/bin/env python # encoding:utf8; """ * Author:ChenJun * Time:2020/12/24 * description: """ def start(): print("import successful") CRC_4_ITU = 'CRC-4/ITU' CRC_5_EPC = 'CRC-5/EPC' CRC_5_ITU = 'CRC-5/ITU' CRC_5_USB = 'CRC-5/USB' CRC_6_ITU = 'CRC-6/ITU' CRC_7_MMC = 'CRC-7/MMC' CRC_8 = 'CRC-8' CRC_8_...
""" * Author:ChenJun * Time:2020/12/24 * description: """ def start(): print('import successful') crc_4_itu = 'CRC-4/ITU' crc_5_epc = 'CRC-5/EPC' crc_5_itu = 'CRC-5/ITU' crc_5_usb = 'CRC-5/USB' crc_6_itu = 'CRC-6/ITU' crc_7_mmc = 'CRC-7/MMC' crc_8 = 'CRC-8' crc_8_itu = 'CRC-8/ITU' crc_8_rohc = 'CRC-8/R...
# https://codeforces.com/problemset/problem/1350/A t = int(input()) cases = [tuple(map(int, input().split())) for _ in range(t)] for case in cases: n, m = map(int, case) if n == 1 or m == 1: print('YES') elif n == 2 and m == 2: print('YES') else: print('NO')
t = int(input()) cases = [tuple(map(int, input().split())) for _ in range(t)] for case in cases: (n, m) = map(int, case) if n == 1 or m == 1: print('YES') elif n == 2 and m == 2: print('YES') else: print('NO')
# -*- coding: UTF-8 -*- __author__ = 'Ivan' # # class EmailGroupDao(): # # def get_all(self): # # return EmailGroup.query.all() # # # # class EmailTemplateDao(): # # def get(self,id): # # return EmailTemplate.query.get(id) # # def get_all(self): # return EmailTemplate.query.all(...
__author__ = 'Ivan'
# This is the class of the input root. Do not edit it. class BinaryTree: def __init__(self, value): self.value = value self.left = None self.right = None # O(n) time | O(n) space worst | O(log(n)) space average def TraverseBSTAndSumOne(node, sum_array, current_sum): current_sum += node....
class Binarytree: def __init__(self, value): self.value = value self.left = None self.right = None def traverse_bst_and_sum_one(node, sum_array, current_sum): current_sum += node.value if node.left is None and node.right is None: sum_array.append(current_sum) return...
def tag(): return select({ "//platforms:k8_cpu_jammy_opt": "amd64_22.04", "//platforms:aarch64_cpu_jammy_opt": "arm64_22.04", "//platforms:k8_cpu_jammy_dbg": "amd64_22.04_debug", "//platforms:aarch64_cpu_jammy_dbg": "arm64_22.04_debug", "//platforms:k8_cpu_focal_opt": "amd64_...
def tag(): return select({'//platforms:k8_cpu_jammy_opt': 'amd64_22.04', '//platforms:aarch64_cpu_jammy_opt': 'arm64_22.04', '//platforms:k8_cpu_jammy_dbg': 'amd64_22.04_debug', '//platforms:aarch64_cpu_jammy_dbg': 'arm64_22.04_debug', '//platforms:k8_cpu_focal_opt': 'amd64_20.04', '//platforms:aarch64_cpu_focal_op...
width = float(input("Width: ")) height = float(input("Height: ")) area = width * height print("Area: ",area)
width = float(input('Width: ')) height = float(input('Height: ')) area = width * height print('Area: ', area)
def action_handler_relation_action_popup(context, action, relation_type, to_entity_type, to_entity_id, **args): try: form_args = { 'to_entity_type' : to_entity_type, 'to_entity_id' : to_entity_id, 'relation_type' : relation_type, 'from_entity_type' : 'Nabar', 'from_entity_id' : context.nabar.id,...
def action_handler_relation_action_popup(context, action, relation_type, to_entity_type, to_entity_id, **args): try: form_args = {'to_entity_type': to_entity_type, 'to_entity_id': to_entity_id, 'relation_type': relation_type, 'from_entity_type': 'Nabar', 'from_entity_id': context.nabar.id} form = IN...
rows = 5 num = rows for i in range(rows, 0, -1): for j in range(0, i): print(num, end=' ') print("\r")
rows = 5 num = rows for i in range(rows, 0, -1): for j in range(0, i): print(num, end=' ') print('\r')
class Solution(object): def topKFrequent(self, nums, k): number_frequency = {} frequency_list = {} for i in nums: if i not in number_frequency: number_frequency[i] = 1 else: number_frequency[i] += 1 for key, value in number_freq...
class Solution(object): def top_k_frequent(self, nums, k): number_frequency = {} frequency_list = {} for i in nums: if i not in number_frequency: number_frequency[i] = 1 else: number_frequency[i] += 1 for (key, value) in number...
g = str(input("Informe seu sexo: [M/F] ")).strip().upper()[0] while g not in 'MF': g = str(input("Dado invalido,digite novamente:")).strip().upper()[0] #print("Ta maluco,pora?? repita") print('Registrado com sucesso,seu cisgenero')
g = str(input('Informe seu sexo: [M/F] ')).strip().upper()[0] while g not in 'MF': g = str(input('Dado invalido,digite novamente:')).strip().upper()[0] print('Registrado com sucesso,seu cisgenero')
# Copyright 2018-present Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
"""Provides file_alias macro.""" _default_visibility = ['PUBLIC'] def file_alias(name, source, visibility=None): """Exports a file from source in current package. This is useful for renaming files that are passed as resources. Args: name: output file name. source: path or label identifying th...
num, res = int(input('Enter N: ')), [] for i in range(num): temp = '' for j in input(): if not j in temp: temp += j res.append(temp) for x in res: print(x)
(num, res) = (int(input('Enter N: ')), []) for i in range(num): temp = '' for j in input(): if not j in temp: temp += j res.append(temp) for x in res: print(x)
""" A collection of JSON response schemes from http://Worldtimeapi.org """ class JsonScheme: """ Base JSON response scheme class. Use children instead. """ def __init__(self,**jsonObj): self._data = {} for key,item in jsonObj.items(): if isinstance(self,DateTimeJson): ...
""" A collection of JSON response schemes from http://Worldtimeapi.org """ class Jsonscheme: """ Base JSON response scheme class. Use children instead. """ def __init__(self, **jsonObj): self._data = {} for (key, item) in jsonObj.items(): if isinstance(self, DateTimeJs...
# -*- coding: utf-8 -*- def ClearChar(x): if x != "[" or x != "]" or x != "'" or x != ",": return False else: return True while True: a = [] try: nr = list(map(int, input().split())) b = list(map(int, input().split())) a = list(range(1, nr[0] + 1)) ...
def clear_char(x): if x != '[' or x != ']' or x != "'" or (x != ','): return False else: return True while True: a = [] try: nr = list(map(int, input().split())) b = list(map(int, input().split())) a = list(range(1, nr[0] + 1)) c = list(set(a) ^ set(b)) ...
routers = dict( BASE = dict(default_application='Rastema', default_controller='default'), )
routers = dict(BASE=dict(default_application='Rastema', default_controller='default'))
class SandboxError(Exception): pass class CompileError(SandboxError): pass class ExecuteError(SandboxError): def __init__(self, *args, **kwargs): if 'execution_log' in kwargs: self.execution_log = kwargs.pop('execution_log') super().__init__(*args, **kwargs)
class Sandboxerror(Exception): pass class Compileerror(SandboxError): pass class Executeerror(SandboxError): def __init__(self, *args, **kwargs): if 'execution_log' in kwargs: self.execution_log = kwargs.pop('execution_log') super().__init__(*args, **kwargs)
class AmbiguousStage(ValueError): pass class AmbiguousPlan(ValueError): pass
class Ambiguousstage(ValueError): pass class Ambiguousplan(ValueError): pass
#!/usr/bin/python # base class for building components class Component: # generate a new logic gate def __init__ (self, position=(0,0), stamp_off=None, stamp_on=None, inputs=[], outputs=[]): self.active = False self.position = position self.stamp_off = stamp_off self.stamp_on = stamp_on # [?] we...
class Component: def __init__(self, position=(0, 0), stamp_off=None, stamp_on=None, inputs=[], outputs=[]): self.active = False self.position = position self.stamp_off = stamp_off self.stamp_on = stamp_on self.outputs = [] for o in outputs: if not o in se...
# File: browserlessio_consts.py # # Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) # # Constants relating to '_get_error_message_from_exception' ERR_CODE_MSG = "Error code unavailable" ERR_MSG_UNAVAILABLE = "Error message unavailable. Please check the asset configuration and|or action para...
err_code_msg = 'Error code unavailable' err_msg_unavailable = 'Error message unavailable. Please check the asset configuration and|or action parameters' parse_err_msg = 'Unable to parse the error message. Please check the asset configuration and|or action parameters' type_err_msg = 'Error occurred while connecting to t...
#import numpy as np MIN_SIZE=-1 """This is the minimum size allowed!""" _pro_min_size=-2 __pri_min_size=-3 def mini(x, y): """ Take the max between two numbers **Parameters** > **x:** `float` -- Description of parameter `x`. > **y:** `float` -- Description of parameter `y`. **Returns** ...
min_size = -1 'This is the minimum size allowed!' _pro_min_size = -2 __pri_min_size = -3 def mini(x, y): """ Take the max between two numbers **Parameters** > **x:** `float` -- Description of parameter `x`. > **y:** `float` -- Description of parameter `y`. **Returns** > `float` -- Desc...
n = int(input()) string = '' for i in range(n): string += input() if string == string[::-1]: print("YES") else: print("NO")
n = int(input()) string = '' for i in range(n): string += input() if string == string[::-1]: print('YES') else: print('NO')
class DataNormalizer: def __init__(self): pass def normalize(self, data): return data
class Datanormalizer: def __init__(self): pass def normalize(self, data): return data
# # PySNMP MIB module Unisphere-Data-BGP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-BGP-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:30:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, constraints_union, constraints_intersection, value_size_constraint) ...
class Solution: # def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float: def findMedianSortedArrays(self, nums1, nums2) -> float: n = nums1 + nums2 n.sort() l = len(n) return n[l // 2] if l % 2 == 1 else (n[l // 2] + n[l // 2 - 1]) / 2 if __name__ == '__...
class Solution: def find_median_sorted_arrays(self, nums1, nums2) -> float: n = nums1 + nums2 n.sort() l = len(n) return n[l // 2] if l % 2 == 1 else (n[l // 2] + n[l // 2 - 1]) / 2 if __name__ == '__main__': ss = solution() n1 = [1, 3] n2 = [2, 4] cc = ss.findMedian...
courses = {} data = input().split(" : ") while "end" not in data: course = data[0] user = data[1] if course not in courses: courses[course] = [] courses[course].append(user) else: courses[course].append(user) data = input().split(" : ") courses = dict(sorted(courses.items...
courses = {} data = input().split(' : ') while 'end' not in data: course = data[0] user = data[1] if course not in courses: courses[course] = [] courses[course].append(user) else: courses[course].append(user) data = input().split(' : ') courses = dict(sorted(courses.items(), ...
# Dynamic typing: Create a variable and when values will be given to it, # then it will automatically know whether the value # given would be an int, float, or char or even a str. # Duck-typing != Dynamic typing: # Types: int, float, str, bytes # INTEGER # var_int = None # print(var_int) # print(type(var_int)) # var_i...
var_castable = 'Hello' var_castable = int(var_castable) print(var_castable) print(type(var_castable))
""" Copyright 2018 Jason Litzinger See LICENSE for details. """ class MQTTParseError(Exception): """Parse error""" class MQTTMoreDataNeededError(Exception): """Parse Error when more data is needed.""" class MQTTInvalidPacketError(Exception): """Invalid packet"""
""" Copyright 2018 Jason Litzinger See LICENSE for details. """ class Mqttparseerror(Exception): """Parse error""" class Mqttmoredataneedederror(Exception): """Parse Error when more data is needed.""" class Mqttinvalidpacketerror(Exception): """Invalid packet"""
class Solution: """ @param nums: the given array @param s: the given target @return: the number of ways to assign symbols to make sum of integers equal to target S """ def findTargetSumWays(self, nums, s): val_cnts = self.dfs(nums, s, 0) if s not in val_cnts: return 0...
class Solution: """ @param nums: the given array @param s: the given target @return: the number of ways to assign symbols to make sum of integers equal to target S """ def find_target_sum_ways(self, nums, s): val_cnts = self.dfs(nums, s, 0) if s not in val_cnts: retu...
# defined by force, span (tuple with start and end point) # and angle of force load_1 = UDL(force=1000, span=(1,2), angle = 0) load_2 = UDL(force=1000, span=(3,4), angle = 45) load_3 = UDL(force=1000, span=(5,6), angle = 90) # Plotting the loads beam = Beam(7) beam.add_loads( load_1, load_2, load_3 ) fig...
load_1 = udl(force=1000, span=(1, 2), angle=0) load_2 = udl(force=1000, span=(3, 4), angle=45) load_3 = udl(force=1000, span=(5, 6), angle=90) beam = beam(7) beam.add_loads(load_1, load_2, load_3) fig = beam.plot_beam_diagram() fig.show()
#!/usr/bin/env python """Representation of the Ackermann function in python. Caleb Levy, 2014. """ def Ackermann(m, n): if m == 0: return n+1 elif m > 0 and n == 0: return Ackermann(m-1, 1) elif m > 0 and n > 0: return Ackermann(m-1, Ackermann(m, n-1)) if __name__ == '__main__'...
"""Representation of the Ackermann function in python. Caleb Levy, 2014. """ def ackermann(m, n): if m == 0: return n + 1 elif m > 0 and n == 0: return ackermann(m - 1, 1) elif m > 0 and n > 0: return ackermann(m - 1, ackermann(m, n - 1)) if __name__ == '__main__': assert acker...
""" Extraer el ID host del router """ bandera = 0 archivo = open("show_ip_route.txt", "r") while bandera != 1: cadena = archivo.readline() posicion = cadena.find("#") if posicion >= 0: bandera = 1 cadena_final = cadena archivo.close() print ("P: %d " % posicion) print (cadena_final) hostnam...
""" Extraer el ID host del router """ bandera = 0 archivo = open('show_ip_route.txt', 'r') while bandera != 1: cadena = archivo.readline() posicion = cadena.find('#') if posicion >= 0: bandera = 1 cadena_final = cadena archivo.close() print('P: %d ' % posicion) print(cadena_final) hostname =...
# # PySNMP MIB module TERMINAL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TERMINAL-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:08:48 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019,...
(terminal_mgmt,) = mibBuilder.importSymbols('APENT-MIB', 'terminalMgmt') (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersect...
# Python program to count Even # and Odd numbers in a List # list of numbers list1 = [1,2,3,4,5,6,7,8,9] even_count, odd_count = 0, 0 # iterating each number in list for num in list1: # checking condition if num % 2 == 0: even_count += 1 else: odd_...
list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9] (even_count, odd_count) = (0, 0) for num in list1: if num % 2 == 0: even_count += 1 else: odd_count += 1 print('Even numbers in the list: ', even_count) print('Odd numbers in the list: ', odd_count)
N = int(input()) p = list(map(int, input().split())) z = 0 for i in range(N): if p[i] != i + 1: z += 1 if z <= 2: print('YES') else: print('NO')
n = int(input()) p = list(map(int, input().split())) z = 0 for i in range(N): if p[i] != i + 1: z += 1 if z <= 2: print('YES') else: print('NO')
class InvalidWordErr(Exception): def __init__(self,message="Invalid Word"): self.message = message super().__init__(self.message) class TargetNotFoundErr(Exception): def __init__(self,message="Target not found"): self.message = message super().__init__(self.message)
class Invalidworderr(Exception): def __init__(self, message='Invalid Word'): self.message = message super().__init__(self.message) class Targetnotfounderr(Exception): def __init__(self, message='Target not found'): self.message = message super().__init__(self.message)
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: ans = 0 def height(self, root): if not root: return 0 left = self.height(r...
class Solution: ans = 0 def height(self, root): if not root: return 0 left = self.height(root.left) right = self.height(root.right) self.ans = max(self.ans, right + left) return 1 + max(left, right) def diameter_of_binary_tree(self, root: TreeNode) -> in...
# # PySNMP MIB module OLD-CISCO-MEMORY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/OLD-CISCO-MEMORY-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:32:47 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection, constraints_union) ...
# Ardin (2101003) | The Town of Ariant (260000200) duel = 3933 backStreet = 926000000 if sm.hasQuest(duel): response = sm.sendAskYesNo("Are you ready to fight my other self?") if response: sm.sendNext("Good. I like your confidence.") sm.warpInstanceIn(backStreet, False) else: sm.se...
duel = 3933 back_street = 926000000 if sm.hasQuest(duel): response = sm.sendAskYesNo('Are you ready to fight my other self?') if response: sm.sendNext('Good. I like your confidence.') sm.warpInstanceIn(backStreet, False) else: sm.sendSayOkay("Remember, you can't become a member of th...
with open('text', 'r') as s: count=0 for i in s: line=i.split() b,e=line[0].split('-') if int(b) <= line[2].count(line[1][0]) <= int(e): count+=1 print(count) with open('text', 'r') as s: count=0 for i in s: line=i.split() b,e=line[0].split...
with open('text', 'r') as s: count = 0 for i in s: line = i.split() (b, e) = line[0].split('-') if int(b) <= line[2].count(line[1][0]) <= int(e): count += 1 print(count) with open('text', 'r') as s: count = 0 for i in s: line = i.split() (b, e) = l...
def wears_jacket_with_if(temp,raining): if temp<= 60 or raining: return True else: return False def wears_jacket(temp,raining): return temp<=60 or raining def is_prime(n): if n == 1: return False else: num = n-1 flag = True while num!=1: ...
def wears_jacket_with_if(temp, raining): if temp <= 60 or raining: return True else: return False def wears_jacket(temp, raining): return temp <= 60 or raining def is_prime(n): if n == 1: return False else: num = n - 1 flag = True while num != 1: ...
TRADE = { 'access': 'trade_pub_key', 'secret': 'trade_pri_key' } CASHIER = { 'access': 'trade_pub_key', 'secret': 'trade_pub_key' }
trade = {'access': 'trade_pub_key', 'secret': 'trade_pri_key'} cashier = {'access': 'trade_pub_key', 'secret': 'trade_pub_key'}
class Node(): def __init__(self,value='',left=None,right=None): self.value = value self.left = left self.right = right self.next = None def __str__(self): return str(self.value) class BinaryTree(): def __init__(self, node=None): self.root = node # CC15 def pre_order(self)...
class Node: def __init__(self, value='', left=None, right=None): self.value = value self.left = left self.right = right self.next = None def __str__(self): return str(self.value) class Binarytree: def __init__(self, node=None): self.root = node def pr...
# model settings model = dict( type='SimMIM', backbone=dict( type='MIMResNet', depth=50, mask_layer=0, mask_token='learnable', num_stages=4, out_indices=(3,), # no conv-1, x-1: stage-x norm_cfg=dict(type='SyncBN'), style='pytorch'), neck=dict(type='Si...
model = dict(type='SimMIM', backbone=dict(type='MIMResNet', depth=50, mask_layer=0, mask_token='learnable', num_stages=4, out_indices=(3,), norm_cfg=dict(type='SyncBN'), style='pytorch'), neck=dict(type='SimMIMNeck', in_channels=2048, encoder_stride=32), head=dict(type='SimMIMHead', encoder_in_channels=3))
class Session: def __init__(self, uid: int, current_dir, id: int) -> None: """ A open shell session in a given `Computer` Args: uid (int): The UID of the user logging in to the given `Session` current_dir (Directory): The current directory that the user is interacting...
class Session: def __init__(self, uid: int, current_dir, id: int) -> None: """ A open shell session in a given `Computer` Args: uid (int): The UID of the user logging in to the given `Session` current_dir (Directory): The current directory that the user is interactin...
#!/usr/bin/env python # vim: set fileencoding=utf-8 : # Tiago de Freitas Pereira <tiago.pereira@idiap.ch> """SGE QUEUES""" QUEUE_DEFAULT = { "default": { "queue": "q_1day", "memory": "8GB", "io_big": False, "resource_spec": "", "max_jobs": 128, "resources": {"default...
"""SGE QUEUES""" queue_default = {'default': {'queue': 'q_1day', 'memory': '8GB', 'io_big': False, 'resource_spec': '', 'max_jobs': 128, 'resources': {'default': 1}}, 'q_1week': {'queue': 'q_1week', 'memory': '4GB', 'io_big': True, 'resource_spec': '', 'max_jobs': 24, 'resources': {'q_1week': 1}}, 'q_long_gpu': {'queue...
''' Your function should take in a single parameter (a string `word`) Your function should return a count of how many occurences of ***"th"*** occur within `word`. Case matters. Your function must utilize recursion. It cannot contain any loops. ''' ''' Your function should take in a single parameter (a string `word`) Y...
""" Your function should take in a single parameter (a string `word`) Your function should return a count of how many occurences of ***"th"*** occur within `word`. Case matters. Your function must utilize recursion. It cannot contain any loops. """ '\nYour function should take in a single parameter (a string `word`)\nY...
class A: def f(self): pass class B(A): def f(self): super().f()
class A: def f(self): pass class B(A): def f(self): super().f()
#!/usr/bin/env python # -*- coding:utf-8 -*- #business name db_info = 'testdb' # mysql connect info my_ip = '1.1.3.111' my_usr = 'compare' my_pass = 'ZAQ_xsw2' my_port = 3306 my_db = 'otpstest' #os info os_data_ip = '1.1.3.200' os_user = 'oracle' os_pass = 'oracle22222' # oracle connect info ora_ip = '1.1.3.200' ora_us...
db_info = 'testdb' my_ip = '1.1.3.111' my_usr = 'compare' my_pass = 'ZAQ_xsw2' my_port = 3306 my_db = 'otpstest' os_data_ip = '1.1.3.200' os_user = 'oracle' os_pass = 'oracle22222' ora_ip = '1.1.3.200' ora_usr = 'sys' ora_pass = 'bigbangdata.cn' ora_port = 1521 ora_srvname = 'orcl' o_directory_name = 'soe_dir' o_direct...
# # PySNMP MIB module Wellfleet-LLC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-LLC-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:40:48 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, single_value_constraint, value_size_constraint, constraints_union, value_range_constraint) ...
f = True o = True x = True y = True p = False p1 = False k = False k1 = False g = False g1 = False m = False m1 = False t = False t1 = False while f: while o: try: weight = int(input("weight :=> ")) o = False except ValueError: print("type an integer") ...
f = True o = True x = True y = True p = False p1 = False k = False k1 = False g = False g1 = False m = False m1 = False t = False t1 = False while f: while o: try: weight = int(input('weight :=> ')) o = False except ValueError: print('type an integer') ...
# -*- coding: utf-8 -*- value1 = input() value2 = input() mult = value1*value2 print("PROD = %d" %mult)
value1 = input() value2 = input() mult = value1 * value2 print('PROD = %d' % mult)
species( label = 'C4rad(5)', structure = SMILES('[CH2]CCC'), E0 = (63.0573,'kJ/mol'), modes = [ HarmonicOscillator(frequencies=([2750,2783.33,2816.67,2850,1425,1450,1225,1275,1270,1340,700,800,300,400,2750,2800,2850,1350,1500,750,1050,1375,1000,3000,3100,440,815,1455,1000,180],'cm^-1')), ...
species(label='C4rad(5)', structure=smiles('[CH2]CCC'), E0=(63.0573, 'kJ/mol'), modes=[harmonic_oscillator(frequencies=([2750, 2783.33, 2816.67, 2850, 1425, 1450, 1225, 1275, 1270, 1340, 700, 800, 300, 400, 2750, 2800, 2850, 1350, 1500, 750, 1050, 1375, 1000, 3000, 3100, 440, 815, 1455, 1000, 180], 'cm^-1')), hindered_...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Sep 14 13:25:26 2020 @author: hamishgibbs """
""" Created on Mon Sep 14 13:25:26 2020 @author: hamishgibbs """
# by Kami Bigdely # Consolidate duplicate conditional fragments class Drink: def __init__(self): self._mix = [] @property def mix(self): return self._mix @mix.setter def mix(self, addons): if len(self.mix) > 1: print(f'mixed {self.mix} with {addons}') se...
class Drink: def __init__(self): self._mix = [] @property def mix(self): return self._mix @mix.setter def mix(self, addons): if len(self.mix) > 1: print(f'mixed {self.mix} with {addons}') self._mix.extend(addons) class Menu(Drink): def __init__(se...
# THIS FILE IS GENERATED FROM SIGPROFILERSIMULATOR SETUP.PY short_version = '1.1.3' version = '1.1.3'
short_version = '1.1.3' version = '1.1.3'
num=int(input("enter the number")) i=1 fact=1 while(i<=num): fact=fact*i i = i + 1 print(fact)
num = int(input('enter the number')) i = 1 fact = 1 while i <= num: fact = fact * i i = i + 1 print(fact)
# Databricks notebook source print('I love Azure Databricks') # COMMAND ---------- # MAGIC %scala # MAGIC println("I Love Azure Databricks") # COMMAND ---------- # MAGIC %sql # MAGIC SELECT "I Love Azure Databricks" as message # COMMAND ---------- # MAGIC %md # MAGIC This is my first notebook using the magic comm...
print('I love Azure Databricks')
class Config(object): DEBUG = False TESTING = False PRODUCTION = False LOGGING_LEVEL = "ERROR" LOGGING_FORMAT = '%(asctime)s - %(levelname)-7s - %(module)s:%(filename)s:%(lineno)d - %(message)s' COUNTRY_LOCATION_ID = 1 class Production(Config): PRODUCTION = True class Development(Conf...
class Config(object): debug = False testing = False production = False logging_level = 'ERROR' logging_format = '%(asctime)s - %(levelname)-7s - %(module)s:%(filename)s:%(lineno)d - %(message)s' country_location_id = 1 class Production(Config): production = True class Development(Config): ...
# Eingabe print("Geben Sie Ihr Bruttogehalt in Euro ein:") brutto = float(input()) # Berechnung if brutto > 2500: steuer = brutto * 0.22 else: steuer = brutto * 0.18 # Ausgabe print("Es ergibt sich ein Steuerbetrag von", steuer, "Euro")
print('Geben Sie Ihr Bruttogehalt in Euro ein:') brutto = float(input()) if brutto > 2500: steuer = brutto * 0.22 else: steuer = brutto * 0.18 print('Es ergibt sich ein Steuerbetrag von', steuer, 'Euro')
# keywords MEMORY = 'memory' SOURCE = 'source' FILE_TYPE = 'file_type' FILE_NAME = 'file_name' FILE_STREAM = 'file_stream' SESSION = 'session' TABLE = 'table' MODEL = 'model' TABLES = 'tables' MODELS = 'models' DEPRECATED_CONTENT = 'content' FILE_CONTENT = 'file_content' ADICT = 'adict' RECORDS = 'records...
memory = 'memory' source = 'source' file_type = 'file_type' file_name = 'file_name' file_stream = 'file_stream' session = 'session' table = 'table' model = 'model' tables = 'tables' models = 'models' deprecated_content = 'content' file_content = 'file_content' adict = 'adict' records = 'records' array = 'array' column_...
##To print the below pattern ## * ## # # ## * # * ## # * * * def pattern_generator(end_point): #counter = 1 for i in range(1, end_point+1): symbol = '#' if (i == 2 or i == 3 or i == 5 or i == 7) else '*' print(symbol, end='') if (i == 1 or i == 3 or i == 6): print('\r') if ...
def pattern_generator(end_point): for i in range(1, end_point + 1): symbol = '#' if i == 2 or i == 3 or i == 5 or (i == 7) else '*' print(symbol, end='') if i == 1 or i == 3 or i == 6: print('\r') if __name__ == '__main__': pattern_generator(10)
# For this fantasy planet, the following is "hard canon". # * Orbital period = exactly 365 days # * The planet reaches periapsis at 00:00am Jan 1 each year # (which I *think automatically means...) # --> Argument of Periapsis = 270 degrees (it reaches periapsis at the southernmost point from the plane o...
eccentricity = 0.032 sm_axis = 149539307 inclination = -4.5 peri_arg = 270 long_asc_node = 0 print() print('Calculating apsides... ') apoapsis = sm_axis * (1 + ECCENTRICITY) periapsis = sm_axis * (1 - ECCENTRICITY) print("The Keplerian elements of the planet's orbit (from a heliocentric reference point) are:") print(f'...
# Definition for a binary tree node # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class BSTIterator(object): def appendToCache(self, cache, branches, curr): while curr: cache.append(curr.val) if ...
class Bstiterator(object): def append_to_cache(self, cache, branches, curr): while curr: cache.append(curr.val) if curr.right: branches.append(curr) curr = curr.left def __init__(self, root): """ :type root: TreeNode """ ...
""" Multiply any two numbers by: 1. taking the individual digits out using division and mod 2. performing partial multiplication and multiplying by 10**n-1 where n is the total length of the number string; 3. adding all product outputs. """ def partial_shift_multiply(target, num): """ A typical...
""" Multiply any two numbers by: 1. taking the individual digits out using division and mod 2. performing partial multiplication and multiplying by 10**n-1 where n is the total length of the number string; 3. adding all product outputs. """ def partial_shift_multiply(target, num): """ A typical...
t = int(input()) for i in range(t): base=int(input()) n = base//2 n = n-1 sq=(n*(n+1))//2 print(sq)
t = int(input()) for i in range(t): base = int(input()) n = base // 2 n = n - 1 sq = n * (n + 1) // 2 print(sq)
__author__ = 'Vladimir Ivanov' __copyright__ = 'Copyright 2020, Raw-packet Project' __credits__ = [''] __license__ = 'MIT' __version__ = '0.2.1' __maintainer__ = 'Vladimir Ivanov' __email__ = 'ivanov.vladimir.mail@gmail.com' __status__ = 'Development'
__author__ = 'Vladimir Ivanov' __copyright__ = 'Copyright 2020, Raw-packet Project' __credits__ = [''] __license__ = 'MIT' __version__ = '0.2.1' __maintainer__ = 'Vladimir Ivanov' __email__ = 'ivanov.vladimir.mail@gmail.com' __status__ = 'Development'
# Default production config DEBUG = True TEAM_COUNT = 20 # MongoDB MONGODB_SETTINGS = { 'db': "fpc2017", # "project" 'host': "localhost", # "127.0.0.1" 'port': 27017, # 27017 # 'username': "None", # 'username' # 'password': None, # 'passwd' } # ReCaptcha RECAPTCHA_ENABLED = False RECAPTCHA_SITE_KEY = '6Leyx...
debug = True team_count = 20 mongodb_settings = {'db': 'fpc2017', 'host': 'localhost', 'port': 27017} recaptcha_enabled = False recaptcha_site_key = '6LeyxBQUAAAAAHBpG2htNplW1qjcgODp47P6FHuE' recaptcha_secret_key = '' mail_server = 'mail2.cs.fsu.edu' mail_port = 587 mail_use_tls = True mail_use_ssl = False mail_default...
#!/usr/bin/env python3 """ A popular word game in which without reading the story you have to substitute some words. The program reads in a text file and lets the user replace word ADJECTIVE, NOUN, ADVERB or VERB with their own text. """ def mad_libs(filename): with open(filename, 'r') as file: filedata = file.rea...
""" A popular word game in which without reading the story you have to substitute some words. The program reads in a text file and lets the user replace word ADJECTIVE, NOUN, ADVERB or VERB with their own text. """ def mad_libs(filename): with open(filename, 'r') as file: filedata = file.read() for wor...
# -*- coding: utf-8 -*- t = int(input()) for _ in range(t): d = {} m, n = map(int, input().split()) for _ in range(m): w = input() d[w] = input() for _ in range(n): ly = input().split() ln = '' for i in range(len(ly)): if ly[i] in d.keys(...
t = int(input()) for _ in range(t): d = {} (m, n) = map(int, input().split()) for _ in range(m): w = input() d[w] = input() for _ in range(n): ly = input().split() ln = '' for i in range(len(ly)): if ly[i] in d.keys(): if i != 0: ...
# Problem: Find Median from Data Stream def findMedian(stream): # print(stream) streamSize = len(stream) if streamSize == 1: return stream[0] else: stream = sorted(stream) midPt = streamSize // 2 if streamSize % 2 == 1: return stream[midPt] else: return (stream[midPt] + stream...
def find_median(stream): stream_size = len(stream) if streamSize == 1: return stream[0] else: stream = sorted(stream) mid_pt = streamSize // 2 if streamSize % 2 == 1: return stream[midPt] else: return (stream[midPt] + stream[midPt - 1]) // 2 d...
class LearnerParams: """ Defines the fields used to set halton space that is used for generating halton samples """ def __init__( self, eps=0.1, lr=0.8, y=0.9, num_episodes=200, num_steps=100, observation_space=1000, columns=["UserId",...
class Learnerparams: """ Defines the fields used to set halton space that is used for generating halton samples """ def __init__(self, eps=0.1, lr=0.8, y=0.9, num_episodes=200, num_steps=100, observation_space=1000, columns=['UserId', 'Role', 'Usage'], MAXNODELEN=30): self.eps = eps ...
for _t in range(int(input())): N, S = map(int,input().split()) steps = input() #print(N,S,steps) pos = [S] cnt = 1 for x in steps: if(x == 'R'): step = 1 else: step = -1 S += step if S not in pos: pos.ap...
for _t in range(int(input())): (n, s) = map(int, input().split()) steps = input() pos = [S] cnt = 1 for x in steps: if x == 'R': step = 1 else: step = -1 s += step if S not in pos: pos.append(S) cnt += 1 print(cnt)
j = 7 for a in range(1, 10, 2): print("I={} J={}".format(a, j)) print("I={} J={}".format(a, j-1)) print("I={} J={}".format(a, j-2)) j += 2
j = 7 for a in range(1, 10, 2): print('I={} J={}'.format(a, j)) print('I={} J={}'.format(a, j - 1)) print('I={} J={}'.format(a, j - 2)) j += 2
""" Given a sorted linked list, delete all duplicates such that each element appear only once. Example: Input: 1->1->2->3->3 Output: 1->2->3 """ #Difficulty: Easy #165 / 165 test cases passed. #Runtime: 40 ms #Memory Usage: 13.9 MB #Runtime: 40 ms, faster than 87.68% of Python3 online submissions...
""" Given a sorted linked list, delete all duplicates such that each element appear only once. Example: Input: 1->1->2->3->3 Output: 1->2->3 """ class Solution: def delete_duplicates(self, head: ListNode) -> ListNode: if not head: return prev = head curr =...
class UI: def __init__(self, screen): self._screen = screen self._screen.setup(600, 600) self._screen.title("Turtle Crossing") self._screen.tracer(0) # PUBLIC METHODS def update(self): self._screen.update() def listen(self): self._screen.listen() d...
class Ui: def __init__(self, screen): self._screen = screen self._screen.setup(600, 600) self._screen.title('Turtle Crossing') self._screen.tracer(0) def update(self): self._screen.update() def listen(self): self._screen.listen() def onkey(self, fn, ke...
# Time: O(nlogn) # Space: O(1) class Solution(object): def reductionOperations(self, nums): """ :type nums: List[int] :rtype: int """ nums.sort() result = curr = 0 for i in xrange(1, len(nums)): if nums[i-1] < nums[i]: curr += 1 ...
class Solution(object): def reduction_operations(self, nums): """ :type nums: List[int] :rtype: int """ nums.sort() result = curr = 0 for i in xrange(1, len(nums)): if nums[i - 1] < nums[i]: curr += 1 result += curr ...
"""Dummy helper methods invoked in other constructors.""" def GenerateMachineName(prefix, suffix): """Generates name of a VM.""" return prefix + "-" + suffix
"""Dummy helper methods invoked in other constructors.""" def generate_machine_name(prefix, suffix): """Generates name of a VM.""" return prefix + '-' + suffix
# The sum of all numbers from 1 upto # that input natural number n def sum_N_Numbers (n): if n == 1: return 1 # Write code here return n + sum_N_Numbers(n-1)
def sum_n__numbers(n): if n == 1: return 1 return n + sum_n__numbers(n - 1)
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- ''' @File : types.py @Author : alexander.here@gmail.com @Date : 2020-01-13 18:36 @Brief : ''' # type() function: print( type( 1), type( 1.2), type( 'hello'), type( ( 1, 2, 3)), type( [ 1, 2, 3]), type( { 1, 2, 3}), type( { 1:2, 3:4})) # ...
""" @File : types.py @Author : alexander.here@gmail.com @Date : 2020-01-13 18:36 @Brief : """ print(type(1), type(1.2), type('hello'), type((1, 2, 3)), type([1, 2, 3]), type({1, 2, 3}), type({1: 2, 3: 4})) print(int, float, str, tuple, list, set, dict) print(None, type(None), type(type(None))) my_type ...
class DfuStatus: OK = 0x00 ERROR_TARGET = 0x01 ERROR_FILE = 0x02 ERROR_WRITE = 0x03 ERROR_ERASE = 0x04 ERROR_CHECK_ERASED = 0x05 ERROR_PROG = 0x06 ERROR_VERIFY = 0x07 ERROR_ADDRESS = 0x08 ERROR_NOTDONE = 0x09 ...
class Dfustatus: ok = 0 error_target = 1 error_file = 2 error_write = 3 error_erase = 4 error_check_erased = 5 error_prog = 6 error_verify = 7 error_address = 8 error_notdone = 9 error_firmware = 10 error_vendor = 11 error_usbr = 12 error_por = 13 error_unknow...
list_of_items = input().split("|") budget = float(input()) initial_money = budget profit = 0 for i in range(len(list_of_items)): product_characteristics = list_of_items[i].split("->") type1 = product_characteristics[0] value = float(product_characteristics[1]) new_price = 0 if value > bud...
list_of_items = input().split('|') budget = float(input()) initial_money = budget profit = 0 for i in range(len(list_of_items)): product_characteristics = list_of_items[i].split('->') type1 = product_characteristics[0] value = float(product_characteristics[1]) new_price = 0 if value > budget: ...
def init_n(d): n = 1 while True: if n * n > d: return n - 1 n += 1 def main(x, y): d = y - x if d <= 2: return d n = init_n(d) remain_d = d - (n * n) if remain_d == 0: return n + (n - 1) if remain_d % n == 0: return n + (n - 1)...
def init_n(d): n = 1 while True: if n * n > d: return n - 1 n += 1 def main(x, y): d = y - x if d <= 2: return d n = init_n(d) remain_d = d - n * n if remain_d == 0: return n + (n - 1) if remain_d % n == 0: return n + (n - 1) + remain_...
if __name__ == '__main__': i=input("your age:") age=int(i) if age<3: print('child') elif age>3 and age<30: print('adult') else: print('man')
if __name__ == '__main__': i = input('your age:') age = int(i) if age < 3: print('child') elif age > 3 and age < 30: print('adult') else: print('man')
# -*- coding: utf-8 -*- """Job Args""" class Args: """Job Args""" def __init__(self, parser): """Initialize class properties.""" parser.add_argument('--tc_owner', required=True) parser.add_argument('--rating', required=True, default=3) parser.add_argument('--confidence', requi...
"""Job Args""" class Args: """Job Args""" def __init__(self, parser): """Initialize class properties.""" parser.add_argument('--tc_owner', required=True) parser.add_argument('--rating', required=True, default=3) parser.add_argument('--confidence', required=True, default=45) ...
result = ('tuple',) + 'string' ''' Traceback (most recent call last): File "exceptions_TypeError.py", line 12, in <module> result = ('tuple',) + 'string' TypeError: can only concatenate tuple (not "str") to tuple '''
result = ('tuple',) + 'string' '\nTraceback (most recent call last):\n File "exceptions_TypeError.py", line 12, in <module>\n result = (\'tuple\',) + \'string\'\nTypeError: can only concatenate tuple (not "str") to tuple\n'
hrs = input("Enter Hours:") rate = input("Enter Rate:") try: h = float(hrs) r = float(rate) except: print("Error, please enter numeric input") quit() if h>40: pay = 40 * r + (h - 40) * 1.5 * r else: pay = h * r print(pay)
hrs = input('Enter Hours:') rate = input('Enter Rate:') try: h = float(hrs) r = float(rate) except: print('Error, please enter numeric input') quit() if h > 40: pay = 40 * r + (h - 40) * 1.5 * r else: pay = h * r print(pay)
class Solution: def numPairsDivisibleBy60(self, time: List[int]) -> int: remainders = collections.defaultdict(int) count = 0 for t in time: if t % 60 == 0: # check if a%60==0 && b%60==0 count += remainders[0] else: # che...
class Solution: def num_pairs_divisible_by60(self, time: List[int]) -> int: remainders = collections.defaultdict(int) count = 0 for t in time: if t % 60 == 0: count += remainders[0] else: count += remainders[60 - t % 60] re...
__AUTHOR__ = "Dipankar Pal" __EMAIL__ = "dipankarpal5050@gmail.com" __WEBSITE__ = "deep5050.github.io" # def get_version(): # return __VERSION__ # if __name__ == "__main__": # get_version()
__author__ = 'Dipankar Pal' __email__ = 'dipankarpal5050@gmail.com' __website__ = 'deep5050.github.io'
#!/usr/bin/env python # -*- coding: utf-8 -*- def windplot(t, windv, pos=5, angle=0.0, color='k'): """Computes angle of arrows based on wind direction. t : arr time position (inform as integers values. Datatime will be processed in the near future) windv : arr Wind Velocity. ang...
def windplot(t, windv, pos=5, angle=0.0, color='k'): """Computes angle of arrows based on wind direction. t : arr time position (inform as integers values. Datatime will be processed in the near future) windv : arr Wind Velocity. angle : arr Wind direction. """ dx...