content
stringlengths
7
1.05M
# -*- mode: python; -*- # Return the pathname of the calling package. # (This is used to recover the directory name to pass to cc -I<dir>, when # choosing from among alternative header files for different platforms.) def pkg_path_name(): return "./" + Label(REPOSITORY_NAME + "//" + PACKAGE_NAME + ...
# Play = 'play' # Pass = 'pass' Draw = 'draw' Discard = 'discard' TutorDeck = 'tutor_deck' TutorDiscard = 'tutor_discard' Create = 'create' Shuffle = 'shuffle' Mill = 'mill' Top = 'top' # Resolve = 'resolve' # Win = 'win' # Lose = 'lose' # Tie = 'tie' # # Build = 'build' # Inspire = 'inspire' # Nourish = 'nourish' # #...
# -*- coding:utf8 -*- """ common settings FUTURE: read setting from a json file """ """ path configuration """ ICON_PATH = '../icons/' CACHE_PATH = '../cache/' DATA_PATH = '../data/' """ mode configuration """ DEBUG = True # 1 for debug PRODUCTION = False # 0 for Production Environment LOGFILE = CACHE_PATH + ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # # FreeType high-level python API - Copyright 2011-2012 Nicolas P. Rougier # Distributed under the terms of the new BSD license. # # ----------------------------------------------------------...
start_text = '''Welcome to Hentai Manga DL Bot. Here you can Download all Hentai Mangas for Free. For many who donโ€™t know about Hentai, this is about Japanese anime and manga porn or cartoon porn. This great genre was born in Japan and its real meaning comes from perverse sexual desire or perverse sexual act sinc...
""" ะŸั€ะพัั‚ะตะนัˆะธะน ั‚ะตะปะตั„ะพะฝะฝั‹ะน ัะฟั€ะฐะฒะพั‡ะฝะธะบ. """ # ะ—ะฐะฒะพะดะธั‚ ะฟะตั€ะตะผะตะฝะฝัƒัŽ ัะฟั€ะฐะฒะพั‡ะฝะธะบะฐ catalog = {} def checked_input(values, type_, hello): """ะŸั€ะพะฒะตั€ัะตั‚ ะฒะฒะพะด ะฝะฐ ะฟั€ะธะฝะฐะดะปะตะถะฝะพัั‚ัŒ ะผะฝะพะถะตัั‚ะฒัƒ ะฟั€ะฐะฒะธะปัŒะฝั‹ั… ะฒะฐั€ะธะฐะฝั‚ะพะฒ""" inp = type_(input(hello)) if inp not in values: while inp not in values: print('Incorrec...
def Fibonacci_Tail(n, acc0= 0, acc1= 1): # Base-Case(s): F(0) = 0, F(1) = 1 if(n == 0): return acc0 if(n == 1): return acc1 # Recursion return Fibonacci_Tail(n-1, acc1, acc1+acc0) n = 0 while(n <= 10): get = Fibonacci_Tail(n) print(f"Fibonacci({n}) = {get}") ...
# # PySNMP MIB module Juniper-Notification-Log-CONF (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-Notification-Log-CONF # Produced by pysmi-0.3.4 at Mon Apr 29 19:52:48 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python ve...
# -*- coding: utf-8 -*- class Pessoa: """Implementaรงรฃo de uma classe que modela uma pessoa""" temDeficiencia = False # atributo de classe def __init__(self, *filhos, nome=None, idade=0): self.nome = nome self.idade = idade self.filhos = list(filhos) def cumprimentar(self):...
# pylint: skip-file #- @A defines/binding ClassA #- @object ref vname("module.object", _, _, "pytd:__builtin__", _) #- ClassA.node/kind class class A(object): pass #- @B defines/binding ClassB #- @A ref ClassA #- ClassB.node/kind class class B(A): pass #- @Foo defines/binding ClassFoo #- @A ref ClassA #- @B re...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Oct 20 08:50:32 2019 @author: Giles """ ''' Question 1 Ask the user for two numbers between 1 and 100. Then count from the lower number to the higher number. Print the results to the screen. ''' ''' Question 2 Ask the user to input a string and then ...
# -*- coding: utf-8 -*- # # Copyright (C) 2015-2016 Mateusz ลฤ…cki and Michaล‚ Startek. # # This file is part of IsoSpec. # # IsoSpec is free software: you can redistribute it and/or modify # it under the terms of the Simplified ("2-clause") BSD licence. # # IsoSpec is distributed in the hope that it will be us...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Receipt View Created on Tue Aug 17 14:16:44 2021 Version: 1.0 Universidad Santo Tomรกs Tunja Simulation @author: Juana Valentina Mendoza Santamarรญa @author: Alix Ivonne Chaparro Vasquez presented to: Martha Susana Contreras Ortiz """ def showReceipt(): print("โ”Œ...
lista = [] print("Escolha uma das Opรงรตes abaixo:") def showOptions(): print(""" 0 - Sair do Programa 1 - Adicionar pessoa 2 - Listar pessoas 3 - Somar salรกrio dos homens 4 - Somar salรกrio das mulheres """) def adicionar(): nome = input('Informe o nome: ') sexo = input('informe o...
'''Instructions You are going to use Dictionary Comprehension to create a dictionary called result that takes each word in the given sentence and calculates the number of letters in each word. Try Googling to find out how to convert a sentence into a list of words. Do NOT Create a dictionary directly. Try to use ...
## A note on unneecssary complexity # We have gone through a few different standards on naming Julia's build artifacts. # The latest, as of this writing, is the `sf/consistent_distnames` branch on github, # and simplifies things relative to earlier versions. However, this buildbot needs # to be able to build/upload Ju...
""" Creating new user after checking all the input. the user will be added into the remote data source and input the login details into the login window """ def makeUser(self,name,pw,pw2,email): """Checking input is valid and not already exist in the current database before creating new user instance ...
# -*- coding: utf-8 -*- """ 958. Check Completeness of a Binary Tree Given a binary tree, determine if it is a complete binary tree. Definition of a complete binary tree from Wikipedia: In a complete binary tree every level, except possibly the last, is completely filled, and all nodes in the last level are as far le...
# coding: utf-8 #Name : satoshi-2000 #Date : 2020/12/3 #Title: string ##### ๆ–‡ๅญ—ๅˆ— ##### #ๆ–‡ๅญ—ๅˆ—็ฝฎๆ› a = 'game' b = 'video' ex = 'You say hello and I say hello' #ๆ–‡ๅญ—ๆ•ฐ print(len(a)) #4 #้€ฃ็ต print(a + b) #gamevideo #็นฐใ‚Š่ฟ”ใ— print(a * 3) #gamegamegame #็ฝฎๆ› print(ex.replace('say','soy')) #You soy...
""" Faรงa um programa que pergunte a hora para o usuรกrio e, se baseando no horรกrio descrito, exiba a saudaรงรฃo apropriada. """ hora = input("Que horas sรฃo aรญ? ") if hora.isnumeric(): hora = int(hora) else: print("Por favor, digite somente nรบmeros.") if hora < 0 or hora > 23: print("Horรกrio invรกlido") elif h...
class Scope: """ Class to define the Scope object to be used during compilation of the whole program. """ def __init__(self, line_number, instructions): """ Constructor for the Scope object. :param line_number: The line the function is defined at :param instructions: The...
try: num = float(input("Enter a number : ")) def real_nums(x): if x > 0: return "The number is POSITIVE" elif x == 0: return "The number is ZERO" elif x < 0: return "The number is NEGATIVE" else: return "Enter a valid numb...
""" month picker simple case implementation in python """ class Case(object): """ class to return a month """ def what_month(self, num): """ returns the month Arguments: num {int} -- month Returns: string -- month """ method_n...
# 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 writing, software # distributed under t...
""" Given an array A of non-negative integers, half of the integers in A are odd, and half of the integers are even. Sort the array so that whenever A[i] is odd, i is odd; and whenever A[i] is even, i is even. You may return any answer array that satisfies this condition. Example: Input: ...
#Finding number of hansu which is under n def number_of_hansu(n): out = 0 digit_difference = 0 for i in range(1, n + 1): #Number under 100 is always hansu if i < 100: out += 1 else: #First digit difference digit_difference = digits(i)[1] - digits...
criteria = [ { 'name': 'Price', 'inc': "Two thousand dollars is a lot of Ramen.", 'just': "A high price tag will be a deal breaker no matter what." }, { 'name': 'User Rating', 'inc': "User ratings indicate reliability and general satisfaction of previous customers.", ...
""" __init__.py Created by: Martin Sicho On: 4/27/20, 10:49 AM """
# # PySNMP MIB module A3COM-HUAWEI-DNS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM-HUAWEI-DNS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 16:49:29 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
DEBUG = False PORT = 8080 PROPAGATE_EXCEPTIONS = True SQLALCHEMY_ECHO = False SQLALCHEMY_DATABASE_URI = "" SQLALCHEMY_POOL_SIZE = 15
class Workpiece: def __init__(self, id): self.id = id # self.status = "awaiting production" self.status = "awaiting next step" self.actual_quality = None self.source = None self.sink = None self.location = "wc_0" # Starting point. Location refers to workcell...
def add_filters_to_legend(): pass def extend_data_from_recs(): pass def find_errors(): '''find errors such as restricted works, etc. where data needs to be entered manually''' pass
QWERTY_KEYMAP = bytearray.fromhex('000000000000000000000000760f00d4ffffffc7000000782c1e3420212224342627252e362d3738271e1f202122232425263333362e37381f0405060708090a0b0c0d0e0f101112131415161718191a1b1c1d2f3130232d350405060708090a0b0c0d0e0f101112131415161718191a1b1c1d2f313035') print(QWERTY_KEYMAP) print(type(QWERTY_KEY...
# MIT License # # Copyright (c) [2018] [Victor Manuel Cajes Gonzalez - vcajes@gmail.com] # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation th...
class APIError(Exception): """Base exception for errors raised by high-level websocket API.""" class MessageHandlerError(APIError): """Decoding or parsing a message failed.""" class RemoteMessageHandlerError(MessageHandlerError): """Raised for errors directly caused by messages from the client.""" cla...
def printadj(table,g): print(" ",end="") print(" ".join(table)) for i in table: strout = "" print(i,end=" : ") for j in table: l = g.get(i,None) if not l : strout+="0, " elif j in l: strout+="1, " els...
""" Created on May 4 - 2019 ---Based on the 2-stage stochastic program structure ---Assumption: RHS is random ---read stoc file (.tim) ---save the distributoin of the random variables and return the ---random variables @author: Siavash Tabrizian - stabrizian@smu.edu """ class readtim: def __init__(self, name):...
class Solution: def twoSum(self, nums, target): for n in nums: print("n = {}".format(n)) indexN = nums.index(n) print("indexN = {}".format(indexN)) for p in nums[1:]: print("p = {}".format(p)) indexP = nums.index(p) print("indexP = {}".format(indexP)) if inde...
''' Binary Seach works on only sorted collection. Time : O(log n) Space : O(1) ''' def binarySearch(arr, target): left = 0 right = len(arr)-1 while(left <= right): mid = (left + right) // 2 if(arr[mid] == target): return mid #if target is greater th...
""" 1436. Destination City You are given the array paths, where paths[i] = [cityAi, cityBi] means there exists a direct path going from cityAi to cityBi. Return the destination city, that is, the city without any path outgoing to another city. It is guaranteed that the graph of paths forms a line without any loop, the...
t=int(input()) for qwerty in range(t): #n,a,b,c=input().split() #n,a,b,c=int(n),int(a),int(b),int(c) #n=int(input()) arr1=list(map(int,input().split())) arr2=list(map(int,input().split())) n1,n2=len(arr1),len(arr2) arr3=[] i=0 j...
expected_output ={ "vrf": { "tn-L2-PBR:vrf-L2-PBR": { "address_family": { "ipv4": { "routes": { "192.168.1.0/24": { "route": "192.168.1.0/24", "active": True, ...
# Week 1 Exercise 1 # Orla Higgins, 2018-02-20 # A program that displays Fibonacci numbers. def fib(n): """This function returns the nth Fibonacci number.""" i = 0 j = 1 n = n - 1 while n >= 0: i, j = j, i + j n = n - 1 return i # Test the function with the following value. x = 16 ans = fib(x)...
''' Fixed XOR Write a function that takes two equal-length buffers and produces their XOR combination. If your function works properly, then when you feed it the string: 1c0111001f010100061a024b53535009181c ... after hex decoding, and when XOR'd against: 686974207468652062756c6c277320657965 ... should produce: 7468...
CAPACITY = 100 class Heap: def __init__(self): self.heap_size = 0 self.heap = [0]*CAPACITY def insert(self, item): if self.heap_size == CAPACITY: return self.heap[self.heap_size] = item self.heap_size = self.heap_size + 1 self.fix_up(self.heap_si...
"""Class that stores the position information""" class FlPosition: """Stores the position information""" def __init__(self, position_data, column_labels, timestamps, conversion): self.position_data = position_data self.column_labels = column_labels self.timestamps = timestamps ...
_base_ = '../_base_/datasets/coco_detection.py' data_root = 'data/egohands/' classes = ('myleft', 'myright', 'yourleft', 'yourright') # ใ‚ฏใƒฉใ‚นใƒฉใƒ™ใƒซ data = dict( train=dict( classes=classes, # COCOใƒ‡ใƒผใ‚ฟใ‚ปใƒƒใƒˆใฎใ‚ฏใƒฉใ‚นใ‚’ใ‚ชใƒผใƒใƒผใƒฉใ‚คใƒ‰ ann_file=data_root+'annotations/train.json', img_prefix=data_root+'train/'), ...
def HI(): print("=======================================") print("= = = =") print("= = =") print("= ====== = =") print("= = = = =") print("= = = = =") p...
def makeminutes(time): h, m = time.split(':') return int(h)*60+int(m) def check_buses(n, m, lines): cntbuses = [0]*(n+1) busbalance = [0]*(n+1) events = [] overnight = 0 for line in lines: cdep, deptime, carr, arrtime = line.split() cdep = int(cdep) carr = int(carr)...
#!/usr/bin/env python class DataProcessingException(Exception): pass
def get_messages(text: str): result = dict() current_key = None for no, line in enumerate(text.split("\n")): line = line.strip() # ะ•ัะปะธ ัั‚ั€ะพะบะฐ ัะฒะปัะตั‚ัั ะบะพะผะผะตะฝั‚ะฐั€ะธะตะผ if line.startswith('#'): continue is_key = line.startswith(':') if not current_key: ...
class Solution: def distinctSubseqII(self, S): res, end = 0, collections.Counter() for c in S: res, end[c] = res * 2 + 1 - end[c], res + 1 return res % (10**9 + 7)
inter_,gremio_ = input().split() inter = int(inter_) gremio = int(gremio_) a = 0 contador = 1 v_inter = 0 v_gremio = 0 empate = 0 if inter > gremio: v_inter += 1 elif inter == gremio: empate += 1 else: v_gremio += 1 while a == 0: print("Novo grenal (1-sim 2-nao)") cond = int(input()) if co...
valor1 = float(input("Digite o primeiro valor: ")) dobro = valor1 *2 triplo = valor1 *3 raiz = valor1 **0.5 print("O dobro {} o triplo {} e a raiz quadrada {}".format(dobro,triplo,raiz))
#!/usr/bin/env python #----------------------------------------------------------------------- # tag.py # Author: Olivia Zhang, Zoe Barnswell, Lyra Katzman #----------------------------------------------------------------------- #----------------------------------------------------------------------- class Tag: ...
TARGET_URL = '/{tail:.*}' EXCLUDED_HEADERS = { # 'Accept-CH', # 'Accept-CH-Lifetime', # 'Cache-Control', # 'Content-Encoding', # 'Content-Security-Policy', # 'Content-Type', # 'Date', # 'Expires', # 'Last-Modified', # 'P3P', # 'Set-Cookie', 'Transfer-Encoding', 'X-Tar...
# author: alex o def counting_sort_int(array, base, col): # initialise count array count_array = [0]*base # get the digit in position column and add them into "buckets" for elem in array: digit = elem // 10 ** (col) count_array[digit % base] += 1 # initialise position array po...
""" 121 / 121 test cases passed. Runtime: 32 ms Memory Usage: 14.9 MB """ class Solution: def countHillValley(self, nums: List[int]) -> int: stk = [nums[0], nums[1]] ans = 0 for num in nums[2:]: if num == stk[-1]: continue if stk[-2] < stk[-1] and stk[...
a = [] b = [] c = a a.append(1) b.append(2) c.append(3) print(f'{a=}, {b=}, {c=}') #print(a is c)
class Element: mass = 0.0 def __init__(self, params): self.mass = params["mass"] def molar_mass_kilograms(self): return self.mass / 1000 hydrogen = Element({"mass": 1.00794})
# Here I will attempt to count the occurences of a kmer in a patter def count_kmer(kmer, pattern): num_matches = 0 for num, _ in enumerate(kmer): window = kmer[num: (num+len(pattern))] if window == pattern: num_matches = num_matches + 1 return num_matches count_kme...
""" Problem Description: Cody was once understanding numbers, their squares and perfect squares from his teacher. A perfect square is a number that can be expressed as square of an integer. To check how much Cody understood the concept his teacher kept a test. He has to find the nearest perfect square of the given num...
#!/usr/bin/python # -*- coding:utf-8 -*- #Filename: range.py for i in [0, 1, 2, 3, 4, 5]: print (i ** 2) # >>> 0 # 1 # 4 # 9 # 16 # 25 for i in range(6): print (i ** 2)
if __name__ == '__main__': n = int(input()) arr = list(map(int, input().split())) f = arr[0] p = -100000 for i in arr: if i>f: p=f f=i; elif i<f and i>p: p=i print(p)
# -*- coding:utf-8 -*- # ็”Ÿๆˆๅ™จ,nextๆ–นๆณ•่Žทๅ–ๅ…ƒ็ด ๅ€ผ g = (x*x for x in range(10)) for n in g : print(n) # ๆ–ๆณขๆ‹‰ๅฅ‘ๆ•ฐๅˆ—็”จๅˆ—่กจ็”Ÿๆˆๅผๅ†™ไธๅ‡บๆฅ,ไฝ†ๆ˜ฏ,็”จๅ‡ฝๆ•ฐๆŠŠๅฎƒๆ‰“ๅฐๅ‡บๆฅๅดๅพˆๅฎนๆ˜“ def fib(max) : n, a, b = 0, 0, 1 while n < max : print(b) a, b = b, a + b n = n + 1 return 'done' print(fib(6)) #fibๅ‡ฝๆ•ฐๅฎž้™…ไธŠๆ˜ฏๅฎšไน‰ไบ†ๆ–ๆณขๆ‹‰ๅฅ‘ๆ•ฐๅˆ—็š„ๆŽจ็ฎ—่ง„ๅˆ™,ๅฏไปฅไปŽ็ฌฌไธ€ไธชๅ…ƒ็ด ๅผ€...
load( "//scala:scala_cross_version.bzl", _default_maven_server_urls = "default_maven_server_urls", ) load("//third_party/repositories:repositories.bzl", "repositories") def junit_repositories( maven_servers = _default_maven_server_urls(), fetch_sources = True): repositories( for_art...
"""Provide a decorator to register event handlers.""" def socketio_handler(event, namespace=None): """Register a socketio handler via decorator.""" def wrapper(func): """Decorate a ws event handler.""" # pylint: disable=protected-access func._ws_event = event func._ws_namespac...
class DynamicalSystem: def __init__(self, a1, b1, c1, alpha1, beta1, a2, b2, c2, alpha2, beta2): self.a1 = a1 self.b1 = b1 self.c1 = c1 self.alpha1 = alpha1 self.beta1 = beta1 self.a2 = a2 self.b2 = b2 self.c2 = c2 self.alpha2 = alpha2 ...
class Group(object): def __init__(self, _name): self.name = _name self.groups = [] self.users = [] def add_group(self, group): self.groups.append(group) def add_user(self, user): self.users.append(user) def get_groups(self): return self.groups ...
#WAP to read two numbers from the keyboard and display the larger one on the screen. num1 = input("enter the number one") num2 = input("enter the number two") if(num1>num2): largest = num1 print("number is ", largest) else: largest = num2 print("number is ",largest)
__all__ = [ "bgl_preprocessor", "open_source_logs", ]
def minesweeper(matrix): row = len(matrix) col = len(matrix[0]) def neighbouring_squares(i, j): return sum( matrix[x][y] for x in range(i - 1, i + 2) if 0 <= x < row for y in range(j - 1, j + 2) if 0 <= y < col if i != x or j !...
ASSEMBLY_HUMAN = "Homo_sapiens.GRCh38.104" ASSEMBLY_MOUSE = "Mus_musculus.GRCm39.104" CELLTYPES = ["adventitial cell", "endothelial cell", "acinar cell", "pancreatic PP cell", "type B pancreatic cell"] CL_VERSION = "v2021-08-10"
'''https://leetcode.com/problems/design-add-and-search-words-data-structure/ 211. Design Add and Search Words Data Structure Medium 3595 150 Add to List Share Design a data structure that supports adding new words and finding if a string matches any previously added string. Implement the WordDictionary class: Wor...
"""Module that defines varios enums.""" class Enum: __names = {} @classmethod def name(cls, state): if not cls.__names: cls.__names = { value: key for key, value in cls.__dict__.items() if isinstance(value, int) } r...
test = { 'name': 'Question 1', 'points': 1, 'suites': [ { 'cases': [ { 'code': r""" >>> read_line('3') 3 >>> read_line('-123') -123 >>> read_line('1.25') 1.25 >>> read_line('true') True >>> read_l...
CONFIG_DIR = '__config__' DATA_ROOT_DIR = '__data__' RESULTS_ROOT_DIR = '__results__' TB_DIR = '__runs__' WEIGHTS_DIR = '__weights__' NOISE_ROOT_DIR = "__noise__"
fruits_name_1 = "ใ‚Šใ‚“ใ”" fruits_num_1 = 2 fruits_name_2 = "ใฟใ‹ใ‚“" fruits_num_2 = 10 # [["ใ‚Šใ‚“ใ”", 2], ["ใฟใ‹ใ‚“", 10]]ใจใ„ใ†ๅ‡บๅŠ›ใซใชใ‚‹ใ‚ˆใ†ใซใ€fruitsใซๅค‰ๆ•ฐใ‚’ใƒชใ‚นใƒˆๅž‹ใซไปฃๅ…ฅใ—ใฆใใ ใ•ใ„ fruits = [[fruits_name_1, fruits_num_1], [fruits_name_2, fruits_num_2]] # ๅ‡บๅŠ› print(fruits)
# Map source standard name to command code # Note that the source names may be aliased in the device # The names that come back from the device in a feedback # message are the aliases ROTEL_RSP1570_SOURCES = { " CD": "SOURCE_CD", "TUNER": "SOURCE_TUNER", "TAPE": "SOURCE_TAPE", "VIDEO 1": "SOURCE_VIDEO_1...
class Test(object): """ @cvar some: some variable @type some: C{str} """ some = 'hello' def __init__(self): self.some1 = 10 def q(self, another): """ @param another: another variable @type another: C{str} """ pass
# ะ˜ั‰ะตะผ ะฒ ัะธัั‚ะตะผัƒ ะธัะฟะพะปัŒะทัƒั ะ›ะžะ“ะ˜ะงะ•ะกะšะžะ• ะ˜ login = 'username' password = '123456' login1 = input("ะ’ะฒะตะดะธั‚ะต ะธะผั ะฟะพะปัŒะทะพะฒะฐั‚ะตะปั: ") password1 = input("ะ’ะฒะตะดะธั‚ะต ะฟะฐั€ะพะปัŒ: ") if login1 == login and password1 == password: print('ะ’ั‹ ะฒะพัˆะปะธ ะฒ ัะธัั‚ะตะผัƒ!') else: print('ะะต ัƒะดะฐะตัŒัั ะฒะพะนั‚ะธ. ะŸะพะถะฐะปัƒะนัั‚ะฐ, ะฟั€ะพะฒะตั€ัŒั‚ะต ะฟั€ะฐะฒะธะปัŒะฝะพัั‚ัŒ ะฝะฐะฟะธัะฐะฝะธ...
""" Implementation of Bubble Sort """ def bubble_sort(arr): for i in range(len(arr)): for j in range(len(arr) - i - 1): if j < arr[j + 1]: arr[j], arr[j + 1] = arr[j + 1], arr[j] print(arr) return arr test_arr_1 = [14, 78, 2587, 3, 687, 21] test_arr_2 = [85, 14, ...
#!/usr/bin/env python3 # Print out all the codons for the sequence below in reading frame 1 # Use a 'for' loop dna = 'ATAGCGAATATCTCTCATGAGAGGGAA' ''' #for 1 frame for i in range(0, len(dna), 3): #range(start letter, lenth of seq, print 3 @ a time) codon = (dna[i:i+3]) print(codon) #f1 for i in range(1, len(...
""" Leetcode 12 - Interger to Roman https://leetcode.com/problems/integer-to-roman/ 1. Time: O(1) Memory: O(1) """ class Solution1: """ 1. MINE | Straight-Forward """ def int_to_roman(self, num): if num is None or num == 0: return '' int_roman_pairs = [(1000, 'M'), (900, 'CM'),...
# Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. DEPS = [ 'chromium', 'depot_tools/bot_update', 'depot_tools/gclient', 'file', 'gsutil', 'recipe_engine/path', 'recipe_engine/prop...
#!/usr/bin/env python # Use generators to avoid crashed in memory when needed to interate on large set of data # Generators can be built with the syntax of list comprehensions but inside () names = ['Tim', 'Mark', 'Donna', 'Albert', 'Sara'] gen_a = (len(n) for n in names) print(next(gen_a)) print(next(gen_a)) # Yo...
sumIdade = 0 velho = 0 nome_velho = '' novo = 0 qtnd_20 = 0 for c in range(1, 5): print('-------- {}ยช pessoa --------' .format(c)) nome = str(input('Digite o nome da pessoa {}: ' .format(c))) .strip() idade = int(input('Digite em nรบmeros a idade de {}: '.format(nome))) sexo = input('Vocรช รฉ de qual sexo?...
def largest_product(a_list): if len(a_list) == 0: return False column = 0 row = 0 big = a_list[0][0] * a_list[0][1] while column < len(a_list) - 1: if a_list[column][row] * a_list[column][row + 1] > big: big = a_list[column][row] * a_list[column][row + 1] if a_lis...
### Dielectric class class Dielectric: ## Intialization function with all properties def __init__(self, pos_x, pos_y, width, height, eps_r): self.pos_x = pos_x self.pos_y = pos_y self.width = width self.height = height self.eps_r = eps_r ## String representation func...
""" drf ไธๅ…ผๅฎน็š„้…็ฝฎ้กน """ SCHEMA_COERCE_METHOD_NAMES = { 'retrieve': 'read', 'destroy': 'delete' } SCHEMA_COERCE_PATH_PK = True
def ceaser(message): ciphered = "" for c in message: if c.isalpha(): if c.isupper(): upper = True else: upper = False c = c.upper() place = ord(c) if place+13 > 90: place = (place+13 - 90) + 64...
# # PySNMP MIB module CONV-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CONV-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:11:06 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:1...
# 268. Missing Number # Runtime: 132 ms, faster than 76.58% of Python3 online submissions for Missing Number. # Memory Usage: 15.5 MB, less than 51.40% of Python3 online submissions for Missing Number. class Solution: # Gauss' Formula def missingNumber(self, nums: list[int]) -> int: expected_sum = l...
def redis_key(project_slug, key, *namespaces): """ Generates project dependent Redis key >>> redis_key('a', 'b') 'a:b' >>> redis_key('a', 'b', 'c', 'd') 'a:c:d:b' >>> redis_key('a', 1, 'c', None) 'a:c:1' """ l = [project_slug] if namespaces: l.extend(namespaces) ...
''' split, join, enumerate em python split: dividir uma string join: juntar uma string ou lista enumerate: enumerar elementos da lista #interavel ''' string = 'Brasil รฉ o paรญs do futebool, brasil รฉ o penta penta penta' lista_1 = string.split(' ') lista_2 = string.split(',') palavra_rep = '' contagem = 0 qtd = 0 for pa...
#from time import sleep #for cont in range(10, -1, -1): # print(cont) # sleep(0.5) #for par in range(1, 51): # # outra forma de escreve: print(par) # if par % 2 == 0: # print(' {} '.format(par), end='') # sleep(0.2) #print('acabou') #for n in range(2, 51, 2): # # outra forma de escreve: pri...
# coding=utf-8 # Author: Jianghan LI # Question: 094.Binary_Tree_Inorder_Traversal # Date: 2017-07-03 13:26 - 13:37, 0 wrong try # Complexity: O(N) # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None ...
# -*- coding: utf-8 -*- def pizza(): print("Pizzaaaaaaa") def nuggets(): print("Course de poussins!") def quiche(): print("Qui?") def croques(): print("Ma machine est partie...") def courgettes(): print("Non, pas de courgettes :'(") def choix_repas_moche(num_choix=4): """ Choix d...
class Solution: def removeOuterParentheses(self, S: str) -> str: res = "" level = 0 start = 0 for i, c in enumerate(S): if c == "(": level += 1 if c == ")": level -= 1 if level == 0: res += S[start...
class Linked_List: class __Node: def __init__(self, val): # declare and initialize the private attributes # for objects of the Node class. # TODO replace pass with your implementation self.val=val self.prev=None self.next=None def __init__(self): # declare and initial...