content
stringlengths
7
1.05M
localproibidoCalcada=430 localproibidofaixa=580 velocidademulta=70 falarnocel=830 tipodeinfracao=str(input('TIPO DE INFRAÇÃO: (calçada),(faixa),(celular)? ')).upper() velocidade=int(input('velocidade: ')) if tipodeinfracao=='CALÇADA': print('o valor a ser pago é {}R$ por estacionar na calçada'.format(localproibid...
def wordPattern(self, pattern: str, str: str) -> bool: m = {} words = str.split() if len(pattern) != len(words): return False result = True for i in range(len(pattern)): if pattern[i] not in m: if words[i] in m.values(): return F...
class ParseError(RuntimeError): """Exception to raise when parsing fails.""" class SyncError(RuntimeError): """Error class for general errors relating to the project sync process."""
# -*- coding: utf-8 -*- """ idfy_rest_client.models.file_format_331 This file was automatically generated for Idfy by APIMATIC v2.0 ( https://apimatic.io ) """ class FileFormat331(object): """Implementation of the 'fileFormat331' enum. TODO: type enum description here. Attributes...
#!usr/bin/python3.4 #!/usr/bin/python3.4 # Problem Set 0 # Name: xin zhong # Collaborators: # Time: 8:58-9:03 # last_name = input("Enter your last name:\n**") first_name = input("Enter your first name:\n**") print(first_name) print(last_name)
""" Exibe quantos produtos são maiores de R$1.000 e qual o mais barato """ print('-' * 50) print('ESTATISTICAS DE PRODUTOS') total = 0 mais_caros = 0 # mais de 1000 mais_barato = 0 n_barato = '' while True: produto = str(input('Nome de produto: ')).strip() preco = float(input('Preço do produto: R$')) tota...
class Solution: def solveNQueens(self, n: int) -> List[List[str]]: ans = [] cols = [False] * n diag1 = [False] * (2 * n - 1) diag2 = [False] * (2 * n - 1) def dfs(i: int, board: List[int]) -> None: if i == n: ans.append(board) return for j in range(n): if cols...
var = 'foo' def ex2(): var = 'bar' print('inside the function var is ', var) ex2() print('outside the function var is ', var) # should be bar, foo
class Hello: def __init__(self, name): self.name = name def greeting(self): print(f'Hello {self.name}')
listA = [1] listB = [1, 2, 3, 4, listA] listC = [1] listB *= 3 print(listB) print(listB[9] == listA) print(listB[4] is listA) print(listB[9] is listA) print(listB[9] is listC) print('-------------------------') print(listB.count(listA)) print(listB.count(listC)) print(listB.index(listC, 5)) print(listB.index(listC, 5,...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright SquirrelNetwork def string_generator(data_incoming): data = data_incoming.copy() del data['hash'] keys = sorted(data.keys()) string_arr = [] for key in keys: string_arr.append(key+'='+data[key]) string_cat = '\n'.join(string_arr) return s...
class UWB (Radio): """ Abstracts all communication over UWB options include: Ranging frequency | range after message """ def __init__(self): self._name = 'UWB' pass #
def fizzbuzz(x): if x % 3 == 0 and x % 5 != 0: r = 'Fizz' elif x % 3 != 0 and x % 5 ==0: r = 'Buzz' elif x % 3 == 0 and x % 5 ==0: r = 'FizzBuzz' else: r = x return r
class Tile: def __init__(self): self.first_visit = True self.tree_fallen = False def describe(self): print("You are walking through the trees. It looks like the path on " "your west leads to a small wooden hut.\n") if not self.first_visit and not self.tree_fallen: ...
#ces fonctions sont importées dans "graphique.py" def intersect(a1, b1, a2, b2): """ Détection d'intersection entre deux intervalles : renvoie `false` si l'intersection de [a1;a2] et [b1;b2] est vide. Arguments: a1 et b1 (float): bornes du premier intervalle a2 et b2 (float): bornes du sec...
#!/usr/bin/python3 """matrix multiplication""" def matrix_mul(m_a, m_b): """matrix multiplication""" if not isinstance(m_a, list): raise TypeError("m_a must be a list") elif not isinstance(m_b, list): raise TypeError("m_b must be a list") elif not all(isinstance(row, list) for row in m...
#!/usr/bin/python3 with open('input.txt') as f: input = list(map(int, f.read().splitlines())) PREMABLE_LENGTH = 25 idx = PREMABLE_LENGTH while idx < len(input): section = input[idx - PREMABLE_LENGTH:idx] target = input[idx] found = False for i, j in enumerate(section): if target - j in section[i+1:]: ...
FRAGMENT_LOG = ''' fragment fragmentLog on Log { id_ level message time } '''
#! Занятие по книге Python Crash Course, chapter 6, "Dictionaries". # Занятие первое. alien_0 = {} print(alien_0) # Начинаем с пустой библиотеки. alien_0[0], alien_0[1], alien_0[2] = {}, {}, {} alien_0[0]['color'], alien_0[0]['points'] = 'green', 5 alien_0[1]['color'], alien_0[1]['points'] = 'yellow'...
def LevenshteinDistance(v, w): v = '-' + v w = '-' + w S = [[0 for i in range(len(w))] for j in range(len(v))] for i in range(1, len(S)): S[i][0] = S[i - 1][0] + 1 for j in range(1, len(S[0])): S[0][j] = S[0][j - 1] + 1 for i in range(1, len(v)): for j in range(1, len(w))...
"""Collection of small helper functions""" def create_singleton(name): """Helper function to create a singleton class""" type_dict = {'__slots__': (), '__str__': lambda self: name, '__repr__': lambda self: name} return type(name, (object,), type_dict)()
input = [4, 6, 2, 9, 1] # for i in range(len(array) - 1): # for j in range(i + 1, len(array)): # if array[i] > array[j]: # array[i], array[j] = array[j], array[i] def bubble_sort(array): # 이 부분을 채워보세요! n = len(array) for i in range(n - 1): for j in range(n - i - 1): if ...
print('{:#^40}'.format(' Medidor de Tinta ')) altura = float(input('Qual a alura da sua parede?')) largura = float(float(input('Qual a altura da sua parede?'))) m2 = altura * largura tinta = m2 / 2 print(f"""\nSua parede tem {altura:.2f}m de altura e {largura:.2f}m de largura totalizando {m2:.2f}m2 Dessa forma serão...
DEBUG = False def set_verbose(value: bool) -> None: """Change the DEBUG value to be verbose or not. Args: value (bool): Verbosity on or off. """ global DEBUG DEBUG = value def log(message: str) -> None: """Logs the message to stdout if DEBUG is enabled. Args: message (s...
with open("water.in", "r") as input_file: input_list = [line.strip() for line in input_file] with open("water.out", "w") as output_file: for binary_diameter in input_list: print(round((2/3 * 3.14 * (int(binary_diameter, 2) ** 3)) / 1000), file=output_file)
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Copyright (c) 2016 Vobile Inc. All Rights Reserved. Author: xu_xiaorong Email: xu_xiaorong@mycompany.cn Created_at: 2016-08-10 13:46:10 ''' LOG_HANDLER = None # None means stdout, syslog means syslog LOG_LEVEL = 'INFO' QUEUE_NAME = "querier_queue" QUEUE_...
def get_unithash(n: int): int(n) if (n == 0): return 0 elif (n % 9 == 0): return 9 else: return n % 9 def set_unithash(num: str, l: int): sanitation=[] sanitation[:0]=num for i in range(0,len(sanitation)): if (sanitation[i].isdigit())==False: ...
american_holidays = """1,2012-01-02,New Year Day 2,2012-01-16,Martin Luther King Jr. Day 3,2012-02-20,Presidents Day (Washingtons Birthday) 4,2012-05-28,Memorial Day 5,2012-07-04,Independence Day 6,2012-09-03,Labor Day 7,2012-10-08,Columbus Day 8,2012-11-12,Veterans Day 9,2012-11-22,Thanksgiving Day 10,2012-12-25,Chris...
# Base node class class Node: """Master node class.""" def __str__(self): return f"{type(self).__name__}"
class md_description: def __init__(self, path, prefix_ref, repetion_number, title_output, total_running): self.path = path self.prefix_ref = prefix_ref self.repetion_number = repetion_number self.title_output = title_output self.total_running = total_running # path where...
class Solution: def minimumTotal(self, triangle: List[List[int]]) -> int: if triangle == []: return 0 for idx in range(1, len(triangle)): row = triangle[idx] prev_row = triangle[idx - 1] row[0] += prev_row[0] row[-1] +...
# -*- coding: utf-8 -*- AMOUNT_INDEX = 0 TYPE_INDEX = 1 RAT_TYPE = 'R' RABBIT_TYPE = 'C' FROG_TYPE = 'S' def main(): n = int(input()) animal_total = 0 rat_total = 0 rabbit_total = 0 frog_total = 0 for i in range(n): input_line = input().split() amount = int(input_line[AMOUNT_...
# # This is a smaller script to just test the servos in the head # Start all services arduino = Runtime.start("arduino","Arduino") jaw = Runtime.start("jaw","Servo") rothead = Runtime.start("RotHead","Servo") leftEyeX = Runtime.start("LeftEyeX","Servo") rightEyeX = Runtime.start("RightEyeX","Servo") eyeY = Runtime.star...
''' Given a string, return a new string made of every other char starting with the first, so "Hello" yields "Hlo". ''' def string_bits(str): return str[0::2] # string_bits('Hello') → 'Hlo' # string_bits('Hi') → 'H' # string_bits('Heeololeo') → 'Hello'
post1 = {"_id": 2, 'name': {'first': 'Dave', 'last': 'Ellis'}, 'contact': {'address': '510 N Division Street, Carson City, MI 48811', 'phone': '(989) 220-8277', 'location': 'Carson City'}, 'position': 'Disciple', 'mentor': 'Seth Roberts', 'status': 'Meeting' #Contacted, Meeting, Interests, Surveys } post2 = {"_...
print ("hello world") print ("hello again") print ("I like typing this.") print("This is fun") print('Yay! Printing.') print ("I'd much rather you 'not'.") print ('I "said" do not touch this.')
# coding=utf-8 class SelectionSort: def find_minimum_idx(self, array: list) -> int: min_element = array[0] min_idx = 0 for idx in range(1, len(array)): if array[idx] < min_element: min_idx = idx min_element = array[idx] return min_idx ...
def part_1(raw_data): raw_data.sort() median = raw_data[len(raw_data)//2] ans = 0 for val in raw_data: ans += abs(val - median) return ans def part_2(raw_data): average = int(round(sum(raw_data) / len(raw_data), 0)) adjusted_average = average - 1 ans = 0 for val in raw_data...
def h(): print('Wen Chuan') m = yield 5 print(m) d = yield 12 print('We are one') c = h() next(c) c.send('Fight') # next(c) def h1(): print('Wen Cha') m = yield 5 print(m) d = yield 12 print('We are together') c = h1() m = next(c) d = c.send('Fighting') print('We will never forg...
test_list = [1, 2, 3, 4, 5, 6, 7] def rotate_by_one_left(array): temp = array[0] for i in range(len(array)-1): array[i] = array[i+1] array[-1] = temp def rotate_list(array, count): print("Rotate list {} by {}".format(array, count)) for i in range(count): # rotate_by_one_left(arra...
__author__ = "Dariusz Izak, Agnieszka Gromadka IBB PAS" __version__ = "1.6.3" __all__ = ["utilities"]
while True: n = int(input()) if n == 0: break for q in range(n): e = str(input()).split() nome = e[0] ano = int(e[1]) dif = int(e[2]) if q == 0: menor = ano - dif ganha = nome if menor > ano - dif: menor = ano - dif ...
n = int(input()) narr = list(map(int,input().split())) mi = narr.index(min(narr)) ma = narr.index(max(narr)) narr[mi] , narr[ma] = narr[ma] , narr[mi] print(*narr)
class Lcg(object): def __init__(self, seed): self.seed = seed self.st = seed def cur(self): return (self.st & 0b1111111111111110000000000000000) >> 16 def adv(self): self.st = (1103515245 * self.st + 12345) % (0b100000000000000000000000000000000) def gen(self): ...
def tournamentWinner(competitions, results): ''' This fuction takes two arrays one of which contains competitions, another array contains results of the competitions and returns a string which is the winning team. This implementation has O(n) time complexity where n is the number of competitions, O(i) space comp...
""" author: Fang Ren (SSRL) 5/1/2017 """
class BlenderAddonManager(): ''' Class to manage all workflows around addon installation and update. ''' def __init__(self): pass def index(self): ''' Indexes all addons and save its metadata into the addon database. ''' pass def poll_remote_...
class Solution(object): def fourSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[List[int]] """ res = set() nums.sort() for i, v in enumerate(nums[:-3]): for j, vv in enumerate(nums[i + 1:-2]): ...
input = """acc +17 acc +37 acc -13 jmp +173 nop +100 acc -7 jmp +447 nop +283 acc +41 acc +32 jmp +1 jmp +585 jmp +1 acc -5 nop +71 acc +49 acc -18 jmp +527 jmp +130 jmp +253 acc +11 acc -11 jmp +390 jmp +597 jmp +1 acc +6 acc +0 jmp +588 acc -17 jmp +277 acc +2 nop +163 jmp +558 acc +38 jmp +369 acc +13 jmp +536 acc +...
""" The Self-Taught Programmer - Chapter 6 Challenges Author: Dante Valentine Date: 1 June, 2021 """ # CHALLENGE 1 for c in "camus": print(c) # CHALLENGE 2 str1 = input("What did you write? ") str2 = input("Who did you send it to? ") str3 = "Yesterday I wrote a {}. I sent it to {}!".format(str1, str2)...
class MyClass: def add(self, a, b): return a + b obj = MyClass() ret = obj.add(3, 4) print(ret)
class Solution: def numUniqueEmails(self, emails: List[str]) -> int: def f(email): (localname, domain) = email.split('@') localname = localname.split('+')[0] localname = localname.replace('.','') return localname + "@" + domain return len(set(...
# count from zero to 10 for i in range(0,10): print (i) print("") # count by 2 for i in range(0,10,2): print(i) print("") # count by 5 start at 50 to 100 for i in range(50,100,5): print(i)
str_btn_prev = "Previous" str_btn_next = "Next" str_btn_download = "Download" str_btn_reset = "Reset Annotation" str_btn_delete_bbox = "Delete Bbox" srt_validation_not_ok = "<b style=\"color:green\">NO ACTION REQUIRED</b>" srt_validation_ok = "<b style=\"color:RED\">ACTION REQUIRED</b>" info_new_ds = "New dataset wit...
# User inputs database = input(f'\nEnter the name of the database you want to create: ') environment = input(f'\nEnter the name of the environment (DTAP) you want to create: ') # Setting variables strdatabase = str(database) strenvironment = str(environment) # Composing the code line10 = ('CREATE ROLE IF NOT EXIST...
# twitter hashtag to find TWITTER_HASHTAG = "#StarWars" # twitter api credentials (https://apps.twitter.com/) TWITTER_CONSUMER_KEY = "" TWITTER_CONSUMER_SECRET = "" TWITTER_ACCESS_TOKEN = "" TWITTER_ACCESS_TOKEN_SECRET = "" # delay in seconds between reading tweets DELAY_TO_READ_TWEET = 30.0
# -*- coding: utf-8 -*- __author__ = 'Michael Odintsov' __email__ = 'templarrrr@gmail.com' __version__ = '0.1.0'
class UnionFind(object): def __init__(self, n): self.parent = list(range(n)) self.rank = [0] * n def find(self, u): if u != self.parent[u]: self.parent[u] = self.find(self.parent[u]) return self.parent[u] def isConnected(self, u, v): return self.find(u) ...
with open('input') as input: lines = input.readlines() number_sequence = lines[0].split(',') board_numbers = [] called_indexes = [] # Flatten data structure for boards for i, line in enumerate(lines): if i == 0: continue if line == '\n': continue stripped_line = line.strip('\n') nu...
"""Longest Collatz sequence The following iterative sequence is defined for the set of positive integers: n -> n/2 (n is even) n -> 3n + 1 (n is odd) Using the rule above and starting with 13, we generate the following sequence: 13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1 It can be seen that this sequence ...
class AchievementDigest(object): ID = 0 SERIAL_NUM_READS = "c1" SERIAL_NUM_PUBLISH = "c2" SERIAL_NUM_REUSES = "c3" SERIAL_LAST_READS = "u1" SERIAL_LAST_PUBLISH = "u2" SERIAL_LAST_REUSES = "u3" def __init__(self): self.num_reads = 0 self.num_publish = 0 self.nu...
# Found here: # https://github.com/gabtremblay/pysrec/ # srecutils.py # # Copyright (C) 2011 Gabriel Tremblay - initnull hat gmail.com # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either v...
# @Title: 最短无序连续子数组 (Shortest Unsorted Continuous Subarray) # @Author: KivenC # @Date: 2018-07-17 16:11:42 # @Runtime: 128 ms # @Memory: N/A class Solution(object): def findUnsortedSubarray(self, nums): """ :type nums: List[int] :rtype: int """ left_index, right_index = 0, ...
ten_things = "Apples Oranges Crows Telephone Light Sugar" print ("Wait there's not 10 things in that list, let's fix that.") stuff = ten_things.split(' ') more_stuff = ["Day", "Night", "Song", "Frisbee", "Corn", "Banana", "Girl", "Boy"] while len(stuff) != 10: next_one = more_stuff.pop() print ("Adding: "...
# "Common block" loaded by the cfi and the cfg to communicate egmID parameters electronVetoId = 'egmGsfElectronIDs:cutBasedElectronID-Summer16-80X-V1-veto' electronLooseId = 'egmGsfElectronIDs:cutBasedElectronID-Summer16-80X-V1-loose' electronMediumId = 'egmGsfElectronIDs:cutBasedElectronID-Summer16-80X-V1-medium' ele...
#!/usr/bin/env python # @file levenshtein.py # @author Michael Foukarakis # @version 0.1 # @date Created: Thu Oct 16, 2014 10:57 EEST # Last Update: Thu Oct 16, 2014 11:01 EEST #------------------------------------------------------------------------ # Description: Levenshtein st...
class Plugin(object): def __init__(self, myarg): self.myarg = myarg def do_it(self): print("doing it with myarg={} inside plugin1".format(self.myarg))
load("//:packages.bzl", "CDK_PACKAGES") # Base rollup globals for dependencies and the root entry-point. CDK_ROLLUP_GLOBALS = { 'tslib': 'tslib', '@angular/cdk': 'ng.cdk', } # Rollup globals for subpackages in the form of, e.g., {"@angular/cdk/table": "ng.cdk.table"} CDK_ROLLUP_GLOBALS.update({ "@angular/cdk/%s...
balance = 1000 pin = input("Ustaw swój 4 cyfrowy pin: ") while len(pin) != 4: print("PIN nie jest 4 cyfrowy, proszę podać jeszcze raz") pin = input("Ustaw swój 4 cyfrowy pin: ") pin = int(pin) def check_pin(): security = int(input("Wprowadź swój PIN: ")) while security != pin: print("Zły nume...
# https://leetcode.com/problems/peeking-iterator/ class PeekingIterator: def __init__(self, iterator): """ Initialize your data structure here. :type iterator: Iterator """ self.iterator = iterator self.seen = deque() def peek(self...
res = client.get_smtp_servers() # The SMTP properties are related to alert routing print(res) if type(res) == pypureclient.responses.ValidResponse: print(list(res.items)) # Valid fields: continuation_token, filter, ids, limit, names, offset, sort # See section "Common Fields" for examples
mimic_tables_dir = './mimic_tables/' # location of the metadata tables of the mimic-cxr dataset. Inside this folder:'mimic-cxr-2.0.0-chexpert.csv' and 'mimic-cxr-2.0.0-split.csv' jpg_path = './dataset_mimic_jpg/' # location of the full mimic-cxr-jpg dataset. Inside this folder: "physionet.org" folder dicom_path = './...
{ 'name': "odoo_view_advanced", 'summary': "Advanced concepts about views", 'description': "Advanced concepts about views...", 'author': "Stiven Ramírez Arango", 'website': "https://stivenramireza.com//", 'category': 'Uncategorized', 'version': '0.1', 'depends': ['base'], 'data': [ ...
class SpriteHandler: """draws the sprites for all objects with updated position, rotation and scale each draw step""" def __init__(self): self.sprite_scale_factor = 0.03750000000000002 self.rotation_factor = 0.0000000 self.debug_draw = 1 def toggle_debug_draw(self): sel...
""" [easy] challenge #14 Source / Reddit Post - https://www.reddit.com/r/dailyprogrammer/comments/q2v2k/2232012_challenge_14_easy/ """ a = [1, 2, 3, 4, 5, 6, 7, 8] k = 2 print([x for i in range(0, len(a), k) for x in a[i:i+k][::-1]])
class bufferPair: # a ping-pong buffer for gpu computation def __init__(self, cur, nxt): self.cur = cur self.nxt = nxt def swap(self): self.cur, self.nxt = self.nxt, self.cur class MultiBufferPair: """ Specifically designed for FaceGrid """ def __init__(self, cur...
"""Factories for the mobileapps_store app.""" # import factory # from ..models import YourModel
class GCode(object): def comment(self): return "" def __str__(self) -> str: return f"{self.code()}{self.comment()}" class G0(GCode): def __init__(self, x=None, y=None, z=None) -> None: if (x is None and y is None and z is None): raise TypeError("G0 needs at least one axis") self.x = x ...
class ListNode: def __init__(self, data): self.data= data self.next= None class Solution: def delete_nth_from_last(self, head: ListNode, n: int) -> ListNode: ans= ListNode(0) ans.next= head first= ans second= ans for i in range(1, n+2): ...
#functions with output def format_name(f_name, l_name): if f_name == '' or l_name == '': return "You didn't privide valid inputs" formated_f_name = f_name.title() formated_l_name = l_name.title() #print(f'{formated_f_name} {formated_l_name}') return f'{formated_f_name} {formated_l_name}' #formated_string = fo...
marks=[] passed=[] fail=[] s1=int(input("what did you score?")) marks.append(s1) s2=int(input("what did you score?")) marks.append(s2) s3=int(input("what did you score?")) marks.append(s3) s4=int(input("what did you score?")) marks.append(s4) s5=int(input("what did you score?")) marks.append(s5) s6=int(input("wha...
def Sum(value1, value2=200, value3=300): return value1 + value2 + value3 print(Sum(10)) print(Sum(10, 20)) print(Sum(10, 20, 30)) print(Sum(10, value2=20)) print(Sum(10, value3=30)) print(Sum(10, value2=20, value3=30))
liste = [] entiers = 0 somme = 0 isZero = False while not isZero: number = float(input("Entrez un nombre: ")) if number == 0: isZero = True elif number - int(number) == 0: entiers += 1 somme += number liste += [number] print("Liste:", liste) print("Nombre d'entiers:", entiers) print("S...
# lis = [x*x for x in range(10)] # print(lis) # #生成器 # generator_ex = (x*x for x in range(10)) # print(generator_ex) # generator_ex = (x*x for x in range(10)) # print(next(generator_ex)) # print(next(generator_ex)) # print(next(generator_ex)) # print(next(generator_ex)) # print(next(generator_ex)) # print(next(generat...
# -*- coding:utf-8 -*- # author: lyl def get_age(): age = 18 name = 'Alex' return age print()
#!/usr/bin/env python3 pwd=os.walk(os.getcwd()) for a,b,c in pwd: for i in c: if re.search('.*\.txt$',i): file_FullPath=os.path.join(a,i) file_open=open(file_FullPath,'r',encoding='gbk') file_read=file_open.read() file_open.close() file_write=open...
class Australia(): state_dict = {"NSW": "New South Wales", "V": "Victoria", "Q": "Queensland", "SA": "South Australia", "WA": "Western Australia", "T": "Tasmania", "NT": "Northern Territory", "ACT": "Australian Capital Territory"} constraints = {"NSW": ["V", "Q", "SA", "ACT"...
""" Copyright (c) 2018, Ankit R Gadiya BSD 3-Clause License Project Euler Problem 1: Multiples of 3 and 5 Q. If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. """ def sumAP(...
# -*- coding: utf-8 -*- """ Created on Wed Feb 1 23:41:54 2017 @author: Roberto Piga Version 1 Recursive method Failed because test parser can not call a function """ # define starting variables balance = a = 5000 annualInterestRate = b = 0.18 monthlyPaymentRate = c = 0.02 month = m = 0 def balancer...
class ValidationError(Exception): def __init__(self, message): super().__init__(message) class FieldError(Exception): def __init__(self, field_name, available_fields): msg = (f"The field '{field_name}' is not present on your model. " f"Available fields are: {', '.join(available_fields)...
a = int(input()) if a > 0: print(1) elif a== 0: print(0) else: print(-1)
txhash = "0xb538eabb6cea1fc3af58f1474c2b8f1adbf36a209ec8dc5534618b1f2d860c8e" version = "1.1.0" network = "ropsten" address = 'bc1qzse3hm25w3nx70e8nlss6nlfusj7wd4q3m8gax' transaction_data = { 'txid': '6cc808a28150482f783fdff7c99a6245a59437f55bb85575aa31c99ab2b0898b', 'hash': '6cc808a28150482f783fdff7c99a6245...
class CognitiveAbilitiesGroupingPolicy: @staticmethod def group(filename: str) -> str: return filename.split(".")[0].split("-")[0]
n=int(input());s=input();r=0;l=len(s) for i in range(l): r+=(ord(s[i])-ord('a')+1)*31**i print(r%1234567891)
# Aula 21 - 09-12-2019 # Como Tratar e Trabalhar Erros!!! # Com base no seguinte dado bruto: dadobruto = '1;Arnaldo;23;m;alexcabeludo2@hotmail.com;014908648117' # 1) Faça uma classe cliente que receba como parametro o dado bruto. # 2) A classe deve iniciar (__init__) guardando o dado bruto nume variável chamada self...
#!/usr/bin/env python3 def edit_distance(s1: str, s2: str) -> int: n = len(s1) m = len(s2) edit = [[None for i in range(1 + m)] for j in range(1 + n)] for i in range(1 + m): edit[0][i] = i for i in range(1, 1 + n): edit[i][0] = i for j in range(1, 1 + m): replace...
class Rtm: def __init__(self): # As próximas 3 variáveis servem apenas para checagem self.states = [] self.input_alphabet = [] self.output_alphabet = [] self.tapes = { 'input': [], 'history': [], 'output': [] } ...
FILTERS = [ [4, 1, 2], [2, 2, 4], [1, 4, 4], [1, 4, 1] ] MSG_LEN = 16 KEY_LEN = 16 BATCH_SIZE = 512 NUM_EPOCHS = 60 LEARNING_RATE = 0.0008
def metade(preco=0, formato=False): res = preco / 2 return res if formato is False else moeda(res) def dobro(preco=0, formato=False): res = preco * 2 return res if formato is False else moeda(res) def aumento(preco=0, taxa=0, formato=False): res = preco * (1 + taxa/100) return res if formato...
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...