content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def setup(): size(600, 400) background(0) strokeWeight(random(10)) frameRate(2) def draw(): for i in range(0, width, 1): x = random(255) stroke(x) line(i, 0, i, height)
def setup(): size(600, 400) background(0) stroke_weight(random(10)) frame_rate(2) def draw(): for i in range(0, width, 1): x = random(255) stroke(x) line(i, 0, i, height)
__title__ = 'monchickey' __description__ = 'Python 3 commonly used tool library' __url__ = 'https://github.com/zengzhiying/py3monchickey/' __version__ = '1.1.0' __build__ = 0x010100 __author__ = 'zengzhiying' __author_email__ = 'yingzhi_zeng@126.com' __license__ = 'Apache 2.0' __copyright__ = 'Copyright 2019 ze...
__title__ = 'monchickey' __description__ = 'Python 3 commonly used tool library' __url__ = 'https://github.com/zengzhiying/py3monchickey/' __version__ = '1.1.0' __build__ = 65792 __author__ = 'zengzhiying' __author_email__ = 'yingzhi_zeng@126.com' __license__ = 'Apache 2.0' __copyright__ = 'Copyright 2019 zengzhiying'
## Lab 9, programming problem "wordplay". ## This is a solution to the first question of that problem only. ## You can use this as a starting point to solve the other questions. ## Remember that you need to download the text file with the list ## of words to be able to run this code. def count_word_lengths(wordlist...
def count_word_lengths(wordlist): """ wordlist is a list of strings (assumed to be words). Returns a dictionary mapping word lengths (integers) to the number of words of that length. For example, lengths = count_word_lengths(my_word_list) print("there are", lengths[3], "words of length 3 in...
# -*- coding: utf-8 -*- # def jac_uniform(mesh): # create Jacobian centroids = mesh.control_volume_centroids X = mesh.node_coords jac = 2 * (X - centroids) * mesh.control_volumes[:, None] return jac
def jac_uniform(mesh): centroids = mesh.control_volume_centroids x = mesh.node_coords jac = 2 * (X - centroids) * mesh.control_volumes[:, None] return jac
##Q2. Write a program to check whether a String is palindrome or not? ############################################################################################################# ##Program Objective: to check whether a String is palindrome or not ## ##Coded by: KNR ...
print('--------------------------------------------------') your_str = input('Enter your string:') if yourStr == yourStr[::-1]: print('{} is a Polindrome'.format(yourStr)) else: print('{} is not a Polindrome'.format(yourStr)) print('--------------------------------------------------')
class Check(object): @staticmethod def isExistAllOptionCustomer(customer): if 'name' and 'sex' and 'phone' not in customer: return False return True @staticmethod def updateCustomer(customer, older): i = 0 options = ['name', 'phone', 'sex'] for key i...
class Check(object): @staticmethod def is_exist_all_option_customer(customer): if 'name' and 'sex' and ('phone' not in customer): return False return True @staticmethod def update_customer(customer, older): i = 0 options = ['name', 'phone', 'sex'] fo...
class SearchOperator: LIKE = 'LIKE' LIKE_BEGIN = 'LIKE_BEGIN' EQUAL = 'EQ' GREATER_EQUAL = 'GE' LESS_EQUAL = 'LE' GREATER = 'GT' LESS = 'LT' IN_LIST = 'LIST' SIMILAR_EQUAL = 'SEQ' def get_list(self): return ['LIKE', 'LIKE_BEGIN', 'EQ', 'GE', 'LE', 'GT', 'LT', 'LIST', 'SE...
class Searchoperator: like = 'LIKE' like_begin = 'LIKE_BEGIN' equal = 'EQ' greater_equal = 'GE' less_equal = 'LE' greater = 'GT' less = 'LT' in_list = 'LIST' similar_equal = 'SEQ' def get_list(self): return ['LIKE', 'LIKE_BEGIN', 'EQ', 'GE', 'LE', 'GT', 'LT', 'LIST', 'SE...
# # Definition for singly-linked list. # # class ListNode: # # def __init__(self, val=0, next=None): # # self.val = val # # self.next = next # class Solution: # def reverseList(self, head: ListNode) -> ListNode: # # exceptions # if not head or not head.next: # return ...
class Solution: """ Simple iterative """ def reverse_list(self, head: ListNode) -> ListNode: if not head or not head.next: return head prev = None curr = head while curr: next = curr.next curr.next = prev prev = curr ...
# 167. Two Sum II - Input array is sorted # Runtime: 56 ms, faster than 96.15% of Python3 online submissions for Two Sum II - Input array is sorted. # Memory Usage: 14.3 MB, less than 5.80% of Python3 online submissions for Two Sum II - Input array is sorted. class Solution: # Two Pointers def twoSum(self, ...
class Solution: def two_sum(self, numbers: list[int], target: int) -> list[int]: start = 0 end = len(numbers) - 1 while start < end: sum_val = numbers[start] + numbers[end] if sum_val == target: return [start + 1, end + 1] elif sum_val < t...
# A plugin's setup symbol is supposed to be a function # which returns the plugin type. # # This plugin's setup function returns a number instead def setup(): return 5
def setup(): return 5
word = "mamba" def quack(x, y): return x * y class Duck: def quack(self): return "quack!"
word = 'mamba' def quack(x, y): return x * y class Duck: def quack(self): return 'quack!'
def knapsack(w, weights, values): table = [[0 for i in range(w + 1)] for j in range(len(weights) + 1)] for i in range(len(weights) + 1): for j in range(w + 1): if i == 0 or j == 0: table[i][j] = 0 elif weights[i - 1] <= j: # if weight[0, 1, etc] is <= cell's all...
def knapsack(w, weights, values): table = [[0 for i in range(w + 1)] for j in range(len(weights) + 1)] for i in range(len(weights) + 1): for j in range(w + 1): if i == 0 or j == 0: table[i][j] = 0 elif weights[i - 1] <= j: table[i][j] = max(values[...
class Funcionario(): def __init__(self, nome, salario): self.nome = nome self.salario = salario def aumentarSalario(self, porcentagem): self.salario += self.salario * (porcentagem / 100)
class Funcionario: def __init__(self, nome, salario): self.nome = nome self.salario = salario def aumentar_salario(self, porcentagem): self.salario += self.salario * (porcentagem / 100)
class Solution: def minTime(self, n: int, edges: List[List[int]], hasApple: List[bool]) -> int: AdjList = [set() for _ in range(n)] for (u, v) in edges: AdjList[u].add(v) AdjList[v].add(u) dfs_num = [0] * n count = [int(i) for i in hasApple] res = 0 ...
class Solution: def min_time(self, n: int, edges: List[List[int]], hasApple: List[bool]) -> int: adj_list = [set() for _ in range(n)] for (u, v) in edges: AdjList[u].add(v) AdjList[v].add(u) dfs_num = [0] * n count = [int(i) for i in hasApple] res = 0...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"bulba_url_for": "01_scraper.ipynb", "sanitize_name": "01_scraper.ipynb", "fetch_page_soup": "01_scraper.ipynb", "save_card_list": "01_scraper.ipynb", "load_card_list": "01...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'bulba_url_for': '01_scraper.ipynb', 'sanitize_name': '01_scraper.ipynb', 'fetch_page_soup': '01_scraper.ipynb', 'save_card_list': '01_scraper.ipynb', 'load_card_list': '01_scraper.ipynb', 'fetch_card_list': '01_scraper.ipynb', 'dedupe_image_urls': ...
''' Copyright (C) 2021 Simon D. Levy MIT License ''' # from gym_copter.sensors import vision # noqa: F401
""" Copyright (C) 2021 Simon D. Levy MIT License """
#Check for Prime numbers def is_prime(n): if n >= 2: for y in range(2,n): if not ( n % y ): return False else: return False return True #Alternate Solution def is_prime(n): return n > 1 and all(n % i for i in xrange(2, n))
def is_prime(n): if n >= 2: for y in range(2, n): if not n % y: return False else: return False return True def is_prime(n): return n > 1 and all((n % i for i in xrange(2, n)))
class Scheduler(object): def __init__(self, env, algorithm): self.env = env self.algorithm = algorithm self.simulation = None self.cluster = None self.destroyed = False self.valid_pairs = {} def attach(self, simulation): self.simulation = simulation ...
class Scheduler(object): def __init__(self, env, algorithm): self.env = env self.algorithm = algorithm self.simulation = None self.cluster = None self.destroyed = False self.valid_pairs = {} def attach(self, simulation): self.simulation = simulation ...
class Widget: pass w = Widget() print(type(w))
class Widget: pass w = widget() print(type(w))
N = int(input()) i = 0 while i < N: x, y = input().split(" ") x = int(x) y = int(y) if y == 0: print('divisao impossivel') else: print('{0}'.format(x/y)) i+=1
n = int(input()) i = 0 while i < N: (x, y) = input().split(' ') x = int(x) y = int(y) if y == 0: print('divisao impossivel') else: print('{0}'.format(x / y)) i += 1
''' Author: Brian Mukeswe Date: September 30, 2019 Contact: mukeswebrian@yahoo.com This class defines a volunteer that can be scheduled into a session ''' class Volunteer(): def __init__(self, volunteer_id): self.volunteer_id = volunteer_id self.max_daily_session...
""" Author: Brian Mukeswe Date: September 30, 2019 Contact: mukeswebrian@yahoo.com This class defines a volunteer that can be scheduled into a session """ class Volunteer: def __init__(self, volunteer_id): self.volunteer_id = volunteer_id self.max_daily_sessions = 4 self.availability = {}...
def h(): print("called h") raise Exception("oof") def g(): print("called g") h() def f(): print("called f") g() try: f() except: print("caught exception")
def h(): print('called h') raise exception('oof') def g(): print('called g') h() def f(): print('called f') g() try: f() except: print('caught exception')
def rev(n): rev=0 while (n > 0): remainder = n % 10 rev = (rev * 10) + remainder n = n // 10 return rev def emirp(n): if n<=1: return False else: for i in range(2,rev(n)): if n%i==0 or rev(n)%i==0: print( n,"IS NOT A...
def rev(n): rev = 0 while n > 0: remainder = n % 10 rev = rev * 10 + remainder n = n // 10 return rev def emirp(n): if n <= 1: return False else: for i in range(2, rev(n)): if n % i == 0 or rev(n) % i == 0: print(n, 'IS NOT AN EMIR...
##Q4. Write a program to calculate the distance between the two points. ############################################################################################################# ##Program Objective: to calculate the distance between the two points. ## ##Coded by: KNR ...
print('--------------------------------------------------') (x1, y1) = [int(i) for i in input('Enter coordinates of first point:').split(',')] (x2, y2) = [int(i) for i in input('Enter coordinates of second point:').split(',')] dist = ((x2 - x1) ** 2 - (y2 - y1) ** 2) ** 0.5 print('Distnace between two points are %8.2f:...
''' 1. Write a Python program to find whether it contains an additive sequence or not. The additive sequence is a sequence of numbers where the sum of the first two numbers is equal to the third one. Sample additive sequence: 6, 6, 12, 18, 30 In the above sequence 6 + 6 =12, 6 + 12 = 18, 12 + 18 = 30.... Also, you can...
""" 1. Write a Python program to find whether it contains an additive sequence or not. The additive sequence is a sequence of numbers where the sum of the first two numbers is equal to the third one. Sample additive sequence: 6, 6, 12, 18, 30 In the above sequence 6 + 6 =12, 6 + 12 = 18, 12 + 18 = 30.... Also, you can...
artist = { "first": "Neil", "last": "Young", } print(f'{artist =}') print('Concatenation Solution') print(f'{artist["first"] + " " + artist["last"] =}') print('Format() Solution') print(f'{"{} {}".format(artist["first"], artist["last"]) =}') print('f-String Solution') print(f'''{f"{artist[f'first']} {artist...
artist = {'first': 'Neil', 'last': 'Young'} print(f'artist ={artist!r}') print('Concatenation Solution') print(f"""artist["first"] + " " + artist["last"] ={artist['first'] + ' ' + artist['last']!r}""") print('Format() Solution') print(f""""{{}} {{}}".format(artist["first"], artist["last"]) ={'{} {}'.format(artist['firs...
def done_or_not(board): rows = board cols = [map(lambda x: x[i], board) for i in range(9)] squares = [ board[i][j:j + 3] + board[i + 1][j:j + 3] + board[i + 2][j:j + 3] for i in range(0, 9, 3) for j in range(0, 9, 3)] for clusters in (rows, cols, squares): ...
def done_or_not(board): rows = board cols = [map(lambda x: x[i], board) for i in range(9)] squares = [board[i][j:j + 3] + board[i + 1][j:j + 3] + board[i + 2][j:j + 3] for i in range(0, 9, 3) for j in range(0, 9, 3)] for clusters in (rows, cols, squares): for cluster in clusters: if ...
load("//conjure:conjure.bzl", _ir = "conjure_generate_ir") load("//conjure_rust:conjure_rust.bzl", _rs = "conjure_rust_generate") load("//conjure_typescript:conjure_typescript.bzl", _ts = "conjure_typescript_generate") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("//conjure:conjure.bzl", "...
load('//conjure:conjure.bzl', _ir='conjure_generate_ir') load('//conjure_rust:conjure_rust.bzl', _rs='conjure_rust_generate') load('//conjure_typescript:conjure_typescript.bzl', _ts='conjure_typescript_generate') load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') load('//conjure:conjure.bzl', 'conjure...
stylesheet = ''' #main_window{ background-image: url(smartcar1.png) } #Ui_SecondWindow{ background-image: url(smartcar2.png) } .QPushButton { border-radius: 10px; background-color: white; border: 1px solid black; } #buttonForward{ background-color: white; border-radius: 20px; } #button...
stylesheet = '\n\n\n#main_window{\n background-image: url(smartcar1.png)\n}\n\n#Ui_SecondWindow{\n background-image: url(smartcar2.png)\n}\n\n.QPushButton\n{\n border-radius: 10px;\n background-color: white;\n border: 1px solid black;\n}\n\n#buttonForward{\n background-color: white;\n border-radius...
#This file should remain in the git repository to inform users that the package can't be installed as is #it is expected to be replaced when package is generated NOT_BUILT_ERR = 'package not generated (refer to https://github.com/NVIDIA/aistore/blob/master/openapi/README.md#how-to-generate-package)' raise Exception(NO...
not_built_err = 'package not generated (refer to https://github.com/NVIDIA/aistore/blob/master/openapi/README.md#how-to-generate-package)' raise exception(NOT_BUILT_ERR)
class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: for i in range(len(nums)): for j in range(len(nums)): if nums[i]+nums[j] == target and i != j: return [i,j]
class Solution: def two_sum(self, nums: List[int], target: int) -> List[int]: for i in range(len(nums)): for j in range(len(nums)): if nums[i] + nums[j] == target and i != j: return [i, j]
class GitSpecifier: def __contains__(self, release): # check that this is GitRelease without imports return hasattr(release, 'commit') def __iadd__(self, other): if hasattr(other, '_attach'): attached = other._attach(self) if attached: return oth...
class Gitspecifier: def __contains__(self, release): return hasattr(release, 'commit') def __iadd__(self, other): if hasattr(other, '_attach'): attached = other._attach(self) if attached: return other return NotImplemented
uid = '12d1:155b' target = '1506' modeswitch = ( 'DefaultVendor = 0x12d1\n' 'DefaultProduct = 0x155b\n' 'TargetVendor = 0x12d1\n' 'TargetProduct = 0x1506\n' 'MessageContent = "55534243123456780000000000000011062000000100000000000000000000"\n' # noqa: E501 )
uid = '12d1:155b' target = '1506' modeswitch = 'DefaultVendor = 0x12d1\nDefaultProduct = 0x155b\nTargetVendor = 0x12d1\nTargetProduct = 0x1506\nMessageContent = "55534243123456780000000000000011062000000100000000000000000000"\n'
def fib(n): if n <= 1: return n if a[n]: return a[n] else: ans = fib(n - 1) + fib(n - 2) a[n] = ans return ans n = int(input("Enter a number\n")) a = [0] * (n + 1) print(fib(n))
def fib(n): if n <= 1: return n if a[n]: return a[n] else: ans = fib(n - 1) + fib(n - 2) a[n] = ans return ans n = int(input('Enter a number\n')) a = [0] * (n + 1) print(fib(n))
# Practice Python -- Simple examples # # This script has simple examples from the Practice Python website. Excercises are placed here if they are too short # or simple to warrant a standalone script. # Exercise 07 -- List comprehensions # # In a single line of Python code, take a list of numbers and create a new lis...
r = 4 % 2 r = 4 % 3 a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] b = [x for x in a if x % 2 == 0] a = [5, 10, 15, 20, 25] b = [a[0], a[-1]] c = [a[i] for i in range(len(a)) if (i == 0) | (i == len(a) - 1)]
class pda_state: def __init__(self, state_number, is_final, is_trap): self.state_number = state_number self.is_final = is_final self.is_trap = is_trap self.transitions = {} def add_transition(self, state2, letter, stack_pop_letter, stack_push_letter): self.transitions[...
class Pda_State: def __init__(self, state_number, is_final, is_trap): self.state_number = state_number self.is_final = is_final self.is_trap = is_trap self.transitions = {} def add_transition(self, state2, letter, stack_pop_letter, stack_push_letter): self.transitions[l...
# CONVERSIONS um_2_m = 1E-6 mm_2_m = 1E-3 m_2_mm = 1E3 m_2_um = 1E6 s_2_ms = 1E3 Pa_2_bar = 1E-5 uL_2_mL = 1E-3 min_2_s = 60 s_2_min = 1/60 uLmin_2_m3s = 1/60E9 # conversion from pixels to microns (camera and magnification-dependent) pix_per_um = {'chronos' : {4 : 1.34, # measured based on reference d...
um_2_m = 1e-06 mm_2_m = 0.001 m_2_mm = 1000.0 m_2_um = 1000000.0 s_2_ms = 1000.0 pa_2_bar = 1e-05 u_l_2_m_l = 0.001 min_2_s = 60 s_2_min = 1 / 60 u_lmin_2_m3s = 1 / 60000000000.0 pix_per_um = {'chronos': {4: 1.34, 10: 3.54}, 'photron': {4: 1 / 2.29, 10: 1.09, 20: 2.18}}
num = 123 d = {'age':12} def change(num,d): num -=1 d['age'] -= 1 change(num,d) print(num,d['age'])
num = 123 d = {'age': 12} def change(num, d): num -= 1 d['age'] -= 1 change(num, d) print(num, d['age'])
def prefixTester(words, prefix): return [x for x in words if prefix == x[0:len(prefix)]] print(prefixTester(["hello", "man", "jam", "amazing", "anaconda", "anal", "hellman", "hangman"], "b"))
def prefix_tester(words, prefix): return [x for x in words if prefix == x[0:len(prefix)]] print(prefix_tester(['hello', 'man', 'jam', 'amazing', 'anaconda', 'anal', 'hellman', 'hangman'], 'b'))
def grade(key, submission): if submission == "t00 many c00ks sp0il the br0th": return True, "Nice job, you solved it! Sometimes less is more!" else: return False, "Not quite there! Keep going!"
def grade(key, submission): if submission == 't00 many c00ks sp0il the br0th': return (True, 'Nice job, you solved it! Sometimes less is more!') else: return (False, 'Not quite there! Keep going!')
def findBestValue(arr: list[int], target: int) -> int: low = 0 high = max(arr) closest_diff = target best_value = 0 while low <= high: mid = (low + high) // 2 total = sum([min(x, mid) for x in arr]) diff = abs(total - target) if diff < closest_diff ...
def find_best_value(arr: list[int], target: int) -> int: low = 0 high = max(arr) closest_diff = target best_value = 0 while low <= high: mid = (low + high) // 2 total = sum([min(x, mid) for x in arr]) diff = abs(total - target) if diff < closest_diff or (diff == close...
# This file will hold the weapon-specific information # And will include the preferred combinations of attacks # And hold the basic information of cooldown times, etc. class WeaponBagFocused(): # The preferred layout of skills for this class is as follows: # a = overhand # s = backhand # d = cannon spi...
class Weaponbagfocused: def __init__(self, level=1) -> None: self.level = level def grab_base_cooldowns(self): cooldowns = {'a': 5.5} cooldowns['s'] = 5.3 cooldowns['d'] = 4.4 cooldowns['f'] = 8.8 cooldowns['g'] = 17 cooldowns['h'] = 41 cooldowns...
class Solution: def nextGreaterElement(self, nums1: List[int], nums2: List[int]) -> List[int]: ans = [] for i in nums1: ind = nums2.index(i); added = False for j in range(ind+1,len(nums2)): if nums2[j] > i: ans.append(nums2[j]); added = Tr...
class Solution: def next_greater_element(self, nums1: List[int], nums2: List[int]) -> List[int]: ans = [] for i in nums1: ind = nums2.index(i) added = False for j in range(ind + 1, len(nums2)): if nums2[j] > i: ans.append(nums2...
plan = int(input()) n = int(input()) leftover = 0 for i in range(n): p = int(input()) leftover += plan - p print(leftover + plan)
plan = int(input()) n = int(input()) leftover = 0 for i in range(n): p = int(input()) leftover += plan - p print(leftover + plan)
class Vector2D: def __init__(self, v: List[List[int]]): self.arr = v self.rows = len(v) self.i = self.j = 0 def next(self) -> int: if self.hasNext(): self.j += 1 return self.arr[self.i][self.j - 1] def hasNext(self) -> bool: if self.arr and s...
class Vector2D: def __init__(self, v: List[List[int]]): self.arr = v self.rows = len(v) self.i = self.j = 0 def next(self) -> int: if self.hasNext(): self.j += 1 return self.arr[self.i][self.j - 1] def has_next(self) -> bool: if self.arr and...
# Krzysztof Joachimiak 2018 # sciquence: Time series & sequences in Python # # Matrix manipulation utils # Author: Krzysztof Joachimiak # # License: MIT class KwargsParser(object): ''' Parsing keyword arguments ''' def __init__(self, kwargs, default=None): self.kwargs = kwargs ...
class Kwargsparser(object): """ Parsing keyword arguments """ def __init__(self, kwargs, default=None): self.kwargs = kwargs self.default = default def __getitem__(self, item): return self.get(item, default=self.default) def get(self, key, default=None): ...
#program to remove item(s) from set. num_set = set([0, 1, 3, 4, 5]) num_set.pop() print(num_set) num_set.pop() print(num_set)
num_set = set([0, 1, 3, 4, 5]) num_set.pop() print(num_set) num_set.pop() print(num_set)
def readAllNotes(notes_quantity): all_notes = [] for iterator in range(notes_quantity): note = int(input(f'Entre com a nota do aluno {iterator + 1}: ')) all_notes.append(note) return all_notes def checkClassPerformance(all_notes): for note in all_notes: if note <= 70: ...
def read_all_notes(notes_quantity): all_notes = [] for iterator in range(notes_quantity): note = int(input(f'Entre com a nota do aluno {iterator + 1}: ')) all_notes.append(note) return all_notes def check_class_performance(all_notes): for note in all_notes: if note <= 70: ...
class Colors: BLACK = '\033[0;30m' RED = '\033[0;31m' GREEN = '\033[0;32m' BROWN = '\033[0;33m' Blue = '\033[0;34m' PURPLE = '\033[0;35m' CYAN = '\033[0;36m' LIGHT_GRAY = '\033[0;37m' NOCOLOR = '\033[0m' @classmethod def str(cls, string, color): return '{color}{strin...
class Colors: black = '\x1b[0;30m' red = '\x1b[0;31m' green = '\x1b[0;32m' brown = '\x1b[0;33m' blue = '\x1b[0;34m' purple = '\x1b[0;35m' cyan = '\x1b[0;36m' light_gray = '\x1b[0;37m' nocolor = '\x1b[0m' @classmethod def str(cls, string, color): return '{color}{strin...
# Authors: David Mutchler, Dave Fisher, and many others before them. #niharika print('Hello, World') print('hi there') print('one', 'two', 'through my shoe') print(3 + 9) print('3 + 9', 'versus', 3 + 9) # DONE: After we talk together about the above, add PRINT statements that print: # DONE: 1. A Hello message to ...
print('Hello, World') print('hi there') print('one', 'two', 'through my shoe') print(3 + 9) print('3 + 9', 'versus', 3 + 9) print('Hello Evan, Henry, Tyler') print('Hello Allison, Cassie, Isabella ') print('Hello Annelise, Owen, Nikhil, Niharika') print('Hello Dave, Shijun, Derek') print('Hey Natalie') print('356748', ...
# ! Simples #for c in range(0, 7, 2): # print(c) #print('FIM') # ! Simples com variavel final #n = int(input('Digite um numero: ')) #for c in range (0, n+1): # print(c) #print('FIM') # ! Complexo, variavel inicial, final e regra #i = int(input('Inicio: ')) #f = int(input('Fim: ')) #p = int(input('Passo: ')...
s = 0 for c in range(0, 4): n = int(input('Digite um numero: ')) s = s + n print('A soma de todas os valores foi: {}'.format(s))
def remove_n_smallest(lst, n): return sorted(lst)[n:] def weekly_quizzes (arr): listr = list(map(float, arr)) grades = remove_n_smallest(listr,2) return (sum(float(i) for i in grades) / (len(grades)*10))*40 def Handins(arr): listr = list(map(float, arr)) listdiv = [i/2 for i in listr] grades = remove_n_smalles...
def remove_n_smallest(lst, n): return sorted(lst)[n:] def weekly_quizzes(arr): listr = list(map(float, arr)) grades = remove_n_smallest(listr, 2) return sum((float(i) for i in grades)) / (len(grades) * 10) * 40 def handins(arr): listr = list(map(float, arr)) listdiv = [i / 2 for i in listr] ...
class Solution: def maxDistance(self, arrays: List[List[int]]) -> int: k1,k2=[],[] z=-inf for i in range(len(arrays)): k1.append([arrays[i][0],i]) k2.append([arrays[i][-1],i]) k1.sort(key=lambda a:a[0]) k2.sort(key=lambda a:a[0],reverse=True) ...
class Solution: def max_distance(self, arrays: List[List[int]]) -> int: (k1, k2) = ([], []) z = -inf for i in range(len(arrays)): k1.append([arrays[i][0], i]) k2.append([arrays[i][-1], i]) k1.sort(key=lambda a: a[0]) k2.sort(key=lambda a: a[0], revers...
class Terrain: def __init__(self, engine): self.texture = engine.graphics.get_texture('dirt') self.mesh = engine.graphics.get_mesh('models/terrains/Level1') def draw(self, renderer): renderer.set_texture(self.texture) renderer.update_matrix() self.mesh.draw() class Pl...
class Terrain: def __init__(self, engine): self.texture = engine.graphics.get_texture('dirt') self.mesh = engine.graphics.get_mesh('models/terrains/Level1') def draw(self, renderer): renderer.set_texture(self.texture) renderer.update_matrix() self.mesh.draw() class Pla...
class Solution: def subdomainVisits(self, cpdomains): helper = {} for record in cpdomains: record_data = record.split(" ") record_data_domain = record_data[1].split('.') while len(record_data_domain) > 0: element = ".".join(record_data_domain) ...
class Solution: def subdomain_visits(self, cpdomains): helper = {} for record in cpdomains: record_data = record.split(' ') record_data_domain = record_data[1].split('.') while len(record_data_domain) > 0: element = '.'.join(record_data_domain) ...
# # PySNMP MIB module HUAWEI-PERFORMANCE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-PERFORMANCE-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:47:41 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constraint, single_value_constraint, constraints_intersection, constraints_union) ...
# swapping the function def swap(a,b): a,b = b,a return a,b if __name__ == '__main__': print(swap(3,4))
def swap(a, b): (a, b) = (b, a) return (a, b) if __name__ == '__main__': print(swap(3, 4))
# DO NOT EDIT BY HAND # This file was autogenerated by dump_obo_files.py at 2020-10-21T18:55:01.621812 terms = { 'MS:0000000': ('Proteomics Standards Initiative Mass Spectrometry Vocabularies', None), 'MS:1000001': ('sample number', 'xsd:string'), 'MS:1000002': ('sample name', 'xsd:string'), 'MS:1000003':...
terms = {'MS:0000000': ('Proteomics Standards Initiative Mass Spectrometry Vocabularies', None), 'MS:1000001': ('sample number', 'xsd:string'), 'MS:1000002': ('sample name', 'xsd:string'), 'MS:1000003': ('sample state', None), 'MS:1000004': ('sample mass', 'xsd:float'), 'MS:1000005': ('sample volume', 'xsd:float'), 'MS...
# default colors and colorscales, taken from plotly color_cycle = [ '#1f77b4', # muted blue '#ff7f0e', # safety orange '#2ca02c', # cooked asparagus green '#d62728', # brick red '#9467bd', # muted purple '#8c564b', # chestnut brown '#e377c2', # raspberry yogurt pink '#7f7f7f', # ...
color_cycle = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf'] colorscales_raw = {'Greys': [[0, 'rgb(0,0,0)'], [1, 'rgb(255,255,255)']], 'YlGnBu': [[0, 'rgb(8, 29, 88)'], [0.125, 'rgb(37, 52, 148)'], [0.25, 'rgb(34, 94, 168)'], [0.375, 'rgb(29, 145, 192)'], ...
config = { "in_pump": 17, "out_pump": 18, "high_float": 23, "low_float": 24, "timeout": 30, "delay": 20, "overfill": 15, "fill_timeout": 420, }
config = {'in_pump': 17, 'out_pump': 18, 'high_float': 23, 'low_float': 24, 'timeout': 30, 'delay': 20, 'overfill': 15, 'fill_timeout': 420}
step_1_group_by_type_and_subtype = { "$group": { "_id": {"goal": "$goal", "type": "$type", "subtype": "$subtype"}, "subTypeCount": {"$sum": 1}, "subTypeAmount": {"$sum": "$valuation"}, "schemes": { "$push": {"amfi": "$amfi", "name": "$name", "valuation": "$valuation"} ...
step_1_group_by_type_and_subtype = {'$group': {'_id': {'goal': '$goal', 'type': '$type', 'subtype': '$subtype'}, 'subTypeCount': {'$sum': 1}, 'subTypeAmount': {'$sum': '$valuation'}, 'schemes': {'$push': {'amfi': '$amfi', 'name': '$name', 'valuation': '$valuation'}}}} step_2_sort_subtype_amount_desc = {'$sort': {'subTy...
x=9 y=3 #Arthimetic Operators print(x+y) #addition print(x-y) #subtraction print(x*y) #multipication print(x/y) #divion print(x%y) #modulus operator print(x**y) #exponentiation x=9.191823 print(x//y) #floor division (round down) #Assignment operators x=9 #declare x=9 x+=3 #shorthand fo...
x = 9 y = 3 print(x + y) print(x - y) print(x * y) print(x / y) print(x % y) print(x ** y) x = 9.191823 print(x // y) x = 9 x += 3 print(x) x = 9 x -= 3 print(x) x *= 3 print(x) x /= 3 print(x) x **= 3 print(x) x = 9 y = 3 print(x == y) print(x != y) print(x > y) print(x < y) print(x >= y) print(x <= y)
def test_create_customer(post_request, paystack_api, mock_assertion): api_response = { "status": True, "message": "Customer created", "data": { "email": "bojack@horsinaround.com", "integration": 100032, "domain": "test", "customer_code": "CUS_x...
def test_create_customer(post_request, paystack_api, mock_assertion): api_response = {'status': True, 'message': 'Customer created', 'data': {'email': 'bojack@horsinaround.com', 'integration': 100032, 'domain': 'test', 'customer_code': 'CUS_xnxdt6s1zg1f4nx', 'id': 1173, 'createdAt': '2016-03-29T20:03:09.584Z', 'upd...
grouped = col.cards.groupby("cdeck") data = grouped.mean()["civl"].sort_values().tail() ax = data.plot.barh() ax.set_ylabel("Deck name") ax.set_xlabel("Average expected retention length/review interval [days]") ax.set_title("Average retention length per deck")
grouped = col.cards.groupby('cdeck') data = grouped.mean()['civl'].sort_values().tail() ax = data.plot.barh() ax.set_ylabel('Deck name') ax.set_xlabel('Average expected retention length/review interval [days]') ax.set_title('Average retention length per deck')
# Created by MechAviv # [Kimu] | [1102204] # Hidden Street : Tiru Forest OBJECT_1 = sm.getIntroNpcObjectID(1102204) sm.setSpeakerID(1102204) sm.setPlayerAsSpeaker() sm.sendNext("Kimu! You haven't seen the Master of Disguise, have you?") sm.setSpeakerID(1102204) sm.sendSay("Nope! Nothing to report! Search somewhere ...
object_1 = sm.getIntroNpcObjectID(1102204) sm.setSpeakerID(1102204) sm.setPlayerAsSpeaker() sm.sendNext("Kimu! You haven't seen the Master of Disguise, have you?") sm.setSpeakerID(1102204) sm.sendSay('Nope! Nothing to report! Search somewhere else!') sm.setSpeakerID(1102204) sm.setPlayerAsSpeaker() sm.sendSay("Yeah, ok...
myset={"apple","banana","cherry"} tropical= {"pineapple","mango","papaya"} print(myset) #Unorderd ,unchangelable and do not allow duplicate values # Once a set is created, you cannot change its items , but you can add new items print(len(myset)) print(type(myset)) #Important set() construtor thisset1=set((1,2,7,5,6,...
myset = {'apple', 'banana', 'cherry'} tropical = {'pineapple', 'mango', 'papaya'} print(myset) print(len(myset)) print(type(myset)) thisset1 = set((1, 2, 7, 5, 6, 8)) print(thisset1) for x in thisset1: print(x) print('banana' in myset) myset.add('kiwi') print(myset) myset.update(tropical) print(myset) thislist = [1...
# this files contains basic metadata about the project. This data will be used # (by default) in the base.html and index.html PROJECT_METADATA = { 'title': 'Shapes for 4dpuzzel', 'author': 'Peter Andorfer', 'subtitle': 'A django project to publish GIS data', 'description': 'please provdie some', 'g...
project_metadata = {'title': 'Shapes for 4dpuzzel', 'author': 'Peter Andorfer', 'subtitle': 'A django project to publish GIS data', 'description': 'please provdie some', 'github': 'https://github.com/acdh-oeaw/sh4d', 'purpose_de': 'Ziel von sh4d ist die Publikation von GIS Daten.', 'purpose_en': 'The purpose of sh4d is...
def printaparenteses(n,lista): for i in range(int(n)): lista.append(')') def printaAbre(n,lista): for i in range(int(n)): lista.append('(') def adicionaParenteses(l): lista = [] for i in range(len(l)): if((i < len(l) -1 ) and (int(l[i]) > int(l[i+1]))): if ((i > 0...
def printaparenteses(n, lista): for i in range(int(n)): lista.append(')') def printa_abre(n, lista): for i in range(int(n)): lista.append('(') def adiciona_parenteses(l): lista = [] for i in range(len(l)): if i < len(l) - 1 and int(l[i]) > int(l[i + 1]): if i > 0 an...
cure = { 'corona': [ {'name': "Azithromycin", 'potency': (250, 'mg'), 'days': 3, 'dose': "thrice a day", 'dose_qty': '1 tab'}, {'name': "Dexamethasone", 'potency': (2, 'mg'), 'days': 3, 'dose': "twice a day", 'dose_qty': '1 tab'...
cure = {'corona': [{'name': 'Azithromycin', 'potency': (250, 'mg'), 'days': 3, 'dose': 'thrice a day', 'dose_qty': '1 tab'}, {'name': 'Dexamethasone', 'potency': (2, 'mg'), 'days': 3, 'dose': 'twice a day', 'dose_qty': '1 tab'}], 'Pneumonia': [{'name': 'Azithromycin', 'potency': (500, 'mg'), 'days': 3, 'dose': 'twice a...
expected_output = { 'punt_cpu_q_statistics': { 'active_rxq_event': 16723, 'cpu_q_id': 18, 'cpu_q_name': 'CPU_Q_TRANSIT_TRAFFIC', 'packets_received_from_asic': 64564, 'rx_consumed_count': 0, 'rx_conversion_failure_dropped': 0, 'rx_dropped_count': 0, 'rx_intack_c...
expected_output = {'punt_cpu_q_statistics': {'active_rxq_event': 16723, 'cpu_q_id': 18, 'cpu_q_name': 'CPU_Q_TRANSIT_TRAFFIC', 'packets_received_from_asic': 64564, 'rx_consumed_count': 0, 'rx_conversion_failure_dropped': 0, 'rx_dropped_count': 0, 'rx_intack_count': 15377, 'rx_invalid_punt_cause': 0, 'rx_non_active_drop...
#====================================================================== # Code for solving day 3 of AoC 2018 #====================================================================== VERBOSE = True #------------------------------------------------------------------ #-----------------------------------------------------...
verbose = True def load_input(filename): my_list = [] with open(filename, 'r') as f: for line in f: my_list.append(parse_line(line)) return my_list def parse_line(line): (cid, at, coord, size) = line.split(' ') cid = int(cid[1:]) (x_coord, y_coord) = coord.split(',') x_...
# -*- coding: utf-8 -*- # https://www.zhihu.com/question/42768955 # https://blog.csdn.net/Yeoman92/article/details/75076166 if __name__ == '__main__': a = 1 print(dict(a=a).keys()) def b(a): print(list(dict(a=a).keys())[0]) c = 5 b(c) aaa = '23asa' bbb = 'kjljl2' def get_v...
if __name__ == '__main__': a = 1 print(dict(a=a).keys()) def b(a): print(list(dict(a=a).keys())[0]) c = 5 b(c) aaa = '23asa' bbb = 'kjljl2' def get_variable_name(var): loc = locals() for key in loc: if loc[key] == var: return key ...
#code https://practice.geeksforgeeks.org/problems/maximize-sum-after-k-negations/0 for _ in range(int(input())): n, k = map(int, input().split()) arr = list(map(int, input().split())) arr.sort() i=0 while k>0 and i<n: if arr[i]<0: arr[i]=-arr[i] k-=...
for _ in range(int(input())): (n, k) = map(int, input().split()) arr = list(map(int, input().split())) arr.sort() i = 0 while k > 0 and i < n: if arr[i] < 0: arr[i] = -arr[i] k -= 1 i += 1 if k % 2 != 0: arr.sort() arr[0] = -arr[0] prin...
class UnavailableFunctionError(RuntimeError): pass class AccountingPrincipleError(ValueError): pass
class Unavailablefunctionerror(RuntimeError): pass class Accountingprincipleerror(ValueError): pass
class WorkflowRegistry(object): def __init__(self): self.workflows = {} self.class_index = {} def add(self, name, cls): self.workflows[id(cls)] = self.workflows.get(id(cls), set()) self.workflows[id(cls)].add(name) self.class_index[id(cls)] = cls def get_class_field...
class Workflowregistry(object): def __init__(self): self.workflows = {} self.class_index = {} def add(self, name, cls): self.workflows[id(cls)] = self.workflows.get(id(cls), set()) self.workflows[id(cls)].add(name) self.class_index[id(cls)] = cls def get_class_fiel...
t=int(input()) matno=[] matdig=[] output=[] for i in range(t): matno.append(int(input())) matdig.append(input()) for i in range(len(matno)): no=matno[i] mat=matdig[i] dp=[[],[]] for j in range(0,no,2): dp[0].append(mat[j]) for j in range(1,no,2): dp[1].append(mat[j]) if(len(dp[0])>len(dp[1])): ...
t = int(input()) matno = [] matdig = [] output = [] for i in range(t): matno.append(int(input())) matdig.append(input()) for i in range(len(matno)): no = matno[i] mat = matdig[i] dp = [[], []] for j in range(0, no, 2): dp[0].append(mat[j]) for j in range(1, no, 2): dp[1].appe...
def matchcase(word): def replace(m): text = m.group() if text.isupper(): return word.upper() elif text.islower(): return word.lower() elif text[0].isupper(): return word.capitalize() else: return word return replace matchca...
def matchcase(word): def replace(m): text = m.group() if text.isupper(): return word.upper() elif text.islower(): return word.lower() elif text[0].isupper(): return word.capitalize() else: return word return replace matchca...
runes = dict() N, G = map(int,input().split()) for _ in range(N): R, Y = input().split() runes[R] = int(Y) input() X = input().split() res = sum([runes[r] for r in X]) print(res) print('My precioooous' if res < G else 'You shall pass!')
runes = dict() (n, g) = map(int, input().split()) for _ in range(N): (r, y) = input().split() runes[R] = int(Y) input() x = input().split() res = sum([runes[r] for r in X]) print(res) print('My precioooous' if res < G else 'You shall pass!')
# # PySNMP MIB module CLAVISTER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CLAVISTER-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:09:04 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, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, constraints_intersection, value_size_constraint, constraints_union) ...
n, b = input().split() n = int(n) points = 0 for i in range(0, n * 4): number, suit = input() nd_dict = { 'A': 11, 'K': 4, 'Q': 3, 'J': 2, 'T': 10, '9': 0, '8': 0, '7': 0 } d_dict = { 'A': 11, 'K': 4, 'Q': 3, ...
(n, b) = input().split() n = int(n) points = 0 for i in range(0, n * 4): (number, suit) = input() nd_dict = {'A': 11, 'K': 4, 'Q': 3, 'J': 2, 'T': 10, '9': 0, '8': 0, '7': 0} d_dict = {'A': 11, 'K': 4, 'Q': 3, 'J': 20, 'T': 10, '9': 14, '8': 0, '7': 0} if suit == b: points += d_dict[number] ...
A, B = input().split() len_a, len_b = len(A), len(B) index_a, index_b = 0, 0 flag = False for i in range(len_a): for j in range(len_b): if A[i] == B[j]: index_a, index_b = i, j flag = True break if flag: break for j in range(len_b): for i in range(len_a): ...
(a, b) = input().split() (len_a, len_b) = (len(A), len(B)) (index_a, index_b) = (0, 0) flag = False for i in range(len_a): for j in range(len_b): if A[i] == B[j]: (index_a, index_b) = (i, j) flag = True break if flag: break for j in range(len_b): for i in ...
# # This file contains the Python code from Program 8.7 of # "Data Structures and Algorithms # with Object-Oriented Design Patterns in Python" # by Bruno R. Preiss. # # Copyright (c) 2003 by Bruno R. Preiss, P.Eng. All rights reserved. # # http://www.brpreiss.com/books/opus7/programs/pgm08_07.txt # class HashTable(Sea...
class Hashtable(SearchableContainer): def f(self, obj): return hash(obj) def g(self, x): return abs(x) % len(self) def h(self, obj): return self.g(self.f(obj))
#!/usr/bin/env python # -*- coding: utf-8 -*- class MouseStateHandler(object): def __init__(self): self.buttons = {} self.position = {} def on_mouse_press(self, x, y, symbol, modifiers): self.buttons[symbol] = True def on_mouse_release(self, x, y, symbol, modifiers): self...
class Mousestatehandler(object): def __init__(self): self.buttons = {} self.position = {} def on_mouse_press(self, x, y, symbol, modifiers): self.buttons[symbol] = True def on_mouse_release(self, x, y, symbol, modifiers): self.buttons[symbol] = False def on_mouse_moti...
student = {"name": "Rolf", "grades": (89, 90, 93, 78, 90)} def average(sequence): return sum(sequence) / len(sequence) print(average(student["grades"])) # But wouldn't it be nice if we could... # print(student.average()) ? class Student: def __init__(self): self.name = "Rolf" self.grades ...
student = {'name': 'Rolf', 'grades': (89, 90, 93, 78, 90)} def average(sequence): return sum(sequence) / len(sequence) print(average(student['grades'])) class Student: def __init__(self): self.name = 'Rolf' self.grades = (89, 90, 93, 78, 90) def average(self): return sum(self.gra...
fora = 5 i = 0 while fora > 0: dentro = 0 while dentro < fora: print("oi") i = i + 1 dentro = dentro + 1 fora = fora - 1 print(i)
fora = 5 i = 0 while fora > 0: dentro = 0 while dentro < fora: print('oi') i = i + 1 dentro = dentro + 1 fora = fora - 1 print(i)
def app_default (app): empty_dict = {} if type(app) is dict: return app else: return empty_dict class FilterModule(object): def filters(self): return {'app_default': app_default}
def app_default(app): empty_dict = {} if type(app) is dict: return app else: return empty_dict class Filtermodule(object): def filters(self): return {'app_default': app_default}
{ "conditions" : [ # OSX # 1) use the portaudio configure # 2) make [ 'OS!="win"', { 'targets': [ { 'target_name': 'Configure', 'type': 'loadable_module', 'actions': [{ 'action_name': 'Configure', 'inputs': ['./configure'], 'action': [ './configure' ], ...
{'conditions': [['OS!="win"', {'targets': [{'target_name': 'Configure', 'type': 'loadable_module', 'actions': [{'action_name': 'Configure', 'inputs': ['./configure'], 'action': ['./configure'], 'outputs': ['dummy']}]}, {'target_name': 'Make', 'type': 'loadable_module', 'actions': [{'action_name': 'make', 'inputs': ['./...
pk = "0219426a5b641ed05ee639bfda80c1e0199182944977686d1dd1ea2dcb89e5dd55" node_info = ln.lnd.get_node_info(pk, include_channels=False) all_addresses = node_info.node.addresses if len(all_addresses) == 1: addr_index = 0 else: addr_index = 1 ln.lnd.connect_peer(pk, all_addresses[addr_index].addr) print(f"connec...
pk = '0219426a5b641ed05ee639bfda80c1e0199182944977686d1dd1ea2dcb89e5dd55' node_info = ln.lnd.get_node_info(pk, include_channels=False) all_addresses = node_info.node.addresses if len(all_addresses) == 1: addr_index = 0 else: addr_index = 1 ln.lnd.connect_peer(pk, all_addresses[addr_index].addr) print(f'connecte...
class EchoApi: def __init__(self, register_query, api_name): self.register_query = register_query self.api_name = api_name self.api_id = self.register_query(api_name, ["", ""] if self.api_name == 'login' else [], api=1) def rpcexec(self, method, params): return self.register_que...
class Echoapi: def __init__(self, register_query, api_name): self.register_query = register_query self.api_name = api_name self.api_id = self.register_query(api_name, ['', ''] if self.api_name == 'login' else [], api=1) def rpcexec(self, method, params): return self.register_qu...
monthDict = {1: 'January', 2: 'February', 3: 'March', 4: 'April', 5: 'May', 6: 'June', 7: 'July', 8: 'August', 9: 'September', 10: 'October', 11: 'November', 12: 'December'} def count_score(score): promoters, detractors, passive = score.get('promoters', 0), score.get('detractors', 0), score.get('pass...
month_dict = {1: 'January', 2: 'February', 3: 'March', 4: 'April', 5: 'May', 6: 'June', 7: 'July', 8: 'August', 9: 'September', 10: 'October', 11: 'November', 12: 'December'} def count_score(score): (promoters, detractors, passive) = (score.get('promoters', 0), score.get('detractors', 0), score.get('passive', 0)) ...
with open('input/day2.txt', 'r', encoding='utf8') as file: policies_and_passwords = file.readlines() valid_count1 = 0 valid_count2 = 0 for policy_and_password in policies_and_passwords: policy, password = policy_and_password.strip().split(': ') policy_range, policy_letter = policy.split(' ') policy_lo,...
with open('input/day2.txt', 'r', encoding='utf8') as file: policies_and_passwords = file.readlines() valid_count1 = 0 valid_count2 = 0 for policy_and_password in policies_and_passwords: (policy, password) = policy_and_password.strip().split(': ') (policy_range, policy_letter) = policy.split(' ') (policy...
def find_unique_int_size_limits(input_batches): i = 0 while i*62500000 < 4294967294: set_to_check = set(list(range(i*62500000, i*62500000+62500000))) for batch in input_batches: for element in batch: if element in set_to_check: set_to_check.remove(...
def find_unique_int_size_limits(input_batches): i = 0 while i * 62500000 < 4294967294: set_to_check = set(list(range(i * 62500000, i * 62500000 + 62500000))) for batch in input_batches: for element in batch: if element in set_to_check: set_to_check...
#child class can has its own attributes and methods #we can extend few attributes of parent class using super keyword #parent class class Employee(): def __init__(self, name, age, salary): self.name = name self.age = age self.salary = salary def work(self): print(f"{self.name}...
class Employee: def __init__(self, name, age, salary): self.name = name self.age = age self.salary = salary def work(self): print(f'{self.name} is working......') class Datascientist(Employee): def __init__(self, name, age, salary, level): super().__init__(name, a...
class Solution: def intersect(self, nums1: List[int], nums2: List[int]) -> List[int]: i1, i2 = 0, 0 nums1.sort() nums2.sort() result = [] while i1< len(nums1) and i2 < len(nums2): if nums1[i1] > nums2[i2]: i2+=1 ...
class Solution: def intersect(self, nums1: List[int], nums2: List[int]) -> List[int]: (i1, i2) = (0, 0) nums1.sort() nums2.sort() result = [] while i1 < len(nums1) and i2 < len(nums2): if nums1[i1] > nums2[i2]: i2 += 1 elif nums1[i1] <...
while True: print('What is your name') name=input() if name != 'Ram': continue print('Hello, Ram. What is your password') password = input() if password == 'swordfish': break else: print('Incorrect password, please enter the correct password') print('Access granted')
while True: print('What is your name') name = input() if name != 'Ram': continue print('Hello, Ram. What is your password') password = input() if password == 'swordfish': break else: print('Incorrect password, please enter the correct password') print('Access granted'...
#encoding:utf-8 subreddit = 'tiktokthots' t_channel = '@r_tiktokthots' def send_post(submission, r2t): return r2t.send_simple(submission)
subreddit = 'tiktokthots' t_channel = '@r_tiktokthots' def send_post(submission, r2t): return r2t.send_simple(submission)
# asks the user for their name and greets them with their name print("Hello") name = input("What's your name?") print("Hello", name) print("nice to meet you")
print('Hello') name = input("What's your name?") print('Hello', name) print('nice to meet you')
print('python101 - Enumerate') friends = ['Brian', 'Judith', 'Reg', 'Loretta', 'Colin'] i = 1 for friend in friends: print(i, friend) i = i +1 # += 1 for num, friend in enumerate(friends,1): print(num, friend) for friend in enumerate(friends,51): print(friend) for friend in enumerate(enumerate(friends,...
print('python101 - Enumerate') friends = ['Brian', 'Judith', 'Reg', 'Loretta', 'Colin'] i = 1 for friend in friends: print(i, friend) i = i + 1 for (num, friend) in enumerate(friends, 1): print(num, friend) for friend in enumerate(friends, 51): print(friend) for friend in enumerate(enumerate(friends, 51...
# Solution 1. recursive # O(N) / O(H) class Solution: def inorderTraversal(self, root: TreeNode) -> List[int]: arr = [] def inorder(node): if not node: return inorder(node.left) arr.append(node.val) inorder(node.right) inorder(r...
class Solution: def inorder_traversal(self, root: TreeNode) -> List[int]: arr = [] def inorder(node): if not node: return inorder(node.left) arr.append(node.val) inorder(node.right) inorder(root) return arr class Solu...
# # PySNMP MIB module WWP-LEOS-NTP-CLIENT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WWP-LEOS-NTP-CLIENT-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:38:06 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, value_range_constraint, constraints_intersection, single_value_constraint) ...