content
stringlengths
7
1.05M
#========================= # Armor List #========================= clothArmor = {'name':'Cloth Armor', 'arm':1, 'description':'This is some cloth armor with a little extra padding.'} leatherArmor = {'name':'Leather Armor', 'arm':3, 'description':'This is some heavy chunks of leather that have been fashioned into ...
#This program estimates a painting job cost_per_hour = 35.00 base_hours = 8 def main(): square_feet = float(input('Enter the number of square feet to be painted: ')) price_per_gallon = float(input('Enter the price of a paint per a gallon: ')) number_of_gallons = calculates_number_of_gallons(square_feet) ...
# spam.py print('imported spam') def foo(): print('spam.foo') def bar(): print('spam.bar')
# https://leetcode.com/problems/largest-rectangle-in-histogram class Solution: def largestRectangleArea(self, heights): if not heights: return 0 st = [0] idx = 1 ans = 0 while idx < len(heights): while heights[idx] < heights[st[-1]]: ...
# Las tuplas no son mutables nombres = ("Ana", "Maria", "Rodrigo") try: nombres.append("Anita") except: print("No se puede nombres.append('Anita')") try: nombres[0]=("Anita") except: print("No se puede nombres[0]=('Anita')")
n = str(input('Digite um número de 0 a 9999: ')) u = str(n[3]) d = str(n[2]) c = str(n[1]) m = str(m[0]) print(f'Unidade: {u}\n Dezena{d}\n Centena{c}\n Milhar: {m}')
""" Python program to find the largest element and its location. """ def largest_element(a, loc = False): """ Return the largest element of a sequence a. """ try: maxval = a[0] location = 0 for (i,e) in enumerate(a): if e > maxval: maxval = e ...
def check(exampleGraph,startPoint,endPoint): global currentPath global final global string if bool(currentPath) == False: currentPath.append(startPoint) for p in exampleGraph: if p[0] == currentPath[-1]: if p[1] not in currentPath: currentP...
# Escreva um programa que leia um valor em metros e o exiba convertido em centímetros e milímetros. medida = float(input("Digite uma distância em metros: ")) km = medida / 1000 hm = medida /100 dam = medida /10 m = medida dm = medida * 10 cm = medida * 100 mm = medida * 1000 #print("A medida de {}m corresponte a {}cm ...
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # @param head, a ListNode # @return a boolean def hasCycle(self, head): d = dict() h = head while h != None: ...
while True: n = int(input('Insira um nº e veja sua tabuada ! ')) print('=' * 15) if n <= 0: break for t in range(1, 11): print(f'{n} X {t} = {n * t}') print('=' * 15) print('Acabou, tenha um bom dia!')
num = input('Digite um número: ') num = int(num) # se for verdade faça: if num % 2 == 0: print(f'O número {num} é PAR!') # se não for verdade faça: else: print(f'O número {num} é IMPAR!')
# Simon says # Do you know the game "Simon says?" The # instructor, "Simon", says what the players should # do, e.g. "jump in the air" or "close your eyes". The # players should follow the instructions only if the # phrase starts with "Simon says". Now let's # implement a digital version of this game! We will # modify ...
lista = [] while True: lista.append(int(input('Digite um valor: '))) respos = str(input('Quer continuar? [S/N] ')).upper().strip()[0] while respos not in 'SN': respos = str(input('Opção Inválida..Quer continuar? [S/N] ')).upper().strip()[0] if respos == 'N': break print(f'Você digitou {l...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' In Curve Fitting, we have all the data available to us at the time of fitting the curve. We want to fit the curve as best as we can. Curve fitting is quite general ambiguously defined. It could refer to polynomial curve fitting. But some curve fitting can also fit...
def test_get_atom1(case_data): """ Test :meth:`.Bond.get_atom1`. Parameters ---------- case_data : :class:`.CaseData` A test case. Holds the bond to test and the correct *atom1*. Returns ------- None : :class:`NoneType` """ assert case_data.bond.get_atom1() is case_da...
# lec10.3-binary_search.py # Binary Search # Can we do better than O(len(L)) for search? # If know nothing about values of elements in list, then no # Worst case have to look at every values # What if list is ordered? Suppose elements are sorted? # Example of searching an ordered list def search(L, e): for i in r...
class OutputHelper: colors = { 'default_foreground': 39, 'black': 30, 'red': 31, 'green': 32, 'yellow': 33, 'blue': 34, 'magenta': 35, 'cyan': 36, 'light_gray': 37, 'dark_gray': 90, 'light_red': 91, 'light_green': 92, ...
# Determine if String Halves Are Alike # Runtime: 39 ms, faster than 82.91% of Python3 online submissions for Determine if String Halves Are Alike. # Memory Usage: 13.8 MB, less than 98.41% of Python3 online submissions for Determine if String Halves Are Alike. # https://leetcode.com/submissions/detail/714796669/ clas...
class Solution: # @param A : list of integers # @return a list of list of integers def twosum(self, arr, index, target): i = index j = len(arr) - 1 while i<j: if arr[i] + arr[j] == target: temp = [arr[index-1], arr[i], arr[j]] if len(self.res)...
""" Very simple, given a number, find its opposite. Examples: 1: -1 14: -14 -34: 34 """ # OPTION 1 # def opposite(number): # return number - number * 2 # OPTION 2 def opposite(number): return -number print(opposite(1))
#!/usr/bin/env python # Settings for synthesis.py (test cases) # Input files Processing path INPUTFILES_PATH = "/home/user/Documents/Development/AlexandriaConsulting/repos/trunk/synthesis/Staging" OUTPUTFILES_PATH = "/home/user/Documents/Development/AlexandriaConsulting/repos/trunk/synthesis/Staging" TEST_FILE = "any...
class TV: #Toda classe deve ser inciada com um função __init_, a partir dele todos os objetos recebe os atributos da classe. def __init__(self) -> None: super().__init__() self.cor = 'preto' self.ligada = False self.tamanho = 55 self.canal = 'netflix' self.volume ...
""" Simple Utilities. """ def _mod(_dividend: int, _divisor: int) -> int: """ Computes the modulo of the given values. _dividend % _divisor :param _dividend: The value of the dividend. :param _divisor: The value of the divisor. :return: The Modulo. """ _q = (_dividend // _divisor) ...
# Variables can store data a = 10 # Assigns the integer 10 to the variable a # In Python variables do not have one fixed type a = "hello" # Assigns the string "hello" to the variable a print(a) # Prints the value of a which is now "hello"
#!/usr/bin/env python3 poly_derivative = __import__('10-matisse').poly_derivative poly = [5, 3, 0, 1] print(poly_derivative(poly))
for x in range(16): with open(f'..\\data\\cpu\\functions\\opcode_switch\\opcode_8xx4\\opcode_8xx4_{x}.mcfunction', 'w') as f: for i in range(16): f.write(f'execute if score Global PC_nibble_3 matches {i} run scoreboard players operation Global V{hex(x)[2:].upper()} += Global V{hex(i)[2:].upper()...
#Diga se a pessoa tem silva no nome sobrenome = str(input('Qual seu nome e sobrenome: ')).upper().strip() if sobrenome == 'SILVA' and len(sobrenome) == 5: print('Tem SILVA no sobrenome') else: print('Não tem SILVA no sobrenome')
valor = int(input()) contadorBixo = contadorCoelho = contadorRato = contadorSapo = 0 for c in range(0, valor): experiencia = str(input()) dividir = experiencia.split() quantidade = int(dividir[0]) tipo = dividir[1] if quantidade > 0 and 'C' in tipo: contadorCoelho += quantidade elif qu...
class gamevals: def __init__(self): self.njp=["","Mark(merchant)","Precious Metal","George(knight)","Old Gem","Map","Gem of Man","Maria(Princess)","Herb","Mineral","Robin(thief)","Gem of Forest","Dragon","Dragon's Nail","Gem of Dragon","Gem of God","Gem of Sky","Gem of Earth","Coin","Vulture","Antiq...
""" String utilities. """ def camelize(value): """ Return the camel-cased version of a string. Used for analysis class names. """ def _camelcase(): while True: yield type(value).capitalize c = _camelcase() return "".join(next(c)(x) if x else '_' for x in value.split("_")...
class Project: def __init__(self, id=None, x=None): self.x = x self.id = id def __eq__(self, other): return (self.id is None or other.id is None or self.id == other.id) and self.x == other.x
class bot_constant: bot_version: str = "0.0.1" bot_token: str = "<Replace token in here>" bot_author: str = "NgLam2911" bot_prefix: str = "?" bot_description: str = "Just a very simple discord bot that say Hi if you say Hello..."
#22. Faça um programa que leia o nome completo de uma pessoa e mostre: nome com todas as letras minusculas e maiusculas; quantas letras tem sem considerar espaços; e quantas letras tem o primeiro nome. def Main022(): nome = str(input('Nome completo: ')).strip() print(nome.upper()) print(nome.lower()) ...
# # PySNMP MIB module HPN-ICF-RS485-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-RS485-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:29:05 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
# message = 'umetumiwa kisi cha tsh2000 kutoka kwa JOSEPH ALEX salio lako ni ths 9000 kujua bonyeza *148*99# ili ' \ # 'kujiunga na salio ' # if message.strip(".islower()"): # print(message) # sentence = "XYThis is an example sentence.XY" # print(message.strip('')) number = input('enter dial codes') if num...
dias = int(input()) ano = dias // 365 dias = dias - ano * 365 mes = dias // 30 dias = dias - mes * 30 print("%.0f ano(s)" % ano) print("%.0f mes(es)" % mes) print("%.0f dia(s)" % dias)
SECRET_KEY = "secret", INSTALLED_APPS = [ 'sampleproject.sample', ] DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME':':memory:' } }
# -*- coding: utf-8 -*- # item pipelines # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html class ScrapydemoPipeline(object): # item pipelines def process_item(self, item, spider): return item
''' Min XOR value Asked in: Booking.com https://www.interviewbit.com/problems/min-xor-value/ Problem Setter: mihai.gheorghe Problem Tester: archit.rai Given an integer array A of N integers, find the pair of integers in the array which have minimum XOR value. Report the minimum XOR value. Input Format: First an...
'''Crie um programa que leia nome, sexo e idade de várias pessoas, guargando os dados de cada pessoa em um dicionário em uma lista no final, mostre: A) quantas pessoas foram cadastradas. B) a média de idade do grupo C) uma lista com todas as mulheres D) uma lista com as pessoas com idade acima da média''' dados ...
load( "@d2l_rules_csharp//csharp/private:common.bzl", "collect_transitive_info", "get_analyzer_dll", ) load("@d2l_rules_csharp//csharp/private:providers.bzl", "CSharpAssembly") def _format_ref_arg(assembly): return "/r:" + assembly.path def _format_analyzer_arg(analyzer): return "/analyzer:" + ana...
# Топ-3 + Результаты тиража по дате + текущая дата def test_top_3_results_draw_date_current_date(app): app.ResultAndPrizes.open_page_results_and_prizes() app.ResultAndPrizes.click_game_top_3() app.ResultAndPrizes.click_the_results_of_the_draw_date() app.ResultAndPrizes.click_ok_in_modal_window_curren...
""" 问题描述:给定两个有序链表的头指针head1和head2,打印两个 链表的公共部分(即链表节点的值相同的部分) 思路:由于链表有序,所以可以比较head1和head2的值进行判断 """ class Node: def __init__(self, value): self.value = value self.next = None class PublicPart: @classmethod def get_public_part(cls, head1, head2): if head1 is None or head2 is None: ...
# This file is part of the airslate. # # Copyright (c) 2021 airSlate, Inc. # # For the full copyright and license information, please view # the LICENSE file that was distributed with this source code. """The top-level module for request models."""
""" Using a read7() method that returns 7 characters from a file, implement readN(n) which reads n characters. For example, given a file with the content "Hello world", three read7() returns "Hello w", "orld" and then "". """ class FileReader: def __init__(self, content: str) -> None: self.conte...
def get_coefficients(Xs, Ys): if len(Xs) != len(Ys): raise ValueError("X and Y series has different lengths") if not isinstance(Xs[0], (int, float)) and not isinstance(Ys[0], (int, float)): raise ValueError("X or Y are not 1D list with numbers") n = len(Xs) X_sum = sum(Xs) X_squar...
def init_celery(app, celery): """Configure celery.Task to run within app context.""" class ContextTask(celery.Task): def __call__(self, *args, **kwargs): with app.app_context(): return self.run(*args, **kwargs) celery.Task = ContextTask
class Solution: def deleteNode(self, node): """ :type node: ListNode :rtype: void Do not return anything, modify node in-place instead. """ node.val = node.next.val node.next = node.next.next
s = "Guido van Rossum heeft programmeertaal Python bedacht." for letter in s: if letter in 'aeiou': print(letter)
class stub: def __init__(self, root): self.dirmap = {root:[]} self.state = 'stopped' def mkdir(self, containing_dir, name): self.dirmap[containing_dir] += [name] path = containing_dir + '/' + name self.dirmap[path] = [] return path ...
# # PySNMP MIB module PEAKFLOW-TMS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PEAKFLOW-TMS-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:40:01 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
# # PySNMP MIB module ENTERASYS-ENCR-8021X-REKEYING-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ENTERASYS-ENCR-8021X-REKEYING-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:48:58 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using P...
# !/usr/bin/env python3 # Author: C.K # Email: theck17@163.com # DateTime:2021-05-24 18:24:44 # Description: class Solution(object): def findLadders(self, beginWord, endWord, wordList): wordList = set(wordList) res = [] layer = {} layer[beginWord] = [[beginWord]] while la...
"""Programa 3_8.py Descrição: Escrever um programa que leia em metros e exiba o valor em milímitros. Autor:Cláudio Schefer Data: Versão: 001 """ # Declaração de variáveis metros = float() milímetros = float() # Entrada de dados metros = float(input("Digite o valor em métros: ")) # Processamento milímetros = me...
# -*- coding: utf-8 -*- class Attendance(object): def __init__(self, user_id, timestamp, status, punch=0, uid=0): self.uid = uid # not really used any more self.user_id = user_id self.timestamp = timestamp self.status = status self.punch = punch def __str__(self): ...
""" @Author: huuuuusy @GitHub: https://github.com/huuuuusy 系统: Ubuntu 18.04 IDE: VS Code 1.39 工具: python == 3.7.3 """ """ 思路: 双指针 结果: 执行用时 : 124 ms, 在所有 Python3 提交中击败了88.13%的用户 内存消耗 : 13.8 MB, 在所有 Python3 提交中击败了5.04%的用户 """ class Solution: def threeSumClosest(self, nums, target): nums = sort...
# admins defines who can issue admin-level commands to the bot. Looks like this: # admins = ["First Admin", "second admin", "xXx third admin-dono xXX"] #please be precise, else python pukes up an error. TIA. admins = ["Exo", "Kalikrates"] #This is the login infor for the account Cogito runs over. account= "Cogito" c...
"""Define class ModelParams which has relevant attributes Params ------ transmission_rate: float sip_start_date: int initial_infection_multiplier: float prison_infection_rate = None: float police_contact_rate = None: float police_group_size = int Returns ------- an object of the class ModelParams that has attributes ...
class Solution: def moveZeroes(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ index = 0 for i in range(0,len(nums)): if nums[i] != 0: nums[index] = nums[i] index...
class Fraction: def __init__(self, n, den=1): if isinstance(n, float): string = str(n) decimalCount = len(string[string.find("."):]) - 1 self.numerator = int(n * 10 ** decimalCount) self.denominator = int(10 ** decimalCount) self.reduce(self) ...
class NodeTemplate(object): def __init__(self, name): self.name = name def to_dict(self): raise NotImplementedError() def get_attr(self, attribute): return {'get_attribute': [self.name, attribute]} class RSAKey(NodeTemplate): def __init__(self, name, ...
class Solution: def findSmallestRegion(self, regions: List[List[str]], region1: str, region2: str) -> str: seen = set() graph = {} for nodes in regions: root = nodes[0] if root not in graph: graph[root] = root for child in nodes[1:]: ...
# -*- coding: utf-8 -*- """This module contains the blueprint app configuration""" # The namespace of the application. Used to prevent collisions in supporting services across # applications. If not set here, the app's enclosing directory name is used. # APP_NAMESPACE = 'app-name' # Dictionaries for the various NLP c...
class White(object): def __init__(self): self.color = 255, 255, 255 self.radius = 10 self.width = 10
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ CS231n Convolutional Neural Networks for Visual Recognition http://cs231n.github.io/ Python Numpy Tutorial http://cs231n.github.io/python-numpy-tutorial/  ̄ python_numpy_tutorial-python-basic_data_types.py 2019-07-03 (Wed) """ # Python Numpy Tutorial > Python > Basic ...
def linearSearch(arr, x): for i in range(len(arr)): if arr[i] == x: return i return -1 if __name__ == "__main__": arr = [0,1,2,3,4,5,6,7,8,9] x = 6 print("Value is present at index number: {}".format(linearSearch(arr,x)))
""" __init__.py Created by: Martin Sicho On: 4/27/20, 6:22 PM """ __all__ = tuple()
produtos = ('Lápís', 1.75, 'Borracha', 2.00, 'Caderno', 15.90, 'Estojo', 25.00, 'Transferidor', 4.20, 'Compasso', 9.99, 'Mochila', 120.32, 'Canetas', 22.30, 'Livro', 34.90) for prod in range(0, len(produtos)): if prod % 2 == 0: print(f'{produtos[prod]:.<30}', end='') else: print(f'...
#http://shell-storm.org/shellcode/files/shellcode-855.php #Author : gunslinger_ (yuda at cr0security dot com) def bin_sh(): shellcode = r"\x01\x60\x8f\xe2" shellcode += r"\x16\xff\x2f\xe1" shellcode += r"\x40\x40" shellcode += r"\x78\x44" shellcode += r"\x0c\x30" she...
SECRET_KEY = "GENERATA AL SETUP DI SEAFILE" DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'seahub-db', 'USER': 'UTENTE DB MYSQL', 'PASSWORD': 'INSERIRE LA PASSWORD DI MYSQL', 'HOST': '127.0.0.1', 'PORT': '3306', 'OPTIONS': { ...
""" A board of players for the Tsuro game. :Author: Maded Batara III :Version: v1.0 """ class PlayerBoard: """ A PlayerBoard is a representation of the Tsuro board as a 2D list. An R*C board in the game is represented by a 2D list with 2*R rows and (3*C)+1 columns. The R*C board will be referre...
# # PySNMP MIB module HUAWEI-IMA-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-IMA-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:45:04 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
class priorityqueue(): def __init__(self): self.data = [] def __repr__(self): return str(self.data) def add(self, i): if len(self.data) == 0: self.data.append(i) else: for j in range(len(self.data)): if self.data[j][1] >...
# encoding: utf-8 # home = "/home/xmxie/caoyananGroup/fangzheng/project/official_data/" home = "/Users/fang/people_dis/data/official_data/" # 比赛数据 train_data_path = home + "pubs_train.json" train_label_path = home + "assignment_train.json" validate_data_path = home + "pubs_validate.json" test_data_path = home + ...
class Account(object): @classmethod def all(cls, client): request_url = "https://api.robinhood.com/accounts/" data = client.get(request_url) results = data["results"] while data["next"]: data = client.get(data["next"]) results.extend(data["results"]) ...
## global strings for output dictionaries ## NAME = "name" TABLE = "table" FIELD = "field" TABLES = "tables" VALUE = "value" FIELDS = "fields" REPORT = "report" MRN = "mrn" DATE = "date" MRN_CAPS = "MRN" UWID = "uwid" ACCESSION_NUM = "accession" KARYO = "karyotype" KARYOTYPE_STRING = "KaryotypeString" FILLER_ORDER_NO =...
username = input('Enter your name: ') password = input('Enter your password: ') password_len = len(password) password_secret = '*' * password_len print(f'Your name is: {username} and your {password_secret} is {password_len} letters long.')
maxvalue = int(input("Until which value do you want to calculate the prime numbers?")) # The first prime, 2, we skip, so that afterwards we can make our loop faster by skipping all even numbers: print("The prime numbers under", maxvalue, "are:") print(2) # Break as soon as isprime is False for n in range(3, maxvalue ...
s,n = [int(x) for x in input().split()] arr = [] for _ in range(n): x,y = [int(x) for x in input().split()] arr.append((x,y)) arr.sort(key=lambda x: x[0]) msg = "YES" for i in range(n): x,y = arr[i] if s > x: s += y else: msg = "NO" break print(msg)
class ProfileParsingError(Exception): pass class RoleNotFoundError(Exception): def __init__(self, credential_method, *args, **kwargs): Exception.__init__(self, *args, **kwargs) # a string describing the IAM context self.credential_method = credential_method class AssumeRoleError(Excep...
#Lê o valor da variável a a = int(input("Leia o valor: ")) #Verifica se a é positivo ou negativo if a > 0: print ("O numero %d eh positivo" %a) else: print ("O numero %d eh negativo" %a)
name = 'Jatin Mehta' greeting = "Hello World, I am " print(greeting, name)
# Listing 26-1 # Copyright Warren & Carter Sande, 2013 # Released under MIT license http://www.opensource.org/licenses/mit-license.php # Version $version ---------------------------- # SI Bitwy pythonów - pierwsze podejście do pokonania OkreznaSI # Zwróć uwagę, że nie jest kompletny program Pythona # Jest to modu...
class Solution: def runningSum(self, nums: List[int]) -> List[int]: # 滑动窗口 tmp = 0 for i in range(len(nums)): tmp += nums[i] nums[i] = tmp return nums
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): # https://leetcode.com/problems/subtree-of-another-tree/solution/ def isSubtree(self, s, t): """ :typ...
for i in range(100, 1000): sum = 0 for s in range(0, 3): i = str(i) sum = sum + int(i[s]) ** 3 i = int(i) if sum == i: print(i) for i in range(1000, 10000): sum = 0 for s in range(0, 4): i = str(i) sum = sum + int(i[s]) ** 4 i = int(i) if ...
def check_user_timeblock_preference(section, preferences, sections_dict): for preference in preferences: if preference.object_1 == section.primary_instructor.user: color = sections_dict[section.id].get('color') if preference.weight: if section.timeblock == preference....
# Runs with PythonScript plugin # Copy to %APPDATA%\Roaming\Notepad++\plugins\config\PythonScript\scripts search_text_4 = '[4[' search_text_8 = '[8[' search_text_f = '[f[' search_text_h = '[h[' search_text_q = '[q[' search_text_i = '[i[' search_text_o = '[o[' search_text_R = '[R[' search_text_r = '[r[' search_text_S = ...
#! /usr/bin/env Pyrhon3 list_of_tuples_even = [] list_of_tuples_odd = [] for i in range(1, 11): for j in range(1, 11): if i % 2 == 0: list_of_tuples_even.append((i, j, i * j)) else: list_of_tuples_odd.append((i, j, i * j)) print(list_of_tuples_odd) print('****************...
#!/usr/bin/python3 for first_digit in range(10): for second_digit in range(first_digit+1, 10): if first_digit == 8 and second_digit == 9: print("{}{}".format(first_digit, second_digit)) else: print("{}{}".format(first_digit, second_digit), end=", ")
def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'): print("-- This parrot wouldn't", action, end =' ') print("if you put", voltage, "volts through it.") print("-- Lovely plumage, the", type) print("-- It's", state, "!") parrot(1000) parrot(voltage=1000000, action='VOOOOOM') par...
def decrypt(ciphertext, key): out = "" for i in range(2, len(ciphertext)): out += chr((((ciphertext[i] ^ (key*ciphertext[i-2])) - ciphertext[i-1]) ^ (key + ciphertext[i-1]))//ciphertext[i-2]) return out def solve(flag): text = ''.join(open("downloads/conversation", "r").readlines()) KEY = int(open("key", "r").r...
welcome_message = ''' ###################################################### Hello! This script pulls all the emails for a required mailing list and saves them as a text file in the "Output" folder. If you run in to problems, contact Matt Email: mrallinson@gmail.com ##############################################...
def solution(brown, yellow): answer = [] s = brown + yellow l = 1 while True: if yellow % l == 0: w = yellow / l print(w, l) if w < l: break if ((l+2)*(w+2)) == s: answer.append(w+2) answer.append(l+2...
# Copied from https://rosettacode.org/wiki/Greatest_common_divisor#Python def gcd_bin(u, v): u, v = abs(u), abs(v) # u >= 0, v >= 0 if u < v: u, v = v, u # u >= v >= 0 if v == 0: return u # u >= v > 0 k = 1 while u & 1 == 0 and v & 1 == 0: # u, v - even u >>= 1; v >>= 1...
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
# encoding: utf-8 # module _hashlib # from /usr/lib/python3.5/lib-dynload/_hashlib.cpython-35m-x86_64-linux-gnu.so # by generator 1.145 # no doc # no imports # functions def new(*args, **kwargs): # real signature unknown """ Return a new hash object using the named algorithm. An optional string argument m...
''' Created on 31 May 2015 @author: sl0 ''' HASH_LEN = 569
SEVERITY_WARNING = 2 SEVERITY_OK = 0 class CException(Exception): def __init__(self, *args, **kwdargs): pass def extend(self, *args, **kwdargs): pass def maxSeverity(self, *args, **kwdargs): return 0