content
stringlengths
7
1.05M
class Solution: def letterCombinations(self, digits: str) -> List[str]: d = { 2:"abc", 3:"def", 4:"ghi", 5:"jkl", 6:"mno", 7:"pqrs", 8:"tuv", 9:"wxyz" } if digits == "": retu...
# @Title: 路径总和 (Path Sum) # @Author: KivenC # @Date: 2020-07-07 17:57:00 # @Runtime: 72 ms # @Memory: 15.6 MB # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def hasPathSum(self, root...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ p.212 05-2.모듈 @author: aimldl """ # mod1.py def sum(a,b): return a+b def safe_sum(a,b): if type(a) != type(b): print("Different types!") return else: result = sum(a,b) return result print( safe_sum('a',1) ) print( safe_...
expected_output = { 'vrf': { 'default': { 'peer': { '192.168.229.3': { 'connect_source_address': '192.168.100.1', 'elapsed_time': '00:00:09', 'nsr': { 'oper_downs': 0, 's...
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def reorderList(self, head) -> None: """ Do not return anything, modify head in-place instead. """ if head is None or...
resp = s = 0 cont = 1 #Contador while resp != 999: resp = int(input('Digite o {}º valor (999 parar): '.format(cont))) cont += 1 if resp != 999:#Desconsiderando 999 s += resp cont -= 2 #Desconsiderando 999 print() print('Foram digitados {} valores'.format(cont)) print('A soma deles é de {}'...
up_alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" class Columnar: def col_encrypt(plaintext, key): plaintext = plaintext.replace(" ", "") cipher = "" num_key = [] key_index = [] table = [] row = [] for i in key.upper(): num_key.append(up_alpha.index(i)) ...
"""Initialization file for library.""" # pylint: disable=C0114 __version__ = "0.1.1"
#Desenvolva um programa que leia a duas notas de um aluno #calcule e mostre a sua média nota1 = float(input('Primeira nota: ')) nota2 = float(input('Segunda nota: ')) soma = nota1+nota2 print(f'A primeira nota foi {nota1}') print(f'A segunda nota foi {nota2}') print(f'A média foi de {soma/2}')
def get_mwa_eor_freq(ch): if ch > 704: print('Maximum frequency channel is 704') else: return 138.915 + 0.08 * ch
#!/usr/bin/python3 def f(l1,l2): n,m = len(l1),len(l1[0]) d = sum([l1[i][j]!=l2[i][j] for i in range(n) for j in range(m)]) if d*2 > n*m: for i in range(n): for j in range(m): l1[i][j] = 'X' if l1[i][j]=='.' else '.' return [''.join(l) for l in l1] n,m = list(map...
# Open doors and collect treasures. peasant = hero.findByType("peasant")[0] goldKey = peasant.findByType("gold-key")[0] silverKey = peasant.findByType("silver-key")[0] bronzeKey = peasant.findByType("bronze-key")[0] # Command the peasant to pick up the gold and silver keys. hero.command(peasant, "pickUpItem...
class Base: """The base object for all top-level client objects. Parameters ---------- domain : one of rubicon.domain.* The top-level object's domain instance. config : rubicon.client.Config, optional The config, which injects the repository to use. """ def __init__(self, d...
"""Widget framework """ __all__ = \ [ 'animators', 'assembly_view', 'axial_plot', 'colormaps.py', 'core_axial_view', 'core_view', 'core_view_plot', 'data_analysis_view', 'detector_multi_view', 'image_ops', 'intrapin_edits_assembly_view', 'intrapin_edits_plot', 'leg...
# using break to stop looping is_learning = True while is_learning: print("I'm still learning") break # using other statement to stop looping hungry = True while hungry: print("let's go eat") hungry = False ''' value that not 'false' or you input other value except 'false' is equal to true in this case, y...
""" Ghost Method (動的なメソッド呼び出し) """ class DynamicProxy(object): def __init__(self, value): self._value = value def __getattr__(self, name): """ __getattr__ (rubyでのmethod_missing) 実装されていないメソッドが呼ばれた時、呼び出される name引数にはその時のメソッド名が入る """ return getattr(self._val...
class Keyboard: def __init__(self): self.keys = [] def add_key(self, key): self.keys.append(key) def get_key(self, index): return [key for key in self.keys if key.index == index][0] if __name__ == '__main__': exit()
# Write a Python function to find the maximum and minimum numbers from a sequence of numbers List = [2, 4, 6, 41, 8, 10, 5] max = 0 for i in List: if i > max: max = i print(max)
class Solution: def judgeSquareSum(self, c): """ :type c: int :rtype: bool """ right = int(c ** 0.5) left = 0 while left <= right: s = left * left + right * right if s == c: return True elif s < c: ...
""" entrada capital-->float-->cap salida ganacia-->float-->g intereses-->float-->i """ #entrada cap=int(input("Digite capital invertido:")) #cajanegra i=cap*0.02 g=cap+i #salidas print("Ganancia despues de un mes:"+str(g))
class StreetParking: def freeParks(self, street): c, l = 0, len(street) for i in xrange(l): if ( street[i] == "-" and "B" not in street[i + 1 : i + 3] and "S" not in street[max(i - 1, 0) : i + 2] ): c += 1 ...
# 1st brute-force solution class Solution: def maxProduct(self, nums: List[int]) -> int: largest = nums[0] for i in range(len(nums)): curProduct = 1 for j in range(i, len(nums)): curProduct *= nums[j] largest = max(largest, curProduct) ...
# ls0 = "3, 4, 1, 5" # Lengths. # # ls0 = "197, 97, 204, 108, 1, 29, 5, 71, 0, 50, 2, 255, 248, 78, 254, 63" # ls1 = list(map(int, [c[:-1] if c[-1] == ',' else c for c in ls0.split()])) # upper_bound = 5 # # upper_bound = 256 # xs = range(upper_bound) # skip_size = 0 # pos = 0 # size = len(xs) # assert a...
''' Project Euler Problem 18 Created: 2012-06-18 Author: William McDonald ''' ''' IDEA: For a given row, store the maximum sum to get to each element in that row by using the maximum sums for the row above it. e.g. 08 01 02 01 05 04 ==> 09 10 01 04 05 ==> 10 15 14 Now simp...
def is_divisible_by_seven(x): if x % 7 == 0: return True return False def is_not_multiple_of_five(x): while x > 0: x -= 5 if x == 0: return False return True result = [x for x in range(2000, 3201) if is_divisible_by_seven(x) and is_not_multiple_of_five(x)] print(result)
# # PySNMP MIB module CAT2600-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CAT2600-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:29:39 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, 0...
# ------------------------------ # 351. Android Unlock Patterns # # Description: # https://leetcode.com/problems/android-unlock-patterns/description/ # # Version: 1.0 # 11/11/17 by Jianfa # ------------------------------ class Solution(object): def numberOfPatterns(self, m, n): """ :type m: int ...
class Solution(object): def canJump(self, nums): cur, last = 0, 0 for i in nums: last, cur = max(last, cur + i), cur + 1 if cur > last: break return True if cur == len(nums) else False
class Kite(object): def __init__(self): self.code = "kite" def foo(self): print("bar!")
def combinations(A): """ Just as an exercise to think about all combinations... Powerset: all subsets of A, including empty set. Grab the first value in A, then find all combinations for the remaining elements. The result is those combinations plus those combinations prefixed with A[0]. """ ...
# # PySNMP MIB module HPN-ICF-EPON-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-EPON-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:26:17 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
# cribbing from matplotlib's approach # by default DeprecationWarnings are ignored. Define our own class to make sure they are seen __all__ = ["mpl_interactions_DeprecationWarning"] class mpl_interactions_DeprecationWarning(DeprecationWarning): """A class for issuing deprecation warnings for mpl-interactions use...
class RepositoryNotFoundError(Exception): pass class MissingFilesError(Exception): pass
#LAB X #Due Date: 04/07/2019, 11:59PM ######################################## # # Name: # Collaboration Statement: # ######################################## # use the code for max heap class MaxHeapPriorityQueue: def __init__(self): self.heap=[] ...
""" url 管理器 """ class URLManager: visited_addr = set() waiting_addr = set() def get_url(self): """ 从 waiting_addr 中获取一个 url 并保证该 url 没有在 visited_url 中 """ if not self.waiting_addr: return None addr = self.waiting_addr.pop() if addr in se...
# Created by MechAviv if sm.getFieldID() == 330002040: # Map ID :: 330002040 # Shinsoo International School : Front Gate sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, False, False, False) sm.hideUser(True) sm.removeAdditionalEffect() OBJECT_7 = sm.s...
""" Datos de entrada monto de la compra-->m-->float nombre del cliente-->n-->str Datos de salida nombre del cliente-->n-->str monto de la compra-->m-->float monto a pagar-->mp-->float descuento-->d-->float """ n=str(input("Ingrese el nombre del cliente ")) m=float(input("Digite el monto de la compra ")) if(m<=50000):...
# -*- coding: utf-8 -*- # @Time : 19-5-20 上午10:33 # @Author : Redtree # @File : insert_sort.py # @Desc : 直接插入排序 #----直接插入排序---- def dosort(L): #遍历数组中的所有元素,其中0号索引元素默认已排序,因此从1开始 for x in range(1,len(L)): #将该元素与已排序好的前序数组依次比较,如果该元素小,则交换 #range(x-1,-1,-1):从x-1倒序循环到0 for i in range(x-1,-1,-1)...
""" Module for processing and saving data for processing in the API. """ selected = None class Selection: def __init__(self, objtype: str, data): self.type = objtype self.data = data
#Crie um script Python que leia o dia, mês e o ano de nascimento #de uma pessoa e mostre uma mensagem com a data formatada. nome = str(input('Digite o seu nome: ')) dia = int(input('Em qual dia você nasceu, {}: '.format(nome))) mes = str(input('{}, em que mês você nasceu? '.format(nome))) ano = int(input('Digite o ano...
#Actividad 4 x = 0 while x != 10: #x = x+0.1 x = x+0.5 # El "problema" es que 0.1 no tiene representación binaria finita. # Por lo tanto, x+0.1 daría una aproximación a 10.
"""Utils for handling biological data""" genomeBuild2genMapSfx = { 'hg17': 'b35', 'hg18': 'b36', 'hg19': 'b37' }
#INCOMPLETE to_sort = [230, 6, 3, 234565, 9, 13000] def ins_sort(): for i in range(0, len(to_sort)): j=i for j in range(1, j+1): if to_sort[j+1]<to_sort[j]: val=to_sort[j+1] to_sort[j+1]=to_sort[j] to_sort[j]=val print(to_sort)
# ******************************************************************************************* # ******************************************************************************************* # # Name : gencpu.py # Purpose : Generate the CPU core (not B) in C # Date : 27th August 2019 # Author : Paul Robson (paul@r...
# Se borro la primera linea print('ESTA ES UNA LINEA AGREGADA DESDE PYTHON') print('esta linea fue añadida desde Github para probar el update en python')
# # Copyright (c) 2020, Hyve Design Solutions Corporation. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # 1. Redistributions of source code must retain the above copyright # notice, th...
class Database: database = None def __init__(self): self.content = "User Data" @staticmethod def getInstance(): if not Database.database: print("New database instance created") Database.database = Database() return Database.database def describe(self): print("The databa...
# Classe contabancaria class ContaBancaria: def __init__(self, numero, titular, senha): self.numero = numero self.titular = titular self.__senha = senha self.__saldo = 0 def __validar_senha(self, senha): # método privado if senha == self.__senha: return Tru...
class OsptException(Exception): msg = '' def __init__(self, message, **kwargs): _msg = message if message else self.msg super(Exception, self).__init__(_msg.format(**kwargs)) class ConnectionError(OsptException): pass class TimeoutError(OsptException): pass class N...
"""The smtp component.""" DOMAIN = "smtp" PLATFORMS = ["notify"]
TEST_NETLIST = r""" ** Library name: gsclib045 ** Cell name: INVX1_3 ** View name: schematic .subckt INVX1_3 A Y VDD VSS *.PININFO VSS:I VDD:I A:I Y:O ** Above line required by Conformal LEC - DO NOT DELETE mp0 Y A VDD VDD g45p1svt L=45e-9 W=250e-9 AD=54.6e-15 AS=54.6e-15 PD=1.06e-6 PS=1.06e-6 NRD=358.974e-3 NRS=358....
def byte_to_hex(bytebuffer): return "".join(("%02x" % a) for a in bytebuffer) # CASSSANDRA TYPES class TxInputOutput(object): def __init__(self, address, value): self.address = address[0] self.value = value class Value(object): def __init__(self, satoshi, eur, usd): self.satosh...
""" Programa 098 Área de estudos. data 02.12.2020 (Indefinida) Hs @Autor: Abraão A. Silva """ # Inicialização dos objetos listas. lista_idade = [] lista_altura = [] # Iteração para colher os dados. for repet in range(1, 6): print(f'{repet}º Sequência de dados.:') lista_idade.append(int(input('Idade.: ')))...
def all_binary(k): if k == 0: return [] if k == 1: return ["0", "1"] return [f"0{x}" for x in all_binary(k - 1)] + [f"1{x}" for x in all_binary(k - 1)] def all_k_in_str(str, k): kmersFound = {} for kmer in all_binary(k): kmersFound[kmer] = False n_kmers_found = 0 n...
FreeSerifItalic18pt7bBitmaps = [ 0x01, 0xC0, 0xF0, 0x3C, 0x0F, 0x03, 0x81, 0xE0, 0x70, 0x1C, 0x06, 0x01, 0x80, 0xC0, 0x30, 0x0C, 0x02, 0x01, 0x80, 0x40, 0x10, 0x00, 0x00, 0x01, 0x80, 0xF0, 0x3C, 0x06, 0x00, 0x38, 0x77, 0x8F, 0x78, 0xF7, 0x0E, 0x60, 0xE6, 0x0C, 0xC1, 0x8C, 0x18, 0x81, 0x00, 0x00, 0x60, 0...
#!/usr/bin/env python3 _, k, *l = map(int, open(0).read().split()) for a,b in sorted(zip(*[iter(l)]*2)): k -= b if k < 1:print(a);exit()
class player_class: number = 0 name = "" HP = 10 live = True raceWeapon = "" comp = False real_player_list = [] def addRealPlayers(): n = 0 real_player_list.append(player_class()) print("Enter the first player's name:") real_player_list[n].name = input() real_p...
f = open('dftdemo.hex', 'r') lines = f.read().split('\n') fout = open('mem-dft.hex', 'w') step = 2 for line in lines: for i in range(len(line), 0, -step): fout.write(line[i-step:i]) fout.write('\n')
tupla = ('Borracha',1.00,'Caneta',2.50,'Caderno',5.00,'Corretivo',3.50,'Lápis',2.00,'Mochila',80, 'Régua',8.0,'Estojo',50) print(f'{"LISTAGEM DE PREÇOS":^30}') for c in range (0,16,2): print(f'{tupla[c]:.<25} R${tupla[c+1]:>}')
expected_output = { 'test': { 'loopback Test': { 'status': True } } }
# "Write a program that prints the numbers from 1 to 100. # But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. # For numbers which are multiples of both three and five print “FizzBuzz” for n in range(1, 101): x = 3 # To quickly change what multiples show 'Fizz...
name = input('What is your first name? ') print( 'Your name is as long or longer the the avarage first name' ) if len(name) >= 6 else print( 'Your name is shorter than the avarage first name' ) message = ( 'The first letter in your name is among the five most common' if name[0].lower() in ['a', 'j', '...
AWS_API_KEY = None AWS_SECRET_KEY = None AWS_KEY_FILE = None LOCAL_AWS_KEY_FILE = None #AMI SETTINGS # AMI IDs are available on http://cloud.ubuntu.com/ami/ # Ubuntu 12.04 EBS Backed Instances AMI_ID_BY_REGION = { 'ap-northeast-1' : 'ami-d71a9ad6', 'ap-southeast-1' : 'ami-6686ca34', 'ap-southeast-2' : 'ami...
# 169. Majority Element # Given an array of size n, find the majority element. The majority element is the element that appears more than n/2 times. # You may assume that the array is non-empty and the majority element always exist in the array. # DIVIDE AND CONQUER [NOT THE BEST WAY TO SOLVE IT] class Solution: ...
class SearcherConfig(): AND = 'AND' OR = 'OR'
# Exercise on selection sort - Level 1 def find_next_min(num_list, start_index): # Remove pass and write the logic to find the minimum element in a sub-list and return the index of the identified element in the num_list. # start_index indicates the start index of the sub-list min_index = 0 for i in ra...
#!/usr/bin/python delayIntervals = [0, 40, 80, 160] lossIntervals = [0, 5, 10] tcpTestLocation = '../../tcp-clock-station/tcp-clock-station' udpTestLocation = '../../udp-clock-station/udp-clock-station' rrtcpTestLocation = '../../rrtcp-clock-station/rrtcp-clock-station'
def extractJunktranslatesWordpressCom(item): ''' Parser for 'junktranslates.wordpress.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('intl', 'It’s Not Too Late to Meet Again After Reb...
transitions = {' ': {' ': 2877, '?': 24468, 'a': 68563, 'b': 24641, 'c': 21074, 'd': 16954, 'e': 11615, 'f': 21199, 'g': 9600, 'h': 49177, 'i': 29498, 'j': 1618, 'k': 3983, 'l': 13015, 'm': 19254, 'n': 14619, ...
# -*- coding: utf-8 -*- # Module/mypkg/mod3.py class MyClass(): def func3(self): print("./mypkg/mod3.py") print("func3")
# Question # WAP to find a reverse of the four-digit number # Code # I ask the user for the number num=int(input('Enter a number: ')) # I initialize the value to null ; rev is just another variable I took for reverse rev=0 # we can do the task by using a while loop while (num>0): # 'num' should not be reversed o...
''' Problem description: Create a function that accepts dimensions, of Rows x Columns, as parameters in order to create a multiplication table sized according to the given dimensions. **The return value of the function must be an array, and the numbers must be Fixnums, NOT strings. Example: multiplication_table(3,...
class Person: """Represents a generic Person.""" def __init__(self, first, last, weight, height): self.first_name = first self.last_name = last self.weight_in_lbs = weight self.height_in_inches = height p1 = Person('Tom', 'Smith', 80, 185) p2 = Person('Fred', 'Smith', 80, 185) p...
# DO NOT EDIT THIS FILE. This file will be overwritten when re-running go-raml. class PassThroughClientService: def __init__(self, http_client): self._http_client = http_client def set_zrobotsecret_header(self, val): """" Set header ZrobotSecret to '<val>'""" self._http_client.set_hea...
# simple function calling def our_method(a, b): if a > b: a = a + 1 a = a + 2 a = a + 3 a = a + 3 a = a + 3 a = a + 3 a = a + 3 return a else: b = b + 1 b = b + 2 b = b + 3 return b x = our_method(2, 3) print(x...
# https://www.codewars.com/kata/50654ddff44f800200000004 def multiply(a, b): return a * b
__version__ = "0.0.1" # from .fe import * # from .metric import * # from .oos import * # # from .scripts import * # from .utils import * test_var = 1 test_dict = {'a': 1, 'b': 2} test_list = [1,2,3]
""" Class with all params of BackEnd.MemoryBound.MioThrottle class and their subclasses @author: Alvaro Saiz (UC) @date: Jul 2021 @version: 1.0 """ class MemoryMioThrottleParameters: C_MEMORY_MIO_THROTTLE_NAME : str = "BACK-END.MEMORY-BOUND.MIO-THROTTLE" C_MEMORY_MIO_THROT...
# Set ranks of words in list (starting at 0) def setRanks(wordList): for x in range(len(wordList)): wordList[x].setRank(x) # Set ranks and initialize modify and notModify characteristics # Modifies the words themselves (no copy created) def readyWordList(wordList): setRanks(wordList) for x in wordList: x.initia...
""" This script is used for course notes. Author: Erick Marin Date: 10/11/2020 """ # String indexing name = "Jaylen" print(name[1]) # Python starts counting indices from 0 and not 1 print(name[0]) # The last index of a string will always be the one less than the length of # the string. print(name[5]) # If we tr...
""" Problem : Add Two Numbers (https://leetcode.com/problems/add-two-numbers/description/) """ # Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution(object): """Solution Class""" def addTwoNumbers(self, l1, l2): ""...
def symmetric_difference(a, b): return sorted(set(a ^ b), key=int) if __name__ == '__main__': _,a = input(), set(input().split()) _,b = input(), set(input().split()) print('\n'.join(symmetric_difference(a, b)))
def make_bold(function): def wrapper(*args): return f"<b>{function(*args)}</b>" return wrapper def make_italic(function): def wrapper(*args): return f"<i>{function(*args)}</i>" return wrapper def make_underline(function): def wrapper(*args): return f"<u>{function(*args)}<...
def test_passed(): assert True def test_read_params(config, param): assert config.get(param) == 2 def test_do_nothing(): pass
def print_list(head): temp=head while temp: print (temp.data) temp=temp.next def reverse_even_nodes(head): odd=head even=None while odd: if odd.next: temp=odd.next odd.next=odd.next.next temp.next=even even=temp odd=odd.next odd=head curr=head print("this is odd l...
hparam_grids={ 'rf':{ 'n_estimators':[120,300,500,800,1200], 'max_depth':[15,25,30,None], 'min_samples_split':[2,5,10,15,100], 'min_samples_leaf':[2,4,5,10], 'max_features':[None, 0.5] }, 'xgb':{ 'eta':[0.01, 0.015, 0.025, 0.05, 0.1], 'gamma':[0.05, 0....
""" Given a positive integer N and a precision factor P, it produces an output with a maximum error P from the actual square root of N. Example: Given N = 5 and P = 0.001, can produce output x such that 2.235 < x < 2.237. Actual square root of 5 being 2.236. """ def square_root(n, epsilon=0.001): """Return squar...
data = open("data-14006B000", "r").read() a = [] index = 0 for _ in range(266504): index = data.find("dup(", index) + 4 a.append(int(data[index])) print(a)
COMMONSENSE_MAPPING = {'Antonym': 'antonym', 'AtLocation': 'at location', 'CapableOf': 'capable of', 'Causes': 'causes', 'CausesDesire': 'causes desire', 'CreatedBy': 'created by', 'DefinedAs': 'defined as', 'DerivedFrom': 'derived from', 'Desires': 'desires', 'DistinctFrom': 'destinct from', 'Enta...
class BasePlanet: def __init__(self, name, description): self.name = name self.description = description self.port = None def get_info(self): return f'*{self.name}*\n' \ f'{self.description}' def start(self, message): self.port.start(message) def...
def calcularMitadHorizontal(size = int(), division = int(), position = int(), message = str()): if position < 1: return -1 if division < 2: return -1 if size <= division: return -1 return int(((size / division)*position)/int(2) - len(message))
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Napisz funkcję common_chars(string1, string2), która zwraca alfabetycznie uporządkowaną listę wspólnych liter z lańcuchów string1 i string2. Oba napisy będą składać się wyłacznie z małych liter. """ def common_chars(string1, string2): set_1 = set(string1.lower()...
class Person: def sleep(self): return "sleeping..." class Employee: def get_fired(self): return "fired..." class Teacher(Person, Employee): def teach(self): return "teaching..." gosho = Teacher() print(Teacher.__mro__) print(gosho.sleep()) print(gosho.get_fired()) print(gosho.t...
def generate_signer_resources(gendoc): gendoc.add_comments(""" The signer watches all release tags and signs those that have the correct metadata and images are reachable (according to an `oc adm release info --verify` invocation). Signatures a test that the specified release image was built within the CI infrast...
number1 = int(input("Enter number 1: ")) number2 = int(input("Enter number 2: ")) def multiplication(number1, number2): return number1 * number2 print(multiplication(number1, number2))
''' Write a Python program to perform an action if a condition is true. Given a variable name, if the value is 1, display the string "First day of a Month!" and do nothing if the value is not equal. ''' var_word = int(input("Enter a number between 0-9: ")) if var_word == 1: print("First day of a month!")
# class constructor takes an array of integers as a parameter and saves it to the __elements instance variable. class Difference: def __init__(self, a): self.__elements = a def computeDifference(self): maxDiff = 0 # computeDifference method that finds the maximum absolute difference betwee...
# coding: utf-8 RESOURCE_MAPPING = { 'list_spreadsheets': { 'resource': '/spreadsheets/private/full', 'docs': 'https://developers.google.com/google-apps/spreadsheets/worksheets' '#retrieve_a_list_of_spreadsheets' }, 'manage_worksheets': { 'resource': '/worksheets/{ke...
def majorityElement(self, nums: List[int]) -> int: ''' tracker = {} for num in nums: if num not in tracker: tracker[num] = 1 else: tracker[num] += 1 return max(tracker, key=tracker.get) ''' # Much nicer num = sorted(nums) r...
a, b = input().split() if int(a) > int(b): print(b * int(a)) else: print(a * int(b))