content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def get_max_index(arr, i, j): index = None maximum = -float('inf') for x in range(i, j + 1): if arr[x] >= maximum: maximum = arr[x] index = x return index def solve(n): string = str(n) digits = list(map(int, string)) for i in range(len(digits)): max...
def get_max_index(arr, i, j): index = None maximum = -float('inf') for x in range(i, j + 1): if arr[x] >= maximum: maximum = arr[x] index = x return index def solve(n): string = str(n) digits = list(map(int, string)) for i in range(len(digits)): max_i...
caps = [chr(x) for x in range(ord('A'), ord('Z') + 1)] lower = [chr(x) for x in range(ord('a'), ord('z') + 1)] digits = [chr(x) for x in range(ord('0'), ord('9') + 1)] password = input("Password\n") capscount = 0 lowercount = 0 digitcount = 0 specialcount = 0 for ch in password: if ch in caps: capscount = 1...
caps = [chr(x) for x in range(ord('A'), ord('Z') + 1)] lower = [chr(x) for x in range(ord('a'), ord('z') + 1)] digits = [chr(x) for x in range(ord('0'), ord('9') + 1)] password = input('Password\n') capscount = 0 lowercount = 0 digitcount = 0 specialcount = 0 for ch in password: if ch in caps: capscount = 1...
def text_justification(text): FINISH = text[len(text-1)] start = 0 text_justified = [] while(True): k=0 end = start + 10 if text[end] == ' ': a=text[start:start+10] text_justified.append(a) else: while(text[end] != ' '): ...
def text_justification(text): finish = text[len(text - 1)] start = 0 text_justified = [] while True: k = 0 end = start + 10 if text[end] == ' ': a = text[start:start + 10] text_justified.append(a) else: while text[end] != ' ': ...
''' This class makes a Tower of Hanoi pddl problem file with arbitrary number of disks ''' class Tower_of_hanoi: def __init__(self,number_of_plates,path): lines = self.make_pddl_problem(number_of_plates) self.make_pddl_file(lines,path) def make_pddl_problem(self,number_of_plates): #Lines contains the lines wh...
""" This class makes a Tower of Hanoi pddl problem file with arbitrary number of disks """ class Tower_Of_Hanoi: def __init__(self, number_of_plates, path): lines = self.make_pddl_problem(number_of_plates) self.make_pddl_file(lines, path) def make_pddl_problem(self, number_of_plates): ...
def main(): for i in range(10): if i == 0: ... else: print(i) ls = [1, 2, 3] ls.append(ls) print(ls) if __name__ == '__main__': main()
def main(): for i in range(10): if i == 0: ... else: print(i) ls = [1, 2, 3] ls.append(ls) print(ls) if __name__ == '__main__': main()
n=int(input()) a,b=n//5,0 while a>=0: if (n-a*5)%3==0: print(a+(n-a*5)//3) exit() a-=1 print(-1)
n = int(input()) (a, b) = (n // 5, 0) while a >= 0: if (n - a * 5) % 3 == 0: print(a + (n - a * 5) // 3) exit() a -= 1 print(-1)
# Creando nuestra propia *generator function* def generatorFunction(limit): for n in range(limit): yield n*n # <--- Yield again! numeros = generatorFunction(3) for n in numeros: print(n, end=' ')
def generator_function(limit): for n in range(limit): yield (n * n) numeros = generator_function(3) for n in numeros: print(n, end=' ')
#P1M3MatthewLane maximum_order = 150.0 minimum_order = 1.0 def cheese_program(order_amount): if order_amount.isdigit() == False: print('Enter cheese order weight (numeric value): ') elif float(order_amount) > maximum_order: print(order_amount, " is more than currently available stock") ...
maximum_order = 150.0 minimum_order = 1.0 def cheese_program(order_amount): if order_amount.isdigit() == False: print('Enter cheese order weight (numeric value): ') elif float(order_amount) > maximum_order: print(order_amount, ' is more than currently available stock') elif float(order_amou...
def add(x,y): print(f"The value of x: {x}") print(f"The value of y: {y}") return x+y result = add(3,7) print(result)
def add(x, y): print(f'The value of x: {x}') print(f'The value of y: {y}') return x + y result = add(3, 7) print(result)
def maxScoreSightseeingPair(A: [int]) -> int: result = 0 mx = A[0] for j in range(1, len(A)): if mx + A[j] - j > result: result = mx + A[j] - j if A[j] + j > mx: mx = A[j] + j return result if __name__ == "__main__" : A = [8,1,5,2,6] result = maxScoreSigh...
def max_score_sightseeing_pair(A: [int]) -> int: result = 0 mx = A[0] for j in range(1, len(A)): if mx + A[j] - j > result: result = mx + A[j] - j if A[j] + j > mx: mx = A[j] + j return result if __name__ == '__main__': a = [8, 1, 5, 2, 6] result = max_sco...
# Cube geometries CUBE_VERTICES = ( (-0.5, -0.5, -0.5), (-0.5, 0.5, -0.5), (0.5, 0.5, -0.5), (0.5, -0.5, -0.5), (-0.5, -0.5, 0.5), (-0.5, 0.5, 0.5), (0.5, 0.5, 0.5), (0.5, -0.5, 0.5), ) CUBE_SEGMENTS = ( (0, 1), (1, 2), (2, 3), (3, 0), (0, 4), (1, 5), (2, 6)...
cube_vertices = ((-0.5, -0.5, -0.5), (-0.5, 0.5, -0.5), (0.5, 0.5, -0.5), (0.5, -0.5, -0.5), (-0.5, -0.5, 0.5), (-0.5, 0.5, 0.5), (0.5, 0.5, 0.5), (0.5, -0.5, 0.5)) cube_segments = ((0, 1), (1, 2), (2, 3), (3, 0), (0, 4), (1, 5), (2, 6), (3, 7), (4, 5), (5, 6), (6, 7), (7, 4)) cube_faces = ((0, 1, 2), (0, 2, 3), (0, 1,...
def get_errors_field_names(response, text=None): for error in response.json.get('errors', []): if text: descriptions = error['description'] if isinstance(error['description'], list) else [error['description']] if text in descriptions: yield (error['location'], error[...
def get_errors_field_names(response, text=None): for error in response.json.get('errors', []): if text: descriptions = error['description'] if isinstance(error['description'], list) else [error['description']] if text in descriptions: yield (error['location'], error['...
script_var = "This is a script or global level variable" # Print the fibonacci number up to n n = 10 a, b = 0, 1 while b < n: print(b) a, b = b, a + b # A dog class class Dog: def __init__(self, name): self.name = name def speak(self): print(self.name + " says woof.") d = Dog("Fido") d.speak()
script_var = 'This is a script or global level variable' n = 10 (a, b) = (0, 1) while b < n: print(b) (a, b) = (b, a + b) class Dog: def __init__(self, name): self.name = name def speak(self): print(self.name + ' says woof.') d = dog('Fido') d.speak()
# Problem URL: https://leetcode.com/problems/spiral-matrix/ def spiral(matrix): result = [] while matrix: result += matrix.pop(0) matrix = list(zip(*matrix))[::-1] return result
def spiral(matrix): result = [] while matrix: result += matrix.pop(0) matrix = list(zip(*matrix))[::-1] return result
nota = float(input('Informe uma nota de 0 a 10: ')) while (Nota>10) or (Nota<0): Nota = float(input('Informe uma nota de 0 a 10: '))
nota = float(input('Informe uma nota de 0 a 10: ')) while Nota > 10 or Nota < 0: nota = float(input('Informe uma nota de 0 a 10: '))
class Solution: def countSquares(self, matrix: List[List[int]]) -> int: if matrix is None: return 0 if len(matrix) == 0: return 0 c = 0 for row in range(len(matrix)): for col in range(len(matrix[0])): curr = matrix[row][col] ...
class Solution: def count_squares(self, matrix: List[List[int]]) -> int: if matrix is None: return 0 if len(matrix) == 0: return 0 c = 0 for row in range(len(matrix)): for col in range(len(matrix[0])): curr = matrix[row][col] ...
# Generate the first k Fibonacci numbers k = 10 fprev = 1 fnext = 1 print(fprev, end=' ') print(fnext, end=' ') for i in range(k-2): # first 2 terms already printed before loop fib = fprev + fnext print(fib, end=' ') fprev = fnext fnext = fib
k = 10 fprev = 1 fnext = 1 print(fprev, end=' ') print(fnext, end=' ') for i in range(k - 2): fib = fprev + fnext print(fib, end=' ') fprev = fnext fnext = fib
def number( ): j=1 while j<1000: i=1 sum=0 while i<j: if j%i==0: sum=sum+i i=i+1 if j==sum: print(sum,"perfect number") j=j+1 number( )
def number(): j = 1 while j < 1000: i = 1 sum = 0 while i < j: if j % i == 0: sum = sum + i i = i + 1 if j == sum: print(sum, 'perfect number') j = j + 1 number()
class Calculadora: def __init__(self): pass def soma(self,valor_a,valor_b): return valor_a+valor_b def subtracao(self,valor_a,valor_b): return valor_a-valor_b def divisao(self,valor_a,valor_b): return valor_a/valor_b def multiplicacao(self,valor_a,valor_b): ...
class Calculadora: def __init__(self): pass def soma(self, valor_a, valor_b): return valor_a + valor_b def subtracao(self, valor_a, valor_b): return valor_a - valor_b def divisao(self, valor_a, valor_b): return valor_a / valor_b def multiplicacao(self, valor_a, v...
''' Probem Task : This program will Compare Two Strings by Count of Characters Problem Link : https://edabit.com/challenge/C3N2JEfFQoh4cqQ98 Create a function that takes two strings as arguments and return either True or False depending on whether the total number of characters in the first string ...
""" Probem Task : This program will Compare Two Strings by Count of Characters Problem Link : https://edabit.com/challenge/C3N2JEfFQoh4cqQ98 Create a function that takes two strings as arguments and return either True or False depending on whether the total number of characters in the first string ...
name, age = "Sahana", 17 username = "sahanasubramaniam" print ('Hello!') print("Name: {}\nAge: {}\nUsername: {}".format(name, age, username))
(name, age) = ('Sahana', 17) username = 'sahanasubramaniam' print('Hello!') print('Name: {}\nAge: {}\nUsername: {}'.format(name, age, username))
class Property: def __init__(self, get_fn =None , set_fn = None): self.get_fn = get_fn self.set_fn = set_fn def __get__(self, instance, owner): return self.get_fn(instance) # def __set__(self, instance, value): # self.set_fn(instance, value) def setter(self, set_fn): ...
class Property: def __init__(self, get_fn=None, set_fn=None): self.get_fn = get_fn self.set_fn = set_fn def __get__(self, instance, owner): return self.get_fn(instance) def setter(self, set_fn): print(type(self)(self.get_fn, set_fn)) return type(self)(self.get_fn, ...
def celsius(): x = int(input("What temperature of Celsius do you want to convert to Fahrenheit?")) cel = (x * 1.8) + 32 print(f"The temperature is {cel} degrees Fahrenheit") return cel def fahrenheit(): x = int(input("What temperature of Fahrenheit do you want to convert to Celsius?")) fah = (...
def celsius(): x = int(input('What temperature of Celsius do you want to convert to Fahrenheit?')) cel = x * 1.8 + 32 print(f'The temperature is {cel} degrees Fahrenheit') return cel def fahrenheit(): x = int(input('What temperature of Fahrenheit do you want to convert to Celsius?')) fah = (x -...
''' Time: O(bits of num) Space: O(bits of num) ''' class Solution: def numberOfSteps (self, num: int) -> int: digits = f'{num:b}' return digits.count('1') - 1 + len(digits)
""" Time: O(bits of num) Space: O(bits of num) """ class Solution: def number_of_steps(self, num: int) -> int: digits = f'{num:b}' return digits.count('1') - 1 + len(digits)
class Point: x = 0 y = 0 def __init__(self, x, y): self.x = x self.y = y class ImagePosition: center = Point(0, 0) min = Point(0, 0) max = Point(0, 0) def __init__(self, x_center, y_center, x_min, y_min, x_max, y_max): self.center = Point(x_center, y_center) ...
class Point: x = 0 y = 0 def __init__(self, x, y): self.x = x self.y = y class Imageposition: center = point(0, 0) min = point(0, 0) max = point(0, 0) def __init__(self, x_center, y_center, x_min, y_min, x_max, y_max): self.center = point(x_center, y_center) ...
# -*- coding: utf-8 -*- # @Time : 2018/8/3 13:11 # @Author : Dylan # @File : config.py # @Email : wenyili@buaa.edu.cn class Config(): model = '' train_path = '' other_train_path = '' val_path = '' test_path = "" checkpoint_path = '../save_models/best_model.h5' save_model_path = '.....
class Config: model = '' train_path = '' other_train_path = '' val_path = '' test_path = '' checkpoint_path = '../save_models/best_model.h5' save_model_path = '../save_models/my_model.h5' save_sub_path = '../outputs/result.csv' log_path = '../analyse/log.csv' plot_path = '../anal...
# this file was automatically generated major = 0 minor = 1 release = 1 version = '{}.{}.{}'.format(major, minor, release)
major = 0 minor = 1 release = 1 version = '{}.{}.{}'.format(major, minor, release)
# class EmojiHelper: def __init__(self): self.FeelsMetalHead = "<:FeelsMetalHead:279991636144947200>" self.FeelsAmazingMan = "<:FeelsAmazingMan:312655939192881162>" self.ThinkMetal = "<:thinkmetal:283286542162591744>" self.FeelsRageMan = "<:FeelsRageMan:264760794615513088>" ...
class Emojihelper: def __init__(self): self.FeelsMetalHead = '<:FeelsMetalHead:279991636144947200>' self.FeelsAmazingMan = '<:FeelsAmazingMan:312655939192881162>' self.ThinkMetal = '<:thinkmetal:283286542162591744>' self.FeelsRageMan = '<:FeelsRageMan:264760794615513088>' se...
def move_objects(): for obj, new_position in movements: objs_in_new_position = get_objects_by_coords(new_position) all_passable = True for obj_in_new_position in objs_in_new_position: if not game_objects[obj_in_new_position]['passable']: all_passable = False ...
def move_objects(): for (obj, new_position) in movements: objs_in_new_position = get_objects_by_coords(new_position) all_passable = True for obj_in_new_position in objs_in_new_position: if not game_objects[obj_in_new_position]['passable']: all_passable = False ...
# -*- coding: utf-8 -*- class Solution: def nextGreatestLetter(self, letters, target): new_letters = list(sorted(set(letters + [target]))) double_new_letters = ''.join(new_letters * 2) return double_new_letters[double_new_letters.find(target) + 1] if __name__ == '__main__': solution...
class Solution: def next_greatest_letter(self, letters, target): new_letters = list(sorted(set(letters + [target]))) double_new_letters = ''.join(new_letters * 2) return double_new_letters[double_new_letters.find(target) + 1] if __name__ == '__main__': solution = solution() assert '...
#Eamonn O'Farrell #Week 5 exercise - . Write a Python script that reads the Iris data set in # and prints the four numerical values on each row in a nice format. # That is, on the screen should be printed the petal length, petal width, sepal length and sepal width, # and these values should have the decimal place...
with open('Data/iris.csv') as f: print('Petal Length Petal Width Sepal Length Sepal Width') for line in f: print(line.split(',')[0], ' ', line.split(',')[1], ' ', line.split(',')[2], ' ', line.split(',')[3])
def selection_sort(list): for i in range(len(list)): max = i for j in range(i, len(list)): if list[j] > list[max]: max = j list[i], list[max] = list[max], list[i] list = [5, 2, 4, 1, 3] selection_sort(list) print(list)
def selection_sort(list): for i in range(len(list)): max = i for j in range(i, len(list)): if list[j] > list[max]: max = j (list[i], list[max]) = (list[max], list[i]) list = [5, 2, 4, 1, 3] selection_sort(list) print(list)
def connect_kafka(): # TODO: connect to kafka data plugin # pass msg = "kafka connected" return msg
def connect_kafka(): msg = 'kafka connected' return msg
__author__ = 'Kevin' class Data: version = "7.29.15.18.43" USERNAME = "RedditBot/q" PASSWORD = "Butts420" playerBlacklist = [] diceRoll = '^[rR]oll 1[dD](([1-9])([0-9]?)+)(((?i)k|m)?) in (clan)' fax = '^!fax (.*?)( -hic-)?$' loveMe = '((?i)I love you)(!)?' helpMe = "^!help" pickup = "^!sexbot" snack = "^!bots...
__author__ = 'Kevin' class Data: version = '7.29.15.18.43' username = 'RedditBot/q' password = 'Butts420' player_blacklist = [] dice_roll = '^[rR]oll 1[dD](([1-9])([0-9]?)+)(((?i)k|m)?) in (clan)' fax = '^!fax (.*?)( -hic-)?$' love_me = '((?i)I love you)(!)?' help_me = '^!help' pick...
serverList = {} # Dictionary of Nagios XI servers serverList['my_nagios'] = { # Nagios XI server information 'apikey': '', # API token of Nagios XI user 'ip': '', # IP of Nagios XI server 'userSSH': '', # SSH username of Nagios XI server 'passSSH': '', # SSH Password of Nagios XI server 'comm...
server_list = {} serverList['my_nagios'] = {'apikey': '', 'ip': '', 'userSSH': '', 'passSSH': '', 'comm': ''} checkcommand = {'Check Cpu': '!cpu!-w 70 -c 80!!!!!', 'Check Mem': '!mem!-w 15 -c 5!!!!!', 'Check Temp': '!temp!-w 50 -c 80!!!!!', 'Check Fan': '!fan!-w 1 -c 2!!!!!', 'Check Psu': '!ps!-w 1 -c 1!!!!!'}
# # PySNMP MIB module FASTPATH-ROUTING6-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FASTPATH-ROUTING6-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:12:41 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, constraints_union, value_size_constraint, constraints_intersection) ...
# Configuration # Platform dependent stuff FULLSCREEN = True BASE_FOLDER = "/home/pi/tv/" ADC_ENABLED = False FORECAST_ENABLED = False BME280_ENABLED = False #RENDER_MODE = "Manual" RENDER_MODE = "Timed" RANDOMIZE = True RENDER_SLEEP = 30 # Potmeters ADC_SLEEP = 0.5 MAX_ADC_VALUE = 2600 # BME 280 BME280_PORT = 1 ...
fullscreen = True base_folder = '/home/pi/tv/' adc_enabled = False forecast_enabled = False bme280_enabled = False render_mode = 'Timed' randomize = True render_sleep = 30 adc_sleep = 0.5 max_adc_value = 2600 bme280_port = 1 bme280_address = 118 display_width = 640 display_height = 480 background_color = (0, 0, 0) imag...
class NotificationInterface(): def pushMessage(self, message): print(message)
class Notificationinterface: def push_message(self, message): print(message)
# Detects all the hardware and responds them for diagnostics json # Pin Definitions # This is now in variant_definitions seperately. # List of USB Wi-Fi Adaptors used usb_wifi_adaptor_ids = { "148f:5370" : "RT5370" } # List of LTE adaptor combinations lte_adaptor_ids = { "2c7c:0125" : "QUECTEL-EC25" }
usb_wifi_adaptor_ids = {'148f:5370': 'RT5370'} lte_adaptor_ids = {'2c7c:0125': 'QUECTEL-EC25'}
# # PySNMP MIB module MIB-INTEL-OSPF (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MIB-INTEL-OSPF # Produced by pysmi-0.3.4 at Wed May 1 14:12:03 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection) ...
flower_radius = 400 def setup(): # runs once when the programs size(600, 600) background(0, 0, 0, 255) #RGBA, A refers to alpha, 255 refers to red def draw(): global flower_radius noFill() stroke(frameCount,frameCount,220,25) beginShape() for a in range (360): ...
flower_radius = 400 def setup(): size(600, 600) background(0, 0, 0, 255) def draw(): global flower_radius no_fill() stroke(frameCount, frameCount, 220, 25) begin_shape() for a in range(360): noise_factor = noise(a * 0.04, frameCount * 0.01) x = 300 + flower_radius * cos(rad...
class FormProvider(object): def items(self, params): raise NotImplementedError('FormProvider.items')
class Formprovider(object): def items(self, params): raise not_implemented_error('FormProvider.items')
Payload = { 'text': str, 'emoji': str, 'expiry': int, };
payload = {'text': str, 'emoji': str, 'expiry': int}
# O(n), O(1) space # 1. Select pivot (last element), # 2. Set wall to be at left most # position of the sublist. # 3. Iterate. If curr element is # smaller than the pivot, swap it # with the left most element after # the wall (A[wall]), then move the # wall one position to the right. # 4. By this point, every element #...
def partition(A, p, q): x = A[q] wall = p for i in range(p, q): if A[i] <= x: (A[wall], A[i]) = (A[i], A[wall]) wall += 1 (A[q], A[wall]) = (A[wall], A[q]) return wall def quicksort(A, p, r): if p < r: q = partition(A, p, r) quicksort(A, p, q - 1)...
def quick_sort(arr, low, high): if low == high: return max_ = partition(arr, low, high) quick_sort(arr, low, max_) quick_sort(arr, max_ + 1, high) def partition(arr, low, high): pivot = arr[low] i = low j = high while i <= j: while True: i += 1 i...
def quick_sort(arr, low, high): if low == high: return max_ = partition(arr, low, high) quick_sort(arr, low, max_) quick_sort(arr, max_ + 1, high) def partition(arr, low, high): pivot = arr[low] i = low j = high while i <= j: while True: i += 1 if...
valor = float(input()) notas = [100, 50, 20, 10, 5, 2] moedas = [1, 0.50, 0.25, 0.10, 0.05, 0.01] print('NOTAS:') for nota in notas: qt_notas = int(valor / nota) print(f'{qt_notas} nota(s) de R$ {nota:.2f}') valor -= qt_notas * nota print('MOEDAS:') for moeda in moedas: valor = round(valor, 2) qt_mo...
valor = float(input()) notas = [100, 50, 20, 10, 5, 2] moedas = [1, 0.5, 0.25, 0.1, 0.05, 0.01] print('NOTAS:') for nota in notas: qt_notas = int(valor / nota) print(f'{qt_notas} nota(s) de R$ {nota:.2f}') valor -= qt_notas * nota print('MOEDAS:') for moeda in moedas: valor = round(valor, 2) qt_moed...
TURN_LEFT = "turn_left" TURN_RIGHT = "turn_right" FWD = "fwd" class Plateau: orientations = [[0, 1], [1, 0], [0, -1], [-1, 0]] def __init__(self, starPositions): self.starPositions = starPositions self.pos = [0, 0] self._orientation = 0 def move(self, moves): count = 0 ...
turn_left = 'turn_left' turn_right = 'turn_right' fwd = 'fwd' class Plateau: orientations = [[0, 1], [1, 0], [0, -1], [-1, 0]] def __init__(self, starPositions): self.starPositions = starPositions self.pos = [0, 0] self._orientation = 0 def move(self, moves): count = 0 ...
def generate_arc(current_chapter): arcs = {"Romance Dawn": [i for i in range(1, 8)], "Orange Town": [i for i in range(8, 22)], "Syrup Village": [i for i in range(22, 42)], "Baratie": [i for i in range(42, 69)], "Arlong Park": [i for i in range(69, 96)], "Loguetown": [i for i ...
def generate_arc(current_chapter): arcs = {'Romance Dawn': [i for i in range(1, 8)], 'Orange Town': [i for i in range(8, 22)], 'Syrup Village': [i for i in range(22, 42)], 'Baratie': [i for i in range(42, 69)], 'Arlong Park': [i for i in range(69, 96)], 'Loguetown': [i for i in range(96, 101)], 'Reverse Mountain': ...
# config.py # Enable sanic's debugging features. Should be False in production DEBUG = False
debug = False
class producao: def counter_nps_calc(self, id_equipamento): counter_db = self.select_database_nps(id_equipamento) fl_presence = self.select_presence_product(id_equipamento) if fl_presence: result = counter_db - 1 else: result = counter_db return r...
class Producao: def counter_nps_calc(self, id_equipamento): counter_db = self.select_database_nps(id_equipamento) fl_presence = self.select_presence_product(id_equipamento) if fl_presence: result = counter_db - 1 else: result = counter_db return resul...
def is_between(value: str, minimum: int, maximum: int) -> bool: if not value.isdigit(): return False int_value = int(value) return minimum <= int_value <= maximum
def is_between(value: str, minimum: int, maximum: int) -> bool: if not value.isdigit(): return False int_value = int(value) return minimum <= int_value <= maximum
# # PySNMP MIB module CXCommonConsole-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CXCommonConsole-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:16:52 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, single_value_constraint, constraints_union, value_size_constraint) ...
def GithubCheckApiRateLimitExceeded(responseJson): if "message" in responseJson: if (responseJson["documentation_url"] == "https://developer.github.com/v3/#rate-limiting"): return True return False
def github_check_api_rate_limit_exceeded(responseJson): if 'message' in responseJson: if responseJson['documentation_url'] == 'https://developer.github.com/v3/#rate-limiting': return True return False
class Banco(): saldo = 0 def deposito(self, valor): self.saldo += valor return True def saque(self, valor): if (valor > self.saldo): print("Digite um valor menor que o saldo atual") return False self.saldo -= valor return False def exibir...
class Banco: saldo = 0 def deposito(self, valor): self.saldo += valor return True def saque(self, valor): if valor > self.saldo: print('Digite um valor menor que o saldo atual') return False self.saldo -= valor return False def exibir_sa...
# Time: O(1) # Space: O(1) # 231 # Given an integer, write a function to determine if it is a power of two. # BitOps skill: # 1. get rightmost 1: x & (-x) # 2. set rightmost 1 to 0: x & (x-1) class Solution: # @param {integer} n # @return {boolean} def isPowerOfTwo(self, n): return n > 0 and (n ...
class Solution: def is_power_of_two(self, n): return n > 0 and n & n - 1 == 0 def is_power_of_two2(self, n): return n > 0 and n & -n == n def is_power_of_two3(self, n): if n <= 0: return False while n % 2 == 0: n /= 2 return n == 1
label_convertor = dict( type='AttnConvertor', dict_type='DICT90', with_unknown=True) model = dict( type='SARNet', backbone=dict(type='ResNet31OCR'), encoder=dict( type='SAREncoder', enc_bi_rnn=False, enc_do_rnn=0.1, enc_gru=False, ), decoder=dict( type='P...
label_convertor = dict(type='AttnConvertor', dict_type='DICT90', with_unknown=True) model = dict(type='SARNet', backbone=dict(type='ResNet31OCR'), encoder=dict(type='SAREncoder', enc_bi_rnn=False, enc_do_rnn=0.1, enc_gru=False), decoder=dict(type='ParallelSARDecoder', enc_bi_rnn=False, dec_bi_rnn=False, dec_do_rnn=0, d...
class TapSearch: def __init__(self): self.documents = '''Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Magna ac placerat vestibulum lectus. Elit duis tristique sollicitudin nibh sit amet commodo. Senectus et netus et malesuada f...
class Tapsearch: def __init__(self): self.documents = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Magna ac placerat vestibulum lectus. Elit duis tristique sollicitudin nibh sit amet commodo. Senectus et netus et malesuada fame...
RED = '\033[0;31m' YELLOW = '\033[33m' BLUE = '\033[34m' CYAN = '\033[36m' WHITE = '\033[37m' RESET = '\033[0m'
red = '\x1b[0;31m' yellow = '\x1b[33m' blue = '\x1b[34m' cyan = '\x1b[36m' white = '\x1b[37m' reset = '\x1b[0m'
class character: def __init__(self): self.data = [] self.health = 100 self.inventory_dictionary = {} def get_health(self): return self.health def take_damage(self, damage): print(f'we took {damage} damage.') self.health = self.health - damage def set_h...
class Character: def __init__(self): self.data = [] self.health = 100 self.inventory_dictionary = {} def get_health(self): return self.health def take_damage(self, damage): print(f'we took {damage} damage.') self.health = self.health - damage def set_h...
''' Descripttion: version: Author: HuSharp Date: 2021-02-19 13:29:18 LastEditors: HuSharp LastEditTime: 2021-02-20 11:54:18 @Email: 8211180515@csu.edu.cn ''' def make_withdraw(balance): def withdraw(amount): nonlocal balance if amount > balance: return 'Insufficient funds' bala...
""" Descripttion: version: Author: HuSharp Date: 2021-02-19 13:29:18 LastEditors: HuSharp LastEditTime: 2021-02-20 11:54:18 @Email: 8211180515@csu.edu.cn """ def make_withdraw(balance): def withdraw(amount): nonlocal balance if amount > balance: return 'Insufficient funds' ba...
n = str(input().upper()) n1 = list(n) pontoJE = pontoJD = partidasjE = partidasjD = 0 for i in (n1): #conta os R e S da lista if i == "S": pontoJE += 1 if i == "R": pontoJD += 1 if pontoJD == 5 and pontoJE <=3: partidasjD +=1 pontoJE = 0 pontoJD = 0 if ponto...
n = str(input().upper()) n1 = list(n) ponto_je = ponto_jd = partidasj_e = partidasj_d = 0 for i in n1: if i == 'S': ponto_je += 1 if i == 'R': ponto_jd += 1 if pontoJD == 5 and pontoJE <= 3: partidasj_d += 1 ponto_je = 0 ponto_jd = 0 if pontoJE == 5 and pontoJD <=...
# Hello world # My first python git repo if __name__ == "__main__": print("Hello world")
if __name__ == '__main__': print('Hello world')
# # Module for handling Hanyu Pinyin # # Copyright (c) 2015 Christian Schiller # # Note that 'v' is not included in this set. CONSONANTS = set(['b', 'B', 'c', 'C', 'd', 'D', 'f', 'F', 'g', 'G', 'h', 'H', 'j', 'J...
consonants = set(['b', 'B', 'c', 'C', 'd', 'D', 'f', 'F', 'g', 'G', 'h', 'H', 'j', 'J', 'k', 'K', 'l', 'L', 'm', 'M', 'n', 'N', 'p', 'P', 'q', 'Q', 'r', 'R', 's', 'S', 't', 'T', 'w', 'W', 'x', 'X', 'y', 'Y', 'z', 'Z']) vowels = set(['a', 'A', 'e', 'E', 'i', 'I', 'o', 'O', 'u', 'U', 'ü', 'Ü', 'v', 'V']) zero_width_space...
num_loop=input("Give me a number for loop ") for num in range(1,num_loop+1): user=list(str(num)) # print user add=0 for i in user: b=int(i) add=add+b**3 # print add if add==num: print (num, 'Armstrong number hai') # ----------------------check a number------------ # user=input("Give me a number ") # num=...
num_loop = input('Give me a number for loop ') for num in range(1, num_loop + 1): user = list(str(num)) add = 0 for i in user: b = int(i) add = add + b ** 3 if add == num: print(num, 'Armstrong number hai')
# Moves for bear to win MAX_BEAR_MOVES = 40 # Combinations for bear to loose, one for each edge position # index ease'0,','1', '2', '3', '4', '5', '6', '7', '8', '9', '10, '11, '12, '13 '14, '15, '16, '17, '18, '19, '20 BEAR_KO = [['2', '1', '1', '1', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_...
max_bear_moves = 40 bear_ko = [['2', '1', '1', '1', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_'], ['1', '_', '2', '1', '_', '_', '1', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_'], ['_', '_', '1', '_', '_', '_', '2', '_', '_', '_', '_', '_', '1', '1', '_',...
# Copyright 2015 Michael DeHaan <michael.dehaan/gmail> # # 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...
class Instancedata(object): __slots__ = ['present', 'ssh'] def __init__(self, present=False, provider_specific=None, ssh=None): self.present = present self.provider_specific = provider_specific self.ssh = ssh class Sshdata(object): __slots__ = ['keyfile', 'user', 'host', 'port'] ...
# Interleaving String ''' Given strings s1, s2, and s3, find whether s3 is formed by an interleaving of s1 and s2. An interleaving of two strings s and t is a configuration where they are divided into non-empty substrings such that: s = s1 + s2 + ... + sn t = t1 + t2 + ... + tm |n - m| <= 1 The interleaving is s1 +...
""" Given strings s1, s2, and s3, find whether s3 is formed by an interleaving of s1 and s2. An interleaving of two strings s and t is a configuration where they are divided into non-empty substrings such that: s = s1 + s2 + ... + sn t = t1 + t2 + ... + tm |n - m| <= 1 The interleaving is s1 + t1 + s2 + t2 + s3 + t3...
#!/usr/bin/env python # -*- coding: UTF-8 -*- ''' @File : with.py @Author : jiachen.zou@jiiov.com @Date : 2021-01-30 11:51 CST(+0800) @Brief : ''' # Use 'with' with open(): if '__file__' in vars(): with open( __file__, 'r') as file: print( file.readlines()[ 16].strip()) # Use 'with' wi...
""" @File : with.py @Author : jiachen.zou@jiiov.com @Date : 2021-01-30 11:51 CST(+0800) @Brief : """ if '__file__' in vars(): with open(__file__, 'r') as file: print(file.readlines()[16].strip()) class Foo: def __enter__(self): print('__enter__() called.') return self...
# # laaso/base_defaults.py # # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # ''' Default settings that are not loaded from any configuration. To keep dependencies simple, use only Python built-in types here. ''' # This is hardcoded in things like the keyvault VM extension...
""" Default settings that are not loaded from any configuration. To keep dependencies simple, use only Python built-in types here. """ azure_certificate_store = '/var/lib/waagent/Microsoft.Azure.KeyVault.Store' exc_value_default = ValueError laaso_venv_path = '/usr/laaso/venv' location_default_fallback = 'eastus2' pf =...
class Solution: def isToeplitzMatrix(self, matrix: List[List[int]]) -> bool: m = len(matrix) n = len(matrix[0]) # starting point: column-wise [0, n) for col in range(n): num = matrix[0][col] (r, c) = (0, col) while(r<m and c<n): if ...
class Solution: def is_toeplitz_matrix(self, matrix: List[List[int]]) -> bool: m = len(matrix) n = len(matrix[0]) for col in range(n): num = matrix[0][col] (r, c) = (0, col) while r < m and c < n: if matrix[r][c] != num: ...
data = ''' 10 1 2 2 8 4 10 5 9 6 10 7 9 ''' data = list(map(int, data.split())) new = [[data[0]]] for i in range(1, len(data), 2): new.append(data[i:i+2]) start = new[0][0] edges = new[1:] print(start - len(edges) - 1)
data = '\n10\n1 2\n2 8\n4 10\n5 9\n6 10\n7 9\n' data = list(map(int, data.split())) new = [[data[0]]] for i in range(1, len(data), 2): new.append(data[i:i + 2]) start = new[0][0] edges = new[1:] print(start - len(edges) - 1)
# # PySNMP MIB module ZXR10-X25-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZXR10-X25-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:42:37 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, constraints_union, value_size_constraint, single_value_constraint) ...
# https://leetcode.com/problems/valid-anagram/ class Solution: def isAnagram(self, s: str, t: str) -> bool: dic = {} for i in s: if i not in dic: dic[i] = 1 else: dic[i] += 1 for j in t: if j not in dic: ret...
class Solution: def is_anagram(self, s: str, t: str) -> bool: dic = {} for i in s: if i not in dic: dic[i] = 1 else: dic[i] += 1 for j in t: if j not in dic: return False else: di...
data_file = open('input.txt', 'r') data = data_file.read().split('\n') data.pop() data = [int(x) for x in data] print(data) for num in data: remainder = 2020 - num if remainder in data: print(num * remainder)
data_file = open('input.txt', 'r') data = data_file.read().split('\n') data.pop() data = [int(x) for x in data] print(data) for num in data: remainder = 2020 - num if remainder in data: print(num * remainder)
# n = letters.length # time = O(n) # space = O(1) # done time = 5m class Solution: def nextGreatestLetter(self, letters: List[str], target: str) -> str: for s in letters: if ord(target) < ord(s): return s return letters[0]
class Solution: def next_greatest_letter(self, letters: List[str], target: str) -> str: for s in letters: if ord(target) < ord(s): return s return letters[0]
# # PySNMP MIB module CISCO-ICSUDSU-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ICSUDSU-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:42:42 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, constraints_union, single_value_constraint, value_size_constraint) ...
def LOS_spatial_global(args): args_spatial = {} args_spatial['cone_opening_angle'] = args['cone_opening_angle'] return args_spatial
def los_spatial_global(args): args_spatial = {} args_spatial['cone_opening_angle'] = args['cone_opening_angle'] return args_spatial
class Species: # member is of type Genome def __init__(self, first_member, species_id): self.leader = first_member self.leader_old = None self.representative = first_member self.members = [] self.id = species_id self.generations_not_improved = 0 self.age ...
class Species: def __init__(self, first_member, species_id): self.leader = first_member self.leader_old = None self.representative = first_member self.members = [] self.id = species_id self.generations_not_improved = 0 self.age = 0 self.spawns_require...
class Test: def __init__(self, request, test_type): #print (request) self.type = test_type if self.type == "active": #initialize Test data self.test_info_first_segment = request['test_info_first_segment'] self.test_info_second_segment = request['test_info...
class Test: def __init__(self, request, test_type): self.type = test_type if self.type == 'active': self.test_info_first_segment = request['test_info_first_segment'] self.test_info_second_segment = request['test_info_second_segment'] self.metadata_first_segment =...
class ProductOfNumbers(object): def __init__(self): self.A = [1] def add(self, a): if a == 0: self.A = [1] else: self.A.append(self.A[-1] * a) def getProduct(self, k): if k >= len(self.A): return 0 return self.A[-1] / self.A[...
class Productofnumbers(object): def __init__(self): self.A = [1] def add(self, a): if a == 0: self.A = [1] else: self.A.append(self.A[-1] * a) def get_product(self, k): if k >= len(self.A): return 0 return self.A[-1] / self.A[-k ...
__author__ = 'Kimmo Brunfeldt' __email__ = 'kimmobrunfeldt@gmail.com' __url__ = 'https://github.com/kimmobrunfeldt/egtest' __version__ = '0.1.0-dev'
__author__ = 'Kimmo Brunfeldt' __email__ = 'kimmobrunfeldt@gmail.com' __url__ = 'https://github.com/kimmobrunfeldt/egtest' __version__ = '0.1.0-dev'
def solve(n, m, s, t, c={}): if (n, m) in c: return c[(n, m)] elif 0 in (n, m): return 0 else: if s[n-1] == t[m-1]: return max(solve(n-1, m-1, s, t)+1, solve(n-1, m, s, t), solve(n, m-1, s, t)) else: return max(solve(n-1, m, s, t), solve(n, m-1, s, t)...
def solve(n, m, s, t, c={}): if (n, m) in c: return c[n, m] elif 0 in (n, m): return 0 elif s[n - 1] == t[m - 1]: return max(solve(n - 1, m - 1, s, t) + 1, solve(n - 1, m, s, t), solve(n, m - 1, s, t)) else: return max(solve(n - 1, m, s, t), solve(n, m - 1, s, t)) if __na...
SECRET_KEY = "s" ALLOWED_HOSTS = ["testserver"] WSGI_APPLICATION = "django_webserver.tests.app.application" INSTALLED_APPS = ["django_webserver"] ROOT_URLCONF = "django_webserver.tests.app" STATIC_URL = "/static/" STATIC_ROOT = "/tmp/static"
secret_key = 's' allowed_hosts = ['testserver'] wsgi_application = 'django_webserver.tests.app.application' installed_apps = ['django_webserver'] root_urlconf = 'django_webserver.tests.app' static_url = '/static/' static_root = '/tmp/static'
# Nama : Eraraya Morenzo Muten # NIM : 16520002 # Tanggal : 19 Maret 2021 # PROGRAM luastrapesium # menghitung luas trapesium dengan persamaan 0.5*t*(s1+s2) # KAMUS # t, s1, s2 : float # ALGORITMA t = float(input()) # menerima input panjang trapesium s1 = float(input()) s2 = float(input()) l = 0.5*t*(s1+s2)...
t = float(input()) s1 = float(input()) s2 = float(input()) l = 0.5 * t * (s1 + s2) print('%.2f' % l)
def multi(array): total = 1 for number in array: total *= number return total
def multi(array): total = 1 for number in array: total *= number return total
size = float(input()) first_size = input().lower() second_size = input().lower() meter = 1 mm = 1000 cm = 100 if first_size == "m": result = size / meter elif first_size == "mm": result = size / mm elif first_size == "cm": result = size / cm if second_size == "m": result = result * meter elif second_s...
size = float(input()) first_size = input().lower() second_size = input().lower() meter = 1 mm = 1000 cm = 100 if first_size == 'm': result = size / meter elif first_size == 'mm': result = size / mm elif first_size == 'cm': result = size / cm if second_size == 'm': result = result * meter elif second_siz...
class programmer: company = 'Microsoft' def __init__(self, name, product): self.name = name self.product = product def getInfo(self): print (f'The name of the {self.company} programmer is {self.name} and the product is {self.product}') amresh = programmer('amresh', 'skype'...
class Programmer: company = 'Microsoft' def __init__(self, name, product): self.name = name self.product = product def get_info(self): print(f'The name of the {self.company} programmer is {self.name} and the product is {self.product}') amresh = programmer('amresh', 'skype') alka = ...
class Loan(object): principal: int term: int rate: float def __init__(self, principal=None, term=None, rate=None): self.principal = principal self.term = term self.rate = rate
class Loan(object): principal: int term: int rate: float def __init__(self, principal=None, term=None, rate=None): self.principal = principal self.term = term self.rate = rate
l = input().split() th = len(l)/4 def maxOcr(l): count = 0 key = l[0] for i in l[1:]: if i == key: count += 1 else: key = i count = 0 if count > th: return i print(maxOcr(l))
l = input().split() th = len(l) / 4 def max_ocr(l): count = 0 key = l[0] for i in l[1:]: if i == key: count += 1 else: key = i count = 0 if count > th: return i print(max_ocr(l))
# # PySNMP MIB module EXTREME-UPM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EXTREME-UPM-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:09:41 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, constraints_intersection, value_size_constraint, single_value_constraint) ...
# author: <Samaiya Howard> # date: <7/2/21> # # description: <Vairables practice page 1> # --------------- Section 1 --------------- # # 1.1 | Variable Creation | Strings # # Relevant Documentation # - https://www.w3schools.com/python/python_variables.asp # - https://www.w3schools.com/python/python_variables_name...
example_name = 'elia' print('EXAMPLE: my name is', example_name) name = 'Samaiya Howard' birthday = 'August 25' animal = 'lion' print('My name is:', name + '\n' + 'My birthday is:', birthday + '\n' + 'and the animal I like is:', animal) print() fav_num = 4 birthday_month_day = 'thursday' neg_num = -256 decimal_num = 3....
class Solution: def addBinary(self, a: str, b: str) -> str: na = len(a) nb = len(b) arr1 = list(map(int, a)) arr2 = list(map(int, b)) res = [] ia = na - 1 ib = nb - 1 c = 0 while ia >= 0 and ib >= 0: sum = arr1[ia] + arr2[ib] + c ...
class Solution: def add_binary(self, a: str, b: str) -> str: na = len(a) nb = len(b) arr1 = list(map(int, a)) arr2 = list(map(int, b)) res = [] ia = na - 1 ib = nb - 1 c = 0 while ia >= 0 and ib >= 0: sum = arr1[ia] + arr2[ib] + c ...
def test_basic_front_end(flask_app): with flask_app.test_client() as client: response = client.get( "/a/random/page" ) assert response.status_code == 200 def test_basic_front_end_next(flask_app, auth_user): with flask_app.test_client(user=auth_user) as client: with cli...
def test_basic_front_end(flask_app): with flask_app.test_client() as client: response = client.get('/a/random/page') assert response.status_code == 200 def test_basic_front_end_next(flask_app, auth_user): with flask_app.test_client(user=auth_user) as client: with client.session_transaction(...
accesslog = '../logs/gunicorn.log' errorlog = '../logs/gunicorn.error.log' loglevel = 'debug' capture_output = True reload = True
accesslog = '../logs/gunicorn.log' errorlog = '../logs/gunicorn.error.log' loglevel = 'debug' capture_output = True reload = True
def solution(xs): if len(xs) == 1: return str(xs[0]) xs = [number for number in xs if number != 0] new_len = len(xs) if not xs: return str(0) neg_cnt = len([number for number in xs if number < 0]) # !! exceptional case - one negative number, the rest are zeroes if new_len == ...
def solution(xs): if len(xs) == 1: return str(xs[0]) xs = [number for number in xs if number != 0] new_len = len(xs) if not xs: return str(0) neg_cnt = len([number for number in xs if number < 0]) if new_len == 1 and neg_cnt == 1: return str(0) xs.sort() if neg_cn...
# https://www.acmicpc.net/problem/1010 n = int(input()) for _ in range(n): (n, m) = [int(i) for i in input().split()] ans = 1 for i in range(m - n + 1, m + 1): ans *= i for i in range(2, n + 1): ans //= i print(ans)
n = int(input()) for _ in range(n): (n, m) = [int(i) for i in input().split()] ans = 1 for i in range(m - n + 1, m + 1): ans *= i for i in range(2, n + 1): ans //= i print(ans)
try: 2*3 except TypeError: print("An exception was raised") else: print("Oh yes! No exceptions were raised.")
try: 2 * 3 except TypeError: print('An exception was raised') else: print('Oh yes! No exceptions were raised.')
def findMin(root): if not root: return None if root.leftChild: return findMin(root.leftChild) return root.val
def find_min(root): if not root: return None if root.leftChild: return find_min(root.leftChild) return root.val
def welcome_msg(): print("Welcome to Python Scripting") print("Python is easy to learn") return None def known_concepts(): print("Now we are good with bascis") print("We are about to start functions concepts in python") return None def learning_concepts(): print("Function are very easy in python") pri...
def welcome_msg(): print('Welcome to Python Scripting') print('Python is easy to learn') return None def known_concepts(): print('Now we are good with bascis') print('We are about to start functions concepts in python') return None def learning_concepts(): print('Function are very easy in ...
_base_ = [ '../_base_/models/segformer_mit-b0.py', '../_base_/datasets/rui.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py' ] model = dict( pretrained='pretrain/mit_b0.pth', decode_head=dict(num_classes=7)) # optimizer optimizer = dict( _delete_=True, type='AdamW', l...
_base_ = ['../_base_/models/segformer_mit-b0.py', '../_base_/datasets/rui.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py'] model = dict(pretrained='pretrain/mit_b0.pth', decode_head=dict(num_classes=7)) optimizer = dict(_delete_=True, type='AdamW', lr=6e-05, betas=(0.9, 0.999), weight_decay=...