content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def rook_cells_under_attack(p, width=8, height=8): cells = [] for i in range(height): cells.append((p[0], i)) for i in range(width): cells.append((i, p[1])) return cells # TODO: add width and height parameters def bishop_cells_under_attack(p, width=8, height=8): cells = [] for k in range(max(width, height)): if p[0] + k <= width and p[1] + k <= height: cells.append((p[0] + k, p[1] + k)) if p[0] + k <= width and p[1] - k >= 0: cells.append((p[0] + k, p[1] - k)) if p[0] - k >= 0 and p[1] - k >= 0: cells.append((p[0] - k, p[1] - k)) if p[0] - k >= 0 and p[1] + k <= height: cells.append((p[0] - k, p[1] + k)) return cells def queen_cells_under_attack(p, width=8, height=8): return rook_cells_under_attack(p, width, height) + bishop_cells_under_attack(p, width, height)
def rook_cells_under_attack(p, width=8, height=8): cells = [] for i in range(height): cells.append((p[0], i)) for i in range(width): cells.append((i, p[1])) return cells def bishop_cells_under_attack(p, width=8, height=8): cells = [] for k in range(max(width, height)): if p[0] + k <= width and p[1] + k <= height: cells.append((p[0] + k, p[1] + k)) if p[0] + k <= width and p[1] - k >= 0: cells.append((p[0] + k, p[1] - k)) if p[0] - k >= 0 and p[1] - k >= 0: cells.append((p[0] - k, p[1] - k)) if p[0] - k >= 0 and p[1] + k <= height: cells.append((p[0] - k, p[1] + k)) return cells def queen_cells_under_attack(p, width=8, height=8): return rook_cells_under_attack(p, width, height) + bishop_cells_under_attack(p, width, height)
nome = str(input("Digite seu nome completo: ")).strip() nome = nome.lower() #verifica = nome.find('silva') > 0 print("Seu nome tem Silva? ") #print("{}".format(verifica)) print("{}".format("silva" in nome))
nome = str(input('Digite seu nome completo: ')).strip() nome = nome.lower() print('Seu nome tem Silva? ') print('{}'.format('silva' in nome))
# Solution # O(n*l) time / O(c) space # n - number of words # l - length of the longest word # c - number of unique characters across all words def minimumCharactersForWords(words): maximumCharacterFrequencies = {} for word in words: characterFrequencies = countCharacterFrequencies(word) updateMaximumFrequencies(characterFrequencies, maximumCharacterFrequencies) return makeArrayFromCharacterFrequencies(maximumCharacterFrequencies) def countCharacterFrequencies(string): characterFrequencies = {} for character in string: if character not in characterFrequencies: characterFrequencies[character] = 0 characterFrequencies[character] += 1 return characterFrequencies def updateMaximumFrequencies(frequencies, maximumFrequencies): for character in frequencies: frequency = frequencies[character] if character in maximumFrequencies: maximumFrequencies[character] = max(frequency, maximumFrequencies[character]) else: maximumFrequencies[character] = frequency def makeArrayFromCharacterFrequencies(characterFrequencies): characters = [] for character in characterFrequencies: frequency = characterFrequencies[character] for _ in range(frequency): characters.append(character) return characters
def minimum_characters_for_words(words): maximum_character_frequencies = {} for word in words: character_frequencies = count_character_frequencies(word) update_maximum_frequencies(characterFrequencies, maximumCharacterFrequencies) return make_array_from_character_frequencies(maximumCharacterFrequencies) def count_character_frequencies(string): character_frequencies = {} for character in string: if character not in characterFrequencies: characterFrequencies[character] = 0 characterFrequencies[character] += 1 return characterFrequencies def update_maximum_frequencies(frequencies, maximumFrequencies): for character in frequencies: frequency = frequencies[character] if character in maximumFrequencies: maximumFrequencies[character] = max(frequency, maximumFrequencies[character]) else: maximumFrequencies[character] = frequency def make_array_from_character_frequencies(characterFrequencies): characters = [] for character in characterFrequencies: frequency = characterFrequencies[character] for _ in range(frequency): characters.append(character) return characters
a = map(int, input().split()) b = map(int, input().split()) c = map(int, input().split()) d = map(int, input().split()) e = map(int, input().split()) _a, _b, _c, _d, _e = sum(a), sum(b), sum(c), sum(d), sum(e) m = max(_a, _b, _c, _d, _e) if m == _a: print(1, _a) elif m == _b: print(2, _b) elif m == _c: print(3, _c) elif m == _d: print(4, _d) elif m == _e: print(5, _e)
a = map(int, input().split()) b = map(int, input().split()) c = map(int, input().split()) d = map(int, input().split()) e = map(int, input().split()) (_a, _b, _c, _d, _e) = (sum(a), sum(b), sum(c), sum(d), sum(e)) m = max(_a, _b, _c, _d, _e) if m == _a: print(1, _a) elif m == _b: print(2, _b) elif m == _c: print(3, _c) elif m == _d: print(4, _d) elif m == _e: print(5, _e)
L=[23,45,88,23,56,78,96] Temp=L[0] L[0]=L[-1] L[-1]=Temp print(L)
l = [23, 45, 88, 23, 56, 78, 96] temp = L[0] L[0] = L[-1] L[-1] = Temp print(L)
# Time: O(n) # Space: O(1) class Solution(object): # @param {integer} s # @param {integer[]} nums # @return {integer} def minSubArrayLen(self, s, nums): start = 0 sum = 0 min_size = float("inf") for i in xrange(len(nums)): sum += nums[i] while sum >= s: min_size = min(min_size, i - start + 1) sum -= nums[start] start += 1 return min_size if min_size != float("inf") else 0 # Time: O(nlogn) # Space: O(n) # Binary search solution. class Solution2(object): # @param {integer} s # @param {integer[]} nums # @return {integer} def minSubArrayLen(self, s, nums): min_size = float("inf") sum_from_start = [n for n in nums] for i in xrange(len(sum_from_start) - 1): sum_from_start[i + 1] += sum_from_start[i] for i in xrange(len(sum_from_start)): end = self.binarySearch(lambda x, y: x <= y, sum_from_start, \ i, len(sum_from_start), \ sum_from_start[i] - nums[i] + s) if end < len(sum_from_start): min_size = min(min_size, end - i + 1) return min_size if min_size != float("inf") else 0 def binarySearch(self, compare, A, start, end, target): while start < end: mid = start + (end - start) / 2 if compare(target, A[mid]): end = mid else: start = mid + 1 return start
class Solution(object): def min_sub_array_len(self, s, nums): start = 0 sum = 0 min_size = float('inf') for i in xrange(len(nums)): sum += nums[i] while sum >= s: min_size = min(min_size, i - start + 1) sum -= nums[start] start += 1 return min_size if min_size != float('inf') else 0 class Solution2(object): def min_sub_array_len(self, s, nums): min_size = float('inf') sum_from_start = [n for n in nums] for i in xrange(len(sum_from_start) - 1): sum_from_start[i + 1] += sum_from_start[i] for i in xrange(len(sum_from_start)): end = self.binarySearch(lambda x, y: x <= y, sum_from_start, i, len(sum_from_start), sum_from_start[i] - nums[i] + s) if end < len(sum_from_start): min_size = min(min_size, end - i + 1) return min_size if min_size != float('inf') else 0 def binary_search(self, compare, A, start, end, target): while start < end: mid = start + (end - start) / 2 if compare(target, A[mid]): end = mid else: start = mid + 1 return start
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'test.db', 'TEST_NAME': 'test1.db', } } ROOT_URLCONF='testapp.urls' SITE_ID = 1 SECRET_KEY = "not very secret in tests" ALLOWED_HOSTS = ( 'testserver', '*' ) INSTALLED_APPS = ( "rest_framework", "testapp" ) MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', )
databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'test.db', 'TEST_NAME': 'test1.db'}} root_urlconf = 'testapp.urls' site_id = 1 secret_key = 'not very secret in tests' allowed_hosts = ('testserver', '*') installed_apps = ('rest_framework', 'testapp') middleware_classes = ('django.middleware.common.CommonMiddleware',)
#Write a Python program that reads your height in cms and converts your height to feet and inches. heightCM = float(input('Enter the height in CM: ')) totalInch = heightCM * 0.393701 heightInch = (totalInch % 12) heightFeet = (totalInch - heightInch)*0.0833333 print('The height is : ',heightFeet,' feet AND 163',heightInch,' inch')
height_cm = float(input('Enter the height in CM: ')) total_inch = heightCM * 0.393701 height_inch = totalInch % 12 height_feet = (totalInch - heightInch) * 0.0833333 print('The height is : ', heightFeet, ' feet AND 163', heightInch, ' inch')
#!/usr/bin/env python3.7 rules = {} with open('input.txt') as fd: for line in fd: words = line[:-1].split() this_bag = words[0]+ " " + words[1] rules[this_bag] = [] b = line[:-1].split('contain') bags = b[1].split(',') for bag in bags: words = bag.split() count = 0 try: count = int(words[0]) except: break new_bag = [count,words[1]+" "+words[2]] rules[this_bag].append(new_bag) def contains(rules, find): res = [] for f in find: for rule in rules: for bag in rules[rule]: if f in bag: res.append(rule) return res search_for = ['shiny gold'] final = {} while True: res = contains(rules,search_for) if res == []: break for bag in res: final[bag] = 1 search_for = res print(final.keys()) print(len(final))
rules = {} with open('input.txt') as fd: for line in fd: words = line[:-1].split() this_bag = words[0] + ' ' + words[1] rules[this_bag] = [] b = line[:-1].split('contain') bags = b[1].split(',') for bag in bags: words = bag.split() count = 0 try: count = int(words[0]) except: break new_bag = [count, words[1] + ' ' + words[2]] rules[this_bag].append(new_bag) def contains(rules, find): res = [] for f in find: for rule in rules: for bag in rules[rule]: if f in bag: res.append(rule) return res search_for = ['shiny gold'] final = {} while True: res = contains(rules, search_for) if res == []: break for bag in res: final[bag] = 1 search_for = res print(final.keys()) print(len(final))
ordered_params = ['vmax', 'km', 'k_synt_s', 'k_deg_s', 'k_deg_p'] n_vars = 2 def model(y, t, yout, p): #---------------------------------------------------------# #Parameters# #---------------------------------------------------------# vmax = p[0] km = p[1] k_synt_s = p[2] k_deg_s = p[3] k_deg_p = p[4] #---------------------------------------------------------# #Variables# #---------------------------------------------------------# _s = y[0] _p = y[1] #---------------------------------------------------------# #Differential Equations# #---------------------------------------------------------# yout[0] = ((-_s * vmax + (_s + km) * (-_s * k_deg_s + k_synt_s)) / (_s + km)) yout[1] = ((-_p * k_deg_p * (_s + km) + _s * vmax) / (_s + km))
ordered_params = ['vmax', 'km', 'k_synt_s', 'k_deg_s', 'k_deg_p'] n_vars = 2 def model(y, t, yout, p): vmax = p[0] km = p[1] k_synt_s = p[2] k_deg_s = p[3] k_deg_p = p[4] _s = y[0] _p = y[1] yout[0] = (-_s * vmax + (_s + km) * (-_s * k_deg_s + k_synt_s)) / (_s + km) yout[1] = (-_p * k_deg_p * (_s + km) + _s * vmax) / (_s + km)
def max_num_in_list( list ): max = list[ 0 ] for a in list: if a > max: max = a return max ls=[] n=int(input("Enter number of elements:")) for i in range(1,n+1): b=int(input("Enter element:")) ls.append(b) print("Max number in the list is:",max_num_in_list(ls))
def max_num_in_list(list): max = list[0] for a in list: if a > max: max = a return max ls = [] n = int(input('Enter number of elements:')) for i in range(1, n + 1): b = int(input('Enter element:')) ls.append(b) print('Max number in the list is:', max_num_in_list(ls))
iter_num = 0 def fib(num): global iter_num iter_num += 1 print("Iteration number {0}. num = {1}".format(iter_num, num)) # Base class for fibonnaci series if num==0 or num==1: return 1 # Recursive call else: return fib(num-1)+fib(num-2) if __name__ == '__main__': num = int(input("Enter a number: ")) ans = fib(num) print("Fibonnaci sum of the number is ", ans)
iter_num = 0 def fib(num): global iter_num iter_num += 1 print('Iteration number {0}. num = {1}'.format(iter_num, num)) if num == 0 or num == 1: return 1 else: return fib(num - 1) + fib(num - 2) if __name__ == '__main__': num = int(input('Enter a number: ')) ans = fib(num) print('Fibonnaci sum of the number is ', ans)
def getNext(instr): count=0 curch=instr[0] outstr=[] for ch in instr: if ch != curch: outstr.append(str(count)+curch) curch=ch count=1 else: count+=1 outstr.append(str(count)+curch) return ''.join(outstr) a=['1'] for i in range(31): a.append(getNext(a[i])) print(len(a[30]))
def get_next(instr): count = 0 curch = instr[0] outstr = [] for ch in instr: if ch != curch: outstr.append(str(count) + curch) curch = ch count = 1 else: count += 1 outstr.append(str(count) + curch) return ''.join(outstr) a = ['1'] for i in range(31): a.append(get_next(a[i])) print(len(a[30]))
# coding=utf-8 __author__ = 'Gareth Coles' class BaseAlgorithm(object): def hash(self, value, salt): pass def check(self, hash, value, salt): return hash == self.hash(value, salt) def gen_salt(self): pass
__author__ = 'Gareth Coles' class Basealgorithm(object): def hash(self, value, salt): pass def check(self, hash, value, salt): return hash == self.hash(value, salt) def gen_salt(self): pass
description = '' pages = ['header', 'my_account'] def setup(data): pass def test(data): navigate('http://store.demoqa.com/') click(header.my_account) verify_is_not_selected(my_account.remember_me) capture('Remember me is not selected') def teardown(data): pass
description = '' pages = ['header', 'my_account'] def setup(data): pass def test(data): navigate('http://store.demoqa.com/') click(header.my_account) verify_is_not_selected(my_account.remember_me) capture('Remember me is not selected') def teardown(data): pass
# Vamos a convertir un numero entero en una lista de sus digitos numero = int(input('Dime tu numero\n')) digitos =[] while numero !=0: digitos.insert(0,numero%10) numero //= 10 print('Los digitos de su numero son',digitos)
numero = int(input('Dime tu numero\n')) digitos = [] while numero != 0: digitos.insert(0, numero % 10) numero //= 10 print('Los digitos de su numero son', digitos)
def main(): input = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] output = findMaxConsecutiveOnes(input) print(output) def findMaxConsecutiveOnes(nums): globalMax = 0 count = 0 if (len(nums) == 0): return 0 for n in nums: if n == 1: count = count +n if(count > globalMax): globalMax = count elif n==0: count = 0 return globalMax if __name__ == '__main__': main()
def main(): input = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] output = find_max_consecutive_ones(input) print(output) def find_max_consecutive_ones(nums): global_max = 0 count = 0 if len(nums) == 0: return 0 for n in nums: if n == 1: count = count + n if count > globalMax: global_max = count elif n == 0: count = 0 return globalMax if __name__ == '__main__': main()
n=int(input().strip()) b=input().strip() step=0 for i in range(0,n-2): if(b[i]+b[i+1]+b[i+2]=='010'): step+=1 print(step)
n = int(input().strip()) b = input().strip() step = 0 for i in range(0, n - 2): if b[i] + b[i + 1] + b[i + 2] == '010': step += 1 print(step)
SHOWNAMES = [ "ap1/product-id", "ap1/adc0", "ap1/adc1", "ap1/adc2", "ap1/din0", "ap1/din1", "ap1/din2", "ap1/din3", "ap1/led1", "ap1/led2", "ap1/device-id", "ap1/vendor-id", "ap1/dout0", "ap1/dout1", "ap1/dout2", "ap1/dout3", "ap1/reset", "ap1/dout-enable", "ap1/hw-version", "capability/adc", "capability/din", "capability/gps", "capability/dout", "capability/lora", "capability/wifi", "capability/bluetooth", "device-id", "eth-reset", "gpiob/product-id", "gpiob/adc0", "gpiob/adc1", "gpiob/adc2", "gpiob/din0", "gpiob/din1", "gpiob/din2", "gpiob/din3", "gpiob/led1", "gpiob/led2", "gpiob/device-id", "gpiob/vendor-id", "gpiob/dout0", "gpiob/dout1", "gpiob/dout2", "gpiob/dout3", "gpiob/reset", "gpiob/dout-enable", "gpiob/hw-version", "has-radio", "hw-version", "imei", "led-a", "led-b", "led-c", "led-cd", "led-d", "led-sig1", "led-sig2", "led-sig3", "led-status", "mac-eth", "product-id", "reset", "reset-monitor", "reset-monitor-intervals", "uuid", "vendor-id", ]
shownames = ['ap1/product-id', 'ap1/adc0', 'ap1/adc1', 'ap1/adc2', 'ap1/din0', 'ap1/din1', 'ap1/din2', 'ap1/din3', 'ap1/led1', 'ap1/led2', 'ap1/device-id', 'ap1/vendor-id', 'ap1/dout0', 'ap1/dout1', 'ap1/dout2', 'ap1/dout3', 'ap1/reset', 'ap1/dout-enable', 'ap1/hw-version', 'capability/adc', 'capability/din', 'capability/gps', 'capability/dout', 'capability/lora', 'capability/wifi', 'capability/bluetooth', 'device-id', 'eth-reset', 'gpiob/product-id', 'gpiob/adc0', 'gpiob/adc1', 'gpiob/adc2', 'gpiob/din0', 'gpiob/din1', 'gpiob/din2', 'gpiob/din3', 'gpiob/led1', 'gpiob/led2', 'gpiob/device-id', 'gpiob/vendor-id', 'gpiob/dout0', 'gpiob/dout1', 'gpiob/dout2', 'gpiob/dout3', 'gpiob/reset', 'gpiob/dout-enable', 'gpiob/hw-version', 'has-radio', 'hw-version', 'imei', 'led-a', 'led-b', 'led-c', 'led-cd', 'led-d', 'led-sig1', 'led-sig2', 'led-sig3', 'led-status', 'mac-eth', 'product-id', 'reset', 'reset-monitor', 'reset-monitor-intervals', 'uuid', 'vendor-id']
def merge(left, right, sorted_lst): i, j, k = 0, 0, 0 while i < len(left) and j < len(right): if left[i] <= right[j]: sorted_lst[k] = left[i] i += 1 else: sorted_lst[k] = right[j] j += 1 k += 1 while i < len(left): sorted_lst[k] = left[i] i += 1 k += 1 while j < len(right): sorted_lst[k] = right[j] j += 1 k += 1 return sorted_lst def mergesort(arr: list): if len(arr) > 1: mid = len(arr) // 2 left, right = mergesort(arr[:mid]), mergesort(arr[mid:]) return merge(left, right, arr) return arr def min_pair_arr(arr): arr = mergesort(arr) min_pair = abs(arr[1] - arr[0]), arr[1], arr[0] for i in range(1, len(arr)): dist = abs(arr[i] - arr[i - 1]) if dist < min_pair[0]: min_pair = dist, arr[i - 1], arr[i] return min_pair[1:] if __name__ == "__main__": arr = [6,2, 1,9, 3, 0, 5, 23 , 73, 123, 4] print(mergesort(arr)) print(min_pair_arr(arr))
def merge(left, right, sorted_lst): (i, j, k) = (0, 0, 0) while i < len(left) and j < len(right): if left[i] <= right[j]: sorted_lst[k] = left[i] i += 1 else: sorted_lst[k] = right[j] j += 1 k += 1 while i < len(left): sorted_lst[k] = left[i] i += 1 k += 1 while j < len(right): sorted_lst[k] = right[j] j += 1 k += 1 return sorted_lst def mergesort(arr: list): if len(arr) > 1: mid = len(arr) // 2 (left, right) = (mergesort(arr[:mid]), mergesort(arr[mid:])) return merge(left, right, arr) return arr def min_pair_arr(arr): arr = mergesort(arr) min_pair = (abs(arr[1] - arr[0]), arr[1], arr[0]) for i in range(1, len(arr)): dist = abs(arr[i] - arr[i - 1]) if dist < min_pair[0]: min_pair = (dist, arr[i - 1], arr[i]) return min_pair[1:] if __name__ == '__main__': arr = [6, 2, 1, 9, 3, 0, 5, 23, 73, 123, 4] print(mergesort(arr)) print(min_pair_arr(arr))
# vestlus:admin:actions def make_read(model, request, queryset): queryset.update(read=True) make_read.short_description = "Mark as read" def make_unread(model, request, queryset): queryset.update(read=False) make_unread.short_description = "Mark as unread" def make_private(model, request, queryset): queryset.update(is_private=True) make_private.short_description = "Make private" def make_public(model, request, queryset): queryset.update(is_private=False) make_public.short_description = "Make public"
def make_read(model, request, queryset): queryset.update(read=True) make_read.short_description = 'Mark as read' def make_unread(model, request, queryset): queryset.update(read=False) make_unread.short_description = 'Mark as unread' def make_private(model, request, queryset): queryset.update(is_private=True) make_private.short_description = 'Make private' def make_public(model, request, queryset): queryset.update(is_private=False) make_public.short_description = 'Make public'
class FeedMiddleware(object): def __init__(self, app): self.app = app def __call__(self, environ, start_response): if self.is_atom_feed(environ['PATH_INFO']): def _start_response(status, headers, exc_info=None): return start_response(status, self.set_charset(headers), exc_info) else: _start_response = start_response return self.app(environ, _start_response) @staticmethod def set_charset(headers, charset='utf-8'): for header in headers: attr, value = header if attr.lower() == 'content-type': if '; ' not in value: value += '; charset={}'.format(charset) yield (attr, value) @staticmethod def is_atom_feed(path_info): return path_info.startswith('/feeds/') and path_info.endswith('.atom')
class Feedmiddleware(object): def __init__(self, app): self.app = app def __call__(self, environ, start_response): if self.is_atom_feed(environ['PATH_INFO']): def _start_response(status, headers, exc_info=None): return start_response(status, self.set_charset(headers), exc_info) else: _start_response = start_response return self.app(environ, _start_response) @staticmethod def set_charset(headers, charset='utf-8'): for header in headers: (attr, value) = header if attr.lower() == 'content-type': if '; ' not in value: value += '; charset={}'.format(charset) yield (attr, value) @staticmethod def is_atom_feed(path_info): return path_info.startswith('/feeds/') and path_info.endswith('.atom')
var = 0 print("Hello!") while var < 10: print(10 - var, end="\n") var += 2
var = 0 print('Hello!') while var < 10: print(10 - var, end='\n') var += 2
def main(): # input ABCs = [*map(int, input().split())] # compute # output print(2 * sum([ABCs[i-1]*ABCs[i] for i in range(3)])) if __name__ == '__main__': main()
def main(): ab_cs = [*map(int, input().split())] print(2 * sum([ABCs[i - 1] * ABCs[i] for i in range(3)])) if __name__ == '__main__': main()
#Q.1 Convert tuples to list. tup=(5,4,2,'a',16,'ram') #this is a tuples. l=[] #this is empty list. lenght=len(tup) for i in (tup): l.append(i) print("list converted form tuples is :",l)
tup = (5, 4, 2, 'a', 16, 'ram') l = [] lenght = len(tup) for i in tup: l.append(i) print('list converted form tuples is :', l)
#A particularly hard problem to solve class Solution: def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float: #Suppose we have two arrays that are sorted #l1 = [1,2,3] #l2 = [4,5,6] #L1 + L2 = [1,2,3,4,5,6] #The median 3.5. #Notice that the index where 3,4 are located is basically the maximum of the left split. And the right split of the union of the 2 arryas #Well this implies a good algorithm too use #We basically split the indexes of both arrays 2 parts each. First assume that 3 and 4 is where we can split off #Then the left partitions [1,2,4] and right partition is [3,5,6] #Then basically the the left partitions can be broken again on the median [1,2] and [2,4] #The right partition is again brokn on the median [3,5] and [5,6] #Notice that 2 and 5 were the medians on their respected parition we use discard them but then maximum(1,3) is used. And then minimum [4,6] is used. #So averaging out (3,4) is 3.5 #The same idea applies when we add 2 sets and get odd numbers #Get the lenghts of the two arrays x = len(nums1) y = len(nums2) #Since we always want the median of the smaller array. We will want to swap them. If they are equal then this doesnt matter #Since python is extremely anal about calling methods on itself in a clas. We have to say self if y < x: return self.findMedianSortedArrays(nums2,nums1) start = 0 end = x #If start becomes greater than the end then we cant partitition arrays in ascending order while(start <= end): #Create a partition based on the (start + (min(x,y))/2) pivotx = int((start + end)/2) pivoty = int((x + y + 1)/2) - pivotx #These cases occur if find that a partition is the length of the entire array #Particularly the mininums edge case occurs if the pivot winds up taking up the arrya #The maximum edge cases occurs if the pivot gets completely reduced to zero maxLeftX = -(sys.maxsize-1 ) if pivotx == 0 else nums1[pivotx-1] minRightX = sys.maxsize if pivotx == x else nums1[pivotx] maxLeftY = -(sys.maxsize-1) if pivoty == 0 else nums2[pivoty-1] minRightY = sys.maxsize if pivoty == y else nums2[pivoty] #We care about these specific integers to get the conclusion we so desired. #Which is the maximum of the Left partitions of each array and the minimum of each partition in the Right partition of each arryas #It is up the reader to understand why we can get the medium through these four numbers if(maxLeftX <= minRightY and maxLeftY <= minRightX): #We found the correct partition #return their specific cases #In the case of even. The median the average of the maximum(maxLeftx,maxLefty) and min(minRightX,minRightY) if (x+y) % 2 == 0: maximum = max(maxLeftX,maxLeftY) minimum = min(minRightX,minRightY) return float((maximum + minimum)/2 ) #Otherwise its the maximum between the maximum of the left partition of X and Y else: return float(max(maxLeftX,maxLeftY)) #We gone too far in the array. We need to move the pivot back elif maxLeftX > minRightY: end = pivotx -1 else: #We gone too far back in the array. We need to the move the pivote forward start = pivotx + 1
class Solution: def find_median_sorted_arrays(self, nums1: List[int], nums2: List[int]) -> float: x = len(nums1) y = len(nums2) if y < x: return self.findMedianSortedArrays(nums2, nums1) start = 0 end = x while start <= end: pivotx = int((start + end) / 2) pivoty = int((x + y + 1) / 2) - pivotx max_left_x = -(sys.maxsize - 1) if pivotx == 0 else nums1[pivotx - 1] min_right_x = sys.maxsize if pivotx == x else nums1[pivotx] max_left_y = -(sys.maxsize - 1) if pivoty == 0 else nums2[pivoty - 1] min_right_y = sys.maxsize if pivoty == y else nums2[pivoty] if maxLeftX <= minRightY and maxLeftY <= minRightX: if (x + y) % 2 == 0: maximum = max(maxLeftX, maxLeftY) minimum = min(minRightX, minRightY) return float((maximum + minimum) / 2) else: return float(max(maxLeftX, maxLeftY)) elif maxLeftX > minRightY: end = pivotx - 1 else: start = pivotx + 1
epsilon = 0.001 def sqr_root(low,high,n,const_value): mid = (low+high)/2.0 mid_2 = mid for _i in range(n-1): mid_2*=mid dif = mid_2 - const_value if abs(dif) <= epsilon: return mid elif mid_2 > const_value: return sqr_root(low,mid,n,const_value) elif mid_2 < const_value: return sqr_root(mid,high,n,const_value) def find_nth_root(value, n): low = 0 high = value return sqr_root(low,high,n,value) def main(): print(find_nth_root(12345,3)) if __name__ == "__main__": main()
epsilon = 0.001 def sqr_root(low, high, n, const_value): mid = (low + high) / 2.0 mid_2 = mid for _i in range(n - 1): mid_2 *= mid dif = mid_2 - const_value if abs(dif) <= epsilon: return mid elif mid_2 > const_value: return sqr_root(low, mid, n, const_value) elif mid_2 < const_value: return sqr_root(mid, high, n, const_value) def find_nth_root(value, n): low = 0 high = value return sqr_root(low, high, n, value) def main(): print(find_nth_root(12345, 3)) if __name__ == '__main__': main()
#! /usr/bin/python3 # seesway.py -- This script counts from -10 to 10 and then back from 10 to -10 # Author -- Prince Oppong Boamah<regioths@gmail.com> # Date -- 27th August 2015 for i in range(-10, 11): print(i) for i in range(9, -1, -1): print(i) for i in range(-10, 0): print(i)
for i in range(-10, 11): print(i) for i in range(9, -1, -1): print(i) for i in range(-10, 0): print(i)
#WAP to input marks of 5 subject and find average and assign grade sub1=int(input("Enter marks of the first subject: ")) sub2=int(input("Enter marks of the second subject: ")) sub3=int(input("Enter marks of the third subject: ")) sub4=int(input("Enter marks of the fourth subject: ")) sub5=int(input("Enter marks of the fifth subject: ")) total=(sub1+sub2+sub3+sub4+sub4) avg=total/5 if(avg>=90): print("Grade: O") elif(avg>=80 and avg<=89): print("Grade: E") elif(avg>=70 and avg<=79): print("Grade: A") elif(avg<70): print("Grade: B")
sub1 = int(input('Enter marks of the first subject: ')) sub2 = int(input('Enter marks of the second subject: ')) sub3 = int(input('Enter marks of the third subject: ')) sub4 = int(input('Enter marks of the fourth subject: ')) sub5 = int(input('Enter marks of the fifth subject: ')) total = sub1 + sub2 + sub3 + sub4 + sub4 avg = total / 5 if avg >= 90: print('Grade: O') elif avg >= 80 and avg <= 89: print('Grade: E') elif avg >= 70 and avg <= 79: print('Grade: A') elif avg < 70: print('Grade: B')
class Solution: def thirdMax(self, nums: List[int]) -> int: maxs = [-float('inf'),-float('inf'),-float('inf')] m = 0 for i in range(len(nums)): if nums[i] not in maxs: if m < 3 : maxs[m] = nums[i] m += 1 if m == 3: maxs = sorted(maxs) else: if nums[i] > maxs[0]: j = len(maxs) - 1 while j >= 0: if nums[i] > maxs[j]: for k in range(j): maxs[k] = maxs[k+1] maxs[j] = nums[i] break j -= 1 if m > 2: return maxs[0] else: if maxs[0] > maxs[1]: return maxs[0] else: return maxs[1]
class Solution: def third_max(self, nums: List[int]) -> int: maxs = [-float('inf'), -float('inf'), -float('inf')] m = 0 for i in range(len(nums)): if nums[i] not in maxs: if m < 3: maxs[m] = nums[i] m += 1 if m == 3: maxs = sorted(maxs) elif nums[i] > maxs[0]: j = len(maxs) - 1 while j >= 0: if nums[i] > maxs[j]: for k in range(j): maxs[k] = maxs[k + 1] maxs[j] = nums[i] break j -= 1 if m > 2: return maxs[0] elif maxs[0] > maxs[1]: return maxs[0] else: return maxs[1]
VERSION = '0.2' TYPE = 'type' LIBRML = 'libRML' ITEM = 'item' ID = 'id' ACTIONS = 'actions' RESTRICTIONS = 'restrictions' PERMISSION = 'permission' TENANT = 'tenant' MENTION = 'mention' SHARE = 'sharealike' USAGEGUIDE = 'usageguide' TEMPLATE = 'template' #XML XRESTRICTION = 'restriction' XACTION = 'action' XPART = 'part' XGROUP = 'group' XSUBNET = 'subnet' XMACHINE = 'machine' # Fieldnames SUBNET = 'subnet' GROUPS = 'groups' PARTS = 'parts' MINAGE = 'minage' INSIDE = 'inside' OUTSIDE = 'outside' MACHINES = 'machines' FROMDATE = 'fromdate' TODATE = 'todate' DURATION = 'duration' COUNT = 'count' SESSIONS = 'sessions' WATERMARK = 'watermarkvalue' COMMERCIAL = 'commercialuse' NONCOMMERCIAL = 'noncommercialuse' MAXRES = 'maxresolution' MAXBIT = 'maxbitrate'
version = '0.2' type = 'type' librml = 'libRML' item = 'item' id = 'id' actions = 'actions' restrictions = 'restrictions' permission = 'permission' tenant = 'tenant' mention = 'mention' share = 'sharealike' usageguide = 'usageguide' template = 'template' xrestriction = 'restriction' xaction = 'action' xpart = 'part' xgroup = 'group' xsubnet = 'subnet' xmachine = 'machine' subnet = 'subnet' groups = 'groups' parts = 'parts' minage = 'minage' inside = 'inside' outside = 'outside' machines = 'machines' fromdate = 'fromdate' todate = 'todate' duration = 'duration' count = 'count' sessions = 'sessions' watermark = 'watermarkvalue' commercial = 'commercialuse' noncommercial = 'noncommercialuse' maxres = 'maxresolution' maxbit = 'maxbitrate'
def factorial(n): if(n == 0): return 1 else: return n*factorial(n-1) if __name__ == "__main__": number = int(input("Enter number:")) print(f'Factorial of {number} is {factorial(number)}')
def factorial(n): if n == 0: return 1 else: return n * factorial(n - 1) if __name__ == '__main__': number = int(input('Enter number:')) print(f'Factorial of {number} is {factorial(number)}')
A = True B = False C = A and B D = A or B if C == True: print("A and B is True.") else: print("A and B is False.") if D == True: print("A or B is True.") else: print("A or B is False.")
a = True b = False c = A and B d = A or B if C == True: print('A and B is True.') else: print('A and B is False.') if D == True: print('A or B is True.') else: print('A or B is False.')
class Tile(): def __init__(self,bomb=False): self.bomb = False self.revealed = False self.nearBombs = 0 def isBomb(self): return self.bomb def isRevealed(self): return self.revealed def setBomb(self): self.bomb=True def setNearBombs(self,near = 0): self.nearBombs = near def getNearBombs(self): return self.nearBombs def revealTile(self): self.revealed = True def printer(self): if self.revealed: if(self.bomb): return "x" if self.nearBombs == 0: return " " else: return str(self.nearBombs) else: return "#" def debugPrinter(self): if self.bomb: return "x" if self.nearBombs == 0: return " " else: return str(self.nearBombs)
class Tile: def __init__(self, bomb=False): self.bomb = False self.revealed = False self.nearBombs = 0 def is_bomb(self): return self.bomb def is_revealed(self): return self.revealed def set_bomb(self): self.bomb = True def set_near_bombs(self, near=0): self.nearBombs = near def get_near_bombs(self): return self.nearBombs def reveal_tile(self): self.revealed = True def printer(self): if self.revealed: if self.bomb: return 'x' if self.nearBombs == 0: return ' ' else: return str(self.nearBombs) else: return '#' def debug_printer(self): if self.bomb: return 'x' if self.nearBombs == 0: return ' ' else: return str(self.nearBombs)
### CONFIGS ### dataset = 'cora' model = 'VGAE' input_dim = 10 hidden1_dim = 32 hidden2_dim = 16 use_feature = True num_epoch = 2000 learning_rate = 0.01
dataset = 'cora' model = 'VGAE' input_dim = 10 hidden1_dim = 32 hidden2_dim = 16 use_feature = True num_epoch = 2000 learning_rate = 0.01
# clut.py. # # clut.py Teletext colour lookup table # Maintains colour lookups # # Copyright (c) 2020 Peter Kwan # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # # This holds the colour lookup tables read in by packet 28 etc. # I think we have four CLUTs 0 to 3. Here is what the standard says: ## 8 background full intensity colours: ## Magenta, Cyan, White. Black, Red, Green, Yellow, Blue, ## 7 foreground full intensity colours: ## Cyan, White. Red, Green, Yellow, Blue, Magenta, ## Invoked as spacing attributes via codes in packets X/0 to X/25. ## Black foreground: Invoked as a spacing attribute via codes in packets X/0 ## to X/25. ## 32 colours per page. The Colour Map contains four CLUTs ## (numbered 0 - 3), each of 8 entries. Each entry has a four bit resolution for ## the RGB components, subclause 12.4. ## Presentation ## Level ## 1 1.5 2.5 3.5 ## { { ~ ~ ## ~ ~ ~ ~ ## { { ~ ~ ## { { ~ ~ ## Colour Definition ## CLUT 0 defaults to the full intensity colours used as spacing colour ## attributes at Levels 1 and 1.5. ## CLUT 1, entry 0 is defined to be transparent. CLUT 1, entries 1 to 7 default ## to half intensity versions of CLUT 0, entries 1 to 7. ## CLUTs 2 and 3 have the default values specified in subclause 12.4. CLUTs ## 2 and 3 can be defined for a particular page by packet X/28/0 Format 1, or ## for all pages in magazine M by packet M/29/0. ## Colour Selection ## CLUT 0, entries 1 to 7 are selectable directly by the Level 1 data as ## spacing attributes. CLUTs 0 to 3 are selectable via packets 26 or objects ## as non-spacing attributes. ## The foreground and background colour codes on the Level 1 page may be ## used to select colours from other parts of the Colour Map. Different CLUTs ## may be selected for both foreground and background colours. ## This mapping information is transmitted in packet X/28/0 Format 1 for the ## associated page and in packet M/29/0 for all pages in magazine M. ## With the exception of entry 0 in CLUT 1 (transparent), CLUTs 0 and 1 can ## be redefined for a particular page by packet X/28/4, or ## class Clut: def __init__(self): print ("Clut loaded") self.clut0 = [0] * 8 # Default full intensity colours self.clut1 = [0] * 8 # default half intensity colours self.clut2 = [0] * 8 self.clut3 = [0] * 8 # set defaults self.reset() # Used by X26/0 to swap entire cluts # @param colour - Colour index 0..7 # @param remap - Remap 0..7 # @param foreground - True for foreground coilour, or False for background # @return - Colour string for tkinter. eg. 'black' or '#000' def RemapColourTable(self, colourIndex, remap, foreground): if type(colourIndex) != int: print('[RemapColourTable] colourIndex is not an integer' + colourIndex + ". foreground = " +str(foreground)) clutIndex = 0 if foreground: if remap>4: clutIndex = 2 elif remap<3: clutIndex = 0 else: clutIndex = 1 else: # background if remap < 3: clutIndex = remap elif remap == 3 or remap == 5: clutIndex = 1 elif remap == 4 or remap == 6: clutIndex = 2 else: clutIndex = 3 return self.get_value(clutIndex, colourIndex) def reset(self): # To values from table 12.4 # CLUT 0 full intensity self.clut0[0] = '#000' # black self.clut0[1] = '#f00' # red self.clut0[2] = '#0f0' # green self.clut0[3] = '#ff0' # yellow self.clut0[4] = '#00f' # blue self.clut0[5] = '#f0f' # magenta self.clut0[6] = '#0ff' # cyan self.clut0[7] = '#fff' # white # CLUT 1 half intensity self.clut1[0] = '#000' # transparent self.clut1[1] = '#700' # half red self.clut1[2] = '#070' # half green self.clut1[3] = '#770' # half yellow self.clut1[4] = '#007' # half blue self.clut1[5] = '#707' # half magenta self.clut1[6] = '#077' # half cyan self.clut1[7] = '#777' # half white # CLUT 2 lovely colours self.clut2[0] = '#f05' # crimsonish self.clut2[1] = '#f70' # orangish self.clut2[2] = '#0f7' # blueish green self.clut2[3] = '#ffb' # pale yellow self.clut2[4] = '#0ca' # cyanish self.clut2[5] = '#500' # dark red self.clut2[6] = '#652' # hint of a tint of runny poo self.clut2[7] = '#c77' # gammon # CLUT 3 more lovely colours self.clut3[0] = '#333' # pastel black self.clut3[1] = '#f77' # pastel red self.clut3[2] = '#7f7' # pastel green self.clut3[3] = '#ff7' # pastel yellow self.clut3[4] = '#77f' # pastel blue self.clut3[5] = '#f7f' # pastel magenta self.clut3[6] = '#7ff' # pastel cyan self.clut3[7] = '#ddd' # pastel white # set a value in a particular clut # Get the colour from a particular clut # Probably want to record which cluts are selected # Lots of stuff # @param colour - 12 bit web colour string eg. '#1ab' # @param clut_index CLUT index 0 to 3 # @param clr_index - 0..7 colour index def set_value(self, colour, clut_index, clr_index): clr_index = clr_index % 8 # need to trap this a bit better. This is masking a problem clut_index = clut_index % 4 if clut_index==0: self.clut0[clr_index] = colour; if clut_index==1: self.clut1[clr_index] = colour; if clut_index==2: self.clut2[clr_index] = colour; if clut_index==3: self.clut3[clr_index] = colour; print("clut value: clut" + str(clut_index) + " set[" + str(clr_index) + '] = ' + colour) # @return colour - 12 bit web colour string eg. '#1ab' # @param clut_index CLUT index 0 to 3 # @param clr_index - 0..7 colour index def get_value(self, clut_index, clr_index): clut_index = clut_index % 4 clr_index = clr_index % 8 if clut_index == 0: return self.clut0[clr_index] if clut_index == 1: return self.clut1[clr_index] if clut_index == 2: return self.clut2[clr_index] if clut_index == 3: return self.clut3[clr_index] return 0 # just in case! # debug dump the clut contents def dump(self): print("[Dump] CLUT values") for i in range(8): print(self.clut0[i] + ', ', end='') print() for i in range(8): print(self.clut1[i] + ', ', end='') print() for i in range(8): print(self.clut2[i] + ', ', end='') print() for i in range(8): print(self.clut3[i] + ', ', end='') print() clut = Clut()
class Clut: def __init__(self): print('Clut loaded') self.clut0 = [0] * 8 self.clut1 = [0] * 8 self.clut2 = [0] * 8 self.clut3 = [0] * 8 self.reset() def remap_colour_table(self, colourIndex, remap, foreground): if type(colourIndex) != int: print('[RemapColourTable] colourIndex is not an integer' + colourIndex + '. foreground = ' + str(foreground)) clut_index = 0 if foreground: if remap > 4: clut_index = 2 elif remap < 3: clut_index = 0 else: clut_index = 1 elif remap < 3: clut_index = remap elif remap == 3 or remap == 5: clut_index = 1 elif remap == 4 or remap == 6: clut_index = 2 else: clut_index = 3 return self.get_value(clutIndex, colourIndex) def reset(self): self.clut0[0] = '#000' self.clut0[1] = '#f00' self.clut0[2] = '#0f0' self.clut0[3] = '#ff0' self.clut0[4] = '#00f' self.clut0[5] = '#f0f' self.clut0[6] = '#0ff' self.clut0[7] = '#fff' self.clut1[0] = '#000' self.clut1[1] = '#700' self.clut1[2] = '#070' self.clut1[3] = '#770' self.clut1[4] = '#007' self.clut1[5] = '#707' self.clut1[6] = '#077' self.clut1[7] = '#777' self.clut2[0] = '#f05' self.clut2[1] = '#f70' self.clut2[2] = '#0f7' self.clut2[3] = '#ffb' self.clut2[4] = '#0ca' self.clut2[5] = '#500' self.clut2[6] = '#652' self.clut2[7] = '#c77' self.clut3[0] = '#333' self.clut3[1] = '#f77' self.clut3[2] = '#7f7' self.clut3[3] = '#ff7' self.clut3[4] = '#77f' self.clut3[5] = '#f7f' self.clut3[6] = '#7ff' self.clut3[7] = '#ddd' def set_value(self, colour, clut_index, clr_index): clr_index = clr_index % 8 clut_index = clut_index % 4 if clut_index == 0: self.clut0[clr_index] = colour if clut_index == 1: self.clut1[clr_index] = colour if clut_index == 2: self.clut2[clr_index] = colour if clut_index == 3: self.clut3[clr_index] = colour print('clut value: clut' + str(clut_index) + ' set[' + str(clr_index) + '] = ' + colour) def get_value(self, clut_index, clr_index): clut_index = clut_index % 4 clr_index = clr_index % 8 if clut_index == 0: return self.clut0[clr_index] if clut_index == 1: return self.clut1[clr_index] if clut_index == 2: return self.clut2[clr_index] if clut_index == 3: return self.clut3[clr_index] return 0 def dump(self): print('[Dump] CLUT values') for i in range(8): print(self.clut0[i] + ', ', end='') print() for i in range(8): print(self.clut1[i] + ', ', end='') print() for i in range(8): print(self.clut2[i] + ', ', end='') print() for i in range(8): print(self.clut3[i] + ', ', end='') print() clut = clut()
# record all kinds of type # pm type LINKEDIN_TYPE = 1 PM_LANG_ITEM_TYPE = 0 PM_CITY_ITEM_TYPE = 1 PM_SERVICE_ITEM_TYPE = 2 REALTOR_MESSAGE_TYPE = 3 #quiz type PM_QUIZ_TYPE = 0 #pm inspection report note type PM_INSPECTION_REPORT_TYPE = 3 PM_EXPENSE_TYPE = 4 #user progress bar USER_PROGRESS_BAR_TYPE = 0 HOME_PROGRESS_BAR_TYPE = 1 #pm bill incomes type PM_INCOME_TYPE = 0 #picture type PIC_AVATAR_TYPE = 0 PIC_URL_TYPE = 1 #file type FILE_S3_TYPE = 0 #status log type STATUS_LOG_USER_TYPE = 0 #extra file type EXTRA_USER_INSPECTION_REPORT_TYPE = 0 EXTRA_USER_CONTRACT_TYEP = 1 #submit type EXPENSE_SUBMIT_TYPE = 0 # census report type CENSUS_REPORT_TYPE_STATE = 0 CENSUS_REPORT_TYPE_MSA = 1 CENSUS_REPORT_TYPE_COUNTY = 2 CENSUS_REPORT_TYPE_CITY = 3 CENSUS_REPORT_TYPE_TOWN = 4 CENSUS_REPORT_TYPE_NEIGHBORHOOD = 5 CENSUS_REPORT_TYPE_ZIPCODE = 6
linkedin_type = 1 pm_lang_item_type = 0 pm_city_item_type = 1 pm_service_item_type = 2 realtor_message_type = 3 pm_quiz_type = 0 pm_inspection_report_type = 3 pm_expense_type = 4 user_progress_bar_type = 0 home_progress_bar_type = 1 pm_income_type = 0 pic_avatar_type = 0 pic_url_type = 1 file_s3_type = 0 status_log_user_type = 0 extra_user_inspection_report_type = 0 extra_user_contract_tyep = 1 expense_submit_type = 0 census_report_type_state = 0 census_report_type_msa = 1 census_report_type_county = 2 census_report_type_city = 3 census_report_type_town = 4 census_report_type_neighborhood = 5 census_report_type_zipcode = 6
if request.isInit: lastVal = 0 else: if lastVal == 0: lastVal = 1 else: lastVal = (lastVal << 1) & 0xFFFFFFFF request.value = lastVal
if request.isInit: last_val = 0 else: if lastVal == 0: last_val = 1 else: last_val = lastVal << 1 & 4294967295 request.value = lastVal
# Copyright 2009, UCAR/Unidata # Enumerate the kinds of Sax Events received by the SaxEventHandler STARTDOCUMENT = 1 ENDDOCUMENT = 2 STARTELEMENT = 3 ENDELEMENT = 4 ATTRIBUTE = 5 CHARACTERS = 6 # Define printable output _MAP = { STARTDOCUMENT: "STARTDOCUMENT", ENDDOCUMENT: "ENDDOCUMENT", STARTELEMENT: "STARTELEMENT", ENDELEMENT: "ENDELEMENT", ATTRIBUTE: "ATTRIBUTE", CHARACTERS: "CHARACTERS" } def tostring(t) : return _MAP[t]
startdocument = 1 enddocument = 2 startelement = 3 endelement = 4 attribute = 5 characters = 6 _map = {STARTDOCUMENT: 'STARTDOCUMENT', ENDDOCUMENT: 'ENDDOCUMENT', STARTELEMENT: 'STARTELEMENT', ENDELEMENT: 'ENDELEMENT', ATTRIBUTE: 'ATTRIBUTE', CHARACTERS: 'CHARACTERS'} def tostring(t): return _MAP[t]
def select_k_items(stream, n, k): reservoir = [] for i in range(k): reservoir.append(stream[i]) if __name__ == '__main__': stream = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] n = len(stream) k = 5 select_k_items(stream, n, k)
def select_k_items(stream, n, k): reservoir = [] for i in range(k): reservoir.append(stream[i]) if __name__ == '__main__': stream = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] n = len(stream) k = 5 select_k_items(stream, n, k)
class Solution: def majorityElement(self, nums: list[int]) -> list[int]: candidate1, candidate2 = 0, 0 count1, count2 = 0, 0 for num in nums: if candidate1 == num: count1 += 1 continue if candidate2 == num: count2 += 1 continue # NOTE: count checks must come AFTER candidate == num checks # to ensure we're not adding the count of an already existing # candidate to the a new number instead. if count1 == 0: candidate1 = num count1 += 1 continue if count2 == 0: candidate2 = num count2 += 1 continue # If we have reached this point, # we have found 3 different items, which we can count out. count1 -= 1 count2 -= 1 result = set() for candidate in (candidate1, candidate2): if nums.count(candidate) > len(nums) // 3: result.add(candidate) return list(result) tests = [ ( ([3, 2, 3],), [3], ), ( ([1],), [1], ), ( ([1, 2],), [1, 2], ), ( ([2, 2],), [2], ), ( ([2, 1, 1, 3, 1, 4, 5, 6],), [1], ), ]
class Solution: def majority_element(self, nums: list[int]) -> list[int]: (candidate1, candidate2) = (0, 0) (count1, count2) = (0, 0) for num in nums: if candidate1 == num: count1 += 1 continue if candidate2 == num: count2 += 1 continue if count1 == 0: candidate1 = num count1 += 1 continue if count2 == 0: candidate2 = num count2 += 1 continue count1 -= 1 count2 -= 1 result = set() for candidate in (candidate1, candidate2): if nums.count(candidate) > len(nums) // 3: result.add(candidate) return list(result) tests = [(([3, 2, 3],), [3]), (([1],), [1]), (([1, 2],), [1, 2]), (([2, 2],), [2]), (([2, 1, 1, 3, 1, 4, 5, 6],), [1])]
memo=[0, 1] def fib_digits(n): if len(memo)==2: for i in range(2, 100001): memo.append(memo[i-1]+memo[i-2]) num=str(memo[n]) res=[] for i in range(0,10): check=num.count(str(i)) if check: res.append((check, i)) return sorted(res, reverse=True)
memo = [0, 1] def fib_digits(n): if len(memo) == 2: for i in range(2, 100001): memo.append(memo[i - 1] + memo[i - 2]) num = str(memo[n]) res = [] for i in range(0, 10): check = num.count(str(i)) if check: res.append((check, i)) return sorted(res, reverse=True)
# Question 1: Write a program that asks the user to enter a string. The program should then print the following: # a) The total number of characters in the string # b) The string repeated 10 times # c) The first character of the string # d) The first three characters of the string # e) The last three characters of the string # f) The string backwards # g) The seventh character of the string if the string is long enough and a message otherwise # h) The string with its first and last characters removed # i) The string in all caps # j) The string with every a replaced with an e # k) The string with every character replaced by an * string=input("enter a string") print(len(string)) print(string*10) print(string[0]) print(string[0:3]) print(string[-3:]) print(string[: :-1]) if len(string) >= 7: print(string[7]) else: print("the string is shorter than 7 charecters") print(string[1:-1]) print(string.upper()) print(string.replace('a', 'e')) print('*'*len(string))
string = input('enter a string') print(len(string)) print(string * 10) print(string[0]) print(string[0:3]) print(string[-3:]) print(string[::-1]) if len(string) >= 7: print(string[7]) else: print('the string is shorter than 7 charecters') print(string[1:-1]) print(string.upper()) print(string.replace('a', 'e')) print('*' * len(string))
_base_ = [ '../swin/cascade_mask_rcnn_swin_small_patch4_window7_mstrain_480-800_giou_4conv1f_adamw_3x_coco.py' ] model = dict( backbone=dict( type='CBSwinTransformer', ), neck=dict( type='CBFPN', ), test_cfg = dict( rcnn=dict( score_thr=0.001, nms=dict(type='soft_nms'), ) ) ) img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) albu_train_transforms = [ dict( type='ShiftScaleRotate', shift_limit=0.0, scale_limit=0.0, rotate_limit=20, interpolation=1, p=0.2), ] train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations', with_bbox=True), dict(type='RandomFlip', flip_ratio=0.5), dict(type='AutoAugment', policies=[ [ dict(type='Resize', img_scale=[(320, 320), (384, 384), (448, 448), (512, 512), (576, 576)], multiscale_mode='value', keep_ratio=True) ], [ dict(type='Resize', img_scale=[(320, 320), (576, 576)], multiscale_mode='value', keep_ratio=True), dict(type='RandomCrop', crop_type='absolute_range', crop_size=(320, 320), allow_negative_crop=True), dict(type='Resize', img_scale=[(320, 320), (384, 384), (448, 448), (512, 512), (576, 576)], multiscale_mode='value', override=True, keep_ratio=True) ] ]), dict(type='Normalize', **img_norm_cfg), dict(type='Pad', size_divisor=32), dict(type='DefaultFormatBundle'), dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']), ] test_pipeline = [ dict(type='LoadImageFromFile'), dict( type='MultiScaleFlipAug', img_scale=[(320, 320), (576, 576)], flip=True, transforms=[ dict(type='Resize', keep_ratio=True), dict(type='RandomFlip'), dict(type='Normalize', **img_norm_cfg), dict(type='Pad', size_divisor=32), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img']), ]) ] samples_per_gpu=2 data = dict(samples_per_gpu=samples_per_gpu, train=dict(pipeline=train_pipeline), val=dict(pipeline=test_pipeline), test=dict(pipeline=test_pipeline)) optimizer = dict(lr=0.0001*(samples_per_gpu/2))
_base_ = ['../swin/cascade_mask_rcnn_swin_small_patch4_window7_mstrain_480-800_giou_4conv1f_adamw_3x_coco.py'] model = dict(backbone=dict(type='CBSwinTransformer'), neck=dict(type='CBFPN'), test_cfg=dict(rcnn=dict(score_thr=0.001, nms=dict(type='soft_nms')))) img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) albu_train_transforms = [dict(type='ShiftScaleRotate', shift_limit=0.0, scale_limit=0.0, rotate_limit=20, interpolation=1, p=0.2)] train_pipeline = [dict(type='LoadImageFromFile'), dict(type='LoadAnnotations', with_bbox=True), dict(type='RandomFlip', flip_ratio=0.5), dict(type='AutoAugment', policies=[[dict(type='Resize', img_scale=[(320, 320), (384, 384), (448, 448), (512, 512), (576, 576)], multiscale_mode='value', keep_ratio=True)], [dict(type='Resize', img_scale=[(320, 320), (576, 576)], multiscale_mode='value', keep_ratio=True), dict(type='RandomCrop', crop_type='absolute_range', crop_size=(320, 320), allow_negative_crop=True), dict(type='Resize', img_scale=[(320, 320), (384, 384), (448, 448), (512, 512), (576, 576)], multiscale_mode='value', override=True, keep_ratio=True)]]), dict(type='Normalize', **img_norm_cfg), dict(type='Pad', size_divisor=32), dict(type='DefaultFormatBundle'), dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels'])] test_pipeline = [dict(type='LoadImageFromFile'), dict(type='MultiScaleFlipAug', img_scale=[(320, 320), (576, 576)], flip=True, transforms=[dict(type='Resize', keep_ratio=True), dict(type='RandomFlip'), dict(type='Normalize', **img_norm_cfg), dict(type='Pad', size_divisor=32), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img'])])] samples_per_gpu = 2 data = dict(samples_per_gpu=samples_per_gpu, train=dict(pipeline=train_pipeline), val=dict(pipeline=test_pipeline), test=dict(pipeline=test_pipeline)) optimizer = dict(lr=0.0001 * (samples_per_gpu / 2))
def test_index(man): errors = [] G = man.writeTest() G.addIndex("Person", "name") G.addVertex("1", "Person", {"name": "marko", "age": "29"}) G.addVertex("2", "Person", {"name": "vadas", "age": "27"}) G.addVertex("3", "Software", {"name": "lop", "lang": "java"}) G.addVertex("4", "Person", {"name": "josh", "age": "32"}) G.addVertex("5", "Software", {"name": "ripple", "lang": "java"}) G.addVertex("6", "Person", {"name": "peter", "age": "35"}) G.addVertex("7", "Person", {"name": "marko", "age": "35"}) G.addEdge("1", "3", "created", {"weight": 0.4}) G.addEdge("1", "2", "knows", {"weight": 0.5}) G.addEdge("1", "4", "knows", {"weight": 1.0}) G.addEdge("4", "3", "created", {"weight": 0.4}) G.addEdge("6", "3", "created", {"weight": 0.2}) G.addEdge("4", "5", "created", {"weight": 1.0}) resp = G.listIndices() found = False for i in resp: if i["field"] == "name" and i["label"] == "Person": found = True if not found: errors.append("Expected index not found") return errors
def test_index(man): errors = [] g = man.writeTest() G.addIndex('Person', 'name') G.addVertex('1', 'Person', {'name': 'marko', 'age': '29'}) G.addVertex('2', 'Person', {'name': 'vadas', 'age': '27'}) G.addVertex('3', 'Software', {'name': 'lop', 'lang': 'java'}) G.addVertex('4', 'Person', {'name': 'josh', 'age': '32'}) G.addVertex('5', 'Software', {'name': 'ripple', 'lang': 'java'}) G.addVertex('6', 'Person', {'name': 'peter', 'age': '35'}) G.addVertex('7', 'Person', {'name': 'marko', 'age': '35'}) G.addEdge('1', '3', 'created', {'weight': 0.4}) G.addEdge('1', '2', 'knows', {'weight': 0.5}) G.addEdge('1', '4', 'knows', {'weight': 1.0}) G.addEdge('4', '3', 'created', {'weight': 0.4}) G.addEdge('6', '3', 'created', {'weight': 0.2}) G.addEdge('4', '5', 'created', {'weight': 1.0}) resp = G.listIndices() found = False for i in resp: if i['field'] == 'name' and i['label'] == 'Person': found = True if not found: errors.append('Expected index not found') return errors
DEFAULT_CHUNK_SIZE = 1000 def chunked_iterator(qs, size=DEFAULT_CHUNK_SIZE): qs = qs._clone() qs.query.clear_ordering(force_empty=True) qs.query.add_ordering('pk') last_pk = None empty = False while not empty: sub_qs = qs if last_pk: sub_qs = sub_qs.filter(pk__gt=last_pk) sub_qs = sub_qs[:size] empty = True for o in sub_qs: last_pk = o.pk empty = False yield o
default_chunk_size = 1000 def chunked_iterator(qs, size=DEFAULT_CHUNK_SIZE): qs = qs._clone() qs.query.clear_ordering(force_empty=True) qs.query.add_ordering('pk') last_pk = None empty = False while not empty: sub_qs = qs if last_pk: sub_qs = sub_qs.filter(pk__gt=last_pk) sub_qs = sub_qs[:size] empty = True for o in sub_qs: last_pk = o.pk empty = False yield o
indent = 3 key = "foo" print('\n%s%*s' % (indent, len(key)+3, 'Hello')) # ok: variable length print("%.*f" % (indent, 1.2345)) def myprint(x, *args): print("%.3f %.4f %10.3f %1.*f" % (x, x, x, 3, x)) myprint(3)
indent = 3 key = 'foo' print('\n%s%*s' % (indent, len(key) + 3, 'Hello')) print('%.*f' % (indent, 1.2345)) def myprint(x, *args): print('%.3f %.4f %10.3f %1.*f' % (x, x, x, 3, x)) myprint(3)
PAGES_FOLDER = 'pages' PUBLIC_FOLDER = 'public' STATIC_FOLDER = 'static' TEMPLATE_NAME = 'template.mustache'
pages_folder = 'pages' public_folder = 'public' static_folder = 'static' template_name = 'template.mustache'
teisuu = 1 suuji_kous = 3 aru = 2 zenn = 0 for ai in range(suuji_kous): zenn += teisuu*aru**ai print(zenn)
teisuu = 1 suuji_kous = 3 aru = 2 zenn = 0 for ai in range(suuji_kous): zenn += teisuu * aru ** ai print(zenn)
# elasticmodels/tests/test_settings.py # author: andrew young # email: ayoung@thewulf.org DATABASES = { "default": { "ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:", } } ROOT_URLCONF = ["elasticmodels.urls"] INSTALLED_APPS = ["elasticmodels"]
databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}} root_urlconf = ['elasticmodels.urls'] installed_apps = ['elasticmodels']
# Python - 2.7.6 Test.describe('Basic Tests') data = [2] Test.assert_equals(print_array(data), '2') data = [2, 4, 5, 2] Test.assert_equals(print_array(data), '2,4,5,2') data = [2, 4, 5, 2] Test.assert_equals(print_array(data), '2,4,5,2') data = [2.0, 4.2, 5.1, 2.2] Test.assert_equals(print_array(data), '2.0,4.2,5.1,2.2') data = ['2', '4', '5', '2'] Test.assert_equals(print_array(data), '2,4,5,2') data = [True, False, False] Test.assert_equals(print_array(data), 'True,False,False') array1 = ['hello', 'this', 'is', 'an', 'array!'] array2 = ['a', 'b', 'c', 'd', 'e!'] data = array1 + array2 Test.assert_equals(print_array(data), 'hello,this,is,an,array!,a,b,c,d,e!') array1 = ['hello', 'this', 'is', 'an', 'array!'] array2 = [1, 2, 3, 4, 5] data = [array1, array2] Test.assert_equals(print_array(data), "['hello', 'this', 'is', 'an', 'array!'],[1, 2, 3, 4, 5]")
Test.describe('Basic Tests') data = [2] Test.assert_equals(print_array(data), '2') data = [2, 4, 5, 2] Test.assert_equals(print_array(data), '2,4,5,2') data = [2, 4, 5, 2] Test.assert_equals(print_array(data), '2,4,5,2') data = [2.0, 4.2, 5.1, 2.2] Test.assert_equals(print_array(data), '2.0,4.2,5.1,2.2') data = ['2', '4', '5', '2'] Test.assert_equals(print_array(data), '2,4,5,2') data = [True, False, False] Test.assert_equals(print_array(data), 'True,False,False') array1 = ['hello', 'this', 'is', 'an', 'array!'] array2 = ['a', 'b', 'c', 'd', 'e!'] data = array1 + array2 Test.assert_equals(print_array(data), 'hello,this,is,an,array!,a,b,c,d,e!') array1 = ['hello', 'this', 'is', 'an', 'array!'] array2 = [1, 2, 3, 4, 5] data = [array1, array2] Test.assert_equals(print_array(data), "['hello', 'this', 'is', 'an', 'array!'],[1, 2, 3, 4, 5]")
def result(score): min = max = score[0] min_count = max_count = 0 for i in score[1:]: if i > max: max_count += 1 max = i if i < min: min_count += 1 min = i return max_count, min_count n = input() score = list(map(int, input().split())) print(*result(score))
def result(score): min = max = score[0] min_count = max_count = 0 for i in score[1:]: if i > max: max_count += 1 max = i if i < min: min_count += 1 min = i return (max_count, min_count) n = input() score = list(map(int, input().split())) print(*result(score))
DEFAULT_PRAGMAS = ( "akamai-x-get-request-id", "akamai-x-get-cache-key", "akamai-x-get-true-cache-key", "akamai-x-get-extracted-values", "akamai-x-cache-on", "akamai-x-cache-remote-on", "akamai-x-check-cacheable", "akamai-x-get-ssl-client-session-id", "akamai-x-serial-no", )
default_pragmas = ('akamai-x-get-request-id', 'akamai-x-get-cache-key', 'akamai-x-get-true-cache-key', 'akamai-x-get-extracted-values', 'akamai-x-cache-on', 'akamai-x-cache-remote-on', 'akamai-x-check-cacheable', 'akamai-x-get-ssl-client-session-id', 'akamai-x-serial-no')
n1 = int(input("digite o valor em metros ")) n2 = int(input("digite o valor em metros ")) n3 = int(input("digite o valor em metros ")) r= (n1**2)+(n2**2)+(n3**2) print(r)
n1 = int(input('digite o valor em metros ')) n2 = int(input('digite o valor em metros ')) n3 = int(input('digite o valor em metros ')) r = n1 ** 2 + n2 ** 2 + n3 ** 2 print(r)
__author__ = 'ipetrash' if __name__ == '__main__': def getprint(str="hello world!"): print(str) def decor(func): def wrapper(*args, **kwargs): print("1 begin: " + func.__name__) print("Args={} kwargs={}".format(args, kwargs)) f = func(*args, **kwargs) print("2 end: " + func.__name__ + "\n") return f return wrapper def predecor(w="W"): print(w, end=': ') getprint() getprint("Py!") print() f = decor(getprint) f() f("Py!") def rgb2hex(get_rgb_func): def wrapper(*args, **kwargs): r, g, b = get_rgb_func(*args, **kwargs) return '#{:02x}{:02x}{:02x}'.format(r, g, b) return wrapper class RGB: def __init__(self): self._r = 0xff self._g = 0xff self._b = 0xff def getr(self): return self._r def setr(self, r): self._r = r r = property(getr, setr) def getg(self): return self._g def setg(self, g): self._g = g g = property(getg, setg) def getb(self): return self._b def setb(self, b): self._b = b b = property(getb, setb) def setrgb(self, r, g, b): self.r, self.g, self.b = r, g, b @rgb2hex def getrgb(self): return (self.r, self.g, self.b) rgb = RGB() print('rgb.r={}'.format(rgb.r)) rgb.setrgb(0xff, 0x1, 0xff) print("rgb.getrgb(): %s" % rgb.getrgb()) print() @decor def foo(a, b): print("{} ^ {} = {}".format(a, b, (a ** b))) foo(2, 3) foo(b=3, a=2)
__author__ = 'ipetrash' if __name__ == '__main__': def getprint(str='hello world!'): print(str) def decor(func): def wrapper(*args, **kwargs): print('1 begin: ' + func.__name__) print('Args={} kwargs={}'.format(args, kwargs)) f = func(*args, **kwargs) print('2 end: ' + func.__name__ + '\n') return f return wrapper def predecor(w='W'): print(w, end=': ') getprint() getprint('Py!') print() f = decor(getprint) f() f('Py!') def rgb2hex(get_rgb_func): def wrapper(*args, **kwargs): (r, g, b) = get_rgb_func(*args, **kwargs) return '#{:02x}{:02x}{:02x}'.format(r, g, b) return wrapper class Rgb: def __init__(self): self._r = 255 self._g = 255 self._b = 255 def getr(self): return self._r def setr(self, r): self._r = r r = property(getr, setr) def getg(self): return self._g def setg(self, g): self._g = g g = property(getg, setg) def getb(self): return self._b def setb(self, b): self._b = b b = property(getb, setb) def setrgb(self, r, g, b): (self.r, self.g, self.b) = (r, g, b) @rgb2hex def getrgb(self): return (self.r, self.g, self.b) rgb = rgb() print('rgb.r={}'.format(rgb.r)) rgb.setrgb(255, 1, 255) print('rgb.getrgb(): %s' % rgb.getrgb()) print() @decor def foo(a, b): print('{} ^ {} = {}'.format(a, b, a ** b)) foo(2, 3) foo(b=3, a=2)
''' https://youtu.be/-xRKazHGtjU Smarter Approach: https://youtu.be/J7S3CHFBZJA Dynamic Programming: https://youtu.be/VQeFcG9pjJU '''
""" https://youtu.be/-xRKazHGtjU Smarter Approach: https://youtu.be/J7S3CHFBZJA Dynamic Programming: https://youtu.be/VQeFcG9pjJU """
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def Insertion_sort(_list): list_length = len(_list) i = 1 while i < list_length: key = _list[i] j = i - 1 while j >= 0 and _list[j] > key: _list[j+1] = _list[j] j -= 1 _list[j+1] = key i += 1 return _list
def insertion_sort(_list): list_length = len(_list) i = 1 while i < list_length: key = _list[i] j = i - 1 while j >= 0 and _list[j] > key: _list[j + 1] = _list[j] j -= 1 _list[j + 1] = key i += 1 return _list
duzina = 5 sirina = 2 povrsina = duzina * sirina print('Povrsina je ', povrsina) print('Obim je ', 2 * (duzina + sirina))
duzina = 5 sirina = 2 povrsina = duzina * sirina print('Povrsina je ', povrsina) print('Obim je ', 2 * (duzina + sirina))
class Contact: def __init__(self, fname=None, sname=None, lname=None, address=None, email=None, tel=None): self.fname = fname self.sname = sname self.lname = lname self.address = address self.email = email self.tel = tel
class Contact: def __init__(self, fname=None, sname=None, lname=None, address=None, email=None, tel=None): self.fname = fname self.sname = sname self.lname = lname self.address = address self.email = email self.tel = tel
def response(number): if number % 4 == 0: return "Multiple of four" elif number % 2 == 0: return "Even" else: return "Odd" def divisible(num, check): if check % num == 0: return "Yes, it's evenly divisible" return "No, it's not evenly divisible" if __name__ == "__main__": number = int(input("Tell me a number: ")) print(response(number))
def response(number): if number % 4 == 0: return 'Multiple of four' elif number % 2 == 0: return 'Even' else: return 'Odd' def divisible(num, check): if check % num == 0: return "Yes, it's evenly divisible" return "No, it's not evenly divisible" if __name__ == '__main__': number = int(input('Tell me a number: ')) print(response(number))
class PipelineError(Exception): pass class PipelineParallelError(Exception): pass
class Pipelineerror(Exception): pass class Pipelineparallelerror(Exception): pass
# print statement, function definition name = "Anurag" age = 30 print(name, age, "python", 2020) print(name, age, "python", 2020, sep=", ", end=" $$ ")
name = 'Anurag' age = 30 print(name, age, 'python', 2020) print(name, age, 'python', 2020, sep=', ', end=' $$ ')
def isPermutation(string_1, string_2): string_1 = list(string_1) string_2 = list(string_2) for i in range(0, len(string_1)): for j in range(0, len(string_2)): if string_1[i] == string_2[j]: del string_2[j] break if len(string_2) == 0: return True else: return False string_1 = str(input()) string_2 = str(input()) if isPermutation(string_1, string_2): print('Your strings are permutations of each other.') else: print('Your strings are not permutations of each other.')
def is_permutation(string_1, string_2): string_1 = list(string_1) string_2 = list(string_2) for i in range(0, len(string_1)): for j in range(0, len(string_2)): if string_1[i] == string_2[j]: del string_2[j] break if len(string_2) == 0: return True else: return False string_1 = str(input()) string_2 = str(input()) if is_permutation(string_1, string_2): print('Your strings are permutations of each other.') else: print('Your strings are not permutations of each other.')
class _SCon: esc : str = '\u001B' bra : str = '[' eb : str = esc + bra bRed : str = eb + '41m' white : str = eb + '37m' bold : str = eb + '1m' right : str = 'C' left : str = 'D' down : str = 'B' up : str = 'A' reset : str = eb + '0m' cyan : str = eb + '36m' del_char: str = eb + 'X' save : str = eb + 's' restore : str = eb + 'u' def caret_to(self, x: int, y: int) -> None: print(self.eb + f"{y};{x}H", end = "") def caret_save(self) -> None: print(self.save, end = "") def caret_restore(self) -> None: print(self.restore, end = "") def del_line(self) -> None: print(self.eb + "2K", end ="") def reset_screen_and_caret(self) -> None: print(self.eb + "2J" + self.eb + "0;0H", end = "") def caret_x_pos(self, x: int) -> None: print(self.eb + f"{x}G", end = "") def caret_y_pos(self, y: int) -> None: print(self.eb + f"{y}d", end = "") SCON: _SCon = _SCon()
class _Scon: esc: str = '\x1b' bra: str = '[' eb: str = esc + bra b_red: str = eb + '41m' white: str = eb + '37m' bold: str = eb + '1m' right: str = 'C' left: str = 'D' down: str = 'B' up: str = 'A' reset: str = eb + '0m' cyan: str = eb + '36m' del_char: str = eb + 'X' save: str = eb + 's' restore: str = eb + 'u' def caret_to(self, x: int, y: int) -> None: print(self.eb + f'{y};{x}H', end='') def caret_save(self) -> None: print(self.save, end='') def caret_restore(self) -> None: print(self.restore, end='') def del_line(self) -> None: print(self.eb + '2K', end='') def reset_screen_and_caret(self) -> None: print(self.eb + '2J' + self.eb + '0;0H', end='') def caret_x_pos(self, x: int) -> None: print(self.eb + f'{x}G', end='') def caret_y_pos(self, y: int) -> None: print(self.eb + f'{y}d', end='') scon: _SCon = _s_con()
# tree structure in decoder side # divide sub-node by brackets "()" class Tree(): def __init__(self): self.parent = None self.num_children = 0 self.children = [] def __str__(self, level = 0): ret = "" for child in self.children: if isinstance(child,type(self)): ret += child.__str__(level+1) else: ret += "\t"*level + str(child) + "\n" return ret def add_child(self,c): if isinstance(c,type(self)): c.parent = self self.children.append(c) self.num_children = self.num_children + 1 def to_string(self): r_list = [] for i in range(self.num_children): if isinstance(self.children[i], Tree): r_list.append("( " + self.children[i].to_string() + " )") else: r_list.append(str(self.children[i])) return "".join(r_list) def to_list(self, form_manager): r_list = [] for i in range(self.num_children): if isinstance(self.children[i], type(self)): r_list.append(form_manager.get_symbol_idx("(")) cl = self.children[i].to_list(form_manager) for k in range(len(cl)): r_list.append(cl[k]) r_list.append(form_manager.get_symbol_idx(")")) else: r_list.append(self.children[i]) return r_list
class Tree: def __init__(self): self.parent = None self.num_children = 0 self.children = [] def __str__(self, level=0): ret = '' for child in self.children: if isinstance(child, type(self)): ret += child.__str__(level + 1) else: ret += '\t' * level + str(child) + '\n' return ret def add_child(self, c): if isinstance(c, type(self)): c.parent = self self.children.append(c) self.num_children = self.num_children + 1 def to_string(self): r_list = [] for i in range(self.num_children): if isinstance(self.children[i], Tree): r_list.append('( ' + self.children[i].to_string() + ' )') else: r_list.append(str(self.children[i])) return ''.join(r_list) def to_list(self, form_manager): r_list = [] for i in range(self.num_children): if isinstance(self.children[i], type(self)): r_list.append(form_manager.get_symbol_idx('(')) cl = self.children[i].to_list(form_manager) for k in range(len(cl)): r_list.append(cl[k]) r_list.append(form_manager.get_symbol_idx(')')) else: r_list.append(self.children[i]) return r_list
# you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(A): N = len(A) l_sum = A[0] r_sum = sum(A) - l_sum diff = abs(l_sum - r_sum) for i in range(1, N -1): l_sum += A[i] r_sum -= A[i] c_diff = abs(l_sum - r_sum) if diff > c_diff: diff = c_diff return diff
def solution(A): n = len(A) l_sum = A[0] r_sum = sum(A) - l_sum diff = abs(l_sum - r_sum) for i in range(1, N - 1): l_sum += A[i] r_sum -= A[i] c_diff = abs(l_sum - r_sum) if diff > c_diff: diff = c_diff return diff
#!/usr/bin/python3 def uppercase(str): for c in str: if (ord(c) >= ord('a')) and (ord(c) <= ord('z')): c = chr(ord(c)-ord('a')+ord('A')) print("{}".format(c), end='') print()
def uppercase(str): for c in str: if ord(c) >= ord('a') and ord(c) <= ord('z'): c = chr(ord(c) - ord('a') + ord('A')) print('{}'.format(c), end='') print()
def calcula_diferenca(A: int, B: int, C: int, D: int): if (not isinstance(A, int) or not isinstance(B, int) or not isinstance(C, int) or not isinstance(D, int)): raise(TypeError) D = A * B - C * D return f'DIFERENCA = {D}'
def calcula_diferenca(A: int, B: int, C: int, D: int): if not isinstance(A, int) or not isinstance(B, int) or (not isinstance(C, int)) or (not isinstance(D, int)): raise TypeError d = A * B - C * D return f'DIFERENCA = {D}'
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ################################################### #........../\./\...___......|\.|..../...\.........# #........./..|..\/\.|.|_|._.|.\|....|.c.|.........# #......../....../--\|.|.|.|i|..|....\.../.........# # Mathtin (c) # ################################################### # Author: Daniel [Mathtin] Shiko # # Copyright (c) 2020 <wdaniil@mail.ru> # # This file is released under the MIT license. # ################################################### __author__ = 'Mathtin' class InvalidConfigException(Exception): def __init__(self, msg: str, var_name: str): super().__init__(f'{msg}, check {var_name} value') class NotCoroutineException(TypeError): def __init__(self, func): super().__init__(f'{str(func)} is not a coroutine function') class MissingResourceException(Exception): def __init__(self, xml: str, path: str): super().__init__(f'Missing resource in {xml}: {path}')
__author__ = 'Mathtin' class Invalidconfigexception(Exception): def __init__(self, msg: str, var_name: str): super().__init__(f'{msg}, check {var_name} value') class Notcoroutineexception(TypeError): def __init__(self, func): super().__init__(f'{str(func)} is not a coroutine function') class Missingresourceexception(Exception): def __init__(self, xml: str, path: str): super().__init__(f'Missing resource in {xml}: {path}')
#Question link #https://practice.geeksforgeeks.org/problems/smallest-subarray-with-sum-greater-than-x/0 def window(arr,n, k): left=0 right=0 ans=n sum1=0 while left<n and right<n+1: if sum1>k: if left==right: ans=1 break ans=min(ans,right-left) sum1-=arr[left] left+=1 elif right==n: break else: sum1+=arr[right] right+=1 return ans def main(): t = int(input()) for _ in range(t): n, k = map(int,input().split()) arr = list(map(int,input().split())) print(window(arr,n,k)) if __name__ == "__main__": main()
def window(arr, n, k): left = 0 right = 0 ans = n sum1 = 0 while left < n and right < n + 1: if sum1 > k: if left == right: ans = 1 break ans = min(ans, right - left) sum1 -= arr[left] left += 1 elif right == n: break else: sum1 += arr[right] right += 1 return ans def main(): t = int(input()) for _ in range(t): (n, k) = map(int, input().split()) arr = list(map(int, input().split())) print(window(arr, n, k)) if __name__ == '__main__': main()
s = input() # s = ' name1' list_stop = [' ', '@', '$', '%'] list_num = '0123456789' # flag_true = 0 flag_false = 0 for i in list_num: if s[0] == i: flag_false += 1 break for j in s: for k in list_stop: if j == k: flag_false += 1 break else: # flag_true += 1 break if flag_false >= 1: print(False) else: print(True)
s = input() list_stop = [' ', '@', '$', '%'] list_num = '0123456789' flag_false = 0 for i in list_num: if s[0] == i: flag_false += 1 break for j in s: for k in list_stop: if j == k: flag_false += 1 break else: break if flag_false >= 1: print(False) else: print(True)
# # @lc app=leetcode id=1232 lang=python3 # # [1232] Check If It Is a Straight Line # # @lc code=start class Solution: def checkStraightLine(self, coordinates): if len(coordinates) <= 2: return True x1, x2, y1, y2 = coordinates[0][0], coordinates[1][0], coordinates[0][1], coordinates[1][1] if x1 == x2: k = 0 else: k = (y1 - y2)/(x1 - x2) b = y1 - k * x1 for item in coordinates[2:]: if item[1] != item[0] * k + b: return False return True # @lc code=end
class Solution: def check_straight_line(self, coordinates): if len(coordinates) <= 2: return True (x1, x2, y1, y2) = (coordinates[0][0], coordinates[1][0], coordinates[0][1], coordinates[1][1]) if x1 == x2: k = 0 else: k = (y1 - y2) / (x1 - x2) b = y1 - k * x1 for item in coordinates[2:]: if item[1] != item[0] * k + b: return False return True
class YggException(Exception): pass class LoginFailed(Exception): pass class TooManyFailedLogins(Exception): pass
class Yggexception(Exception): pass class Loginfailed(Exception): pass class Toomanyfailedlogins(Exception): pass
class TriggerBase: def __init__(self, q, events): self.q = q self.events = events def trigger(self, name): self.q.put( {'req': 'trigger_animation', 'data': name, 'sender': 'Trigger'})
class Triggerbase: def __init__(self, q, events): self.q = q self.events = events def trigger(self, name): self.q.put({'req': 'trigger_animation', 'data': name, 'sender': 'Trigger'})
favcolor = { "Jacob": "Magenta", "Jason": "Red", "Anais": "Purple" } for name, color in favcolor.items(): print("%s's favorite color is %s" %(name, color))
favcolor = {'Jacob': 'Magenta', 'Jason': 'Red', 'Anais': 'Purple'} for (name, color) in favcolor.items(): print("%s's favorite color is %s" % (name, color))
''' 5. Write a Python program to check whether a specified value is contained in a group of values. Test Data : 3 -> [1, 5, 8, 3] : True -1 -> [1, 5, 8, 3] : False ''' def check_value(group_data, n): for x in group_data: if n == x: return True else: return False print(check_value([1,5,8,3], 3)) print(check_value([1,5,8,3], -1))
""" 5. Write a Python program to check whether a specified value is contained in a group of values. Test Data : 3 -> [1, 5, 8, 3] : True -1 -> [1, 5, 8, 3] : False """ def check_value(group_data, n): for x in group_data: if n == x: return True else: return False print(check_value([1, 5, 8, 3], 3)) print(check_value([1, 5, 8, 3], -1))
# Program corresponding to flowchart in this site https://automatetheboringstuff.com/2e/images/000039.jpg print('Is raining? (Y)es or (N)o') answer = input() if answer == 'N': print('Go outside.') elif answer == 'Y': print('Have umbrella? (Y)es or (N)o') answer2 = input() if answer2 == 'Y': print('Go outside.') elif answer2 == 'N': print('Wait a while.') print('Is raining? (Y)es or (N)o') answer3 = input() while answer3 == 'Y': print('Wait a while.') print('Is raining? (Y)es or (N)o') answer3 = input() print('Go outside.') else: print("I can't understand you.Type 'Y' for yes and 'N' or No.") print('===============') print('Exiting program')
print('Is raining? (Y)es or (N)o') answer = input() if answer == 'N': print('Go outside.') elif answer == 'Y': print('Have umbrella? (Y)es or (N)o') answer2 = input() if answer2 == 'Y': print('Go outside.') elif answer2 == 'N': print('Wait a while.') print('Is raining? (Y)es or (N)o') answer3 = input() while answer3 == 'Y': print('Wait a while.') print('Is raining? (Y)es or (N)o') answer3 = input() print('Go outside.') else: print("I can't understand you.Type 'Y' for yes and 'N' or No.") print('===============') print('Exiting program')
first_name = input() second_name = input() delimeter = input() print(f"{first_name}{delimeter}{second_name}")
first_name = input() second_name = input() delimeter = input() print(f'{first_name}{delimeter}{second_name}')
# # PySNMP MIB module CISCO-ITP-RT-CAPABILITY (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ITP-RT-CAPABILITY # Produced by pysmi-0.3.4 at Wed May 1 12:03:41 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint") ciscoAgentCapability, = mibBuilder.importSymbols("CISCO-SMI", "ciscoAgentCapability") NotificationGroup, ModuleCompliance, AgentCapabilities = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance", "AgentCapabilities") Bits, Counter32, NotificationType, Counter64, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, Integer32, Gauge32, Unsigned32, MibIdentifier, TimeTicks, iso, IpAddress, ModuleIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "Counter32", "NotificationType", "Counter64", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "Integer32", "Gauge32", "Unsigned32", "MibIdentifier", "TimeTicks", "iso", "IpAddress", "ModuleIdentity") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") ciscoItpRtCapability = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 7, 216)) ciscoItpRtCapability.setRevisions(('2002-01-21 00:00', '2001-10-24 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: ciscoItpRtCapability.setRevisionsDescriptions(('Updated capabilities MIB as required for new groups. cItpRtNotificationsGroup, cItpRtScalarGroupRev1', 'Initial version of this MIB module.',)) if mibBuilder.loadTexts: ciscoItpRtCapability.setLastUpdated('200201210000Z') if mibBuilder.loadTexts: ciscoItpRtCapability.setOrganization('Cisco Systems, Inc.') if mibBuilder.loadTexts: ciscoItpRtCapability.setContactInfo(' Cisco Systems Customer Service Postal: 170 West Tasman Drive San Jose, CA 95134 USA Tel: +1 800 553-NETS E-mail: cs-ss7@cisco.com') if mibBuilder.loadTexts: ciscoItpRtCapability.setDescription('Agent capabilities for the CISCO-ITP-RT-MIB.') ciscoItpRtCapabilityV12R024MB1 = AgentCapabilities((1, 3, 6, 1, 4, 1, 9, 7, 216, 1)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoItpRtCapabilityV12R024MB1 = ciscoItpRtCapabilityV12R024MB1.setProductRelease('Cisco IOS 12.2(4)MB1') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoItpRtCapabilityV12R024MB1 = ciscoItpRtCapabilityV12R024MB1.setStatus('current') if mibBuilder.loadTexts: ciscoItpRtCapabilityV12R024MB1.setDescription('IOS 12.2(4)MB1 Cisco CISCO-ITP-RT-MIB.my User Agent MIB capabilities.') ciscoItpRtCapabilityV12R0204MB3 = AgentCapabilities((1, 3, 6, 1, 4, 1, 9, 7, 216, 2)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoItpRtCapabilityV12R0204MB3 = ciscoItpRtCapabilityV12R0204MB3.setProductRelease('Cisco IOS 12.2(4)MB3') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoItpRtCapabilityV12R0204MB3 = ciscoItpRtCapabilityV12R0204MB3.setStatus('current') if mibBuilder.loadTexts: ciscoItpRtCapabilityV12R0204MB3.setDescription('IOS 12.2(4)MB3 Cisco CISCO-ITP-RT-MIB.my User Agent MIB capabilities.') mibBuilder.exportSymbols("CISCO-ITP-RT-CAPABILITY", ciscoItpRtCapabilityV12R024MB1=ciscoItpRtCapabilityV12R024MB1, ciscoItpRtCapabilityV12R0204MB3=ciscoItpRtCapabilityV12R0204MB3, PYSNMP_MODULE_ID=ciscoItpRtCapability, ciscoItpRtCapability=ciscoItpRtCapability)
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ValueSizeConstraint', 'SingleValueConstraint', 'ConstraintsIntersection', 'ValueRangeConstraint') (cisco_agent_capability,) = mibBuilder.importSymbols('CISCO-SMI', 'ciscoAgentCapability') (notification_group, module_compliance, agent_capabilities) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance', 'AgentCapabilities') (bits, counter32, notification_type, counter64, mib_scalar, mib_table, mib_table_row, mib_table_column, object_identity, integer32, gauge32, unsigned32, mib_identifier, time_ticks, iso, ip_address, module_identity) = mibBuilder.importSymbols('SNMPv2-SMI', 'Bits', 'Counter32', 'NotificationType', 'Counter64', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ObjectIdentity', 'Integer32', 'Gauge32', 'Unsigned32', 'MibIdentifier', 'TimeTicks', 'iso', 'IpAddress', 'ModuleIdentity') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') cisco_itp_rt_capability = module_identity((1, 3, 6, 1, 4, 1, 9, 7, 216)) ciscoItpRtCapability.setRevisions(('2002-01-21 00:00', '2001-10-24 00:00')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: ciscoItpRtCapability.setRevisionsDescriptions(('Updated capabilities MIB as required for new groups. cItpRtNotificationsGroup, cItpRtScalarGroupRev1', 'Initial version of this MIB module.')) if mibBuilder.loadTexts: ciscoItpRtCapability.setLastUpdated('200201210000Z') if mibBuilder.loadTexts: ciscoItpRtCapability.setOrganization('Cisco Systems, Inc.') if mibBuilder.loadTexts: ciscoItpRtCapability.setContactInfo(' Cisco Systems Customer Service Postal: 170 West Tasman Drive San Jose, CA 95134 USA Tel: +1 800 553-NETS E-mail: cs-ss7@cisco.com') if mibBuilder.loadTexts: ciscoItpRtCapability.setDescription('Agent capabilities for the CISCO-ITP-RT-MIB.') cisco_itp_rt_capability_v12_r024_mb1 = agent_capabilities((1, 3, 6, 1, 4, 1, 9, 7, 216, 1)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_itp_rt_capability_v12_r024_mb1 = ciscoItpRtCapabilityV12R024MB1.setProductRelease('Cisco IOS 12.2(4)MB1') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_itp_rt_capability_v12_r024_mb1 = ciscoItpRtCapabilityV12R024MB1.setStatus('current') if mibBuilder.loadTexts: ciscoItpRtCapabilityV12R024MB1.setDescription('IOS 12.2(4)MB1 Cisco CISCO-ITP-RT-MIB.my User Agent MIB capabilities.') cisco_itp_rt_capability_v12_r0204_mb3 = agent_capabilities((1, 3, 6, 1, 4, 1, 9, 7, 216, 2)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_itp_rt_capability_v12_r0204_mb3 = ciscoItpRtCapabilityV12R0204MB3.setProductRelease('Cisco IOS 12.2(4)MB3') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_itp_rt_capability_v12_r0204_mb3 = ciscoItpRtCapabilityV12R0204MB3.setStatus('current') if mibBuilder.loadTexts: ciscoItpRtCapabilityV12R0204MB3.setDescription('IOS 12.2(4)MB3 Cisco CISCO-ITP-RT-MIB.my User Agent MIB capabilities.') mibBuilder.exportSymbols('CISCO-ITP-RT-CAPABILITY', ciscoItpRtCapabilityV12R024MB1=ciscoItpRtCapabilityV12R024MB1, ciscoItpRtCapabilityV12R0204MB3=ciscoItpRtCapabilityV12R0204MB3, PYSNMP_MODULE_ID=ciscoItpRtCapability, ciscoItpRtCapability=ciscoItpRtCapability)
# -*- coding: utf-8 -*- qntCaso = int(input()) for caso in range(qntCaso): listStrTamanhoStr = list() listStr = list(map(str, input().split())) for indiceStr in range(len(listStr)): listStrTamanhoStr.append([listStr[indiceStr], len(listStr[indiceStr])]) strSequenciaOrdenadaTamanho = "" for chave, valor in sorted(listStrTamanhoStr, key=lambda x: x[1],reverse=True): strSequenciaOrdenadaTamanho += "{} ".format(chave) print(strSequenciaOrdenadaTamanho.strip())
qnt_caso = int(input()) for caso in range(qntCaso): list_str_tamanho_str = list() list_str = list(map(str, input().split())) for indice_str in range(len(listStr)): listStrTamanhoStr.append([listStr[indiceStr], len(listStr[indiceStr])]) str_sequencia_ordenada_tamanho = '' for (chave, valor) in sorted(listStrTamanhoStr, key=lambda x: x[1], reverse=True): str_sequencia_ordenada_tamanho += '{} '.format(chave) print(strSequenciaOrdenadaTamanho.strip())
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Chirstoph Reimers' __email__ = 'creimers@byteyard.de' __version__ = '0.1.0.b6'
__author__ = 'Chirstoph Reimers' __email__ = 'creimers@byteyard.de' __version__ = '0.1.0.b6'
#square pattern ''' Print the following pattern for the given N number of rows. Pattern for N = 4 4444 4444 4444 4444 ''' rows=int(input()) for i in range(rows): for j in range(rows): print(rows,end="") print()
""" Print the following pattern for the given N number of rows. Pattern for N = 4 4444 4444 4444 4444 """ rows = int(input()) for i in range(rows): for j in range(rows): print(rows, end='') print()
expected_output = { "vrf": { "default": { "address_family": { "ipv4": { "instance": { "10000": { "summary_traffic_statistics": { "ospf_packets_received_sent": { "type": { "rx_invalid": {"packets": 0, "bytes": 0}, "rx_hello": {"packets": 0, "bytes": 0}, "rx_db_des": {"packets": 0, "bytes": 0}, "rx_ls_req": {"packets": 0, "bytes": 0}, "rx_ls_upd": {"packets": 0, "bytes": 0}, "rx_ls_ack": {"packets": 0, "bytes": 0}, "rx_total": {"packets": 0, "bytes": 0}, "tx_failed": {"packets": 0, "bytes": 0}, "tx_hello": {"packets": 0, "bytes": 0}, "tx_db_des": {"packets": 0, "bytes": 0}, "tx_ls_req": {"packets": 0, "bytes": 0}, "tx_ls_upd": {"packets": 0, "bytes": 0}, "tx_ls_ack": {"packets": 0, "bytes": 0}, "tx_total": {"packets": 0, "bytes": 0}, } }, "ospf_header_errors": { "length": 0, "instance_id": 0, "checksum": 0, "auth_type": 0, "version": 0, "bad_source": 0, "no_virtual_link": 0, "area_mismatch": 0, "no_sham_link": 0, "self_originated": 0, "duplicate_id": 0, "hello": 0, "mtu_mismatch": 0, "nbr_ignored": 0, "lls": 0, "unknown_neighbor": 0, "authentication": 0, "ttl_check_fail": 0, "adjacency_throttle": 0, "bfd": 0, "test_discard": 0, }, "ospf_lsa_errors": { "type": 0, "length": 0, "data": 0, "checksum": 0, }, } }, "888": { "router_id": "10.19.13.14", "ospf_queue_statistics": { "limit": {"inputq": 0, "updateq": 200, "outputq": 0}, "drops": {"inputq": 0, "updateq": 0, "outputq": 0}, "max_delay_msec": { "inputq": 3, "updateq": 2, "outputq": 1, }, "max_size": { "total": {"inputq": 4, "updateq": 3, "outputq": 2}, "invalid": { "inputq": 0, "updateq": 0, "outputq": 0, }, "hello": {"inputq": 4, "updateq": 0, "outputq": 1}, "db_des": {"inputq": 0, "updateq": 0, "outputq": 1}, "ls_req": {"inputq": 0, "updateq": 0, "outputq": 0}, "ls_upd": {"inputq": 0, "updateq": 3, "outputq": 0}, "ls_ack": {"inputq": 0, "updateq": 0, "outputq": 0}, }, "current_size": { "total": {"inputq": 0, "updateq": 0, "outputq": 0}, "invalid": { "inputq": 0, "updateq": 0, "outputq": 0, }, "hello": {"inputq": 0, "updateq": 0, "outputq": 0}, "db_des": {"inputq": 0, "updateq": 0, "outputq": 0}, "ls_req": {"inputq": 0, "updateq": 0, "outputq": 0}, "ls_upd": {"inputq": 0, "updateq": 0, "outputq": 0}, "ls_ack": {"inputq": 0, "updateq": 0, "outputq": 0}, }, }, "interface_statistics": { "interfaces": { "Tunnel65541": { "last_clear_traffic_counters": "never", "ospf_packets_received_sent": { "type": { "rx_invalid": { "packets": 0, "bytes": 0, }, "rx_hello": {"packets": 0, "bytes": 0}, "rx_db_des": {"packets": 0, "bytes": 0}, "rx_ls_req": {"packets": 0, "bytes": 0}, "rx_ls_upd": {"packets": 0, "bytes": 0}, "rx_ls_ack": {"packets": 0, "bytes": 0}, "rx_total": {"packets": 0, "bytes": 0}, "tx_failed": {"packets": 0, "bytes": 0}, "tx_hello": { "packets": 62301, "bytes": 5980896, }, "tx_db_des": {"packets": 0, "bytes": 0}, "tx_ls_req": {"packets": 0, "bytes": 0}, "tx_ls_upd": {"packets": 0, "bytes": 0}, "tx_ls_ack": {"packets": 0, "bytes": 0}, "tx_total": { "packets": 62301, "bytes": 5980896, }, } }, "ospf_header_errors": { "length": 0, "instance_id": 0, "checksum": 0, "auth_type": 0, "version": 0, "bad_source": 0, "no_virtual_link": 0, "area_mismatch": 0, "no_sham_link": 0, "self_originated": 0, "duplicate_id": 0, "hello": 0, "mtu_mismatch": 0, "nbr_ignored": 0, "lls": 0, "unknown_neighbor": 0, "authentication": 0, "ttl_check_fail": 0, "adjacency_throttle": 0, "bfd": 0, "test_discard": 0, }, "ospf_lsa_errors": { "type": 0, "length": 0, "data": 0, "checksum": 0, }, }, "GigabitEthernet0/1/7": { "last_clear_traffic_counters": "never", "ospf_packets_received_sent": { "type": { "rx_invalid": { "packets": 0, "bytes": 0, }, "rx_hello": { "packets": 70493, "bytes": 3383664, }, "rx_db_des": { "packets": 3, "bytes": 1676, }, "rx_ls_req": { "packets": 1, "bytes": 36, }, "rx_ls_upd": { "packets": 14963, "bytes": 1870388, }, "rx_ls_ack": { "packets": 880, "bytes": 76140, }, "rx_total": { "packets": 86340, "bytes": 5331904, }, "tx_failed": {"packets": 0, "bytes": 0}, "tx_hello": { "packets": 1, "bytes": 100, }, "tx_db_des": { "packets": 4, "bytes": 416, }, "tx_ls_req": { "packets": 1, "bytes": 968, }, "tx_ls_upd": { "packets": 1, "bytes": 108, }, "tx_ls_ack": { "packets": 134, "bytes": 9456, }, "tx_total": { "packets": 141, "bytes": 11048, }, } }, "ospf_header_errors": { "length": 0, "instance_id": 0, "checksum": 0, "auth_type": 0, "version": 0, "bad_source": 0, "no_virtual_link": 0, "area_mismatch": 0, "no_sham_link": 0, "self_originated": 0, "duplicate_id": 0, "hello": 0, "mtu_mismatch": 0, "nbr_ignored": 0, "lls": 0, "unknown_neighbor": 0, "authentication": 0, "ttl_check_fail": 0, "adjacency_throttle": 0, "bfd": 0, "test_discard": 0, }, "ospf_lsa_errors": { "type": 0, "length": 0, "data": 0, "checksum": 0, }, }, "GigabitEthernet0/1/6": { "last_clear_traffic_counters": "never", "ospf_packets_received_sent": { "type": { "rx_invalid": { "packets": 0, "bytes": 0, }, "rx_hello": { "packets": 70504, "bytes": 3384192, }, "rx_db_des": { "packets": 3, "bytes": 1676, }, "rx_ls_req": { "packets": 1, "bytes": 36, }, "rx_ls_upd": { "packets": 14809, "bytes": 1866264, }, "rx_ls_ack": { "packets": 877, "bytes": 76028, }, "rx_total": { "packets": 86194, "bytes": 5328196, }, "tx_failed": {"packets": 0, "bytes": 0}, "tx_hello": { "packets": 1, "bytes": 100, }, "tx_db_des": { "packets": 4, "bytes": 416, }, "tx_ls_req": { "packets": 1, "bytes": 968, }, "tx_ls_upd": { "packets": 1, "bytes": 108, }, "tx_ls_ack": { "packets": 117, "bytes": 8668, }, "tx_total": { "packets": 124, "bytes": 10260, }, } }, "ospf_header_errors": { "length": 0, "instance_id": 0, "checksum": 0, "auth_type": 0, "version": 0, "bad_source": 0, "no_virtual_link": 0, "area_mismatch": 0, "no_sham_link": 0, "self_originated": 0, "duplicate_id": 0, "hello": 0, "mtu_mismatch": 0, "nbr_ignored": 0, "lls": 0, "unknown_neighbor": 0, "authentication": 0, "ttl_check_fail": 0, "adjacency_throttle": 0, "bfd": 0, "test_discard": 0, }, "ospf_lsa_errors": { "type": 0, "length": 0, "data": 0, "checksum": 0, }, }, } }, "summary_traffic_statistics": { "ospf_packets_received_sent": { "type": { "rx_invalid": {"packets": 0, "bytes": 0}, "rx_hello": { "packets": 159187, "bytes": 7640968, }, "rx_db_des": { "packets": 10240, "bytes": 337720, }, "rx_ls_req": {"packets": 5, "bytes": 216}, "rx_ls_upd": { "packets": 31899, "bytes": 4010656, }, "rx_ls_ack": {"packets": 2511, "bytes": 201204}, "rx_total": { "packets": 203842, "bytes": 12190764, }, "tx_failed": {"packets": 0, "bytes": 0}, "tx_hello": { "packets": 208493, "bytes": 20592264, }, "tx_db_des": { "packets": 10540, "bytes": 15808320, }, "tx_ls_req": {"packets": 5, "bytes": 3112}, "tx_ls_upd": { "packets": 33998, "bytes": 5309252, }, "tx_ls_ack": { "packets": 17571, "bytes": 1220144, }, "tx_total": { "packets": 270607, "bytes": 42933092, }, } }, "ospf_header_errors": { "length": 0, "instance_id": 0, "checksum": 0, "auth_type": 0, "version": 0, "bad_source": 0, "no_virtual_link": 0, "area_mismatch": 0, "no_sham_link": 0, "self_originated": 0, "duplicate_id": 0, "hello": 0, "mtu_mismatch": 0, "nbr_ignored": 2682, "lls": 0, "unknown_neighbor": 0, "authentication": 0, "ttl_check_fail": 0, "adjacency_throttle": 0, "bfd": 0, "test_discard": 0, }, "ospf_lsa_errors": { "type": 0, "length": 0, "data": 0, "checksum": 0, }, }, }, } } } } }, "ospf_statistics": { "last_clear_traffic_counters": "never", "rcvd": { "total": 204136, "checksum_errors": 0, "hello": 159184, "database_desc": 10240, "link_state_req": 5, "link_state_updates": 31899, "link_state_acks": 2511, }, "sent": { "total": 281838, "hello": 219736, "database_desc": 10540, "link_state_req": 5, "link_state_updates": 33998, "link_state_acks": 17571, }, }, }
expected_output = {'vrf': {'default': {'address_family': {'ipv4': {'instance': {'10000': {'summary_traffic_statistics': {'ospf_packets_received_sent': {'type': {'rx_invalid': {'packets': 0, 'bytes': 0}, 'rx_hello': {'packets': 0, 'bytes': 0}, 'rx_db_des': {'packets': 0, 'bytes': 0}, 'rx_ls_req': {'packets': 0, 'bytes': 0}, 'rx_ls_upd': {'packets': 0, 'bytes': 0}, 'rx_ls_ack': {'packets': 0, 'bytes': 0}, 'rx_total': {'packets': 0, 'bytes': 0}, 'tx_failed': {'packets': 0, 'bytes': 0}, 'tx_hello': {'packets': 0, 'bytes': 0}, 'tx_db_des': {'packets': 0, 'bytes': 0}, 'tx_ls_req': {'packets': 0, 'bytes': 0}, 'tx_ls_upd': {'packets': 0, 'bytes': 0}, 'tx_ls_ack': {'packets': 0, 'bytes': 0}, 'tx_total': {'packets': 0, 'bytes': 0}}}, 'ospf_header_errors': {'length': 0, 'instance_id': 0, 'checksum': 0, 'auth_type': 0, 'version': 0, 'bad_source': 0, 'no_virtual_link': 0, 'area_mismatch': 0, 'no_sham_link': 0, 'self_originated': 0, 'duplicate_id': 0, 'hello': 0, 'mtu_mismatch': 0, 'nbr_ignored': 0, 'lls': 0, 'unknown_neighbor': 0, 'authentication': 0, 'ttl_check_fail': 0, 'adjacency_throttle': 0, 'bfd': 0, 'test_discard': 0}, 'ospf_lsa_errors': {'type': 0, 'length': 0, 'data': 0, 'checksum': 0}}}, '888': {'router_id': '10.19.13.14', 'ospf_queue_statistics': {'limit': {'inputq': 0, 'updateq': 200, 'outputq': 0}, 'drops': {'inputq': 0, 'updateq': 0, 'outputq': 0}, 'max_delay_msec': {'inputq': 3, 'updateq': 2, 'outputq': 1}, 'max_size': {'total': {'inputq': 4, 'updateq': 3, 'outputq': 2}, 'invalid': {'inputq': 0, 'updateq': 0, 'outputq': 0}, 'hello': {'inputq': 4, 'updateq': 0, 'outputq': 1}, 'db_des': {'inputq': 0, 'updateq': 0, 'outputq': 1}, 'ls_req': {'inputq': 0, 'updateq': 0, 'outputq': 0}, 'ls_upd': {'inputq': 0, 'updateq': 3, 'outputq': 0}, 'ls_ack': {'inputq': 0, 'updateq': 0, 'outputq': 0}}, 'current_size': {'total': {'inputq': 0, 'updateq': 0, 'outputq': 0}, 'invalid': {'inputq': 0, 'updateq': 0, 'outputq': 0}, 'hello': {'inputq': 0, 'updateq': 0, 'outputq': 0}, 'db_des': {'inputq': 0, 'updateq': 0, 'outputq': 0}, 'ls_req': {'inputq': 0, 'updateq': 0, 'outputq': 0}, 'ls_upd': {'inputq': 0, 'updateq': 0, 'outputq': 0}, 'ls_ack': {'inputq': 0, 'updateq': 0, 'outputq': 0}}}, 'interface_statistics': {'interfaces': {'Tunnel65541': {'last_clear_traffic_counters': 'never', 'ospf_packets_received_sent': {'type': {'rx_invalid': {'packets': 0, 'bytes': 0}, 'rx_hello': {'packets': 0, 'bytes': 0}, 'rx_db_des': {'packets': 0, 'bytes': 0}, 'rx_ls_req': {'packets': 0, 'bytes': 0}, 'rx_ls_upd': {'packets': 0, 'bytes': 0}, 'rx_ls_ack': {'packets': 0, 'bytes': 0}, 'rx_total': {'packets': 0, 'bytes': 0}, 'tx_failed': {'packets': 0, 'bytes': 0}, 'tx_hello': {'packets': 62301, 'bytes': 5980896}, 'tx_db_des': {'packets': 0, 'bytes': 0}, 'tx_ls_req': {'packets': 0, 'bytes': 0}, 'tx_ls_upd': {'packets': 0, 'bytes': 0}, 'tx_ls_ack': {'packets': 0, 'bytes': 0}, 'tx_total': {'packets': 62301, 'bytes': 5980896}}}, 'ospf_header_errors': {'length': 0, 'instance_id': 0, 'checksum': 0, 'auth_type': 0, 'version': 0, 'bad_source': 0, 'no_virtual_link': 0, 'area_mismatch': 0, 'no_sham_link': 0, 'self_originated': 0, 'duplicate_id': 0, 'hello': 0, 'mtu_mismatch': 0, 'nbr_ignored': 0, 'lls': 0, 'unknown_neighbor': 0, 'authentication': 0, 'ttl_check_fail': 0, 'adjacency_throttle': 0, 'bfd': 0, 'test_discard': 0}, 'ospf_lsa_errors': {'type': 0, 'length': 0, 'data': 0, 'checksum': 0}}, 'GigabitEthernet0/1/7': {'last_clear_traffic_counters': 'never', 'ospf_packets_received_sent': {'type': {'rx_invalid': {'packets': 0, 'bytes': 0}, 'rx_hello': {'packets': 70493, 'bytes': 3383664}, 'rx_db_des': {'packets': 3, 'bytes': 1676}, 'rx_ls_req': {'packets': 1, 'bytes': 36}, 'rx_ls_upd': {'packets': 14963, 'bytes': 1870388}, 'rx_ls_ack': {'packets': 880, 'bytes': 76140}, 'rx_total': {'packets': 86340, 'bytes': 5331904}, 'tx_failed': {'packets': 0, 'bytes': 0}, 'tx_hello': {'packets': 1, 'bytes': 100}, 'tx_db_des': {'packets': 4, 'bytes': 416}, 'tx_ls_req': {'packets': 1, 'bytes': 968}, 'tx_ls_upd': {'packets': 1, 'bytes': 108}, 'tx_ls_ack': {'packets': 134, 'bytes': 9456}, 'tx_total': {'packets': 141, 'bytes': 11048}}}, 'ospf_header_errors': {'length': 0, 'instance_id': 0, 'checksum': 0, 'auth_type': 0, 'version': 0, 'bad_source': 0, 'no_virtual_link': 0, 'area_mismatch': 0, 'no_sham_link': 0, 'self_originated': 0, 'duplicate_id': 0, 'hello': 0, 'mtu_mismatch': 0, 'nbr_ignored': 0, 'lls': 0, 'unknown_neighbor': 0, 'authentication': 0, 'ttl_check_fail': 0, 'adjacency_throttle': 0, 'bfd': 0, 'test_discard': 0}, 'ospf_lsa_errors': {'type': 0, 'length': 0, 'data': 0, 'checksum': 0}}, 'GigabitEthernet0/1/6': {'last_clear_traffic_counters': 'never', 'ospf_packets_received_sent': {'type': {'rx_invalid': {'packets': 0, 'bytes': 0}, 'rx_hello': {'packets': 70504, 'bytes': 3384192}, 'rx_db_des': {'packets': 3, 'bytes': 1676}, 'rx_ls_req': {'packets': 1, 'bytes': 36}, 'rx_ls_upd': {'packets': 14809, 'bytes': 1866264}, 'rx_ls_ack': {'packets': 877, 'bytes': 76028}, 'rx_total': {'packets': 86194, 'bytes': 5328196}, 'tx_failed': {'packets': 0, 'bytes': 0}, 'tx_hello': {'packets': 1, 'bytes': 100}, 'tx_db_des': {'packets': 4, 'bytes': 416}, 'tx_ls_req': {'packets': 1, 'bytes': 968}, 'tx_ls_upd': {'packets': 1, 'bytes': 108}, 'tx_ls_ack': {'packets': 117, 'bytes': 8668}, 'tx_total': {'packets': 124, 'bytes': 10260}}}, 'ospf_header_errors': {'length': 0, 'instance_id': 0, 'checksum': 0, 'auth_type': 0, 'version': 0, 'bad_source': 0, 'no_virtual_link': 0, 'area_mismatch': 0, 'no_sham_link': 0, 'self_originated': 0, 'duplicate_id': 0, 'hello': 0, 'mtu_mismatch': 0, 'nbr_ignored': 0, 'lls': 0, 'unknown_neighbor': 0, 'authentication': 0, 'ttl_check_fail': 0, 'adjacency_throttle': 0, 'bfd': 0, 'test_discard': 0}, 'ospf_lsa_errors': {'type': 0, 'length': 0, 'data': 0, 'checksum': 0}}}}, 'summary_traffic_statistics': {'ospf_packets_received_sent': {'type': {'rx_invalid': {'packets': 0, 'bytes': 0}, 'rx_hello': {'packets': 159187, 'bytes': 7640968}, 'rx_db_des': {'packets': 10240, 'bytes': 337720}, 'rx_ls_req': {'packets': 5, 'bytes': 216}, 'rx_ls_upd': {'packets': 31899, 'bytes': 4010656}, 'rx_ls_ack': {'packets': 2511, 'bytes': 201204}, 'rx_total': {'packets': 203842, 'bytes': 12190764}, 'tx_failed': {'packets': 0, 'bytes': 0}, 'tx_hello': {'packets': 208493, 'bytes': 20592264}, 'tx_db_des': {'packets': 10540, 'bytes': 15808320}, 'tx_ls_req': {'packets': 5, 'bytes': 3112}, 'tx_ls_upd': {'packets': 33998, 'bytes': 5309252}, 'tx_ls_ack': {'packets': 17571, 'bytes': 1220144}, 'tx_total': {'packets': 270607, 'bytes': 42933092}}}, 'ospf_header_errors': {'length': 0, 'instance_id': 0, 'checksum': 0, 'auth_type': 0, 'version': 0, 'bad_source': 0, 'no_virtual_link': 0, 'area_mismatch': 0, 'no_sham_link': 0, 'self_originated': 0, 'duplicate_id': 0, 'hello': 0, 'mtu_mismatch': 0, 'nbr_ignored': 2682, 'lls': 0, 'unknown_neighbor': 0, 'authentication': 0, 'ttl_check_fail': 0, 'adjacency_throttle': 0, 'bfd': 0, 'test_discard': 0}, 'ospf_lsa_errors': {'type': 0, 'length': 0, 'data': 0, 'checksum': 0}}}}}}}}, 'ospf_statistics': {'last_clear_traffic_counters': 'never', 'rcvd': {'total': 204136, 'checksum_errors': 0, 'hello': 159184, 'database_desc': 10240, 'link_state_req': 5, 'link_state_updates': 31899, 'link_state_acks': 2511}, 'sent': {'total': 281838, 'hello': 219736, 'database_desc': 10540, 'link_state_req': 5, 'link_state_updates': 33998, 'link_state_acks': 17571}}}
# Write your solutions for 1.5 here! class superheroes: def __int__(self, name, superpower, strength): self.name=name self.superpower=superpower self.strength=strength def print_me(self): print(self.name +str( self.strength)) superhero = superheroes("tamara","fly", 10) superhero.print_me()
class Superheroes: def __int__(self, name, superpower, strength): self.name = name self.superpower = superpower self.strength = strength def print_me(self): print(self.name + str(self.strength)) superhero = superheroes('tamara', 'fly', 10) superhero.print_me()
N = int(input()) A, B, C = input(), input(), input() ans = 0 for i in range(N): abc = A[i], B[i], C[i] ans += len(set(abc)) - 1 print(ans)
n = int(input()) (a, b, c) = (input(), input(), input()) ans = 0 for i in range(N): abc = (A[i], B[i], C[i]) ans += len(set(abc)) - 1 print(ans)
contador = 0 print("2 elevado a " + str(contador) + " es igual a: " + str(2 ** contador)) contador = 1 print("2 elevado a " + str(contador) + " es igual a: " + str(2 ** contador)) contador = 2 print("2 elevado a " + str(contador) + " es igual a: " + str(2 ** contador)) contador = 3 print("2 elevado a " + str(contador) + " es igual a: " + str(2 ** contador)) contador = 4 print("2 elevado a " + str(contador) + " es igual a: " + str(2 ** contador)) contador = 5 print("2 elevado a " + str(contador) + " es igual a: " + str(2 ** contador)) contador = 6 print("2 elevado a " + str(contador) + " es igual a: " + str(2 ** contador)) contador = 7 print("2 elevado a " + str(contador) + " es igual a: " + str(2 ** contador)) contador = 8 print("2 elevado a " + str(contador) + " es igual a: " + str(2 ** contador))
contador = 0 print('2 elevado a ' + str(contador) + ' es igual a: ' + str(2 ** contador)) contador = 1 print('2 elevado a ' + str(contador) + ' es igual a: ' + str(2 ** contador)) contador = 2 print('2 elevado a ' + str(contador) + ' es igual a: ' + str(2 ** contador)) contador = 3 print('2 elevado a ' + str(contador) + ' es igual a: ' + str(2 ** contador)) contador = 4 print('2 elevado a ' + str(contador) + ' es igual a: ' + str(2 ** contador)) contador = 5 print('2 elevado a ' + str(contador) + ' es igual a: ' + str(2 ** contador)) contador = 6 print('2 elevado a ' + str(contador) + ' es igual a: ' + str(2 ** contador)) contador = 7 print('2 elevado a ' + str(contador) + ' es igual a: ' + str(2 ** contador)) contador = 8 print('2 elevado a ' + str(contador) + ' es igual a: ' + str(2 ** contador))
class Number: def __init__(self): self.num = 0 def setNum(self, x): self.num = x # na= Number() # na.setNum(3) # print(hasattr(na, 'id')) a = ABCDEFGHIJKLMNOPQRSTUVWXYZ b = BLUESKYACDFGHIJMNOPQRTVWXZ class Point: def __init__(self, x=0, y=0): self.x = x self.y = y def __str__(self): return (self.x, self.y) def __add__(self, p2): return 4 p1 = Point(1, 2) p2 = Point(2, 3) print(p1+p2)
class Number: def __init__(self): self.num = 0 def set_num(self, x): self.num = x a = ABCDEFGHIJKLMNOPQRSTUVWXYZ b = BLUESKYACDFGHIJMNOPQRTVWXZ class Point: def __init__(self, x=0, y=0): self.x = x self.y = y def __str__(self): return (self.x, self.y) def __add__(self, p2): return 4 p1 = point(1, 2) p2 = point(2, 3) print(p1 + p2)
n = int(input()) ans = 0 for i in range(n): a, b = map(int, input().split()) ans += (a + b) * (b - a + 1) // 2 print(ans)
n = int(input()) ans = 0 for i in range(n): (a, b) = map(int, input().split()) ans += (a + b) * (b - a + 1) // 2 print(ans)
def is_leap(year): leap = False # Write your logic here if (year%400) == 0: leap = True elif (year%100) == 0: leap = False elif (year%4) == 0: leap = True return leap
def is_leap(year): leap = False if year % 400 == 0: leap = True elif year % 100 == 0: leap = False elif year % 4 == 0: leap = True return leap
__version__ = '2.0.0' print("*"*35) print(f'SpotifyToVKStatus. Version: {__version__}') print("*"*35)
__version__ = '2.0.0' print('*' * 35) print(f'SpotifyToVKStatus. Version: {__version__}') print('*' * 35)
file_name = input('Enter file name: ') if file_name == 'na na boo boo': print("NA NA BOO BOO TO YOU - You have been punk'd!") exit() else: try: file = open(file_name) except: print('File cannot be opened') exit() count = 0 numbers = 0 average = 0 for line in file: if line.startswith('X-DSPAM-Confidence'): colon_position = line.find(':') numbers = numbers + float(line[colon_position+1:]) count = count + 1 if count != 0: average = numbers / count print(average)
file_name = input('Enter file name: ') if file_name == 'na na boo boo': print("NA NA BOO BOO TO YOU - You have been punk'd!") exit() else: try: file = open(file_name) except: print('File cannot be opened') exit() count = 0 numbers = 0 average = 0 for line in file: if line.startswith('X-DSPAM-Confidence'): colon_position = line.find(':') numbers = numbers + float(line[colon_position + 1:]) count = count + 1 if count != 0: average = numbers / count print(average)
# # @lc app=leetcode id=46 lang=python3 # # [46] Permutations # # @lc code=start class Solution: def permute(self, nums: List[int]) -> List[List[int]]: results = [] prev_elements = [] def dfs(elements): if len(elements) == 0: results.append(prev_elements[:]) for e in elements: next_elements = elements[:] next_elements.remove(e) prev_elements.append(e) dfs(next_elements) prev_elements.pop() # dfs(nums) # return results return list(itertools.permutations(nums)) # @lc code=end
class Solution: def permute(self, nums: List[int]) -> List[List[int]]: results = [] prev_elements = [] def dfs(elements): if len(elements) == 0: results.append(prev_elements[:]) for e in elements: next_elements = elements[:] next_elements.remove(e) prev_elements.append(e) dfs(next_elements) prev_elements.pop() return list(itertools.permutations(nums))
def user(*args): blank=[] for num in args: blank+=1 return arg user()
def user(*args): blank = [] for num in args: blank += 1 return arg user()
class basedriver (object): def __init__(self, ctx, model): self._ctx = ctx self._model = model def check_update(self, current): if current is None: return True if current.version is None: return True if current.version != self._model.version: return True return False def update(self, fmgr): raise NotImplementedError() def unpack(self, fmgr, locations): raise NotImplementedError() def cleanup(self): pass
class Basedriver(object): def __init__(self, ctx, model): self._ctx = ctx self._model = model def check_update(self, current): if current is None: return True if current.version is None: return True if current.version != self._model.version: return True return False def update(self, fmgr): raise not_implemented_error() def unpack(self, fmgr, locations): raise not_implemented_error() def cleanup(self): pass
def get(key): return None def set(key, value): pass
def get(key): return None def set(key, value): pass
# Problem Statement: https://leetcode.com/problems/longest-increasing-subsequence/ class Solution: def lengthOfLIS(self, nums: List[int]) -> int: arr = nums if not arr: return 0 lens = [1 for num in arr] seqs = [None for num in arr] for i, num in enumerate(arr): curr_num = num for j in range(0, i): other_num = arr[j] if other_num < curr_num and lens[j] + 1 >= lens[i]: lens[i] = lens[j] + 1 seqs[i] = j return max(lens)
class Solution: def length_of_lis(self, nums: List[int]) -> int: arr = nums if not arr: return 0 lens = [1 for num in arr] seqs = [None for num in arr] for (i, num) in enumerate(arr): curr_num = num for j in range(0, i): other_num = arr[j] if other_num < curr_num and lens[j] + 1 >= lens[i]: lens[i] = lens[j] + 1 seqs[i] = j return max(lens)
print('load # extractor diagram V1 essential') # Essential version for the final summary automation in the main notebook. #It contains only the winning prefilter and feature extraction from the development process. class extdia_v1_essential(extractor_diagram): def ini_diagram(self): # custom # extractor diagram name self.name = 'EDiaV1' # name extention HP if self.fHP: self.name += 'HP' # name extention augment if self.augment>-1: self.name += 'aug' + str(self.augment) # name extention DeviceType ( Time Slicing or not) if self.DeviceType==1: self.name += 'TsSl' # extractor pre objects self.pre['denoise'] = feature_extractor_pre_nnFilterDenoise(self.base_folder,'den') self.pre['denoise'].set_hyperparamter(aggregation=np.mean, channel=0) if self.fHP: self.pre['HP'] = simple_FIR_HP(self.fHP, 16000) else: self.pre['HP'] = simple_FIR_HP(120, 16000) # extractor objects self.ext['MEL'] = feature_extractor_mel(self.base_folder,'MELv1') self.ext['MEL'].set_hyperparamter(n_fft=1024, n_mels=80, hop_length=512, channel=0) self.ext['PSD'] = feature_extractor_welchPSD(BASE_FOLDER,'PSDv1') self.ext['PSD'].set_hyperparamter(nperseg=512, nfft=1024, channel=0) # outport ini self.outport_akkulist['MEL_raw'] = [] self.outport_akkulist['PSD_raw'] = [] self.outport_akkulist['MEL_den'] = [] pass def execute_diagram(self,file_path,file_class, probe=False): # custom #-record target to akku append later # get file and cut main channel wmfs = [copy.deepcopy(memory_wave_file().read_wavfile(self.base_folder,file_path))] wmfs[0].channel = np.array([wmfs[0].channel[self.main_channel]]) #print(wmfs[0].channel.shape ) wmfs_class = [file_class] # react to augmenting flag if file_class==self.augment: #print(file_class,self.augment,file_path) wmfs.append(create_augmenter(wmfs[0])) wmfs_class.append(-1) #print(wmfs[0].channel.shape) for wmf_i,wmf in enumerate(wmfs): #print(wmf_i,wmfs_class[wmf_i],file_path) self.target_akkulist.append(wmfs_class[wmf_i]) #print(wmfs[wmf_i].channel.shape) # HP toggle on off if self.fHP: wmfs[wmf_i].channel[0] = self.pre['HP'].apply(wmf.channel[0]) #print(wmfs[wmf_i].channel.shape) # Time Slice if self.DeviceType == 1: wmfs[wmf_i].channel = TimeSliceAppendActivation(wmfs[wmf_i].channel,wmfs[wmf_i].srate) #print(wmfs[wmf_i].channel.shape,file_path) # denoise 2 self.pre['denoise'].create_from_wav(wmfs[wmf_i]) wmf_den2 = copy.deepcopy(self.pre['denoise'].get_wav_memory_file()) #->OUTPORTs self.ext['PSD'].create_from_wav(wmfs[wmf_i]) self.outport_akkulist['PSD_raw'].append(copy.deepcopy(self.ext['PSD'].get_dict())) self.ext['MEL'].create_from_wav(wmfs[wmf_i]) self.outport_akkulist['MEL_raw'].append(copy.deepcopy(self.ext['MEL'].get_dict())) self.ext['MEL'].create_from_wav(wmf_den2) self.outport_akkulist['MEL_den'].append(copy.deepcopy(self.ext['MEL'].get_dict())) pass
print('load # extractor diagram V1 essential') class Extdia_V1_Essential(extractor_diagram): def ini_diagram(self): self.name = 'EDiaV1' if self.fHP: self.name += 'HP' if self.augment > -1: self.name += 'aug' + str(self.augment) if self.DeviceType == 1: self.name += 'TsSl' self.pre['denoise'] = feature_extractor_pre_nn_filter_denoise(self.base_folder, 'den') self.pre['denoise'].set_hyperparamter(aggregation=np.mean, channel=0) if self.fHP: self.pre['HP'] = simple_fir_hp(self.fHP, 16000) else: self.pre['HP'] = simple_fir_hp(120, 16000) self.ext['MEL'] = feature_extractor_mel(self.base_folder, 'MELv1') self.ext['MEL'].set_hyperparamter(n_fft=1024, n_mels=80, hop_length=512, channel=0) self.ext['PSD'] = feature_extractor_welch_psd(BASE_FOLDER, 'PSDv1') self.ext['PSD'].set_hyperparamter(nperseg=512, nfft=1024, channel=0) self.outport_akkulist['MEL_raw'] = [] self.outport_akkulist['PSD_raw'] = [] self.outport_akkulist['MEL_den'] = [] pass def execute_diagram(self, file_path, file_class, probe=False): wmfs = [copy.deepcopy(memory_wave_file().read_wavfile(self.base_folder, file_path))] wmfs[0].channel = np.array([wmfs[0].channel[self.main_channel]]) wmfs_class = [file_class] if file_class == self.augment: wmfs.append(create_augmenter(wmfs[0])) wmfs_class.append(-1) for (wmf_i, wmf) in enumerate(wmfs): self.target_akkulist.append(wmfs_class[wmf_i]) if self.fHP: wmfs[wmf_i].channel[0] = self.pre['HP'].apply(wmf.channel[0]) if self.DeviceType == 1: wmfs[wmf_i].channel = time_slice_append_activation(wmfs[wmf_i].channel, wmfs[wmf_i].srate) self.pre['denoise'].create_from_wav(wmfs[wmf_i]) wmf_den2 = copy.deepcopy(self.pre['denoise'].get_wav_memory_file()) self.ext['PSD'].create_from_wav(wmfs[wmf_i]) self.outport_akkulist['PSD_raw'].append(copy.deepcopy(self.ext['PSD'].get_dict())) self.ext['MEL'].create_from_wav(wmfs[wmf_i]) self.outport_akkulist['MEL_raw'].append(copy.deepcopy(self.ext['MEL'].get_dict())) self.ext['MEL'].create_from_wav(wmf_den2) self.outport_akkulist['MEL_den'].append(copy.deepcopy(self.ext['MEL'].get_dict())) pass
n = int(input()) sticks = list(map(int, input().split())) uniq = sorted(set(sticks)) for i in uniq: print(len([x for x in sticks if x >= i]))
n = int(input()) sticks = list(map(int, input().split())) uniq = sorted(set(sticks)) for i in uniq: print(len([x for x in sticks if x >= i]))
x = 1 y = 10 if(x == 1): print("x equals 1") if(y != 1): print("y doesn't equal 1") if(x < y): print("x is less than y") elif(x > y): print("x is greater than y") else: print("x equals y") if (x == 1 and y == 10): print("Both values true") if(x < 10): if (y > 5): print("x is less than 10, y is greater than 5")
x = 1 y = 10 if x == 1: print('x equals 1') if y != 1: print("y doesn't equal 1") if x < y: print('x is less than y') elif x > y: print('x is greater than y') else: print('x equals y') if x == 1 and y == 10: print('Both values true') if x < 10: if y > 5: print('x is less than 10, y is greater than 5')
class BackgroundClip( Property, ): BorderBox = "border-box" PaddingBox = "padding-box" ContentBox = "content-box"
class Backgroundclip(Property): border_box = 'border-box' padding_box = 'padding-box' content_box = 'content-box'