content
stringlengths
7
1.05M
number =int(raw_input("enter number:")) word =str(raw_input("enter word:")) if number == 0 or number > 1: print ("%s %ss." % (number,word)) else: print("%s %s." % (number,word)) if word[-3:] == "ife": print( word[:-3] + "ives") elif word[-2:] == "sh": print(word[:-2] + "shes" ) elif word[-2:] == "ch...
FIELDS_EN = { 'title': lambda **kwargs: ' renamed project from "{from}" to "{to}"'.format(**kwargs), 'short': lambda **kwargs: ' changed short name of project from "{from}" to "{to}"'.format(**kwargs), 'description': lambda **kwargs: ' changed description of project from "{from}" to "{to}"'.format(**kwargs)...
# -*- coding: utf-8 -*- class PeekableGenerator(object): def __init__(self, generator): self.__generator = generator self.__element = None self.__isset = False self.__more = False try: self.__element = generator.next() self.__more = True ...
def get_member_guaranteed(ctx, lookup): if len(ctx.message.mentions) > 0: return ctx.message.mentions[0] if lookup.isdigit(): result = ctx.guild.get_member(int(lookup)) if result: return result if "#" in lookup: result = ctx.guild.get_member_named(lookup) ...
class Solution: def isIsomorphic(self, s: str, t: str) -> bool: if len(s) != len(t): return False s_t_dic = {} t_s_dic = {} n = len(s) for i in range(n): if (s[i] not in s_t_dic) and (t[i] not in t_s_dic): s_t_dic[s[i]] = t[i] ...
class RandomListNode(): def __init__(self, x: int): self.label = x self.next = None self.random = None class Solution(): def copy_random_list(self, root: RandomListNode) -> RandomListNode: head = None if root is not None: pointers = {} new_root =...
soma = 0 pares = 0 for i in range(6): numeros = int(input('Digite um número: ')) if numeros % 2 == 0: pares +=1 soma += numeros print(f'A soma dos {pares} números pares entre os números digitados é {soma}')
# Copyright 2016 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # These devices are ina3221 (3-channels/i2c address) devices inas = [('0x40:0', 'pp3300_edp_dx', 3.30, 0.020, 'rem', True), #R367 ('0x40:1', '...
class _PortfolioMemberships: """This object determines if a user is a member of a portfolio. """ def __init__(self, client=None): self.client = client def find_all(self, params={}, **options): """Returns the compact portfolio membership records for the portfolio. You must s...
n = int(input()) lst = [] for _ in range(n): a, b = [int(i) for i in input().split()] lst.append((a,b)) lst.sort(key = lambda x: x[1]) index = 0 coordinates = [] while index < n: curr = lst[index] while index < n-1 and curr[1]>=lst[index+1][0]: index += 1 coordinates.append(curr[1]) ...
# -*- coding: utf-8 -*- class Solution: def numDifferentIntegers(self, word: str) -> int: result = set() number = None for char in word: if char.isdigit() and number is None: number = int(char) elif char.isdigit() and number is not None: ...
def fibo(n): return n if n <= 1 else (fibo(n-1) + fibo(n-2)) nums = [1,2,3,4,5,6] [fibo(x) for x in nums] # [1, 1, 2 ,3 ,5, 8] [y for x in nums if (y:= fibo(x)) % 2 == 0] # [2, 8]
__version__ = '1.12.0' __author__ = 'nety' DEFAULT_DATABASE = { "tokens": [], "secret_code": "", "delete_all_notify": False, "ru_captcha_key": "", "ignored_members": [], "ignored_global_members": [], "muted_members": [], "aliases": [], "service_prefixes": [ "!слп", ".слп" ], ...
#!/usr/bin/env python # encoding: utf-8 name = "Singlet_Carbene_Intra_Disproportionation/rules" shortDesc = u"Convert a singlet carbene to a closed-shell molecule through a concerted 1,2-H shift + 1,2-bond formation" longDesc = u""" Reaction site *1 should always be a singlet in this family. """
BUTTON_LEFT = 0 BUTTON_MIDDLE = 1 BUTTON_RIGHT = 2
def main(): file_log = open("hostapd.log",'r').read() address = file_log.find("AP-STA-CONNECTED") mac = set() while address >= 0: mac.add(file_log[address+17:address+34]) address=file_log.find("AP-STA-CONNECTED",address+1) for addr in mac: print(addr) # For ...
""" 问题描述:在一个二维坐标系中,所有的值都是double类型,那么一个三角形可以由3个点来代表, 给定3个点代表的三角形,再给定一个点(x,y),判断(x,y)是否在三角形中. """ class PointInTriangle: @classmethod def cross_product(cls, x1, y1, x2, y2): return x1 * y2 - x2 * y1 @classmethod def is_inside(cls, x1, y1, x2, y2, x3, y3, x, y): if cls.cross_product(x3-x...
COURSE = "Python for Everybody" def which_course_is_this(): print("The course is:", COURSE)
DATASOURCE_NAME = "Coderepos" GITHUB_DATASOURCE_NAME = "github"
def readDataIntoMatrix(fileName): f = open(fileName, 'r') i = 0 data = [] for line in f.readlines(): j = 0 row = [] values = line.split() for value in values: row.append(int(value)) j += 1 data.append(row) i += 1 return data
# -*- coding: UTF-8 -*- logger.info("Loading 2 objects to table invoicing_tariff...") # fields: id, designation, number_of_events, min_asset, max_asset loader.save(create_invoicing_tariff(1,['By presence', 'Pro Anwesenheit', 'By presence'],1,None,None)) loader.save(create_invoicing_tariff(2,['Maximum 10', 'Maximum 10',...
#!/usr/bin/env python3 # Write a program that computes the GC% of a DNA sequence # Format the output for 2 decimal places # Use all three formatting methods print('Method 1: printf()') seq = 'ACAGAGCCAGCAGATATACAGCAGATACTAT' # feel free to change gc_count = 0 for i in range(0, len(seq)): if seq[i] == 'G' or seq[i]...
''' solve amazing problem: Given a 2D array of mines, replace the question mark with the number of mines that immediately surround it. This includes the diagonals, meaning it is possible for it to be surrounded by 8 mines maximum. The key is as follows: An empty space: "-" A mine: "#" Number showing number of mines...
#!/usr/bin/python # -*- coding: utf-8 -*- ''' @AUTHOR:Joselyn Zhao @CONTACT:zhaojing17@foxmail.com @HOME_PAGE:joselynzhao.top @SOFTWERE:PyCharm @FILE:tiqu.py @TIME:2020/4/29 22:35 @DES: 使用字典推导式提取字典子集 ''' prices = { 'asp':49.9, 'python':69.9, 'java':59.9, 'c':45.9, 'php':79.9 } p1 = {key:value for k...
#when many condition fullfil use all. subs = 1000 likes = 400 comments = 500 condition = [subs>150,likes>150,comments>50] if all(condition): print('Great Content')
class Solution: def findMedianSortedArrays(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: float """ tmp = nums1 + nums2 tmp.sort() if len(tmp)%2 == 0: # print(tmp[len(tmp)//2 - 1] + tmp[len(tmp)//2] / 2) ...
def write_to(filename:str,text:str): with open(f'{filename}.txt','w') as file1: file1.write(text) write_to('players','zarinaemirbaizak')
def main(): # input S = input() N, M = map(int, input().split()) # compute # output print(S[:N-1] + S[M-1] + S[N:M-1] + S[N-1] + S[M:]) if __name__ == '__main__': main()
class PropertyMonitor(object): __slots__ = ( '_lock', # concurrency control '_state', # currently active state '_pool', # MsgRecord deque to hold temporary records 'witness', # MsgRecord list of observed events 'on_enter_scope', # callback upo...
le = 0 notas = 0 while le != 2: n = float(input()) if 0 <= n <= 10: notas = notas+n le += 1 else: print('nota invalida') print('media = {:.2f}'.format((notas/2)))
class CustomHandling: """ A decorator that wraps the passed in function. Will push exceptions to a queue. """ def __init__(self, queue): self.queue = queue def __call__(self, func): def wrapper(*args, **kwargs): try: return func(*args, **kwargs) ...
def ipaddr(interface=None): ''' Returns the IP address for a given interface CLI Example:: salt '*' network.ipaddr eth0 ''' iflist = interfaces() out = None if interface: data = iflist.get(interface) or dict() if data.get('inet'): return data.get('inet'...
def generate(env, **kw): if not kw.get('depsOnly',0): env.Tool('addLibrary', library=['astro'], package = 'astro') if env['PLATFORM'] == 'win32'and env.get('CONTAINERNAME','')=='GlastRelease': env.Tool('findPkgPath', package = 'astro') env.Tool('facilitiesLib') env.Tool('tipLib') env.Tool('addLibrary', libr...
def cvt(s): if isinstance(s, str): return unicode(s) return s class GWTCanvasImplDefault: def createElement(self): e = DOM.createElement("CANVAS") try: # This results occasionally in an error: # AttributeError: XPCOM component '<unknown>' has no attribute 'M...
def create_category(base_cls): class Category(base_cls): __tablename__ = 'category' __table_args__ = {'autoload': True} @property def serialize(self): """Return object data in easily serializeable format""" return { 'Category_name'...
""" File: boggle.py Name: ---------------------------------------- TODO: """ # This is the file name of the dictionary txt file # we will be checking if a word exists by searching through it FILE = 'dictionary.txt' lst = [] enter_lst = [] d = {} # A dict contain the alphabets in boggle games ans_lst = [...
# DSAME prob #40 class Node: def __init__(self, data=None, next=None): self.data = data self.next = next def get_josephus_pos(): q = p = Node() n = int(input("Enter no of players: ")) m = int(input("Enter which player needs to be eliminated each time:")) # create cll containing a...
'''LC459:Repeated Substr pattern https://leetcode.com/problems/repeated-substring-pattern/ Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may assume the given string consists of lowercase English letters only and its lengt...
a=float(input()) b=float(input()) if a<b: print(a) else: print(b)
# -*- coding: utf-8 -*- print(""" Atm'ye Hoşgeldiniz.... Para Çekmek için : 1 Para Yatırmak için : 2 Bakiye Sorgulamak İçin : 3 Kart iadesi için : "ç" """) bakiye = 0 while True: islem = input("Yapmak istediğiniz işlemi seçiniz...") ...
def grammar(): return [ 'progStructure', 'name', 'body', 'instruction', 'moreInstruction', 'functionCall', 'parameter', 'moreParameter', 'parameterType' ] def progStructure(self): self.name() self.match( ('reserved_word', 'INICIO')...
class GeneratorCache(object): """Cache for cached_generator to store SharedGenerators and exception info. """ # Private attributes: # list<dict> _shared_generators - A list of the SharedGenerator and # exception info maps stored in this GeneratorCache. def __init__(self): self._sha...
n,m=map(int,input().split()) l1=list(map(int,input().split())) minindex=l1.index(min(l1)) l2=list(map(int,input().split())) maxindex=l2.index(max(l2)) for i in range(0,m): print(minindex,i) for j in range(0,minindex): print(j,maxindex) for j in range(minindex+1,n): print(j,maxindex)
class TempSensor: __sensor_path = '/sys/bus/w1/devices/28-00000652b8e4/w1_slave' def __init__(self): self.__recent_values = [] def read(self): data = self.__read_sensor_file() temp_value = self.__parse_sensor_data(data) fahrenheit_value = self.__convert_to_fahrenheit(temp_...
#Question 14 power = int(input('Enter power:')) number = 2**power print('Two last digits:', number%100)
def distance(strand_a, strand_b): if len(strand_a) != len(strand_b): raise ValueError('strands are not of equal length') count = 0 for i in range(len(strand_a)): if strand_a[i] != strand_b[i]: count += 1 return count
# 367. Valid Perfect Square class Solution: # Binary Search def isPerfectSquare(self, num: int) -> bool: if num < 2: return True left, right = 2, num // 2 while left <= right: mid = left + (right - left) // 2 sqr = mid ** 2 if sqr == num...
class BuySellEnum: BUY_SELL_UNSET = 0 BUY = 1 SELL = 2
'''Crie um programa que simule o funcionamento de um caixa eletrônico. No início, pergunte ao usuário qual será o valor a ser sacado (número inteiro) e o programa vai informar quantas cédulas de cada valor serão entregues. OBS: considere que o caixa possui cédulas de R$50, R$20, R$10 e R$1.''' valor = int(input('Digite...
# -*- coding: utf-8 -*- """ logbook._termcolors ~~~~~~~~~~~~~~~~~~~ Provides terminal color mappings. :copyright: (c) 2010 by Armin Ronacher, Georg Brandl. :license: BSD, see LICENSE for more details. """ esc = "\x1b[" codes = {"": "", "reset": esc + "39;49;00m"} dark_colors = ["black", "darkre...
STATS = [ { "num_node_expansions": 653, "plan_length": 167, "search_time": 0.49, "total_time": 0.49 }, { "num_node_expansions": 978, "plan_length": 167, "search_time": 0.72, "total_time": 0.72 }, { "num_node_expansions": 1087, ...
class Command(object): def __init__(self, command, description, callback): """ Construct command :param command: The command :param description: The description :param callback: The callback """ self.command = command self.description = descr...
# List dog_names = ["tom", "sean", "sally", "mark"] print(type(dog_names)) print(dog_names) # Adding Item On Last Position dog_names.append("sam") print(dog_names) # Adding Item On First Position dog_names.insert(0, "bruz") print(dog_names) # Delete Items del(dog_names[0]) print(dog_names) # Length Of List pr...
class BTNode: def __init__(self, data = -1, left = None, right = None): self.data = data self.left = left self.right = right class BTree: def __init__(self): self.root = None self.found = False def is_empty(self): return self.root is None def build(self, ...
# FAZER UM PROGRAMA QUE LEIA O PRIMEIRO TERMO E UMA RAZÃO DE UMA PROGRESSÃO ARITMÉTICA # MOSTRAR OS 10 PRIMEIROS TERMOS DA PROGRESSÃO ARITMÉTICA pa = int(input('Digite o primeiro termo: ')) razao = int(input('Digite a razão: ')) n = 0 verificacao = False vezes = 10 while verificacao == False: while n != vezes: ...
# -*- coding: utf-8 -*- """ Created on Wed Mar 13 11:30:05 2019 @author: Jongmin Sung import functions and variables into our notebooks and scripts: from projectname import something """
"""Module with bad __all__ To test https://github.com/ipython/ipython/issues/9678 """ def evil(): pass def puppies(): pass __all__ = [evil, # Bad 'puppies', # Good ]
# -- Project information ----------------------------------------------------- project = "Test" copyright = "Test" author = "Test" # -- General configuration --------------------------------------------------- master_doc = "index" # -- Options for HTML output ------------------------------------------------- html_...
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def countUnivalSubtrees(self, root): """ :type root: TreeNode :rtype: int """ sel...
# coding: utf8 """ 题目链接: https://leetcode.com/problems/flatten-nested-list-iterator/description. 题目描述: Given a nested list of integers, implement an iterator to flatten it. Each element is either an integer, or a list -- whose elements may also be integers or other lists. Example 1: Given t...
# Reads the UA list from the file "ua_list.txt" # Refer this site for list of UAs: https://developers.whatismybrowser.com/useragents/explore/ ua_file = open("ua_list.txt", "r") lines = ua_file.readlines() ua_list = [] for line in lines: line_cleaned = line.replace("\n","").lower() ua_list.append(line_cleaned)...
# greatest of three def greatest(a,b,c): return max(a,b,c) print(greatest(2,4,3))
def LCSBackTrack(v, w): v = '-' + v w = '-' + w S = [[0 for i in range(len(w))] for j in range(len(v))] Backtrack = [[0 for i in range(len(w))] for j in range(len(v))] for i in range(1, len(v)): for j in range(1, len(w)): tmp = S[i - 1][j - 1] + (1 if v[i] == w[j] else 0) ...
{ "targets": [ { "target_name": "boost-parameter", "type": "none", "include_dirs": [ "1.57.0/parameter-boost-1.57.0/include" ], "all_dependent_settings": { "include_dirs": [ "1.57.0/parameter-boos...
# -*- coding: utf-8 -*- { 'name': "WooCommerce Connector", 'summary': """This module enables users to connect woocommerce api to odoo modules of sales, partners and inventory""", 'description': """ Following are the steps to use this module effectively: 1) Put in the KEY and SECRET in the co...
class AbstractBatchifier(object): def filter(self, games): return games def apply(self, games): return games
"""https://leetcode.com/problems/permutations-ii/ 47. Permutations II Medium Given a collection of numbers, nums, that might contain duplicates, return all possible unique permutations in any order. Examples: >>> Solution().permuteUnique([]) [[]] Constraints: 1 <= nums.length <= 8 -10 <= nums[i] <= 10 Re...
#coding:utf-8 ''' filename:clsmethod.py learn class method ''' class Message: msg = 'Python is a smart language.' def get_msg(self): print('self :',self) print('attrs of class(Message.msg):',Message.msg) print('use type(self).msg:',type(self).msg) cls = type(self) ...
class Solution: def findNumbers(self, nums: List[int]) -> int: if len(nums) == 0: return 0 return len(list(filter(lambda x:len(str(x))%2==0,nums)))
""" This module contains methods that model the properties of galaxy cluster populations. """
# 231 - Power Of Two (Easy) # https://leetcode.com/problems/power-of-two/submissions/ class Solution: def isPowerOfTwo(self, n: int) -> bool: return n and (n & (n-1)) == 0
random_test_iterations = 64 def repeat(fn): """Decorator for running the function's body multiple times.""" def repeated(): i = 0 while i < random_test_iterations: fn() i += 1 # nosetest runs functions that start with 'test_' repeated.__name__ = fn.__name__ ...
# Some sites give IR codes in this weird pronto format # Cut off the preamble and footer and find which value represents a 1 in the spacing code = "0000 0016 0000 0016 0000 0016 0000 003F 0000 003F 0000 003F 0000 0016 0000 003F 0000 0016 0000 0016 0000 0016 0000 0016 0000 0016 0000 0016 0000 0016 0000 0016 0000 0016 0...
# ---------------------------------------------------------------------------- # This software is in the public domain, furnished "as is", without technical # support, and with no warranty, express or implied, as to its usefulness for # any purpose. # # iscSendSampleDef # # Author: mathewson # -------------------------...
#Write a program (using functions!) that asks the user for a long string containing multiple words. # Print back to the user the same string, except with the words in backwards order. For example, say I type the string: # My name is Michele #Then I would see the string: # Michele is name My #shown back to me. def ...
# coding: utf-8 def test_index(admin_client): """ Basic test to see if it even works. """ url = "/nothing-to-see-here/" HTTP_OK_200 = 200 respnse = admin_client.get(url) assert respnse.status_code == HTTP_OK_200
def strategy(history, memory): if memory is None or 1 == memory: return 0, 0 else: return 1, 1
with open("promote.in") as input_file: input_lst = [[*map(int, line.split())] for line in input_file] promotions = [ promotion[1] - promotion[0] for promotion in input_lst ] output = [] for promotion in promotions[::-1]: output.append(sum([])) with open("promote.out", "w") as output_file: for promotio...
''' Está chegando a grande final do Campeonato Nlogonense de Surf Aquático, que este ano ocorrerá na cidade de Bonita Horeleninha (BH)! Antes de viajar para BH, você e seus N-1 amigos decidiram combinar algum dia para ir a uma pizzaria, para relaxar e descontrair (e, naturalmente, comer!). Neste momento está sendo esc...
sample_text = ''' The textwrap module can be used to format text for output in situations where pretty-printing is desired. It offers programmatic functionality similar to the paragraph wrapping or filling features found in many text editors. '''
# Write your solutions for 1.5 here! class Superheros: def __init__(self, name, superpower, strength): self.name = name self.superpower = superpower self.strength = strength def hero (self): print(self.name) print(self.strength) def save_civilian (self, work): if work > self....
# Size of program memory (bytes) MAX_PGM_MEM = 4096 # Size of context memory (bytes) MAX_DATA_MEM = 2048 # Max stack size (bytes) MAX_STACK = 512 # Number of registers MAX_REGS = 11 # Default output indentation for some debug messages IND = " " * 8 # Maximum values for various unsigned integers MAX_UINT8 = 0xff MAX...
# Copyright (c) 2011 Google Inc. 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': 'prefix_header', 'type': 'static_library', 'sources': [ 'file.c', ], 'xcode_settings': { 'GCC_...
#FACTORIAL OF A NUMBER a = input("Enter number1") a=int(a) factorial=1 if a==1: print('Factorial is 1') elif a<1: print('Please enter a valid number') else: for i in range(1, a+1): factorial *= i print(f'The factorial is {factorial}')
# Copyright 2020 Q-CTRL Pty Ltd & Q-CTRL 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
class Node: def __init__(self, val, left=None, right=None): self.val = val self.left = left self.right = right node = Node("root", Node("left", Node("left.left")), Node("right")) s = "" def serialize(node, s=""): if not node: s += "# " return s s += str(node.val) ...
# 5) Faça um programa que leia um número inteiro e mostre na tela o seu sucessor e antecessor. # Resolução do Exercício 5: valor = int(input('Digite um número: ')) print(f'Analisando o valor {valor}, seu antecessor é {valor - 1} e o sucessor é {valor + 1}.')
# Программа запрашивает у пользователя строку чисел, разделенных пробелом. # При нажатии Enter должна выводиться сумма чисел. # Пользователь может продолжить ввод чисел, разделенных пробелом и снова нажать Enter. # Сумма вновь введенных чисел будет добавляться к уже подсчитанной сумме. # Но если вместо числа вводится с...
# -*- coding: utf-8 -*- class Job: def __init__(self, job_id, name, status, start_date, end_date, source_records, processed_records, price): self.id = job_id self.name = name self.status = status self.start_date = start_date self.end_date = end_date ...
def median(iterable): items = sorted(iterable) if len(items) == 0: raise ValueError("median() arg is an empty series") median_index = (len(items) - 1) // 2 if len(items) % 2 != 0: return items[median_index] return (items[median_index] + items[median_index + 1]) / 2 print(median([5,...
""" Product Store Write a class Product that has three attributes: type name price Then create a class ProductStore, which will have some Products and will operate with all products in the store. All methods, in case they can’t perform its action, should raise ValueError with appropriate error information...
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo # Copyright (C) 2011-2019 German Aerospace Center (DLR) and others. # This program and the accompanying materials # are made available under the terms of the Eclipse Public License v2.0 # which accompanies this distribution, and is available at ...
cali_cities = ["Adelanto", "Agoura Hills", "Alameda", "Albany", "Alhambra", "Aliso Viejo", "Alturas", "Amador City", "American Canyon", "Anaheim", "Anderson", "Angels Camp", "Antioch", "Apple Valley", "Arcadia", "Arcata", "Arroyo Grande", "Artesia", "Arvin", "Atascadero", "Atherton", "Atwater", "Auburn", "Avalon", "Ave...
def get(): return int(input()) def get_num(): return get() def get_line(): return get_num() print(get_line())
# ### Problem 1 # ``` # # Start with this List # list_of_many_numbers = [12, 24, 1, 34, 10, 2, 7] # ``` # Example Input/Output if the user enters the number 9: # ``` # The User entered 9 # 1 2 7 are smaller than 9 # 12 24 34 10 are larger than 9 # ``` # Ask the user to enter a number. userInput = int(input("Enter...
class Scheduler(object): def __init__(self, env, cpu_list=[], task_list=[]): self.env = env self.cpu_list = cpu_list self.task_list = [] self._lock = False self.overhead = 0 def run(self): pass def on_activate(self, job): pass def on_termin...
""" This is a sample program to demonstrate string concatenation """ if __name__ == "__main__": alice_name = "Alice" bob_name = "Bob" print(alice_name + bob_name)
# test 0 # correct answer # [0] num_topics, num_themes = 1, 1 lst = [0] with open('input.txt', 'w') as f: f.write("{} {}\n".format(num_topics, num_themes)) for l in lst: f.write(str(l) + '\n')
def binary_Search(w, q): if len(w) == 1 or len(q) == 1: return False else: # q의 앞이 ?로 시작하는지 q_next_start = 0 q_next_end = len(q) - 1 if q[0] == '?': q_next_start = (len(q) // 2) else: q_next_end = (len(q) // 2) print(q[q_next_start:...
class Stack(): def __init__(self): self.items = [] def push(self, item): return self.items.append(item) def pop(self): return self.items.pop() def IsEmpty(self): return self.items == [] def length(self): return len(self.items) def peek(self): ...