content
stringlengths
7
1.05M
def generate_odd_nums(start, end): for num in range(start, end+1): if num % 2 !=0: print(num, end=" ") generate_odd_nums(start = 0, end = 15)
""" Escreva um programa que leia um número n inteiro qualquer e mostre na tela os n primeiros elementos de uma Sequência de Fibonacci. Ex.: 0 → 1 → 2 → 3 → 5 → 8 """ """ print("-"*30) print("Fibonacci Sequence") print("-"*30) n = int(input("How many Fibonacci sequence numbers do you want? ")) t1 = 0 t2 = 1 prin...
__author__ = 'KKishore' PAD_WORD = '#=KISHORE=#' HEADERS = ['class', 'sms'] FEATURE_COL = 'sms' LABEL_COL = 'class' WEIGHT_COLUNM_NAME = 'weight' TARGET_LABELS = ['spam', 'ham'] TARGET_SIZE = len(TARGET_LABELS) HEADER_DEFAULTS = [['NA'], ['NA']] MAX_DOCUMENT_LENGTH = 100
class PracticeCenter: def __init__(self, practice_center_id, name, email=None, web_site=None, phone_number=None, climates=None, recommendations=None, average_note=None): self.id = practice_center_id self.name = name self.email = email self.web_site = web_site ...
class Rectangle: def __init__(self, width, height): self.width = width self.height = height def __str__(self): return "Rectangle(width=" + str(self.width) + ", height="+ str(self.height) + ")" def set_width(self, width): self.width = width def set_height(self, hei...
class Test: def foo(a): if a == 'foo': return 'foo' return 'bar'
#Exercício Python 3: Crie um programa que leia dois números e mostre a soma entre eles. nome = str(input("Digite seu nome: ")) print("Olá {}, tudo bem?".format(nome)) print("Espero que sim!... \nMeu nome e VanTec-9000, e hoje eu vou te ajudar com uma soma!") print("Por favor siga os passos que eu vou te pedir, é bem f...
#------------------------------------------------------------------- # Copyright (c) 2021, Scott D. Peckham # # Oct. 2021. Added to bypass old tf_utils.py for version, etc. # #------------------------------------------------------------------- # Notes: Update these whenever a new version is released #------------...
class Solution: def maxProfit(self, prices): """ :type prices: List[int] :rtype: int """ max_profit = temp_profit = 0 incresing = [tomorrow-today for today, tomorrow in zip(prices[:-1],prices[1:])] # print(incresing) for price in incresing: ...
first_name = "ada" last_name = "lovelace" full_name = f"{first_name} {last_name}" #or full_name = "{} {}".format(first_name,last_name) #print(full_name) message = f"Hello, {full_name.title()}!" print(message)
''' the permission will be set in the database and only the managers will have permission to cancel an order already completed ''' class User(): def __init__(self, userid, username, permission): self.userid=userid self.username=username self.permission=permission def getUserNumber(self)...
class Solution: def recurse(self, A, stack) : if A == "" : self.ans.append(stack) temp_str = "" n = len(A) for i, ch in enumerate(A) : temp_str += ch if self.isPalindrome(temp_str) : self.recurse(A[i+1:], stack+[temp_str]...
class DataParser: input_pub_sub_subscription = "" output_pub_sub_subscription = "" stocks: list = [] brokers: list = [] def __init__(self, html): self.html = html def parse_table_content(self, html): """ :param html: a table of stock or broker :return: ...
# name: TColors # Version: 1 # Created by: Grigory Sazanov # GitHub: https://github.com/SazanovGrigory class TerminalColors: # Description: Class that can be used to color terminal output # Example: print('GitHub: '+f"{BColors.TerminalColors.UNDERLINE}https://github.com/SazanovGr...
""" #David Hickox #Mar 20 17 #Typing Program #this will tell each of the 7 dwarfs if they can type fast enough or not #variables # STUDENTS = names of the dwarfs # num = WPM """ STUDENTS = ["Bashful", "Doc", "Dopey", "Happy", "Sleepy", "Sneezy", "Grumpy"] print("Welcome to the Typing program") #starts the loop for...
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def solve(self, t1: TreeNode, t2: TreeNode) -> TreeNode: if not t1 and not t2: return None node = TreeNode(0) ...
"""Question: https://leetcode.com/problems/validate-binary-search-tree/ """ class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def isValidBST(self, root: TreeNode) -> bool: def is_valid_bst_recu...
# -*- coding: utf-8 -*- """ Created on Wed Jul 17 14:15:21 2019 @author: hu """
def foo(): global bar def bar(): pass
#!/usr/bin/env python """ idea: break up the address into 3 sections: 0xAABBCC. Treat each section like it is a layer in the page tables. AA is the base of one table. From that, offset BB is the base of the "PTE". Then CC is the offset into the "page" and contains a 24-bit word that we can copy. """ WORD_WIDTH = 24 D...
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompa...
class ParadoxException(Exception): pass class ParadoxConnectError(ParadoxException): def __init__(self) -> None: super().__init__('Unable to connect to panel') class ParadoxCommandError(ParadoxException): pass class ParadoxTimeout(ParadoxException): pass
#factorial(N) = N * factorial(N-1) # 예 factorial(4) = 4 * factorical(3) #... #factoral(1) = 1 def factorial(n): if n == 1: return 1 # 이 부분을 채워보세요! return n * factorial(n-1) print(factorial(5))
class Solution: def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float: def merge(l1, l2): if not l1: return l2 if not l2: return l1 if l1[0] < l2[0]: return [l1[0]] + merge(l1[1:], l2) else: retu...
cities = [ 'Riga', 'Daugavpils', 'Liepaja', 'Jelgava', 'Jurmala', 'Ventspils', 'Rezekne', 'Jekabpils', 'Valmiera', 'Ogre', 'Tukums', 'Cesis', 'Salaspils', 'Bolderaja', 'Kuldiga', 'Olaine', 'Saldus', 'Talsi', 'Dobele', 'Kraslava', 'Bausk...
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # def f_gold ( s ) : n = len ( s ) ; sub_count = ( n * ( n + 1 ) ) // 2 ; arr = [ 0 ] * sub_count ; index = 0 ; ...
morse_translated_to_english = { ".-": "A", "-...": "B", "-.-.": "C", "-..": "D", ".": "E", "..-.": "F", "--.": "G", "....": "H", "..": "I", ".---": "J", "-.-": "K", ".-..": "L", "--": "M", "-.": "N", "---": "O", ".--.": "P", "--.-": "Q", ".-.": "R"...
# # PySNMP MIB module Wellfleet-NAME-TABLE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-NAME-TABLE-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:41:01 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7....
#!/usr/bin/env python """ 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");...
''' 3) Escreva um programa que leia a quantidade de dias, horas, minutos e segundos do usuário. Calcule o total em segundos (1 min. = 60s; 1h = 60min; 1 dia = 24h). ''' dias = (int(input("Número de dias: "))) horas = (int(input("Número de horas: "))) minutos = (int(input("Número de minutos: "))) segundos = (int(input(...
""" Parking Cars in a List """ # create a list of cars row = ['Ford','Audi','BMW','Lexus'] # park my Mercedes at the end of the row row.append('Mercedes') print(row) print(row[4]) # swap the BMW at index 2 for a Jeep row[2] = 'Jeep' print(row) # park a Honda at the end of the row row.append('Honda') ...
#!/usr/bin/env python #### provide two configuration dictionaries: global_setting and feature_set #### ###This is basic configuration global_setting=dict( max_len = 256, # max length for the dataset ) feature_set=dict( ccmpred=dict( suffix = "ccmpred", leng...
class Solution: def threeSum(self, nums: List[int]) -> List[List[int]]: if not nums: return [] res = [] nums.sort() for i, num in enumerate(nums): if i > 0 and num == nums[i - 1]: continue left, right = i +...
#!/usr/bin/python3 with open('03_input', 'r') as f: lines = f.readlines() bits_list = [list(n.strip()) for n in lines] bit_len = len(bits_list[0]) zeros = [0 for i in range(bit_len)] ones = [0 for i in range(bit_len)] for bits in bits_list: for i, b in enumerate(bits): if b == '0': zero...
# WHICH NUMBER IS NOT LIKE THE OTHERS EDABIT SOLUTION: # creating a function to solve the problem. def unique(lst): # creating a for-loop to iterate for the elements in the list. for i in lst: # creating a nested if-statement to check for a distinct element. if lst.count(i) == 1: # ret...
#!/usr/bin/python3 # -*- coding: utf-8 -*- currency_symbols = {'AUD': 'A$', 'BGN': 'BGN', 'BRL': 'R$', 'CAD': 'CA$', 'CHF': 'CHF', 'CNY': 'CN¥', 'CZK': 'CZK', 'DKK': 'DKK', ...
# Complete the function below. # Function to check ipv4 # @Return boolean def validateIPV4(ipAddress): isIPv4 = True # ipv4 address is composed by octet for octet in ipAddress: try: # pretty straigthforward, convert to int # ensure per-octet value falls between [0,255] ...
""" Contains the Team object used represent NBA teams """ class Team: """ Object representing NBA teams containing: team name - three letter code - unique team id - nickname. """ def __init__(self, name, tricode, teamID, nickname): self.name = name self...
# -*- coding: utf8 -*- # ============LICENSE_START======================================================= # org.onap.vvp/validation-scripts # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. # ========================================...
def kph(ms): return ms * 3.6 def mph(ms): return ms * 2.2369362920544 def knots(ms): return ms * 1.9438444924574 def minPkm(ms): # minutes per kilometre return ms * (100 / 6) def c(ms): # speed of light return ms / 299792458 def speedOfLight(ms): return c(ms) def mach(ms): return ms / 340 d...
# -*- encoding: utf-8 -*- # # Copyright 2015-2016 Red Hat, 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 applic...
# -*- coding: utf-8 -*- even = 0 for i in range(5): A = float(input()) if (A % 2) == 0: even +=1 print("%i valores pares"%even)
class user(): def __init__(self,id,passwd): self.id = id self.passwd = passwd def get_id(self): pass
def factorial(no): if no == 1: return no else: return no * factorial(no - 1) """ # Factorial using for loop Without Recursive ans = 1 for i in range(1, no+1): ans = ans * i print(ans) """ def main(): no = int(input("Enter number : ")) # ret = no+1 print(facto...
## using hashing .. def duplicates_hash(arr, n): s = dict() for i in range(n): if arr[i] in s: s[arr[i]] = s[arr[i]]+1 else: s[arr[i]] = 1 res = [] for i in s: if s[i] > 1: res.append(i) if len(res)>0: return res else: ...
lastA = 116 lastB = 299 judgeCounter = 0 for i in range(40000000): # Generation cycle aRes = (lastA * 16807) % 2147483647 bRes = (lastB * 48271) % 2147483647 # Judging time if (aRes % 65536 == bRes % 65536): print("Match found! With ", aRes, " and ", bRes, sep="") judgeCounter...
"""In this little assignment you are given a string of space separated numbers, and have to return the highest and lowest number. === Example: === high_and_low("1 2 3 4 5") # return "5 1" high_and_low("1 2 -3 4 5") # return "5 -3" high_and_low("1 9 3 4 -5") # return "9 -5" === Notes: === All numbers are valid I...
# # PySNMP MIB module ZYXEL-DIFFSERV-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZYXEL-DIFFSERV-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:49:30 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
PLUGIN_URL_NAME_PREFIX = 'djangocms_alias' CREATE_ALIAS_URL_NAME = '{}_create'.format(PLUGIN_URL_NAME_PREFIX) DELETE_ALIAS_URL_NAME = '{}_delete'.format(PLUGIN_URL_NAME_PREFIX) DETACH_ALIAS_PLUGIN_URL_NAME = '{}_detach_plugin'.format(PLUGIN_URL_NAME_PREFIX) # noqa: E501 LIST_ALIASES_URL_NAME = '{}_list'.format(PLUGIN...
class Party: def __init__(self): self.party_people = [] self.party_people_counter = 0 party = Party() people = input() while people != 'End': party.party_people.append(people) party.party_people_counter += 1 people = input() print(f'Going: {", ".join(party.party_people)}') print(f'T...
m = float(input('Digite o número em metros: ')) c = m * 100 mm = c * 10 print('{}m é igual à {}cm e {}mm'.format(m, c, mm))
class Solution: def __init__(self): self.count = 0 def waysToStep(self, n: int) -> int: def dfs(n): if n == 1: self.count += 1 elif n == 2: self.count += 2 elif n == 3: self.count += 4 else: ...
# Determine whether a number is a perfect number, an Armstrong number or a palindrome. def perfect_number(n): sum1 = 0 for i in range(1, n): if(n % i == 0): sum1 = sum1 + i if (sum1 == n): return True else: return False def armstrong(n): sum = 0 temp = n ...
#!/usr/bin/env python3 '''\ Provides basic operations for Binary Search Trees using a tuple representation. In this representation, a BST is either an empty tuple or a length-3 tuple consisting of a data value, a BST called the left subtree and a BST called the right subtree ''' def is_bintree(T): if type(T) is ...
# Created by MechAviv # [Kyrin] | [1090000] # Nautilus : Navigation Room sm.setSpeakerID(1090000) sm.sendSayOkay("Welcome aboard the Nautilus. The ship isn't headed anywhere for a while. How about going out to the deck?")
""" Nombre: Alejandro Tejada Curso: Diseño lenguajes de programacion Fecha: Abril 2021 Programa: scannerToken.py Propósito: Esta clase es para guardar los valores de token V 1.0 """ class tokenForScanner: def __init__(self): self.tipoToken = "" self.numeracion = "" self.valor = "" def...
def deduplicate_list(list_with_dups): return list(dict.fromkeys(list_with_dups)) def filter_list_by_set(original_list, filter_set): return [elem for elem in original_list if elem not in filter_set] def write_to_file(filename, text, message): # pragma: no cover with open(filename, 'w') as f: f.w...
# # PySNMP MIB module HM2-DNS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HM2-DNS-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:31:23 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 0...
class Params: def __init__(self): self.embed_size = 75 self.epochs = 2000 self.learning_rate = 0.01 self.top_k = 20 self.ent_top_k = [1, 5, 10, 50] self.lambda_3 = 0.7 self.generate_sim = 10 self.csls = 5 self.heuristic = True self.is_s...
""" with open("scrabble.txt", 'r') as f: count = 0 for line in f: if count > 5: break print(line) count += 1 """ #1: Compute scrabble tile score of given string input #2: Compute all "valid scrabble" words that you could make # with all char from an input string. Retu...
class Solution: def longestPalindrome(self, s: str) -> int: m = {} for c in s: if c in m: m[c] += 1 else: m[c] = 1 ans = 0 longest_odd = 0 longest_char = None; for key in m: ...
# https://www.hackerrank.com/challenges/icecream-parlor/problem t = int(input()) for _ in range(t): m = int(input()) n = int(input()) cost = list(map(int, input().split())) memo = {} for i, c in enumerate(cost): if (m - c) in memo: print('%s %s' % (memo[m - c], i + 1)) ...
# Enum for allegiances ALLEGIANCE_MAP = { 0: "Shadow", 1: "Neutral", 2: "Hunter" } # Enum for card types CARD_COLOR_MAP = { 0: "White", 1: "Black", 2: "Green" } # Enum for text colors TEXT_COLORS = { 'server': 'rgb(200,200,200)', 'number': 'rgb(153,204,255)', 'White': 'rgb(255,255,...
#!/usr/bin/env python # -*- coding: utf-8 -*- """app: The package to hold shell CLI entry points. 1. cistat-cli added for demo. #. cache commands under progress. ..moduleauthor:: Max Wu < http: // maxwu.me > """
with open('binary_numbers.txt') as f: lines = f.readlines() length = len(lines) # Part One def most_common(strings): # Creates a list of amount of 1's at each index for all lines in the string. E.g. a = [1, 3, 2] will have 3 binary numbers with 1 at index 1. indices = [] bit_length = len(strings[0...
""" Sensor of Library to measure the 5g signal How to import: from Sensors.{sensor_package}.lib import device How to use: with device() as sensor: print(sensor.read_power()) """
class DarkKeeperError(Exception): pass class DarkKeeperCacheError(DarkKeeperError): pass class DarkKeeperCacheReadError(DarkKeeperCacheError): pass class DarkKeeperCacheWriteError(DarkKeeperCacheError): pass class DarkKeeperParseError(DarkKeeperError): pass class DarkKeeperParseContentErro...
""" Program: bouncy.py Project 4.8 This program calculates the total distance a ball travels as it bounces given: 1. the initial height of the ball 2. its bounciness index 3. the number of times the ball is allowed to continue bouncing """ height = float(input("Enter the height from which the ball is dropped: ")) bo...
def initialize(n): for key in ['queen','row','col','rwtose','swtose']: board[key]={} for i in range(n): board['queen'][i]=-1 board['row'][i]=0 board['col'][i]=0 for i in range(-(n-1),n): board['rwtose'][i]=0 for i in range(2*n-1): board['swtose'][i]=0 def...
class PackageManager: """ An object that contains the name used by dotstar and the true name of the PM (the one used by the OS, that dotstar calls when installing). dotstar don't uses the same name as the OS because snap has two mods of installation (sandbox and classic) so we have to differentiate ...
def raizI(x,b): if b** 2>x: return b-1 return raizI (x,b+1) raizI(11,5)
lambda x: xx def write2(): pass def write(*args, **kw): raise NotImplementedError async def foo(one, *args, **kw): """ Args: args: Test """ data = yield from read_data(db)
class Solution: def numberOfSteps (self, num: int) -> int: count = 0 while num!=0: print(num,count) if num==1: count+=1 return count if num%2==0: count+=1 else: c...
class ErrorSeverity(object): FATAL = 'fatal' ERROR = 'error' WARNING = 'warning' ALLOWED_VALUES = (FATAL, ERROR, WARNING) @classmethod def validate(cls, value): return value in cls.ALLOWED_VALUES
#!/usr/bin/env python3 def write_csv(filename, content): with open(filename, 'w') as csvfile: for line in content: for i, item in enumerate(line): csvfile.write(str(item)) if i != len(line) - 1: csvfile.write(',') csvfile.write('\n'...
def inverte_lista(lista): a = list(lista) #Nunca esquecer do list() para NÃO alterar a lista original for i in list(range(0, int(len(a)/2))): a[i], a[len(a)-i-1] = a[len(a)-i-1], a[i] return a lista1 = [1, 2, True, 3, "opa", 4, 5] lista2 = ["um", "dois", "três", "quatro"] lista3 = "Victor" print...
'''Change the database in this file Change the database in this script locally Careful here '''
class LevelUpCooldownError(Exception): pass class MaxLevelError(Exception): pass
# -*- coding: utf-8 -*- # @Time : 2021/4/23 下午8:00 """ 根据数据集构建word和index之间的映射关系 """ class Language: def __init__(self, name): """ word与index之间形成映射 Args: name (str): 语种 eg.'eng'(英文) or 'fra'(法语) """ super(Language, self).__init__() self.name = name ...
# # Copyright 2013 Red Hat, 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 to in writing...
mys1 = {1,2,3,4} mys2 = {3,4,5,6} mys1.difference_update(mys2) print(mys1) # DU1 mys3 = {'a','b','c','d'} mys4 = {'d','w','f','g'} mys5 = {'v','w','x','z'} mys3.difference_update(mys4) print(mys3) # DU2 mys4.difference_update(mys5) print(mys4) # DU3
NUMERICAL_TYPE = "num" NUMERICAL_PREFIX = "n_" CATEGORY_TYPE = "cat" CATEGORY_PREFIX = "c_" TIME_TYPE = "time" TIME_PREFIX = "t_" MULTI_CAT_TYPE = "multi-cat" MULTI_CAT_PREFIX = "m_" MULTI_CAT_DELIMITER = "," MAIN_TABLE_NAME = "main" MAIN_TABLE_TEST_NAME = "main_test" TABLE_PREFIX = "table_" LABEL = "label" HAS...
# Operations allowed : Insertion, Addition, Deletion def func(str1, str2, m, n): dp = [[0 for x in range(n+1)] for x in range(m+1)] for i in range(m+1): for j in range(n+1): if i == 0: dp[i][j] = j elif j == 0: dp[i][j] = i elif str1[i...
# Tai Sakuma <tai.sakuma@gmail.com> ##__________________________________________________________________|| def create_file_start_length_list(file_nevents_list, max_events_per_run = -1, max_events_total = -1, max_files_per_run = 1): file_nevents_list = _apply_max_events_total(file_nevents_list, max_events_total) ...
class DBModel: """Параметры для настройки подключения к БД""" def __init__(self, db_server, db_user, db_pass, db_schema, db_port): self.db_server = db_server self.db_user = db_user self.db_pass = db_p...
def metade(p=0, show=False): resp = p / 2 if show == True: return moeda(resp) else: return resp def dobro(p=0, show=False): resp = p * 2 if show == True: return moeda(resp) else: return resp def aumentar(p=0 , desc_mais=0, show=False): resp = p + (p * desc...
def buildFireTraps(start, end, step, x, y): for i in range(start, end+1, step): if x: hero.buildXY("fire-trap", x, i) else: hero.buildXY("fire-trap", i, y) buildFireTraps(40, 112, 24, False, 114) buildFireTraps(110, 38, -18, 140, False) buildFireTraps(132, 32, -20, False, 2...
"""exercism protein translation module.""" def proteins(strand): """ Translate RNA sequences into proteins. :param strand string - The RNA to translate. :return list - The protein the RNA translated into. """ # Some unit tests seem to be funky because of the order ... # proteins = set() ...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' ***************************************** Author: zhlinh Email: zhlinhng@gmail.com Version: 0.0.1 Created Time: 2016-01-10 Last_modify: 2016-01-10 ****************************************** ''' ''' Implement atoi to convert a string to an i...
# TLV format: # TAG | LENGTH | VALUE # Header contains nested TLV triplets TRACE_TAG_HEADER = 1 TRACE_TAG_EVENTS = 2 TRACE_TAG_FILES = 3 TRACE_TAG_METADATA = 4 HEADER_TAG_VERSION = 1 HEADER_TAG_FILES = 2 HEADER_TAG_METADATA = 3
""" capo_optimizer library, allows quick determination of optimal guitar capo positioning. """ version = (0, 0, 1) __version__ = '.'.join(map(str, version))
menu = """ What would your weight would be in other celestian bodies Choose a celestial body 1-Sun 2-Mercury 3-Venus 4-Mars 5-Jupiter 6-Saturn 7-Uranus 8-Neptune 9-The Moon 10- Ganymede """ option = int(input(menu)) class celestial_body: def gravity_calculation(name,acceleration): mass = float(input...
''' Classes to work with WebSphere Application Servers Author: Christoph Stoettner Mail: christoph.stoettner@stoeps.de Documentation: http://scripting101.stoeps.de Version: 5.0.1 Date: 09/19/2015 License: Apache 2.0 ''' class WasServers: def __init__(self): # Get a...
class Solution: def findReplaceString(self, S: str, indexes: List[int], sources: List[str], targets: List[str]) -> str: ans = [""] * len(S) for i in range(len(S)): ans[i] = S[i] for i in range(len(indexes)): start = indexes[i] src = sources[i] ...
############################################################################### # Singlecell plot arrays # ############################################################################### tag = "singlecell"
class PipelineNotDeployed(Exception): def __init__(self, pipeline_id=None, message="Pipeline not deployed") -> None: self.pipeline_id = pipeline_id self.message = message super().__init__(self.message) def __str__(self): return f"{self.pipeline_id} -> {self.message}"
class TGConfigError(Exception):pass def coerce_config(configuration, prefix, converters): """Convert configuration values to expected types.""" options = dict((key[len(prefix):], configuration[key]) for key in configuration if key.startswith(prefix)) for option, converter in converte...
class Solution: def search(self, nums, target): if not nums: return -1 x, y = 0, len(nums) - 1 while x <= y: m = x + (y - x) // 2 if nums[m] > nums[0]: x = m + 1 elif nums[m] < nums[0]: y = m else: ...
class Chapter: id: float title: str text: str
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def getKthFromEnd(self, head: ListNode, k: int) -> ListNode: p1 = head for _ in range(k): if p1: p1 = p1.next else: return None ...