content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Filename: for.py edibles = ['ham', 'spam', 'eggs', 'nuts'] for food in edibles: if food == 'spam': print('No more spam please!') break print('Great, delicious ' + food) else: print('I am so glad: No spam!') print('Finally, I finished stuffing...
edibles = ['ham', 'spam', 'eggs', 'nuts'] for food in edibles: if food == 'spam': print('No more spam please!') break print('Great, delicious ' + food) else: print('I am so glad: No spam!') print('Finally, I finished stuffing myself')
class QuoteLine: def __init__(self, lineText, lineNumber, origin): self.lineText = lineText self.lineNumber = lineNumber self.origin = origin self.renderedLine = None def renderLine(self, font, color): ''' Renders the line using the given font and color. ''' self.renderedLine = font.render(self.l...
class Quoteline: def __init__(self, lineText, lineNumber, origin): self.lineText = lineText self.lineNumber = lineNumber self.origin = origin self.renderedLine = None def render_line(self, font, color): """ Renders the line using the given font and color. """ ...
first_str = input() second_str = input() while first_str in second_str: second_str = second_str.replace(first_str, '') print(second_str)
first_str = input() second_str = input() while first_str in second_str: second_str = second_str.replace(first_str, '') print(second_str)
# # PySNMP MIB module CHIPFDDINET-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CHIPFDDINET-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:48:56 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, value_range_constraint, constraints_union, constraints_intersection) ...
# class Solution(object): # def generateParenthesis(self, n): # """ # :type n: int # :rtype: List[str] # """ class Solution(object): def generateParenthesis(self, n): if n == 1: return ['()'] last_list = self.generateParenthesis(n - 1) ...
class Solution(object): def generate_parenthesis(self, n): if n == 1: return ['()'] last_list = self.generateParenthesis(n - 1) res = [] for t in last_list: curr = t + ')' for index in range(len(curr)): if curr[index] == ')': ...
# MIT License # # Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved. # # 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 th...
def pretty_dict(d, indent=0): """Pretty the output format of a dictionary. Parameters ---------- d dict, the input dictionary instance. indent int, indent level, non-negative. Returns ------- res str, the output string """ res = '' for (k, v) in d.ite...
print(10/3) print(10//3) print() kue = 16 anak = 4 kuePerAnak = kue // anak print ("Setiap anak akan mendapatkan kue sebanyak ", kuePerAnak)
print(10 / 3) print(10 // 3) print() kue = 16 anak = 4 kue_per_anak = kue // anak print('Setiap anak akan mendapatkan kue sebanyak ', kuePerAnak)
class ExportUnit(Enum,IComparable,IFormattable,IConvertible): """ An enumerated type listing possible target units for CAD Export. enum ExportUnit,values: Centimeter (4),Default (0),Foot (2),Inch (1),Meter (5),Millimeter (3) """ def __eq__(self,*args): """ x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx._...
class Exportunit(Enum, IComparable, IFormattable, IConvertible): """ An enumerated type listing possible target units for CAD Export. enum ExportUnit,values: Centimeter (4),Default (0),Foot (2),Inch (1),Meter (5),Millimeter (3) """ def __eq__(self, *args): """ x.__eq__(y) <==> x==yx.__eq__(y) <=...
while True: X, M = map(int, input().split()) if X == 0 and M == 0: break Y = X * M print(Y)
while True: (x, m) = map(int, input().split()) if X == 0 and M == 0: break y = X * M print(Y)
age = 5+(8%3)-3+(3*10)/2 greetings = "Welcome to IEEE Python Workshop 2018 edition. It's my pleasure to conduct today's workshop for you." name = "Saurabh Mudgal" major = "mechanical engineering" print(greetings) print("My name is " + name + ".") print("I am " + str(age) + " years old and am majoring in " + major + "....
age = 5 + 8 % 3 - 3 + 3 * 10 / 2 greetings = "Welcome to IEEE Python Workshop 2018 edition. It's my pleasure to conduct today's workshop for you." name = 'Saurabh Mudgal' major = 'mechanical engineering' print(greetings) print('My name is ' + name + '.') print('I am ' + str(age) + ' years old and am majoring in ' + maj...
# -*- coding: utf-8 -*- __title__ = 'exp_mixture_model' __version__ = '1.0.0' __description__ = 'Maximum likelihood estimation and model selection of EMMs' __copyright__ = 'Copyright (C) 2019 Makoto Okada and Naoki Masuda' __license__ = 'MIT License' __author__ = 'Makoto Okada, Kenji Yamanishi and Naoki Masuda' __auth...
__title__ = 'exp_mixture_model' __version__ = '1.0.0' __description__ = 'Maximum likelihood estimation and model selection of EMMs' __copyright__ = 'Copyright (C) 2019 Makoto Okada and Naoki Masuda' __license__ = 'MIT License' __author__ = 'Makoto Okada, Kenji Yamanishi and Naoki Masuda' __author_email__ = 'naoki.masud...
class Product: def __init__(self, name, category_name, unit_price): self.name = name self.category_name = category_name self.unit_price = unit_price def __str__(self): return f"Nazwa: {self.name} | Kategoria: {self.category_name} | Cena: {self.unit_price} PLN/szt"
class Product: def __init__(self, name, category_name, unit_price): self.name = name self.category_name = category_name self.unit_price = unit_price def __str__(self): return f'Nazwa: {self.name} | Kategoria: {self.category_name} | Cena: {self.unit_price} PLN/szt'
class Shape: def __init__(self): self.data = ['_' for _ in range(10)] def print_out(self): print(''.join(self.data)) class Even(Shape): def draw_func(self, x): if x % 2 == 0: return True else: return False class ThirdBiggerFive(Shape): def draw_f...
class Shape: def __init__(self): self.data = ['_' for _ in range(10)] def print_out(self): print(''.join(self.data)) class Even(Shape): def draw_func(self, x): if x % 2 == 0: return True else: return False class Thirdbiggerfive(Shape): def dr...
#!/usr/bin/python3 # steinkirch at gmail.com # astro.sunysb.edu/steinkirch class Node(object): def __init__(self, value=None): self.value = value self.next = None class Stack(object): def __init__(self): self.top = None def push(self, item): node = Node(item) node...
class Node(object): def __init__(self, value=None): self.value = value self.next = None class Stack(object): def __init__(self): self.top = None def push(self, item): node = node(item) node.next = self.top self.top = node def pop(self): if sel...
# coding: utf-8 def naive_square_matrix_product(A, B): """ Implementation of naive squre matrix multiplication algorithm """ n = len(A) C = [[0 for _ in range(n)] for _ in range(n)] for i in range(n): for j in range(n): for k in range(n): C[i][j] += A[i][k] * B[k][...
def naive_square_matrix_product(A, B): """ Implementation of naive squre matrix multiplication algorithm """ n = len(A) c = [[0 for _ in range(n)] for _ in range(n)] for i in range(n): for j in range(n): for k in range(n): C[i][j] += A[i][k] * B[k][j] return C de...
def lmap(f, it): return list(map(f, it)) def ints(it): return lmap(int, it) def solve(input): l = len(input.split()[0]) xs = lmap(lambda x: int(x, 2), input.split()) a = 0 for i in range(l): cnt = [0, 0] for x in xs: cnt[(x >> i) & 1] += 1 if cnt[1] > cnt[...
def lmap(f, it): return list(map(f, it)) def ints(it): return lmap(int, it) def solve(input): l = len(input.split()[0]) xs = lmap(lambda x: int(x, 2), input.split()) a = 0 for i in range(l): cnt = [0, 0] for x in xs: cnt[x >> i & 1] += 1 if cnt[1] > cnt[0]: ...
#!/usr/bin/env python3 # # Author: # Tamas Jos (@skelsec) # PROCESS_QUERY_INFORMATION = 0x0400 PROCESS_VM_READ = 0x0010 PROCESS_VM_WRITE = 0x0020 PROCESS_VM_OPERATION = 0x0008 PROCESS_CREATE_THREAD = 0x0002 # Standard access rights DELETE = 0x00010000 READ_CONTROL = 0x00...
process_query_information = 1024 process_vm_read = 16 process_vm_write = 32 process_vm_operation = 8 process_create_thread = 2 delete = 65536 read_control = 131072 write_dac = 262144 write_owner = 524288 synchronize = 1048576 standard_rights_required = 983040 standard_rights_read = READ_CONTROL standard_rights_write = ...
class Solution(object): def frequencySort(self, s): """ :type s: str :rtype: str """ d = collections.defaultdict(int) for c in s: d[c] += 1 l = [[-d[key],key] for key in d] l.sort() # print l res = ''.join(...
class Solution(object): def frequency_sort(self, s): """ :type s: str :rtype: str """ d = collections.defaultdict(int) for c in s: d[c] += 1 l = [[-d[key], key] for key in d] l.sort() res = ''.join([-n * c for (n, c) in l]) ...
class Helper: @staticmethod def is_Empty(obj): flag = False if obj is None: flag = True elif not obj.strip(): flag = True else: flag = False return flag if __name__ == '__main__': print(Helper.is_Empty(None))
class Helper: @staticmethod def is__empty(obj): flag = False if obj is None: flag = True elif not obj.strip(): flag = True else: flag = False return flag if __name__ == '__main__': print(Helper.is_Empty(None))
''' Lambda expressions are quick way of creating the anonymous functions: ''' #function without lamda expression: def square(num): return num ** 2 print(square(5)) #converting it into lambda expression: lambda num : num ** 2 #if we want we can assign this to variable like square2 = lambda num : num ** 2. # we are...
""" Lambda expressions are quick way of creating the anonymous functions: """ def square(num): return num ** 2 print(square(5)) lambda num: num ** 2 square2 = lambda num: num ** 2.0 print(square2(5)) print(list(map(lambda num: num ** 2, [1, 2, 3, 4]))) '\nMap: map() --> map(func, *iterables) --> map object\n' def...
# Builds the Netty fork of Tomcat Native. See http://netty.io/wiki/forked-tomcat-native.html { 'targets': [ { 'target_name': 'netty-tcnative-so', 'product_name': 'netty-tcnative', 'type': 'shared_library', 'sources': [ 'src/c/address.c', 'src/c/bb.c', 'src/c/dir.c',...
{'targets': [{'target_name': 'netty-tcnative-so', 'product_name': 'netty-tcnative', 'type': 'shared_library', 'sources': ['src/c/address.c', 'src/c/bb.c', 'src/c/dir.c', 'src/c/error.c', 'src/c/file.c', 'src/c/info.c', 'src/c/jnilib.c', 'src/c/lock.c', 'src/c/misc.c', 'src/c/mmap.c', 'src/c/multicast.c', 'src/c/network...
#!/usr/bin/python3 def set_dependencies(source_nodes): """Sets contract node dependencies. Arguments: source_nodes: list of SourceUnit objects. Returns: SourceUnit objects where all ContractDefinition nodes contain 'dependencies' and 'libraries' attributes.""" symbol_map = get_s...
def set_dependencies(source_nodes): """Sets contract node dependencies. Arguments: source_nodes: list of SourceUnit objects. Returns: SourceUnit objects where all ContractDefinition nodes contain 'dependencies' and 'libraries' attributes.""" symbol_map = get_symbol_map(source_node...
# https://www.acmicpc.net/problem/9020 if __name__ == '__main__': input = __import__('sys').stdin.readline N = 10_001 T = int(input()) is_prime = [True for _ in range(N)] sqrt = int(N ** (1 / 2)) is_prime[0] = is_prime[1] = False for idx in range(2, sqrt + 1): if not is_prime[idx]...
if __name__ == '__main__': input = __import__('sys').stdin.readline n = 10001 t = int(input()) is_prime = [True for _ in range(N)] sqrt = int(N ** (1 / 2)) is_prime[0] = is_prime[1] = False for idx in range(2, sqrt + 1): if not is_prime[idx]: continue for num in r...
def bin_value(num): return bin(num) [2:] def remove0b(num): return num [2:] numberA = int(input("")) numberB = int(input("")) binaryA = bin_value(numberA) binaryB = bin_value(numberB) sum = bin(int(binaryA,2) + int(binaryB,2)) cleaned = remove0b(sum) binaryA = str(binaryA) binaryB = str(binaryB) sum = str(cle...
def bin_value(num): return bin(num)[2:] def remove0b(num): return num[2:] number_a = int(input('')) number_b = int(input('')) binary_a = bin_value(numberA) binary_b = bin_value(numberB) sum = bin(int(binaryA, 2) + int(binaryB, 2)) cleaned = remove0b(sum) binary_a = str(binaryA) binary_b = str(binaryB) sum = st...
# HEAD # Classes - Setters are shallow # DESCRIPTION # Describes how setting of inherited attributes and values function # RESOURCES # # Creating Parent class class Parent(): par_cent = "parent" # Parent Init method def __init__(self, val): self.par_cent = val print("Parent Instantiated ...
class Parent: par_cent = 'parent' def __init__(self, val): self.par_cent = val print('Parent Instantiated with ', self.par_cent) class Child(Parent): def __init__(self, val_two): print('Child Instantiated with ', val_two) self.p = super() self.p.__init__(val_two) o...
#!/usr/bin/env python # encoding: utf-8 ''' @author: Jason Lee @license: (C) Copyright @ Jason Lee @contact: jiansenll@163.com @file: jianzhi_offer_31.py @time: 2019/4/23 16:09 @desc: ''' class Solution: def FindGreatestSumOfSubArray(self, array): if not array: return 0 f = arr...
""" @author: Jason Lee @license: (C) Copyright @ Jason Lee @contact: jiansenll@163.com @file: jianzhi_offer_31.py @time: 2019/4/23 16:09 @desc: """ class Solution: def find_greatest_sum_of_sub_array(self, array): if not array: return 0 f = array for i in range(1, len(arr...
def get_eig_Jacobian(pars, fp): """ Simulate the Wilson-Cowan equations Args: pars : Parameter dictionary fp : fixed point (E, I), array Returns: evals : 2x1 vector of eigenvalues of the Jacobian matrix """ #get the parameters tau_E, a_E, theta_E = pars['tau_E'], pars['a_E'], pars[...
def get_eig__jacobian(pars, fp): """ Simulate the Wilson-Cowan equations Args: pars : Parameter dictionary fp : fixed point (E, I), array Returns: evals : 2x1 vector of eigenvalues of the Jacobian matrix """ (tau_e, a_e, theta_e) = (pars['tau_E'], pars['a_E'], pars['theta_E']) (...
k, n, w = map(int, input().split()) x = 1 money = 0 while x <= w and money != -1: money += k * x x += 1 money_toborrow = money - n if money_toborrow >= 0: print(money_toborrow) else: print(0)
(k, n, w) = map(int, input().split()) x = 1 money = 0 while x <= w and money != -1: money += k * x x += 1 money_toborrow = money - n if money_toborrow >= 0: print(money_toborrow) else: print(0)
def fatorial (n): r = 1 for num in range (n, 1, -1): r *= num return r def dobro (n): num = n * 2 return num def triplo (n): num = n * 3 return num
def fatorial(n): r = 1 for num in range(n, 1, -1): r *= num return r def dobro(n): num = n * 2 return num def triplo(n): num = n * 3 return num
#####################################Data class class RealNews(object): def __init__(self, date, headline, description,distype, url="", imageurl="",location=""): self.date = date self.headline = headline self.description = description self.url = url self.distype = distype ...
class Realnews(object): def __init__(self, date, headline, description, distype, url='', imageurl='', location=''): self.date = date self.headline = headline self.description = description self.url = url self.distype = distype self.imageurl = imageurl self.lo...
bicicleta=["bike","cannon","cargo", "CALOI"] #Armazenamento de farias mensagens/lista em uma string print(bicicleta[0].title()) print(bicicleta[1]) print(bicicleta[2]) print(bicicleta[3]) print(bicicleta[-1]) print(bicicleta[-2]) print(bicicleta[-3]) print(bicicleta[-4].title()) #como...
bicicleta = ['bike', 'cannon', 'cargo', 'CALOI'] print(bicicleta[0].title()) print(bicicleta[1]) print(bicicleta[2]) print(bicicleta[3]) print(bicicleta[-1]) print(bicicleta[-2]) print(bicicleta[-3]) print(bicicleta[-4].title()) mensagem = 'Minha Primeira Bicicleta foi uma ' + bicicleta[3].title() + '!' print(mensagem)
class Subtract: def __init__(self,fnum,snum): self.fnum=fnum self.snum=snum def allSub(self): self.sub=self.fnum-self.snum return self.sub
class Subtract: def __init__(self, fnum, snum): self.fnum = fnum self.snum = snum def all_sub(self): self.sub = self.fnum - self.snum return self.sub
model = Sequential() model.add(LSTM(50, return_sequences = True, input_shape = (x_train.shape[1], 1))) model.add(LSTM(50, return_sequences = False)) model.add(Dense(25)) model.add(Dense(1)) #Compiling the model model.compile(optimizer = 'adam', loss = 'mean_squared_error') #using rmse
model = sequential() model.add(lstm(50, return_sequences=True, input_shape=(x_train.shape[1], 1))) model.add(lstm(50, return_sequences=False)) model.add(dense(25)) model.add(dense(1)) model.compile(optimizer='adam', loss='mean_squared_error')
DEFAULT_REDIS_PORT = 6379 # Number of seconds to sleep upon successful end to allow graceful termination of subprocesses. TERMINATION_TIME = 3 # Max caps on parameters MAX_NUM_STEPS = 10000 MAX_OBSERVATION_DELTA = 5000 MAX_VIDEO_FPS = 60
default_redis_port = 6379 termination_time = 3 max_num_steps = 10000 max_observation_delta = 5000 max_video_fps = 60
# -*- coding: utf-8 -*- """Utils for celery.""" def init_celery(celery, app): celery.conf.update(app.config) celery.conf.update( task_serializer='json', accept_content=['json'], # Ignore other content result_serializer='json', timezone='Europe/Berlin', enable_utc=True...
"""Utils for celery.""" def init_celery(celery, app): celery.conf.update(app.config) celery.conf.update(task_serializer='json', accept_content=['json'], result_serializer='json', timezone='Europe/Berlin', enable_utc=True) task_base = celery.Task class Contexttask(TaskBase): abstract = True ...
key = input().strip() value = input().strip() count = int(input()) result = '' for entry in range(count): keys, values = input().split(' => ') if key in keys: result += f'{keys}:\n' if value in values: all_values = '\n'.join([f'-{v}' for v in values.split(';') if value in v]) ...
key = input().strip() value = input().strip() count = int(input()) result = '' for entry in range(count): (keys, values) = input().split(' => ') if key in keys: result += f'{keys}:\n' if value in values: all_values = '\n'.join([f'-{v}' for v in values.split(';') if value in v]) ...
""" Written by Jesse Evers Finds the factorial of a number. """ def factorial(num): # While num > 1, multiply num by num - 1 if num > 1: return num * factorial(num - 1) return num print(factorial(10))
""" Written by Jesse Evers Finds the factorial of a number. """ def factorial(num): if num > 1: return num * factorial(num - 1) return num print(factorial(10))
''' Author : MiKueen Level : Medium Problem Statement : Product of Array Except Self Given an array nums of n integers where n > 1, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i]. Example: Input: [1,2,3,4] Output: [24,12,8,6] Constraint: It's guaranteed...
""" Author : MiKueen Level : Medium Problem Statement : Product of Array Except Self Given an array nums of n integers where n > 1, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i]. Example: Input: [1,2,3,4] Output: [24,12,8,6] Constraint: It's guaranteed...
name = str(input()) salary = float(input()) sales = float(input()) total = salary + (sales * 0.15) print(f'TOTAL = R$ {total:.2f}')
name = str(input()) salary = float(input()) sales = float(input()) total = salary + sales * 0.15 print(f'TOTAL = R$ {total:.2f}')
class Parameters: WINDOW_WIDTH = 500 WINDOW_HEIGHT = 600 BASE_HEIGHT = 100 BASE_IMAGE = "base.png" BACKGROUND_IMAGE = "bg.png" BIRD_IMAGES = ["bird1.png", "bird2.png", "bird3.png"] PIPE_IMAGES = ["pipe.png"]
class Parameters: window_width = 500 window_height = 600 base_height = 100 base_image = 'base.png' background_image = 'bg.png' bird_images = ['bird1.png', 'bird2.png', 'bird3.png'] pipe_images = ['pipe.png']
# It make a node class node: def __init__(self, symbol): self.symbol = symbol self.edges = [] self.shortest_distance = float('inf') self.shortest_path_via = None # Adds another node as a weighted edge def add_edge(self, node, distance): self.edges.append([node, dista...
class Node: def __init__(self, symbol): self.symbol = symbol self.edges = [] self.shortest_distance = float('inf') self.shortest_path_via = None def add_edge(self, node, distance): self.edges.append([node, distance]) def update_edges(self): for edge in self...
d=dict() for _ in range(int(input())): s=input().split(' ',1) d[s[0]]=list(map(int,s[1].split())) d=dict(sorted(d.items(), key=lambda x: x[0])) d=dict(sorted(d.items(), key=lambda x: x[1][2],reverse=True)) d=dict(sorted(d.items(), key=lambda x: x[1][1],reverse=True)) d=dict(sorted(d.items(), key=lambda x: x[1][...
d = dict() for _ in range(int(input())): s = input().split(' ', 1) d[s[0]] = list(map(int, s[1].split())) d = dict(sorted(d.items(), key=lambda x: x[0])) d = dict(sorted(d.items(), key=lambda x: x[1][2], reverse=True)) d = dict(sorted(d.items(), key=lambda x: x[1][1], reverse=True)) d = dict(sorted(d.items(), k...
def my_func(count=4): for i in range (1, 5): print("count", count) if count == 2: print("count", count) count = count - 1 my_func()
def my_func(count=4): for i in range(1, 5): print('count', count) if count == 2: print('count', count) count = count - 1 my_func()
""" 217. Contains Duplicate https://leetcode.com/problems/contains-duplicate/ Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct. Example: Input: [1,2,3,1] Ou...
""" 217. Contains Duplicate https://leetcode.com/problems/contains-duplicate/ Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct. Example: Input: [1,2,3,1] Ou...
s = str(input()) ss = ''.join(list(reversed(s))) sss = ss[:2] ssss = ''.join(list(reversed(sss))) print(ssss)
s = str(input()) ss = ''.join(list(reversed(s))) sss = ss[:2] ssss = ''.join(list(reversed(sss))) print(ssss)
num=5 for i in range(1,num+1): toPrint="" end=int(i*(i+1)/2) a=list(j for j in range(end+1-i,end+1)) for x in a: toPrint+=" "+str(x) print(toPrint) toPrint="" #output ''' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 '''
num = 5 for i in range(1, num + 1): to_print = '' end = int(i * (i + 1) / 2) a = list((j for j in range(end + 1 - i, end + 1))) for x in a: to_print += ' ' + str(x) print(toPrint) to_print = '' '\n1\n2 3\n4 5 6\n7 8 9 10\n11 12 13 14 15\n'
if __name__ == '__main__': x = int(input()) y = int(input()) z = int(input()) n = int(input()) ar = [] #p=0 for i in range(x+1): for j in range(y+1): for k in range(z+1): if (i+j+k) != n: ar.append([i,j,k]) print(ar) """for i in r...
if __name__ == '__main__': x = int(input()) y = int(input()) z = int(input()) n = int(input()) ar = [] for i in range(x + 1): for j in range(y + 1): for k in range(z + 1): if i + j + k != n: ar.append([i, j, k]) print(ar) 'for i in rang...
expected_output = { 'mstp': { 'mst_instances': { 0: { 'mst_id': 0, 'bridge_priority': 32768, 'bridge_sysid': 0, 'bridge_address': '00e3.04ff.ad03', 'topology_change_flag': False, 'topology_detected_...
expected_output = {'mstp': {'mst_instances': {0: {'mst_id': 0, 'bridge_priority': 32768, 'bridge_sysid': 0, 'bridge_address': '00e3.04ff.ad03', 'topology_change_flag': False, 'topology_detected_flag': False, 'topology_changes': 0, 'time_since_topology_change': '142:22:13', 'times': {'hold': 1, 'topology_change': 70, 'n...
#THIS IS HANGMAN print('"Hangman"\nA game where you will try to guess which the hidden word is!') print('\n') word = input('Input the word to guess:\n') while True: if word.isalpha(): break else: word = input('Wrong input, type a valid word:\n') number_of_letters = len(word) word_listed_lett...
print('"Hangman"\nA game where you will try to guess which the hidden word is!') print('\n') word = input('Input the word to guess:\n') while True: if word.isalpha(): break else: word = input('Wrong input, type a valid word:\n') number_of_letters = len(word) word_listed_letters = list(word) prin...
dataset_type = "SuperviselyDataset" data_root = '/data/slyproject' class_names = ['Car', 'Pedestrian', 'Cyclist', 'DontCare'] point_cloud_range = [0, -40, -3, 70.4, 40, 1] input_modality = dict(use_lidar=True, use_camera=False) file_client_args = dict(backend='disk') # db_sampler = dict( # data_root=data_root, # ...
dataset_type = 'SuperviselyDataset' data_root = '/data/slyproject' class_names = ['Car', 'Pedestrian', 'Cyclist', 'DontCare'] point_cloud_range = [0, -40, -3, 70.4, 40, 1] input_modality = dict(use_lidar=True, use_camera=False) file_client_args = dict(backend='disk') train_pipeline = [dict(type='LoadPointsFromSlyFile')...
LIST_ASSIGNED_USER_ROLE_RESPONSE = """ [ { "id": "IFIFAX2BIRGUSTQ", "label": "Application Administrator", "type": "APP_ADMIN", "status": "ACTIVE", "created": "2019-02-06T16:17:40.000Z", "lastUpdated": "2019-02-06T16:17:40.000Z", "assignmentType": "USER", ...
list_assigned_user_role_response = '\n[\n {\n "id": "IFIFAX2BIRGUSTQ",\n "label": "Application Administrator",\n "type": "APP_ADMIN",\n "status": "ACTIVE",\n "created": "2019-02-06T16:17:40.000Z",\n "lastUpdated": "2019-02-06T16:17:40.000Z",\n "assignmentType": "USER"...
while True: num = int(input("Enter a number: ")) if num % 2 == 0: print(num, "is an even number") else: print(f"{num} is a odd number")
while True: num = int(input('Enter a number: ')) if num % 2 == 0: print(num, 'is an even number') else: print(f'{num} is a odd number')
__package_name__ = 'python-utils' __version__ = '2.5.0' __author__ = 'Rick van Hattem' __author_email__ = 'Wolph@wol.ph' __description__ = ( 'Python Utils is a module with some convenient utilities not included ' 'with the standard Python install') __url__ = 'https://github.com/WoLpH/python-utils'
__package_name__ = 'python-utils' __version__ = '2.5.0' __author__ = 'Rick van Hattem' __author_email__ = 'Wolph@wol.ph' __description__ = 'Python Utils is a module with some convenient utilities not included with the standard Python install' __url__ = 'https://github.com/WoLpH/python-utils'
class BBUtil(object): def __init__(self,width,height): super(BBUtil, self).__init__() self.width=width self.height=height def xywh_to_tlwh(self, bbox_xywh): x,y,w,h = bbox_xywh xmin = max(int(round(x - (w / 2))),0) ymin = max(int(round(y - (h / 2))),0) r...
class Bbutil(object): def __init__(self, width, height): super(BBUtil, self).__init__() self.width = width self.height = height def xywh_to_tlwh(self, bbox_xywh): (x, y, w, h) = bbox_xywh xmin = max(int(round(x - w / 2)), 0) ymin = max(int(round(y - h / 2)), 0) ...
class Storage: __storage = 0 def __init__(self, capacity): self.capacity = capacity self.storage = [] def add_product(self, product): if not Storage.__storage == self.capacity: self.storage.append(product) Storage.__storage += 1 def get_products(self): ...
class Storage: __storage = 0 def __init__(self, capacity): self.capacity = capacity self.storage = [] def add_product(self, product): if not Storage.__storage == self.capacity: self.storage.append(product) Storage.__storage += 1 def get_products(self): ...
# A CAN bus. class Bus(object): """A CAN bus. """ def __init__(self, name, comment=None, baudrate=None, fd_baudrate=None, autosar_specifics=None): self._name = name # If the 'comment' argument is a strin...
class Bus(object): """A CAN bus. """ def __init__(self, name, comment=None, baudrate=None, fd_baudrate=None, autosar_specifics=None): self._name = name if isinstance(comment, str): self._comments = {None: comment} else: self._comments = comment self....
def signFinder (s): plus = s.count("-") minus = s.count("+") total = plus+minus if total == 1: return True else: return False
def sign_finder(s): plus = s.count('-') minus = s.count('+') total = plus + minus if total == 1: return True else: return False
"""Postgres Connector error classes.""" class PostgresConnectorError(Exception): """Base class for all errors.""" class PostgresClientError(PostgresConnectorError): """An error specific to the PostgreSQL driver."""
"""Postgres Connector error classes.""" class Postgresconnectorerror(Exception): """Base class for all errors.""" class Postgresclienterror(PostgresConnectorError): """An error specific to the PostgreSQL driver."""
def binary_search(arr, target): low, high = 0, len(arr)-1 while low < high: mid = (low + high)/2 if arr[mid] == target: return mid elif arr[mid] > target: high = mid - 1 else: low = mid + 1 return high if __name__ == "__main__": lst = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] ...
def binary_search(arr, target): (low, high) = (0, len(arr) - 1) while low < high: mid = (low + high) / 2 if arr[mid] == target: return mid elif arr[mid] > target: high = mid - 1 else: low = mid + 1 return high if __name__ == '__main__': ...
#EP1 ''' def getPentagonalNumber(n): i = 1 for i in range(1,n+1): s = (i*(3*i-1)*1.0)/2 print (str(s)+' ',end='') if i%10==0: print() getPentagonalNumber(100) ''' #EP2 ''' def sum(n): s= 0 while(n%10!=0): a=n%10 b=n//10 s=s+a n=b p...
""" def getPentagonalNumber(n): i = 1 for i in range(1,n+1): s = (i*(3*i-1)*1.0)/2 print (str(s)+' ',end='') if i%10==0: print() getPentagonalNumber(100) """ '\ndef sum(n):\n s= 0\n while(n%10!=0):\n a=n%10\n b=n//10\n s=s+a\n n=b\n print...
# -*- coding: utf-8 -*- """ Created on Fri Feb 19 13:45:46 2021 @author: Lakhan Kumawat """ mylist=input().split() k=int(input()) k1=k mylist1=mylist mylist1.sort() mylist.sort() max1=max(mylist1) #print(mylist,mylist1) #remove k-1th max from list1 and print max while(k1-1!=0): while(max(mylist1)...
""" Created on Fri Feb 19 13:45:46 2021 @author: Lakhan Kumawat """ mylist = input().split() k = int(input()) k1 = k mylist1 = mylist mylist1.sort() mylist.sort() max1 = max(mylist1) while k1 - 1 != 0: while max(mylist1) == max1: mylist1.remove(max(mylist1)) max1 = max(mylist1) k1 -= 1 min2 = min(m...
# coding=utf-8 __author__ = 'co2y' __email__ = 'co2y@foxmail.com' __version__ = '0.0.1'
__author__ = 'co2y' __email__ = 'co2y@foxmail.com' __version__ = '0.0.1'
""" Errors relating to partitioning """ # Partitioning partitionWarning = ("Partitioning suggests no partitions.\n" "Recommend running with different partitioning method or disable partitioning")
""" Errors relating to partitioning """ partition_warning = 'Partitioning suggests no partitions.\nRecommend running with different partitioning method or disable partitioning'
def main(): full_name = get_full_name() print() password = get_password() print() first_name = get_first_name(full_name) print("Hi " + first_name + ", thanks for creating an account.") def get_full_name(): while True: name = input("Enter full name: ").s...
def main(): full_name = get_full_name() print() password = get_password() print() first_name = get_first_name(full_name) print('Hi ' + first_name + ', thanks for creating an account.') def get_full_name(): while True: name = input('Enter full name: ').strip() if ' ' in...
#EVALUATION OF THE MODEL def evaluate_model(model, X_test, y_test): _, score = model.evaluate(X_test, y_test, verbose = 0) print(score) def predict_model(model, X): y = model.predict(X) print(y) def predict_class_model(model, X): y = model.predict_classes(X) print(y)
def evaluate_model(model, X_test, y_test): (_, score) = model.evaluate(X_test, y_test, verbose=0) print(score) def predict_model(model, X): y = model.predict(X) print(y) def predict_class_model(model, X): y = model.predict_classes(X) print(y)
class Solution: def removeKdigits(self, num: str, k: int) -> str: if len(num) == 0 and len(num) <= k : return "0" st = [num[0]] i = 1 while i < len(num): while len(st) > 0 and int(st[-1]) > int(num[i]) and k > 0: st.pop() ...
class Solution: def remove_kdigits(self, num: str, k: int) -> str: if len(num) == 0 and len(num) <= k: return '0' st = [num[0]] i = 1 while i < len(num): while len(st) > 0 and int(st[-1]) > int(num[i]) and (k > 0): st.pop() k -...
file_input = open("motivation.txt",'w') file_input.write("Never give up") file_input.write("\nRise above hate") file_input.write("\nNo body remember second place") file_input.close()
file_input = open('motivation.txt', 'w') file_input.write('Never give up') file_input.write('\nRise above hate') file_input.write('\nNo body remember second place') file_input.close()
__title__ = "django-kindeditor" __description__ = "Django admin KindEditor integration." __url__ = "https://github.com/waketzheng/django-kindeditor" __version__ = "0.3.0" __author__ = "Waket Zheng" __author_email__ = "waketzheng@gmail.com" __license__ = "MIT" __copyright__ = "Copyright 2019 Waket Zheng"
__title__ = 'django-kindeditor' __description__ = 'Django admin KindEditor integration.' __url__ = 'https://github.com/waketzheng/django-kindeditor' __version__ = '0.3.0' __author__ = 'Waket Zheng' __author_email__ = 'waketzheng@gmail.com' __license__ = 'MIT' __copyright__ = 'Copyright 2019 Waket Zheng'
class BoundingBox: x: int y: int x2: int y2: int cx: int cy: int width: int height: int def __init__(self, x: int, y: int, width: int, height: int): self.x = x self.y = y self.width = width self.height = height self.x2 = x + width - 1 ...
class Boundingbox: x: int y: int x2: int y2: int cx: int cy: int width: int height: int def __init__(self, x: int, y: int, width: int, height: int): self.x = x self.y = y self.width = width self.height = height self.x2 = x + width - 1 ...
#!/usr/bin/env python3 def convert_to_celsius(fahrenheit: float) -> float: return (fahrenheit - 32.0) * 5.0 / 9.0 def above_freezing(celsius: float) -> bool: return celsius > 0 fahrenheit = float(input('Enter the temperature in degrees Fahrenheit: ')) celsius = convert_to_celsius(fahrenheit) print(celsius)...
def convert_to_celsius(fahrenheit: float) -> float: return (fahrenheit - 32.0) * 5.0 / 9.0 def above_freezing(celsius: float) -> bool: return celsius > 0 fahrenheit = float(input('Enter the temperature in degrees Fahrenheit: ')) celsius = convert_to_celsius(fahrenheit) print(celsius) if above_freezing(celsius)...
numero = str(input('digite um numero')) print('unidade: {}'.format(numero[1])) print('dezena: {}'.format(numero[2])) print('centena: {} '.format(numero[3])) print('unidade de milhar: {}'.format(numero[4]))
numero = str(input('digite um numero')) print('unidade: {}'.format(numero[1])) print('dezena: {}'.format(numero[2])) print('centena: {} '.format(numero[3])) print('unidade de milhar: {}'.format(numero[4]))
def floydwarshall(G): """ Compute and return the all pairs shortest paths solution. Notice the returned path cost matrix P has modified entries. For example, P[i][j] contains a tuple (c, v1) where c is the cost of the shortest path from i to j, and v1 is the first vertex along said path after i....
def floydwarshall(G): """ Compute and return the all pairs shortest paths solution. Notice the returned path cost matrix P has modified entries. For example, P[i][j] contains a tuple (c, v1) where c is the cost of the shortest path from i to j, and v1 is the first vertex along said path after i....
""" Tema: Arrays Curso: Estructura de Datos Lineales (Python). Plataforma: Platzi. Profesor: Hector Vega. Alumno: @edinsonrequena. """ class Array(object): """A simple array""" def __init__(self, capacity: int, fill_value=None) -> None: self.items = list() for i in range(capacity): ...
""" Tema: Arrays Curso: Estructura de Datos Lineales (Python). Plataforma: Platzi. Profesor: Hector Vega. Alumno: @edinsonrequena. """ class Array(object): """A simple array""" def __init__(self, capacity: int, fill_value=None) -> None: self.items = list() for i in range(capacity): ...
def f(): '''f''' pass def f1(): pass f2 = f if True: def g(): pass else: def h(): pass class C: def i(self): pass def j(self): def j2(self): pass class C2: def k(self): pass
def f(): """f""" pass def f1(): pass f2 = f if True: def g(): pass else: def h(): pass class C: def i(self): pass def j(self): def j2(self): pass class C2: def k(self): pass
# 450. Delete_Node_in_a_BST # ttungl@gmail.com # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def deleteNode(self, root, key): """ :type root: TreeNode ...
class Solution(object): def delete_node(self, root, key): """ :type root: TreeNode :type key: int :rtype: TreeNode """ if root is None: return None if root.val > key: root.left = self.deleteNode(root.left, key) elif root.val < ...
""" Day 8 - Part 1 https://adventofcode.com/2021/day/8 By NORXND @ 08.12.2021 (C) NORXND 2021 - Under The MIT License """ input_file = open('Day8/input.txt', 'r') entries = [] for entry in input_file.readlines(): entry = entry.strip().split(" | ") patterns = entry[0].split(" ") output = entry[1].split("...
""" Day 8 - Part 1 https://adventofcode.com/2021/day/8 By NORXND @ 08.12.2021 (C) NORXND 2021 - Under The MIT License """ input_file = open('Day8/input.txt', 'r') entries = [] for entry in input_file.readlines(): entry = entry.strip().split(' | ') patterns = entry[0].split(' ') output = entry[1].split(' ')...
IPlist = ['209.85.238.4','216.239.51.98','64.233.173.198','64.3.17.208','64.233.173.238'] # for address in range(len(IPlist)): # IPlist[address] = '%3s.%3s.%3s.%3s' % tuple(IPlist[address].split('.')) # IPlist.sort(reverse=False) # for address in range(len(IPlist)): # IPlist[address] = IPlist[address].re...
i_plist = ['209.85.238.4', '216.239.51.98', '64.233.173.198', '64.3.17.208', '64.233.173.238'] IPlist.sort(key=lambda address: list(map(str, address.split('.')))) print(IPlist)
class Base1: def FuncA(self): print("Base1::FuncA") class Base2: def FuncA(self): print("Base2::FuncA") class Child(Base1, Base2): pass def main(): obj=Child() obj.FuncA() if __name__ == "__main__": main()
class Base1: def func_a(self): print('Base1::FuncA') class Base2: def func_a(self): print('Base2::FuncA') class Child(Base1, Base2): pass def main(): obj = child() obj.FuncA() if __name__ == '__main__': main()
KIND_RETRIEVE_DATA = { "_embedded": { "naam": { "_embedded": { "inOnderzoek": { "_embedded": { "datumIngangOnderzoek": { "dag": None, "datum": None, "ja...
kind_retrieve_data = {'_embedded': {'naam': {'_embedded': {'inOnderzoek': {'_embedded': {'datumIngangOnderzoek': {'dag': None, 'datum': None, 'jaar': None, 'maand': None}}, 'geslachtsnaam': False, 'voornamen': False, 'voorvoegsel': False}}, 'geslachtsnaam': 'Maykin Kind', 'voorletters': 'K', 'voornamen': 'Media Kind', ...
# -*- coding: utf-8 -*- #from pkg_resources import resource_filename class dlib_model: def pose_predictor_model_location(): return "./models/dlib/shape_predictor_68_face_landmarks.dat" def pose_predictor_five_point_model_location(): return "./models/dlib/shape_predictor_5_face_landmarks.dat" def face_...
class Dlib_Model: def pose_predictor_model_location(): return './models/dlib/shape_predictor_68_face_landmarks.dat' def pose_predictor_five_point_model_location(): return './models/dlib/shape_predictor_5_face_landmarks.dat' def face_recognition_model_location(): return './models/d...
# %% [705. Design HashSet](https://leetcode.com/problems/design-hashset/) class MyHashSet(set): remove = set.discard contains = set.__contains__
class Myhashset(set): remove = set.discard contains = set.__contains__
words_count = int(input()) words_dict = {} def add_word(word,definition): words_dict[word] = definition def translate_sentence(words_list): sentence = "" for word in words_list: if word in words_dict: sentence += words_dict[word] + " " else: sentence += word + " "...
words_count = int(input()) words_dict = {} def add_word(word, definition): words_dict[word] = definition def translate_sentence(words_list): sentence = '' for word in words_list: if word in words_dict: sentence += words_dict[word] + ' ' else: sentence += word + ' ' ...
''' Control Structures A statement used to control the flow of execution in a program is called a control structure. Types of control structures 1. Sequence ****************************************************** In a sequential structure the statements are executed in the same order in which they a...
""" Control Structures A statement used to control the flow of execution in a program is called a control structure. Types of control structures 1. Sequence ****************************************************** In a sequential structure the statements are executed in the same order in which they a...
#33 # Time: O(logn) # Space: O(1) # Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. # (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). # # You are given a target value to search. If found in the array return its index, otherwise return -1. # # You may assume no dupli...
class Binarysearchsol: def search_in_rotated_array_i(self, nums, target): (left, right) = (0, len(nums) - 1) while left <= right: mid = (left + right) // 2 if nums[mid] == target: return mid elif nums[mid] > nums[left] and nums[left] <= target < n...
"""Chapter 8 Practice Question 3 Draw the complete truth tables for the and, or, and not operators. """ def notTruthTable() -> None: """Not truth table. Prints a truth table for the not operator. Returns: None. Only prints out a table. """ print(" _________________________\n", ...
"""Chapter 8 Practice Question 3 Draw the complete truth tables for the and, or, and not operators. """ def not_truth_table() -> None: """Not truth table. Prints a truth table for the not operator. Returns: None. Only prints out a table. """ print(' _________________________\n', '|not A...
""" -*- coding: utf-8 -*- Time : 2019/7/19 8:25 Author : Hansybx """ class Res: code = 200 msg = '' info = {} def __init__(self, code, msg, info): self.code = code self.msg = msg self.info = info
""" -*- coding: utf-8 -*- Time : 2019/7/19 8:25 Author : Hansybx """ class Res: code = 200 msg = '' info = {} def __init__(self, code, msg, info): self.code = code self.msg = msg self.info = info
class Task: def __init__(self,name,due_date): self.name = name self.due_date = due_date self.comments=[] self.completed=False def change_name(self,new_name:str): if self.name==new_name: return f"Name cannot be the same." self.name=new_name ret...
class Task: def __init__(self, name, due_date): self.name = name self.due_date = due_date self.comments = [] self.completed = False def change_name(self, new_name: str): if self.name == new_name: return f'Name cannot be the same.' self.name = new_nam...
class BITree: def __init__(self, nums): self.n = len(nums) self.arr = [0 for _ in range(self.n)] self.bitree = [0 for _ in range(self.n + 1)] for i in range(self.n): self.update(i, nums[i]) def update(self, i, val): diff = val - self.arr[i] ...
class Bitree: def __init__(self, nums): self.n = len(nums) self.arr = [0 for _ in range(self.n)] self.bitree = [0 for _ in range(self.n + 1)] for i in range(self.n): self.update(i, nums[i]) def update(self, i, val): diff = val - self.arr[i] self.arr[...
class Solution(object): def hammingWeight(self, n): """ :type n: int :rtype: int """ res = 0 while n: res += 1 n &= (n-1) return res def hammingWeight(self, n): for i in range(33): if not n: return i ...
class Solution(object): def hamming_weight(self, n): """ :type n: int :rtype: int """ res = 0 while n: res += 1 n &= n - 1 return res def hamming_weight(self, n): for i in range(33): if not n: r...
""" 133 / 133 test cases passed. Runtime: 56 ms Memory Usage: 15.1 MB """ class Solution: def searchMatrix(self, matrix: List[List[int]], target: int) -> bool: m, n = len(matrix), len(matrix[0]) l, r = 0, m * n - 1 while l < r: mid = (l + r + 1) >> 1 if matrix[mid // ...
""" 133 / 133 test cases passed. Runtime: 56 ms Memory Usage: 15.1 MB """ class Solution: def search_matrix(self, matrix: List[List[int]], target: int) -> bool: (m, n) = (len(matrix), len(matrix[0])) (l, r) = (0, m * n - 1) while l < r: mid = l + r + 1 >> 1 if matri...
class ManuscriptSubjectAreaService: def __init__(self, df): self._df = df self._subject_areas_by_id_map = df.groupby( 'version_id')['subject_area'].apply(sorted).to_dict() @staticmethod def from_database(db, valid_version_ids=None): df = db.manuscript_subject_area.read_f...
class Manuscriptsubjectareaservice: def __init__(self, df): self._df = df self._subject_areas_by_id_map = df.groupby('version_id')['subject_area'].apply(sorted).to_dict() @staticmethod def from_database(db, valid_version_ids=None): df = db.manuscript_subject_area.read_frame() ...
def _cc_stamp_header(ctx): out = ctx.outputs.out args = ctx.actions.args() args.add("--stable_status", ctx.info_file) args.add("--volatile_status", ctx.version_file) args.add("--output_header", out) ctx.actions.run( outputs = [out], inputs = [ctx.info_file, ctx.version_file], ...
def _cc_stamp_header(ctx): out = ctx.outputs.out args = ctx.actions.args() args.add('--stable_status', ctx.info_file) args.add('--volatile_status', ctx.version_file) args.add('--output_header', out) ctx.actions.run(outputs=[out], inputs=[ctx.info_file, ctx.version_file], arguments=[args], execut...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 11 11:47:23 2021 @author: Claire He Selecting Topics : paper suggest topic selection policy-wise using Meade (2017) work on dissent in policies. We may want to use the same method to select Using Lasso regression shrinkage """
""" Created on Mon Oct 11 11:47:23 2021 @author: Claire He Selecting Topics : paper suggest topic selection policy-wise using Meade (2017) work on dissent in policies. We may want to use the same method to select Using Lasso regression shrinkage """
def permute(obj_list, l, r, level): """Helper function to implement the nAr permutation operation Arguments: obj_list -- the list of objects from which the permutation should be generated l -- left end point of current permutation r -- right end point (exclusive) of current p...
def permute(obj_list, l, r, level): """Helper function to implement the nAr permutation operation Arguments: obj_list -- the list of objects from which the permutation should be generated l -- left end point of current permutation r -- right end point (exclusive) of current p...
print('Challenge 14: WAF to check if a number is present in a list or not.') test_list = [ 1, 6, 3, 5, 3, 4 ] print("Checking if 6 exists in list: ") # Checking if 6 exists in list # using loop for i in test_list: if(i == 6) : print ("Element Exists")
print('Challenge 14: WAF to check if a number is present in a list or not.') test_list = [1, 6, 3, 5, 3, 4] print('Checking if 6 exists in list: ') for i in test_list: if i == 6: print('Element Exists')
# dictionaries friends = ["john", "andre", "mark", "robert"] ages = [23, 43, 54, 12] biodatas_dict = dict(zip(friends, ages)) print(biodatas_dict) # list biodatas_list = list(zip(friends, ages)) print(biodatas_list) # tuple biodatas_tuple = tuple(zip(friends, ages)) print(biodatas_tuple)
friends = ['john', 'andre', 'mark', 'robert'] ages = [23, 43, 54, 12] biodatas_dict = dict(zip(friends, ages)) print(biodatas_dict) biodatas_list = list(zip(friends, ages)) print(biodatas_list) biodatas_tuple = tuple(zip(friends, ages)) print(biodatas_tuple)
#!/usr/bin/env python def count_fish(lanternfish: list, repro_day: int) -> int: return len([x for x in lanternfish if x == repro_day]) def pass_one_day(fish_age_hash: dict, day: int, lanternfish: list=None): if day == 0: if not lanternfish: raise AttributeError("Error: lanternfish list mus...
def count_fish(lanternfish: list, repro_day: int) -> int: return len([x for x in lanternfish if x == repro_day]) def pass_one_day(fish_age_hash: dict, day: int, lanternfish: list=None): if day == 0: if not lanternfish: raise attribute_error('Error: lanternfish list must be passed as arg') ...
class MyClass: def __call__(self): print('__call__') c = MyClass() c() c.__call__() print() c.__call__ = lambda: print('overriding call') c() c.__call__()
class Myclass: def __call__(self): print('__call__') c = my_class() c() c.__call__() print() c.__call__ = lambda : print('overriding call') c() c.__call__()
token = 'Ndhhfghfgh' firebase = { "apiKey": "AIzaSyBYHMxJYFVWP6xH55gAY1TJpVECq4KRjKM", "authDomain": "test24-13912.firebaseapp.com", "databaseURL": "https://test24-13912-default-rtdb.firebaseio.com", "projectId": "test24-13912", "storageBucket": "test24-13912.appspot.com", "messagingSenderId": "939334214645", "...
token = 'Ndhhfghfgh' firebase = {'apiKey': 'AIzaSyBYHMxJYFVWP6xH55gAY1TJpVECq4KRjKM', 'authDomain': 'test24-13912.firebaseapp.com', 'databaseURL': 'https://test24-13912-default-rtdb.firebaseio.com', 'projectId': 'test24-13912', 'storageBucket': 'test24-13912.appspot.com', 'messagingSenderId': '939334214645', 'appId': '...
class InstagramQueryId: USER_MEDIAS = '17880160963012870' USER_STORIES = '17890626976041463' STORIES = '17873473675158481'
class Instagramqueryid: user_medias = '17880160963012870' user_stories = '17890626976041463' stories = '17873473675158481'