content
stringlengths
7
1.05M
# From: http://wiki.python.org/moin/SimplePrograms, with permission from the author, Steve Howell BOARD_SIZE = 8 def under_attack(col, queens): return col in queens or \ any(abs(col - x) == len(queens)-i for i,x in enumerate(queens)) def solve(n): solutions = [[]] for row in range(n): s...
# -*- coding: utf-8 -*- """ VITA Person Registry, Controllers @author: nursix @see: U{http://eden.sahanafoundation.org/wiki/BluePrintVITA} """ prefix = request.controller resourcename = request.function # ----------------------------------------------------------------------------- # Options Menu (availabl...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. INITIAL_DATA_TO_COMPLETE = [ 'valid_0', 'valid_1', 'valid_10', 'valid_100', 'valid_101', 'valid...
#フロイドワーシャル法 INF=1<<60 N,M=6,9 dp=[[INF]*N for _ in range(N)]#N×Nの2次元リスト #初期化 #dp[a][b]=w dp[0][1]=3 dp[0][2]=5 dp[1][2]=4 dp[1][3]=12 dp[2][3]=9 dp[2][4]=4 dp[4][3]=7 dp[3][5]=2 dp[4][5]=8 for v in range(N): dp[v][v]=0 #更新 for k in range(N): for i in range(N): for j in range(N): dp[i][j]...
""" Question: Distinct ways to climb a n step staircase where each time you can either climb 1 or 2 steps. """ """ Solution 1: We can easily find recursive nature in above problem. The person can reach n’th stair from either (n-1)’th stair or from (n-2)’th stair. Let the total number of ways to reach n’t stair be ‘w...
def inicio(): print ("--PRINCIPAL--") print("1. AGREGAR") print("2. ELIMINAR") print("3. VER") opc = input ("------> ") return opc
n, m = map(int, input().strip().split()) matrix = [list(map(int, input().strip().split())) for _ in range(n)] k = int(input().strip()) for lst in sorted(matrix, key=lambda l: l[k]): print(*lst)
Nsweeps = 100 size = 32 for beta in [0.1, 0.8, 1.6]: g = Grid(size, beta) m = g.do_sweeps(0, Nsweeps) grid = g.cells mag = g.magnetisation(grid) e_plus = np.zeros((size, size)) e_minus = np.zeros((size, size)) for i in np.arange(size): for j in np.arange(size): e_plus[i,...
class Listing: def extrem(self, nvar1="", nvar2="", ninc="", **kwargs): """Lists the extreme values for variables. APDL Command: EXTREM Parameters ---------- nvar1, nvar2, ninc List extremes for variables NVAR1 through NVAR2 in steps of NINC. Variab...
load("@rules_maven_third_party//:import_external.bzl", import_external = "import_external") def dependencies(): import_external( name = "org_apache_maven_resolver_maven_resolver_api", artifact = "org.apache.maven.resolver:maven-resolver-api:1.4.0", artifact_sha256 = "85aac254240e8bf387d737a...
# Generic uwsgi_param headers CONTENT_LENGTH = 'CONTENT_LENGTH' CONTENT_TYPE = 'CONTENT_TYPE' DOCUMENT_ROOT = 'DOCUMENT_ROOT' QUERY_STRING = 'QUERY_STRING' PATH_INFO = 'PATH_INFO' REMOTE_ADDR = 'REMOTE_ADDR' REMOTE_PORT = 'REMOTE_PORT' REQUEST_METHOD = 'REQUEST_METHOD' REQUEST_URI = 'REQUEST_URI' SERVER_ADDR = 'SERVER...
class MachineDetails: """ Class to represent the HTB machine details """ def __init__(self, identifier, name, operating_system, ip, avatar, avatar_thumb, points, release, retired_date, maker, maker2, ratings_pro, ratings_sucks, user_blood, root_blood, user_owns, root_owns): s...
file1 = "" file2 = "" with open('Hello.txt') as f: file1 = f.read() with open('Hi.txt') as f: file2 = f.read() file1 += "\n" file1 += file2 with open('file3.txt', 'w') as f: f.write(file1)
ix.enable_command_history() ix.api.SdkHelpers.enable_disable_items_selected(ix.application, False) ix.disable_command_history()
# -*- coding: utf-8 -*- """ pepipost This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). """ class TimeperiodEnum(object): """Implementation of the 'Timeperiod' enum. The periodic \n\nAllowed values \"daily\", \"weekly\", \"monhtly\" Attributes: ...
#!/usr/bin/env python ###################################### # Installation module for King Phisher ###################################### # AUTHOR OF MODULE NAME AUTHOR="Spencer McIntyre (@zeroSteiner)" # DESCRIPTION OF THE MODULE DESCRIPTION="This module will install/update the King Phisher phishing campaign toolki...
num = int(input()) for i in range(1, num+1): s = '' for j in range(1, i): s += str(j) for j in range(i, 0, -1): s += str(j) print(s)
def replace_spaces_dashes(line): return "-".join(line.split()) def last_five_lowercase(line): return line[-5:].lower() def backwards_skipped(line): return line[::-2] if __name__ == '__main__': line = input("Enter a string: ") print(replace_spaces_dashes(line)) print(last_five_lowercase(lin...
# TODO: refactor nested_dict into common library with ATen class nested_dict(object): """ A nested dict is a dictionary with a parent. If key lookup fails, it recursively continues into the parent. Writes always happen to the top level dict. """ def __init__(self, base, parent): self....
""" This is the 'country_names' module. The country_names module consists of one dictionary which provides corrected or shortened versions of country names. """ names = {'Bolivia (Plurinational State of)':'Bolivia', 'Democratic People\'s Republic of Korea':'North Korea', 'Dem. People\'s Republic of ...
beggars_jobs = [int(x) for x in input().split(", ")] count_of_beggars = int(input()) final_list = [] for num in range(count_of_beggars): jobs = 0 for index in range(num, len(beggars_jobs), count_of_beggars): jobs += beggars_jobs[index] final_list.append(jobs) print(final_list)
# for xxx in で2次元リストを作る # 0 で初期化したリストを作成する # for ... in の末尾に:を置かない場合、 forの前に書かれた処理を実行する # range(i) は、0からi未満の整数を持つリストを返すので、forの前に書かれた処理をi回繰り返すことができる # このような記法を、Pythonではリスト内方表記と呼ぶ # 参考URL: https://note.nkmk.me/python-list-comprehension/ numbers = [0 for i in range(10)] print(numbers) print() # 2n+1の等比数列をのリストを作成する geome...
""" --- geometry parameters for simple geometry of cylindrical tube with spherical particle inside, 2D --- """ # length scale nm = 1e-0 # tolerance for coordinate comparisons tolc = 1e-9*nm dim = 2 # cylinder radius R = 40*nm # cylinder length l = 80*nm # particle position (z-axis) z0 = 0*nm # particle radius r = ...
try: raise except: pass try: raise NotImplementedError('User Defined Error Message.') except NotImplementedError as err: print('NotImplementedError') except: print('Error :') try: raise KeyError('missing key') except KeyError as ex: print('KeyError') except: print('Error :') try: ...
# Copyright (c) 2020-2021 Matematyka dla Ciekawych Świata (http://ciekawi.icm.edu.pl/) # Copyright (c) 2020-2021 Robert Ryszard Paciorek <rrp@opcode.eu.org> # # MIT License # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Soft...
""" Given a string s and an integer array indices of the same length. The string s will be shuffled such that the character at the ith position moves to indices[i] in the shuffled string. Return the shuffled string. Example: Input: s = "codeleet", indices = [4,5,6,7,0,2,1,3] Output: "leetc...
def extractBersekerTranslations(item): """ """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if 'Because the world has changed into a death game is funny' in item['tags'] and (chp or vol or 'Prologue' in postfix): return buildReleaseMessageWithType(item, 'Sekai ga death game ni natta ...
N = int(input()) combined_length = 0 for _ in range(N): length = int(input()) combined_length += length print(combined_length - (N-1))
class Resort: def __init__(self): self._mysql = False self._postgres = False self._borg = False def name(self, name): self._name = name return self def appendName(self, text): return text+self._name return self def storage(self, storage): ...
# -*- coding: utf8 -*- # Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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...
#! python3 # -*- coding: utf-8 -*- def method(args1='sample2'): print(args1 + " is runned") print("")
def extract_author(simple_author_1): list_tokenize_name=simple_author_1.split("and") if len(list_tokenize_name)>1: authors_list = [] for tokenize_name in list_tokenize_name: splitted=tokenize_name.split(",") authors_list.append((splitted[0].strip(),splitted[1].strip())) ...
class SwaggerYaml: def __init__(self, swagger, info, schemes, basePath, produces, paths, definitions): self.swagger = swagger self.info = info self.schemes = schemes self.basePath = basePath self.produces = produces self.paths = paths self.definitions = def...
# ------------------------------ # 401. Binary Watch # # Description: # A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59). # Each LED represents a zero or one, with the least significant bit on the right. # # Given a non-negative integer n...
""" Question: Implement Queue using Stacks Implement the following operations of a queue using stacks. push(x) -- Push element x to the back of queue. pop() -- Removes the element from in front of queue. peek() -- Get the front element. empty() -- Return whether the queue is empty. Notes:...
#Tuplas são imutavéis lanche = ('hamburguer','suco','pizza','pudim', 'batata frita') print(sorted(lanche)) print(len(lanche)) print(lanche) print(lanche[2]) for comida in lanche: print('Eu vou comer {}'.format(comida)) print('Comi pra caramba') for cont in range(0, len(lanche)): print (lanche[cont]) print('...
print("Sum > ") num1 = input("First number : ") num2 = input("second number : ") print(int(num1) + int(num2)) # 빼기, 곱하기, 나누기, 나머지 print(int(num1) - int(num2)) print(int(num1) * int(num2)) print(int(num1) / int(num2)) print(int(num1) % int(num2)) if(int(num1)%2 == 0): print("num1 is even") else: print("num1 i...
# Temperature of an oven setting by reading from a pressure meter r = int(input("Enter the reading:- ")) if( (r == 2) or (r == 3) ): print("Temperature set to 500 degrees.") elif( r==4): print("Temperature set to 600 degrees.") elif((r==5)or(r==6)or(r==7)): print("Temperature set to 700 degrees.") ...
# tested def Main(): a = 1 b = 10 c = 20 d = add(a, b, 10) d2 = add(d, d, d) return d2 def add(a, b, c): result = a + b + c return result
# # @lc app=leetcode id=779 lang=python3 # # [779] K-th Symbol in Grammar # # @lc code=start class Solution(object): def kthGrammar(self, N, K): """ :type N: int :type K: int :rtype: int """ if N == 1: return 0 if K == 2: return 1 if K <= 1 << N - 2: ...
#!/usr/bin/env python ######################################################################################### # # Test function sct_documentation # # --------------------------------------------------------------------------------------- # Copyright (c) 2014 Polytechnique Montreal <www.neuro.polymtl.ca> # Author: Aug...
power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate...
# encoding: utf-8 # module Tekla.Structures.Geometry3d calls itself Geometry3d # from Tekla.Structures,Version=2017.0.0.0,Culture=neutral,PublicKeyToken=2f04dbe497b71114 # by generator 1.145 # no doc # no imports # no functions # classes class AABB(object): """ AABB() AABB(MinPoint: Point,MaxPo...
a=2 b=3 #三目运算符 str='a>b'if a>b else 'a<b' print(str)
nilai = 9 if (nilai > 7): print ("Selamat Anda Jadi programmer") if (nilai > 10): print ("Selamat Anda Jadi programmer handal")
# list all array connections res = client.get_array_connections() print(res) if type(res) == pypureclient.responses.ValidResponse: print(list(res.items)) # list all array connections with remote name "otherarray" res = client.get_array_connections(remote_names=["otherarray"]) print(res) if type(res) == pypureclient...
#num=[2,5,9,1] #num[2]=3 #na posiçao 2 vai mudar de 9 para virar 3 #num.append(7) #estou adicionando o valor 7 #num.sort(reverse=True) #ordem reversa #num.insert(2,0) #inseri um valor e reordena automaticamente o resto, na posição 2, vai inserir o valor 0 #num.pop(2) ...
kanto, johto, hoenn = input().split() catch_kanto, catch_johto, catch_hoenn = input().split() total_kanto = int(kanto) + int(catch_kanto) total_johto = int(johto) + int(catch_johto) total_hoenn = int(hoenn) + int(catch_hoenn) print(f"{total_kanto} {total_johto} {total_hoenn}")
{ 'variables': { 'external_libmediaserver%' : '<!(echo $LIBMEDIASERVER)', 'external_libmediaserver_include_dirs%' : '<!(echo $LIBMEDIASERVER_INCLUDE)', }, "targets": [ { "target_name": "medooze-fake-h264-encoder", "cflags": [ "-march=native", "-fexceptions", "-O3", ...
class Solution: def reverseVowels(self, s: str) -> str: vowels = {"a", "e", "i", "o", "u", "A", "E", "I", "O", "U"} ns = [e for e in s] left, right = 0, len(s) - 1 while right > left: while s[left] not in vowels and left < right: left += 1 ...
def reverse(string): return string[::-1] print('Gimmie some word') s = input() print(reverse(s))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # 集合 basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'} print(basket) # 判断是否在集合中 print('orange' in basket) # 初始化 a = set('abracadabra') print(a)
""" External repositories used in this workspace. """ load("@bazel_gazelle//:deps.bzl", "go_repository") def go_repositories(): go_repository( name = "co_honnef_go_tools", importpath = "honnef.co/go/tools", sum = "h1:/hemPrYIhOhy8zYrNj+069zDB68us2sMGsfkFJO0iZs=", version = "v0.0.0-...
"""Load dependencies needed to compile and test the grpc library as a 3rd-party consumer.""" def grpc_deps(): """Loads dependencies need to compile and test the grpc library.""" pass
# Roman Ramirez, rr8rk@virginia.edu # Advent of Code 2021, Day 14: Extended Polymerization #%% LONG INPUT my_input = [] with open('input.txt', 'r') as f: for line in f: my_input.append(line.strip('\n')) #%% EXAMPLE INPUT my_input = [ 'NNCB', '', 'CH -> B', 'HH -> N', 'CB -> H', ...
board = sum([list(input()) for _ in range(3)], []) assert(board[4] == '1') rest = list(range(2, 10)) clock = [1, 2, 5, 0, -1, 8, 3, 6, 7] cclock = [3, 0, 1, 6, -1, 2, 7, 8, 5] for start in [1, 3, 5, 7]: for next_idx in [clock, cclock]: now = start ans = board[:] for i in rest: if...
class UnmodifiableModeError(Exception): """Raised when file-like object has indeterminate open mode.""" def __init__(self, target, *args, **kwargs): super().__init__(target, *args, **kwargs) self.target = target def __repr__(self): return '{}: {}'.format(self.__class__.__name__, se...
# -*- coding: utf-8 -*- ''' Created on 1983. 08. 09. @author: Hye-Churn Jang, CMBU Specialist in Korea, VMware [jangh@vmware.com] ''' name = 'Project' # custom resource name sdk = 'vra' # imported SDK at common directory inputs = { 'create': { 'VraManager': 'constant' }, 'read': { ...
# coding=utf-8 class DictProxy(object): store = None def __init__(self, d): self.Dict = d super(DictProxy, self).__init__() if self.store not in self.Dict or not self.Dict[self.store]: self.Dict[self.store] = self.setup_defaults() self.save() self.__initia...
class TextBoxBase(FocusWidget): def getCursorPos(self): try : elem = self.getElement() tr = elem.document.selection.createRange() if tr.parentElement().uniqueID != elem.uniqueID: return -1 return -tr.move("character", -65535) except: ...
strategies = {} def strategy(strategy_name: str): """Register a strategy name and strategy Class. Use as a decorator. Example: @strategy('id') class FindById: ... Strategy Classes are used to build Elements Objects. Arguments: strategy_name (...
def shape(A): num_rows = len(A) num_cols=len(A[0]) if A else 0 return num_rows, num_cols A=[ [1,2,3], [3,4,5], [4,5,6], [6,7,8] ] print(shape(A))
class ContentUnavailable(Exception): """Raises when fetching content fails or type is invalid.""" def __init__(self, *args, **kwargs) -> None: super().__init__(*args, **kwargs) class ClosedSessionError(Exception): """Raises when attempting to interact with a closed client instance.""" def __...
INT_LITTLE_ENDIAN = '<i' # little-endian with 4 bytes INT_BIG_ENDIAN = '>i' # big-endian with 4 bytes SHORT_LITTLE_ENDIAN = '<h' # little-endian with 2 bytes SHORT_BIG_ENDIAN = '<h' # big-endian with 2 bytes
''' lab2 ''' #3.1 my_name = 'Tom' print(my_name.upper()) #3. my_id = 123 print(my_id) #3.3 #123=my_id my_id=your_id=123 print(my_id) print(your_id) #3.4 my_id_str = '123' print(my_id_str) #3.5 #print(my_name=my_id) #3.6 print(my_name+my_id_str) #3.7 print(my_name*3) #3.8 print('hello, world. This is my first...
# list-comp = list comprenhension symbols = "$¢£¥€¤" # List comprenhensions and readability # Example 2-1. Build a list of Unicode codepoints from a string. codes = [] for symbol in symbols: codes.append(ord(symbol)) # ord(): char to int print(f"good old for loop: {codes}") # Example 2-2. Build a list of Unicode...
def sqrt(x): """for x>=0, return non-negative y such that y^2 = x""" estimate = x/2.0 while True: newestimate = ((estimate+(x/estimate))/2.0) if newestimate == estimate: break estimate = newestimate return estimate print("The answer is ", sqrt(2.0)) print("That answe...
"""Folder structure of the platform.""" class Folders: """Class containing the relevant folders of the platforms. The members without underscore at the beginning are the exported (useful) ones. The tests folders are omitted. """ _ROOT = "/opt/dike/" _CODEBASE = _ROOT + "codebase/" _DATA ...
def vampire_test(x, y): product = x * y if len(str(x) + str(y)) != len(str(product)): return False for i in str(x) + str(y): if i in str(product): return True else: return False
""" 8393 : 합 URL : https://www.acmicpc.net/problem/8393 Input : 3 Output : 6 """ n = int(input()) sum = 0 for i in range(1, n + 1): sum += i print(sum)
# -*- coding: utf-8 -*- ''' 월간 코딩 챌린지 시즌 2 - 두개 뺴서 더하기 ''' def solution(numbers): answer = set() num_len = len(numbers) for i in range(num_len): for j in range(num_len): if i != j: answer.add(numbers[i] + numbers[j]) answer = list(answer) answer.sort(...
#!/usr/bin/env python class Config(object): GABRIEL_IP='128.2.213.107' RECEIVE_FRAME=True VIDEO_STREAM_PORT = 9098 RESULT_RECEIVING_PORT = 9101 TOKEN=1
# October 2018 ''' cifero.sheets Modules syll and translit use cifero.sheets.sheetsdict in their functions. ''' ################################################################################ # default cipher sheets # better not change these # these aren't linked to the main program. ipa_sheet = { 'title': 'IP...
""" link: https://leetcode-cn.com/problems/sequence-reconstruction problem: 给数组 org,与数组集合seqs,问能否满足 seqs 中的数组均为 org 的子序列, 且不存在另一个不同的 org' 满足 seqs 中元素也均为其子序列 solution: 拓扑排序。根据 seqs 中每个数组 seq,构建 seq[i] --> seq[i+1] 的图m,若该图的唯一拓扑序为 org,则满题意。 """ class Solution: def sequenceReconstruction(self, org: List[...
c = 0 n = (int(input('Digite um valor: ')), int(input('Digite outro valor: ')), int(input('Digite mais um valor: ')), int(input('Digite o último valor: '))) print(f'Os valores digitados foram: {n}') print(f'O número 9 apareceu {n.count(9)} veze(s)') if 3 in n: print(f'O número 3 apareceu pela primeira vez na ...
"""The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ?""" # from math import sqrt, ceil NUMB = 600851475143 FACTOR = 2 PRIME_ARY = [] DIVIDER_ARY = [] while FACTOR <= NUMB: for i in PRIME_ARY: if FACTOR % i == 0: break else: ...
def isEvilNumber(n): count = 0 for char in str(bin(n)[2:]): if char == '1': count += 1 if count % 2 == 0: return True else: return False print(isEvilNumber(4))
b1 >> fuzz([0, 2, 3, 5], dur=1/2, amp=0.8, lpf=linvar([100, 1000], 12), lpr=0.4, oct=3).every(16, "shuffle").every(8, "bubble") d1 >> play("x o [xx] oxx o [xx] {oO} ", room=0.4).every(16, "shuffle") d2 >> play("[--]", amp=[1.3, 0.5, 0.5, 0.5], hpf=linvar([6000, 10000], 8), hpr=0.4, spin=4) p1 >> pasha([0, 2, 3, 5], dur...
class Dog: def __init__(self, age, name, is_male, weight): self.age = age self.name = name self.is_male = is_male # Boolean. True if Male, False if Female. self.weight = weight # Create your instance below this line my_dog = Dog(5, "Yogi", True, 15)
class TimetableException(Exception): """Base class exception.""" class TimetableNotFound(TimetableException): def __init__(self, timetable_set): self.timetable_set = timetable_set super().__init__(f'timetable set not found: \'{timetable_set}\'') class RequestedDayNotSupported(Tim...
""" Takes in a fasta file and creates a javascript variable containing protein accession number --> protein sequence objects ---------------------------------------------------------------- Industrial Microbes C 2017 All Rights Reserved Contact: J Paris Morgan (jparismorgan@gmail.com) or Derek Greenfield (derek@imicrob...
# https://www.codechef.com/viewsolution/36973732 for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) count = 0 for i in range(n): for j in range(i + 1, n): if a[i] & a[j] == a[i]: count += 1 print(count)
""" Lambda functions Functions without names, kind of similar to arrow functions in JavaScript. """ square = lambda num: num * num print(square(9)) # 81 add = lambda a,b: a + b print(add(3,10)) # 13
""" 428. Pow(x, n) https://www.lintcode.com/problem/powx-n/description?_from=ladder&&fromId=152 """ class Solution: """ @param x {float}: the base number @param n {int}: the power number @return {float}: the result """ def myPow(self, x, n): # write your code here if n == 0: ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ __project__ = 'leetcode' __file__ = '__init__.py' __author__ = 'king' __time__ = '2020/1/31 20:25' _ooOoo_ o8888888o 88" . "88 (| -_- |) ...
# This should be an enum once we make our own buildkite AMI with py3 class SupportedPython: V3_8 = "3.8.1" V3_7 = "3.7.6" V3_6 = "3.6.10" V3_5 = "3.5.8" V2_7 = "2.7.17" SupportedPythons = [ SupportedPython.V2_7, SupportedPython.V3_5, SupportedPython.V3_6, SupportedPython.V3_7, ...
#!/usr/bin/env python3 """Basic utilities for nova""" class _superpass(object): """Simple object to be a placeholder""" def __getattr__(self, name): return self def __setattr__(self, name, value): return def __delattr__(self, name): return def __getitem__(self, name)...
print( 3 + 4, 3 - 4, 3 * 4, 3 / 4, 3 ** 4, 3 // 4, 3 % 4) # 2
print ('\n\nSistema de Cadastro Pessoal') print ('______________________________________') nome = input('\nESCREVA SEU NOME COMPLETO.: ') idade = int(input('\nDIGA QUANTOS ANOS VOCÊ TEM?.: ')) peso = input('\nDIGITE SEU PESO !.: ') print('========================================================\n') print ('Seu nome ...
#Project Euler Problem 14 y=True i=1 maxz=0 while i <= 1000000: i=i+1 c=0 y=True n=i while y: if n % 2 == 0: n=n/2 else : n=3 * n + 1 c=c+1 if c > maxz: maxz=c x=i if n == 1: y=False print("max: ",max...
# -*- coding: utf-8 -*- TESTING = True SECURITY_PASSWORD_HASH = 'plaintext' SQLALCHEMY_DATABASE_URI = 'sqlite://' SLIM_FILE_LOGGING_LEVEL = None # LOGIN_DISABLED = True # PRESERVE_CONTEXT_ON_EXCEPTION = False
#REPRODUZIR ARQUIVO DE ÁUDIO """import pygame pygame.init() pygame.mixer.music.load('ex021.ogg') pygame.mixer.music.play() pygame.event.wait()""" #NÃO DEU CERTO
# File: atbash_cipher.py # Purpose: Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East. # Programmer: Amal Shehu # Course: Exercism # Date: Thursday 3rd September 2016, 09:15 PM alpha = "abcdefghijklmnopqrstuvwxyz" rev = list(alpha)[::-1] sto...
# Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> "Exceptions definition." class ElementNotFound(Exception): """Raised when an element is not found. Selenium has it's own exception but when we're iterating through multiple elements and expect one, we ra...
def _root_path(f): if f.is_source: return f.owner.workspace_root return "/".join([f.root.path, f.owner.workspace_root]) def _colon_paths(data): return ":".join([ f.path for f in sorted(data) ]) def encode_named_generators(named_generators): return ",".join([k + "=" + v for ...
''' pegue o preco dos produto e some usando compreeção de lista ''' carrinho = [] carrinho.append(('Produto 1', 40)) carrinho.append(('Produto 2', 10)) carrinho.append(('Produto 3', 50)) carrinho.append(('Produto 4', 20)) carrinho.append(('Produto 5', 10)) valor = sum([float(val) for prod, val in carrinho]) print(v...
## Дано координати двох точок на площині, потрібно визначити, чи лежать вони в одній координатної чверті чи ні (всі координати відмінні від нуля). ## ## формат введення ## ## Вводяться 4 числа: координати першої точки (x1, y1) і координати другої точки (x2, y2). ## ## формат виведення ## ## Програма повинна вивести сло...
__author__ = "Marten Scheuck" """This runs the Linux Version of the AWC""" def main(): """Main function to run all the code""" ... if __name__ == "__main__": ...
class DBRouter(object): def db_for_read(self, model, **hints): if model._meta.app_label == 'panglao': return 'panglao' if model._meta.app_label == 'cheapcdn': return 'cheapcdn' if model._meta.app_label == 'lifecycle': return 'lifecycle' return 'def...
# -*- coding: utf-8 -*- def echofilter(): print("OK, 'echofilter()' function executed!")