content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
carros = [] carros.append("audi") carros.append("bmw") carros.append("subaru") carros.append("toyota") carros.append("chevrolet") carros.append("honda") # if elif else for carro in carros: if carro == "honda": print(carro.upper() + " !") elif carro == "BMW": print(carro.upper()) ...
carros = [] carros.append('audi') carros.append('bmw') carros.append('subaru') carros.append('toyota') carros.append('chevrolet') carros.append('honda') for carro in carros: if carro == 'honda': print(carro.upper() + ' !') elif carro == 'BMW': print(carro.upper()) elif carro == 'toyota': ...
# Digit factorials def factorial(n): if n == 0: return 1 return n*factorial(n-1) def digitized_factorial_sum(num): if num == 1 or num == 2: return False return sum([factorial(int(digit)) for digit in str(num)]) == num # Need bounds on the numbers to be checked if their sum of factoria...
def factorial(n): if n == 0: return 1 return n * factorial(n - 1) def digitized_factorial_sum(num): if num == 1 or num == 2: return False return sum([factorial(int(digit)) for digit in str(num)]) == num for i in range(int(1000000.0)): if digitized_factorial_sum(i): print('Th...
# Question 2 - Shouting! def main(): # You don't need to modify this function. name = input('Please enter your name: ') # The computer is pleased to see you! Shout out to the user shout_name = shout(name) print('This program is happy to see you, {}'.format(shout_name)) def shout(name): ...
def main(): name = input('Please enter your name: ') shout_name = shout(name) print('This program is happy to see you, {}'.format(shout_name)) def shout(name): pass if __name__ == '__main__': main()
#python3 # Compute the last digit of the sum of squares of Fibonacci numbers till Fn def fib_mod_sum(n): mod_seq = [0, 1] # mod is 10 -> pisano period is 60 pp = 60 fib_i = n % pp for _ in range(1, fib_i): mod_seq.append((mod_seq[-1] + mod_seq[-2])) fn_seq = mod_seq[:fib_i + 1] r...
def fib_mod_sum(n): mod_seq = [0, 1] pp = 60 fib_i = n % pp for _ in range(1, fib_i): mod_seq.append(mod_seq[-1] + mod_seq[-2]) fn_seq = mod_seq[:fib_i + 1] return sum([i ** 2 for i in fn_seq]) % 10 def main(): n = int(input()) print(fib_mod_sum(n)) if __name__ == '__main__': ...
__title__ = 'django-uuslug' __author__ = 'Val Neekman' __author_email__ = 'info@neekware.com' __description__ = "A Django slugify application that also handles Unicode" __url__ = 'https://github.com/un33k/django-uuslug' __license__ = 'MIT' __copyright__ = 'Copyright 2022 Val Neekman @ Neekware Inc.' __version__ = '2.0....
__title__ = 'django-uuslug' __author__ = 'Val Neekman' __author_email__ = 'info@neekware.com' __description__ = 'A Django slugify application that also handles Unicode' __url__ = 'https://github.com/un33k/django-uuslug' __license__ = 'MIT' __copyright__ = 'Copyright 2022 Val Neekman @ Neekware Inc.' __version__ = '2.0....
class Quadrado: def __init__(self, lado): self.lado = lado def perimetro(self): return 4 * self.lado def area(self): return self.lado * self.lado class Retangulo: def __init__(self, base, altura): self.base = base self.altura = altura def area(self): return self.base * self.altura ...
class Quadrado: def __init__(self, lado): self.lado = lado def perimetro(self): return 4 * self.lado def area(self): return self.lado * self.lado class Retangulo: def __init__(self, base, altura): self.base = base self.altura = altura def area(self): ...
# https://codeforces.com/problemset/problem/510/A n, m = input().split() whileloop_count = 1 dotline = 0 k = int(m)-1 while whileloop_count <= int(n): if whileloop_count % 2 != 0: print("#"*int(m)) elif whileloop_count % 2 == 0 and dotline % 2 == 0: print(("."*k+"#")) dotline += 1 el...
(n, m) = input().split() whileloop_count = 1 dotline = 0 k = int(m) - 1 while whileloop_count <= int(n): if whileloop_count % 2 != 0: print('#' * int(m)) elif whileloop_count % 2 == 0 and dotline % 2 == 0: print('.' * k + '#') dotline += 1 elif whileloop_count % 2 == 0 and dotline % ...
minha_lista = [1,2,3,4,5] sua_lista = [item ** 2 for item in minha_lista] print(minha_lista) print(sua_lista)
minha_lista = [1, 2, 3, 4, 5] sua_lista = [item ** 2 for item in minha_lista] print(minha_lista) print(sua_lista)
#!/usr/bin/python # -*- coding:utf-8 -*- class Cursor: def __init__(self, x=0, y=0): self.x = x self.y = y self.x_max = 5 self.y_max = 32 def up(self, buff): return Cursor(self.x - 1, self.y).clamp(buff) def down(self, buff): return Cursor(self.x + 1, self....
class Cursor: def __init__(self, x=0, y=0): self.x = x self.y = y self.x_max = 5 self.y_max = 32 def up(self, buff): return cursor(self.x - 1, self.y).clamp(buff) def down(self, buff): return cursor(self.x + 1, self.y).clamp(buff) def right(self, buff)...
# Fern Zapata # https://github.com/fernzi/dotfiles # Qtile Window Manager - User settings terminal = 'alacritty' launcher = 'rofi -show drun' switcher = 'rofi -show window' file_manager = 'pcmanfm-qt' wallpaper = '~/Pictures/Wallpapers/Other/Waves.png' applications = dict( messenger='discord', mixer='pavucontrol...
terminal = 'alacritty' launcher = 'rofi -show drun' switcher = 'rofi -show window' file_manager = 'pcmanfm-qt' wallpaper = '~/Pictures/Wallpapers/Other/Waves.png' applications = dict(messenger='discord', mixer='pavucontrol-qt', web_browser='qutebrowser') autostart = ['lxqt-policykit-agent', 'setxkbmap -option compose:r...
# http://www.geeksforgeeks.org/find-number-of-triangles-possible/ def number_of_triangles(input): input.sort() count = 0 for i in range(len(input)-2): k = i + 2 for j in range(i+1, len(input)): while k < len(input) and input[i] + input[j] > input[k]: k = k + 1 ...
def number_of_triangles(input): input.sort() count = 0 for i in range(len(input) - 2): k = i + 2 for j in range(i + 1, len(input)): while k < len(input) and input[i] + input[j] > input[k]: k = k + 1 count += k - j - 1 return count if __name__ == '_...
def primeCheck(n): # 0, 1, even numbers greater than 2 are NOT PRIME if n==1 or n==0 or (n % 2 == 0 and n > 2): return "Not prime" else: # Not prime if divisable by another number less # or equal to the square root of itself. # n**(1/2) returns square root of n ...
def prime_check(n): if n == 1 or n == 0 or (n % 2 == 0 and n > 2): return 'Not prime' else: for i in range(3, int(n ** (1 / 2)) + 1, 2): if n % i == 0: return 'Not prime' return 'Prime'
# GYP file to build unit tests. { 'includes': [ 'apptype_console.gypi', 'common.gypi', ], 'targets': [ { 'target_name': 'tests', 'type': 'executable', 'include_dirs' : [ '../src/core', '../src/gpu', ], 'sources': [ '../tests/AAClipTest.cpp', ...
{'includes': ['apptype_console.gypi', 'common.gypi'], 'targets': [{'target_name': 'tests', 'type': 'executable', 'include_dirs': ['../src/core', '../src/gpu'], 'sources': ['../tests/AAClipTest.cpp', '../tests/BitmapCopyTest.cpp', '../tests/BitmapGetColorTest.cpp', '../tests/BitSetTest.cpp', '../tests/BlitRowTest.cpp', ...
class UserAlreadyEnteredError(Exception): pass class NoUsersEnteredError(Exception): pass class WrongTimeFormatError(Exception): pass #custom error just for readability
class Useralreadyenterederror(Exception): pass class Nousersenterederror(Exception): pass class Wrongtimeformaterror(Exception): pass
''' Given an integer n, return the next bigger permutation of its digits. If n is already in its biggest permutation, rotate to the smallest permutation. case 1 n= 5342310 ans=5343012 case 2 n= 543321 ans= 123345 ''' n = 5342310 # case 1 # n = 543321 # case 2 a = list(map(int, str(n))) i = len(a)-...
""" Given an integer n, return the next bigger permutation of its digits. If n is already in its biggest permutation, rotate to the smallest permutation. case 1 n= 5342310 ans=5343012 case 2 n= 543321 ans= 123345 """ n = 5342310 a = list(map(int, str(n))) i = len(a) - 2 while a[i] >= a[i + 1]: i -= 1 if i ==...
# function test # test 1 def println ( str ) : print ( str ) return println ( "Hello World" ) # test 2 def printStu ( name, age ): print ("%s, %d" % (name, age)) return printStu (age = 19, name = "Inno") # test 3 def printInfo ( who, sex = 'male' ): print ("%s/%s" % (who, sex)) return printInfo (...
def println(str): print(str) return println('Hello World') def print_stu(name, age): print('%s, %d' % (name, age)) return print_stu(age=19, name='Inno') def print_info(who, sex='male'): print('%s/%s' % (who, sex)) return print_info('Inno') def count_sum(*var_arg): sum = 0 for i in var...
# # PySNMP MIB module HM2-PWRMGMT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HM2-PWRMGMT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:18:36 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, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection, constraints_union) ...
# key = DB quest string, value = quest timer in days quests = { 'AugmentationBlankGemAcquired': ('Aug Gem: Bellas', 6), 'BlankAugLuminanceTimer_0511': ('Aug Gem: Luminance', 14), 'PickedUpMarkerBoss10x': ('Aug Gem: Diemos', 6), 'SocietyMasterStipendCollectionTimer': ('Stipend - Society', 6), 'Stipen...
quests = {'AugmentationBlankGemAcquired': ('Aug Gem: Bellas', 6), 'BlankAugLuminanceTimer_0511': ('Aug Gem: Luminance', 14), 'PickedUpMarkerBoss10x': ('Aug Gem: Diemos', 6), 'SocietyMasterStipendCollectionTimer': ('Stipend - Society', 6), 'StipendTimer_0812': ('Stipend - General', 6)}
# Initialization of n*n grid def create_grid(): global n n = int(input("Enter grid size: ")) global grids grids = [] for i in range(0, n): grids.append([]) for i in range(0, n): for j in range(0, n): grids[i].append(j) grids[i][j] = - 1 grid_def()...
def create_grid(): global n n = int(input('Enter grid size: ')) global grids grids = [] for i in range(0, n): grids.append([]) for i in range(0, n): for j in range(0, n): grids[i].append(j) grids[i][j] = -1 grid_def() def grid_def(): grid = [] ...
''' By a length in meters you can check how it is in kilometer, hectometer decimeter, centimeter and millimeter ''' m = float(input('Type a length in meters: ')) km = m / 1000 hm = m / 100 dam = m / 10 dm = m * 10 cm = m * 100 mm = m * 1000 print('The value in kilometer is {:.3f}. \nThe value in hectometer is {:.2f}....
""" By a length in meters you can check how it is in kilometer, hectometer decimeter, centimeter and millimeter """ m = float(input('Type a length in meters: ')) km = m / 1000 hm = m / 100 dam = m / 10 dm = m * 10 cm = m * 100 mm = m * 1000 print('The value in kilometer is {:.3f}. \nThe value in hectometer is {:.2f}. ...
glob_cnt = {} def key_or_incr(word): if glob_cnt.has_key(word): glob_cnt[word]+=1 else: glob_cnt.update({word:1}) if __name__=='__main__': # Reads a paragraph of text para = open("para.txt","r") word_list = para.read().split(" ") # update the count entries for each word fo...
glob_cnt = {} def key_or_incr(word): if glob_cnt.has_key(word): glob_cnt[word] += 1 else: glob_cnt.update({word: 1}) if __name__ == '__main__': para = open('para.txt', 'r') word_list = para.read().split(' ') for word in word_list: key_or_incr(word.lower()) for (k, v) in ...
MODEL_EXTENSIONS = ( '.egg', '.bam', '.pz', '.obj', ) PANDA_3D_RUNTIME_PATH = r'C:\Panda3D-1.10.9-x64'
model_extensions = ('.egg', '.bam', '.pz', '.obj') panda_3_d_runtime_path = 'C:\\Panda3D-1.10.9-x64'
class Key: def __init__(self, m, e): self.modulus = m self.exponent = e def set_modulus(self, m): self.modulus = m def set_exponent(self, e): self.exponent = e def get_modulus(self): return self.modulus def get_exponent(self): return self.exponent
class Key: def __init__(self, m, e): self.modulus = m self.exponent = e def set_modulus(self, m): self.modulus = m def set_exponent(self, e): self.exponent = e def get_modulus(self): return self.modulus def get_exponent(self): return self.exponent
# 13. Write a program that asks the user to enter two strings of the same length. The program # should then check to see if the strings are of the same length. If they are not, the program # should print an appropriate message and exit. If they are of the same length, the program # should alternate the characters of th...
first_string = input('Enter a string: ') second_string = input('Enter another string: ') if len(first_string) != len(second_string): print('The strings are not the same length.') else: for i in range(len(first_string)): print(second_string[i] + first_string[i], end='')
#!/usr/bin/env python # table auto-generator for zling. # author: Zhang Li <zhangli10@baidu.com> kBucketItemSize = 4096 matchidx_blen = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7] + [8] * 1024 matchidx_code = [] matchidx_bits = [] matchidx_base = [] while len(matchidx_code) < kBucketItemSize: for bit...
k_bucket_item_size = 4096 matchidx_blen = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7] + [8] * 1024 matchidx_code = [] matchidx_bits = [] matchidx_base = [] while len(matchidx_code) < kBucketItemSize: for bits in range(2 ** matchidx_blen[len(matchidx_base)]): matchidx_code.append(len(matchidx_base...
# NOTE: the agent holds items as a list where # items[idx] is the number of items collected of type 'idx' # IMPORTANT: if the original item config is changed/reodered, this file will # likely have to be updated to reflect new item positions. def all_item_reward(ai_r=1): # awards +ai_r for every new item collected ...
def all_item_reward(ai_r=1): def reward_calc(prev_items, items): return (sum(items) - sum(prev_items)) * ai_r return reward_calc def r_jellybean(jb_r=1): def reward_calc(prev_items, items): jb_idx = 2 return (items[JB_IDX] - prev_items[JB_IDX]) * jb_r return reward_calc def r...
tuplas = (1,2,3,4,5,6,7,8,9,0) print(tuplas[0]) # seleccion invertida print(tuplas[-1]) # sub tuplas sub = tuplas[:9:2] print(sub) # no puede ser modificada, por lo que sub[1] = 30
tuplas = (1, 2, 3, 4, 5, 6, 7, 8, 9, 0) print(tuplas[0]) print(tuplas[-1]) sub = tuplas[:9:2] print(sub) sub[1] = 30
# Define a Python subroutine to colour atoms by B-factor, using predefined intervals def colour_consurf(selection="all"): # Colour other chains gray, while maintaining # oxygen in red, nitrogen in blue and hydrogen in white cmd.color("gray", selection) cmd.util.cnc() # These are constants mi...
def colour_consurf(selection='all'): cmd.color('gray', selection) cmd.util.cnc() minimum = 0.0 maximum = 9.0 n_colours = 9 colours = [[0.039215686, 0.490196078, 0.509803922], [0.294117647, 0.68627451, 0.745098039], [0.647058824, 0.862745098, 0.901960784], [0.843137255, 0.941176471, 0.941176471],...
fName = input("\nwhat is your first name? ").strip().capitalize() mName = input("\nwhat is your middle name? ").strip().capitalize() lName = input("\nwhat is your last name? ").strip().capitalize() print(f"\nHello World, My name is {fName:s} {mName:.1s} {lName:s}, Happy to see you.")
f_name = input('\nwhat is your first name? ').strip().capitalize() m_name = input('\nwhat is your middle name? ').strip().capitalize() l_name = input('\nwhat is your last name? ').strip().capitalize() print(f'\nHello World, My name is {fName:s} {mName:.1s} {lName:s}, Happy to see you.')
class Player: def __init__(self, amount): if amount < 1: print('You do not have money') self.amount = 100 self.hand_bet = None self.suit_bet = 0 self.amount_bet = 0 self.sinput = None self.binput = None self.badb_bet = 0 de...
class Player: def __init__(self, amount): if amount < 1: print('You do not have money') self.amount = 100 self.hand_bet = None self.suit_bet = 0 self.amount_bet = 0 self.sinput = None self.binput = None self.badb_bet = 0 def amount(se...
#!/usr/bin/env python # -*- coding: utf-8 -* ONION_ADDR = { "patient": "xwjtp3mj427zdp4tljiiivg2l5ijfvmt5lcsfaygtpp6cw254kykvpyd.onion" } # TODO: LOGGER = { "user": { "password": "", "rooms": [] # rooms are mapped to topics in mqtt } } LOGGER = { "!qKGqWURPTdcyFQHFjJ:casper.magi.sys":...
onion_addr = {'patient': 'xwjtp3mj427zdp4tljiiivg2l5ijfvmt5lcsfaygtpp6cw254kykvpyd.onion'} logger = {'user': {'password': '', 'rooms': []}} logger = {'!qKGqWURPTdcyFQHFjJ:casper.magi.sys': {'user': 'patient', 'password': 'MDTweSomWY'}}
host = 'localhost' user = 'dongeonguard' password = 'SuchWow' db = 'imagedongeon'
host = 'localhost' user = 'dongeonguard' password = 'SuchWow' db = 'imagedongeon'
def myfunction1(): x = 60 # This is local variable print("Welcome to Fucntions") print("x value from func1: ", x) myfunction2() return None def myfunction2(): print("Thank you!!") print("x value form fucn2:", x) return None x = 10 # This is global variable myfunction1() # Note : Priority is given to Local va...
def myfunction1(): x = 60 print('Welcome to Fucntions') print('x value from func1: ', x) myfunction2() return None def myfunction2(): print('Thank you!!') print('x value form fucn2:', x) return None x = 10 myfunction1() '\ndef myfunction1():\n\tx = 60 # This is local variable\n\tprint("...
frase = input('Digite a frase: ').strip() print(frase.lower().count('a')) print(frase.lower().find('a')) print(frase.lower().rfind('a'))
frase = input('Digite a frase: ').strip() print(frase.lower().count('a')) print(frase.lower().find('a')) print(frase.lower().rfind('a'))
''' @Date: 2019-12-22 20:33:28 @Author: ywyz @LastModifiedBy: ywyz @Github: https://github.com/ywyz @LastEditors : ywyz @LastEditTime : 2019-12-22 20:38:20 ''' strings = input("Enter the first 9 digits of an ISBN-10 as a string: ") temp = 1 total = 0 for i in strings: total += int(i) * temp temp += 1 total %=...
""" @Date: 2019-12-22 20:33:28 @Author: ywyz @LastModifiedBy: ywyz @Github: https://github.com/ywyz @LastEditors : ywyz @LastEditTime : 2019-12-22 20:38:20 """ strings = input('Enter the first 9 digits of an ISBN-10 as a string: ') temp = 1 total = 0 for i in strings: total += int(i) * temp temp += 1 total %= ...
def solution(num): answer = 0 while num != 1: if num % 2 == 0: num = int(num // 2) else: num = num * 3 + 1 answer += 1 if answer >= 500: return -1 return answer print(solution(626331))
def solution(num): answer = 0 while num != 1: if num % 2 == 0: num = int(num // 2) else: num = num * 3 + 1 answer += 1 if answer >= 500: return -1 return answer print(solution(626331))
class ListNode: def __init__(self, x): self.val = x self.next = None class CircularLinkedList: def __init__(self): self.head = None def insertAtHead(self, x): if self.head is None: self.head = ListNode(x) self.head.next = self.head el...
class Listnode: def __init__(self, x): self.val = x self.next = None class Circularlinkedlist: def __init__(self): self.head = None def insert_at_head(self, x): if self.head is None: self.head = list_node(x) self.head.next = self.head else:...
#T# opposite numbers are calculated with the minus - operator #T# create a number and find its opposite num1 = 5 num2 = -num1 # -5 num1 = -5 num2 = -num1 # 5
num1 = 5 num2 = -num1 num1 = -5 num2 = -num1
X = int(input()) while True: Z = int(input()) if Z > X: break count = 0 summ = 0 for i in range(X,Z+1): summ += i count += 1 if summ > Z: break print(count)
x = int(input()) while True: z = int(input()) if Z > X: break count = 0 summ = 0 for i in range(X, Z + 1): summ += i count += 1 if summ > Z: break print(count)
# Copyright (c) 2021, Omid Erfanmanesh, All rights reserved. class EncoderTypes: CUSTOM = 0 LABEL = 1 ORDINAL = 2 ONE_HOT = 3 BINARY = 4
class Encodertypes: custom = 0 label = 1 ordinal = 2 one_hot = 3 binary = 4
# 1 #1 1 #1 1 1 p = int(input("Ingrese un numero: ")) for n in range(1,p): print(" "*(p-1) + "1") if(p != 1): print(" 1 1 ")
p = int(input('Ingrese un numero: ')) for n in range(1, p): print(' ' * (p - 1) + '1') if p != 1: print(' 1 1 ')
# first_list_example.py # # Illustrates two ways to iterate through a list (examine every # element in a list). # CSC 110 # Fall 2011 stuff = [7, 17, -4, 0.5] # create a list filled with integers print(stuff) # prints in "list" form (with square brackets and commas) # This loop visits every element of the list,...
stuff = [7, 17, -4, 0.5] print(stuff) for index in range(len(stuff)): print('Index', index, 'has value', stuff[index]) print() sq_sum = 0 for value in stuff: sq = value ** 2 print('The number', value, 'squared =', sq) sq_sum += sq print('The sum of the squares =', sqSum)
# other column settings -> http://bootstrap-table.wenzhixin.net.cn/documentation/#column-options columns_criar_eleicao = [ { "field": "pessoa", # which is the field's name of data key "title": "Pessoa", # display as the table header's name] "sortable":True }, { "field": "...
columns_criar_eleicao = [{'field': 'pessoa', 'title': 'Pessoa', 'sortable': True}, {'field': 'login', 'title': 'Login', 'sortable': True}, {'field': 'select', 'checkbox': True}] columns_abrir_eleicao = [{'field': 'eleicao', 'title': 'Titulo', 'sortable': True}, {'field': 'select', 'checkbox': True}] columns_fechar_elei...
class cell: def __init__(self, y, x, icon, cellnum, board): self.chricon = icon self.coords = [y, x] self.evopoints = 0 self.idnum = cellnum self.playable = False self.learnedmutations = { 'move' : False, 'sight' : False, ...
class Cell: def __init__(self, y, x, icon, cellnum, board): self.chricon = icon self.coords = [y, x] self.evopoints = 0 self.idnum = cellnum self.playable = False self.learnedmutations = {'move': False, 'sight': False, 'strike': True, 'wall': False, 'leap': True} ...
# # PySNMP MIB module A3COM-HUAWEI-ACL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM-HUAWEI-ACL-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:03:47 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(h3c_common,) = mibBuilder.importSymbols('A3COM-HUAWEI-OID-MIB', 'h3cCommon') (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_un...
# # PySNMP MIB module VMWARE-ESX-AGENTCAP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/VMWARE-ESX-AGENTCAP-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:34:50 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, constraints_intersection, value_size_constraint, constraints_union) ...
def test(seq, target_seq): scorer = CodonFreqScorer() scorer.set_codon_freqs_from_seq(target_seq) print(scorer.score(seq))
def test(seq, target_seq): scorer = codon_freq_scorer() scorer.set_codon_freqs_from_seq(target_seq) print(scorer.score(seq))
#!/usr/bin/env python3 class State(): def __init__(self, e, pos, dist=float('inf'), prev=None): self.e = e self.pos = pos self.dist = dist self.prev = prev # we need a good hash that is the same for all (g,m)-pair permutations # this hash will be used to index the dictiona...
class State: def __init__(self, e, pos, dist=float('inf'), prev=None): self.e = e self.pos = pos self.dist = dist self.prev = prev def __hash__(self): l = [] for i in range(int(len(self.pos) / 2)): l += [(self.pos[2 * i], self.pos[2 * i + 1])] ...
def sum_numbers(numbers=None): if numbers == None: return sum(range(101)) else: return sum(numbers)
def sum_numbers(numbers=None): if numbers == None: return sum(range(101)) else: return sum(numbers)
COLUMNS = [ 'EventId', 'DER_mass_MMC', 'DER_mass_transverse_met_lep', 'DER_mass_vis', 'DER_pt_h', 'DER_deltaeta_jet_jet', 'DER_mass_jet_jet', 'DER_prodeta_jet_jet', 'DER_deltar_tau_lep', 'DER_pt_tot', 'DER_sum_pt', 'DER_pt_ratio_lep_tau', 'DER_met_phi_centrality', ...
columns = ['EventId', 'DER_mass_MMC', 'DER_mass_transverse_met_lep', 'DER_mass_vis', 'DER_pt_h', 'DER_deltaeta_jet_jet', 'DER_mass_jet_jet', 'DER_prodeta_jet_jet', 'DER_deltar_tau_lep', 'DER_pt_tot', 'DER_sum_pt', 'DER_pt_ratio_lep_tau', 'DER_met_phi_centrality', 'DER_lep_eta_centrality', 'PRI_tau_pt', 'PRI_tau_eta', '...
class MetadataError(Exception): pass class CopyError(RuntimeError): pass class _BaseZarrError(ValueError): _msg = "" def __init__(self, *args): super().__init__(self._msg.format(*args)) class ContainsGroupError(_BaseZarrError): _msg = "path {0!r} contains a group" def err_contains...
class Metadataerror(Exception): pass class Copyerror(RuntimeError): pass class _Basezarrerror(ValueError): _msg = '' def __init__(self, *args): super().__init__(self._msg.format(*args)) class Containsgrouperror(_BaseZarrError): _msg = 'path {0!r} contains a group' def err_contains_group...
class Solution: def longestStrChain(self, words: List[str]) -> int: dp = {} for word in sorted(words, key=len): dp[word] = max(dp.get(word[:i] + word[i + 1:], 0) + 1 for i in range(len(word))) return max(dp.values())
class Solution: def longest_str_chain(self, words: List[str]) -> int: dp = {} for word in sorted(words, key=len): dp[word] = max((dp.get(word[:i] + word[i + 1:], 0) + 1 for i in range(len(word)))) return max(dp.values())
# Integer Break class Solution: def integerBreak(self, n): dp = [0] * (max(7, n + 1)) dp[2] = 1 dp[3] = 2 dp[4] = 4 dp[5] = 6 dp[6] = 9 if n <= 6: return dp[n] mod = n % 3 if mod == 0: return dp[6] * 3 ** ((n - 6) // ...
class Solution: def integer_break(self, n): dp = [0] * max(7, n + 1) dp[2] = 1 dp[3] = 2 dp[4] = 4 dp[5] = 6 dp[6] = 9 if n <= 6: return dp[n] mod = n % 3 if mod == 0: return dp[6] * 3 ** ((n - 6) // 3) elif mod...
class ParseError(Exception): def __init__(self,mes:str="")->None: super().__init__() self.mes = mes def __str__(self)->str: return f"ParseError: {self.mes}" class Flag: def __init__(self,flag:str,options:int,second_flag:str=None,flag_symbol:str="-")->None: self.flag=flag ...
class Parseerror(Exception): def __init__(self, mes: str='') -> None: super().__init__() self.mes = mes def __str__(self) -> str: return f'ParseError: {self.mes}' class Flag: def __init__(self, flag: str, options: int, second_flag: str=None, flag_symbol: str='-') -> None: ...
''' u are given pointer to the root of the binary search tree and two values and . You need to return the lowest common ancestor (LCA) of and in the binary search tree. image In the diagram above, the lowest common ancestor of the nodes and is the node . Node is the lowest node which has nodes and as descendan...
""" u are given pointer to the root of the binary search tree and two values and . You need to return the lowest common ancestor (LCA) of and in the binary search tree. image In the diagram above, the lowest common ancestor of the nodes and is the node . Node is the lowest node which has nodes and as descendan...
# uncompyle6 version 3.7.4 # Python bytecode 3.7 (3394) # Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] # Embedded file name: T:\InGame\Gameplay\Scripts\Server\filters\demographics_filter_term_mixin.py # Compiled at: 2018-12-11 03:52:40 # Size of source mod 2*...
class Demographicsfiltertermmixin: def get_valid_world_ids(self): raise NotImplementedError
def main(): max_id = -1 with open("data.txt") as f: for line in f: line = line.strip() if len(line) == 0: continue if len(line) != 10: raise ValueError(f"unexpected line {line} in input file") max_id = max(max_id, int("".joi...
def main(): max_id = -1 with open('data.txt') as f: for line in f: line = line.strip() if len(line) == 0: continue if len(line) != 10: raise value_error(f'unexpected line {line} in input file') max_id = max(max_id, int(''.jo...
def binary_search(arr, n): return _binary_search(sorted(arr), n, 0, len(arr) - 1) def _binary_search(arr, n, start, end): if start > end: return 0 mid = int((start + end) / 2) if n == arr[mid]: return 1 elif n < arr[mid]: return _binary_search(arr, n, start, mid - 1) else: return _binary_search(arr, n, ...
def binary_search(arr, n): return _binary_search(sorted(arr), n, 0, len(arr) - 1) def _binary_search(arr, n, start, end): if start > end: return 0 mid = int((start + end) / 2) if n == arr[mid]: return 1 elif n < arr[mid]: return _binary_search(arr, n, start, mid - 1) els...
# URI Online Judge 1178 X = float(input()) N = [X] print('N[{}] = {:.4f}'.format(0, N[0])) for i in range(1, 100): N.append(N[i-1]/2) print('N[{}] = {:.4f}'.format(i, N[i-1]/2))
x = float(input()) n = [X] print('N[{}] = {:.4f}'.format(0, N[0])) for i in range(1, 100): N.append(N[i - 1] / 2) print('N[{}] = {:.4f}'.format(i, N[i - 1] / 2))
# Global variables representing colors WHITE = (255, 255, 255) BLACK = (0, 0, 0) # Global variable used for sizing ICON_SIZE = 24
white = (255, 255, 255) black = (0, 0, 0) icon_size = 24
#LeetCode problem 112: Path Sum # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def hasPathSum(self, root: TreeNode, sum: int) -> bool: if root is N...
class Solution: def has_path_sum(self, root: TreeNode, sum: int) -> bool: if root is None: return False if root.left is None and root.right is None: return root.val == sum res = [] self.isTrue(root, sum, res) print(res) if res.count(1) >= 1: ...
blacklisted_generators = [ 'latitude', 'geo_coordinate', 'longitude', 'time_delta', 'date_object', 'date_time', 'date_time_between', 'date_time_ad', 'date_time_this_decade', 'date_time_between_dates', 'time_object', 'date_time_this_year', 'date_time_this_century', ...
blacklisted_generators = ['latitude', 'geo_coordinate', 'longitude', 'time_delta', 'date_object', 'date_time', 'date_time_between', 'date_time_ad', 'date_time_this_decade', 'date_time_between_dates', 'time_object', 'date_time_this_year', 'date_time_this_century', 'date_time_this_month', 'sentences', 'words', 'paragraph...
class Node: def __init__(self,data): self.data = data self.next = None class Solution: def display(self,head): current = head while current: print(current.data,end=' ') current = current.next def insert(self, head, data): if head is None: ...
class Node: def __init__(self, data): self.data = data self.next = None class Solution: def display(self, head): current = head while current: print(current.data, end=' ') current = current.next def insert(self, head, data): if head is None...
general_option = ('option MIP = CPLEX;' 'option NLP = IPOPTH;' 'option threads = 1;' 'option optcr = 0.001;' 'option optca = 0.0;' 'GAMS_MODEL.nodLim = 1E8;' 'option domLim = 1E8;' 'option iterL...
general_option = 'option MIP = CPLEX;option NLP = IPOPTH;option threads = 1;option optcr = 0.001;option optca = 0.0;GAMS_MODEL.nodLim = 1E8;option domLim = 1E8;option iterLim = 1E8;option resLim = 900;' gams_optionfile = {'bonminh-B-BB': [general_option + 'GAMS_MODEL.optfile = 1;\n$onecho > bonminh.opt \nbonmin.algorit...
def binary_search(a, val, start, end): mid = (start + end)//2 if start >= end: return val == a[mid] if val == a[mid]: return True elif val < a[mid]: return binary_search(a, val, start, mid - 1) elif val > a[mid]: return binary_search(a, val, mid + 1, end) def main()...
def binary_search(a, val, start, end): mid = (start + end) // 2 if start >= end: return val == a[mid] if val == a[mid]: return True elif val < a[mid]: return binary_search(a, val, start, mid - 1) elif val > a[mid]: return binary_search(a, val, mid + 1, end) def main(...
class HashLinearProbe: def __init__(self): self.hashtable_size = 10 self.hashtable = [0] * self.hashtable_size def hashcode(self, key): return key % self.hashtable_size def lprobe(self, element): i = self.hashcode(element) j = 0 while self.hashtable[(i+j) % ...
class Hashlinearprobe: def __init__(self): self.hashtable_size = 10 self.hashtable = [0] * self.hashtable_size def hashcode(self, key): return key % self.hashtable_size def lprobe(self, element): i = self.hashcode(element) j = 0 while self.hashtable[(i + j)...
noteValues = ['C0', 'Cs0', 'Db0', 'D0', 'Ds0', 'Eb0', 'E0', 'F0', 'Fs0', 'Gb0', 'G0', 'Gs0', 'Ab0', 'A0', 'As0', 'Bb0', 'B0', 'C1', 'Cs1', 'Db1', 'D1', 'Ds1', 'Eb1', 'E1', 'F1', 'Fs1', 'Gb1', 'G1', 'Gs1', 'Ab1', 'A1', 'As1', 'Bb1', 'B1', 'C2', 'Cs2', 'Db2', 'D2'...
note_values = ['C0', 'Cs0', 'Db0', 'D0', 'Ds0', 'Eb0', 'E0', 'F0', 'Fs0', 'Gb0', 'G0', 'Gs0', 'Ab0', 'A0', 'As0', 'Bb0', 'B0', 'C1', 'Cs1', 'Db1', 'D1', 'Ds1', 'Eb1', 'E1', 'F1', 'Fs1', 'Gb1', 'G1', 'Gs1', 'Ab1', 'A1', 'As1', 'Bb1', 'B1', 'C2', 'Cs2', 'Db2', 'D2', 'Ds2', 'Eb2', 'E2', 'F2', 'Fs2', 'Gb2', 'G2', 'Gs2', 'A...
''' Implement int sqrt(int x). Compute and return the square root of x, where x is guaranteed to be a non-negative integer. Since the return type is an integer, the decimal digits are truncated and only the integer part of the result is returned. Example 1: Input: 4 Output: 2 Example 2: Input: 8 Output: 2 Explanatio...
""" Implement int sqrt(int x). Compute and return the square root of x, where x is guaranteed to be a non-negative integer. Since the return type is an integer, the decimal digits are truncated and only the integer part of the result is returned. Example 1: Input: 4 Output: 2 Example 2: Input: 8 Output: 2 Explanatio...
def test_greeter(chain): greeter, _ = chain.provider.get_or_deploy_contract('Greeter') greeting = greeter.call().greet() assert greeting == 'Hello' def test_custom_greeting(chain): greeter, _ = chain.provider.get_or_deploy_contract('Greeter') set_txn_hash = greeter.transact().setGreeting('Guten ...
def test_greeter(chain): (greeter, _) = chain.provider.get_or_deploy_contract('Greeter') greeting = greeter.call().greet() assert greeting == 'Hello' def test_custom_greeting(chain): (greeter, _) = chain.provider.get_or_deploy_contract('Greeter') set_txn_hash = greeter.transact().setGreeting('Guten...
def test_something(setup): assert setup.timecostly == 1 def test_something_more(setup): assert setup.timecostly == 1
def test_something(setup): assert setup.timecostly == 1 def test_something_more(setup): assert setup.timecostly == 1
#wapp to find factorial of a number provided by the user num=int(input("enter a number:")) if(num<0): print("enter positive number") elif(num==0): print("ans=",1) else: fact=1 for i in range(1,num+1): fact=fact*i print("ans=",fact)
num = int(input('enter a number:')) if num < 0: print('enter positive number') elif num == 0: print('ans=', 1) else: fact = 1 for i in range(1, num + 1): fact = fact * i print('ans=', fact)
def part1(data): coordinateData = {} coordinateData2 = {} coordinates = set() xmin, xmax, ymin, ymax = 1000, 0, 1000, 0 for eachLine in data.splitlines(): splitLine = eachLine.split(', ') coordinates.add((int(splitLine[0]), int(splitLine[1]))) coordinateData[f"{int(splitLine[...
def part1(data): coordinate_data = {} coordinate_data2 = {} coordinates = set() (xmin, xmax, ymin, ymax) = (1000, 0, 1000, 0) for each_line in data.splitlines(): split_line = eachLine.split(', ') coordinates.add((int(splitLine[0]), int(splitLine[1]))) coordinateData[f'{int(sp...
# Copyright (c) 2009 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'includes': [ '../../build/common.gypi', ], 'targets': [ { 'target_name': 'harfbuzz', 'type': '<(library)', 'sources': ...
{'includes': ['../../build/common.gypi'], 'targets': [{'target_name': 'harfbuzz', 'type': '<(library)', 'sources': ['src/harfbuzz-buffer.c', 'src/harfbuzz-stream.c', 'src/harfbuzz-dump.c', 'src/harfbuzz-gdef.c', 'src/harfbuzz-gpos.c', 'src/harfbuzz-gsub.c', 'src/harfbuzz-impl.c', 'src/harfbuzz-open.c', 'src/harfbuzz-sh...
# -*- coding: utf-8 -*- n = float(input()) if (0 <= n <=25): print('Intervalo [0,25]') elif (25 < n <=50): print('Intervalo (25,50]') elif (50 < n <=75): print('Intervalo (50,75]') elif (75 < n <=100): print('Intervalo (75,100]') else: print('Fora de intervalo')
n = float(input()) if 0 <= n <= 25: print('Intervalo [0,25]') elif 25 < n <= 50: print('Intervalo (25,50]') elif 50 < n <= 75: print('Intervalo (50,75]') elif 75 < n <= 100: print('Intervalo (75,100]') else: print('Fora de intervalo')
def get_priorities(client, db_rid=None, priority_name=None, page_size=1000, verbose=False): conditionstring = "" if db_rid: conditionstring = client._add_condition(conditionstring, 'id', db_rid, verbose) if priority_name: conditionstring = client._add_condition(conditionstring, 'name', prio...
def get_priorities(client, db_rid=None, priority_name=None, page_size=1000, verbose=False): conditionstring = '' if db_rid: conditionstring = client._add_condition(conditionstring, 'id', db_rid, verbose) if priority_name: conditionstring = client._add_condition(conditionstring, 'name', prior...
def maior(* num): print('=' * 30) print('Analisando os respectivos valores . . . ') cont = maior = 0 for n in num: print(f'{n} ', end='') if cont == 0: maior = n else: if n > maior: maior = n cont += 1 print(f' Foram digitados {...
def maior(*num): print('=' * 30) print('Analisando os respectivos valores . . . ') cont = maior = 0 for n in num: print(f'{n} ', end='') if cont == 0: maior = n elif n > maior: maior = n cont += 1 print(f' Foram digitados {cont} valores ao todo...
_base_ = [ '../_base_/models/spatialflow_r50_fpn.py', '../_base_/datasets/coco_panoptic.py', '../_base_/schedules/schedule_20e.py', '../_base_/default_runtime.py' ] # optimizer optimizer = dict(type='SGD', lr=0.005, momentum=0.9, weight_decay=0.0001) # panoptic settings segmentations_folder='./work_dirs/spa...
_base_ = ['../_base_/models/spatialflow_r50_fpn.py', '../_base_/datasets/coco_panoptic.py', '../_base_/schedules/schedule_20e.py', '../_base_/default_runtime.py'] optimizer = dict(type='SGD', lr=0.005, momentum=0.9, weight_decay=0.0001) segmentations_folder = './work_dirs/spatialflow_r50_fpn_20e_coco/segmentations_fold...
#!/usr/bin/env python3 # This script is to learn how to manipulate lists my_list = ['192.168.0.5', 5060, 'UP'] print( "THe first item in teh list (IP): " + my_list[0] ) print( "The second item in teh list (state): " + my_list[2] ) new_list = [ 5060, '80', 55, '10.0.0.1', '10.20.30.1', 'ssh' ] #my code to use a single ...
my_list = ['192.168.0.5', 5060, 'UP'] print('THe first item in teh list (IP): ' + my_list[0]) print('The second item in teh list (state): ' + my_list[2]) new_list = [5060, '80', 55, '10.0.0.1', '10.20.30.1', 'ssh'] print('Ip addresses ' + new_list[3] + ' ' + new_list[4] + ' availalbe for ' + new_list[5] + ' at ports ' ...
languages = [ { "Language": "Bengali", "ISO-639-1 Code": "bn" }, { "Language": "Gujarati", "ISO-639-1 Code": "gu" }, { "Language": "Hindi", "ISO-639-1 Code": "hi" }, { "Language": "Malayalam", "ISO-639-1 Code": "ml" }, { "Language": "Marathi", "ISO-639-1 Code": "mr" }, { "Lan...
languages = [{'Language': 'Bengali', 'ISO-639-1 Code': 'bn'}, {'Language': 'Gujarati', 'ISO-639-1 Code': 'gu'}, {'Language': 'Hindi', 'ISO-639-1 Code': 'hi'}, {'Language': 'Malayalam', 'ISO-639-1 Code': 'ml'}, {'Language': 'Marathi', 'ISO-639-1 Code': 'mr'}, {'Language': 'Punjabi', 'ISO-639-1 Code': 'pa'}, {'Language':...
''' isEven takes a single integer parameter a returning true if a is even and false if a is odd ''' def isEven(a): return a % 2 == 0 ''' print(isEven(-1)) print(isEven(-2)) print(isEven(1)) print(isEven(8)) ''' ''' missing_char takes a non-empty string, str, and returns the str without the character at index n '...
""" isEven takes a single integer parameter a returning true if a is even and false if a is odd """ def is_even(a): return a % 2 == 0 '\nprint(isEven(-1))\nprint(isEven(-2))\nprint(isEven(1))\nprint(isEven(8))\n' '\nmissing_char takes a non-empty string, str, and returns\nthe str without the character at index n\n...
# generated from catkin/cmake/template/order_packages.context.py.in source_root_dir = "/home/robotpt/QTRobotTester/src" whitelisted_packages = "".split(';') if "" != "" else [] blacklisted_packages = "".split(';') if "" != "" else [] underlay_workspaces = "/home/robotpt/QTRobotTester/devel;/home/robotpt/HumanProjectorI...
source_root_dir = '/home/robotpt/QTRobotTester/src' whitelisted_packages = ''.split(';') if '' != '' else [] blacklisted_packages = ''.split(';') if '' != '' else [] underlay_workspaces = '/home/robotpt/QTRobotTester/devel;/home/robotpt/HumanProjectorInteration/devel;/home/robotpt/Desktop/catkin_nui/devel;/home/robotpt...
# -*- coding: utf-8 -*- # Copyright 2017, A10 Networks # Author: Mike Thompson: @mike @t @a10@networks!com # image1 = '''Funded By: ``........` `.--:////////...
image1 = 'Funded By:\n ``........`\n `.--:///////////////-`\n `.-://::--..`` ``.:////:...
# network HOST = '127.0.0.1' # or '0:0:0:0:0:0:0:1' PORT = 9999 # UI DEFAULT_POWERED = False # powered off DEFAULT_COLOR = '#000000' # black BACKGROUND_COLOR = '#FFFFFF' # white DIMENSIONS = "200x200" REFRESH_RATE = 100 # UI refresh every 100 milliseconds # misc LOGGING = { 'level': 'INFO', 'handler': '...
host = '127.0.0.1' port = 9999 default_powered = False default_color = '#000000' background_color = '#FFFFFF' dimensions = '200x200' refresh_rate = 100 logging = {'level': 'INFO', 'handler': 'StreamHandler', 'filepath': 'lantern.log'}
class RangeStack: def __init__(self) -> None: self.stack = [] self.add = [] self.cursum = 0 def push(self, v : int) -> None: self.cursum += v self.stack.append(v) self.add.append(0) def pop(self) -> int: if not self.add: return -1 ...
class Rangestack: def __init__(self) -> None: self.stack = [] self.add = [] self.cursum = 0 def push(self, v: int) -> None: self.cursum += v self.stack.append(v) self.add.append(0) def pop(self) -> int: if not self.add: return -1 ...
# Copyright 2019 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. DEPS = [ 'cloudbuildhelper', 'recipe_engine/path', ] def RunSteps(api): paths = api.cloudbuildhelper.discover_manifests( root=api.path['cache']...
deps = ['cloudbuildhelper', 'recipe_engine/path'] def run_steps(api): paths = api.cloudbuildhelper.discover_manifests(root=api.path['cache'], dirs=['1', '2']) assert paths == [api.path['cache'].join('1', 'target.yaml'), api.path['cache'].join('2', 'target.yaml')], paths def gen_tests(api): yield api.test(...
class Solution: def __init__(self): self.tribo = {0:0,1:1,2:1} def tribonacci(self, n: int) -> int: if(n in self.tribo): return self.tribo[n] else: res = self.tribonacci(n-1)+self.tribonacci(n-2)+self.tribonacci(n-3) self.tribo[n] = res return ...
class Solution: def __init__(self): self.tribo = {0: 0, 1: 1, 2: 1} def tribonacci(self, n: int) -> int: if n in self.tribo: return self.tribo[n] else: res = self.tribonacci(n - 1) + self.tribonacci(n - 2) + self.tribonacci(n - 3) self.tribo[n] = res...
#Exercise 3: Write a program to read through a mail log, build a histogram using a dictionary #to count how many messages have come from each email address, and print the dictionary. #Exercise 5: This program records the domain name (instead of the address) where the message #was sent from instead of who the mail ca...
name = input('Enter file:') if len(name) < 1: name = 'mbox-short.txt' handle = open(name) counts = dict() for line in handle: words = list(line.split()) if not line.startswith('From') or line.startswith('from'): continue emails = words[1] x = emails.find('@') domains = emails[x:] cou...
# output from sgtbx computed on platform win32 on 2010-04-28 sgtbx = { 'p 2 3': [ (1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0) , (0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0) , (0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0) , (0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 1.0, 0.0, 0.0, 0...
sgtbx = {'p 2 3': [(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0), (0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0), (0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0), (0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 1.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0...
print('-' * 12) num = int(input('Digite um numero da tabuada: ')) print('{} x 1 = {}'.format(num, num*1)) print('{} x 2 = {}'. format(num, num*2)) print('{} x 3 = {}'.format(num, num*3)) print('{} x 4 = {}'.format(num,num*4)) print('{} x 5 = {}'.format(num, num*5)) print('{} x 6 = {}'.format(num, num*6)) print('{} x 7 ...
print('-' * 12) num = int(input('Digite um numero da tabuada: ')) print('{} x 1 = {}'.format(num, num * 1)) print('{} x 2 = {}'.format(num, num * 2)) print('{} x 3 = {}'.format(num, num * 3)) print('{} x 4 = {}'.format(num, num * 4)) print('{} x 5 = {}'.format(num, num * 5)) print('{} x 6 = {}'.format(num, num * 6)) pr...
T=int(input()) N=int(input()) A=list(map(int,input().split())) M=int(input()) B=list(map(int,input().split())) k=0 for i in range(N): if k!=M and 0<=B[k]-A[i]<=T:k+=1 print("yes" if k==M else "no")
t = int(input()) n = int(input()) a = list(map(int, input().split())) m = int(input()) b = list(map(int, input().split())) k = 0 for i in range(N): if k != M and 0 <= B[k] - A[i] <= T: k += 1 print('yes' if k == M else 'no')
def NX(LENS, X = .50): tot = sum(LENS) for L in LENS: a = sum([x for x in LENS if x >= L]) if a >= tot * X: NX = L return NX if __name__ == "__main__": FASTA_file = open('MRSA_k85/contigs.fasta') LENS = [] for line in FASTA_file: if line.startswith('>'): ...
def nx(LENS, X=0.5): tot = sum(LENS) for l in LENS: a = sum([x for x in LENS if x >= L]) if a >= tot * X: nx = L return NX if __name__ == '__main__': fasta_file = open('MRSA_k85/contigs.fasta') lens = [] for line in FASTA_file: if line.startswith('>'): ...
# --- Day 3: Perfectly Spherical Houses in a Vacuum --- f = open("input.txt", "r").read() def getSantasUniquePositions(file, numSantas): x = 0 y = 0 start = [x, y] santaPositions = [start] roboPositions = [start] i = 0 santaX = roboX = x santaY = roboY = y for c in file: if i % numSantas == 0: sant...
f = open('input.txt', 'r').read() def get_santas_unique_positions(file, numSantas): x = 0 y = 0 start = [x, y] santa_positions = [start] robo_positions = [start] i = 0 santa_x = robo_x = x santa_y = robo_y = y for c in file: if i % numSantas == 0: santa_pos = [] ...
total_tickets = 0 student_tickets = 0 standart_tickets = 0 kids_tickets = 0 count_seats = 0 while True: command = input() if command == "Finish": print(f"Total tickets: {total_tickets}") percent_student = student_tickets / total_tickets * 100 percent_standart = standart_ticke...
total_tickets = 0 student_tickets = 0 standart_tickets = 0 kids_tickets = 0 count_seats = 0 while True: command = input() if command == 'Finish': print(f'Total tickets: {total_tickets}') percent_student = student_tickets / total_tickets * 100 percent_standart = standart_tickets / total_t...
class Structure: # Class variable that specifies expected fields _fields= [] def __init__(self, *args): if len(args) != len(self._fields): raise TypeError('Expected {} arguments'.format(len(self._fields))) # Set the arguments for name, value in zip(self._fields, args): ...
class Structure: _fields = [] def __init__(self, *args): if len(args) != len(self._fields): raise type_error('Expected {} arguments'.format(len(self._fields))) for (name, value) in zip(self._fields, args): setattr(self, name, value) if __name__ == '__main__': class ...
def tax_brackets(gross_income, deduc=12700): # married only # deduc is for itemizing in 2017 (majority would be from income tax) brackets_17 = ( (18650, 0.1), (75900-18650, 0.15), (153100-75900, 0.25), (233350-153100, 0.28), (416700-233350, 0.33), (470700-4167...
def tax_brackets(gross_income, deduc=12700): brackets_17 = ((18650, 0.1), (75900 - 18650, 0.15), (153100 - 75900, 0.25), (233350 - 153100, 0.28), (416700 - 233350, 0.33), (470700 - 416700, 0.35), (1e+100, 0.393)) tax_17 = 0.0 gross_income_17 = gross_income - deduc for bracket in brackets_17: if ...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"count_errors": "00_core.ipynb", "map_dtypes_to_choices": "00_core.ipynb", "AsType": "00_core.ipynb", "Row": "00_core.ipynb", "get_smallest_valid_conversion": "00_core.ipyn...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'count_errors': '00_core.ipynb', 'map_dtypes_to_choices': '00_core.ipynb', 'AsType': '00_core.ipynb', 'Row': '00_core.ipynb', 'get_smallest_valid_conversion': '00_core.ipynb', 'get_improvement': '00_core.ipynb', 'report_on_dataframe': '00_core.ipynb...
class Solution: def solve(self, nums): is_strictly_increasing = True for i in range(len(nums)-1): if nums[i+1] <= nums[i]: is_strictly_increasing = False if is_strictly_increasing: return True is_strictly_decreasing = True ...
class Solution: def solve(self, nums): is_strictly_increasing = True for i in range(len(nums) - 1): if nums[i + 1] <= nums[i]: is_strictly_increasing = False if is_strictly_increasing: return True is_strictly_decreasing = True for i in...
# # PySNMP MIB module NETBOTZ-DEVICE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NETBOTZ-DEVICE-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:18:29 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, constraints_union, value_range_constraint, single_value_constraint) ...
num= 89 cont= 0 while num <= 150: if num % 2 == 0: print('par', num) cont = cont + 1 num = num + 1 print('quantidade= ',cont)
num = 89 cont = 0 while num <= 150: if num % 2 == 0: print('par', num) cont = cont + 1 num = num + 1 print('quantidade= ', cont)
# Reference: https://runestone.academy/runestone/books/published/pythonds/Recursion/pythondsConvertinganIntegertoaStringinAnyBase.html # if num < base (2, 8, 10, 16) then we can directly lookup the corresponding # string value # hence base case = if num < base then lookup # To reduce the problem towards base case, we ...
def to_str(num, base): convert_string = '0123456789ABCDEF' if num < base: return convert_string[num] else: digit = num // base remainder = num % base return to_str(digit, base) + convert_string[remainder] def test_base_convertor(): assert to_str(10, 2) == '1010' asse...