content
stringlengths
7
1.05M
""" File: caesar.py ------------------------------ This program demonstrates the idea of caesar cipher. Users will be asked to input a number to produce shifted ALPHABET as the cipher table. After that, any strings typed in will be encrypted. """ # This constant shows the original order of alphabetic sequence ALPHABE...
class TraceLogger( object ): def __init__( self, name ): self.name = name def log( **kwargs ): raise TypeError( "Abstract Method" )
class Libro: def __init__(self, nombre, genero, numero_paginas, autor, ISBN): self.nombre = nombre self.genero = genero self.numero_paginas = numero_paginas self.autor = autor self.ISBN = ISBN def get_nombre(self): return self.nombre def set_nombre(self, a):...
'''给定一个仅包含大小写字母和空格 ' ' 的字符串,返回其最后一个单词的长度。 如果不存在最后一个单词,请返回 0 。 说明:一个单词是指由字母组成,但不包含任何空格的字符串。 示例: 输入: "Hello World" 输出: 5 ''' class Solution: def lengthOfLastWord(self, s): """ :type s: str :rtype: int """ wordLength = 0 for cha in s[::-1].str...
"""Helper classes for managing state""" class GithubSearchContext(): """Search Context class for manageing search state. Parameters: ----------- context = The name of the repo, org, or user you are searching scope = {user, org, repo} find = Text to find in the repo replace_with = Replacement str...
def get_binary_nmubmer(decimal_number): assert isinstance(decimal_number, int) return bin(decimal_number) print(get_binary_nmubmer("10"))
""" Adding a small value several times to a large value leads to an error. Adding 10^-6 to 10^9 over 10^6 times and then subtracting 10^9. Ideally the answer should be 1, but the program gives output as 0.9537 which is large error. Run the same program by replacing 10^9 with 1 The error becomes very tiny. """ big_num =...
r""" Pore-scale models for calculating the conductance of conduits. """ __all__ = ["_poisson_conductance"] def _poisson_conductance(target, pore_conductivity=None, throat_conductivity=None, size_factors=None): r""" Calculates the condu...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue May 8 16:07:04 2018 @author: wolfensb """
x = 20 y = 30 print((x==25 and y==30)) print((x==25 or y==30)) print(not(x==25 or y==30)) print((not(x==25) and y==30))
def contains_only_pdf(files): file_paths = [] for file_path in files: file_paths.append(file_path) for file_path in file_paths: pd = file_path.lower()[-4:-1] if pd + 'f' != '.pdf': return False return True
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri May 28 09:04:40 2021 @author: zmg """
""" Ejercicio 4 Para tomar texto por consola se utiliza el comando: input() Tome un nombre por consola y presente en pantalla de la consola la oracion: Hola nombre bienvenido! """ print(f"Ingrese su nombre:") p = input() print(f"Hola {p} bienvenido")
myFile = open("system-charset.bin", "rb") unshiftedFileBytes = myFile.read() myFile.close() myFile = open("system-charset-lower.bin", "rb") shiftedFileBytes = myFile.read() myFile.close() asciiBytes = [0]*8*32 # control characters asciiBytes += shiftedFileBytes[32*8:64*8] # punctuation and numbers asciiBytes += ...
# AISH AND XOR N = int(input().strip()) Arr = [0] + [int(a) for a in input().strip().split()] for i in range(int(input())): q = [int(a) for a in input().strip().split()] l = q[0] r = q[1] subArr = Arr[l:r+1] subArr1 = subArr.count(1) subArr0 = subArr.count(0) ans = "" if (subArr1)%2==0:...
class Email: def __init__(self, subject: str = "None", plaintext: str = "None", attachments: list = [], from_address: str = None, recipients: str = None, html: str = None): self.subject = subject self.plaintext = plaintext self.attachments =...
# Copyright (c) 2016 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 applic...
data_atual = str ( input ('Data atual ? ')).strip().split('/') data_nasc = str ( input ('Data de nascimento ? ')).strip().split('/') # idade do indivíduo será cauculada por esse algoritimo if ( int( data_atual[0]) < 31) and ( int(data_atual[1]) <= 12) and ( int(data_nasc[0]) < 31 ) and ( int(data_nasc[1]) <= 12 ): ...
for count in range(1,10): print(count) print(count * count) for letter in "coffee": print(letter)
class BaseHandler: '''Abstract handler for send emails''' def send_mail(self, message): raise NotImplementedError('Not implemented in abstract class')
__author__ = 'Aaron Yang' __email__ = 'byang971@usc.edu' __date__ = '8/17/2020 3:31 PM' class Solution: def merge(self, nums1, m: int, nums2, n: int) -> None: """ Do not return anything, modify nums1 in-place instead. """ if n != 0: nums1[m:m + n] = nums2 ...
t = int(input()) while t: t-=1 n = int(input()) print(n//2)
{ "targets": [ { "target_name": "re2", "sources": [ "lib/addon.cc", "lib/new.cc", "lib/exec.cc", "lib/test.cc", "lib/match.cc", "lib/replace.cc", "lib/search.cc", "lib/split.cc", "lib/to_string.cc", "lib/accessors.cc", ...
""" Entradas a-->int-->a b-->int-->b c-->int-->c Salidas e-->int-->e """ a=int(input("digite el valor de a: ")) b=int(input("digite el valor de b: ")) c=int(input("digite el valor de c: ")) #caja negra d=b**2-4*a*c if (d==0): e=-b/(2*a) elif (d>0): e="X1= "+str((-b+(b**2-4*a*c)**(1/2))/(2*a))+" y X2= "+str((-b-...
# 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): def constructMaximumBinaryTree(self, nums): """ :type nums: List[int] :rtype: TreeNode ""...
Sbox =( 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, ...
# Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # @param root, a tree node # @param sum, an integer # @return a boolean def hasPathSum(self, root, sum): if root == N...
def same_doc_as(source): def wrapper(target): target.__doc__ = source.__doc__ return target return wrapper
USER_AGENT_WECHAT = [ 'Mozilla/5.0 (Linux; Android 7.1.1; MI 6 Build/NMF26X; wv) AppleWebKit/537.36 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/6.6.1.1220(0x26060135) NetType/WIFI Language/zh_CN', 'Mozilla/5.0 (Linux; Android 7.1.1; OD103 Build/NMF26F; wv) AppleWebKit/537.36 (KHTML, like Gecko) Mobile/11D2...
""" This file creates a grid of stars for the HRD plot """ # use solar and low metallicity metallicities = [0.0142, 0.001] # circular binaries with a separation so wide that they are effectively single eccentricity = 0.0 a = 1e20 with open("grid.txt", "w") as f: # mass range: basically logspace from 0.5 to 50 bu...
button_icon=b''' iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7E AAAOxAGVKw4bAAABg0lEQVQ4jZ3TvWsVQRQF8N9bwhZiZWFlMQSxsFIEW9eY gCEKIgj2IsFWwX9ALAQbOz/KlFZWIsjLFMFKgoSg2MgSgqBFCBIkDEEsdvZl XJ4Wnmpn9pw7c+49MzJA29SncBvzmM3bWxjjWYjpY8kfFcIZPMRdzAwLZ/zC U9wLMe1PCmTxS1z7i3CIt7gaYtqv8saDQryH7S...
total = maismil = barato = cont = 0 nomebarato = '' print('\033[1;97m-' * 18) print('| \033[91mLoja do Xandão \033[97m|') print('-' * 18) while True: produto = str(input('Nome do produto: ')).strip() preco = ' ' while not preco.isnumeric(): preco = input('Preço: \033[93mR$') preco = int(preco) ...
""" Given a string, find the length of the longest substring without repeating characters. """ def longest_no_repeat(string: str) -> int: """Return longest length of a substring with no repeating characters.""" last_seen = {} max_so_far = 0 current_streak = 0 for i, letter in enumerate(string): ...
ar = list(map(int, input().split())) for i in range(len(ar)): nr = ar[i] is_top = True for next_i in range (i +1, len(ar)): next_nr = ar[next_i] if nr <= next_nr: is_top = False break if is_top: print(nr, end = ' ')
#!/usr/bin/env python NAME = 'Armor Defense (Armor)' def is_waf(self): for attack in self.attacks: r = attack(self) if r is None: return _, page = r # Armor reveals itself only in blockpage twice. if any(i in page for i in (b'blocked by website protection from...
# faça um programa que leia o peso de cinco pessoas. no final mostre qual foi o maior # qual foi o menor maior = menor = 0 for c in range(1, 6): peso = float(input(f'Digite o pesso da {c}°: ')) if c == 1: maior = peso menor = peso else: if peso > maior: maior = peso ...
__version__ = "0.1.1" __author__ = "Arie Bovenberg" __copyright__ = "2018, Arie Bovenberg" __license__ = 'Apache 2.0' __description__ = 'Capable GraphQL client'
class Solution: def findErrorNums(self, nums: List[int]) -> List[int]: L = [None, None] sorted_nums = sorted(nums) prev = 0 for current in sorted_nums: if current - prev == 1: pass elif current - prev == 0: L[0] = current ...
''' map loop ''' def main(): a = {'x':100, 'y':200} b = '' c = 0 for key,value in a: b += key c += value print( b ) print( c )
class Parameters: def __init__(self, server: str, login: str, password: str, period: float): self.server = server self.login = login self.password = password self.period = period @classmethod def from_dict(cls, config: dict): return cls(str(config['imap_server']), ...
#two dimentional lists #inside number_grid list there are four elements which themselves are lists. number_grid = [ [1, 2, 3], [4, 5, 6], [7, 8, 9], [0] ] #prints the first index of the first array. print(number_grid[0][0]) #prints the second index of the third array. print(number_grid[2][1]) #how...
print('\n') ''' a classe type, é de onde se herda para criar classes ''' class Pai: nome = 'Teste' A = type('A', (Pai,), {'attr': 'Olá, mundo'}) a = A() print(a.attr) print(a.nome)
my_dict = {"one":1, "two":2, "three":3} print (my_dict) print(len(my_dict)) if ("one" in my_dict): print (my_dict["one"]) else: print("nothing found")
#!/usr/bin/python def printme3( str ): "This prints a passed string into this function" print(str) return def printme3too( str ): "This prints a passed string into this function" print(str) return
#coding=utf-8 #人生不同阶段P76 2017.4.14 age = 1 while age>0: try: age = input('please input your age (input 0 to exit)\n') age = int(age) except: print("ERROR INPUT,please input a right age!\n") age = 1 continue if age<2: print('You are just a little baby') elif age>=2 and age<4: print('oh~ You should lear...
''' Accept a number and reverse it account for leading zeros ''' n=int(input("No.: ")) n=str(n) w='' ''' Using the opposite indexing i.e. if s= '2 3 4' then indices= -3 -2 -1 ''' for i in range(1,len(n)+1): w+=n[-i] n='' print(int(w))
''' Estes exercícios fazem parte do curso de Introdução a Algoritmos, ministrado pelo prof. Gustavo Guanabara e podem ser encontrados no site https://www.cursoemvideo.com/wp-content/uploads/2019/08/exercicios-algoritmos.pdf 56) Crie um programa que leia vários números pelo teclado e mostre no final o somatório en...
# The name of the panel group to be added to HORIZON_CONFIG. Required. PANEL_GROUP = 'second_panel_group' # The display name of the PANEL_GROUP. Required. PANEL_GROUP_NAME = 'Second Plugin Panel Group' # The name of the dashboard the PANEL_GROUP associated with. Required. PANEL_GROUP_DASHBOARD = 'admin'
# Copyright (c) 2017 Wladimir J. van der Laan # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ####### Expressions ######## class Expression: '''Base class for expression node''' pass class OpExpression(Expression): '...
list = \ [ unichr(79) + unichr(110) + unichr(32) + unichr(109) + unichr(121) + unichr(32) + unichr(119) + unichr(97) + unichr(121), unichr(65) + unichr(108) + unichr(109) + unichr(111) + unichr(115) + unichr(116) + unichr(32) + unichr(104) + unichr(111) + unichr(109) + unichr(101), unichr(73) + unichr(110) + uni...
def rabbit_fib(n, k, start): if n == 0: return 0 if n == 1: return start else: return rabbit_fib(n - 1, k, start) + (k * rabbit_fib(n - 2, k, start)) print(rabbit_fib(5, 3, 1))
#Clase Nodo class Nodo: def __init__(self, id): self.id = id self.grado=0 #Parametros algoritmo de dijkstra self.padre=None self.visitado=False self.distancia=float('inf') def __str__(self): return str(self.id) def __eq__(self, otroNodo): return self.id == otroN...
""" Question: Valid parenthesis Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the correct order, "()" and "()[]{}" are all valid but "(]" and "([)]" are not. Performance: 1. Total Accepted: 71155 Total...
class Parser: def __init__(self, builtins): self.builtins = builtins def parse(self): pass def get_parser(self): pass
"Este script es para saber que usuarios tengo definido" "seria mi ""base de datos"" jaja" class DatosUsuarios(): def leer_datos(self): archivo = open("wsgi/module_login/usuarios", "r") self.list_usuarios = [] self.list_password = [] self.list_permisos = [] for line in archivo.readlines(): ...
""" Ejercicio 05 Un alumno desea saber cuál será su calificación final en la materia de computación. Dicha calificación se compone de los siguientes porcentajes: 55% del promedio de sus tres calificaciones parciales, 30% de la calificación del examen final y 15% de la calificación de un trabajo final. Entradas Nota_Pa...
''' A dictionary that maps a file extension to its type. ''' FILE_TYPES = { "!BT": "Misc", "!QB": "Misc", "!SYNC": "Misc", "!UT": "Misc", "$$$": "Backup", "$01": "Code", "$DB": "Backup", "$ER": "Database", "0": "Compressed", "00": "Game file", "000": "Misc", "001": "Back...
total = totmil = cont = menor = 0 barato = '' while True: produto = str(input('Nome do produto: ')) preco = float(input('Preço: ')) cont += 1 total += preco if preco > 1000: totmil += 1 if cont == 1 or preco < menor: menor = preco barato = produto resposta = ' ' ...
#! /usr/bin/env python3 # -*- coding: utf-8 -*- """ Describes cellular model for development purposes. """ __author__ = 'Ari Saha (arisaha@icloud.com)' __date__ = 'Tuesday, March 6th 2018, 10:08:50 am'
#!/usr/bin/env python # encoding: utf-8 """ @author: puyangsky @file: model.py @time: 2018/6/2 下午6:43 """ class User(object): def __init__(self, uid, username, avatar, gender): self.uid = uid self.username = username self.avatar = avatar self.gender = gender
# Licensed under a 3-clause BSD style license - see LICENSE.rst class Suite: def named_method(self): return 0 named_method.benchmark_name = 'custom.track_method' def named_function(): pass named_function.benchmark_name = 'custom.time_function' named_function.pretty_name = 'My Custom Function'...
class Solution: def orangesRotting(self, grid: List[List[int]]) -> int: # BFS, min minutes is how many level to reach the bottom queue = collections.deque() for i in range(len(grid)): for j in range(len(grid[0])): if grid[i][j] == 2: ...
# Time: O(n * 2^n) # Space: O(n), longest possible path in tree, which is if all numbers are increasing. class Solution(object): def findSubsequences(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ def findSubsequencesHelper(nums, pos, seq, resul...
class Solution: def reverseString(self, s: List[str]) -> None: """ Do not return anything, modify s in-place instead. """ self.reverseString1(s) def reverseString1(self, s: List[str]) -> None: end = len(s) last_index = len(s) - 1 for offset in range(len(s...
SOURCE = [ [41, -61, 41, 98, -74, -66, -61, -75, -44, 93, 99, -57, -11, 41, 44, -64, 52, 27, -87, -85], ] DESTINATION = [ [-87, -85, -75, -74, -66, -64, -61, -61, -57, -44, -11, 27, 41, 41, 41, 44, 52, 93, 98, 99], ] def validate(func): for n, data in enumerate(SOURCE): data_copy = data[:] ...
def readBinFile(fname): """ Read a binary FCS data file, containing a list of U64 numbers that represent the photon counts per time bin of 1 µs. Each pair of two numbers contains the information of all 25 detector elements in a single time bin. ========== ==================================...
# DROP TABLES songplay_table_drop = "DROP TABLE IF EXISTS songplays;" user_table_drop = "DROP TABLE IF EXISTS users;" song_table_drop = "DROP TABLE IF EXISTS songs;" artist_table_drop = "DROP TABLE IF EXISTS artists;" time_table_drop = "DROP TABLE IF EXISTS time;" # CREATE TABLES songplay_table_create = (""" CRE...
x = [()] x = [(a)] x = [(a,)] x = [(a)] x = [(a,)] x = [a, b] x = [(a, b)] x = [(a, b, c)]
# https://leetcode.com/problems/find-the-difference/description/ # # algorithms # Easy (52.06%) # Total Accepted: 124.1k # Total Submissions: 238.4k class Solution(object): def findTheDifference(self, s, t): """ :type s: str :type t: str :rtype: str """ length = l...
class Solution: def XXX(self, x: int) -> int: if x != 0: if x > 0: num = str(x)[::-1] else: num = '-' + str(-x)[::-1] num = int(num) return num if num < 2 ** 31 and num >= - 2 ** 31 else 0 return 0
# Event: LCCS Python Fundamental Skills Workshop # Date: Dec 2018 # Author: Joe English, PDST # eMail: computerscience@pdst.ie # Breakout 6.4 Check digits # Suggested Activities - EAN-8 barcodes def extractDigit(i, n): """Extract the ith digit from n The rightmost digit is at position 0 ...
def is_a_url(path): return (path is not None and isinstance(path, str) and (path.startswith('http://') or path.startswith('https://')) ) def tabular(descriptor): return 'schema' in descriptor def streaming(descriptor): return descriptor.get(PROP_STREAMING) def stre...
class Users: def __init__(self, first_name, last_name, user_name, credential): self.first_name = first_name self.last_name = last_name self.user_name = user_name self.credential = credential user_users = [] def save_user(self): ''' this is a save function th...
# This file is Copyright 2015, Will Bond <will@wbond.net>, licensed to Google # under the terms of the Google Inbound Service Agreement, signed August 15 2015 def data(provider_method, first_param_name_suffix=False): """ A method decorator for unittest.TestCase classes that configured a static method to b...
message_id_example = 'f1392251-db64-4f6c-acb3-73b64aa79d9d' timestamp_example = '2016-03-23 12:15:22.62027' current_articles_example = open("dashboard/tests/json/current_articles_example.json", "r").read() article_detail_example = open("dashboard/tests/json/article_detail_example.json", "r").read() article_ids_exampl...
class Const: @property def GUROBI(self): return "GUROBI"
''' ''' # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License");...
filename = 'a_daughter_of_witches.txt' file_path = 'txt_files/' try: with open(f"{file_path}{filename}", encoding = 'utf-8') as f: contents = f.read() word_hunt = contents.lower().count('the ') print(f"Ordet du letar efter hittas {word_hunt} gånger i denna story") except FileNotFoundError:...
__title__ = 'hermes_python' __version__ = '0.8.1' __description__ = 'Python bindings for Snips Hermes Protocol' __url__ = { 'Documentation': 'https://hermespython.readthedocs.io/en/latest/', 'Source': 'https://github.com/snipsco/hermes-protocol/tree/develop/platforms/hermes-python', 'Tracker': 'https://gith...
class Vehiculo: def __init__(self, velocidad_maxima, kilometraje, capacidad): self.velocidad_maxima = velocidad_maxima self.kilometraje = kilometraje self.capacidad = capacidad def set_capacidad(self, capacidad): self.capacidad = capacidad def get_capacidad(self...
load("//:plugin.bzl", "ProtoPluginInfo") load("//:compile.bzl", "ProtoCompileInfo") load( "//:compile.bzl", # "ProtoCompileInfo", # "get_plugin_out_arg", # "get_plugin_outputs", "objc_upper_segments", "rust_keywords", ) def proto_compile_impl(ctx): files = [] for dep in ctx.attr.deps: ...
# 다트게임 def solution(dartResult): answer = [] result = [] for x in dartResult: dartResult = dartResult.replace("10",'A') dartResult = list(dartResult) for x in dartResult: result.append(x.replace('A','10')) print(result) for idx in range(1, len(result)): if result[idx...
""" [05/30/13] Challenge #126 [Intermediate] Perfect P'th Powers https://www.reddit.com/r/dailyprogrammer/comments/1fcpnx/053013_challenge_126_intermediate_perfect_pth/ # [](#IntermediateIcon) *(Intermediate)*: Perfect P'th Powers An integer X is a "perfect square power" if there is some integer Y such that Y^2 = X. ...
class PlanTopology(APIObject,IDisposable): """ An object that represents a Plan Topology within the Autodesk Revit project. """ def Dispose(self): """ Dispose(self: APIObject,A_0: bool) """ pass def GetRoomIds(self): """ GetRoomIds(self: PlanTopology) -> ICollection[ElementId] Retrieves room...
def integrity_query(t_from, t_to, period, table, test_column, time_column='time', return_epoch=True): return f'''WITH RECURSIVE input (t_from, t_to, t_interval) AS ( VALUES (to_timestamp({t_from}), to_timestamp({t_to}), interval \'{period} s\') ), filled AS ( SELECT ser.tm as time, {test_column} ...
#Escreva um programa que leia um valor em metros e o exiba convertido em centimetros e milímetros n1 = float(input("Uma distância em metros: ")) print(f'A medidade de {n1}m, corresponde a ') #Mostrar tambem quantidade de Kilometros, hectometros, decametros, decimetros, km = n1 / 1000 print(f'{km}km - Kilometros'...
""" Deleting objects in VNC should also delete it's back-ref objects. """ def test_delete_vmi(vnc_api_client, vnc_lib, vnc_vmi_1): vnc_vmi_1.get_instance_ip_back_refs.return_value = [{'uuid': 'instance-ip-uuid'}] vnc_lib.virtual_machine_interface_read.return_value = vnc_vmi_1 vnc_api_client.delete_vmi('v...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- class Animal(object): def run(self): print('Animal running...') class Dog(Animal): def run(self): print('Dog running...') def shout(self): print('Dog wang wang...') class Cat(Animal): def run(self): print('Cat running...') def shout(self): print('Cat mi...
# Python function that checks whether a passed string is palindrome or not. def isPalindrome(string): left_pos = 0 right_pos = len(string) - 1 while right_pos >= left_pos: if not string[left_pos] == string[right_pos]: return False left_pos += 1 right_pos -= 1 return True print(isPalindrome('aza'))
""" Дополнительная Выведите таблицу размером n×n, заполненную числами от 1 до n^2 по спирали, выходящей из левого верхнего угла и закрученной по часовой стрелке, как показано в примере (здесь n=5n=5): Sample Input: 5 Sample Output: 1 2 3 4 5 16 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9 Тестируется через ...
def bubbleSort(alist): t = 0 for passnum in range(len(alist) - 1, 0, -1): for i in range(passnum): if alist[i] < alist[i + 1]: temp = alist[i] alist[i] = alist[i + 1] alist[i + 1] = temp elif alist[i] == alist[i + 1]: ...
num=300 num2=14 num3=100 num4=111
command = input().split(": ") products = {} while "statistics" not in command: key = command[0] value = command[1] if key in products: products[key] += int(value) else: products[key] = int(value) command = input().split(": ") print("Products in stock:") [print(f"- {product}: {quan...
def can_build(env, platform): return True def configure(env): pass def has_custom_iterator(): return True def has_custom_physics_iterator(): return True def has_custom_audio_iterator(): # TODO enable custom iterator once the audio process system is integrated return False def get_doc_p...
#-*- coding: utf-8 -*- """ This package is an implementation of the OpenID specification in Python. It contains code for both server and consumer implementations. For information on implementing an OpenID consumer, see the C{L{openid.consumer.consumer}} module. For information on implementing an OpenID server, see t...
class dotSetProperty_t(object): # no doc aName=None aStringValue=None DoubleValue=None FatherId=None IntValue=None Source=None Type=None
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See LICENSE.txt in the project root for # license information. # ------------------------------------------------------------------------- def assert...
# -*- coding: utf-8 -*- """ Created on Sun Dec 5 19:14:22 2021 @author: catal """ """please see https://holypython.com/ for original exercises""" """ Place a curly bracket "{}" in the appropriate place and fill inside .format()'s parenthesis so that "Hello!, Name" is printed. """ def printGreeting(): """take...
# # PySNMP MIB module RIVERSTONE-RS94X-AGENTCAP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RIVERSTONE-RS94X-AGENTCAP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:49:22 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python ve...
class GameOfLifeDivTwo: def theSimulation(self, init, T): s, l = init, len(init) def r(i): def rr(ls): return '1' if ls.count('1') >= 2 else '0' if i == 0: return rr(s[-1:] + s[:2]) elif i == l-1: return rr(s[-2:] + ...