content
stringlengths
7
1.05M
def multiplicationTable(size): return [[j*i for j in range(1, size+1)] for i in range(1, size+1)] x = multiplicationTable(5) print(x) print() for i in x: print(i)
def getFrequencyDictForText(sentence): fullTermsDict = multidict.MultiDict() tmpDict = {} # making dictionary for counting word frequencies for text in sentence.split(" "): # remove irrelevant words if re.match("a|the|an|the|to|in|for|of|or|by|with|is|on|that|but|from|than|be", text): ...
class BoxaugError(Exception): pass
""" Desenvolva um programa que leia o comprimento de três retas e diga ao usuário se elas podem ou não formar um triângulo.""" a = float(input('Reta A:')) b = float(input('Reta B:')) c = float(input('Reta C:')) if a < b + c and b < a + c and c < a + b: print('Forma um triangulo') else: print('Não forma um trian...
# short hand if a=23 b=4 if a > b: print("a is greater than b") # short hand if print("a is greater ") if a > b else print("b is greater ") #pass statements b=300 if b > a: pass
if args.algo in ['a2c', 'acktr']: values, action_log_probs, dist_entropy, conv_list = actor_critic.evaluate_actions(Variable(rollouts.states[:-1].view(-1, *obs_shape)), Variable(rollouts.actions.view(-1, action_shape))) # pre-process values = values.view(args.num_steps, num_processes_total, 1) action_lo...
''' Given an array consists of non-negative integers, your task is to count the number of triplets chosen from the array that can make triangles if we take them as side lengths of a triangle. Example 1: Input: [2,2,3,4] Output: 3 Explanation: Valid combinations are: 2,3,4 (using the first 2) 2,3,4 (using the second 2)...
print("\tWelcome to the Factor Generator App") #Creamos la variable c = True para utilizar en un bucle sin fin c = True #Creamos el bucle while c : num = int(input("\nEnter a number to determine all factors of that number: ")) fact = [] #Añadimos los factores del número for i in range(1,num+1): ...
a = [0x77, 0x60, 0x76, 0x66, 0x72, 0x77, 0x7D, 0x73, 0x60, 0x3D, 0x64, 0x60, 0x39, 0x52, 0x66, 0x3B, 0x73, 0x7A, 0x23, 0x7D, 0x73, 0x4A, 0x70, 0x78, 0x6A, 0x46, 0x69, 0x2B, 0x76, 0x68, 0x41, 0x77, 0x41, 0x42, 0x49, 0x4A, 0x4A, 0x42, 0x40, 0x48, 0x5A, 0x5A, 0x45, 0x41, 0x59, 0x03, 0x5A, 0x4A, 0x51, 0x5C, 0x4F] flag = ''...
""" Datos de entrada: Nombre --> str --> A Compra --> float --> B Datos de salida: Total --> float --> C Nombre --> str --> A Compra --> float --> B Descuento --> float --> D """ # Entrada A = str(input("\nDigite tu nombre ")) B = float(input("Digite el valor de tu compra ")) # Caja negra if B < 50000: D...
# This code is provoded by MDS DSCI 531/532 def mds_special(): font = "Arial" axisColor = "#000000" gridColor = "#DEDDDD" return { "config": { "title": { "fontSize": 24, "font": font, "anchor": "star...
# Writing a method class Shape: def __init__(self, name, sides, colour=None): self.name = name self.sides = sides self.colour = colour def get_info(self): return '{} {} with {} sides'.format(self.colour, self.name, ...
def soma(a, b): print(f'A = {a} e B = {b}.') s = a + b print(f'A soma de A + B = {s}.') # Programa Principal soma(a=4, b=5) soma(b=8, a=9) soma(2, 1) # Empacotamento def contador(* num): for valor in num: print(f'{valor} ', end=' ') print('FIM!') tam = len(num) print(f'O total d...
""" A very simple class to make running tests a bit simpler. There are much stronger frameworks possible; this is a KISS framework. Authors: David Mutchler, Valerie Galluzzi, Mark Hays, Amanda Stouder, and their colleagues. """ class SimpleTestCase(object): """ A SimpleTestCase is a test to run. It...
class Solution: def findSmallestSetOfVertices(self, n: int, edges: List[List[int]]) -> List[int]: degree = [0] * n for u, v in edges: degree[v] = 1 return [i for i, d in enumerate(degree) if d == 0]
#!/usr/bin/env python DEBUG = True SECRET_KEY = 'super-ultra-secret-key' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } INSTALLED_APPS = [ 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.staticfiles', 'django_ta...
def recursion_test(depth): print("recursion depth:", depth) if depth < 996: recursion_test(depth + 1) else: print("exit recursion") return # 下面是 代码16-5,重复出现,不要出现在代码示例里: recursion_test(1)
# -*- coding: utf-8 -*- """ Created on Wed Feb 2 07:54:50 2022 @author: HP """ A = [85, 86 ,32 ,12 ,82 ,43] # i, j # [12,32,43,55,82,86] # obtener el tamaño de la lista num = len (A) i=0 while i < num : j=i while j < num : if (A[i]> A[j]): aux= A[i] A[i]=A[j] A[i]=aux...
# classical (x, y) position vectors class Pos: def __init__(self, x, y): self.x = x self.y = y def __add__(self, other): return(Pos(self.x + other.x, self.y + other.y)) def __eq__(self, other): return( (self.x == other.x) and (self.y == other.y)) def __mul__(self, factor): return(Pos(factor * sel...
# model settings model = dict( type='Recognizer3D', backbone=dict( type='C3D', # pretrained= # noqa: E251 # 'https://download.openmmlab.com/mmaction/recognition/c3d/c3d_sports1m_pretrain_20201016-dcc47ddc.pth', # noqa: E501 pretrained= # noqa: E251 './work_dirs/fatigue...
# # @lc app=leetcode id=55 lang=python # # [55] Jump Game # # https://leetcode.com/problems/jump-game/description/ # # algorithms # Medium (31.35%) # Total Accepted: 241.1K # Total Submissions: 767.2K # Testcase Example: '[2,3,1,1,4]' # # Given an array of non-negative integers, you are initially positioned at the ...
class HelperProcessRequest: """ This class allows agents to express their need for a helper process that may be shared with other agents. """ def __init__(self, python_file_path: str, key: str, executable: str = None): """ :param python_file_path: The file that should be loaded and insp...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': if root is None: return...
def variance_of_sample_proportion(a,b,c,d,e,f,g,h,j,k): try: a = int(a) b = int(b) c = int(c) d = int(d) e = int(e) f = int(f) g = int(g) h = int(h) j = int(j) k = int(k) sample = [a,b,c,d,e,f,g,h,j,k] # Count how many ...
class FlatList(list): """ This class inherits from list and has the same interface as a list-type. However, there is a 'data'-attribute introduced, that is required for the encoding of the list! The fields of the encoding-Schema must match the fields of the Object to be encoded! """ @property ...
class ITypeHintingFactory(object): def make_param_provider(self): """ :rtype: rope.base.oi.type_hinting.providers.interfaces.IParamProvider """ raise NotImplementedError def make_return_provider(self): """ :rtype: rope.base.oi.type_hinting.providers.interfaces.I...
class Stack: def __init__(self): self.stack = [] self.current_minimum = float('inf') def push(self, item): if not self.stack: self.stack.append(item) self.current_minimum = item else: if item >= self.current_minimum: self.stack...
# -*- coding: utf-8 -*- # Return the contents of a file def load_file(filename): with open(filename, "r") as f: return f.read() # Write contents to a file def write_file(filename, content): with open(filename, "w+") as f: f.write(content) # Append contents to a file def append_file(filename, content): ...
def main(): t: tuple[i32, str] t = (1, 2) main()
# Config SIZES = { 'basic': 299 } NUM_CHANNELS = 3 NUM_CLASSES = 2 GENERATOR_BATCH_SIZE = 32 TOTAL_EPOCHS = 50 STEPS_PER_EPOCH = 100 VALIDATION_STEPS = 50 BASE_DIR = 'C:\\Users\\guilo\\mba-tcc\\data\\'
def test_split(): assert split(10) == 2 def test_string(): city = "String" assert type(city) == str def test_float(): price = 3.45 assert type(price) == float def test_int(): high_score = 1 assert type(high_score) == int def test_boolean(): is_having_fun = True assert type(is...
""" ID: tony_hu1 PROG: milk2 LANG: PYTHON3 """ def read_in(infile): a = [] with open(infile) as filename: for line in filename: a.append(line.rstrip()) return a def milk_cows_main(flines): total = [] num_cows = int(flines[0]) for i in range(num_cows): b = fline...
A = 'A' B = 'B' RULE_ACTION = { 1: 'Suck', 2: 'Right', 3: 'Left', 4: 'NoOp' } rules = { (A, 'Dirty'): 1, (B, 'Dirty'): 1, (A, 'Clean'): 2, (B, 'Clean'): 3, (A, B, 'Clean'): 4 } # Ex. rule (if location == A && Dirty then 1) Environment = { A: 'Dirty', B: 'Dirty', 'Curre...
numero = int(input('\033[33mDigite um número inteiro:\033[m ')) print("""Escolha uma das bases para conversão: [ \033[1;31m1\033[m ] converter para \033[1;31mBINÁRIO\033[m [ \033[1;35m2\033[m ] converter para \033[1;35mOCTAL\033[m [ \033[1;36m3\033[m ] converter para \033[1;36mHEXADECIMAL\033[m""") opcao = int(input('S...
def convert(s): s_split = s.split(' ') return s_split def niceprint(s): for i, elm in enumerate(s): print('Element #', i + 1, ' = ', elm, sep='') return None c1 = 10 c2 = 's'
# Source : https://leetcode.com/problems/reverse-string-ii/#/description # Author : Han Zichi # Date : 2017-04-23 class Solution(object): def reverseStr(self, s, k): """ :type s: str :type k: int :rtype: str """ l = len(s) tmp = [] for i in range(0...
# 1. def print_greeting(name, age_in_years, address): age_in_days = age_in_years * 365 age_in_years_1000_days_ago = (age_in_days - 1000) / 365 print("My name is " + name + " and I am " + str(age_in_years) + " years old (that's " + str(age_in_days) + " days). 1000 days ago, I was " ...
# # PySNMP MIB module ASCEND-MIBIPSECSPD-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASCEND-MIBIPSECSPD-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:11:32 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
#!/usr/bin/env python # coding: utf-8 # In[2]: def utopianTree(cycles): h=1 for cyc_no in range(cycles): if (cyc_no%2==0): h=h*2 elif (cyc_no): h+=1 return h if __name__=='__main__': n=int(input()) for itr in range(n): cycles=int(input()) pr...
# Copyright 2020 InterDigital Communications, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
def divisors(integer): aux = [i for i in range(2, integer) if integer % i == 0] if len(aux) == 0: return "{} is prime".format(integer) else: return aux
# coding: utf-8 pyslim_version = '0.700' slim_file_version = '0.7' # other file versions that require no modification compatible_slim_file_versions = ['0.7']
""" Created on Sat Aug 27 12:52:52 2021 AI and deep learnin with Python Data types and operators Quiz Zip and Enumerate """ # Problem 1: """Use zip to write a for loop that creates a string specifying the label and coordinates of each point and appends it to the list points. Each string should be format...
#!/usr/bin/env python # -*- coding: UTF-8 -*- # 有效的字母异位词 # v1 def isAnagram(s, t): return sorted(s) == sorted(t) v1 = 'cat' v2 = 'tca' # print(isAnagram(v1, v2)) # v2 def isAnagram1(s, t): dic1, dic2 = {},{} # dict -> hashmap for item in s: dic1[item] = dic1.get(item, 0) + 1 for item in t:...
def format_as_vsys(amount): abs_amount = abs(amount) whole = int(abs_amount / 100000000) fraction = abs_amount % 100000000 if amount < 0: whole *= -1 return f'{whole}.{str(fraction).rjust(8, "0")}'
class Solution: def canVisitAllRooms(self, rooms): stack = [0] visited = set(stack) while stack: curr = stack.pop() for room in rooms[curr]: if room not in visited: stack.append(room) visited.add(room) ...
__author__ = 'spersinger' class Configuration: @staticmethod def run(): Configuration.enforce_ttl = True Configuration.ttl = 60 Configuration.run()
""" link: https://leetcode-cn.com/problems/relative-ranks problem: 求数组每个元素排序后的次序 solution: 排序后记录 """ class Solution: def findRelativeRanks(self, nums: List[int]) -> List[str]: if not nums: return [] res = [_ for _ in nums] for i, v in enumerate(nums): nums[i] = (-...
##### # https://github.com/sushiswap/sushiswap-subgraph # https://dev.sushi.com/api/overview # https://github.com/sushiswap/sushiswap-analytics/blob/c6919d56523b4418d174224a6b8964982f2a7948/src/core/api/index.js # CP_API_TOKEN = os.environ.get("cp_api_token") #"https://gateway.thegraph.com/api/c8eae2e5ac9d2e9d5d5459c33...
""" Telemac-Mascaret exceptions """ class TelemacException(Exception): """ Generic exception class for all of Telemac-Mascaret Exceptions """ pass class MascaretException(TelemacException): """ Generic exception class for all of Telemac-Mascaret Exceptions """ pass
# -*- coding: utf-8 -*- commands = { 'start_AfterAuthorized': u'Welcome to remoteSsh_bot\n\n' u'If you known password - use /on\n' u'else - connect to admin', 'start_BeforeAuthorized': u'Hello!\n' ...
# -*- coding: utf-8 -*- """ Created on Mon Feb 5 14:31:36 2018 @author: User """ # part 1-e def multlist(m1, m2): lenof = len(m1) newl = [] for i in range(lenof): newl.append( m1[i]* m2[i]) print(None) m1=[1, 2, 23, 104] m2=[-3, 2, 0, 6] multlist(m1, m2) # part 1-a #def cr...
''' ''' def main(): info('Pump Microbone') close(description="Jan Inlet") if is_closed('F'): open(description= 'Microbone to CO2 Laser') else: close(name="T", description="Microbone to CO2 Laser") sleep(1) close(description= 'CO2 Laser to Roughing') #close(description...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' def split_text_by_fragments(text: str, fragment_length=50) -> list: """ Функция для разбития текста (<text>) на куски указанной длины (<fragment_length>). """ # Если длина фрагмента больше или равна длине текста, то сразу возвра...
def findDecision(obj): #obj[0]: Driving_to, obj[1]: Passanger, obj[2]: Weather, obj[3]: Temperature, obj[4]: Time, obj[5]: Coupon, obj[6]: Coupon_validity, obj[7]: Gender, obj[8]: Age, obj[9]: Maritalstatus, obj[10]: Children, obj[11]: Education, obj[12]: Occupation, obj[13]: Income, obj[14]: Bar, obj[15]: Coffeehouse,...
bil = 0 count = 0 hasil = 0 while(bil <= 100): if(bil % 2 == 1): count += 1 hasil += bil print(bil) bil += 1 print('Banyaknya bilangan ganjil :', count) print('Jumlah seluruh bilangan :', hasil)
def mapping_Luo(t=1): names = [ 'Yao_6_2', 'AB_TMA_2', 'ABA_TMA_2', 'ABAB_TMA_2', 'ABABA_TMA_2', 'ABABA_IPrMeP_2'] xlocs = [ 21400, 5500, -7200, -11700, -17200, -30700] ylocs = [ 0, 0, 0, 0, ...
# -*- coding: utf-8 -*- """ Created on Mon Feb 12 21:55:16 2018 @author: User """ def by_courses(file): lol = [] name_dict = {} f = open(file, 'r') all_details = f.read() lol.append([all_details]) f.close() all_details = [line for line in all_details.split('\n') if line.strip()...
def alpha_numeric(m): return re.sub('[^A-Za-z0-9]+', ' ', m) def uri_from_fields(fields): string = '_'.join(alpha_numeric(f.strip().lower()) for f in fields) if len(string) == len(fields)-1: return '' return string def splitLocation(location): return re.search('[NS]',location).start() def getLatitude(s,l): ...
def solve(input, days): # Lanternfish with internal timer t are the number of lanternfish with timer t+1 after a day for day in range(days): aux = input[0] input[0] = input[1] input[1] = input[2] input[2] = input[3] input[3] = input[4] input[4] = input[5] ...
def funcao1(funcao, *args, **kwargs): return funcao(*args, **kwargs) def funcao2(nome): return f'Oi {nome}' def funcao3(nome, saudacao): return f'{saudacao} {nome}' executando = funcao1(funcao2, 'Luiz') print(executando) executando = funcao1(funcao3, 'Luiz', saudacao='Bom dia') print(executando)
true = True; false = False; true1 = "True"; false1 = "False"; true2 = true; ''' I was trying to check if keyword is case sensitive which it is not but here the above defined variable value is taken which is bool This technique can be used to define case insensitive keywords at start to py program.''' false2 = false; pr...
## input = 1,2,3,4 ## output = ['1','2','3','4'], ('1','2','3','4') def abc(): values = input() print("----") print(values) print("----") x = values.split(",") print(x) y = tuple(x) print("===") print(y) if __name__ == "__main__": abc()
#!/usr/bin/env python3 FILENAME = "/tmp/passed" bmks = [] with open(FILENAME, "r") as f: for l in f: [m, a] = l.split(" ") t = (m, a.strip()) bmks.append(t) def quote(s): return '"{}"'.format(s) indent = " " output = '{}[ {}\n{}]'.format(indent, f'\n{indent}, '.join(f'("{m}", "{a}"...
class Solution: def ladderLength(self, beginWord: str, endWord: str, wordList: List[str]) -> int: """BFS. """ words = set(wordList) if endWord not in words: return 0 layer = set([beginWord]) res = 1 while layer: nlayer = set() ...
{ "includes": [ "../common.gypi" ], "targets": [ { "target_name": "libgdal_ogr_vrt_frmt", "type": "static_library", "sources": [ "../gdal/ogr/ogrsf_frmts/vrt/ogrvrtlayer.cpp", "../gdal/ogr/ogrsf_frmts/vrt/ogrvrtdriver.cpp", "../gdal/ogr/ogrsf_frmts/vrt/ogrvrtdatasource.cpp" ], "include...
class Compose(object): """Composes several transforms together for object detection. Args: transforms (list of ``Transform`` objects): list of transforms to compose. """ def __init__(self, transforms): self.transforms = transforms def __call__(self, image, target): for t i...
def subarraysCountBySum(a, k, s): ans=0 n=len(a) t=0 ii=1 while(k+t<=n): tmp=[] for i in range(t,ii+t): tmp.append(a[i]) print(tmp) ii+=1 if len(tmp)<=k and sum(tmp)==s: ans+=1 t+=1 else: break return ans a=list(ma...
def main(request, response): response.headers.set(b"Content-Type", b"text/plain") response.status = 200 response.content = request.headers.get(b"Content-Type") response.close_connection = True
fruits = ['banana', 'orange', 'mango', 'lemon'] fruit = str(input('Enter a fruit: ')).strip().lower() if fruit not in fruits: fruits.append(fruit) print(fruits) else: print(f'{fruit} already in the list')
amount = 20 num=1 def setup(): size(640, 640) stroke(0, 150, 255, 100) def draw(): global num, amount fill(0, 40) rect(-1, -1, width+1, height+1) maxX = map(mouseX, 0, width, 1, 250) translate(width/2, height/2) for i in range(0,360,amount): x = sin(radians(i+num)) * maxX ...
class EmailValidator(object): """Abstract email validator to subclass from. You should not instantiate an EmailValidator, as it merely provides the interface for is_email, not an implementation. """ def is_email(self, address, diagnose=False): """Interface for is_email method. K...
# Copyright (c) Microsoft Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
class Backend(object): # should be implemented all methods def set(self, name, value): raise NotImplementedError() def get(self, name): raise NotImplementedError() def delete(self, name): raise NotImplementedError() def set_fields(self): raise NotImplementedError()...
number_of_days = int(input()) type_of_room = str(input()) rating = str(input()) room_for_one_person = 18.00 apartment = 25.00 president_apartment = 35.00 apartment_discount = 0 president_apartment_discount = 0 total_price_for_a_room = 0 total_price_for_apartment = 0 total_price_for_presidential_apartment = 0 addition...
LIST_WORKFLOWS_GQL = ''' query workflowList { workflowList { edges{ node { id name objectType initialPrefetch initialState { id name } initialTransition { id name } } } } } ''' LIST_STATES_GQL...
""" # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail """ # Write your code here x = ['0', '1', '8'] t = int(int(input())) f...
""" if __name__ == '__main__': for _ in range(int(input())): name = input() score = float(input()) """ # pythonNestedLists.py #!/usr/bin/env python N = int(input()) students = list() for i in range(N): students.append([input(), float(input())]) scores = set([students[x][1] for x in range(N)]...
with open("text.txt", "w") as my_file: my_file.write("Tretas dos Bronzetas") if my_file.closed == False: my_file.close() print(my_file.closed)
test = { 'name': 'Mutability', 'points': 0, 'suites': [ { 'type': 'wwpp', 'cases': [ { 'code': """ >>> lst = [5, 6, 7, 8] >>> lst.append(6) Nothing >>> lst [5, 6, 7, 8, 6] >>> lst.insert(0, 9) >>> lst ...
DESCRIBE_VMS = [ { "id": "/subscriptions/00-00-00-00/resourceGroups/TestRG/providers/Microsoft.Compute/virtualMachines/TestVM", "type": "Microsoft.Compute/virtualMachines", "location": "West US", "resource_group": "TestRG", "name": "TestVM", "plan": { "pro...
n = int(input('Informe um número: ')) print('Analisando o número: {}'.format(n)) u = n // 1 % 10 d = n // 10 % 10 c = n // 100 % 10 m = n // 1000 % 10 print('Unidade: {}\nDezena: {}\nCentena: {}\nMilhar: {}'.format(u, d, c, m))
''' Pattern Enter number of rows: 5 1 21 321 4321 54321 ''' print('Number Pattern:') number_rows=int(input('Enter number of rows: ')) for row in range(1,number_rows+1): for column in range(row,0,-1): if column < 10: print(f'0{column}',end=' ') else: print(column,end=' ') print()
class Solution: def isStrobogrammatic(self, num: str) -> bool: dic = {'1': '1', '6': '9', '8': '8', '9': '6', '0': '0'} l, r = 0, len(num)-1 while l <= r: if num[l] not in dic or dic[num[l]] != num[r]: return False l += 1 r -= 1 ret...
# Runtime: 128 ms # Beats 99.53% of Python submissions # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def insertIntoBST(self, root, val): """ :type root: TreeNode ...
""" Iterate List of list vertically tags : Twitter, array """ class Solution(): def vertical_iterator(self, arr): ans = [] arr_len = len(arr) col = 0 while True: is_empty = True for x in range(arr_len): if col < len(arr[x]): ...
# -*- coding: utf-8 -*- name = 'usd' version = '20.02' requires = [ 'alembic-1.5', 'boost-1.55', 'tbb-4.4.6', 'opensubdiv-3.2', 'ilmbase-2.2', 'jinja-2', 'jemalloc-4', 'openexr-2.2', 'pyilmbase-2.2', 'materialx', 'oiio-1.8', 'ptex-2.0', 'PyOpenGL', 'embree_lib'...
contador = 1 while contador <= 9: for contador2 in range(7, 4, -1): print(f'I={contador} J={contador2}') contador += 2
hora = int(input('quantas horas trabalha por mes: ')) money = float(input('quanto ganha por hora: ')) salario = hora * money ir = salario * 0.11 inss = salario * 0.08 sindicato = salario * 0.05 salario2 = (((salario - ir)-inss)-sindicato) print(''' + Salário Bruto : R${} - IR (11%) : R${} - INSS (8%) : R${} - Sindicato...
# Advent of Code - Day 4 valid_passport_data = { 'ecl', 'pid', 'eyr', 'hcl', 'byr', 'iyr', 'hgt', } count_required_data = len(valid_passport_data) def ecl_rule(value): return value in {'amb', 'blu', 'brn', 'gry', 'grn', 'hzl', 'oth'} def pid_rule(value): try: int(value) isnumber = True...
#!/usr/bin/env python # -*- coding: utf-8 -*- #----------------------------------- # AutoNaptPython # # Copyright (c) 2018 RainForest # # This software is released under the MIT License. # http://opensource.org/licenses/mit-license.php #----------------------------------- class Event2(object): def __init__(self,...
class Parser: def __init__(self, directory, rel_path): pass def parse(self): return {}, [] def get_parser(): return 5
load("@bazel_tools//tools/jdk:toolchain_utils.bzl", "find_java_runtime_toolchain", "find_java_toolchain") def _proto_path(proto): """ The proto path is not really a file path It's the path to the proto that was seen when the descriptor file was generated. """ path = proto.path root = proto.root...
# Set up constants WIDTH = 25 HEIGHT = 6 LAYER_SIZE = WIDTH * HEIGHT # Read in the input file and convert to a list pixel_string = "" with open("./input.txt") as f: pixel_string = f.readline() unlayered_pixel_values = list(pixel_string.strip()) # Make into a list of layers idx = 0 layers = [] while idx < len(unla...
def pg_version(conn): """ Returns the PostgreSQL server version as numeric and full version. """ num_version = conn.get_pg_version() conn.execute("SELECT version()") full_version = list(conn.get_rows())[0]['version'] return dict(numeric=num_version, full=full_version)
class BaseExceptions(Exception): pass class DeleteException(BaseException): """Raised when delete failed""" def __init__(self, resp_data): if isinstance(resp_data, dict): self.err = ''.join('Failed with reason {}'.format(val) for key, val in resp_data.items()) else: ...
def transition(state, char, stack_char): new_state = -1 new_stack_chars = "" if state == 0: new_state = 1 new_stack_chars = "S#" elif state == 1: if stack_char in "0123456789+-*:().": new_state = 1 new_stack_chars = "" elif stack_char == "S": ...
###### Gui Reis - guisreis25@gmail.com ###### COPYRIGHT © 2020 KINGS # -*- coding: utf-8 -*- ## Classe responsável pelo dos dias entre duas datas. class Dif_emDias: ## Construtor: define os atributos separando cada índice da data def __init__(self) -> None: # jan,fev,mar,abr,m...
class CommandBuilder(): def __init__(self, cindex): self.cindex = cindex class CodeBuilder(CommandBuilder): def __init__(self, cindex, cmd): super().__init__(cindex) self.cmd = cmd def __str__(self): return self.cmd class SlugBuilder(CommandBuilder): def __init__(self,...
n1=int(input('Digite o primeiro valor: ')) n2=int(input('Digite o segundo valor: ')) o=(input('Digite o operador para conta: ')) if o=='+': r=n1+n2 print(f'O resultado da conta é {r:,}') elif o=='-': r=n1-n2 print(f'O resultado da conta é {r:,}') elif o=='*': r==n1*n2 print(f'O resultado da con...