content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
""" http://www.geeksforgeeks.org/merge-sort/ https://www.programiz.com/dsa/merge-sort """ def merge_sort(arr): if len(arr) > 1: mid = len(arr) // 2 L = arr[:mid] R = arr[mid:] merge_sort(L) merge_sort(R) i = j = k = 0 if i < len(L) and j < len(R): ...
""" http://www.geeksforgeeks.org/merge-sort/ https://www.programiz.com/dsa/merge-sort """ def merge_sort(arr): if len(arr) > 1: mid = len(arr) // 2 l = arr[:mid] r = arr[mid:] merge_sort(L) merge_sort(R) i = j = k = 0 if i < len(L) and j < len(R): ...
class Solution: def splitArray(self, nums): """ :type nums: List[int] :rtype: bool """ # (0, i - 1), (i + 1, j - 1), (j + 1, k - 1) and (k + 1, n - 1) # P[i] = P[j] - P[i+1] = P[k] - P[j+1] = P[-1] - P[k+1] P = [0] for x in nums: P.append(P[-1] + x) ...
class Solution: def split_array(self, nums): """ :type nums: List[int] :rtype: bool """ p = [0] for x in nums: P.append(P[-1] + x) n = len(nums) d = collections.defaultdict(list) for (i, u) in enumerate(P): d[u].append(...
# # @lc app=leetcode id=938 lang=python3 # # [938] Range Sum of BST # # @lc code=start # 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 rangeSumBST(self...
class Solution: def range_sum_bst(self, root: TreeNode, L: int, R: int) -> int: self.ans = 0 self.finder(root, L, R) return self.ans def finder(self, root, l, r): if not root: return if l <= root.val <= r: self.ans += root.val if root.val...
protists_chlorophyta = ["volvox", "actinastrum", "hydrodictyon", "spirogyra"] print("The first three items in the list are:") for protist in protists_chlorophyta[:3]: print(protist.title()) protists_chlorophyta = ["volvox", "actinastrum", "hydrodictyon", "spirogyra"] print("The items in the middle of the list are:...
protists_chlorophyta = ['volvox', 'actinastrum', 'hydrodictyon', 'spirogyra'] print('The first three items in the list are:') for protist in protists_chlorophyta[:3]: print(protist.title()) protists_chlorophyta = ['volvox', 'actinastrum', 'hydrodictyon', 'spirogyra'] print('The items in the middle of the list are:'...
#This program demonstrates creation of bank account using OOP #Reference: https://www.udemy.com/the-python-mega-course/learn/v4/t/lecture/5170352?start=0 class Account: def __init__(self, filepath): #filepath stands for a value that is taken from balance.txt self.fp=filepath #this makes filepath an in...
class Account: def __init__(self, filepath): self.fp = filepath with open(filepath, 'r') as file: self.balance = int(file.read()) def withdraw(self, amount): self.balance -= amount def deposit(self, amount): self.balance += amount def commit(self): ...
def fuel(mass): try: mass_int = int(mass) return max(int(mass_int / 3) - 2, 0) except ValueError: return 0 def fuel_recursive(mass): try: mass_int = int(mass) fuel_mass = fuel(mass_int) fuel_total = fuel_mass while fuel_mass > 0: fuel_ma...
def fuel(mass): try: mass_int = int(mass) return max(int(mass_int / 3) - 2, 0) except ValueError: return 0 def fuel_recursive(mass): try: mass_int = int(mass) fuel_mass = fuel(mass_int) fuel_total = fuel_mass while fuel_mass > 0: fuel_mass...
# The test # For (3,4,5) representing (a,b,c) # For (3,4,5) a + b + c = 12 is true # a < b < c is true for (3,4,5) # a2 + b2 = c2 is true for (3,4,5) # For (3,4,5) a + b + c = 12 # Ultimately, fink the product abc. # - Iterate through (a,b) until a^2 + b^2 = c^2 # - Test if a < b < c # - Test if a + b + c = 1000 # (...
sum_of_triplets = 1000 def main(): a = 1 while True: (a, b, c) = platonic_sequence(a) k = 0 while k * (a + b + c) < sum_of_triplets: k += 1 if k * (a + b + c) == sum_of_triplets and a < b < c: print('Primitive Triplet: ', a, b, c) ...
ntos = { 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine', 10: 'ten', 11: 'eleven', 12: 'twelve', 13: 'thirteen', 14: 'fourteen', 15: 'fifteen', 16: 'sixteen', 17: 'seventeen', 18: 'eighteen', 19...
ntos = {1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine', 10: 'ten', 11: 'eleven', 12: 'twelve', 13: 'thirteen', 14: 'fourteen', 15: 'fifteen', 16: 'sixteen', 17: 'seventeen', 18: 'eighteen', 19: 'nineteen', 20: 'twenty', 30: 'thirty'} for i in range(1, 10): ntos[20 ...
# A python module for example purposes myName = "mymod module for examples" def add(a,b): return a + b def multiply(a,b): return a * b
my_name = 'mymod module for examples' def add(a, b): return a + b def multiply(a, b): return a * b
#Setting Directory morsealpha={ "A" : ".-", "B" : "-...", "C" : "-.-.", "D" : "-..", "E" : ".", "F" : "..-.", "G" : "--.", "H" : "....", "I" : "..", "J" : ".---", "K" : "-.-", "L" : ".-..", "M" : "--", "N" :...
morsealpha = {'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', 'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', 'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.', 'S': '...', 'T': '-', 'U': '..-', 'V': '...-', 'W': '.--', 'X': '-..-', 'Y': '-.--', 'Z'...
nome = input("Digite seu nome: ") s = input("Digite seu sexo(M/N): ").upper() while s != 'M' != 'F': s = input("Digite seu sexo novamente: ").upper()
nome = input('Digite seu nome: ') s = input('Digite seu sexo(M/N): ').upper() while s != 'M' != 'F': s = input('Digite seu sexo novamente: ').upper()
# THIS FILE IS AUTO-GENERATED. PLEASE DO NOT MODIFY# version file for ldap3 # generated on 2020-09-07 08:48:35.409733 # on system uname_result(system='Windows', node='ELITE10GC', release='10', version='10.0.19041', machine='AMD64', processor='Intel64 Family 6 Model 58 Stepping 9, GenuineIntel') # with Python 3.8.5 - ('...
__version__ = '2.8.1' __author__ = 'Giovanni Cannata' __email__ = 'cannatag@gmail.com' __url__ = 'https://github.com/cannatag/ldap3' __description__ = 'A strictly RFC 4510 conforming LDAP V3 pure Python client library' __status__ = '5 - Production/Stable' __license__ = 'LGPL v3'
def parse_bool(val, default): if not val: return default if type(val) == bool: return val if type(val) == str: if val.lower() in ["1", "true"]: return True if val.lower() in ["0", "false"]: return False raise ValueError(f"{val} can not be interpret...
def parse_bool(val, default): if not val: return default if type(val) == bool: return val if type(val) == str: if val.lower() in ['1', 'true']: return True if val.lower() in ['0', 'false']: return False raise value_error(f'{val} can not be interpre...
class RhinoObjectEventArgs(EventArgs): # no doc ObjectId = property(lambda self: object(), lambda self, v: None, lambda self: None) """Get: ObjectId(self: RhinoObjectEventArgs) -> Guid """ TheObject = property(lambda self: object(), lambda self, v: None, lambda self: None) """Get: TheO...
class Rhinoobjecteventargs(EventArgs): object_id = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Get: ObjectId(self: RhinoObjectEventArgs) -> Guid\n\n\n\n' the_object = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Get: TheObject(self: RhinoObjectE...
def ficha(nome='<desconhecido>', gol=0): print(f'O jogador {nome} fez {gol} gol(s) no campeonato.') #programa principal n = str(input('Digite o nome do jogador: ')) g = str(input('Quantos gols no campeonato: ')) if g.isnumeric(): g = int(g) else: g = 0 if n.strip() == '': ficha(gol=g) else: ficha(n...
def ficha(nome='<desconhecido>', gol=0): print(f'O jogador {nome} fez {gol} gol(s) no campeonato.') n = str(input('Digite o nome do jogador: ')) g = str(input('Quantos gols no campeonato: ')) if g.isnumeric(): g = int(g) else: g = 0 if n.strip() == '': ficha(gol=g) else: ficha(n, g)
count=0 while count<5 : print(count, "is less than 5") count= count +1 else : print(count, "is greater than 5")
count = 0 while count < 5: print(count, 'is less than 5') count = count + 1 else: print(count, 'is greater than 5')
def merge(x, y): if len(x) == 0: return y if len(y) == 0: return x if x[0] <= y[0]: return [x[0]] + merge(x[1:], y) else: return [y[0]] + merge(x, y[1:]) #Solution without slice and concat, which are O(n) in python def merge2(x, y): if len(x) == 0: retu...
def merge(x, y): if len(x) == 0: return y if len(y) == 0: return x if x[0] <= y[0]: return [x[0]] + merge(x[1:], y) else: return [y[0]] + merge(x, y[1:]) def merge2(x, y): if len(x) == 0: return y if len(y) == 0: return x last = y.pop() if x[-...
#!/usr/bin/env python # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # Jiao Lin # California Institute of Technology # (C) 2007 All Rights Reserved # # {LicenseText} # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
class Abstractbinding: def compositescatterer(self, shape, elements, geometer): raise NotImplementedError def scatterercontainer(self): raise NotImplementedError def geometer(self): raise NotImplementedError def position(self, x, y, z): """create binding's representat...
try: user_number = int(input("Enter a number: ")) res = 10/user_number except ValueError: print("You did not enter a number!") except ZeroDivisionError: print("Enter a number different from zero (0)!")
try: user_number = int(input('Enter a number: ')) res = 10 / user_number except ValueError: print('You did not enter a number!') except ZeroDivisionError: print('Enter a number different from zero (0)!')
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = "nebula" class RabbitmqCtx(object): _instance = None def __init__(self): self._amqp_url = "amqp://guest:guest@localhost:5672/" @property def amqp_url(self): return self._amqp_url @amqp_url.setter def amqp_url(self, ...
__author__ = 'nebula' class Rabbitmqctx(object): _instance = None def __init__(self): self._amqp_url = 'amqp://guest:guest@localhost:5672/' @property def amqp_url(self): return self._amqp_url @amqp_url.setter def amqp_url(self, amqp_url): self._amqp_url = amqp_url ...
class Item: def __init__(self, kind, variable): super(Item, self).__init__() self.variable = variable self.kind = kind class Request: def __init__(self, operation, length): super(Request, self).__init__() self.operation = operation self.length = length class Schedule: """ operations represents list of...
class Item: def __init__(self, kind, variable): super(Item, self).__init__() self.variable = variable self.kind = kind class Request: def __init__(self, operation, length): super(Request, self).__init__() self.operation = operation self.length = length class S...
# Truth and guesses should be lists of (commit_id, classification_id) def score(truth, guesses): truth = dict(truth) correct_matches = 0 incorrect_matches = 0 for commit_id, classification_id in guesses: assert(commit_id in truth) if truth[commit_id] == classification_id: correct_matches += 1 ...
def score(truth, guesses): truth = dict(truth) correct_matches = 0 incorrect_matches = 0 for (commit_id, classification_id) in guesses: assert commit_id in truth if truth[commit_id] == classification_id: correct_matches += 1 else: incorrect_matches += 1 ...
class MyQueue(object): def __init__(self): """ Initialize your data structure here. """ self.data = [] def push(self, x): """ Push element x to the back of queue. :type x: int :rtype: None """ stack = [x] tmp = [] ...
class Myqueue(object): def __init__(self): """ Initialize your data structure here. """ self.data = [] def push(self, x): """ Push element x to the back of queue. :type x: int :rtype: None """ stack = [x] tmp = [] ...
#coding:utf-8 # Define no-op plugin methods def pre_build_page(page, context, data): """ Called prior to building a page. :param page: The page about to be built :param context: The context for this page (you can modify this, but you must return it) :param data: The raw body for this page (you can...
def pre_build_page(page, context, data): """ Called prior to building a page. :param page: The page about to be built :param context: The context for this page (you can modify this, but you must return it) :param data: The raw body for this page (you can modify this). :returns: Modified (or not...
class A(object): def __init__(self): pass def _internal_use(self): pass def __method_name(self): pass
class A(object): def __init__(self): pass def _internal_use(self): pass def __method_name(self): pass
#https://leetcode.com/explore/learn/card/queue-stack/239/conclusion/1393/ # According to Trial 68 ms and 14.5 mb # 95.45% time and 21.71% space class Solution: def floodFill(self, image: List[List[int]], sr: int, sc: int, newColor: int) -> List[List[int]]: stack = [(sr,sc)] visited = {} val...
class Solution: def flood_fill(self, image: List[List[int]], sr: int, sc: int, newColor: int) -> List[List[int]]: stack = [(sr, sc)] visited = {} valid_path_val = image[sr][sc] while stack: (row, col) = stack.pop() if image[row][col] == valid_path_val and (no...
# Copyright (c) 2009 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'variables': { 'feature_defines': [ 'ENABLE_CHANNEL_MESSAGING=1', 'ENABLE_DATABASE=1', 'ENABLE_DATAGRID=1', 'ENABLE_DASHB...
{'variables': {'feature_defines': ['ENABLE_CHANNEL_MESSAGING=1', 'ENABLE_DATABASE=1', 'ENABLE_DATAGRID=1', 'ENABLE_DASHBOARD_SUPPORT=0', 'ENABLE_JAVASCRIPT_DEBUGGER=0', 'ENABLE_JSC_MULTIPLE_THREADS=0', 'ENABLE_ICONDATABASE=0', 'ENABLE_XSLT=1', 'ENABLE_XPATH=1', 'ENABLE_SVG=1', 'ENABLE_SVG_ANIMATION=1', 'ENABLE_SVG_AS_I...
l, h = [int(input()), int(input())] t = [ord(c.lower()) - 97 if c.isalpha() else 26 for c in input()] for _ in range(h): row = input() print("".join(row[j * l:(j + 1) * l] for j in t))
(l, h) = [int(input()), int(input())] t = [ord(c.lower()) - 97 if c.isalpha() else 26 for c in input()] for _ in range(h): row = input() print(''.join((row[j * l:(j + 1) * l] for j in t)))
""" Radix Sort In computer science, radix sort is a non-comparative integer sorting algorithm that sorts data with integer keys by grouping keys by the individual digits which share the same significant position and value. A positional notation is required, but because integers can represent strings of characters ...
""" Radix Sort In computer science, radix sort is a non-comparative integer sorting algorithm that sorts data with integer keys by grouping keys by the individual digits which share the same significant position and value. A positional notation is required, but because integers can represent strings of characters ...
# Worker: Microsoft GET_ANOMALY = { "type": "get", "endpoint": "/getAnomaly", "call_message": "{type} {endpoint}", "error_message": "{type} {endpoint} {response_code}" }
get_anomaly = {'type': 'get', 'endpoint': '/getAnomaly', 'call_message': '{type} {endpoint}', 'error_message': '{type} {endpoint} {response_code}'}
""" Write a function that accepts 2 strings (first_name, last_name). The function should concatenate these two strings by inserting a space in between the strings and then reverse the resultant string. Example: first_name = 'Allen' last_name = 'Brown' Expected output = 'nworB nellA' """ def string_reverse(first_...
""" Write a function that accepts 2 strings (first_name, last_name). The function should concatenate these two strings by inserting a space in between the strings and then reverse the resultant string. Example: first_name = 'Allen' last_name = 'Brown' Expected output = 'nworB nellA' """ def string_reverse(first_...
n=int(input()) res=[] grade=[] for i in range(n): name=input() mark=float(input()) res.append([name,mark]) grade.append(mark) grade=sorted(set(grade)) #sorted and remove the duplicates m=grade[1] name=[] for val in res: if m==val[1]: name.append(val[0]) name.sort() ...
n = int(input()) res = [] grade = [] for i in range(n): name = input() mark = float(input()) res.append([name, mark]) grade.append(mark) grade = sorted(set(grade)) m = grade[1] name = [] for val in res: if m == val[1]: name.append(val[0]) name.sort() for nm in name: print(nm)
def adapt_routes_object(object): lat_north = object['routes'][0]['bounds']['northeast']['lat'] long_east = object['routes'][0]['bounds']['northeast']['long'] lat_south = object['routes'][0]['bounds']['southwest']['lat'] long_west = object['routes'][0]['bounds']['southwest']['long']
def adapt_routes_object(object): lat_north = object['routes'][0]['bounds']['northeast']['lat'] long_east = object['routes'][0]['bounds']['northeast']['long'] lat_south = object['routes'][0]['bounds']['southwest']['lat'] long_west = object['routes'][0]['bounds']['southwest']['long']
def get_aggregation(**kwargs): field_name = '' for k, v in kwargs.items(): field_name = v.replace('.keyword', '')+'_'+k return { field_name : { k: { 'field': v } } }
def get_aggregation(**kwargs): field_name = '' for (k, v) in kwargs.items(): field_name = v.replace('.keyword', '') + '_' + k return {field_name: {k: {'field': v}}}
short = {} def printShort1(word, i): words = word.split() words[i] = "[" + words[i][0] + "]" + words[i][1:] print(" ".join(words)) def printShort2(cmd, i): print(cmd[:i] + "[" + cmd[i] + "]" + cmd[i + 1:]) for i in range(ord('a'), ord('z') + 1): short[chr(i)] = False n = int(input()) cmds = [] f...
short = {} def print_short1(word, i): words = word.split() words[i] = '[' + words[i][0] + ']' + words[i][1:] print(' '.join(words)) def print_short2(cmd, i): print(cmd[:i] + '[' + cmd[i] + ']' + cmd[i + 1:]) for i in range(ord('a'), ord('z') + 1): short[chr(i)] = False n = int(input()) cmds = [] f...
#!/usr/bin/env python # coding: utf-8 # # Day 4 Assignment # In[1]: num1 = 1042000 num2 = 702648265 for num in range(num1, num2 + 1): order = len(str(num)) total = 0 temp = num while temp > 0: digit = temp % 10 total += digit ** order temp //= 10 if num == total: ...
num1 = 1042000 num2 = 702648265 for num in range(num1, num2 + 1): order = len(str(num)) total = 0 temp = num while temp > 0: digit = temp % 10 total += digit ** order temp //= 10 if num == total: print(num) break
""" Custom exceptions for things that can go wrong in the execution of changesets. These are used more for documentation than functionality at the moment. """ class ChangesetException(Exception): pass class NotEnoughApprovals(ChangesetException): pass class NotPermittedToApprove(ChangesetException): ...
""" Custom exceptions for things that can go wrong in the execution of changesets. These are used more for documentation than functionality at the moment. """ class Changesetexception(Exception): pass class Notenoughapprovals(ChangesetException): pass class Notpermittedtoapprove(ChangesetException): pas...
def simple_math(first, second): return f"""{first} + {second} = {first + second} {first} - {second} = {first - second} {first} * {second} = {first * second} {first} / {second} = {int(first / second)}""" if __name__ == '__main__': f = int(input('What is the first number?')) s = int(input('What is the secon...
def simple_math(first, second): return f'{first} + {second} = {first + second}\n{first} - {second} = {first - second}\n{first} * {second} = {first * second}\n{first} / {second} = {int(first / second)}' if __name__ == '__main__': f = int(input('What is the first number?')) s = int(input('What is the second n...
#THIS IS TO PLACTICE CLASS AND METHODS ##CREATE A BANK CLASS AND METHODTS TO DEPOSIT AND WITHDRAW MONEY FROM THE ##ACCOUNT, IF THE ACCOUNT DOES NOT HAVE ENOUGH FUND, PREVENT WITHDRAWAL class Bank_Account(): #bank account has owner and balance attributes def __init__(self, owner, balance =0): sel...
class Bank_Account: def __init__(self, owner, balance=0): self.owner = owner self.balance = balance def __str__(self): return f'Account owner is: {self.owner}\n Balance : {self.balance}' def deposit(self, deposit): self.balance += deposit print('Deposit accepted an...
class ReverseOrderIterator(): def __init__(self, n): self.n = n def __iter__(self): return self def __next__(self): list = [] for element in range(self.n, -1, -1): list.append(element) return list def next(self): return...
class Reverseorderiterator: def __init__(self, n): self.n = n def __iter__(self): return self def __next__(self): list = [] for element in range(self.n, -1, -1): list.append(element) return list def next(self): return self.__next__() iter =...
''' setting api config ''' ''' base config class ''' class Config(object): DEBUG=False SECRET_KEY="secret" ''' testing class configurations ''' class Testing(Config): DEBUG=True TESTING=True ''' dev class configurations ''' class Development(Config): DEBUG=True ''' staging configurations ''' c...
""" setting api config """ ' base config class ' class Config(object): debug = False secret_key = 'secret' ' testing class configurations ' class Testing(Config): debug = True testing = True ' dev class configurations ' class Development(Config): debug = True ' staging configurations ' class St...
expected_output = { 'application': 'TEMPERATURE', 'temperature_sensors': { 'CPU board': { 'id': 0, 'history': { '11/10/2019 05:35:04': 51, '11/10/2019 05:45:04': 51, '11/10/2019 06:35:04': 49, '11/10/2019 06:40:...
expected_output = {'application': 'TEMPERATURE', 'temperature_sensors': {'CPU board': {'id': 0, 'history': {'11/10/2019 05:35:04': 51, '11/10/2019 05:45:04': 51, '11/10/2019 06:35:04': 49, '11/10/2019 06:40:04': 49}}, 'FANIO Board': {'id': 1, 'history': {'11/10/2019 05:35:04': 48, '11/10/2019 05:45:04': 48, '11/10/2019...
a = float(input()) b = float(input()) media = ((a*3.5) + (b*7.5)) / 11 print('MEDIA = {:.5f}'.format(media))
a = float(input()) b = float(input()) media = (a * 3.5 + b * 7.5) / 11 print('MEDIA = {:.5f}'.format(media))
class Node(): def __init__(self, x, y, r): self.x = x self.y = y self.r = r self.next = None self.prev = None pass @classmethod def from_np(cls, index, pos): return cls(pos[index][0], pos[index][1], pos[index][2]) def __str__(self): retu...
class Node: def __init__(self, x, y, r): self.x = x self.y = y self.r = r self.next = None self.prev = None pass @classmethod def from_np(cls, index, pos): return cls(pos[index][0], pos[index][1], pos[index][2]) def __str__(self): return...
def decrypt_fun(input_string,k): st="" for i in range(len(input_string)): if input_string.islower(): shift=97 #ord(97)=a else: shift=65 #ord(65)=A s=(((ord(input_string[i]))-(ord(k[i])))%26)+shift #here we need to subtract the ord(key) rest is same as ...
def decrypt_fun(input_string, k): st = '' for i in range(len(input_string)): if input_string.islower(): shift = 97 else: shift = 65 s = (ord(input_string[i]) - ord(k[i])) % 26 + shift st += chr(s) return st def key(length): t = list(input('Enter t...
N, K, M = map(int, input().split()) P = list(map(int, input().split())) E = list(map(int, input().split())) A = list(map(int, input().split())) H = list(map(int, input().split())) P.sort() E.sort() A.sort() H.sort() result = 0 for x in zip(P, E, A, H): y = sorted(x) result += pow(y[-1] - y[0], K, M) resul...
(n, k, m) = map(int, input().split()) p = list(map(int, input().split())) e = list(map(int, input().split())) a = list(map(int, input().split())) h = list(map(int, input().split())) P.sort() E.sort() A.sort() H.sort() result = 0 for x in zip(P, E, A, H): y = sorted(x) result += pow(y[-1] - y[0], K, M) resul...
#!/usr/bin/env python # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "Lic...
mshr_urls = [] MSHR_URLS.append('ftp://ftp.ncdc.noaa.gov/pub/data/homr/docs/MSHR_Enhanced_Table.txt') MSHR_URLS.append('http://www.ncdc.noaa.gov/homr/file/mshr_enhanced.txt.zip') mshr_field_index_name = 0 mshr_field_index_start = 1 mshr_field_index_end = 2 mshr_field_index_type = 3 mshr_fields = {} MSHR_FIELDS['SOURCE_...
(a, b) = map(str, input().split(" ")) a = len(a) b = len(b) if a<b: g = a else: g = b l = [] for i in range(1,g+1): if a%i==0 and b%i==0: l.append(str(i)) if (len(l) == 1) and ('1' in l): print("yes") else: print("no")
(a, b) = map(str, input().split(' ')) a = len(a) b = len(b) if a < b: g = a else: g = b l = [] for i in range(1, g + 1): if a % i == 0 and b % i == 0: l.append(str(i)) if len(l) == 1 and '1' in l: print('yes') else: print('no')
# Enumerate instead of parsing so we pick up errors if a host is added/changed ver_lookup = { "postgresql-96-c7": ("9.6", "centos"), "postgresql-10-c7": ("10", "centos"), "postgresql-11-c7": ("11", "centos"), "postgresql-12-c7": ("12", "centos"), "postgresql-96-u1804": ("9.6", "ubuntu"), "postg...
ver_lookup = {'postgresql-96-c7': ('9.6', 'centos'), 'postgresql-10-c7': ('10', 'centos'), 'postgresql-11-c7': ('11', 'centos'), 'postgresql-12-c7': ('12', 'centos'), 'postgresql-96-u1804': ('9.6', 'ubuntu'), 'postgresql-10-u1804': ('10', 'ubuntu'), 'postgresql-11-u1804': ('11', 'ubuntu'), 'postgresql-12-u1804': ('12',...
""" The Participant class represents a participant in a specific match. It can be used as a placeholder until the participant is decided. """ class Participant: """ The Participant class represents a participant in a specific match. It can be used as a placeholder until the participant is decided. """ ...
""" The Participant class represents a participant in a specific match. It can be used as a placeholder until the participant is decided. """ class Participant: """ The Participant class represents a participant in a specific match. It can be used as a placeholder until the participant is decided. """ ...
#%% payments = 0 interest = (1 + rpi + 0.03) ** (1 / 12) for i in range(0, 30*12): repayment = (monthly_income(i) - base_monthly_income(i)) * 0.09 temp = debt * interest - repayment if temp < 0: payments = payments + debt * interest debt = 0 break debt = temp payments = ...
payments = 0 interest = (1 + rpi + 0.03) ** (1 / 12) for i in range(0, 30 * 12): repayment = (monthly_income(i) - base_monthly_income(i)) * 0.09 temp = debt * interest - repayment if temp < 0: payments = payments + debt * interest debt = 0 break debt = temp payments = payment...
print("Welcome To even / odd Check: ") num = int(input("Enter Number: ")) if num % 2 != 0: print("This is Odd Number") else: print("This is an Even Number")
print('Welcome To even / odd Check: ') num = int(input('Enter Number: ')) if num % 2 != 0: print('This is Odd Number') else: print('This is an Even Number')
class Solution: def maxSubArray(self, nums: [int]) -> int: max_ending = max_current = nums[0] for i in nums[1:]: max_ending = max(i, max_ending + i) max_current = max(max_current, max_ending) return max_current
class Solution: def max_sub_array(self, nums: [int]) -> int: max_ending = max_current = nums[0] for i in nums[1:]: max_ending = max(i, max_ending + i) max_current = max(max_current, max_ending) return max_current
# # PySNMP MIB module DATASMART-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DATASMART-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:21:38 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...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, single_value_constraint, value_range_constraint, value_size_constraint, constraints_union) ...
# List of base-map providers class Providers: MAPBOX = "mapbox" GOOGLE_MAPS = "google_maps"
class Providers: mapbox = 'mapbox' google_maps = 'google_maps'
class Person: def __init__(self, name): self.name = name def greet(self): print(f"Hello, I'm {self.name}") class Child(Person): def __init__(self, name, school): super().__init__(name) self.school = school def learn(self): print(f"I'm learning a lot at {self.s...
class Person: def __init__(self, name): self.name = name def greet(self): print(f"Hello, I'm {self.name}") class Child(Person): def __init__(self, name, school): super().__init__(name) self.school = school def learn(self): print(f"I'm learning a lot at {self....
def test_get_links_nsdi(): """ >>> from diamond_miner.test import url >>> from diamond_miner.queries import GetLinks >>> rows = GetLinks().execute(url, 'test_nsdi_example') >>> links = [(row["near_addr"], row["far_addr"]) for row in rows] >>> sorted(links)[:3] [('::ffff:150.0.1.1', '::ffff:1...
def test_get_links_nsdi(): """ >>> from diamond_miner.test import url >>> from diamond_miner.queries import GetLinks >>> rows = GetLinks().execute(url, 'test_nsdi_example') >>> links = [(row["near_addr"], row["far_addr"]) for row in rows] >>> sorted(links)[:3] [('::ffff:150.0.1.1', '::ffff:1...
#!/usr/bin/python3 # https://practice.geeksforgeeks.org/problems/finding-middle-element-in-a-linked-list/1 def findMid(head): """ Start two pointers, one that moves a step, the other takes two steps When the other reaches end the first will be in the mid Works for both even and odd lengths """ ...
def find_mid(head): """ Start two pointers, one that moves a step, the other takes two steps When the other reaches end the first will be in the mid Works for both even and odd lengths """ ref = head ptr = head while ptr and ref and ref.next: ptr = ptr.next ref = ref.next...
__author__ = 'Yifei' HEADER_OFFSET = 0 INDEX_OFFSET = 4 LENGTH_OFFSET = 5 CHECKSUM_OFFSET = 6 PACKET_CONSTANT_OFFSET = 7 OPERAND_OFFSET = 7 PAYLOAD_OFFSET = 8 MAX_PAYLOAD_LENGTH = 255 MIN_PACKET_LENGTH = 4 + 1 + 1 + 1 PROTOSBN1_HEADER_BYTES = [0x53, 0x42, 0x4e, 0x31]
__author__ = 'Yifei' header_offset = 0 index_offset = 4 length_offset = 5 checksum_offset = 6 packet_constant_offset = 7 operand_offset = 7 payload_offset = 8 max_payload_length = 255 min_packet_length = 4 + 1 + 1 + 1 protosbn1_header_bytes = [83, 66, 78, 49]
# -*- coding: utf-8 -*- """ ParaMol Parameter_space subpackage. Contains modules related to the ParaMol representation of QM engines. """ __all__ = ['amber_wrapper', 'dftb_wrapper', 'ase_wrapper', 'qm_engine']
""" ParaMol Parameter_space subpackage. Contains modules related to the ParaMol representation of QM engines. """ __all__ = ['amber_wrapper', 'dftb_wrapper', 'ase_wrapper', 'qm_engine']
#!/usr/bin/env python # -*- coding: utf-8 -*- """application not found exception design for application not found exception created: 2016/3/17 author: smileboywtu """ class AppNotFound(Exception): """app not found """ def __init__(self, msg, *args, **kwargs): """init the object """ ...
"""application not found exception design for application not found exception created: 2016/3/17 author: smileboywtu """ class Appnotfound(Exception): """app not found """ def __init__(self, msg, *args, **kwargs): """init the object """ self.msg = msg self.args = args ...
#code=input("Enter customer code:") while True: print("") code=input("Enter customer code:") bill_float = 0 bill = float(bill_float) if code == "r": begin_int=input("Enter beginning meter reading:") begin = float(begin_int) end_int=input("Enter ending meter reading:") ...
while True: print('') code = input('Enter customer code:') bill_float = 0 bill = float(bill_float) if code == 'r': begin_int = input('Enter beginning meter reading:') begin = float(begin_int) end_int = input('Enter ending meter reading:') end = float(end_int) ...
class ExperimentorException(Exception): pass class ModelDefinitionException(ExperimentorException): pass class ExperimentDefinitionException(ExperimentorException): pass class DuplicatedParameter(ExperimentorException): pass
class Experimentorexception(Exception): pass class Modeldefinitionexception(ExperimentorException): pass class Experimentdefinitionexception(ExperimentorException): pass class Duplicatedparameter(ExperimentorException): pass
class RequestManipulator: ''' This class can be used to inspect or manipulate output created by the sdc client. Output creation is done in three steps: first a pysdc.pysoap.soapenvelope.Soap12Envelope is created, then a (libxml) etree is created from its content, anf finally a bytestring is gene...
class Requestmanipulator: """ This class can be used to inspect or manipulate output created by the sdc client. Output creation is done in three steps: first a pysdc.pysoap.soapenvelope.Soap12Envelope is created, then a (libxml) etree is created from its content, anf finally a bytestring is generated fr...
# https://leetcode.com/problems/single-element-in-a-sorted-array/ # You are given a sorted array consisting of only integers where every element # appears exactly twice, except for one element which appears exactly once. Find # this single element that appears only once. # Follow up: Your solution should run in O(log...
class Solution: def single_non_duplicate(self, nums: List[int]) -> int: if len(nums) == 1: return nums[0] (left, right) = (0, len(nums) - 1) while left + 1 < right: mid = left + (right - left) // 2 if mid % 2 == 0: if nums[mid] == nums[mid...
class Solution: def findDuplicates(self, nums: List[int]) -> List[int]: if not len(nums): return nums l = [0 for i in range(len(nums)+1)] for i in range(len(nums)): n = nums[i] if l[n]==0: l[n]= 1 else: l[n]+=1 ...
class Solution: def find_duplicates(self, nums: List[int]) -> List[int]: if not len(nums): return nums l = [0 for i in range(len(nums) + 1)] for i in range(len(nums)): n = nums[i] if l[n] == 0: l[n] = 1 else: l[...
# terrascript/resource/at-wat/ucodecov.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:29:37 UTC) __all__ = []
__all__ = []
#Guess my number #Week 2 Finger Exercise 3 print ("Please think of a number between 0 and 100!") print ("Is your secret number 50?") s=[x for x in range (100)] i=input("Enter 'h' to indicate the guess is too high. Enter 'l' to indicate the guess is too low. Enter 'c' to indicate I guessed correctly.") j=0 k=len(s) m=50...
print('Please think of a number between 0 and 100!') print('Is your secret number 50?') s = [x for x in range(100)] i = input("Enter 'h' to indicate the guess is too high. Enter 'l' to indicate the guess is too low. Enter 'c' to indicate I guessed correctly.") j = 0 k = len(s) m = 50 while i != 'c': if i != 'l': ...
soma = 0 cont = 1 while cont <= 5: x = float(input("Digite a {} nota: ".format(cont))) soma = soma + x cont = cont + 1 media = soma / 5 print('A media final {}'.format(media))
soma = 0 cont = 1 while cont <= 5: x = float(input('Digite a {} nota: '.format(cont))) soma = soma + x cont = cont + 1 media = soma / 5 print('A media final {}'.format(media))
#A program to count the words "to" and "the" present in a text file "poem.txt". countTo = 0 countThe = 0 file = open("poem.txt", "r") listObj = file.readlines() for index in listObj: word = index.split() for search in word: if search == "to": countTo += 1 elif search == "the": ...
count_to = 0 count_the = 0 file = open('poem.txt', 'r') list_obj = file.readlines() for index in listObj: word = index.split() for search in word: if search == 'to': count_to += 1 elif search == 'the': count_the += 1 print("Number of 'to': ", countTo) print("Number of 'th...
FirstLetter = "Hello" SecondLetter = "World" print(f"{FirstLetter} {SecondLetter}!")
first_letter = 'Hello' second_letter = 'World' print(f'{FirstLetter} {SecondLetter}!')
# -*- coding: utf-8 -*- # The union() method returns a new set with all items from both sets: set1 = {"a", "b" , "c"} set2 = {1, 2, 3} set3 = set1.union(set2) print(set3) # Return a set that contains the items that exist in both set x, and set y: x = {"apple", "banana", "cherry"} y = {"google", "microsoft", "apple"} z ...
set1 = {'a', 'b', 'c'} set2 = {1, 2, 3} set3 = set1.union(set2) print(set3) x = {'apple', 'banana', 'cherry'} y = {'google', 'microsoft', 'apple'} z = x.intersection(y) print(z) x = {'apple', 'banana', 'cherry'} y = {'google', 'microsoft', 'apple'} x.symmetric_difference_update(y) print(z)
nums1 = {1, 2, 7, 3, 4, 5} nums2 = {4, 5, 6, 8} nums3 = {9, 10} distinct_nums = nums1.union(nums2, nums3) print( distinct_nums)
nums1 = {1, 2, 7, 3, 4, 5} nums2 = {4, 5, 6, 8} nums3 = {9, 10} distinct_nums = nums1.union(nums2, nums3) print(distinct_nums)
class Descriptor(object): """.""" def __init__(self, name=None): """.""" self.name = name def __get__(self, instance, owner): """.""" return instance.__dict__[self.name] def __set__(self, instance, value): """.""" instance.__dict__[self.name] = value...
class Descriptor(object): """.""" def __init__(self, name=None): """.""" self.name = name def __get__(self, instance, owner): """.""" return instance.__dict__[self.name] def __set__(self, instance, value): """.""" instance.__dict__[self.name] = value ...
class Solution: def maxAreaOfIsland(self, grid): """ :type grid: List[List[int]] :rtype: int """ maxArea = 0 for i in range(len(grid)): for j in range(len(grid[0])): if grid[i][j] == 1: maxArea = max(maxArea, self.dfs(g...
class Solution: def max_area_of_island(self, grid): """ :type grid: List[List[int]] :rtype: int """ max_area = 0 for i in range(len(grid)): for j in range(len(grid[0])): if grid[i][j] == 1: max_area = max(maxArea, self....
"""This script demonstrates the bubble sort algorithm in Python 3.""" AGES = [19, 20, 13, 1, 15, 7, 11, 3, 16, 10] def display(): """Prints all the items in the list.""" print("The ages are: ") for i in range(len(AGES)): print(AGES[i]) print("\n") def bubble_sort(array): """Repeatedly s...
"""This script demonstrates the bubble sort algorithm in Python 3.""" ages = [19, 20, 13, 1, 15, 7, 11, 3, 16, 10] def display(): """Prints all the items in the list.""" print('The ages are: ') for i in range(len(AGES)): print(AGES[i]) print('\n') def bubble_sort(array): """Repeatedly step...
# fmt: off print(2.2j.real) print(2.2j.imag) print(1.1+0.5j.real) print(1.1+0.5j.imag)
print(2.2j.real) print(2.2j.imag) print(1.1 + 0.5j.real) print(1.1 + 0.5j.imag)
#!/usr/bin/env python # # Decoder for Texecom Connect API/Protocol # # Copyright (C) 2018 Joseph Heenan # Updates Jul 2020 Charly Anderson # # 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 Licens...
class Area: """Information about an area and it's current state""" def __init__(self, area_number): self.number = area_number self.text = 'Area{:d}'.format(self.number) self.state = None self.state_text = None self.zones = {} def save_state(self, area_state): ...
def test_get_work_film(work_object_film): details = work_object_film.get_details() if not isinstance(details, dict): raise AssertionError() if not len(details) == 17: print(len(details)) raise AssertionError() def test_rating_work_film(work_object_film): main_rating = work_obj...
def test_get_work_film(work_object_film): details = work_object_film.get_details() if not isinstance(details, dict): raise assertion_error() if not len(details) == 17: print(len(details)) raise assertion_error() def test_rating_work_film(work_object_film): main_rating = work_obj...
numbers_1 = [1, 2, 3, 4] numbers_2 = [3, 4, 5, 6] answer = [number for number in numbers_1 if number in numbers_2] print(answer) friends = ['Elie', 'Colt', 'Matt'] answer2 = [friend.lower()[::-1] for friend in friends] print(answer2)
numbers_1 = [1, 2, 3, 4] numbers_2 = [3, 4, 5, 6] answer = [number for number in numbers_1 if number in numbers_2] print(answer) friends = ['Elie', 'Colt', 'Matt'] answer2 = [friend.lower()[::-1] for friend in friends] print(answer2)
# -*- coding: utf-8 -*- def GetCookie(raw_cookies): """Get raw_cookies with Chrome or Fiddler.""" COOKIE = {} for line in raw_cookies.split(';'): key, value = line.split("=", 1) COOKIE[key] = value return(COOKIE)
def get_cookie(raw_cookies): """Get raw_cookies with Chrome or Fiddler.""" cookie = {} for line in raw_cookies.split(';'): (key, value) = line.split('=', 1) COOKIE[key] = value return COOKIE
""" After years of study, scientists have discovered an alien language transmitted from a faraway planet. The alien language is very unique in that every word consists of exactly L lowercase letters. Also, there are exactly D words in this language. Once the dictionary of all the words in the alien language was built,...
""" After years of study, scientists have discovered an alien language transmitted from a faraway planet. The alien language is very unique in that every word consists of exactly L lowercase letters. Also, there are exactly D words in this language. Once the dictionary of all the words in the alien language was built,...
#!/usr/bin/python # Examples of function in Python 3.x # When you need a function? # When you want to perform a set of specific tasks and want to reuse that code whenever required # Also, for better modularity, readability and troubleshooting # How to write a function (Syntax)? '''def function_name(): { ...
"""def function_name(): { # some code here } """ def add_numbers(num1, num2): return num1 + num2 print(add_numbers(5, 4)) def is_even(num): if num % 2 == 0: return True return False num = 12 result = is_even(num) if result: print(f'{num} is even') else: print(f'{num} is not...
#!/usr/bin/python3 """ 1-main """ FIFOCache = __import__('1-fifo_cache').FIFOCache my_cache = FIFOCache() my_cache.put("A", "Hello") my_cache.put("B", "World") my_cache.put("C", "Holberton") my_cache.put("D", "School") my_cache.print_cache() my_cache.put("E", "Battery") my_cache.print_cache() my_cache.put("C", "Street...
""" 1-main """ fifo_cache = __import__('1-fifo_cache').FIFOCache my_cache = fifo_cache() my_cache.put('A', 'Hello') my_cache.put('B', 'World') my_cache.put('C', 'Holberton') my_cache.put('D', 'School') my_cache.print_cache() my_cache.put('E', 'Battery') my_cache.print_cache() my_cache.put('C', 'Street') my_cache.print_...
print("Welcome!") is_able_to_ride = "" first_rider_age = int(input("What is the age of the first rider? ")) first_rider_height = float(input("What is the height of the first rider? ")) is_a_second_rider = input("Is there a second rider (yes/no)? ") if is_a_second_rider == "yes": second_rider_age = int(input("Wha...
print('Welcome!') is_able_to_ride = '' first_rider_age = int(input('What is the age of the first rider? ')) first_rider_height = float(input('What is the height of the first rider? ')) is_a_second_rider = input('Is there a second rider (yes/no)? ') if is_a_second_rider == 'yes': second_rider_age = int(input('What i...
def main(): pass # Run this when called from CLI if __name__ == "__main__": main()
def main(): pass if __name__ == '__main__': main()
# test for for x in range(10): print(x) for x in range(3, 10): print(x) for x in range(1, 10, 3): print(x) for i, v in enumerate(["a", "b", "c"]): print(i, v) for x in [1,2,3,4]: print(x) for k, v in d.items(): print(x) for a, b, c in [(1,2,3), (4,5,6)]: a = a + 1 b = b * 2 c ...
for x in range(10): print(x) for x in range(3, 10): print(x) for x in range(1, 10, 3): print(x) for (i, v) in enumerate(['a', 'b', 'c']): print(i, v) for x in [1, 2, 3, 4]: print(x) for (k, v) in d.items(): print(x) for (a, b, c) in [(1, 2, 3), (4, 5, 6)]: a = a + 1 b = b * 2 c = c /...
class ErrorMessage: @staticmethod def inline_link_uid_not_exist(uid): return ( "error: DocumentIndex: " "the inline link references an " "object with an UID " "that does not exist: " f"{uid}." )
class Errormessage: @staticmethod def inline_link_uid_not_exist(uid): return f'error: DocumentIndex: the inline link references an object with an UID that does not exist: {uid}.'
_logger = None def set_logger(logger): global _logger _logger = logger def get_logger(): return _logger class cached_property: """ Descriptor (non-data) for building an attribute on-demand on first use. ref: http://stackoverflow.com/a/4037979/3886899 """ __slots__ = ('_factory',...
_logger = None def set_logger(logger): global _logger _logger = logger def get_logger(): return _logger class Cached_Property: """ Descriptor (non-data) for building an attribute on-demand on first use. ref: http://stackoverflow.com/a/4037979/3886899 """ __slots__ = ('_factory',) ...
''' You are given an array (which will have a length of at least 3, but could be very large) containing integers. The array is either entirely comprised of odd integers or entirely comprised of even integers except for a single integer N. Write a method that takes the array as an argument and returns this "outlier" N. ...
""" You are given an array (which will have a length of at least 3, but could be very large) containing integers. The array is either entirely comprised of odd integers or entirely comprised of even integers except for a single integer N. Write a method that takes the array as an argument and returns this "outlier" N. ...
class Plugin: max = 1 min = 0 def __init__(self, name): self.name = name
class Plugin: max = 1 min = 0 def __init__(self, name): self.name = name
def load(): data = [] targets = [] f = open('sonar.data', 'r+') line = f.readline() while line: s = line.strip().split(',') d = s[0:len(s)-1] t = 1 if s[len(s)-1] == 'M' else 0 for i in range(len(d)): d[i] = float(d[i]) data.append(d) ta...
def load(): data = [] targets = [] f = open('sonar.data', 'r+') line = f.readline() while line: s = line.strip().split(',') d = s[0:len(s) - 1] t = 1 if s[len(s) - 1] == 'M' else 0 for i in range(len(d)): d[i] = float(d[i]) data.append(d) t...
class InstrumentStatus(object): def __init__(self, actuatorCommands, commandCounter): self._actuatorCommands= actuatorCommands self._commandCounter= commandCounter def commandCounter(self): return self._commandCounter def actuatorCommands(self...
class Instrumentstatus(object): def __init__(self, actuatorCommands, commandCounter): self._actuatorCommands = actuatorCommands self._commandCounter = commandCounter def command_counter(self): return self._commandCounter def actuator_commands(self): return self._actuatorCo...
pkgname = "startup-notification" pkgver = "0.12" pkgrel = 0 build_style = "gnu_configure" configure_args = ["lf_cv_sane_realloc=yes", "lf_cv_sane_malloc=yes"] hostmakedepends = ["pkgconf"] makedepends = ["libx11-devel", "libsm-devel", "xcb-util-devel"] pkgdesc = "Library for tracking application startup" maintainer = "...
pkgname = 'startup-notification' pkgver = '0.12' pkgrel = 0 build_style = 'gnu_configure' configure_args = ['lf_cv_sane_realloc=yes', 'lf_cv_sane_malloc=yes'] hostmakedepends = ['pkgconf'] makedepends = ['libx11-devel', 'libsm-devel', 'xcb-util-devel'] pkgdesc = 'Library for tracking application startup' maintainer = '...
# the defined voltage response from a type K thermocouple # from https://srdata.nist.gov/its90/download/type_k.tab ktype = { #temp in C: millivolt response -270: -6.458, -269: -6.457, -268: -6.456, -267: -6.455, -266: -6.453, -265: -6.452, -264: -6.450, -263: -6.448, ...
ktype = {-270: -6.458, -269: -6.457, -268: -6.456, -267: -6.455, -266: -6.453, -265: -6.452, -264: -6.45, -263: -6.448, -262: -6.446, -261: -6.444, -260: -6.441, -259: -6.438, -258: -6.435, -257: -6.432, -256: -6.429, -255: -6.425, -254: -6.421, -253: -6.417, -252: -6.413, -251: -6.408, -250: -6.404, -249: -6.399, -248...
''' author : https://github.com/Harnek Prim's algorithm is a minimum-spanning-tree algorithm (for weighted undirected graph) Complexity: Performance:: Adjacency matrix = O(|V|^2) Adjacency list with heap = O(|E| log|V|) ''' def prim(s, edges, n): wt = 0 V = set(range(1,n+1)) A = set() A.add(s...
""" author : https://github.com/Harnek Prim's algorithm is a minimum-spanning-tree algorithm (for weighted undirected graph) Complexity: Performance:: Adjacency matrix = O(|V|^2) Adjacency list with heap = O(|E| log|V|) """ def prim(s, edges, n): wt = 0 v = set(range(1, n + 1)) a = set() A.ad...
''' Problem Statement : GCD Choice Link : https://www.hackerearth.com/challenges/competitive/october-easy-20/algorithm/gcd-choice-f04433f3/ Score : partially accepted - 43 pts ''' def find_gcd(x, y): while(y): x, y = y, x % y return x n = int(input()) numbers = list(map(int,input().spl...
""" Problem Statement : GCD Choice Link : https://www.hackerearth.com/challenges/competitive/october-easy-20/algorithm/gcd-choice-f04433f3/ Score : partially accepted - 43 pts """ def find_gcd(x, y): while y: (x, y) = (y, x % y) return x n = int(input()) numbers = list(map(int, input().spli...
teacher = "Mr. Zhang" print(teacher) print("53+28") print(53+28) first = 5 second = 3 print(first + second) third = first + second print(third) teacher_a="Mr. Zhang" teacher_b=teacher_a print(teacher_a) print(teacher_b) teacher_a="Mr.Yu" print(teacher_a) print(teacher_b) score=7 score = score + 1 print(score)...
teacher = 'Mr. Zhang' print(teacher) print('53+28') print(53 + 28) first = 5 second = 3 print(first + second) third = first + second print(third) teacher_a = 'Mr. Zhang' teacher_b = teacher_a print(teacher_a) print(teacher_b) teacher_a = 'Mr.Yu' print(teacher_a) print(teacher_b) score = 7 score = score + 1 print(score)
__all__ = [ "utils", "ascii_table", "astronomy", "data_plot", "h5T", "mesa", "nugridse", "ppn", "selftest", ]
__all__ = ['utils', 'ascii_table', 'astronomy', 'data_plot', 'h5T', 'mesa', 'nugridse', 'ppn', 'selftest']
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2021, Cisco Systems # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) DOCUMENTATION = r""" --- module: enterprise_ssid short_description: Manage EnterpriseSsid objects of Wireless description: - Gets either one or al...
documentation = "\n---\nmodule: enterprise_ssid\nshort_description: Manage EnterpriseSsid objects of Wireless\ndescription:\n- Gets either one or all the enterprise SSID.\n- Creates enterprise SSID.\n- Deletes given enterprise SSID.\nversion_added: '1.0.0'\nauthor: Rafael Campos (@racampos)\noptions:\n ssid_name:\n ...