content
stringlengths
7
1.05M
reporting_jurisdiction = [ 'AL', 'AK', 'AR', 'AZ', 'CA', 'CI', 'CO', 'MP', 'CT', 'DE', 'DC', 'FM', 'FL', 'GA', 'GU', 'HI', 'HO', 'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LC', 'LA', 'ME', 'MD', 'MA', 'MI', ...
#!/usr/bin/env python # http://flask.pocoo.org/docs/config/#development-production class Config(object): SECRET_KEY = 'bzNsEap7HGJeOGzAxhNlQCtaRpccRZHgWaOncxAKpCJovJgJbN' SITE_NAME = 'profiler' MEMCACHED_SERVERS = ['localhost:11211'] SYS_ADMINS = ['foo@example.com'] class ProductionConfig(Config): ...
local = list(input('Introduza os nomes das equipas da casa separados entre espaços: ').split()) golos = list(map(int, input('Introduza os golos marcados em cada jornada separados entre espaços: ').split())) loop = True while loop: for i in golos: if i < 0: print('Os golos marcados devem ser núme...
# coding: utf-8 # Try POH # author: Leonarodne @ NEETSDKASU ############################################## def gs(*_): return input().strip() def gi(*_): return int(gs()) def gss(*_): return gs().split() def gis(*_): return list(map(int, gss())) def nmapf(n,f): return list(map(f, range(n))) def ngs(n): return nmapf...
class Point(): # each method has at least self argument def getX(self): return self.x # Create instances of class Point point1 = Point() point2 = Point() print(point1) print(point2) print(point1 is point2) point1.x = 5 point2.x = 10 print(point1.getX()) print(point2.getX())
""" Ryan Kirkbride - Love coding weird noises to dance to: https://www.youtube.com/watch?v=Qc_8Pm2t-84 How to: - Run the statements line by line (alt+enter), go to the next one whenever you feel like - The "#### > run block <" blocks should be executed atomically (ctrl+enter) - If you want to fast-...
# 문제 번호: 13866 문제 이름: 팀 나누기 # 문제 최초 시도: 2019_04_09 # 문제 풀이 완료: 2019_04_09 # 이 코드의 접근법: 구현 Min=987654321 A,B,C,D=map(int,input().split()) if(abs(A+B-C-D)<Min): Min=abs(A+B-C-D) if(abs(A+C-B-D)<Min): Min=abs(A+C-B-D) if(abs(A+D-B-C)<Min): Min=abs(A+D-B-C) print(Min)
# ham cho do dai day con dai nhat thoa man A[i] = A[i-1] + A[i-2] def maxSubLens(A, N): pass N = int(input()) A = [int(item) for item in input().split()] print(len(A))
def getTotalX(a, b): limMax = min(b) #maximum limit limMin = max(a) #minimum limit sizeA = len(a) sizeB = len(b) nums = [] result = 0 aux = limMin while (aux <= limMax): for j in range(0,sizeA): if (j == sizeA - 1) and (aux % a[j] == 0): nums.append(aux) break if aux % a...
""" Custom exceptions for dealing with responses from the TAP server """ __all__ = ["TAPQueryException", "TAPUploadException"] class TAPQueryException(Exception): def __init__(self, response, message=None): # Try parsing out an error message. if message is None: try: ...
opt = { "optimizer": { "type": "Adam", "kwargs": { "lr": 0.001, }, }, "learning_rate_decay": { "type": "", "kwargs": {}, }, "gradient_clip": { "type": "", "kwargs": {}, }, "gradient_noise_scale": None, "name": None, }
array = [7,5,9,0,3,1,6,2,4,8] def quick_sort(array): if len(array) <= 1: return array pivot = array[0] tail = array[1:] #pivot보다 작은 값은 left_side로, 큰 값은 right_side로 나눔 left_side = [x for x in tail if x <= pivot] right_side = [x for x in tail if x > pivot] #left_side와 right_side를 각...
# hw02_07 money = int(input('請輸入存款金額:(整數)')) print('') yrate = float(input('請輸入年利率:(浮點數)')) # 書上有錯,這裡要填0.1,而不是10 print('') y = int(input('請輸入存款年數:(整數)')) print('單利:%d元%d年的本利和=%12.1f' % (money, y, money + money * yrate * y)) print('複利:%d元%d年的本利和=%12.1f' % (money, y, money * ((1 + yrate) ** y))) ''' 請輸入存款金額:(整數)20000 ...
class Protocol(object): def __str__(self): _str = '<================ Constants information ================>\n' for name, value in self.__dict__.items(): print(name, value) _str += '\t{}\t{}\n'.format(name, value) return _str def __len__(self): raise No...
class FastTextModel(object): def __init__(self, word_index, raw_word_vectors): pass def save_to_word2vec_format(self, word_vectors, output_path): pass
sexo = str(input('Digite o seu sexo [M/F]: ').strip().upper()[0]) while sexo != 'M' and sexo != 'F': print('''\033[1;31mAlerta! Você não digitou nenhuma das opções. Tente novamente.\033[m''') sexo = input('Digite o seu sexo [M/F]: ').strip().upper() if sexo == 'M': sexo = '\033[1;35mMasculino\033[m' elif se...
# Desenvolva um programa que leia as duas notas de um aluno, calcule e mostre a sua média. n1 = float(input('Digite a sua nota da prova 1:')) n2 = float(input('Digite a sua nota da sua prova 2:')) m = (n1 + n2) / 2 print('A sua média entre as duas notas equivale a {:.2f}'.format(m)) if m > 6:print('Está aprovado, boas ...
class PhoneDirectory: def __init__(self, maxNumbers): self.nums = set(range(maxNumbers)) def get(self): return self.nums.pop() if self.nums else -1 def check(self, number): return number in self.nums def release(self, number): self.nums.add(number)
#!/usr/bin/env python class TestMyModule: ''' ``Test`` prefix ''' def test_f(self): ''' ``test_`` prefix ''' pass
tests = ( 'parse_token', 'variable_fields', 'template', 'loaders', 'filters', 'default_filters', 'blockextend', 'default_tags', )
standardRnaToProtein = { 'UUU':'F', 'UUC':'F', 'UCU':'S', 'UCC':'S', 'UAU':'Y', 'UAC':'Y', 'UGU':'C', 'UGC':'C', 'UUA':'L', 'UCA':'S', 'UAA':'*', 'UGA':'*', 'UUG':'L', 'UCG':'S', 'UAG':'*', 'UGG':'W', 'CUU':'L', 'CUC':'L', 'CCU':'P', 'CCC':'P', 'CAU':'H', ...
class Field(object): def __init__(self, default=None, null: bool = False): self.default = default self.null = null self.section = None self.name = None self.value = None self.meta = None def __get__(self, instance, owner): value = self.meta.connector.get...
#!/usr/bin/env python3 w, h = 12, 4 matrix = [[0 for iw in range(w)] for ih in range(h)] base_row = [] print("Grund-Zwölftonreihe eingeben") for i in range(12): base_row.append(int(input("\n {0}: ".format(i)))) print(base_row) for i in range(12): matrix[i][0] = 12 - matrix[0][i] print(matrix)
# simple_assignment.py # THIS FILE IS AUTOMATICALLY GENERATED FROM comments.pil. # DO NOT EDIT! foo = 5 print(foo)
NEO4J_TEST_CONNECTION = """MATCH (n) RETURN count(n) as count""" # create NEO4J_CREATE_DOCUMENT_NODE_RETURN_ID = """ CYPHER 3.4 CREATE (node { }) RETURN ID(node) as ID""" NEO4J_CREATE_NODE_SET_PART = "SET node.`{attr_name}` = {{`{attr_name}`}}" NEO4J_CREATE_NODE_SET_PART_MERGE_ATTR = "SET node.`{attr_name}` = (CASE WH...
# -*- coding: utf-8 -*- """ Utilities for generating ring crossings. """ def generate_crossings(points, n_rings): """ Generate a rings crossing dictionary from crossings points. :param list points: Points is a list of rings from 0 to N-1. Each list specifies the LED number of eac...
# GENERATED VERSION FILE # TIME: Thu Aug 6 08:41:19 2020 __version__ = '0.7.rc1+82bf68a' short_version = '0.7.rc1' mmskl_home = r'/home/wing_mac/action_recognition/mmskeleton'
class SqlError(Exception): def __init__(self, message="Salary != in (5000, 15000) range"): self.message = message super().__init__(self.message)
# vat.py price = 100 # GBP, no VAT final_price1 = price * 1.2 final_price2 = price + price / 5.0 final_price3 = price * (100 + 20) / 100.0 final_price4 = price + price * 0.2 if __name__ == "__main__": for var, value in sorted(vars().items()): if 'price' in var: print(var, value)
# -*- coding: UTF-8 -*- # config.py にコピーして使用する CONFIG = { "baseUrl": "http://api.example.com/api", "tenantId": "", "appId": "", "appKey": "", "proxy": { "type": "http", "host": "proxygate2.nic.nec.co.jp:8080" } }
def hash_get_func(name, key, redisConnect): result =redisConnect.hget(name, key) return result def hash_set_func(name, key, value,redisConnect): result =redisConnect.hset(name, key,value) return result def hash_mget_func(name, L_key, redisConnect): result =redisConnect.hmget(name, L_key) retur...
class Solution: def numberOfMatches(self, n: int) -> int: count = 0 while n >= 2: count += n // 2 print(count) if n % 2: n = n // 2 + 1 else: n = n // 2 return count
"""This module contains the set of Ostorlab exceptions.""" class OstorlabError(Exception): """Ostorlab base error that all the exceptions inherit from."""
#!/usr/bin/env python class HmiMessage(object): def __init__(self): pass class CloseMessage(HmiMessage): def __init__(self): super(CloseMessage, self).__init__() class HmiModbusMessage(HmiMessage): def __init__(self, ip, mb_table): super(HmiModbusMessage, self).__init__() ...
N = int(input()) G = [int(x) for x in input().split()] trueG = list(range(N)) for i in range(N): for j in range(N): G[j] = (G[j] + (-1 if j % 2 else 1)) % N if G == trueG: print('Yes') break else: print('No')
class APIException(Exception): def __init__(self): self.message = '!200 response from api' class OpenConvException(Exception): def __init__(self): self.message = 'Error while opening conv non 200 response' class OpenConvServerException(Exception): def __init__(self): self.message...
class Inference(object): def __init__(self, file_path, file_name, class_name, class_function, variable_name, variable_type, inference_variable_path, is_external_package = False, line_no = 0): self.file_path = file_path self.file_name = file_name self.class_name = class_name self.cla...
name = input('Введите имя: ') id = int(input('Введите номер заказа: ')) result = 'Здравствуйте {0}, ваш номер заказа: {1}, спасибо за покупку!!'.format(name, id) print(result)
n = list(map(int, input().split())) if (n[1] % 2 == 0): print("possible") else: print("impossible")
# vim: fileencoding=utf-8 a = """bbbbbb aaaaaaaaaa """ b = '''aaaaa dfdfd3''' print(a) print('--------------') print(b) print('=================') print(str(1)) print(int('1')) print('=================') print('3' in b) print('=================') m1 = 'I am {}'.format('Yujiii') print(m1) m2 = '{2}-{2} {0} {...
''' In a binary tree, the root node is at depth 0, and children of each depth k node are at depth k+1. Two nodes of a binary tree are cousins if they have the same depth, but have different parents. We are given the root of a binary tree with unique values, and the values x and y of two different nodes in the tree. ...
""" Model parameters. """ sys_params = { 'food_growth_rate': [3], 'maximum_food_per_site': [10], 'reproduction_probability': [1.0], 'agent_lifespan': [35], 'reproduction_food_threshold': [6], # When the agents start reproducing 'hunger_threshold': [15], # When the agents start eating 'repro...
# The arduino accepts commands in 1/10 millimeters UNIT = 10 class Line: def __init__(self, x1, y1, x2, y2): self.x1 = float(x1) self.y1 = float(y1) self.x2 = float(x2) self.y2 = float(y2) def __eq__(self, other): return isinstance(other, self.__class__) \ a...
def check_and_apply(queue, rule): r = rule[0].split() l = len(r) if len(queue) >= l: t = queue[-l:] if list(zip(*t)[0]) == r: new_t = rule[1](list(zip(*t)[1])) del queue[-l:] queue.extend(new_t) return True return False rules = [] # k, ...
_base_ = [ '../_base_/models/faster_rcnn_r50_fpn.py', '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_3x.py', '../_base_/default_runtime.py' ] ''' model = dict( neck=dict( type='PAFPN', in_channels=[256, 512, 1024, 2048], out_channels=256, num_outs...
class Parser: def parse(self, string): """ Returns a dictionary which has a structure like this: - com - arg1 - arg2 ... -argN """ parsedString = {} strArr = string.split() parsedString['com'] = strArr[0] ...
""" What? Simplest unit check (as opposed to integration checks) Keep in mind that python sum function accepts any iterables. Reference: https://realpython.com/python-testing/ """ def test_sum_list(): assert sum([1, 2, 3]) == 6, "Should be 6" def test_sum_tuple(): assert sum((1, 2, 2)) == 5, "Should be 6" ...
""" EOS CLI syntax changes """ CLI_SYNTAX = { # Default CLI syntax version # We do trandlation from 4.23.0 syntax to pre-4.23.0 syntax 1: { "aaa authorization serial-console": "aaa authorization console", "area not-so-stubby lsa type-7 convert type-5": "area nssa translate type7 always", ...
# Copyright (c) 2016-2017 Dustin Doloff # Licensed under Apache License v2.0 load( "@bazel_toolbox//actions:actions.bzl", "generate_templated_file", ) load( "@bazel_toolbox//labels:labels.bzl", "executable_label", ) def _generate_deploy_site_zip_s3_script(ctx): ctx.actions.run( mnemonic = ...
# Projeto: VemPython/exe009 # Autor: rafael # Data: 13/03/18 - 17:02 # Objetivo: TODO Faça um programa que leia um numero inteiro qualquer e mostre na tela a sua tabuada pr = int(input('Informe o valor da tabuada: ')) print('{} x 01 = {}\n' '{} x 02 = {}\n' '{} x 03 = {}\n' '{} x 04 = {}\n' '{}...
__all__ = ['__version__', '__author__', '__email__'] __version__ = '1.0.1' __author__ = 'Axel Juraske' __email__ = 'axel.juraske@short-report.de'
""" #DEFUNCT TROPO TEST response.view="generic.json" def index(): return( dict( tropo=[{"say":{"value":"Welcome to the Biddrive dot com call center. Testing pronunciation. Hello Neal, Paul, Zaki, Barret, Rob, Christy, and Himel."}}] ) ) def result(): return( dict( tropo=[{"hangup":{"value":"...
# Crie um programa que leia quanto dinheiro uma pessoa tem na carteira e # mostre quantos Dólares ele pode comprar. reais = float(input('Quantos reais (R$) você tem? ')) print('US$1.00 = R$ 5,67 | 26/12/2021') conv = reais/5.67 print('Você pode comprar US${:.2f} com R${}'.format(conv, reais))
CFNoQuitButton=256 CFPageButton=16 CFQuicktalker=4 CFQuitButton=32 CFReversed=64 CFSndOpenchat=128 CFSpeech=1 CFThought=2 CFTimeout=8 CCNormal = 0 CCNonPlayer = 1 CCSuit = 2 CCToonBuilding = 3 CCSuitBuilding = 4 CCHouseBuilding = 5 CCSpeedChat = 6 NAMETAG_COLORS = { CCNormal: ( # Normal FG ...
""" File: largest_digit.py Name: ---------------------------------- This file recursively prints the biggest digit in 5 different integers, 12345, 281, 6, -111, -9453 If your implementation is correct, you should see 5, 8, 6, 1, 9 on Console. """ def main(): print(find_largest_digit(12345)) # 5 print(find_larg...
def main(): n,k = map(int,input().split()) answer = [1 for _ in range(n)] for _ in range(k): d = int(input()) a = list(map(int,input().split())) for i in range(d): answer[a[i]-1] = 0 print(sum(answer)) if __name__ == "__main__": main()
# ex:ts=4:sw=4:sts=4:et # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- # # Copyright (C) 2006 - 2007 Michael 'Mickey' Lauer # Copyright (C) 2006 - 2007 Richard Purdie # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License versi...
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # @param {ListNode} head # @param {integer} val # @return {ListNode} def removeElements(self, head, val): node = head last = None ...
'''https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/ 105. Construct Binary Tree from Preorder and Inorder Traversal Medium 6751 171 Add to List Share Given two integer arrays preorder and inorder where preorder is the preorder traversal of a binary tree and inorder is the inor...
template = { 'template_type': 'attachment', 'value': { 'attachment': { 'type': 'file', 'payload': { 'url': '' } } } } class AttachmentTemplate: def __init__(self, url='', type='file'): self.template = template['value'] ...
"""This problem was asked by Microsoft. Given a string and a pattern, find the starting indices of all occurrences of the pattern in the string. For example, given the string "abracadabra" and the pattern "abr", you should return [0, 7]. """
class _Regex: def __init__(self, s: str): self.s = s def __eq__(self, x): if self.s == None and x.s == None: return True if self.s == None: return False if x.s == None: return False return self.s == x.s def __add__(self, x): ...
#!/usr/bin/env python # -*- encoding: utf-8 -*- __author__ = 'andyguo' DAYU_DB_ROOT_FOLDER_NAME = '.!0x5f3759df_this_is_a_magic_number_used_for_telling_which_atom_is_the_root' DAYU_DB_NAME = 'DAYU_DB_NAME' DAYU_APP_NAME = 'DAYU_APP_NAME' DAYU_CONFIG_STATIC_PATH = 'DAYU_CONFIG_STATIC_PATH'
a=10 #Normal initialization of object to variable a def global_var(): global a #declaring that a variable as a global variable here to access or use that a here a=a+1 # calculation print(a) global_var() #calling the function """ output become 11 """ """ Global variables for Nested functions """ def func_...
""" `minion-ci` is a minimalist, decentralized, flexible Continuous Integration Server for hackers. This module contains the exceptions specific to `minion` errors. :copyright: (c) by Timo Furrer :license: MIT, see LICENSE for details """ class MinionError(Exception): """Exception which is raised...
def tag_bloco(conteudo, classe='sucesso', inline=False): tag = 'span' if inline else 'div' return f'<{tag} class="{classe}">{conteudo}</{tag}>' def tag_lista(*itens): lista = ''.join(f'<li>{item}</li>' for item in itens) return f'<ul>{lista}</ul>' if __name__ == '__main__': print(tag_bloco('TEXT...
""" FDS Assignment 2 Group A Name: Shamik S Ghadge Roll no.: SECOA159 Problem Statement: Write a Python program to store marks scored in subject “Fundamental of Data Structure” by N students in the class. Write functions to compute following:...
lista = [1, 10] arquivo = open('teste.txt', 'r') try: texto = arquivo.read() divisao = 10 / 1 numero = lista[1] except ZeroDivisionError: print('Não é possivel realizar a divisão por 0') except ArithmeticError: print('Houve um erro ao realizar uma operação aritimetica.') except IndexError: pr...
# Errors from Identity Provider translates into these errors codes # as an internal abstraction over OpenID Connect errors. OIDC_ERROR_CODES = { 'E0': 'Unknown error from Identity Provider', 'E1': 'User interrupted', 'E3': 'User failed to verify SSN', 'E4': 'User declined terms', # Happens if an...
# bubble sort # https://www.w3resource.com/python-exercises/data-structures-and-algorithms/python-search-and-sorting-exercise-4.php # # 时间复杂度: 最优时间复杂度O(n) 当遍历一次的时候发现没有任何元素交换,说明已经是按大小有序的,排序结束 # 最坏时间复杂度O(n^2) # 平均时间复杂度O(n^2) # 稳定性:稳定 # 不需要额外空间 def bubble_sort(alist): ...
z=10 w=-10 while(z<50): if (z>0 and w<0): print(z**2, w**3) z = z+10 w=w+10 # 100 -1000
""" Krema part for Perms, Types, Intents etc... """ class ChannelTypes: """All Channel types in this class.""" GUILD_TEXT: int = 0 # a text channel within a server DM: int = 1 # a direct message between users GUILD_VOICE: int = 2 # a voice channel within a server GROUP_DM: int = 3 # a direct ...
def downheap(i, size): while 2 * i <= size: k = 2 * i if k < size and a[k] < a[k + 1]: k += 1 if a[i] >= a[k]: break a[i], a[k] = a[k], a[i] i = k def create_heap(a): hsize = len(a) - 1 for i in reversed(range(1, hsize // 2 + 1)): dow...
x = int(input('Digite primeiro numero: ')) y = int(input('Digite segundo numero: ')) if x > y : print('Primeiro numero e maior que o segundo!!!!') elif x == y : print('Os dois numeros sao iguais!!!!') else: print('Segundo numero e maior que o primeiro!!!!')
# # @lc app=leetcode id=47 lang=python3 # # [47] Permutations II # # @lc code=start class Solution: def permuteUnique(self, nums: List[int]) -> List[List[int]]: if len(nums) == 1: return [nums] last_num = nums[-1] pre_nums = nums[:-1] permutations = [] pre_per...
#!/usr/bin/python3 # -*- coding: utf-8 -*- dosya=open("lagrange.txt") degerler = [] for line in dosya.readlines(): line = line.rstrip('\n').split(' ') degerler.append(line) dosya.close() x = int(input("hangi değerin hesaplanmasını istiyorsunuz: ")) boyut = len(line) boyut2 = len(degerler) sonuc,sonuc1, gen...
# Project Euler Problem 0001 # Multiples of 3 and 5 # 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. # NOTES: # - natural numbers: -2, -1, 0, 1, 2, ... # Answer: 233168 lower_...
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None def insert(root, x): if x < root.val: if root.left is None: root.left = TreeNode(x) else: insert(root.left, x) elif x > root.val: if root.ri...
# -*- coding: utf-8 -*- """ mudicom.exceptions ~~~~~~~~~~~~~~~~~~ Module for package specific exceptions """ class InvalidDicom(IOError): """ A DICOM file must have the correct tag to be validated as a DICOM file. Read the DICOM standard for more information. """ pass
""" Exemplo de um módulo python. Contém uma variável chamada minha_variavel, uma função chamada minha_funcao e uma classe chamada MinhaClasse. """ minha_variavel = 0 def minha_funcao(): """ Função examplo """ return minha_variavel class MinhaClasse: """ Classe exemplo. """ def __...
############################################################################### ## Laboratorio de Engenharia de Computadores (LECOM) ## ## Departamento de Ciencia da Computacao (DCC) ## ## Universidade Federal de Minas Gerais (UFMG) ## ...
def getName(): return "html" def output(state,information): categories = information.listCategories() selections = state.selected toSave = "" toSave += """ <html> <head> </head> <body> \n """ firstOne = True for category in categories: found = 0 for select...
""" TLS Lite is a free python library that implements SSL v3, TLS v1, and TLS v1.1. TLS Lite supports non-traditional authentication methods such as SRP, shared keys, and cryptoIDs, in addition to X.509 certificates. TLS Lite is pure python, however it can access OpenSSL, cryptlib, pycrypto, and GMPY for faster crypt...
class Solution: def customSortString(self, order: str, str: str) -> str: output = "" strList = list(str) for i in order: cnt = strList.count(i) strList = [c for c in strList if c != i] output += i * cnt return output + "".join(strList)
def rot13_encrypt(text: str) -> str: if type(text) is not str: return False encrypted_text = "" for letter in text.lower(): ascii_code = ord(letter) if ascii_code > 109: # 122 (z) - 13 encrypted_text += chr(ascii_code + 13 - 26) # 26 - ilość liter w ang. else: ...
print("\n") print("****************************************************") print("|--------------------- PyPong ---------------------|") print("| |") print("| By WMouton | l33th |") print("| Profession: Web Development & Linux Security ...
def pseudo_sort(st): lowerCaseWords = [] pass
class DataStore: def __init__(self, data): self.data = { "image": data["image"], "name": data["name"], "id": data["image"]["full"].split(".")[0], } def setImageUrl(self, imageUrl): self.imageUrl = imageUrl @property def image(self): r...
class Distance: kilometers = 0.0 minutes = 0.0 def __init__(self, kilometers, minutes): self.kilometers = kilometers self.minutes = minutes def toJson(self): return { "kilometers" : self.kilometers, "minutes" : self.minutes }
# problem 8 # Project Euler def productOfNumbers(string,start,LENGTH): adjNumber = string[start:start+LENGTH] product = 1 for n in adjNumber: product *= int(n) return product def adjacentNumbers(string): LENGTH = 13 currentMaxProduct = -1 currentMaxIndex = -1 for i,e in enumerate(string): product = produc...
# coding=utf-8 """ Created by jayvee on 2017/6/9. https://github.com/JayveeHe """
#!/usr/bin/env python # -*- coding: utf-8 -*- ######################################################################### # Author: jonyqin # Created Time: Thu 11 Sep 2014 01:53:58 PM CST # File Name: ierror.py # Description:定义错误码含义 ######################################################################### WXBizMs...
name = input("Enter your name: ") if name == "Arya Stark": print("Valar Morghulis") elif name == "Jon Snow": print("You know nothing!") else: print("Carry On!")
# Find the longest Palindromic Substring # Asked in Amazon ,MakeMyTrip, Microsoft, Qualcomm, Visa # Difficulty -> Medium # Algorithm: # We observe that a palindrome mirrors around its center. Therefore, a palindrome can be expanded from its center, and # there are only 2n - 1 such centers. You might be asking why th...
km = int(input('A quantos km/h o veículo cruzou o radar?')) if km > 80: m = float(km-80)*7 print('O veículo está acima do limite permitido, a multa é de :R${}'.format(m)) else: print('O veículo está dentro do limite permitido!')
expected_output = { "process_id": { 65109: { "router_id": "10.4.1.1", "ospf_object": { "Process ID (65109)": { "ipfrr_enabled": "no", "sr_enabled": "yes", "ti_lfa_configured": "yes", "ti_l...
# # PySNMP MIB module NBS-VLAN-FWD-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NBS-VLAN-FWD-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:17:48 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
class has_many: def __init__(self, name, _class, primary_key=None, foreign_key=None): self.name = name self._class = _class self.primary_key = primary_key self.foreign_key = foreign_key class belongs_to: def __init__(self, name, _class, primary_key=None, foreign_key=None): ...
''' UBC Eye Movement Data Analysis Toolkit (EMDAT), Version 3 '''
setup( name='pyroll', description='cli for simulating the rolling of dice', author='Philip Z Nevill', author_email='pznevill.dev@gmail.com', version='0.1.0', packages=find_packages(include=['pyroll', 'pyroll.*']), )