content
stringlengths
7
1.05M
#!/usr/bin/env python # -*- coding: utf-8 -*- class Notifier(object): """ Base class for all notifiers """ def __init__(self, name=None): self._name = name def notify(self, event): """Create notification of event. :param event: The event for which to create a notificatio...
# Licensed Materials - Property of IBM # Copyright IBM Corp. 2016 class SourceTuples: def __init__(self, tuples=[]): self.tuples = tuples def __call__(self): return self.tuples
years = range(2008, 2010) vars = ['ta_2m', 'pr', 'psl', 'rss', 'rls', 'wss_10m', 'hur_2m', 'albedo', 'ps', 'ts_0m'] hourres = ['1H', '1H', '1H', '3H', '3H', '1H', '1H', '1H', '3H', '1H'] b11b = 'NORA10' b11c = '11km' paths = ['%s_%s_%s_%s_%s.nc' % (b11b, hourres[vi], b11c, vars[vi], y) for vi in ran...
class Demo: a1 = 1 b1 = 2 c1 = 3 d1 = 4 def __init__(self): print(self.a1) # access SV inside constructor using self print(Demo.a1) # access SV inside constructor using classname def mymethod1(self): print(self.b1) # access SV inside instance method using ...
#list print([1, 2, 3, 4, 5]) print(type([1, 2, 3, 4, 5])) print([1, 2, "hello", "world", True, [1, 2], [True, False]]) print(type([1, 2, "hello", "world", True, [1, 2], [True, False]])) #基础操作 #返回单个元素 print(["1", "2", "3", "4"][0]) #返回list print(["1", "2", "3", "4"][0:2]) print(["1", "2", "3", "4"][-1:]) print(["1...
bits = [] val = 190 while val > 0: bits.append(val & 1) val = int(val / 2) print(bits) # find the longest length of bits of 1s with one flip or None lens = [] count = 0 if len(bits) == 1: print(bits[0]) for bit in bits: if bit: count += 1 else: lens.append(count) lens.append(bit) count = 0 ...
print ('\033[1;31;47mOlá mundo!\033[m') print('\033[7;30mOlá Mundo!\033[m') a = 3 b = 5 print('Os valores são \033[33m{}\033[m e \033[32m{}\033[m !!!'.format(a,b))
def isPalindrome(x: int) -> bool: if x < 0: return False reverse_num = contador = 0 while x // 10**contador != 0: reverse_num = (reverse_num*10) + (x // 10**contador % 10) contador += 1 return x == reverse_num
# Ex-1 Update Values in Dictionaries and Lists x = [ [5,2,3], [10,8,9] ] students = [ {'first_name': 'Michael', 'last_name' : 'Jordan'}, {'first_name' : 'John', 'last_name' : 'Rosales'} ] sports_directory = { 'basketball' : ['Kobe', 'Jordan', 'James', 'Curry'], 'soccer' : ['Messi', 'Ronaldo', 'Roo...
__all__ = [ 'Dcscn', 'DnCnn', 'Espcn', 'Idn', 'Rdn', 'Srcnn', 'Vdsr', 'Drcn', 'LapSrn', 'Drrn', 'Dbpn', 'Edsr', 'SrGan', 'Exp', ]
class Solution: def XXX(self, root: TreeNode) -> int: def XXX(root): if not root: return 0 if not root.left: return XXX(root.right) + 1 if not root.right: return XXX(root.left) + 1 leftDepth = XXX(root.left) rightDepth = XXX(root.right) ...
def handle_error_by_throwing_exception(): raise Exception("ERROR: something went wrong") def handle_error_by_returning_none(input_data): try: return int(input_data) except ValueError: return None def handle_error_by_returning_tuple(input_data): try: return True, int(input_...
class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: m = {} # { value: index } for i in range(0, len(nums)): remainder = target - nums[i] if remainder in m: return [i, m[remainder]] m[nums[i]] = i
def f04(s): within = lambda n : n in [1, 5, 6, 7, 8, 9, 15, 16, 19] get_letters = lambda pred, w: [w[:2], w[0]][pred] wt, wdic = ((i + 1, w) for i, w in enumerate(s.split())), {} for index, word in wt: wdic[get_letters(within(index), word)] = index return wdic s = 'Hi He Lied Because Boron Could Not...
def special_case_2003(request): pass def year_archive(request,year): pass def month_archive(request,year,month): pass def article_detail(request,year,month,title): pass
# Değişkenlerin tanımlanması i = 2 print("Payi gir:") # Pay ve paydanın girilmesi pay = int(input()) print("Paydayi gir:") payda = int(input()) # Pay ve paydanın küçüğünün tespit edilmesi if (pay > payda): kucuk = abs(payda); else: kucuk = abs(pay); while i <= kucuk: if pay % i == 0 and payda % i == 0: ...
class UF: def __init__(self, n: int): self.id = list(range(n)) def union(self, u: int, v: int) -> None: self.id[self.find(u)] = self.find(v) def connected(self, u: int, v: int) -> bool: return self.find(self.id[u]) == self.find(self.id[v]) def reset(self, u: int): self.id[u] = u def find(s...
km = float(input('Qual é a distância da viagem em km? ')) if km <= 200: print(f'O total a ser pago na viagem é de R${km * 0.50:.2f}') else: print(f'O total a ser pago na viagem é de R${km * 0.45:.2f}')
class Templates: NotAnyMessage = '$var cannot be empty (should contain at least one element).' NotEqualMessage = 'Equality precondition not met.' NotNullMessage = '$var cannot be Null.' NotGreaterThanMessage = "$var cannot be greater than $value." NotLessThanMessage = "$var cannot be less than $valu...
class FunnyRect: cx =0. cy=0. fsize=0. def setCenter (self, x, y): self.cx = x self.cy = y def setSize (self, size): self.fsize = size def render (self): rect (self.cx , self.cy , self.fsize , self.fsize ) funnyRectObj = FunnyRect () de...
##################################################### # dictTranslate.py # # made by Iván Montalvo & Santiago Buitrago # # # # Translation of the classes to the characters. # # ...
# Definition for an interval. class Interval: def __init__(self, s=0, e=0): self.start = s self.end = e class Solution: def merge(self, intervals): """ :type intervals: List[Interval] :rtype: List[Interval] """ if intervals is None or len(interval...
class FloorLayout: def countBoards(self, layout): c = 0 for i in xrange(len(layout)): for j in xrange(len(layout[i])): if j > 0 and layout[i][j] == '-' and layout[i][j-1] == '-': continue if i > 0 and layout[i][j] == '|' and layout[i-1]...
# The isBadVersion API is already defined for you. # @param version, an integer # @return a bool # def isBadVersion(version): class SequenceWrapper(object): def __init__(self, function, start, stop): self._function = function self._start = start self._size = max(0, stop - start) de...
def main(): choice='z' if choice == 'a': print("You chose 'a'.") elif choice == 'b': print("You chose 'b'.") elif choice == 'c': print("You chose 'c'.") else: print("Invalid choice.") if __name__ == '__main__': main()
{ 'conditions': [ ['OS=="win"', { 'variables': { 'GTK_Root%': 'C:/GTK', # Set the location of GTK all-in-one bundle 'with_jpeg%': 'false', 'with_gif%': 'false', 'with_pango%': 'false', 'with_freetype%': 'false' } }, { # 'OS!="win"' 'variables': { ...
# Funcion para hacer flat un arreglo def flatten_array(array): return [item for sublist in array for item in sublist] # Funcion para calcular matriz transpuesta def transpose(matA): transMatrix=[[0 for j in range(len(matA))] for i in range(len(matA[0]))] for i in range(len(matA)): for j in range(...
class FeatureExtractor: def __init__(self): preprocess = False data_dir = "H:/data/createddata/feature/" os.mkdirs(data_dir) years = {2016, 2017} for year in years: splitFiles(year) print("year\tday\tmeanValue\tmedianValue\thoMedian\tmean...
# -*- coding: utf-8 -*- class ThreeStacks(object): """ 3.1 Three in One: Describe how you could use a single array to implement three stacks. """ def __init__(self, size): self.arr = [None] * size self.stack1_ptr = 0 self.stack2_ptr = 1 self.stack3_ptr = 2 def pop(s...
""" Copyright 2019 Skyscanner Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
class Solution: def isSubsequence(self, s: str, t: str) -> bool: index = 0 for i in range(len(t)): if index < len(s) and t[i] == s[index]: index += 1 return index == len(s)
"""Common bits of functionality shared between all efro projects. Things in here should be hardened, highly type-safe, and well-covered by unit tests since they are widely used in live client and server code. license : MIT, see LICENSE for more details. """
inputs = open('../input.txt', 'r') data = inputs.readlines() frequency = 0 for frequency_change in data: try: change = int(frequency_change.rstrip()) if change: frequency += change except: print('Bad value: {}'.format(repr(frequency_change))) print('frequency: {}'.format(fr...
""" Before going through the code, have a look at the following blog about AVL Tree: https://en.wikipedia.org/wiki/AVL_tree @author: lashuk1729 """ class Node(): def __init__(self, val): self.val = val self.left = None self.right = None self.height = 1 class AVL_Tree(): def ge...
#!usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'Ziang Lu' def karatsuba(x: int, y: int) -> int: """ Calculates the multiplication of two integers using Karatsuba Multiplication. Naive calculation: O(n^2) :param x: int :param y: int :return: int """ # We assume that the...
# # PySNMP MIB module LINKSWITCH-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/LINKSWITCH-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:56:49 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...
error_messages = { 'type_invalid': 'Expected value of type %s, found %s', 'field_type_invalid': 'Expected value of type %s for field %s, found %s', 'length_invalid': 'value is not of required length', 'object_length_invalid': 'object does not have required number of elements', 'not_in_options': 'val...
''' Compound Conditions Logical Operators AND Operator Or operator Not operator A type of condition where we combine or connect differient relational expressions using some connectors Example: if x> 10 and y <= 9 if p == 5 or q < 10 P | Q | P and Q # P and Q is a com...
"""This problem was asked by Dropbox. Sudoku is a puzzle where you're given a partially-filled 9 by 9 grid with digits. The objective is to fill the grid with the constraint that every row, column, and box (3 by 3 subgrid) must contain all of the digits from 1 to 9. Implement an efficient sudoku solver. """
class InvalidParametersException(Exception): """ Exception added to handle invalid constructor parameters """ def __init__(self, msg: str): super().__init__(msg)
class EmptyStackError(Exception): """ Custom Error for empty stack. """ pass class Stack: """ Stack: LIFO Data Structure. Operations: push(item) pop() peek() isEmpty() size() """ def __init__(self): """...
input() # Ignore first line s = input().split(' ') L = len(s) N = sorted([int(i) for i in s]) median = N[L//2] if L % 2 != 0 else (N[(L//2) - 1] + N[L//2])/2 total = 0 mode, mode_c = None, 0 cmode, cmode_c = None, 0 for n in N: total += n if cmode_c > mode_c: mode = cmode mode_c = cmode_c ...
for i in range(10): print(i) for i in range(ord('a'), ord('z')+1): print(chr(i))
class S: def __init__(self, name): self.name = name def __repr__(self): return f'{self.__dict__}' def __str__(self): return f'Name: {self.name}' def __add__(self, other): return S(f'{self.name} {other.name}') class Deck: def __init__(self): self.cards = [...
# # PySNMP MIB module RADLAN-ippreflist-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RADLAN-ippreflist-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:42:11 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
class Point2D: def __init__(self, x, y): self.x = x self.y = y def __str__(self): return "(" + str(self.x) + ", " + str(self.y) + ")" def __add__(self, other): return Point2D(self.x + other.x, self.y + other.y) def __sub__(self, other): return Point2D(self.x - other.x, self.y - other.y) ...
def is_pesel_valid(pesel): if re.match(PATTERN, pesel): return True else: return False def is_pesel_woman(pesel): if int(pesel[-2]) % 2 == 0: return True else: return False
def default_dict(): dict_ = { 'Name': '', 'Mobile': '', 'Email': '', 'City': '', 'State': '', 'Resources': '', 'Description': '' } return dict_ def default_chat_dict(): dict_ = { 'updateID': '', 'chatID': '', 'Text': '' ...
# BSD Licence # Copyright (c) 2009, Science & Technology Facilities Council (STFC) # All rights reserved. # # See the LICENSE file in the source distribution of this software for # the full license text. """ The classes in this module define the base interface between the OWS Pylons server and components that provide ...
# -*- coding: utf-8 -*- """ GistAgent represents a generic gist agent. """ class GistAgent(): @property def host(self): ... @property def username(self): ... def get_gists(self): ... def create_gist(self, files, desc="", public=False): ...
class ProductQuantity(object): def __init__(self, str_quantity): self.StrQuantity = str_quantity def __str__(self): return self.StrQuantity
# https://blog.dreamshire.com/project-euler-5-solution/ # https://code.mikeyaworski.com/python/project_euler/problem_5""" # 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. # What is the smallest positive number that is evenly divisible by all of the numb...
def three_LCS(A,B,C): m=len(A) n=len(B) o=len(C) L=[[[0 for i in range(o+1)]for j in range(n+1)]for k in range(m+1)] for i in range(m+1): for j in range(n+1): for k in range(o+1): if (i==0 or j==0 or k==0): L[i][j][k]=0 elif (A[...
pytest_plugins = ( "tests.plugins.home", "tests.plugins.about", "tests.plugins.login", "tests.plugins.register", "tests.plugins.account", "tests.plugins.posts", "tests.plugins.status_codes", "tests.plugins.endpoints", "tests.plugins.hooks", )
#!/usr/bin/env python # -*- coding: utf-8 -*- """ 自己实现一个分页 传入参数:1.数据库返回对象列表; 2.当前页码; 3.每页展示记录数(默认10) 总记录数 / PAGE_SIZE = 总共多少页 """ DEFAULT_PAGESIZE = 10 class Pagination(object): def __init__(self, *args, **kwargs): self.current_page = kwargs.get('current_page', 1) # 当前页码 self.page_size = kwargs...
def length_message(x): print("The length of", repr(x), "is", len(x)) length_message('Fnord') length_message([1, 2, 3]) print()
print("\033[35m{:=^60}".format('\033[32mTabuada v3.0\033[35m')) while True: v = int(input('\033[32mDigite um valor para ver a sua tabuada: ')) if v < 0: break print('\033[35m-'*40) for c in range(1, 11): print(f'\033[36m{v} x {c} = {v * c}') print('\033[35m-'*40) print('\033[34mProgr...
sum=0 for j in range(int(input())): sum += (j+1) print(sum)
"""The `cargo_bootstrap` rule is used for bootstrapping cargo binaries in a repository rule.""" load("//cargo/private:cargo_utils.bzl", "get_host_triple", "get_rust_tools") load("//rust:defs.bzl", "rust_common") _CARGO_BUILD_MODES = [ "release", "debug", ] _FAIL_MESSAGE = """\ Process exited with code '{code...
# Copyright 2015 Google Inc. 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 applicable ...
#!/usr/bin/env python # -*- coding:utf-8 -*- # ProjectName: HW2 # FileName: write # Description: # TodoList: def writeOutput(result, path="output.txt"): res = "" if result == "PASS": res = "PASS" else: res += str(result[0]) + ',' + str(result[1]) with open(path, 'w') as f: f.write(re...
# https://www.hackerrank.com/challenges/bigger-is-greater def bigger_is_greater(string): s = list(string) if len(set(s)) == 1: return 'no answer' else: last = s[-1] for i, c in reversed(list(enumerate(s))): if c > last: last = c elif c < last...
class ApiError(Exception): def __init__(self, error, status_code): self.message = error self.status_code = status_code def __str__(self): return self.message
""" version which can be consumed from within the module """ VERSION_STR = "0.0.6" DESCRIPTION = "module to help you maintain third party apt repos in a sane way" APP_NAME = "pyapt" LOGGER_NAME = "pyapt"
value = input('Digite a chave de entrada: ') flag = 0 sample = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] for i in value: if i in sample: flag += 1 if flag == 1: print("Chave correta.") elif flag > 1: print("A chave possui mais de um interiro.") else: print("A chave faltando o caracter ...
# Copyright 2010-2016, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and ...
# Python Program To Handle IO Error Produced By Open() Function ''' Function Name : Open() Function Function Date : 23 Sep 2020 Function Author : Prasad Dangare Input : String Output : String ''' try: name = input('Enter Filename : ') f = open(name, 'r') exc...
lstano1827=[] listaano=[] somador=maisvalioso=itemvalioso=anovalioso=0 for k in range(2): descricao=str(input('descrição: ')) valor=int(input('valor: ')) ano=int(input('ano')) listaano.append(ano) somador=somador+valor if ano <=1827: lstano1827.append(ano) if valor>=maisvalioso: ...
#!/usr/bin/env python # coding: utf-8 # # Basic python syntax # The syntax of the Python programming language is the set of rules that defines how a Python program will be written and interpreted (by both the runtime system and by human readers).The Python language has many similarities to Perl, C, and Java. However,...
#!/usr/bin/env python3 def foo(): print('This is foo') print('Starting the program') foo() print('Ending the program')
# # PySNMP MIB module REDLINE-AN50-PMP-V2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/REDLINE-AN50-PMP-V2-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:55:17 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...
# # PySNMP MIB module ALCATEL-IND1-TIMETRA-OAM-TEST-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALCATEL-IND1-TIMETRA-OAM-TEST-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:19:55 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using P...
class HashMapList(object): def __init__(self, size=None, hash_function=hash): assert isinstance(size, int) self.array = list() for x in range(size): self.array.append(list()) self.size = size self.hash_function = hash_function def __setitem__(self, key, valu...
#! /usr/bin/python3 def backpack(value_1, value_2, weight, i, capacity, store={}): if i in store: if capacity in store[i]: return store[i][capacity] else: store[i] = {} result = 0 if i != len(weight) and capacity != 0: if weight[i] > capacity: return ...
# -*- coding: utf-8 -*- """ This package offers access to the standard database structure. All defined sources are belonging directly to the so called "standard configuration". Whenever you use a standard configuration for a topic (you configure this in your YAML see: :ref:`configuration`)you can find further informati...
def flatten_list(arr): result = [] for item in arr: if isinstance(item, list): result.extend(flatten_list(item)) else: result.append(item) return result def flatten_list(mapping): for key in mapping: if isinstance(mapping[key], dict): value = ...
#Crie um programa que leia uma frase qualquer e diga se ela é um palíndromo, desconsiderando os espaços. frase = input('Digite uma frase: ') frase = frase.strip().upper() palavras = frase.split() junto = ''.join(palavras) #junto = '*'join(palavras) -->Junta as palavras com asteriscos ligando elas! #There is no bui...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def getMinimumDifference(self, root: TreeNode) -> int: if not root: return -inf prev = -inf...
n = 0 tab = 0 while True: n = int(input('Você deseja mostrar a tabuada do número: ')) print('-' * 30) if n < 0: break for c in range (1, 10): c +=1 tab = n * c print('{} X {} = {}'.format(n, c, tab)) print('-' * 30) print('Programa encerrado!')
def isBadVersion(version): return True class Solution(object): def firstBadVersion(self, n): """ :type n: int :rtype: int """ left, right = 1, n while left <= right: mid = left + (right - left) / 2 if isBadVersion(mid): ri...
class ContainerRegistry: def __init__(self, server, username, password): self.server = server self.username = username self.password = password
count = 0 total = 0 for i in range(1, 7): amount = int(input(f"请输入第{i}位同学的饭费:")) total += amount count += 1 if total >= 300: break average = round(total / count,2) print(f"共{i}位同学掏钱了,一共{total}元,人均{average}元")
class Solution: def countPrimes(self, n: 'int') -> 'int': primeChecker = [True] * n if n < 2: return 0 primeChecker[0] = primeChecker[1] = False for i in range(2, int(n ** 0.5) + 1): if primeChecker[i]: primeChecker[i*i:n:i] = [False] * len(pri...
NUM_LEN = 12 def extract_with_bit(numbers, index, bit_value): return [number for number in numbers if number[index] == bit_value] def count_frequencies(numbers): # for each of the NUM_LEN bits, count the frequency of each bit freqs = [{"0": 0, "1": 0} for _ in range(NUM_LEN)] for number in numbers:...
""" Exercise Python 079: Crie um programa onde o usuário possa digitar vários valores numéricos e cadastre-os em uma lista. Caso o número já exista lá dentro, ele não será adicionado. No final, serão exibidos todos os valores únicos digitados, em ordem crescente. """ valuesList = [] while True: n = int(input('...
SERVICE_PATTERNS = { "LATEST": { "Stopping": re.compile(r'.*Stopping.*(service|container).*'), "Stopped": re.compile(r'.*Stopped.*(service|container).*'), "Starting": re.compile(r'.*Starting.*(service|container).*'), "Started": re.compile(r'.*Started.*(service|container).*') }, ...
has_bi_direction = False consider_literal = False kb_prefix = 'http://dbpedia.org/resource/' # kb_prefix = 'http://rdf.freebase.com/ns/' kb_type_predicate_list = ['a', 'rdf:type', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'] oracle_canidates_file = 'E:\kb_oracle_canidates_file'
n = int(input().strip()) N = n i = 2 while i * i <= n: if n % i: i += 1 else: n //= i if n == N: print(True) else: print(False)
# # Copyright (c) 2011-2015 Advanced Micro Devices, Inc. # All rights reserved. # # For use for simulation and test purposes only # # 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 co...
# Write your code here string = input() dict = {} maximum = 0 for i in string : if i in dict : dict[i] += 1 if dict[i] > maximum : maximum = dict[i] else : dict[i] = 1 for key,value in sorted(dict.items()) : if value == maximum : print(str(key),str(value)) ...
TRANSPARENT = 0 BLACK = 1 RED = 2 GREEN = 3 YELLOW = 4 BLUE = 5 MAGENTA = 6 CYAN = 7 WHITE = 8
# -*- coding: utf-8 -*- """ >>> from pycm import * >>> from pytest import warns >>> large_cm = ConfusionMatrix(list(range(10))+[2,3,5],list(range(10))+[1,7,2]) >>> with warns(RuntimeWarning, match='The confusion matrix is a high dimension matrix'): ... large_cm.print_matrix() Predict 0 1 2 3 ...
""" basic package information """ # This file is also parsed by setup.py, so it should # be limited to simple value definitions. # Single source of truth for package version __version__ = "0.3.1" __all__ = [ "__version__", ]
class UnregisteredHandlerException(Exception): """ Raised when the registry is unable to find a handler for a provided translations domain. """
# 1. Write an if statement that assigns 20 to the variable y, # and assigns 40 to the variable z if the variable x is greater # than 100. x = 101.0 if x > 100: y = 20 z = 40 # 2. Write an if statement that assigns 10 to the variable b, and # 50 to the variable c if the variable a is equal to 100. a = ...
a = [] def splitter(n, user_num): user_num_str = str(user_num) for i in range(0, n, 1): x = str(user_num_str[i]) a.append(x) x = 0 def mainer(): try: user = str(input()) a.append(user.split()) print(*a[0], sep='\n') except EOFError: print...
'''022 - ANALISADOR DE NOMES. PROGRAMA QUE LEIA UM NOME E DISTRICHE E MOSTRE ALGUMAS POSSIBILIDADES DO QUE PODE SER FEITO COM STRINGS''' nome = str(input('Digite seu nome completo: ')) print('Analisando seu nome...') print(f'Seu nome com letras maíusculas fica {nome.upper()}') print(f'Seu nome em minusculas fica {nome...
# Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def hasCycle(self, head): """ :type head: ListNode :rtype: bool """ if not head or not head.next: return...
#Special Pythagorean triplet def Euler9(sum): for a in range(1,sum): for b in range(1,sum): c=sum-a-b #print(str(a)+'\t\t'+str(b)+'\t\t'+str(c)) if (a*a+b*b)==(c*c): return (a,b,c,a*b*c) for i in range(1000,1001): print(str(i)+'\t\t'+str(Euler9(i)))
t = int(input()) for i in range(t): n,a,b = map(int, input().split()) s = [] for j in range(n): s.append(chr(97 + (j%b))) print(''.join(s))