content
stringlengths
7
1.05M
contents = [ ( "Getting Started", [ ("welcome/index.html", "Welcome to yt!", "What's yt all about?"), ( "orientation/index.html", "yt Orientation", "Quickly get up and running with yt: zero to sixty.", ), ...
class DataStream: def __init__(self, *args): self._processObjects = args; self._ports = [] self.finished = False self._executeToken = 0 for po in self._processObjects: for i in range(po.getNrOfOutputPorts()): self._ports.append(po.getOutputPort(i))...
"""Representation and helpers for app, system, metadata, job permissions """ PEM_POSIX_MAPPING = { 'NONE': '---', 'READ': 'r--', 'WRITE': '-w-', 'EXECUTE': '--x', 'READ_WRITE': 'rw-', 'READ_EXECUTE': 'r-x', 'WRITE_EXECUTE': '-wx', 'ALL': 'rwx' } __all__ = ['posixify_pem'] def posixif...
# Day 2 - part 1 def run_intcode_computer(program): return run_program(program, 0) # Day 2 - part 2 def find_input_brute_force(program, output): for noun in range(0, 99): for verb in range(0, 99): memory = program.copy() memory[1] = noun memory[2] = verb memory = run_program(memory, 0) ...
# Copyright 2020 Aeris Communications Inc. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
for _ in range(int(input())): M, x, y = map(int, input().split()) cops = [int(x)-1 for x in input().split()] can_hide = [True] * 100 for c in cops: can_hide[c] = False i = 1 while i <= x * y: if c-i >= 0: can_hide[c-i] = False if c+i < 100:...
nome = 'Paulo Oliveira' idade = 30 altura = 1.79 peso = 85 ano_atual = 2021 imc = peso / (altura * altura) ano_nascimento = ano_atual - idade print(f'{nome} tem {idade} anos, {altura} de altura e pesa {peso}.\n' f'O IMC de {nome} é {imc:.2f}.\n' f'{nome} nasceu em {ano_nascimento}.')
""" # Problem 40: Champernowne's constant An irrational decimal fraction is created by concatenating the positive integers: 0.123456789101112131415161718192021... | It can be seen that the 12th digit of the fractional part is 1. If dn represents the nth digit of the fractional part, find the value of th...
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None # class Solution: # # def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: # if not l1 and not l2: # return None # if not l1 and l2: # r...
# -*- coding: utf-8 -*- """ Created on Tue Jun 23 11:04:19 2020 @author: William """
""" return only unique values Complexity: O(n) Memory complexity: O(n) """ unordered_elements = [12, 43, 1, 3, 1, 3, 44, 21, 2, 18, 15, 19, 1, 33, 45, 2, 22, 2] def unique(elements): seen = set() for element in elements: if element in seen: continue seen.add(element) yiel...
#Escreva um programa que leia a velocidade de um carro. Se ele ultrapassar 80Km/h, mostre uma mensagem dizendo que ele foi multado. # A multa vai custar R$7,00 por cada Km acima do limite. v = float(input('Qual a velocidade atual do carro: ')) l = 80 m = (v-l)*7 if v > l: print('Você foi multado porque excedeu o li...
""" 590. N-ary Tree Postorder Traversal Given an n-ary tree, return the postorder traversal of its nodes' values. Nary-Tree input serialization is represented in their level order traversal, each group of children is separated by the null value (See examples). Follow up: Recursive solution is trivial, could you d...
# pylint: disable=R0903, useless-object-inheritance """ Simple test case for an annoying behavior in pylint. """ __revision__ = 'pouet' class Test(object): """Smallest test case for reported issue.""" def __init__(self): self._thing = None @property def myattr(self): """Getter for my...
class Foo: x y = 123 def bar(self): self.z self.baz = 456
# -*- coding: utf-8 -*- try: a = int(input("Lütfen 1. Sayıyı Giriniz: ")) b = int(input("Lütfen 2. Sayıyı Giriniz: ")) print(a/b) except ValueError: print("Lütfen int değer giriniz") except ZeroDivisionError: print("Sayılar 0'a Bölünemez") #%% try: a = ...
#!/usr/bin/env python3.6 """ Example usages for pdfminer """ def parse_pdf_to_string(pdf_file_path): """ :param pdf_file_path: file path of a pdf to convert into a string :return: string of the parsed pdf """ pdf_string = '' return pdf_string def multithreaded_parse_pdf_to_string(pdf_file_p...
def fakulteta(n): zmnozek = 1 for x in range(1,n+1): zmnozek *= x return zmnozek def vsota_stevk_fakultete(n): fakul = fakulteta(n) vsota = 0 while fakul > 0: vsota += fakul % 10 fakul //= 10 return vsota vsota_stevk_fakultete(100)
# number calculation x=3+6 print(x) # x=x+1 # update the variable by +1 x+=1 # x=x+1 print(x) print ("////////////////////////////////////////////////////") # String calculation str1="Hello" *3 str2="Hell\"o" str3="Hello"+"World" str4="Hello\nWorld" print(str1) print(str2) print(str3) print(str4) print ("////////...
#!/usr/bin/env python # coding: utf-8 # * Validate hexadecimal in range (0, 2**16):<br> # * 1. at least one and not more than 4 hexdigits in one chunk # * 2. only hexdigits are allowed: 0-9, a-f, A-F # # valid ipv6 ="18:36:F3:98:4F:9A" # In[1]: # Validate hexadecimal in range (0, 2**16): # 1. at least one and not ...
''' Problem Statement : A rainbow array of n elements follows the form { 1 (repeated a1 times), 2 (a2 times), 3 (a3 times), 4 (a4 times), 5 (a5 times), 6 (a6 times), 7 (a7 times), 6 (a6 times), 5 (a5 times), 4 (a4 times), 3 (a3 times), 2 (a2 times), 1 (a1 times) Given an array consisting of n elements, check if it’s...
print ("Both parties agree to a single prime") prime=int(input("Enter the prime number to be considered: ")) # Primitive root to be used use print ("Both must agree with single primitive root to use") root=int(input("Enter the primitive root: ")) # Party1 chooses a secret number alicesecret=int(input("Enter...
blueprint = [] h = 10 w = 8 ID = 1 roofSize = 3 for wi in range(w+1): blueprint.append((0,wi,5,6)) for hi in range(1,4): for wi in range(1,w): blueprint.append((hi,wi,16,8)) blueprint.append((hi,0,20,10)) blueprint.append((hi,w,20,10)) for hi in range(4,h-roofSize): blueprint.append((hi,0,5...
def divide(n1 , n2): try: return n1 / n2 except ZeroDivisionError as error: print('Log: ', error) raise try: print(divide(2,0)) except ZeroDivisionError as error: print(error)
class Test: def __init__(self, *args, **kwargs) -> None: self.args = args self.kwargs = kwargs def test_func(self) -> None: self.args = 'Nothing' class Test2(Test): def __init__(self, *args, **kwargs) -> None: super().__init__(*args, **kwargs) obj0 = Test(0, test=1) ob...
# Reads a list of integers num_iterations = int(input()) list_items = [] for element in range(num_iterations): list_items.append(int(input())) result = 0 for element in list_items: result += element print(result)
class Animals: AnimalsType = "Mammal" class Pets(Animals): Color = "Multicolor" class Dogs(Pets): @staticmethod def barks(): print("Bow Bow!!") d = Dogs() d.barks() d.barks()
""" 1. Can build a sitemap from a folder 1.1 Number of nodes 1.2 Number of pages in each node 1.3 Node Attributes 1.3.1 Url 1.3.2 Full Url 1.3.3 Source Folder 1.3.4 Temp Folder 1.3.5 Target Folder 1.3.6 Listing Page 1.4 Page Attributes 1.4.1 Ti...
# -*- coding: utf-8 -*- """Generic HTTP Request representation passed to Refget functions The Request class represents the genericized HTTP request passed to the Refget service. The generic request is used in all Refget functions. Vendor/Platform-specific request objects (e.g. Tornado Server Request, AWS lambda reque...
#!/usr/bin/python # Vigenere Cipher (Polyalphabetic Substitution Cipher) # http://inventwithpython.com/hacking (BSD Licensed) # Further Edited by Mike Weaver to not require pyperclip # and to add additinoal functionality to main() LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' def main(): message = input('Enter message:...
# Copyright (c) 2019 The ProtobufBytes Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def protobuf_bytes_deps(): if not native.existing_rule("rules_proto"): ...
class Solution: def trimMean(self, arr: List[int]) -> float: arr.sort() n = len(arr) * 5 //100 return sum(arr[n:-n])/(len(arr)-(n<<1))
yaxis = 0 xaxis = 0 dead = 0 torch = 0 key = 0 doorone = 0 while dead == 0: if yaxis == 0 and xaxis == 0: answer = input("You are in a stone hallway with two exits. Go north, or south?: ") if answer == "north": yaxis = yaxis + 1 elif answer == "south": yaxis = yaxis - 1 #------------------------------...
class ImageExportOptions(object,IDisposable): """ This class defines options for exporting views and sheets as an image. ImageExportOptions() """ def Dispose(self): """ Dispose(self: ImageExportOptions) """ pass @staticmethod def GetFileName(aDoc,dbViewId): """ GetFileName(aDoc: Document,...
# Dictionary(lug'at) """ Dictionary (lug'at) bu tartiblanmagan, o'zgartiriladigan va indexlangan to'plamdir! ularda kalitlar va qiymatlar saqlanadi! """ # Set """ Set bu tartiblanmagan va takrorlanmagan elementlardan tashkil topgan to'plam! ...
input = """ q(a,b,c). q(b,c,a). q(c,b,c). q(b,b,c). q(a,b,b). q(c,a,a). s(c,b). s(a,b). s(a,c). s(c,c). t(a). t(b). w(b,c). w(b,b). w(a,a). p(X,Y) :- q(X,b,Z), r(Z,b,Y), not r(X,Y,Z). m(X,Y) :- u(a,X,Y,Y,c,X). v(X) :- s(a,X), not t(X). n(X,X) :- q(X,b,X). r(X,Y,Z) :- t(a), s(X,Z), w(X,Y), not p(Z,Y). """ output = ...
weights_str = input('体重(kg)をカンマ区切りで入力してください: ') weight_str_list = weights_str.split(',') weight_list = [] for weight_str in weight_str_list: weight = int(weight_str) weight_list.append(weight) height_str = input('身長(cm)を入力してください: ') height = int(height_str) for weight in weight_list: bmi = weight / (heig...
''' - Leetcode problem: 203 - Difficulty: Easy - Brief problem description: Remove all elements from a linked list of integers that have value val. Example: Input: 1->2->6->3->4->5->6, val = 6 Output: 1->2->3->4->5 - Solution Summary: - Used Resources: --- Bo Zhou ''' # Definition for singly-linked list. # c...
'''Config file for log_parser''' #Path to 'POET' log file POET_LOG = './Test_Logs/poet.log' #Path to 'Heartbeat' log file HEARTBEAT_LOG = './Test_Logs/heartbeat.log'
{ # pylint: disable=C8101,C8103 'name': 'Odoo Next - Website Address', 'description': 'Adds fields to address checkout', 'version': '14.0.1.0.1', 'category': 'Website', 'author': 'Trustcode', 'license': 'OEEL-1', 'website': 'http://www.odoo-next.com.br', 'contributors': [ 'Danim...
class MetastoreCredentials: def __init__(self): pass def to_dict(self): return {} class InvalidCredentials: def __init__(self, reason: str): self.reason = reason def to_dict(self): return {}
class Solution: def getHappyString(self, n: int, k: int) -> str: base = 1 << (n - 1) if k > 3 * base: return '' table = {'a': 'bc', 'b': 'ac', 'c': 'ab'} k -= 1 index, k = divmod(k, base) result = chr(ord('a') + index) base >>= 1 while base...
#------------------------------------------------------------------------------------------# # This file is part of Pyccel which is released under MIT License. See the LICENSE file or # # go to https://github.com/pyccel/pyccel/blob/master/LICENSE for full license details. # #----------------------------------------...
""" Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at a random position. Find the letter that was added in t. Runtime: 40 ms, faster than 84.44% of Python3 online submissions for Find the Difference. Memory Usage: 13...
VARIABLE_STATIC_LENGTH = 5 TYPE_STRING = 1 TYPE_INT = 2
def say_hello(name="world"): print("hello " + name + "!") say_hello()
def upper_filename_before_dot(file): name, dot, format = file.name.rpartition('.') if len(name) > 4: return f'{name[:-5]}/{name[-4:].upper()}{dot}{format}' return f'{name.upper()}{dot}{format}' def parse_filename(instance): dir, slash, name = instance.file.name.rpartition('/') name, dot, f...
print('Esta aula resolve o >>>DESAFIO 04 - Dissecando uma variável. <<<') algo = input('Digite algo para mostrarmos seu tipo primitivo e demais informações: >>> ') print('Você digitou {} e o tipo deste dado é {} '.format(algo, type(algo))) print('Só tem espaços? {}'.format(algo.isspace())) print('É um número? {}'.forma...
""" This file is create and managed by Tahir Iqbal ---------------------------------------------- It can be use only for education purpose """ # Value vs Reference type Functions # Value Type print('*Value Type*') num = 100 def change_num(n): n += 100 print('Inner num : ', n) change_num(num) print(...
""" helper functions """ def title_to_slug(title: str) -> str: """ :param title: (str) e.g. 'A Very Good Book' :return: (str) 'a-very-good-book' """ return '-'.join(title.lower().split())
def int_diff(arr, n): num=0 for i in range(len(arr)): for j in range(i+1,len(arr)): if abs(arr[i]-arr[j])==n: num+=1 return num
# -*- coding: utf-8 -*- LANGUAGES = [ 'english', 'polish', 'german', ]
""" LeetCode Problem: 40. Combination Sum II Link: https://leetcode.com/problems/combination-sum-ii/ Language: Python Written by: Mostofa Adib Shakib Time Complexity: O(2^N) Space Complexity: O(N) """ class Solution: def combinationSum2(self, candidates: List[int], target: int) -> List[List[int]]: candida...
# This Python program displays ASCII art # # by Aleksander Rohozinski # Febuary 14, 2022 # ICS 2O - Ashbury College # Mr. Giansante # ------------------------------------------------------- print(" _ _ _ _ _ _ _ _ ") print("| | | | | | | | | ...
__all__ = [ 'GENERAL_SETTINGS_FILE', 'GUL_INPUT_FILES', 'GUL_SUMMARIES_FILE', 'INPUT_FILES', 'IL_INPUT_FILES', 'IL_SUMMARIES_FILE', 'MODEL_SETTINGS_FILE', 'OPTIONAL_INPUT_FILES', 'TAR_FILE' ] INPUT_FILES = { 'complex_items': {'name': 'complex_items', 'type': 'gul', 'conversion_t...
class BlackjackGameButtonView: control_y_axis = 153 new_game_x_axis = 650 quit_x_axis = 760 control_button_width = 100 control_button_height = 40
""" https://www.hackerrank.com/challenges/2d-array/problem """ def main(arr): max_so_far = -63 # Because 7 x 9 = 63 x = 1 y = 1 count = 0 while x <= 4: y = 1 while y <= 4: top = arr[x-1][y-1] + arr[x-1][y] + arr[x-1][y+1] middle = arr[x][y] bot...
def count_positives_sum_negatives(arr): if not arr: return [] pos = 0 neg = 0 for n in arr: if n > 0: pos = pos + 1 else: neg = neg + n return [pos, neg] def count_positives_sum_negatives1(arr): if not arr: return [] pos = 0 neg = 0 f...
# def leiaInt(txt): # while True: # valor = str(input(txt)).strip() # if valor.isnumeric() is True: # break # else: # print('ERRO! Digite um número inteiro válido') # return valor # # def leiaFloat(txt): # cont = 0 # while True: # valor = str(input...
# -*- coding: utf-8 -*- class Command(object): def __init__(self, trigger): self._trigger = trigger def description(self, *args, **kwargs): pass def usage(self, *args, **kwargs): pass def run(self, *args, **kwargs): pass def trigger(self): ...
""" Escrevendo um iterador customizado """ class Contador: def __init__(self, menor, maior): self.menor = menor self.maior = maior def __iter__(self): return self def __next__(self): if self.menor < self.maior: numero = self.menor self.menor = s...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: Pieter Huycke email: pieter.huycke@ugent.be GitHub: phuycke """ #%% S = str(input("What is your name?\n")) print(S[::2]) print(S[2:8:-1])
def get_num_teams(league_id='390.l.XXXXXX'): url = 'https://fantasysports.yahooapis.com/fantasy/v2/leagues;league_keys={}'.format('390.l.227235') response = oauth.session.get(url, params={'format': 'json'}) r = response.json() return r['fantasy_content']['leagues']['0']['league'][0]['num_teams']
# t > 25 >>>>> vay cheghad garmame! # t < 15 >>>>> kapshen niyaz shodam man! # ajab havaye mizuniye! # temperature print("***Temperature Checker***") temperature = int(input("Enter Temperature: ")) if temperature > 25: print("Weather is EXTREMLY HOT!") elif temperature < 15: print("I really need WARM cloth!")...
lc = list() lp = list() li = list() while True: n = int(input('Digite um número: ')) lc.append(n) if n % 2 == 0: lp.append(n) else: li.append(n) r = str(input('Quer continuar? [S/N] ')).strip() if r in 'Nn': break print(20*'=-') print(f'A lista completa é {lc}') print(f'A...
num1 = 19 num2 = 22 num6 = 9999 num3 = 666 num4 = 878 num8 = 10000
# 0 1 1 2 3 5 def fibonacci(n): if n == 0 or n == 1: return n return fibonacci(n-1) + fibonacci(n-2) print(fibonacci(5)) # Normal way to do fibonacci class A: def fibo(n): f1 = 0 f2 = 1 test = "" for i in range(1,n): test = f1 + f2 f1 = f2 ...
minimal_map =""" <map version="freeplane 1.7.0"> <!--To view this file, download free mind mapping software Freeplane from http://freeplane.sourceforge.net --> <node TEXT="new_mindmap" FOLDED="false" ID="ID_1723255651" CREATED="1283093380553" MODIFIED="1283093380553"><hook NAME="MapStyle"> <properties edgeColorConf...
''' BGP Genie Ops Object Outputs for IOSXE. ''' class BgpOutput(object): show_bgp_all_summary = '''\ show bgp all summary For address family: IPv4 Unicast BGP router identifier 1.1.1.1, local AS number 65000 BGP table version is 4, main routing table version 4 3 network e...
def count_substring(string, sub_string): # there are two ways of acheieving it, as usual one we will put in comments. # 1st method as suggested in concept of question count = 0 #sub_string_len =len(sub_string) # Finding length of sub_string #for i in range(0, len(string)): # Looping through string f...
""" ## Question : Medium ### 238. [Product of Array Except Self](https://leetcode.com/problems/product-of-array-except-self/) Given an array nums of n integers where n > 1, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i]. Example: Input: [1,2,3,4] Output:...
#!/usr/bin/env python """Provides classes and algorithms for dealing with matrices. """ __all__ = ['distance'] __author__ = "" __copyright__ = "Copyright 2007-2012, The Cogent Project" __credits__ = ["Greg Caporaso", "Rob Knight"] __license__ = "GPL" __version__ = "1.5.3" __maintainer__ = "Greg Caporaso" __email__ = ...
number = int(input()) price = 5 * number if number > 1: price *= 0.9 # 10% discount price *= 1.07 # Tax print("%.2f" % price)
# Map for SVG graphics from HTML num_class = ['M8.954 30V3.545h-.267c-.738.41-6.706 4.655-7.71 5.311V5.883c.635-.41 6.767-4.758 7.977-5.476h2.789V30h-2.79z', 'M.12 9.57C.16 4.462 4.057.791 9.41.791c5.209 0 9.187 3.568 9.187 8.224 0 3.076-1.415 5.475-6.275 10.664l-7.998 8.53v.247h15.012V31H.284v-1.969L10....
""" Day 7 - Part 2 https://adventofcode.com/2021/day/7#part2 By NORXND @ 07.12.2021 (C) NORXND 2021 - Under The MIT License """ input_file = open('Day7/input.txt', 'r') crab_positions = [] l = input_file.read().split(",") for x in l: crab_positions.append(int(x)) fuel_cost = {} for dest in range(0, max(crab_p...
class Constraint(object): def __init__(self, parent, cat_constructor,*args): self.parentsDict = parent self.parent=parent[parent[-1]] self.cat_constructor = cat_constructor self.references = [i for i in args] @property def name(self): return self.cat_const...
# Run tests if __name__ == '__main__': print('Running all the tests...')
class Maths(object): MATHS_CLASS_MEMBER=0.1 def __init__(self, num): self.maths_instance_member = num def maths_instance_method(self): print("Hello from instance method") class MultipleArg(object): def __init__(self, num, str, other = 0): self.multipleArg_instance_member_num = num + other s...
db_host="127.0.0.1" db_port="3306" db_user="" db_pass="" db_database="" twitch_key="" twitch_channel=""
def valid_character(number): return True if int(number) > 0 and int(number) < 27 else False def solve(message): if message == '': return 1 else: number_of_solutions = 0 if valid_character(message[:1]): number_of_solutions += (solve(message[1:])) if len(message...
def text_to_words(the_text): """ return a list of words with all punctuation removed, and all in lowercase. """ my_substitutions = the_text.maketrans( # If you find any of these "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!\"#$%&()*+,-./:;<=>?@[]^_`{|}~'\\", # Replace them by these ...
HW_SOURCE_FILE = 'hw03.py' ######### # Trees # ######### def tree(label, branches=[]): """Construct a tree with the given label value and a list of branches.""" for branch in branches: assert is_tree(branch), 'branches must be trees' return [label] + list(branches) def label(tree): """Return ...
# Function to to check null in dataset def null_check(df): for _ in df: if None in df.isnull(): print("No Error") else: print("Error")
class Solution: def removeDuplicates(self, nums: [int]) -> int: if len(nums) == 0: return 0 order = 0 for i in range(1, len(nums)): if nums[order] != nums[i]: order += 1 nums[order] = nums[i] return order + 1
# -*- coding: utf-8 -*- """ Created on Fri Apr 26 10:47:52 2019 @author: jercas """ """ offer66-4 '二维数组中的查找' 在一个二维数组中(每个一维数组的长度相同),每一行都按照从左到右递增的顺序排序, 每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。 """ class Solution: # array 二维列表 def Find(self, target, array): if len(array[0]) == 0: return False ...
""" Calculate Lamé's first and second parameter. """ def lame_lambda(pvel, svel, density): r""" Calculate Lamé's first parameter :math:`\lambda`. Defined in terms of the P and S wave velocities (:math:`v_P` and :math:`v_S`) and the density (:math:`\rho`). .. math:: \lambda = v_P^2 \rho ...
# # For licensing see accompanying LICENSE file. # Copyright (C) 2021 Apple Inc. All Rights Reserved. # # Architecture parameters DEFAULT_PARAMS = { "epochs": 200, "test_freq": 20, "batch_size": 128, "momentum": 0.9, "weight_decay": 0.0005, } DEFAULT_IMAGENET_PARAMS = { **DEFAULT_PARAMS, "...
def preencherInventario(lista): resp="S" while resp=="S": equipamento=[input("Equipamento: "), float(input("Valor: ")), int(input("Numero Serial: ")), input("Departamento: ")] lista.append(equipamento) resp=input("Digite \"s\" para continuar: ").uppe...
# 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"); you may...
""" Complexos: É São numeros que possuem varivéis, com números imaginários. exemplo: 3J """ numero_complexo = 2-2j print(type(numero_complexo)) """ Boolean True or false """ nome_var1 = False nome_var2 = True """ String Todos os dados que estão entre - ' ' = aspas simples ...
class BaseError(Exception): pass class UserTokenRequiredError(BaseError): pass class XboxUserTokenRequiredError(BaseError): pass class XstsXboxTokenRequiredError(BaseError): pass class XstsHaloTokenRequiredError(BaseError): pass class SpartanTokenRequiredError(BaseError): pass class ...
no = str(input("Digite o nome completo: ")).strip() nome = no.split() print('seu primeiro nome é {}'.format(nome[0])) print('seu ultimo nome é {}'.format(nome[len(nome)-1]))
""" Count the Lone Ones Create a function which counts how many lone 1s appear in a given number. Lone means the number doesn't appear twice or more in a row. Examples count_lone_ones(101) ➞ 2 count_lone_ones(1191) ➞ 1 count_lone_ones(1111) ➞ 0 count_lone_ones(462) ➞ 0 """ def count_lone_ones(n): a, count = l...
class GrowthCalculator(object): def __init__(self): """ Sets default values for the following instance variables: Lotka-Volterra equation coefficients: self.a - Growing rate of prey when there's no predators self.b - Dying rate of prey due to predation se...
a = input() b = input() x = min(len(a), len(b)) correct = [] for c in range(1, x+1): if b.endswith(a[:c]): correct.append(c) if correct: print(max(correct)) else: print(0)
class ScriptError(Exception): pass class SheetsNotSelected(ScriptError): pass class ElemNotFound(ScriptError): pass
""" Minion status monitoring Maps to the `status` execution module. """ __monitor__ = [ "loadavg", "process", ] def loadavg(name, maximum=None, minimum=None): """ Return the current load average for the specified minion. Available values for name are `1-min`, `5-min` and `15-min`. `minimum` and ...
""" Easy, Wayfair You are given a 2 x N board, and instructed to completely cover the board with the following shapes: * Dominoes, or 2 x 1 rectangles. * Trominoes, or L-shapes. For example, if N = 4, here is one possible configuration, where A is a domino, and B and C are trominoes. ``` A B B C A B C C ``` Given ...
#All three functions #repss the number of time and element appear def count(s): l1=[] for i in s: l1.append(i.lower()) a = [ord(x) for x in l1] b = [(a.reps(x)) for x in a] char = [x for x in s] x = dict(zip(char,b)) return x def count_list(string): #Works with lists ...
""" Problem 3_1: Write a function that reads a text file and counts the number of characters in it. Print both the text file and the number of characters. Do this so that the printout isn't doubled space (use an end="" argument in the print statement). Also, skip a line before printing the count. Note that it is easy...