content
stringlengths
7
1.05M
#!/usr/bin/python # tuple_one.py print ((3 + 7)) print ((3 + 7, ))
# -*- coding: utf-8 -*- """ Created on Sun Jan 6 23:48:22 2019 gnomesort example from Python Algorithms by Magnus Lie Hetland """ def gnomesort(seq): i =0 while i < len(seq): if i == 0 or seq[i-1] <= seq[i]: i += 1 else: seq[i], seq[i-1] = seq[i-1], seq[i...
""" :testcase_name factorial :author Sriteja Kummita :script_type Class :description Class, RecursiveFactorial contains a function that calculates factorial of a given number recursively """ class RecursiveFactorial: def factorial(self, n): if n <= 1: return 1 return n * self.factorial...
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # 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 appli...
def extractRrrrhexiatranslationHomeBlog(item): ''' Parser for 'rrrrhexiatranslation.home.blog' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('Flower', 'Childish Fl...
# 题意: # 题解1: 暴力+滑动窗口:从每一个点以每一个滑动窗口来遍历,注意剪枝不然会超时 # 题解2: 双指针。指针间的区间为candidate,若candidate的和大于target则左边界+1,若小于则右边界+1.比题解1快得多。 class Solution: def findContinuousSequence(self, target): # inputs: target: int # outputs: List[List[int]] # 想用滑动窗口 res = [] for i in range(1,target): #...
""" Enumerates the Resource Description Framework and XML namespaces in use in ISDE. Each class variable is a `dict` with two keys: - _ns_: The preferred namespace prefix for the vocabulary as a `str` - _url_: The URL to the vocabulary as a `str` """ class RDFNamespaces: """ Resource Description Framework na...
class FuzzyOperatorSizeException(Exception): """ An Exception which indicates that the associated matrix of the operator has invalid shape. """ def __init__(self, message: str = "Only squared matrices are valid to represent a fuzzy operator."): super().__init__(message)
# 泰波那契序列 Tn 定义如下:  # # T0 = 0, T1 = 1, T2 = 1, 且在 n >= 0 的条件下 Tn+3 = Tn + Tn+1 + Tn+2 # # 给你整数 n,请返回第 n 个泰波那契数 Tn 的值。 # #   # # 示例 1: # # 输入:n = 4 # 输出:4 # 解释: # T_3 = 0 + 1 + 1 = 2 # T_4 = 1 + 1 + 2 = 4 # 示例 2: # # 输入:n = 25 # 输出:1389537 #   # # 提示: # # 0 <= n <= 37 # 答案保证是一个 32 位整数,即 answer <= 2^31 - 1。 # # 来源:力扣(Lee...
#!/usr/bin/python3 """基数排序(非比较排序) 按低位到高位的顺序放置数据到10个桶,依次重复到最高位就排好序了 此法,需要二倍内存 """ #辅助函数1:按位重复排序:个位,十位,百位... def bitSort(alist, bucket, bit): for item in alist: pos = item // pow(10, bit) % 10 #计算元素所属列表位置 bucket[pos].append(item) #辅助函数2:将桶内元素放回lst, #类似将[[],[],[123,426],[],[547,941]]变成 lst = [123,456...
"""Top-level package for ERD Generator.""" __author__ = """Datateer""" __email__ = 'dev@datateer.com' __version__ = '__version__ = 0.1.0'
class Solution: def maxDistance(self, position: List[int], m: int) -> int: self.position = sorted(position) low, high = 0, self.position[-1] - self.position[0] while low <= high: mid = (high+low) // 2 if self.check(self.position, m, mid): low = mid + 1...
l = int(input()) ar = input().split() for size in range(l): ar[size] = int(ar[size]) def shift(plist, index): temp = plist[index] if plist[index-1] > plist[index]: plist[index] = plist[index-1] plist[index-1] = temp if index - 2 == -1: pass else: ...
SERPRO_API_GATEWAY = "https://apigateway.serpro.gov.br" SERPRO_PUBLIC_JWKS = "https://d-biodata.estaleiro.serpro.gov.br/api/v1/jwks" AUTHENTICATE_ENDPOINT = "/token" # biodata endpoints BIODATA_TOKEN_ENDPOINT = "/biodata/v1/token" JWT_AUDIENCE = '35284162000183'
def div(a, b): if(b != 0): return a/b else: print("cannot divide by 0") return def add(a,b): return a+b
class Graph(object): def __init__(self, n): self._n = n
ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' def base64_to_base10(s): return sum(ALPHABET.index(j)*64**i for i,j in enumerate(s[::-1]))
class Solution: def numIdenticalPairs(self, nums: List[int]) -> int: #create counter visited = {} counter = 0 #loop through nums for i in nums: if i in visited: counter += visited[i] visited[i] += 1 ...
n= int(input()) line1 = sum([int(i) for i in input().split()]) line2 = sum([int(i) for i in input().split()]) line3 = sum([int(i) for i in input().split()]) first = line1-line2 second = line2-line3 print(first) print(second)
#!/usr/bin/env python3 #Create and print string people = "sapiens, erectus, neanderthalensis" print(people) #Split the string into individual words species = people.split(', ') print(species) #Sort alphabetically print(sorted(species)) #Sort be length of string and print print(sorted(species,key=len))
y = int(input("Digite um numero: ")) x = int(input("Digite um numero: ")) linha = 1 coluna = 1 while linha <= x: while coluna <= y: print(linha * coluna, end="\t") coluna += 1 linha += 1 print() coluna = 1
# -*- encoding: UTF-8 -*- STICKERS_TO_COUNT = [ { 'id': '13984239', 'name': '無言雞', }, { 'id': '13984243', 'name': '哇恐龍', }, { 'id': '13984245', 'name': '我不要聽', }, { 'id': '1691926', 'name': '熊遮眼', }, { 'i...
class DataGeneratorCfg: n_samples = 300 centers = [[-1, 0.5], [1, 0], [1,1]] cluster_std = 0.5 random_state = None class APCfg: n_iterations = 300 damping = 0.8 preference = -50 #'MEDIAN', 'MINIMUM' or a value class MainCfg: generate_new_data=True # Saves it to data folde...
"Implementing stack using python lists" class UnderFlowError(Exception): pass class OverFlowError(Exception): pass class Stack: def __init__(self, max_size): self.s = [] self.top = -1 self.max_size = max_size @property def stack_empty(self): return self.top == ...
# #!/usr/bin/env python # encoding: utf-8 # -------------------------------------------------------------------------------------------------------------------- # # Name: merging_two_dictionaries.py # Version: 1.0 # # Summary: Merging two dictionaries. # # Author: Alexsander Lopes Camargos # Author-email: alcamargos...
# output: ok a, b, c, d, e, f = 1000, 1000, 1000, 1000, 1000, 1000 g, h, i, j, k, l = 2, 1000, 1000, 1000, 1000, 1000 a = a + 1 b = b - 2 c = c * 3 d = d / 4 e = e // 5 f = f % 6 g = g ** 7 h = h << 8 i = i >> 9 j = j & 10 k = k ^ 11 l = l | 12 assert a == 1001 assert b == 998 assert c == 3000 assert d == 250 assert...
""" Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the linked list becomes 1->2->3->5. Note: Given n will always be valid. Try to do this in one pass. """ # ...
''' Description : Data Structure Using String Method Function Date : 07 Feb 2021 Function Author : Prasad Dangare Input : str Output : str ''' # This is a string object name = 'prasad' if name.startswith('pra'): print ('Yes, the string starts with "pra"') if ...
class Utilities: @staticmethod def get_longest(words): longest = "" for word in words: if len(word) > len(longest): longest = word Utilities.log(longest) return longest @staticmethod def log(word): print("Logging: " + word)
""" The binary search algorithm - search for an item inside a sorted list. Also includes the bisect algorithm: Return the insertion point for an item x in a list to maintain sorted order. (again in logarithmic time) Author: Christos Nitsas (nitsas) (chrisnitsas) Language: Python 3(.4) Date: November, 20...
data = { 4 : [2, 0, 3, 1], 5 : [3, 0, 2, 4, 1], 6 : [3, 0, 4, 1, 5, 2], 7 : [4, 0, 5, 3, 1, 6, 2], 8 : [2, 4, 1, 7, 0, 6, 3, 5], 9 : [3, 1, 4, 7, 0, 2, 5, 8, 6], 10 : [8, 4, 0, 7, 3, 1, 6, 9, 5, 2], 11 : [5, 7, 0, 3, 8, 2, 9, 6, 10, 1, 4], 12 : [7, 10, 0, 2, 8, 5, 3, 1, 9, 11, 6, 4],...
{ "targets": [ { "target_name": "clang_indexer", "sources": [ "addon.cc" ], "include_dirs": [ "<!(node -e \"require('nan')\")", "/Users/vincentrouille/Dev/MicroStep/llvm/tools/clang/include" ], "link_settings": { "libraries": ["/Users/vincentroui...
class FileHandler: def get_data(self, path: str): contents = [] try: with open(path, 'r') as x: content = x.read().strip() contents = list(map(int, content.split(' '))) except FileNotFoundError: if path: print(f"File at loca...
class Solution(object): def countAndSay(self, n): """ :type n: int :rtype: str """ desc = '1' if n == 1: return desc for i in range(2, n+1): last_ch = None counter = 0 last_desc = desc desc = '' ...
''' import random ## random choice will choose 1 option from the list randnum = random.choice(['True', 'False']) print(randnum) ''' class Enemy: def __init__(self): pass self.health = health self.attack = attack def health(self): pass def attack(self): pass class Player(Enemy): d...
ids = [ "elrond", "gandalf", "galadriel", "celeborn", "aragorn", "arwen", "glorfindel", "legolas", "thorin", "balin", "gloin", "gimli", "denethor", "boromir", "faramir", "theoden", "eomer", "eowyn", "bilbo", "frodo", "sam", "pipin",...
# -*- coding: utf-8 -*- """ pepipost This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). """ class DomainStruct(object): """Implementation of the 'DomainStruct' model. Domain Modal Attributes: domain (string): The domain you wish to include ...
#Author: ahmelq - github.com/ahmedelq/ #License: MIT #this is a solution of https://old.reddit.com/r/dailyprogrammer/comments/aphavc/20190211_challenge_375_easy_print_a_new_number_by/ # -- coding: utf-8 -- def exoticNum(n): return ''.join([ str(int(num) + 1) for num in list(str(n))]) i...
#!/usr/bin/env python # -*- coding: UTF-8 -*- class BaseAnonymizor(object): '''BaseType for anonymizers of the *data-migrator*. Instantiate the anonymizer and definition and call the instantiation at translation time. Implement the :meth:`~.__call__` method to implement your specific anonymizor. ...
# -*- coding: utf-8 -*- def test_chat_delete(slack_time): assert slack_time.chat.delete def test_chat_delete_scheduled_message(slack_time): assert slack_time.chat.delete_scheduled_message def test_chat_get_permalink(slack_time): assert slack_time.chat.get_permalink def test_chat_me_message(slack_tim...
for _ in range(int(input())): n = int(input()) s = input() count_prev = 0 count = 0 changes = 0 for i in s: if i == "(": count -= 1 else: count += 1 if count>0 and count>count_prev: #print(i, count) changes += 1 ...
a='platzi' a=list(a) #Convierto a lista, porque una lista si se puede modificar a[0]='c' #Realizo el cambio que necesito a=''.join(a) #Concateno para obtener nuevamente el string print(a)
# -*- coding: utf-8 -*- """ Assessments Module - Controllers @author: Fran Boon @see: http://eden.sahanafoundation.org/wiki/Pakistan @ToDo: Rename as 'assessment' (Deprioritised due to Data Migration issues being distracting for us currently) """ module = request.controller if module not in deployment_...
var1 = [0,1,2,3,4,5] for x in var1: var1[x] = x*x for x in "123456": print(x) #While loop someval = 1 while someval<1000: someval *= 2
""" Зачет проводится отдельно в каждом классе. Победителями олимпиады становятся школьники, которые набрали наибольший балл среди всех участников в данном классе. Для каждого класса определите максимальный балл, который набрал школьник, не ставший победителем в данном классе. Формат вывода Выведите три целых числа. ""...
class Rod: def __init__(self, length, boost_begin, boost_count, ang_acc): self.length = length self.boost_begin = boost_begin self.boost_count = boost_count self.ang_acc = ang_acc self.ang_vel = 0 self.ang_pos = 0
#Program that takes a temperature typed in °C and converts it to °F print('=' * 10, 'DEFIANCE 014', '=' * 10) c = float(input('Enter the temperature in °C: ')) f = (c * 9/5) + 32 print('The temperature of {}°C stands for {}°F.'.format(c, f))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' QSDsan: Quantitative Sustainable Design for sanitation and resource recovery systems This module is developed by: Yalin Li <zoe.yalin.li@gmail.com> This module is under the University of Illinois/NCSA Open Source License. Please refer to https://github.com/QSD-G...
class SingleNode: def __init__(self, key, next=None): self.key = key self.next = None def __repr__(self): return f"Node: key={self.key}, next={self.next.key if self.next is not None else None}" class SinglyLinkedList: def __init__(self): self.sentinel = SingleNode(None) ...
# Your code here s=str(input()) n=len(s) for i in range(n): print(s[0],end="")
print() print('LEITOR DE NÚMEROS') print('-' * 25) num = int(input('Digite um número: ')) soma = 0 contador = 0 while num != 999: soma += num num = int(input('Digite um número: ')) contador += 1 print() print('\033[1;4;34m%i\033[m números \033[4mforam digitados\033[m' % contador) print('\nE a soma entre ...
# from Attributes_and_Methods.movie_world_02E.project.customer import Customer # from Attributes_and_Methods.movie_world_02E.project.dvd import DVD class MovieWorld: def __init__(self, name: str): self.name = name self.customers = [] self.dvds = [] @staticmethod def dvd_capacity()...
print("Welcome to Python Prizza Deliveries!") size = input("What size pirzza do you want? S, M, L \n") add_pepperoni = input("Do you want pepperoni? Y or N \n") extra_cheese = input("Do you want extra cheese? Y or N \n") bill = 0 if size=="S" | "s": bill += 15 if add_pepperoni == "Y": bill +...
class Solution: def nextGreaterElement(self, nums1, nums2): # Write your code here answer = {} stack = [] for x in nums2: while stack and stack[-1] < x: answer[stack[-1]] = x del stack[-1] stack.append(x) for x in stack...
""" escopo """ variavel = 'valor' def func(): print(variavel) def func2(): global variavel variavel = 'outro valor' print(variavel) def func3(): print(variavel) func() func2() func3()
def move_disk(fp,tp): print("moving disk from",fp,"to",tp) def move_tower(heigth,from_pole,to_pole,with_pole): if heigth>=1: move_tower(heigth-1,from_pole, with_pole, to_pole) move_disk(from_pole,to_pole) move_tower(heigth-1,with_pole,to_pole,from_pole) def move_disk(fp,tp): print("m...
""" Vamos a crear un programa que simule un inicio de sesión solicitando el nombre de usuario y contraseña, y mostrar un mensaje en pantalla, inicio de sesión correcto / nombre de usuario y/o contraseña incorrecto. (por ejemplo el usuario vuestro nombre en minúsculas (bootcamp_python3) y el password 12345678 Datos de p...
## Beginner Series #3 Sum of Numbers ## 7 kyu ## https://www.codewars.com/kata/55f2b110f61eb01779000053 def get_sum(a,b): if a == b: return a elif a < b: return sum([i for i in range(a, b+1)]) elif b < a: return sum([i for i in range(b, a+1)])
load(":repositories.bzl", "csharp_repos") # NOTE: THE RULES IN THIS FILE ARE KEPT FOR BACKWARDS COMPATIBILITY ONLY. # Please use the rules in repositories.bzl def csharp_proto_compile(**kwargs): print("Import of rules in deps.bzl is deprecated, please use repositories.bzl") csharp_repos(**kwargs) def c...
def count(): x=1 while x<10000: yield x x+=1 for x in count(): print(x)
#sorted(iterable, key=key, reverse=reverse) # List x = ['q', 'w', 'r', 'e', 't', 'y'] print (sorted(x)) # Tuple x = ('q', 'w', 'e', 'r', 't', 'y') print (sorted(x)) # String-sorted based on ASCII translations x = "python" print (sorted(x)) # Dictionary x = {'q':1, 'w':2, 'e':3, 'r':4,...
class Graph(object): """docstring for Graph""" def __init__(self): self.edges = {} self.numVertices = 0 self.start = "" self.end = "" def neighbors(self, id): return self.edges[id] def cost(self, current, next): for x in self.edges[current]: if x[1] == next: return x[0]
# python 3 # (C) Simon Gawlik # started 8/1/2015 n = 20 #232792560 primes = [] non_primes = [] # find prime numbers up to n def primes_lt_n (n): for num in range (2, n + 1): is_prime = True for i in range (2, num): if num % i == 0: is_prime = False if i...
ages = [34, 87, 35, 31, 19, 44, 16] odds = [age for age in ages if age % 2 == 1] print(odds) friends = ['Rolf', 'james', 'Sam', 'alex', 'Louise'] guests = ['jose', 'benjamin', 'Mark', 'Alex', 'Sophie', 'michelle', 'rolf'] lower_case_friends = [friend.lower() for friend in friends] lower_case_guests = [guest.lower()...
# -*- coding: utf-8 -*- ############################################################################## # # This file is part of web_readonly_bypass, # an Odoo module. # # Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>) # # web_readonly_bypass is free software: # you can redistribute it and/or m...
# # PySNMP MIB module POLICY-BASED-MANAGEMENT-MIB (http://pysnmp.sf.net) # ASN.1 source http://mibs.snmplabs.com:80/asn1/POLICY-BASED-MANAGEMENT-MIB # Produced by pysmi-0.0.7 at Sun Feb 14 00:23:59 2016 # On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose # Using Python version 3.5.0 (default, ...
# Estrutura de Repetição for # Dando oi 6 vezes for c in range(0, 6): print('OI!!!') print('FIM!!!') print() # Contar de 1 a 6 for c in range(1, 7): print(c) print('FIM') print() # Contagem regressiva a partir de 6 for c in range(6, -1, -1): print(c) print('FIM') # Contar de 2 em 2 for c in range(0, 7, 2)...
""" Given a positive integer num, output its complement number. The complement strategy is to flip the bits of its binary representation. """ class Solution: def findComplement(self, num: int) -> int: bin_num = bin(num)[2:] return int(str(int(len(bin_num) * '1') - int(bin_num)), 2)
#!/usr/bin/env python3 def reverse(input: str) -> str: if len(input) < 2: return input return input[-1] + reverse(input[1:-1]) + input[0] def reverse_iter(input: str) -> str: ret = "" for i in range(len(input)): ret += input[len(input)-1-i] return ret if __name__ == '__main__...
#cubes list = [] for number in range(1,11): list.append(number**3) for number in list: print(number)
class decorate: def __init__(self, arg1=None, arg2=None): self.arg1 = arg1 self.arg2 = arg2 def __call__(self, method): def wrapper(): print('ARG1 = %s, ARG2 = %s' % ( str(self.arg1), str(self.arg2)) ) method() return wrapper @decorate('the decoration...
#Faça um programa que leia um nome de usuário e a sua senha e não aceite a senha igual ao nome do usuário, # mostrando uma mensagem de erro e voltando a pedir as informações. n = (input("Digite seu nome: ")) s = (input("digite uma senha: ")) while n == s: print("error") n = int(input("Digite seu no...
class Team: """ A class for creating a team with an attacking, defending and overall attribute""" def __init__(self, name, player1, player2, player3, player4, player5): self.name = name self.player1 = player1 self.player2 = player2 self.player3 = player3 ...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' ***************************************** Author: zhlinh Email: zhlinhng@gmail.com Version: 0.0.1 Created Time: 2016-03-10 Last_modify: 2016-03-10 ****************************************** ''' ''' Say you have an array for which the ith el...
def Typename(name): class TypeN(type): def __repr__(cls): return name return TypeN
# https://leetcode.com/problems/maximum-number-of-balls-in-a-box def get_box(ball): count = 0 while ball > 0: count += ball % 10 ball //= 10 return count def count_balls(low_limit, high_limit): hash_counter = {} for ball in range(low_limit, high_limit + 1): ...
""" Problem #5 """ # cons implementation def cons(a,b): return lambda f: f(a,b) def car(func): f1 = lambda a,b :a return func(f1) def cdr(func): f2 = lambda a,b:b return func(f2) if __name__ == "__main__": assert car(cons(3,4)) == 3 assert cdr(cons(3,4)) == 4
def removeDuplicates(nums): if not nums: return 0 slow = 1 for fast in range(1, len(nums)): if nums[fast] != nums[slow-1]: nums[slow] = nums[fast] slow += 1 return slow if __name__ == '__main__': print(removeDuplicates([0,0,1,1,1,2,2,3,3,4])) print(rem...
# Magnum IO Developer Environment container recipe Stage0 += comment('GENERATED FILE, DO NOT EDIT') Stage0 += baseimage(image='nvcr.io/nvidia/cuda:11.4.0-devel-ubuntu20.04') # GDS 1.0 is part of the CUDA base image Stage0 += nsight_systems(cli=True, version='2021.2.1') Stage0 += mlnx_ofed(version='5.3-1.0.0.1') Stag...
class IterationTimeoutError(Exception): pass class AlreadyRunningError(Exception): pass class TimeoutError(Exception): pass class MissingCredentialsError(Exception): pass class IncompleteCredentialsError(Exception): pass class FileNotFoundError(Exception): pass
class Solution(object): def isValid(self, s): stack = [] for word in s: #print word if word == "{" or word == "[" or word == "(": stack.append(word) elif word == "}" or word == "]"or word == ")": if len(stack)==0: ...
n = int(input('Qual a velocidade atual do carro: ')) ex = n - 80 multa = float(ex * 7) if n > 80: print(f'MULTADO! Voce execedeu o limite de 80 km/h e deve pagar uma multa de R$ {multa}') print('Tenha um bom dia! Dirija com segurança!')
#Escreva um programa que leia um numero inteiro qualquer e peça para escolher qual será a base de conversão: binário,octal ou hexadecimal #Header print('{:=^38}'.format('Desafio 37')) print('='*5,'Conversor de base numérica','='*5) #Survey num=int(input('Digite um número inteiro: ')) print('''Escolha uma das bases...
# SRC: https://leetcode.com/problems/reverse-string/ # # Write a function that reverses a string. # The input string is given as an array of characters s. # You must do this by modifying the input array in-place with O(1) extra memory. def reverseString(s: str) -> None: chars = s # FIXME simplify do 1 trip, i...
def convert_rankine_to(temperature_to: str, amount: float): if temperature_to == 'celsiu(s)': value = amount * 0.55 - 273.15 if temperature_to == 'fahrenheit(s)': value = amount - 459.67 if temperature_to == 'kelvin(s)': value = amount * 0.55 if temperature_to == 'rankine(s)': ...
# -*- coding: utf-8 -*- ''' Management of Gitlab resources ============================== :depends: - python-gitlab Python module :configuration: See :py:mod:`salt.modules.gitlab` for setup instructions. Enforce the project/repository ------------------------------ .. code-block:: yaml gitlab_project: g...
# # PySNMP MIB module CISCO-LWAPP-MESH-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-LWAPP-MESH-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:48:49 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
# parsetab.py # This file is automatically generated. Do not edit. # pylint: disable=W,C,R _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = "NUM PAL\n lista : '[' conteudo ']'\n\n conteudo :\n | elementos\n\n elementos : elem\n | elem ',' elementos\n\n elem : NUM\n ...
def create_connection(db_file): """ create a database connection to a SQLite database """ conn = None try: conn = sqlite3.connect(db_file) print(sqlite3.version) except Error as e: print(e) finally: if conn: conn.close() def execute_query(conn...
print('你真是一个小天才') print('听说你是个棒槌') print('sadasdsadsd') print('jijijijijij') hello = 'dig' print(hello) print('liweiguo') print('这只是个开始') print('后面还会有无数的挫折和考验') print('漂亮的小姐姐') print('需要我们解放她们')
numberMap = {} maxValueKey= None with open('data.txt', 'r') as data : for line in data : number = int(line) value = None if number in numberMap : value = numberMap[number] + 1 else : value = 1 numberMap[number] = value if maxValueKey == None...
class Elasticity(object): def __init__(self, young_module, contraction, temperature): self.__temperature = temperature self.__contraction = contraction self.__young_module = young_module def get_temperature(self): return self.__temperature def get_contraction(self): ...
######################################## # AssemblerBssElement ################## ######################################## class AssemblerBssElement: """.bss element, representing a memory area that would go to .bss section.""" def __init__(self, name, size, und_symbols = None): """Constructor.""" self.__...
""" Frozen subpackages for meta release. """ frozen_packages = { "libpysal": "4.3.0", "access": "1.1.1", "esda": "2.3.1", "giddy": "2.3.3", "inequality": "1.0.0", "pointpats": "2.2.0", "segregation": "1.3.0", "spaghetti": "1.5.0", "mgwr": "2.1.1", "spglm": "1.0.7", "spint": "...
class Node: def __init__(self, data): self.data = data self.next = None class CircularLinkedList: def __init__(self): self.head = None def print_list(self): cur = self.head while cur: print(cur.data) cur=cur.next if cur == self...
# https://leetcode.com/problems/linked-list-cycle-ii/ # Given a linked list, return the node where the cycle begins. If there is no # cycle, return null. # There is a cycle in a linked list if there is some node in the list that can be # reached again by continuously following the next pointer. Internally, pos is # u...
# -*- encoding:utf-8 -*- """Autogenerated file, do not edit. Submit translations on Transifex.""" MESSAGES = { "%d min remaining to read": "残りを読むのに必要な時間は%d分", "(active)": "(有効)", "Also available in:": "他の言語で読む:", "Archive": "文書一覧", "Atom feed": "Atomフィード", "Authors": "著者一覧", "Categories": "...
# -*- coding: utf-8 -*- class KriegspielException(Exception): pass
""" Base class for set of data stores and connection provider for them """ class StoreSet: connection_provider = None context_store = None user_store = None messagelog_store = None
class Edge: # edge for polygon def __init__(self): self.id = -1 # polygon vertex id self.v0_id = -1 self.v1_id = -1 # connected polygon node id self.node0_id = -1 self.node1_id = -1 # the lane id this edge cross self.cross_lane_id = -1 ...