content
stringlengths
7
1.05M
#~ def product(x,y,z=10): #~ print(x*y*z) #~ product(2,3) #~ def product(x=1,y=10,z): #~ print(x*y*z) #~ product(2,3) def product(x,y,z=10): print(x) print(y) print(z) #~ print(x*y*z) #~ product(2,3) product(2,3,100)
""" RPi.Relay Version: 0.1.0 Homepage: https://github.com/ricco386/RPi/tree/master/RPi.Relay This software is licensed as described in the README.rst and LICENSE files, which you should have received as part of this distribution. """ __version__ = '0.1.0'
class fHDHR_Detect(): def __init__(self, fhdhr): self.fhdhr = fhdhr self.fhdhr.db.delete_fhdhr_value("ssdp_detect", "list") def set(self, location): detect_list = self.fhdhr.db.get_fhdhr_value("ssdp_detect", "list") or [] if location not in detect_list: detect_list...
# -*- coding: utf-8 -*- """ VITA Person Finder, Controllers @author: nursix @see: U{http://eden.sahanafoundation.org/wiki/BluePrintVITA} """ prefix = request.controller resourcename = request.function if prefix not in deployment_settings.modules: session.error = T("Module disabled!") redirect(URL(r...
class Solution: def checkIfPangram(self, sentence: str) -> bool: words = set(sentence) if (len(words) != 26): return False else: return True
TEXT = ''' <div class="row"> <div class="col-md-12"> <hr/> <div class="page-footer"> <p class="page-footer"><a href="/legal/privacypolicy" target="_blank">Privacy Policy <i class='fa fa-pencil' style='font-size:16px;color:red'></i></a></p> <p class="page-footer">Copyright &copy...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for `pyxq` package.""" def test_000_something(): """Test something."""
class Dataset: def __init__(self): self.dataset = None self.groundtruth = None self.camera_file = None self.camera = None self.quat = None self.init_pose = None self.rgb_image = None self.pre_assoc_file_path = None self.descr = None
f = str(input('Digite uma frase: ')).strip().upper() p = f.split() j = ''.join(p) #i = '' i = j[::-1] #for l in range(len(j)-1,-1,-1): # i += j[l] print('o inverso de {} é {}.'.format(j,i)) if i == j: print('Temos um palíndromo!') else: print('A frase digitada não é um palíndromo.')
""" Module: 'uhashlib' on LEGO EV3 v1.0.0 """ # MCU: sysname=ev3, nodename=ev3, release=('v1.0.0',), version=('0.0.0',), machine=ev3 # Stubber: 1.3.2 class sha1: '' def digest(): pass def update(): pass class sha256: '' def digest(): pass def update(): pass
def policy(resource): if resource['MaxPasswordAge'] is None: return False return resource['MaxPasswordAge'] <= 90
class Solution(object): def multiply(self, A, B): """ :type A: List[List[int]] :type B: List[List[int]] :rtype: List[List[int]] """ if A is None or B is None or len(A) == 0 or len(B) == 0: return [[]] m = len(A) n = len(B[0]) ...
""" Define the exception classes for aioharmony module. """ class HarmonyException(Exception): """Top level Harmony Exception""" class HarmonyClient(HarmonyException): """ Top level exception for HarmonyClient """ class TimeOut(HarmonyClient, TimeoutError): """ Raised on timeouts """
def cubicip(ipparams, position, etc = []): """ This function fits the intra-pixel sensitivity effect using a 2D cubic. Parameters ---------- a: cubic coefficient in y b: cubic coefficient in x c: coefficient of cross-term xy^2 d: coefficient of cross-term yx^2 e: quadratic coefficient in...
""" Initial jokes from stackoverflow - provided under CC BY-SA 3.0 http://stackoverflow.com/questions/234075/what-is-your-best-programmer -joke?page=4&tab=votes#tab-top Copied from pyjokes. The purpose of this is so users without pyjokes pip installed can run select_a_scrum_master.py """ scrum_chooser_jokes = [ "C...
# ============================================================================= # Fog Metrics Utilities # ============================================================================= # # Miscellaneous utility functions used to compute metrics # ACCEPTABLE_TYPES = (set, frozenset, dict) def intersection_size(A, B): ...
def test(r): avg = round(sum(r) / len(r), 3) hal = { "h": 0, "a": 0, "l": 0 } for mark in r: if mark > 8: hal["h"] += 1 elif mark > 6: hal["a"] += 1 else: hal["l"] += 1 return [avg, hal, "They did well"] if hal["h"] == len(r) els...
#desenvolva um programa que leia as duas notas de um aluno, calcule e mostre a sua média n1 = float(input('Digite nota do primeiro bimestre ')) n2 = float(input('Digite nota do segundo bimestre ')) n3 = float(input('Digite nota do terceiro bimestre ')) n4 = float(input('Digite nota do quarto bimestre ')) s = n1 + n2 +...
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. ''' This module generates ANSI character codes to printing colors to terminals. See: http://en.wikipedia.org/wiki/ANSI_escape_code ''' CSI = '\033[' OSC = '\033]' BEL = '\007' def code_to_chars(code): return CSI + str(code) + 'm' def set...
print("import getmac") def get_mac_address(interface=None, ip=None, ip6=None, hostname=None, network_request=True): get_mac_address_content = f"{f'interface={interface}' if interface else ''}{f', ip={ip}' if ip else ''}{f', ip6={ip6}' if ip6 else ''}{f', hostname={hostname}' if hostname else ''}{f', network_req...
_base_ = '../../../base.py' # model settings model = dict( type='Classification', pretrained=None, backbone=dict( type='ResNet', depth=50, in_channels=3, out_indices=[4], # 0: conv-1, x: stage-x # TODO(cjrd) should we be using BN here??? norm_cfg=dict(type='B...
# Depth-first search def dfs(node, explored): if node not in explored: explored.append(node) for n in node.neighbors: dfs(n, explored) return explored # Breadth-first search def bfs(start, goal): # begin = time() explored = [] paths = [[start]] while len(paths) > 0:...
def counter(start=0): n = start while True: yield n n += 1 c = counter() print(next(c)) # prints: 0 print(next(c)) # prints: 1 print(next(c)) # prints: 2
""" Reindex the purchase records DataFrame to be indexed hierarchally, first by store, then by person. Name these indexes 'Location' and 'Name'. Then add a new entry. """ purchase_1 = pd.Series({'Name': 'Chris', 'Item Purchased': 'Dog Food', 'Cost': 22.50}) purchase_2 = p...
""" Use null statement as placeholder for future implementation ----------------------------------------------------------- Python interpreter doesn't ignore pass. The difference between pass and comment, that interpreter ignores comments. Pass is unll statement that means it is a general palceholder for future im...
# list can store any type of data type. temperatures = [] # add at the end. temperatures.append(98.6) temperatures.append(98.7) print(temperatures) er_temps = [102.2, 103.5] # extends the original list. temperatures.extend(er_temps) print(temperatures) # Concatenate primary_care_doctors = ["Dr. Scholls", "Dr. Pepper...
class Solution: def traverse(self, l, dep): for e in l: if e.isInteger(): v = e.getInteger() self.sumdep += dep * v else: self.traverse(e.getList(), dep + 1) def depthSum(self, nestedList: List[NestedInteger]) -> int: self....
# # @lc app=leetcode id=538 lang=python3 # # [538] Convert BST to Greater Tree # # https://leetcode.com/problems/convert-bst-to-greater-tree/description/ # # algorithms # Medium (56.64%) # Likes: 2561 # Dislikes: 144 # Total Accepted: 163.3K # Total Submissions: 273.4K # Testcase Example: '[4,1,6,0,2,5,7,null,nu...
class _DataPad: data_types = ['video', 'audio', 'subtitles', 'data'] def __init__(self): self.__data_type = None self.media_stream = None @property def data_type(self): return self.__data_type @data_type.setter def data_type(self, dt): if dt in _DataPad.data_t...
class Solution(object): def maxSubArray(self, nums): max_sum=float('-inf') cur_sum=0 for i in range(len(nums)): cur_sum += nums[i] if cur_sum>max_sum: max_sum = cur_sum if cur_sum<0: cur_sum = 0 return max_sum
# Problem: https://www.hackerrank.com/challenges/s10-the-central-limit-theorem-3/problem # Score: 30 # inputs mean = 500 std = 80 n = 100 z = 1.96 # characteristics of sample mean = mean std = std / n**(1/2) # Find the 95% interval print(round(mean - std * z, 2)) print(round(mean + std * z, 2))
class Solution: def validateStackSequences(self, pushed, popped): """ :type pushed: List[int] :type popped: List[int] :rtype: bool """ stack = [] pushed_index, popped_index = 0, 0 while pushed_index < len(pushed) or popped_index < len(popped): ...
# Portions Copyright (c) 2005 Nokia Corporation # # Secret Labs' Regular Expression Engine # # various symbols used by the regular expression engine. # run this script to update the _sre include files! # # Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved. # # See the sre.py file for information on usage...
##------------------------------------------------------------------- """ Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example: Given binary tree [3,9,20,null,null,15,7], 3 / \ 9 20 / \ 15 7 return its level order traversa...
def pytest_addoption(parser): parser.addoption("--core_url", action="store", default="localhost:6565") parser.addoption("--serving_url", action="store", default="localhost:6566") parser.addoption("--jobcontroller_url", action="store", default="localhost:6570") parser.addoption("--allow_dirty", action="s...
class Cab: def __init__(self,kms,type_of_cab,year): self.__kms = kms self.__type_of_cab = type_of_cab self.__year = year def get_kms(self): """ Returns kms Parameters: self returns: int: return self.__hms ...
""" Fourth algorithm function for application. Fill in your own algorithmic code here. """ def calculate4(self): 'Calculate ROI and other params given historical stock data using ?? algorithm.' return False
class Armor: name = "" info = "" level = 0 material = "" heaviness = 0 loudness = 0 hit_points = 10000 cut_damage_reduction = 0 # 1 - 10(%) stab_damage_reduction = 0 # 1 - 10(%) smash_damage_reduction = 0 # 1 - 10(%) special_abilities = [] occupied = False no_armor =...
def count_change(money, coins): # your implementation here coins.sort() result = 0 cache = [coins[0]] for i,coin in enumerate(coins): while sum(cache) < money: if sum(cache) == money: result += 1 cache.append(coin)
# -*- coding: utf-8 -*- def main(): n = int(input()) st = [0 for _ in range(n)] for i in range(n): si, ti = map(int, input().split()) st[i] = (si, ti) time = sorted(st, key=lambda x: x[0]) ans = 1 last = time[0][1] for j in range(1, n): last = max...
class AzEntity(object): """Base class for Azurelib objects""" def __init__(self, service, name): """Creates an Azurelib AzEntity Args: service: either a azure.storage.TableService or a azure.storage.QueueService name: entity's name. May be None ...
ALL_IM_SIZE = (72, 208, 208) # Resize to 72, 256, 256 then crop to 208 CROP = 24 N_CLASSES = 5 ROI_ORDER = ['SpinalCord', 'Lung_R', 'Lung_L', 'Heart', 'Esophagus'] PIXEL_SPACING = 0.975625 # Normalize to this value INPLANE_SIZE = 512 SLICE_THICKNESS = 3
num = int(input('Digite um número: ')) fat = 1 i = 2 while i <= num: fat = fat * i i += 1 print(f'O valor de {num}! é = {fat}')
def molecule_iterator_filter( molecule_iterator, min_fragments=None, max_fragments=None, min_mapping_qual=None, max_mapping_qual=None, min_ivt_duplicates=None, max_ivt_duplicates=None, both_pairs_mapped=None, min_span=None, max_span=None ): """ Filter iterable with molecules ...
""" Symlet 12 wavelet """ class Symlet12: """ Properties ---------- near symmetric, orthogonal, biorthogonal All values are from http://wavelets.pybytes.com/wavelet/sym12/ """ __name__ = "Symlet Wavelet 12" __motherWaveletLength__ = 24 # length of the mother wavelet __transformW...
# Crie um programa que tenha uma tupla totalmente preenchida com uma contagem por extenso, de zero até vinte. # Seu programa deverá ler um número pelo teclado (entre 0 e 20) e mostrá-lo por extenso. ex = ('Zero','Um','Dois','Tres','Quatro','Cinco', 'Seis','Sete','Oito','Nove','Dez','Onze','Doze' ,'Treze',...
# Complete the rotLeft function below. def go(): a= [1,2,3] d = 1 result = rotLeft(a, d) return result # print(result, a, d) def rotLeft(a, d): # append and pop value = a.pop(d) a.append(value) # print(a) # return -1 return a
# Copyright (c) 2012 The Khronos Group Inc. # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publis...
__all__ = ['GreetTheWorld'] class GreetTheWorld: def __init__(self, name: str): self._name = name def say_hello(self): print(f'Hello from GreetTheWorld: {self._name}')
VERSION = ('0', '2', '4') def get_version(): return '.'.join(VERSION)
fears = [ "the unknown", "stepping up", "going outside", "getting old", "being a coward", "intimacy", "the public", "lonliness", "death", "losing autonomy", "seperation", "mutulation", "repationships", "enclosed spaces", "letting out", "sharing emotions", "being judged" ]
print("--------------------------start--------------------------") diction={} d=1 #Function to parse the bracketed problem statement and put the intermediate results(could be terminal or non terminal) into dictionary. def parse(expression): def _helper(iter): items = [] global d for item i...
# implementation of the trie data structure class TrieNode: def __init__(self): self.children = {} self.char = '*' self.value = None self.end = False def put(self, key, value): if len(key) == 0: print("Error: Empty Key") return False head...
if __name__ == '__main__': N, M = map(int, input().split()) for i in range(1, N, 2): print((i * ".|.").center(M, "-")) print("welcome".upper().center(M, "-")) for i in range(N-2, -1, -2): print((i * ".|.").center(M, "-"))
# -*- coding:utf-8 -*- # https://leetcode.com/problems/restore-ip-addresses/description/ class Solution(object): def restoreIpAddresses(self, s): """ :type s: str :rtype: List[str] """ ret = [] def f(s, address): if not s or len(address) == 4: ...
print("Welcome to the tip calculator.") bill = float(input("What was the total bill? $")) tip = int(input("What percentage tip would you like to give? 10, 12, or 15? ")) total_people = int(input("How many people to split the bill? ")) total_tip = (bill * (tip / 100)) total_bill = (bill + total_tip) payment = (total_bi...
class LyricsNotFound(Exception): pass class ElasticSearchConnectionError(Exception): pass class InvalidRepository(Exception): pass class ArtistNotFound(Exception): pass class ConfigError(Exception): pass
# Create an infinite loop and break it when the user enters the word 'stop'. while True: # Ask the user for a word. word = input("Enter an word: ") # Stop when the user enters the word 'stop'. if word == "stop": break # Print the word back to the user followed by its length. print(word...
def math(): n = int(input()) for i in range(n): if i == n-1: print('Ho', end='') else: print('Ho', end=' ') print('!') if __name__ == '__main__': math()
load(":actions.bzl", "nim_compile") def _nim_binary_impl(ctx): # Declare an output file for the main package and compile it from srcs. executable = ctx.actions.declare_file(ctx.label.name) nim_exe= ctx.executable._nim nim_compile( ctx, nim_exe = nim_exe, projectfile = ctx.file.p...
#!/usr/bin/env python3 sumsq = sum([i**2 for i in range(1, 101)]) sqsum = sum(range(1, 101))**2 print(sqsum-sumsq)
class HostOperationSystemVersion(object): def read_get(self, name, idx_name, unity_client): return unity_client.get_host_os_type(idx_name) class HostOperationSystemVersionColumn(object): def get_idx(self, name, idx, unity_client): return unity_client.get_hosts()
k=int(input()) m=int(input()) list1=[int(i) for i in range(1,k+1)] for i in range(m): action=int(input()) list2=[] for e in range(0,len(list1)+1-action,action): if e==0: pass else: list2.append(e) for c in list2: list1.remove(c) ...
"""Tests the routes for the Errors module.""" def test_404(app, client): """Check if the application can route to a 404.""" with app.app_context(): response = client.get('/unknown_page') assert response.status_code == 404 assert 'Page Not Found' in str(response.data) def test_500(app...
class GenericTreeNode: def __init__(self, data=None, firstChild=None, nextSibling=None): self.data = data self.firstChild = firstChild self.nextSibling = nextSibling def initializeGenericTree() -> GenericTreeNode: c = GenericTreeNode(4) e = GenericTreeNode(5) a = GenericTreeNod...
''' Descripttion: version: Author: HuSharp Date: 2021-02-22 12:12:48 LastEditors: HuSharp LastEditTime: 2021-02-23 23:16:08 @Email: 8211180515@csu.edu.cn ''' class A: z = -1 def f(self, x): return B(x-1) class B(A): n = 4 def __init__(self, y): if y: self.z = self.f(y) ...
# coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # 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 applicab...
def print_full_name(a, b): b=b+'!' print("Hello",a,b, "You just delved into python.")
""" 基准条件 递归条件 """ def quicksort(src_list): if len(src_list) == 0: return [] if len(src_list) ==1: return [src_list[0]] pivot=src_list[0] left = [val for val in src_list[1:] if val<pivot] right = [val for val in src_list[1:] if val > pivot] return quicksort(left)+ [pivot] + q...
class Element: def __init__(self, value): self.value = value self.next = None class LinkedList: def __init__(self, head=None): self.head = head def append(self, new_element): current = self.head if self.head: while current.next: current ...
""" Vol I Lab __: GMRES Name: Date: """ #Problem 1: Implement the following function def gmres(A, b, x0, k=100, tol=1e-8): '''Calculate approximate solution of Ax=b using GMRES algorithm. INPUTS: A - Callable function that calculates Ax for any input vector x. b - A NumPy array of length m. ...
""" This class Environment sets up the universe for the robot. """ class Environment: """Environment class """ def __init__(self): self._detected_obj: [CoherentItem] = None
def c12_config(): return { "data_table": "default", "diag_table": "default", "experiment_name": "default", "forcing": "gs://vcm-fv3config/data/base_forcing/v1.1/", "orographic_forcing": "gs://vcm-fv3config/data/orographic_data/v1.0", "initial_conditions": "gs://vcm-fv...
class ValidatorVector: value = None def __get__(self, obj, objtype=None): return self.value def __set__(self, obj, value): if value is not None: if not isinstance(value, list): raise TypeError(f'Expected {value!r} to be an list') if obj.n is not N...
''' Description: Author: HCQ Company(School): UCAS Email: 1756260160@qq.com Date: 2021-09-12 11:16:43 LastEditTime: 2021-10-26 14:55:11 FilePath: /mmdetection3d/configs/_base_/models/hv_pointpillars_secfpn_ouster.py ''' # voxel_size = [0.16, 0.16, 4] # 长宽高 voxel_size = [0.25, 0.25, 10.5] # 长宽高 z高度要和point_cloud_range高...
# # Collective Knowledge (dealing with table) # # See CK LICENSE.txt for licensing details # See CK COPYRIGHT.txt for copyright details # # Developer: Grigori Fursin, Grigori.Fursin@cTuning.org, http://fursin.net # cfg={} # Will be updated by CK (meta description of this module) work={} # Will be updated by CK (tempo...
# Copyright (c) 2017 Cable Television Laboratories, Inc. ("CableLabs") # and others. 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. # You may obtain a copy of the License at: # # http://w...
def variableName(name): if name[0].isdigit(): return False for c in name: if not c.isalnum() and not c == '_': return False return True
deepspeech = True #Use Mozilla DeepSPeech google = True #Use Google Cloud API Speech to Text remove_wav_dir = True data_dir = './data/' input_dir = data_dir+'audio_examples/' google_credentials = data_dir+ 'project_0123.json' #Replace with your json file from: ''' https://console.cloud.google.com/apis/credentials/serv...
[ [ 0.0036339, 0.00360887, 0.00275196, 0.0019008, 0.00174623, 0.00346563, 0.00081923, 0.00105703, ], [ 0.00380165, 0.00361068, 0.0027048, 0.00190774, 0.00170164, 0.00382391, 0.00086244, ...
#5. Se tiene un monto en soles, deberá de mostrarlo en dólares. #Conversor de cambio de divisas Soles=float(input("Cuanto es el Valor Soles: S/ ")) Valor_Dolar=3.84 Dolar=Soles/Valor_Dolar Dolar=round(Dolar,2) Dolar=str(Dolar) print("El tipo de Cambio a Dolar es $",Dolar)
#!/usr/bin/env python3 #https://codeforces.com/problemset/problem/1354/B #找到最短连续子串包含123. #规律: 一定是abbbbc形式.. #recent含义是1/2/3最近出现的位置.. def tstring(s): counts = [s.count('1'),s.count('2'),s.count('3')] if 0 in counts: return 0 minlen = len(s) recent = [None,None,None] for i in range(len(s)): ...
__title__ = 'tes' __description__ = 'AlfaStrakhovanie TES API Python SDK' __url__ = '' __version__ = '0.3.1' __author__ = 'Sergey Popinevskiy' __author_email__ = 'sergey.popinevskiy@gmail.com' __license__ = 'MIT' __copyright__ = 'Copyright 2020 Sergey Popinevskiy'
''' Escreva um programa que leia dois números inteiros e compare-os. mostrando na tela uma mensagem: - O primeiro valor é maior - O segundo valor é maior - Não existe valor maior, os dois são iguais ''' n1 = int(input('Informe um número inteiro: ')) n2 = int(input('Informe mais número inteiro: ')) if n1 > n2: prin...
inp = input('Enter a sentence: ') # Gets users input old = 'abcdefghijklmnopqrstuvwxyz' # Lists for indexing if character is lower case new = 'zyxwvutsrqponmlkjihgfedcba' oldcaps = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' # Lists for indexing if character is uppercase newcaps = 'ZYXWVUTSRQPONMLKJIHGFEDCBA' for i in inp: # I...
# Alpaca login info API_URL='https://paper-api.alpaca.markets' API_KEY='' API_SECRET='' # Postgres login info DB_HOST = 'localhost' DB_USER = 'postgres' DB_PASS = 'password' DB_NAME = 'stocks' # AlphaVantage login info ALPHA_API_KEY = ''
#crie um proframa que leia quanto em dineiro uma pessoa tem na carteira e mostre quantos dolares ela pode comprar #US$ 1,00 = R$ 3,27 dinheiro = float(input('Digite quanto de dinheiro você tem? R$ ')) dolar = dinheiro / 3.27 euro = dinheiro / 4.74 iene = dinheiro / 0.039 guarani = dinheiro / 0.00067 print('O valor de...
"""Contains email templates for Epicast and helper functions for using them. Email categories include: - `alerts`: custom, one-time `notifications`-type email for a manual user group - `notifications`: for all users, says that the CDC published new data - `reminders`: for users with missing forecasts, a reminder that...
""" * Assignment: Type Int Bytes * Required: no * Complexity: easy * Lines of code: 7 lines * Time: 3 min English: 1. File size is 100 megabytes 2. Calculate size in kilobytes 2. Calculate size in megabits 3. Run doctests - all must succeed Polish: 1. Wielkość pliku to 100 megabajtów 2. Oblicz...
#: Progress bar of downloading torrents def progressBar(progress): bars = int(float(progress)) // 5 return f"{'▣'*bars}{(20-bars)*'▢'}" #: Account space bar def spaceBar(totalSpace, spaceUsed): bars = round((spaceUsed / totalSpace) * 20) return f"{'▣'*bars}{(20-bars)*'▢'}"
# simulation nodes tree class Tree: def __init__(self): # import nodes self.imp_nds = {} # simulation nodes self.sim_nds = {} # cache nodes self.cache_nds = {}
# -*- coding: utf-8 -*- # Copyright 2019 Cohesity Inc. class EULAConfiguration(object): """Implementation of the 'EULA Configuration.' model. Specifies the End User License Agreement acceptance information. Attributes: license_key (string): Specifies the license key. signed_by_user (str...
# -*- coding: utf-8 -*- """ Created on Sun Jan 03 2021 - 11:55 Introduction to Computation and Programming Using Python. John V. Guttag, 2016, 2nd ed Book Chapter 7 Exceptions and Assertions Try, except Finger exercise - Implement а function that meets the specification using a try-except block @author: Atanas Ko...
URL_JOB_SEARCH_HHRU = 'https://hh.ru/search/vacancy' PARAM_HHRU_QUERY = 'text' PARAM_HHRU_EXP = 'experience' PARAM_HHRU_AREA = 'area' PARAM_HHRU_PAGE = 'page' VACANCIES_PER_PAGE = 50
# # Roommate Finder v0.9 # # This query is intended to find pairs of roommates. It almost works! # There's something not quite right about it, though. Find and fix the bug. # QUERY = ''' select a.id, b.id, a.building, a.room from residences as a, residences as b where a.building = b.building and a.room = ...
""" Doubly Linked Lists have references to the next and previous elements """ class ListElement: def __init__(self, data, prev_item=None, next_item=None): self.data = data self.next_item = prev_item self.prev_item = next_item def append(self, data): if self.next_item: ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- if __name__ == '__main__': s = input('Введите предложение:') z = s.rfind(' ') if z == -1: print('Вы ввели одно слово') exit(1) else: print('Последние слово:', s[z:]) exit(0)
# Integer age = 22 print(age) print(type(age)) # Float grade = 9.8 print(grade) print(type(grade)) # Boolean is_published, offline = True, False print(is_published, offline) print(type(is_published), type(offline)) # String movie_name = 'Nobody' print(movie_name) print(type(movie_name)) # List (Ordered) mixed = [1,...
# """ # This is Sea's API interface. # You should not implement it, or speculate about its implementation # """ class Sea(object): def hasShips(self, topRight: 'Point', bottomLeft: 'Point') -> bool: pass class Point(object): def __init__(self, x: int, y: int): self.x = x self.y = y ...
""" Copyright (c) College of Mechatronics and Control Engineering, Shenzhen University. All rights reserved. Description : Author:Team Li """ """ 2. Add Two Numbers Medium You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes...