content
stringlengths
7
1.05M
# print it like this """Twinkle, twinkle, little star, How I wonder what you are! Up above the world so high, Like a diamond in the sky. Twinkle, twinkle, little star, How I wonder what you are" """ print("Twinkle, twinkle, little star,\n\tHow I wonder what you are!\n\t\t...
# DESCRIPTION # Given a string, sort it in decreasing order based on the frequency of characters. # Example 1: # Input: # "tree" # Output: # "eert" # Explanation: # 'e' appears twice while 'r' and 't' both appear once. # So 'e' must appear before both 'r' and 't'. Therefore "eetr" is also a valid answer. # Example ...
# Do not edit this file directly. # It was auto-generated by: code/programs/reflexivity/reflexive_refresh load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") def mpmcQueue(): http_archive( name = "mpmc_queue", build...
sample_event = { 'level': 'error', 'exception': { 'values': [ { 'module': None, 'type': 'TypeError', 'value': 'Testing stuff', 'mechanism': None, 'stacktrace': { 'frames': [ { 'filename': ...
map_out = { r'\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{1,6}(-|\+)\d{2}' : 'YYYY-MM-DD HH:MM:SS.FFFFFF-TZ' , r'\d{2}:\d{2}:\d{2}.\d{1,6}' : 'HH:MM:SS.FFFFFF' , r'\d{4}-\d{2}-\d{2}' : 'YYYY-MM-DD'} test_cases = [ test_case( cmd=('yb_chunk_dml_by_date_part.py @{argsdir}/yb_chunk_dml_by_date_part__ar...
''' Created on 1.12.2016 @author: Darren '''''' Given two strings s and t, write a function to determine if t is an anagram of s. For example, s = "anagram", t = "nagaram", return true. s = "rat", t = "car", return false. Note: You may assume the string contains only lowercase alphabets. ...
#!/bin/python3 """ https://www.hackerrank.com/challenges/simple-text-editor/problem """ class SimpleTextEditor: def __init__(self): self.s = '' # It works as a stack for storing full copies of previous s. # However, it might take too much memory resource if s is huge. self.s_histo...
""" Root endpoints. """ def root() -> str: """ Root endpoint. :return: project description """ return 'Sample RESTful API'
class LetterInput(): def __init__(self, letter): self.__dict__['_x'] = [] self.__dict__['_d'] = None self.__dict__['_letter'] = letter self.getLetter() def getLetter(self): if self._letter == 'a': self._x = [ 0, 0, 0, 0, 0, ...
x = 8 class C: x = 7 def f(): return x
# Obtaining the Width and Height of a Raster # https://github.com/GeospatialPython/Learn/raw/master/SatImage.zip rasterLyr = QgsRasterLayer("/qgis_data/rasters/satimage.tif", "Satellite Image") rasterLyr.isValid() # True rasterLyr.width() # 2592 rasterLyr.height() # 2693
def first(input): res = "" rem = input[::] while '(' in rem: start = rem.index('(') end = rem.index(')') chars, repetitions = list(map(int, rem[start+1:end].split('x'))) res += rem[:start] res += rem[end+1:end+1+chars]*repetitions rem = rem[end+chars+1:] ...
def not_(a): """Checks if value is False. `📘`_ - a: a boolean Example: >>> not_(False) == True >>> not_(True) == False .. _📘: https://github.com/python3f/extra-boolean/wiki/not """ return not a
strings = { # ui strings 'nothing': 'None', 'mora': "Mora", 'xp': 'Character Exp', 'wep_xp': 'Weapon Exp', 'resin': 'Resin', 'location': "Location", 'item': 'Item', 'item_s': 'Item(s)', 'character_s': 'Character(s)', 'characters': 'Characters', 'inventory': 'Inventory', 'add': 'Add', 'character': 'Charact...
# 2-4 Name Cases name = "henrik samuelsson" print(name.lower()) print(name.upper()) print(name.title())
"""AXL definitions""" WSDL_URLS = { "RisPort70": "https://{fqdn}:8443/realtimeservice2/services/RISService70?wsdl", "CDRonDemand": "https://{fqdn}:8443/realtimeservice2/services/CDRonDemandService?wsdl", "PerfMon": "https://{fqdn}:8443/perfmonservice2/services/PerfmonService?wsdl", "ControlCenterServi...
# get prime numbers def get_primes(): prime1 = int(input('Please enter the first prime number:')) prime2 = int(input('Please enter the second prime number:')) return prime1, prime2 # check if each number is prime def is_prime(i): if i < 2: return False if i == 2: return True if...
# 2020.01.09 # Problem Statement: # https://leetcode.com/problems/same-tree/ # 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 isSameTree(self, p: TreeNo...
''' Crie um Script em Python que leia 2 numeros e tente mostrar a soma entre eles ''' n1 = int(input('Digite um número qualquer: ')) n2 = int(input ('Digite outro número qualquer: ')) soma = n1 + n2 print(' A soma entre {} e {} é de {}.'.format(n1, n2, soma))
@job(desc="job1's desc") def job1(): pass @job("test1") def job2(): pass
class HTTPException(Exception): """ Exception which happens when HTTP status code is not 200 (OK). """ def __init__(self, code, url) -> None: self.error = f"While requesting to {url}, request returned status {code}." def __str__(self) -> str: return self.error class GeniusExcepti...
class Tracker: def __init__(self, con): self.con = con def get_tracking(self): tracking = dict() for notice in self.con.notices: splits = notice.split() if splits[1] == 'TRACK': if splits[2] in tracking: tracking[splits[2]].ap...
class PortainerNameView: def __init__( self, client, database="portainer2git", collection="portainer_name" ): super().__init__() self.__client = client self.__db = self.__client[database] self.__collection = self.__db[collection] def name_exists(self, name: str) -> b...
# -*- coding: utf-8 -*- a = 1 b = 2 c = 3 d = 1 e = 100000000 # большие числа можно задавать в читаемом формате e = 100_000_000 # больше print(a > b) # меньше print(a < b) # равно print(a == d) # не равно print(a != b) # больше либо равно print(a >= b) # меньше либо равно print(a <= b) # составное выражение pr...
def partida(): n = int(input("Quantas peças? ")) m = int(input("Limite de peças por jogada? ")) while n!=0: if n%(m+1) == 0: print("Você começa!") resultado = usuario_escolhe_jogada(n, m) else: print("Computador começa!") resultado = computado...
t = float(input('Quanto dinheiro você tem na carteira? R$ ')) c = t / 3.27 print('Com R$ {:.2f} você pode comprar US$ {:.2f}.'.format(t, c))
dict1 = {"first_name": "frodo","last_name":"baggins"} #x = dict1.pop("lst_name") #print(x) a = {"snack": "pasta","desert":"brownie","main":"rice"} b = a.copy() b["desert"]= "pudding" print(a) mytup = (10000,) print(mytup*6) subject = ("physics","chemistry","history","anthropology","archeology") subjects = subject + ...
class Solution: def findMaxAverage(self, nums, k): """ :type nums: List[int] :type k: int :rtype: float """ if len(nums) == 1: return nums[0] max_ave = float('-inf') for i in range(len(nums) - k + 1): max_ave = max(max_ave, sum(nums[i:i + k...
"""CSC110 Fall 2021: Term Test 2, Question 1 (Cryptography) Module Description ================== This module contains instructions for this question. There are THREE parts of this question, labelled "Part (a)", "Part (b)", etc. The comments in this file contain instructions on how to complete each part, so please rea...
#Conversor de temperatura celcius = float(input('\033[040mInforma a temperatura em °C:\033[m ')) tempf = celcius * 9/5 + 32 print('{} °C = {} °F'.format(celcius, tempf))
#! usr/bin/env python3 # Function arguments in python work in the same way as assignments - be careful with mutable objects # When assigning a mutable to a var, we are actually assigning a reference to the mutable # Function arguments work in the same way as assignments. Changes to mutable objects will be reflected ...
################################### # File Name : multiple_of_ten.py ################################### #!/usr/bin/python3 def multiple_of_ten(): square_root = 10 def square(x): return square_root ** x return square def main(): print ("=== print result ===") f = multiple_of_ten() p...
# -*- coding:utf-8 -*- ''' Analysis N = 1 f(1)=I~1 N = 2 f(2)=I~1+—~1 N = 3 f(3)=I~f(2) + —~f(1) N = 4 f(4)= I~f(3)+ —~f(2) N = n f(n) = I~f(n-1)+—~f(n-2) ''' class Solution: def rectCover(self, number): # write code here former = 1 latter = 1 if number<1: return 0 ...
num1 = 10 num2 = 20 num3 = 454545 num3 = 12012
# python3 def solve(r, c): res = 0 q_r, q_c = r // 3, c // 3 r_r, r_c = r % 3, c % 3 res += q_r * q_c * 8 if r_c == 1: res += q_r * 2 if r_c == 2: res += q_r * 5 if r_r == 1: res += q_c * 2 if r_r == 2: res += q_c * 5 if r_r == 1 and r_c == 2: ...
def powertower(x, n): ''' Calculates the power tower x**x**x**x**x... where the exponentiation is repeated n times. ''' r = 1 for i in range(n): r = r**x return r
# Elabore um programa que calcule o valor a ser pago por um produto, considerando o seu preço normal e # condição de pagamento: # - à vista dinheiro/cheque: 10% de desconto # - à vista no cartão: 5% de desconto # - em até 2x no cartão: preço formal # - 3x ou mais no cartão: 20% de juros class GerenciadorPagamentos(): ...
class CircularBuffer: def __init__(self, size): self.buf = [None] * size self.posW = 0 self.posR = 0 self.len = 0 def __len__(self): return self.len def _incR(self): self.posR = (self.posR + 1) % len(self.buf) def _incW(self): self...
x = input("enter number:") if(x>=10 and x<30): print(x,"le bada surma eda layi firda") elif(x>=30 and x<=40): print(x,"bada stud") else : print(x,"chota bai oye")
""" Config module. """ class Config: """ Class with constants for configuration. """ DEFAULT_DEBUGGING: bool = True DEFAULT_DAYS_EXPIRATION: int = 60
# coding: utf-8 # In[ ]: class Solution: #算法思路: #核心是recuisive,尝试一遍当前的可用解,当最后发现出现无解的情况时,判断为错误解,并返回最初assign可用解时,把这个槽位重新置空 #并对后面的槽位开始排解,之后又回到这个槽位来再次找解 #方程findUnassigned:按遍历顺序找到当前第一个没有数的槽位 #方程isSafe: 对这个槽位进行排解,按1,2,3...的顺序试满不满足要求 #方程solve: 对整个board进行数独计算 def solveSudoku(self, board): self.board = board #传入...
def predict_proba(arr): return [ [[], 99.999], ]
class Solution(object): def countComponents(self, n, edges): """ :type n: int :type edges: List[List[int]] :rtype: int """ g = {x: [] for x in range(n)} for x, y in edges: g[x].append(y) g[y].append(x) visited = [False] * n ...
class TwitterData_Cleansing(TwitterData_Initialize.TwitterData_Initialize): def __init__(self, previous): self.processed_data = previous.processed_data def cleanup(self, cleanuper): t = self.processed_data for cleanup_method in cleanuper.iterate(): if not self.is_tes...
#!/usr/bin/python2.4 # encoding: utf-8 """ score.py THIS FILE SHOULD BE REMOVED ONCE THE DDG SCHEDULER HAS BEEN REWRITTEN. Created by Shane O'Connor 2012. Copyright (c) 2012 __UCSF__. All rights reserved. """ class ddgScore(object): type = None version = None def __init__(self, data = {}): self.data = data ...
def enum(): with open("textSource", "r") as file: text = file.read() words = text.split() formatedText = "" for i, word in enumerate(words): formatedText += str((i // 15) + 1) + ( " " * (10 - len(str((i // 15) + 1))) ) if i % 15 == 0 else "" formatedText += ...
"""! # Trading folder **This folder contains all the modules related to live trading** """
class Submarine: depth = 0 horizontal_pos = 0 def down(self, depth): self.depth += depth def up(self, depth): self.depth -= depth def forward(self, distance): self.horizontal_pos += distance def get_depth(self): return self.depth def get_horizontal_pos(se...
# PRAGMA TEST 4 *NOT READY TO GO YET # Santiago Garcia Arango def minCost(numProjects, projectId, bid): # Vector of ids needed [0, 1, 2, 3, ..., N] vector_of_ids = [] for i in range(numProjects): vector_of_ids.append(i) possibilities = [] for i in range(len(vector_of_ids)): curren...
# ДНК и РНК это последовательности нуклеотидов. # # Четыре нуклеотида в ДНК это аденин (A), цитозин (C), гуанин (G) и тимин (T). # # Четыре нуклеотида в РНК это аденин (A), цитозин (C), гуанин (G) и урацил (U). # # Цепь РНК составляется на основе цепи ДНК последовательной # заменой каждого нуклеотида: # # G -> C # C ->...
""" 鸡兔同笼问题。有鸡和兔在一个笼子中,数头共 50 个头,数脚共 120 只脚,问:鸡和兔分别有多少只? Chicken and rabbit in the same cage. There are chickens and rabbits in a cage with 50 heads and 120 feet. Q: How many chickens and rabbits are there? """ def count_animals_in_cage(): animals = [] # each chicken has 2 feets, 50 of them will only has 100...
#1. Create a greeting for your program. print("Welcome to the band name generator!") #2. Ask the user for the city that they grew up in. city = input("What city did you grow up in? \n") #3. Ask the user for the name of a pet. pet = input("What is the name of a pet?\n") #4. Combine the name of their city and pet and sho...
N = int(input()) answer = 10**9 + 1 for _ in range(N): a, p, x = map(int, input().split()) if x - a > 0: answer = min(answer, p) if answer == 10**9 + 1: print(-1) else: print(answer)
score_sum = 0 #we open the file that we can read file_names = open('p022_names.txt', 'r') #we split it on "," names = file_names.read().split(",") #we removed the first and last sign (double " ") for i in range(len(names)): names[i] = names[i][1:-1] #we sort all names into alphabetical order names.sort() for i in ...
#!/usr/bin/python #coding:utf8 __author__ = ['markshao'] __version__ = "1.0.2" def version_number(): return __version__
""" Discussion: In a limiting case, when the time constant of the OU process is very long and the input current is almost flat, we expect the firing rate to decrease and neuron will spike more regularly. So as the OU process time constant increases, we expect firing rate and CV_ISI to decrease, if all other parame...
#!/usr/bin/env python3 with open('27_B.txt') as f: triades = [sorted([int(y) for y in x.split()]) for x in f.readlines()[1:]] k, min_diff, s = 109, 20000, 0 for triade in triades: s += triade[2] max_mid = triade[2] - triade[1] max_min = triade[2] - triade[0] if max_mid % k != 0: min_diff = min(min_diff, max_mid...
# -*- coding: utf-8 -*- SERVER_INDEX = 'serverIndex' """ OpenAPI has support for multiple servers (read as base URLs), but the OMS doesn't. To account for this, a choice must be made when converting. """
#$Id: $ def generate(env, **kw): if not kw.get('depsOnly',0): env.Tool('addLibrary', library = ['pulsePhase']) env.Tool('pulsarDbLib') env.Tool('st_appLib') env.Tool('st_facilitiesLib') env.Tool('timeSystemLib') env.Tool('tipLib') def exists(env): return 1
# -*- coding: utf-8 -*- task = Task("Livingskill", desc = u"生活技能") #task.addSetupActionSet("RefreshGame",tag="pre1",desc="RefreshGame") task.addTeardownActionSet("TypeCommand", tag = "0.6", desc = u"清除背包", mp={'command':'$dropall -1'}) tasksuit.addTask(task) #Login step = Step("step0.5", u"登陆") step.addActionSet("Inpu...
class Solution: def countAndSay(self, n: int) -> str: def read(n): if n == 1: return '1' else: s = read(n - 1) curr, cnt = s[0], 1 res = '' for i in range(1, len(s)): ...
# %% ####################################### def remove_falsey_values_in_array(lst: list): """Removes falsey values such as 0, '', False, None from the list. Examples: >>> list_with_falsey = [0, 1, False, 2, '', ' ', 3, 'a', 's', 34, None]\n >>> remove_falsey_values_in_array(list_with_falsey)\...
class TextSearch(DependencyObject): """ Enables a user to quickly access items in a set by typing prefixes of strings. """ @staticmethod def GetText(element): """ GetText(element: DependencyObject) -> str Returns the string to that identifies the specified item. element: The element ...
def partition(a, start=0, end=0): pivot = a[end] pi = start for i in range(start, end): if a[i] <= pivot: a[i], a[pi] = a[pi], a[i] pi += 1 a[pi], a[end] = a[end], a[pi] return pi def quicksort(a, start = 0, end = 0): if start < end: pi = pa...
class Indicator_Image_Control(object): """ Handle update logic for animations """ def update(self, indicator_image): pass class Image_Pause_Control(Indicator_Image_Control): """ Handle pauses """ def __init__(self, frames): self.frames = frames self._current_frame = 0 de...
# URI Online Judge 1688 N = int(input()) for n in range(N): S = int(input()) soma = 0 for s in range(S): if s%2 == 0: soma += 1 elif s%2 == 1: soma -= 1 print(soma)
#### Data #### datapath = "COVID-19" #### Database #### db_host = "localhost" db_port = "3306" db_scheme = "bmbf_formular" db_prefix = "bmbf_" db_user = "root" db_password = "" #### DO NOT CHANGE #### if __name__ == "__main__": exit(1)
'''for i in range(1, 7): print(i) print('Fim')''' '''for i in range(6, 0, -1): print(i) print('FIM')''' for i in range(0, 7, 2): print(i) print('FIM')
n1 = float(input('Digite o primeiro numero: ')) n2 = float(input('Digite o segundo numero: ')) n3 = float(input('Digite o terceiro numero: ')) menor = n1 maior = n1 if n2<n1 and n2<n3: menor = n2 if n3<n1 and n3<n2: menor = n3 if n2>n1 and n2>n3: maior = n2 if n3>n1 and n3>n2: maior = n3 print('O menor ...
class Solution(object): def uniquePathsWithObstacles(self, grid): """ :type obstacleGrid: List[List[int]] :rtype: int """ if not grid: return 0 if grid[0][0] == 1: return 0 dp = [[0] * len(grid[0]) for _ in range(0, len(grid))] dp[0][0] = 1 if grid[0][0] == 0 else 0 for...
class CGXFormatter: def __init__(self): self.BASE_INDENT = 4 self.inside_string = False self.total_indent = 0 self.new_line = True self.nb_lines = 0 def read_lines(self): self.nb_lines = int(input()) for _ in range(self.nb_lines): line = input...
""" When make reliable means, we need to neglect best and worst value. For example, when making average score on athletes we need this option. So, this algorithms, fix some percentage to neglect when making mean. For example, if you suggest 20%, it will neglect best 10% value, and worst 10% value. This algorithm gets ...
def test_roles_dict(): """ A dictionary of roles for use in testing the dynamic User class. This dictionary represents the roles that will be in RaxKeystone.roles. """ return { "admin": ["admin_role_1", "admin_role_2"], "support": ["support_role_1"] }
# # PySNMP MIB module RBTWS-EXTERNAL-SERVER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RBTWS-EXTERNAL-SERVER-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:45:13 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3....
n = 1e5 print(int(n)) st = "a"*int(n) print(st)
class ModelUnknown(Exception): pass class AsyncMismatch(Exception): pass class InvalidInput(Exception): pass
""" 安装 pip install leqi-algorithm-mic-sdk 算法模块 algorithm_mic_sdk.error 异常模块 algorithm_mic_sdk.error.AbnormalAlgorithmPlatform API网关相关异常 algorithm_mic_sdk.auth.AuthInfo 账号信息,需要初始化后作为参数给其他需要验证的模块调用 algorithm_mic_sdk.base 基础类库模块 algorithm_mic_sdk.base.Base 主要是对图片算法的处理,可以上传/下载图片, 获取算法结果等,详细使用见模块说明 algorithm_mic_sdk.base....
def plot(processes): """ Displays the given processes in a tabular format Args: processes (Array : :class:`src.utils.process.Process`): processed processes. """ print('| PID | BURST_TIME | ARRIVAL_TIME | PRIORITY || RESPONSE_TIME | WAITING_TIME | TURNAROUND_TIME | RETURN_TIME |') for...
def test_delete_user(app): app.session.login(username="admin", password="qa2017") app.users.delete() app.session.logout() # ПРОВЕРКА #wait.until(EC.presence_of_all_elements_located((By.XPATH, "//ul[@class='sb-list ng-scope']"))) #self.assertNotIn("Auto.test.user", driver.find_element_by_xpath("...
''' Given a linked list of size N. Reverse every k nodes (where k is an input to the function) in the linked list. ''' class Node: # initializing the Node def __init__(self, data): self.data = data self.next = None class LinkedList: # Initializing the LinkedList def __init...
#Write a function that concatenates two lists. [a,b,c], [1,2,3] → [a,b,c,1,2,3] # def concatenates_two_list(lists1, lists2): # return lists1 + lists2 def concatenates_two_list(lists1, lists2): for i in lists2: lists1.append(i) return lists1 lists1 = ["a","b","c"] lists2 = [1,2,3] print(concatenate...
a = int(input()) while a != 0: if a % 2 == 1: a += 1 print(sum(range(a, a+10, 2))) a = int(input())
class dictlist(dict): """A python implementation of a dictionary mapping one key to a list of values. Parameters ---------- See the ``update`` method. Example ------- >>> from dictlist import dictlist >>> dl = dictlist() >>> dl['A']='a' >>> dl.update({'B':'b','C':'c'}) >>> ...
__author__ = 'student' A = set('0123456789') B = set('02468') C = set('12345') D = set('56789') E = ((A - B)&(C - D)) | ((D-A)&(B-C)) print(E)
def reverse(s, start, stop): """ 序列倒置 递归方式实现 :param s: :param start: :param stop: :return: """ if start < stop: s[start], s[stop] = s[stop], s[start] reverse(s, start + 1, stop - 1) def reverse_iterative(s): """ 序列倒置 迭代方式实现 :param s: :return: """ ...
def improve_initiative(): return 4 def new_ac_selector(player): def _get_ac_abil_mod(self): if not self.wearing_heavy(): return max(map( lambda x: player.get_abil_mod, name.DEX, name.INT, name.CON)) else: return max(map( la...
# https://www.hackerrank.com/challenges/time-conversion/problem def timeConversion(s): hour = int(s[0:2]) if s[-2:] == "AM": if s[0:2] == "12": res = f"0{hour - 12}{s[2:8]}" return res else: return s[0:8] else: if s[0:2] == "12": ...
# Nomal method numbers = [1, 2, 3, 4] double_numbers = [] for number in numbers: doubled = number * 2 double_numbers.append(doubled) print(double_numbers) # Using map in build function def double(x): return x * 2 doubled_list_functional = list(map(double, numbers)) print(doubled_list_functional)
class MyType: pass MyType MyType() MyType == MyType()
# coding=utf-8 def index_of_min(lyst): """ min() 搜索最小值 Returns teh index of minimum items. :param lyst: :return: """ min_index = 0 current_index = 1 while current_index < len(lyst): if lyst[current_index] < lyst[min_index]: min_index = current_index ...
# -*- coding: utf-8 -*- # Copyright 2021 Cohesity Inc. class CouchbaseRecoverJobParams(object): """Implementation of the 'CouchbaseRecoverJobParams' model. Contains any additional couchbase environment specific params for the recover job. Attributes: append_documents (bool): Whether to appen...
#coding=utf-8 class LeagueListDTO: def __init__(self, jsonData): self.leagueId = jsonData["leagueId"] if "leagueId" in jsonData else None self.tier = jsonData["tier"] if "tier" in jsonData else None self.entries = [] if "entries" in jsonData: for item in jsonData["entrie...
"""13 - Crie uma função que resolva a seguinte equação do segundo grau X² + 3x +3 = 0. Dica para calcular a raiz quadrada -> num ** 0.5""" def raizes(a, b, c): Delta = (b**2 - 4*a*c) x1 = (-b + Delta**(0.5)) / (2*a) x2 = (-b - Delta**(0.5)) / (2*a) print("\nX1: ", x1) print("X2: ", x2) return r...
def parse(raw_instruction): parsed = raw_instruction.split(' ') return { 'operation': parsed[0], 'value': int(parsed[1][1:]) if parsed[1].startswith('+') else int(parsed[1]), 'executedCount': 0 } def run(instructions): for instruction in instructions: instruction['execu...
#!/usr/bin/env python3 EXIT_VALID = 0 EXIT_KEYBOARD = 1 EXIT_UNKNOWN = 2 EXIT_CLI = 64 EXIT_INPUT_FORMAT = 65 EXIT_INPUT_NOT_FOUND = 66 EXIT_SYSERR = 71 EXIT_CANT_OUTPUT = 73 # EXIT_IOERR = 74 class MyException(Exception): def __init__(self, msg: str, ecode: int): self.msg = msg self.ecode = ec...
class TypeValidationEventArgs(EventArgs): """ Provides data for the System.Windows.Forms.MaskedTextBox.TypeValidationCompleted event. TypeValidationEventArgs(validatingType: Type,isValidInput: bool,returnValue: object,message: str) """ @staticmethod def __new__(self, validatingType, isVali...
# String s = "I am a string." print(type(s)) # Will say str # Boolean yes = True # Boolean True print(type(yes)) no = False print(type(no)) # Boolean false print(" ") # Lit -- ordered and changeable alpha_list = ["a", "b", "c"] # List initialization print(type(alpha_list)) ...
# Copyright 2018- The Pixie Authors. # # 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 w...
OPEN = 'Open' IN_PROGRESS = 'In Progress' DUE_SOON = 'Due Soon' OVERDUE = 'Overdue' CLOSED = 'Closed'
class Node: def __init__(self, data): self.data = data self.next = None class Solution: def display(self, head): current = head while current: print(current.data, end=' ') current = current.next # Solution 1 def insert(self, head, data): ...