content
stringlengths
7
1.05M
''' Operador ternário em python ''' logged_user = True idade = 17 # if logged_user: #logged_user == True # msg = 'Usuário logado.' # else: # msg = 'Usuário precisa logar.' msg = 'Usuário logado.' if logged_user else 'Usuário precisa logar.' print(msg) maior_idade = (idade >= 18) msg2 = 'Pode acessar' if maior...
__title__ = 'syspass-api-client' __description__ = 'sysPass API client library for Python.' __url__ = 'https://github.com/sysPass/syspass-api-client-python' __version__ = '0.1.3' __build__ = 19090601 __author__ = 'Rubén Domínguez' __author_email__ = 'nuxsmin@syspass.org' __license__ = 'Apache 2.0' __copyright__ = 'Copy...
def parse_cds_header(header_str): data = header_str.split('|') data_count = len(data) data_dict = dict(zip(data[0:data_count:2], data[1:data_count:2])) return data_dict def parse_nt_header(header_str): data = header_str.split('|') data_dict = {} data_dict['gi'] = int(data[1]) data_dict['accession'] = data[3] ...
#072_Numero_por_extenso.py num = ("Zero", "Um", "Dois", "Três", "Quatro", "Cinco", "Seis", "Sete", "Oito", "Nove", "Dez") while True: n = int(input("Digite um número (1 - 10): ")) while n not in range(0,11): print("Tente novamente!") n = int(input("Digite um número entre 0 e 10: ")) prin...
""" https://leetcode.com/problems/4sum-ii """ # define an input for testing purposes A = [1, 2] B = [-2, -1] C = [-1, 2] D = [0, 2] # actual code to submit tracker = {} solution = 0 for i in range(len(A)): for z in range(len(B)): num = A[i] + B[z] if num in tracker: tracker[num] = tra...
# Count Binary Substrings: https://leetcode.com/problems/count-binary-substrings/ # Give a binary string s, return the number of non-empty substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in these substrings are grouped consecutively. # Substrings that occur multiple times are count...
#!/usr/bin/python """ Copyright (c) 2014 tilt (https://github.com/AeonDave/sir) See the file 'LICENSE' for copying permission """ pass
# create he following pattern # ['h'] # ['h', 'e'] # ['h', 'e', 'l'] # ['h', 'e', 'l', 'l'] # ['h', 'e', 'l', 'l', 'o'] text='hello' my_list=[] for char in text: my_list.append(char) print(my_list)
class Input(object): """This class represents inputs. Mainly, this class used to be able to distinguish between inputs and outputs.""" def __init__(self, value): super(Input, self).__init__() self.value = value def __str__(self): return 'in(' + str(self.value) + ')' def __repr__(self): return str(self)
age = input("Enter birthdate in dd/mm/yyyy format? ") age_year = age[-4:] age_in_2021 = 2021-int(age_year) last_character=age_in_2021 % 10 c=" "*7+"_"*(5-int(last_character/2))+"i"*last_character+"_"*(5-int(last_character/2))+" "*7 print(c) a=""" |:H:a:p:p:y:| __|___________|__ |^^^^^^^^^^^^^^^^^| |:...
def do_calculate(vl, v): vs = vl.get('groesse') * vl.get('pauschalwert_qm') price = vs * vl.get('praemiensatz') price = price + vs * vl.get('katastrophenschutz') # price = price + price / \ # v['praemiensatz'] * \ # c(vl, 'hochwasser', v['hochwasser']["1"]) # # Sicherungen vorhand...
class AllianzeAccountCreator: """ Allianze Account Creator """ def __init__(self, allanze_account_command): self.allanze_account_command = allanze_account_command def __call__(self): self.__repo.update_or_create() allianze_serializer = AllianzeAccountSerializer(data=request.d...
# Basic Addition Calculator Program # Takes input from the user and outputs the sum of those two numbers. num1 = input("Enter a number: ") num2 = input("Enter another number: ") # Python by default converts inputs into strings a function is used to convert them into numbers. # Float is used to allow the use of decimal...
def append_file(password, file_path): try: password_file = open(file_path, "a+") password_file.write(password + "\r\n") password_file.close() except PermissionError as Err: print("Error creating file: {}".format(Err))
# Um exemplo mais realista envolveria mais de tres alienígenas, com um código que gere automaticamente # cada alienígena. No exemplo a seguir vamos usar um range() para criar uma frota de 30 alienígenas. # informações sobre um alienigena em particular: aliens = [] # cria uma lista vazia para armazena...
def mean(interactions, _): """Computes the mean interaction of the user (if user_based == true) or the mean interaction of the item (item user_based == false). It simply sums the interaction values of the neighbours and divides by the total number of neighbours.""" count, interaction_sum = 0, 0 for...
LANGUAGES = ['cs', 'da', 'de', 'en', 'es', 'et', 'fi', 'fr', 'it', 'nl', 'ro', 'pt', 'el', 'lt', 'lv'] LANGUAGE_DICTIONARY = {'cs' : 'Czech', 'da' : 'Danish', 'de' : 'German', 'en' : 'English', 'es' : 'Spanis...
class MacOsJob: def __init__(self, os_version, is_build=False, is_test=False, extra_props=tuple()): # extra_props is tuple type, because mutable data structures for argument defaults # is not recommended. self.os_version = os_version self.is_build = is_build self.is_test = is...
# Problem: Longest Palindrome # Difficulty: Easy # Category: String # Leetcode 409: https://leetcode.com/problems/longest-palindrome/description/ # Description: """ Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters. This is c...
__all__ = [ "job_poll", "single_job", ]
""" Module: 'flowlib.faces._calc' on M5 FlowUI v1.4.0-beta """ # MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11-284-g5d8e1c867 on 2019-08-30', machine='ESP32 module with ESP32') # Stubber: 1.3.1 class Calc: '' def _available(): pass def _update(): pass def c...
class Solution: def generateTheString(self, n): ans=[] if n%2==0: ans=['a' for i in range(n-1)] ans.append('b') else: ans=['a' for i in range(n)] return ans
""" As the original oauth2_provider models are overwritten and users are forced to inherit from the new models here in drf_integrations, every migration in oauth2_provider must be replicated here, and it has to be added as a dependency to the migration. For example, migration 0002 here has as a dependency the migratio...
# singleton tuple <- singleton tuple x, = 0, print(x) # singleton tuple <- singleton list x, = [-1] print(x) # binary tuple <- binary tuple x,y = 1,2 print(x,y) # binary tuple swap x,y = y,x print(x,y) # ternary tuple <- ternary tuple x,y,z = 3,4,5 print(x,y,z) # singleton list <- singleton list [x] = [42] print(x) # s...
def f1(): pass def f2(): pass def f3(): def f35(): pass
n = int(input()) print('*'*n) for _ in range(n-2): print(f'*{" " * (n - 2)}*') print('*'*n)
# Copyright (c) 2010 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'targets': [ { 'target_name': 'ceee_ie_all', 'type': 'none', 'dependencies': [ 'common/common.gyp:*', 'broker/b...
expected_output = { "fsol_packet_drop": 0, "cac_status": "Not Dropping", "cac_state": "ACTIVE", "total_call_session_charges": 0, "cac_duration": 372898, "calls_accepted": 48667, "current_actual_cpu": 3, "call_limit": 350, "cpu_limit": 80, "calls_rejected": 3381, "cac_events":...
# TODO Introduce DesignViolation escalation system class DictAttrs(object): def __init__(self, **dic): self.__dict__.update(dic) def __iter__(self): return self.__dict__.__iter__() def __getitem__(self, item): return self.__dict__.__getitem__(item) def __getattr__(self, item): if not item in self.__dic...
class Solution: def uniqueOccurrences(self, arr: List[int]) -> bool: occ = {} for num in arr: if num not in occ: occ[num] = 1 else: occ[num] += 1 x = list(occ.values()) return len(set(x)) == len(x)
n = int(input()) class Tree: left_node = None right_node = None node_dict = dict([]) for i in range(n): root, left, right = input().split() node_dict[root] = Tree() node_dict[root].left_node = left node_dict[root].right_node = right def prefix(root): left = node_dict[root].left_n...
class Solution: def rob(self, nums: List[int]) -> int: if len(nums) == 0: return 0 if len(nums) <= 2: return max(nums) cache = [0] * len(nums) cache[0] = nums[0] cache[1] = max(nums[1], nums[0]) for i in range(2, len(nums) - 1...
class Solution: def maxLengthBetweenEqualCharacters(self, s: str) -> int: char_dict = {} max = 0 for i in range(len(s)): t = char_dict.get(s[i],-1) if t==-1: char_dict[s[i]] = i else: if i-t>max: ...
def make_car(manufacturer, model_name, **arguments): new_car = { 'manufacturer': manufacturer, 'model_name': model_name, } for key, value in arguments.items(): new_car[key] = value return new_car car = make_car('subaru', 'outback', color='blue', tow_package=True) print(car...
class Node: """node class for linked list""" def __init__(self, data): self.data = data # Node data self.next = None # Reference for next node class LinkedList: """Linked List Class""" def __init__(self): self.head = None # the first node(head node) self.tail = None...
################################################################################ # Design Automation # ################################################################################ ''' Author: Sean Lam Contact: seanlm@student.ubc.ca '''
# # below is Okceg v0.1 # # def is_num(jerry): # try: # int(jerry) # except: # try: # float(jerry) # except: # return False # else: # return True # else: # return True # # print('\nInteractive Okceg Shell!\npowered by python\n') # #...
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def oddEvenList(self, head): """ :type head: ListNode :rtype: ListNode """ if head is None or head.next is None: ...
c.Authenticator.admin_users = {'jupyterhub'} c.JupyterHub.services = [ { 'command': [ '/opt/conda/bin/comsoljupyter', 'web', '-s', '/srv/jupyterhub', '12345', 'http://jupyter.radiasoft.org:8000', ], 'name': 'comsol', 'url': 'http://127.0.0.1:12345...
''' Aim: Given a base-10 integer, n, convert it to binary (base-2). Then find and print the base-10 integer denoting the maximum number of consecutive 1's in n's binary representation. ''' n = int(input()) # getting input remainder = [] while n > 0: rm = n % 2 n = n//2 ...
class node: def __init__(self,key): self.left=self.right=None self.val=key def printlevel(root,level): if root==None: return if level==0: print(root.val,end=' ') else: printlevel(root.left,level-1) printlevel(root.right,level-1) root=node(1) roo...
''' Classe Pessoa: Crie uma classe que modele uma pessoa: Atributos: nome, idade, peso e altura Métodos: Envelhercer, engordar, emagrecer, crescer. Obs: Por padrão, a cada ano que nossa pessoa envelhece, sendo a idade dela menor que 21 anos, ela deve crescer 0,5 cm. >>> YHAGO = Pessoa('Yhago Carvalho', 27, 98, 1.88) ...
"""This file contains custom Exceptions for pysradb """ class MissingQueryException(Exception): """Exception raised when the user did not supply any query fields. Attributes: message: string Error message for this Exception """ def __init__(self): self.message = ( ...
n=int(input()) for i in range(n): x=input() l=len(x);li=[] for i in range(l): li.append(x[i]) j=0 sum=0 while j<len(li): if li[j]=='4': sum+=1 else: pass j+=1 print(sum)
__title__ = 'aiolo' __version__ = '4.1.1' __description__ = 'asyncio-friendly Python bindings for liblo' __url__ = 'https://github.com/elijahr/aiolo' __author__ = 'Elijah Shaw-Rutschman' __author_email__ = 'elijahr+aiolo@gmail.com'
""" Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. """ class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: return ...
customers = { "name": "Taen Ahammed", "age": 20, "is_verified": True } print(customers["name"]) # print(customers["birthdate"]) # print(customers["Name"]) customers["name"] = "Taen" print(customers.get("name")) print(customers.get("birthdate")) print(customers.get("birthdate", "Dec 12 1998")) customers[...
class Scrapable(): def __parse(self, html=None): """todo: documentation""" pass async def scrap(self): """todo: documentation""" pass
'''' Faça um programa que peça uma nota, entre zero e dez. Mostre uma mensagem caso o valor seja inválido e continue pedindo até que o usuário informe um valor válido. ''' print ('**' * 18) print ('**** Bem Vindo ao Meu Programa ****') nota = float(input('Digite uma valor entre 0 e 10: ' )) print(nota)
def correct_sentence(text): ''' For the input of your function, you will be given one sentence. You have to return a corrected version, that starts with a capital letter and ends with a period (dot). Pay attention to the fact that not all of the fixes are necessary. If a sentence already ends with a period (do...
def get_arrangement_count(free_spaces): if not free_spaces: return 1 elif free_spaces < 2: return 0 arrangements = 0 if free_spaces >= 3: arrangements += (2 + get_arrangement_count(free_spaces - 3)) arrangements += (2 + get_arrangement_count(free_spaces - 2)) return arr...
# ------------------------------ # 397. Integer Replacement # # Description: # Given a positive integer n and you can do operations as follow: # # If n is even, replace n with n/2. # If n is odd, you can replace n with either n + 1 or n - 1. # What is the minimum number of replacements needed for n to become 1? # # ...
class Solution: def judgePoint24(self, cards: List[int]) -> bool: """Backtracking. """ if len(cards) == 1 and abs(cards[0] - 24.0) < 0.0001: return True for i in range(1, len(cards)): for j in range(0, i): copy = cards[:] a, b =...
__copyright__ = "Copyright (C) 2020 shimakaze-git" __version__ = "0.0.1" __license__ = "MIT" __author__ = "shimakaze-git" __author_email__ = "shimakaze.soft+github@googlemail.com" __url__ = "http://github.com/shimakaze-git/django-jp-birthday" __all__ = ["fields", "managers", "models"]
"""termination: A library for first-order term-rewriting.""" __version__ = '0.0.2' __author__ = 'Chris Bouchard <chris@upliftinglemma.net>'
#Manifest example. { 'author':'Campo y Tierra del Jerte S.A.', 'name':'Test Module', 'depends':[ 'base', 'account', ], 'summary':'Module for testing odooo', 'description':""" This is an *extended description* for the module that is testing our skills developing in...
blist = [ 1, 2, 3, 255 ] # byte is immutable the_bytes = bytes( blist ) # b'\x01\x02\x03\xff' print( the_bytes ) the_byte_array = bytearray( blist ) # bytearray(b'\x01\x02\x03\xff') print( the_byte_array ) # bytearray is mutable the_byte_array = bytearray( blist ) print( the_byte_array ) the_byte_array[0] = 127 p...
""" CFG has many blocks blocks has many nodes nodes may jump into blocks (if else) """ class CFG(object): def __init__(self): self.startingBlockIndex = 0 self.blocks = [] self.arguments = [] self.vars = set() self.name = None self.returnVariables = [] def setName(self,name): self.name = name def ad...
total=0 n=int(input()) for i in range(9): t=int(input()) total+=t print(n-total)
# -*- coding: utf-8 -*- """ Created on Wed Feb 26 15:47:44 2020 @author: alexi """
class ImeMode(Enum,IComparable,IFormattable,IConvertible): """ Specifies a value that determines the Input Method Editor (IME) status of an object when the object is selected. enum ImeMode,values: Alpha (8),AlphaFull (7),Close (11),Disable (3),Hangul (10),HangulFull (9),Hiragana (4),Inherit (-1),Katakana (5)...
# Donnée : l la liste d'adjacence l = [[1,3],[0,2],[1],[0]] # Initialisation # N : nombre de pages N = 4 # A : tableau d'adjacence A = [[False for x in range(N)] for y in range(N)] # Début du traitement # index_page : l'index en cours dans la liste for index_page in range(len(l)): # index_lien : l'index en cours...
matrix_line_color = '#fff' matrix_background_color = '#eee' matrix_border_color = '#888' matrix_border_width = 0.18 cc = { # cycle colors 'axis': 'ff0000', 'maindiag': '00438a', 'bigcyc': 'ba1000', 'with0': 'ff5500', 'without0': 'e23287', 'lighttetra': 'da691e', 'darktetra': '7b2e13' } id...
# http://59.23.150.58/30stair/q_r/q_r.php?pname=q_r a, b = map(int, input().split()) print(int(a/b), a%b)
# -*- coding: utf-8 -*- """Release information for Python Package.""" # Consider change to: ska-tangods-sdpsubarray ? NAME = "ska-sdp-subarray" # For version names see: https://www.python.org/dev/peps/pep-0440/ VERSION = "0.7.0" VERSION_INFO = VERSION.split(".") AUTHOR = "ORCA team, Sim Team" LICENSE = 'License :: OSI...
# # PySNMP MIB module HPN-ICF-LswRSTP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-LswRSTP-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:40:01 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
#Faça um programa que peça uma nota, entre zero e dez. Mostre uma mensagem caso o valor # seja inválido e continue pedindo até que o usuário informe um valor válido. flag = True while flag: n = float(input("INFORME UMA NOTA DE 0 - 10: ")) if n >= 0 and n <= 10: flag = False else: print("NO...
""" A number is strobogrammatic if the number looks the same, when rotate by 180 degrees, upside down """ def is_strobogrammatic(num): """ :type num: str :rtype: bool It has to be palindromic stylish and we should also be able to swap / interchange. That's the intuition Args: num: ...
""" Advent of Code Day 1 https://adventofcode.com/2021/day/1 (c) JAnxO, 2021 """
class Track: def __init__(self, _id, data: dict): self.id = _id self.data = data self.title = data.get("title") self.author = data.get("author") self.length = data.get("length") self.yt_id = data.get("identifier") self.uri = data.get("uri") self.is_st...
''' write a Python program that will accept binary numbers as an input form a user. After the input, validate which binary numbers are divisible by 5 or not. int() arguments The Python int() method takes two arguments: x – Number or string to be converted to integer object. Default argument is zero. base – Ba...
{ "variables": { "base_path": "C:/msys64/mingw64" }, "targets": [ { "target_name": "expand", "sources": [ "src/expand.cc" ], "libraries": ["-llibpostal"], "library_dirs": ["<(base_path)/bin"], "include_di...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- if __name__ == '__main__': name = input('please input your name:') print('hello,', name)
s: str = "" se: str = "" l: [int] = None le: int = 0 k: bool = False def f(): 1+"2" for k in l: 1+"2" for g in l: 1+"2" for f in l: 1+"2" for se in l: 1+"2" for l in s: 1+"2" for f in k: 1+"2"
# coding=utf8 SthWrong = (-1, 'Something Wrong') ArgMis = (-1000, 'Args Missing') ArgFormatInvalid = (-1001, 'Args Format Invalid') DataNotExists = (-2000, 'Data Not Exists')
# Directory and File locations DATASETDIR = "driving_dataset/" MODELDIR = "save" MODELFILE = MODELDIR + "/model.ckpt" LOGDIR = "logs"
"""! @brief Cloud Tool for Yandex Disk service. @details The tool has been implemented to support CI infrastructure of pyclustering library. @authors Andrei Novikov (pyclustering@yandex.ru) @date 2014-2020 @copyright BSD-3-Clause """
side1 = 12 side2 = 14 side3 = 124 if side1 == side2 and side2 == side3: print(1) elif side1 == side2 or side2 == side3 or side1 == side3: print(2) else: print(3)
class RPCError(Exception): pass class ConsistencyError(Exception): pass class TermConsistencyError(ConsistencyError): def __init__(self, term: int): self.term = term class LeaderConsistencyError(ConsistencyError): def __init__(self, leader_id: bytes): self.leader_id = leader_id c...
#Card class to be imported by every program in repository #Ace value initialized to 11, can be changed to 1 in-game class Card: def __init__(self, suit_id, rank_id): self.suit_id = suit_id self.rank_id = rank_id if self.rank_id == 1: self.rank = "Ace" self.value = 1...
# find the maximum path sum. The path may start and end at any node in the tree. class Node: def __init__(self, data): self.data = data self.left = None self.right = None def max_sum_path(root): max_sum_path_util.res = -float('inf') max_sum_path_util(root) return max_sum_pat...
def buildGraphFromInput(): n = int(input()) graph = [] for i in range(n): x, y = [int(j) for j in input().split()] graph.append((x,y)) return graph def computeNumberOfNeighbors(graph): numberOfNeighbors = {} for x,y in graph: if not x in numberOfNeighbors: ...
MES_LEVEL_INFO = 0 MES_LEVEL_WARN = 1 MES_LEVEL_ERROR = 2 _level = 0 _message = "" def set_mes(level, message): global _level global _message if message != "": _level = level _message = message def get_mes(): ...
# # PySNMP MIB module IBM-INTERFACE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IBM-INTERFACE-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:51:02 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
name = "btclib" __version__ = "2020.12" __author__ = "The btclib developers" __author_email__ = "devs@btclib.org" __copyright__ = "Copyright (C) 2017-2020 The btclib developers" __license__ = "MIT License"
class Sentinel(object): """Unique placeholders for signals""" def __init__(self, name=None): self.name = name def __eq__(self, other): return other is self def __hash__(self): return id(self) def __str__(self): if self.name is not None: return str(self....
# # PySNMP MIB module RARITANCCv2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RARITANCCv2-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:43:46 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
age=input("How old are you? 38") height=input("How tall are you? `120") weight=input("How much do you weight? 129") print(f"So, you're {age} old, {height} tall, and {weight} heavy.")
#!/usr/bin/env python # -*- coding: utf-8 -* # Copyright: [CUP] - See LICENSE for details. # Authors: liushuxian(liushuxian) """ This module provides utils of jenkins. """ STATUS_FAIL = "FAIL" STATUS_ERROR = "ERROR" STATUS_ABORTED = "ABORTED" STATUS_REGRESSION = "REGRESSION" STATUS_SUCCESS = "SUCCESS" STATUS_FIXED = ...
# Homeserver address homeserver = "https://phuks.co" # Homeserver credentials. Not required if using a .token file username = "jenny" password = "nice&secure" # Display name nick = "Jenny" # Prefix for commands prefix = '.' # List of admins using full matrix usernames admins = ['@polsaker:phuks.co'] # If this lis...
# table definition table = { 'table_name' : 'db_view_cols', 'module_id' : 'db', 'short_descr' : 'Db view columns', 'long_descr' : 'Database view column definitions', 'sub_types' : None, 'sub_trans' : None, 'sequence' : ['seq', ['view_id', 'col_type'], None], 'tre...
f = open('input.txt', 'r') values = [] for line in f: values.append(int(line)) counter = 0 # Part 1: for x in range(len(values)-1): if values[x+1] > values[x]: counter += 1 print(f"part 1: {counter}") # Part 2: counter = 0 for x in range(2, len(values)-1): lsum = sum([values[i] for i in range...
# # PySNMP MIB module ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:49:38 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # U...
""" This module contains the result sentences and intents for the English version of the Supervisor app. """ # Result sentences RESULT_BACK = "Hi, I'm back!" RESULT_CONFIRM_REBOOT = "Do you really want to reboot the system?" RESULT_CONFIRM_SHUTDOWN = "Do you really want to shutdown the system?" RESULT_DISABLE_APP = "O...
# -*- coding: utf-8 -*- ''' File name: code\the_incenter_of_a_triangle\sol_482.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x ''' # Solution to Project Euler Problem #482 :: The incenter of a triangle # # For more information see: # https://projecteuler.net/problem=482 # Prob...
class Solution(object): def fizzBuzz(self, n): # Scaleable hash dict = {3:"Fizz", 5:"Buzz"} res = [] # Iterate through 1-n+1 for i in range(1, n+1): # app represents what to append of not the number app = "" # iterate throug...
print("olar teu cu") # palavras usa '' print(8+1) # numeros não usam '' # nome = "cuzao" # idade = "1900000" # peso = "mae de neto" # igual a 5000 toneladas # print(nome, idade, peso) gado = input("ja foi gado quantas vezes?: ") corno = input("Já foi corno quantas vezes?: ") print("ahla, já foi gado ", gado, "...
# MAJOR_VER = 20 # MINOR_VER = 11 # REVISION_VER = 0 # CONTROL_VER = 6 # OFFICIAL = False # MAJOR_VER = 20 # MINOR_VER = 12 # REVISION_VER = 5 # CONTROL_VER = 6 # OFFICIAL = True MAJOR_VER = 21 MINOR_VER = 6 REVISION_VER = 0 CONTROL_VER = 6 OFFICIAL = False
#https://www.hackerrank.com/challenges/array-left-rotation length, rotations = map(int, input().strip().split()) array = list(map(int, input().strip().split())) displacement = rotations % length lower = [] for i in range(displacement, length): lower.append(array[i]) upper = [] for i in range(displacement): ...
""" # Definition for a Node. class Node: def __init__(self, val, prev, next, child): self.val = val self.prev = prev self.next = next self.child = child """ class Solution: def flatten(self, head: 'Node') -> 'Node': curr = head stack = [] while curr: ...