content
stringlengths
7
1.05M
class SeriesField(object): def __init__(self): self.series = [] def add_serie(self, serie): self.series.append(serie) def to_javascript(self): jsc = "series: [" for s in self.series: jsc += s.to_javascript() + "," # the last comma is accepted by javascript...
self.description = "conflict 'db vs db'" sp1 = pmpkg("pkg1", "1.0-2") sp1.conflicts = ["pkg2"] self.addpkg2db("sync", sp1); sp2 = pmpkg("pkg2", "1.0-2") self.addpkg2db("sync", sp2) lp1 = pmpkg("pkg1") self.addpkg2db("local", lp1) lp2 = pmpkg("pkg2") self.addpkg2db("local", lp2) self.args = "-S %s --ask=4" % " ".jo...
# To check a number is prime or not num = int(input("Enter a number: ")) check = 0 if(num>=0): for i in range(1,num+1): if( (num % i) == 0 ): check=check+1 if(check==2): print(num,"is a prime number.") else: ...
def func1(): pass def func2(): pass a = b = func1 b() a = b = func2 a()
n=int(input());f=True if n!=3: f=False a=set() for _ in range(n): b,c=map(int,input().split()) a.add(b);a.add(c) if a!={1,3,4}: f=False print((f) and 'Wa-pa-pa-pa-pa-pa-pow!' or 'Woof-meow-tweet-squeek')
numeros = [] for i in range(1, 1000001): numeros.append(i) for numero in numeros: print(numero)
# Event: LCCS Python Fundamental Skills Workshop # Date: Dec 2018 # Author: Joe English, PDST # eMail: computerscience@pdst.ie # Purpose: A program to demonstrate recursion # A recursive function to add up the first n numbers. # Example: The sum of the first 5 numbers is 5 + the sum of the first 4 numbers # S...
# Problem: https://docs.google.com/document/d/1Sz1cWKsiQzQUOjC76TzFcOQGYEZIPvQuWg6NjQ0B6VA/edit?usp=sharing def print_roman(number): dict = {1:"I", 4:"IV", 5:"V", 9:"IX", 10:"X", 40:"XL", 50:"L", 90:"XC", 100:"C", 400:"CD", 500:"D", 900:"CM", 1000:"M"} for i in sorted(dict, reverse = True): ...
# 000562_04_ex03_def_vowels.py # в развитие темы - написать программу, которая выводит количество гласных букв, в порядке возрастания частотности def searsh4vowels(word): """выводит гласные, находящиеся в веденном тексте""" vowels = set('aeiou') found = vowels.intersection(set(word)) # for vowel in found: # prin...
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def maxDepth(self, p, d=0): if p is None: return 0 d = d + 1 d_left = self.maxDepth(p.left, d) d_right...
# why does this expression cause problems and what is the fix # helen o'shea # 20210203 try: message = 'I have eaten ' + 99 +' burritos.' except: message = 'I have eaten ' + str(99) +' burritos.' print(message)
seconds = 365 * 24 * 60 * 60 for year in [1, 2, 5, 10]: print(seconds * year)
""" my_rectangle = { # Coordinates of bottom-left corner 'left_x' : 1, 'bottom_y' : 1, # Width and height 'width' : 6, 'height' : 3, } """ def find_overlap(point1, length1, point2, length2): # get the highest_start_point as the max of point1 and point2 highest_start_point = m...
# ------------------------- DESAFIO 005 ------------------------- # Programa para mostrar na tela o sucessor e antecessor de um numero digitado num = int(input('Digite um Numero: ')) suc = num + 1 ant = num - 1 print('Abaixo seguem os numeros conforme na ordem: \n Antecessor / Numedo Digitado / Sucessor \n {:^10} / ...
# -*- coding: utf-8 -*- """ REFUSE Simple cross-plattform ctypes bindings for libfuse / FUSE for macOS / WinFsp https://github.com/pleiszenburg/refuse src/refuse/__init__.py: Package root Copyright (C) 2008-2020 refuse contributors <LICENSE_BLOCK> The contents of this file are subject to the Internet Syste...
# COUNT BY # This function takes two arguments: # A list with items to be counted # The function the list will be mapped to # This function uses the properties inherent in objects # to create a new property for each unique value, then # increase the count of that property each time that # element appears in ...
N, A, B = map(int, input().split()) if (B - A) % 2 == 0: print('Alice') else: print('Borys')
""" RabbitMQ concepts """ def Graphic_shape(): return "none" def Graphic_colorfill(): return "#FFCC66" def Graphic_colorbg(): return "#FFCC66" def Graphic_border(): return 2 def Graphic_is_rounded(): return True # managementUrl = rabbitmq.ManagementUrlPrefix(configNam) # managementUrl = ...
# # PySNMP MIB module HPN-ICF-ISSU-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-ISSU-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:39:30 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
def factorial(n): total = 1 for i in range(1, n+1): total *= i return total if __name__ == '__main__': f = factorial(10) print(f)
#!/usr/bin/env python3.8 # ######################################## # # Python Tips, by Wolfgang Azevedo # https://github.com/wolfgang-azevedo/python-tips # # Round Built-in Function # 2020-03-12 # ######################################## # # num_1 = input("Digite um número tipo float: ") # ex.: 1.13 num_2 = input("D...
# encoding=utf-8 class LazyDB(object): def __init__(self): self.exists = 5 def __getattr__(self, name): value = 'Value for %s' %name setattr(self,name,value) return value data = LazyDB() print('Before',data.__dict__) print('foo',data.foo) print('After',data.__dict__) class LogginglazyDB(LazyDB): def __g...
'''def algo1(): print('Antes da exceção') raise Exception('exceção do algo1') print('Depois da exceção') algo1()''' def algo1(): print('Anterior a exceção') algo2() print('Após a exceção') def algo2(): raise Exception('exceção do algo2') algo1()
n, flag = input(), False for i in range(2, len(n)): if (int(n[i]) - int(n[i-1]) != int(n[i-1]) - int(n[i-2])): flag = True break if len(n) == 1: flag = False if flag: print("흥칫뿡!! <( ̄ ﹌  ̄)>") else: print("◝(⑅•ᴗ•⑅)◜..°♡ 뀌요미!!")
#!/usr/bin/env python # -*- encoding: utf-8 -*- """ @File : exceptions.py @Contact : leetao94cn@gmail.com @Description: @Modify Time @Author @Version @Description ------------ ------- -------- ----------- 2021/6/26 4:43 下午 leetao 1.0 None """ # import lib class Error(Ex...
""" A sentence S is given, composed of words separated by spaces. Each word consists of lowercase and uppercase letters only. We would like to convert the sentence to "Goat Latin" (a made-up language similar to Pig Latin.) The rules of Goat Latin are as follows: - If a word begins with a ...
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Copyright 2012 California Institute of Technology. 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 th...
class Solution: def singleNonDuplicate(self, nums): """ :type nums: List[int] :rtype: int """ c=0 for num in nums: c=c^num return c
# -*- coding: utf-8 -*- """ Created on Fri Dec 20 23:18:03 2019 @author: NOTEBOOK """ def main(): speed = int(input('What is the speed of the vehicle in mph? ')) hours = int(input('How many hours has it traveled? ')) print('Hour\t\tDistance traveled(Miles)') print('------------------------------------...
class Params(object): """ Params object """ def __init__(self): self._params = set() self._undefined_params = set() @property def params(self) -> set: return self._params @property def defined_params(self) -> set: return self._params ^ self._undefined_params ...
winClass = window.get_active_class() if winClass not in ("code.Code", "emacs.Emacs"): # Regular window keyboard.send_keys('<home>') keyboard.send_keys('<shift>+<end>') else: # VS Code keyboard.send_keys('<ctrl>+l')
n1 = int(input('Digite um número: ')) n2 = int(input('Agora digite outro número: ')) while n1 >= n2: print (n2) n2 += 1 while n1 <= n2: print (n1) n1 += 1
#! /usr/bin/env python ############################################################################### # esp8266_MicroPy_main_boilerplate.py # # base main.py boilerplate code for MicroPython running on the esp8266 # Copy relevant parts and/or file with desired settings into main.py on the esp8266 # # The main.py file...
""" Condições IF, Elif e Else """ # If, Else e Elif são verificadores que se baseiam em boolean (TRUE ou FALSE) para determinar # o que deve ser feito. Se uma ação deve ser feita caso seja verdadeiro ou outra caso seja # falso. No caso o If é a primeira linha de verificação. Não se começa por else ou elif # Nunca esqu...
class Angel: color = "white" feature = "wings" home = "Heaven" class Demon: color = "red" feature = "horns" home = "Hell" my_angel = Angel() print(my_angel.color) print(my_angel.feature) print(my_angel.home) my_demon = Demon() print(my_demon.color) print(my_demon.feature) print(my_demon.home...
# uninhm # https://codeforces.com/contest/1419/problem/A # greedy def hasmodulo(s, a): for i in s: if int(i) % 2 == a: return True return False for _ in range(int(input())): n = int(input()) s = input() if n % 2 == 0: if hasmodulo(s[1::2], 0): print(2) ...
agent = dict( type='TD3_BC', batch_size=256, gamma=0.95, update_coeff=0.005, policy_update_interval=2, alpha=2.5, ) log_level = 'INFO' eval_cfg = dict( type='Evaluation', num=10, num_procs=1, use_hidden_state=False, start_state=None, save_traj=True, save_video=True,...
# https://codeforces.com/contest/1270/problem/B # https://codeforces.com/contest/1270/submission/68220722 # https://github.com/miloszlakomy/competitive/tree/master/codeforces/1270B def solve(A): for cand in range(len(A)-1): if abs(A[cand] - A[cand+1]) >= 2: return cand, cand+2 return None ...
class CustomConstant(object): """ Simple class for custom constants such as NULL, NOT_FOUND, etc. Each object is obviously unique, so it is simple to do an equality check. Each object can be configured with string, int, float, and boolean values, as well as attributes. """ def __ini...
def identity(x): return x def with_max_length(max_length): return lambda x: x[:max_length] if x else x def identity_or_none(x): return None if not x else x def tipo_de_pessoa(x): return "J" if x == "PJ" else "F" def cnpj(x, tipo_pessoa): return x if tipo_pessoa == "PJ" else None def cpf(x,...
a = 1 b = 2 c = 3 tmp=a a=b b=tmp tmp=c c=b b=tmp
# https://programmers.co.kr/learn/courses/30/lessons/43105 # 정수 삼각형 def solution(triangle): mem = [[0]*(i + 1) for i in range(len(triangle))] mem[0][0] = triangle[0][0] for r in range(1, len(triangle)): mem[r][0] = mem[r - 1][0] + triangle[r][0] for c in range(1, r): mem[r][c] =...
expected_output = { "cdp": { "index": { 1: { "capability": "R S C", "device_id": "Device_With_A_Particularly_Long_Name", "hold_time": 134, "local_interface": "GigabitEthernet1", "platform": "N9K-9000v", ...
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def oddEvenList(self, head: ListNode) -> ListNode: if not head or not head.next: return head odd = odd_head = head even = eve...
class Solution: def decodeString(self, s: str) -> str: stack = [] stack.append([1, ""]) num = 0 for l in s: if l.isdigit(): num = num * 10 + ord(l) - ord('0') elif l == '[': stack.append([num, ""]) num = 0 ...
# Time: O(n) # Space: O(1) class Solution(object): def countGoodRectangles(self, rectangles): """ :type rectangles: List[List[int]] :rtype: int """ result = mx = 0 for l, w in rectangles: side = min(l, w) if side > mx: result,...
pizzas = ['Supreme', 'Stuffed Crust', 'Buffalo Chicken'] friendpizzas = pizzas[:] pizzas.append("Eggs Benedict Pizza") friendpizzas.append("Eggs Florentine Pizza") print("My favorite pizzas are:") print(pizzas) print("My friend's favorite pizzas are:") print(friendpizzas)
# In a 2D grid from (0, 0) to (N-1, N-1), every cell contains a 1, except those cells in the given list mines which are 0. What is the largest axis-aligned plus sign of 1s contained in the grid? Return the order of the plus sign. If there is none, return 0. # # An "axis-aligned plus sign of 1s of order k" has some cent...
# EDA: Airplanes - Q3 def plot_airplane_type_over_europe(gdf, airplane="B17", years=[1940, 1941 ,1942, 1943, 1944, 1945], kdp=False, aoi=europe): fig = plt.figure(figsize=(16,12)) for e, y in enumerate(years): _gdf = gdf.loc[(gdf["...
class BaseRelationship: def __init__(self, name, repository, model, paginated_menu=None): self.name = name self.repository = repository self.model = model self.paginated_menu = paginated_menu class OneToManyRelationship(BaseRelationship): def __init__(self, related_name, name, ...
#Faça um programa que leia um número de # 0 a 9999 e mostre na tela # cada um dos dígitos separados. n = int(input('Informe um número: ')) u = n // 1 % 10 d = n // 10 % 10 c = n // 100 % 10 m = n // 1000 % 10 print('Analisando o número {}'.format(n)) print('Unidade: {}'.format(u)) print('Dezena: {}'.format(d)) print('C...
#! /usr/bin/env python3 def next_permutation(seq): k = len(seq) - 1 # Find the largest index k such that a[k] < a[k + 1]. while k >= 0: if seq[k - 1] >= seq[k]: k -= 1 else: k -= 1 break # No such index exists, the permutation is the last permutati...
#!/usr/bin/env python3 """RZFeeser | Alta3 Research nesting an if-statement inside of a for loop""" farms = [{"name": "NE Farm", "agriculture": ["sheep", "cows", "pigs", "chickens", "llamas", "cats"]}, {"name": "W Farm", "agriculture": ["pigs", "chickens", "llamas"]}, {"name": "SE Farm", "agricult...
""" Meijer, Erik - The Curse of the Excluded Middle DOI:10.1145/2605176 CACM vol.57 no.06 """ def less_than_30(n): check = n < 30 print('%d < 30 : %s' % (n, check)) return check def more_than_20(n): check = n > 20 print('%d > 20 : %s' % (n, check)) return check l = [1, 25, 40, 5, 23] q0 = (n ...
def get_url_headers_params_data(): url = "https://www.lagou.com/jobs/positionAjax.json" # 请求头 headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36", "Referer": "https://www.lagou.com/jobs/list_python", ...
#!/usr/bin/python # -*- coding: UTF-8 -*- class Employee: '所有员工的基类' empCount = 0 def __init__(self, name, salary): self.name = name self.salary = salary Employee.empCount += 1 def displayCount(self): print("Total Employee %d" % Employee.empCount) def displayEmploy...
a=25 b=5 print("division is ",(a/b)) print("division success")
#!/usr/bin/python # -*- coding:utf-8 -*- #Filename: decorator_return_result.py def printdebug(func): def __decorator(user): print('enter the login') result = func(user) print('exit the login') return result #在装饰器函数返回调用func的结果 return __decorator @printdebug de...
name1 = "Atilla" name2 = "atilla" name3 = "ATILLA" name4 = "AtiLLa" ## Common string functions print("capitalize",name1.capitalize()) print("capitalize",name2.capitalize()) print("capitalize",name3.capitalize()) print("capitalize",name4.capitalize()) # ends with if name1.endswith("x"): print("name1 ends with x ch...
# --==[ Settings ]==-- # General mod = 'mod4' terminal = 'st' browser = 'firefox' file_manager = 'thunar' font = 'SauceCodePro Nerd Font Medium' wallpaper = '~/wallpapers/wp1.png' # Weather location = {'Mexico': 'Mexico'} city = 'Mexico City, MX' # Hardware [/sys/class] net = 'wlp2s0' backlight = 'radeon_bl0' # Col...
"""678. Valid Parenthesis String https://leetcode.com/problems/valid-parenthesis-string/ """ class Solution: def check_valid_string(self, s: str) -> bool: left_stack, star_stack = [], [] for i, c in enumerate(s): if c == '(': left_stack.append(i) elif c == '...
class Solution: def isValid(self, s: str) -> bool: stack = [] for i in s: if i == ')' or i == ']' or i == '}': if not stack or stack[-1] != i: return False stack.pop() else: if i == '(': s...
SEARCH_PARAMS = { "Sect1": "PTO2", "Sect2": "HITOFF", "p": "1", "u": "/netahtml/PTO/search-adv.html", "r": "0", "f": "S", "l": "50", "d": "PG01", "Query": "query", } SEARCH_FIELDS = { "document_number": "DN", "publication_date": "PD", "title": "TTL", "abstract": "ABS...
# Variable Selection Linear Model Baseline = ['price_lag_1', 'price3_lag_1', 'target_lag_1', 'target3_lag_1', 'tstd_lag_1'] Lags = ['item_id_price_lag_1', 'item_id_price3_lag_1', 'item_id_target_lag_1', 'item_id_target3_lag_1', 'item_id_tstd_lag_1', 'price_lag_1', 'price3_lag_1'...
path = "." # Set this to True to fully unlock all maps # Set this to False to erase all map progress useFullMaps = True def reverse_endianness_block2(block): even = block[::2] odd = block[1::2] res = [] for e, o in zip(even, odd): res += [o, e] return res # Initiate base file data = None saveFile = [0]...
# -*- coding: utf-8 -*- class Screen: def __init__(self, dim): self.arena = [] self.dimx = dim[0]+2 self.dimy = dim[1]+2 for x in range(self.dimx): self.arena.append([]) for y in range(self.dimy): if x == 0 or x == (self.dimx-1): self.arena[x].append('-') elif y == 0 or y == (self.dimy-1): ...
#!/usr/bin/env python # -*- coding: UTF-8 -*- # pylint:disable=bad-whitespace # pylint:disable=line-too-long # pylint:disable=too-many-lines # pylint:disable=invalid-name # ######################################################### # # ************** !! WARNING !! *************** # ******* THIS FILE WAS A...
"""Manipulate vote counts so that final results conform to Benford's Law.""" # example below is for Trump vs Clinton, Illinois, 2016 Presidental Election def load_data(filename): """Open a text file of numbers & turn contents into a list of integers.""" with open(filename) as f: lines = f.read().strip...
''' 69-Crie um programa que leia a idade e o sexo de várias pessoas.A cada pessoa casdatrada,o programa deverá perguntar se o usuário quer continuar ou não.No final,mostre: A)Quantas pessoas tem mais de 18 anos. B)Quantos homens foram cadastrados. C)Quantas mulheres tem menos de 20 anos. ''' contidade = 0 conthomens =...
def strategy(history, memory): """ Tit-for-tat, except we punish them N times in a row if this is the Nth time they've initiated a defection. memory: (initiatedDefections, remainingPunitiveDefections) """ if memory is not None and memory[1] > 0: choice = 0 memory = (memory[0], m...
""" Simple config file """ class Config(object): DEBUG = False TESTING = False SECRET_KEY = b'' # TODO SQLALCHEMY_DATABASE_URI = 'sqlite:///database.db' SQLALCHEMY_TRACK_MODIFICATIONS = False class Dev(Config): DEBUG = True TESTING = True SQLALCHEMY_TRACK_MODIFICATIONS = True
#!/usr/bin/env python """ Github: https://github.com/Jiezhi/myleetcode Created on 2019-03-25 Leetcode: """ def func(x): return x + 1 def test_answer(): assert func(3) == 4
''' Construa um algoritmo que leia as variáveis C e N, respectivamente código e número de horas trabalhadas de um operário. E calcule o salário sabendo-se que ele ganha R$ 10,00 por hora. Quando o número de horas exceder a 50 calcule o excesso de pagamento armazenando-o na variável E, caso contrário zerar tal variável...
class Solution: """ @param A: An array of Integer @return: an integer """ def longestIncreasingContinuousSubsequence(self, A): n = len(A) if n < 2: return n longest = 0 conti = 1 for i in range(1, n): if A[i] > A[i - 1]: ...
LMS8001_REGDESC=""" REGBANK ChipConfig 0x000X REGBANK BiasLDOConfig 0x001X REGBANK Channel_A 0b00010000000XXXXX REGBANK Channel_B 0b00010000001XXXXX REGBANK Channel_C 0b00010000010XXXXX REGBANK Channel_D 0b00010000011XXXXX REGBANK HLMIXA 0x200X REGBANK HLMIXB 0x201X REGBANK HLMIXC 0x202X REGBANK HLMIXD 0x203X REGBANK...
age = int(input()) if 0 < age <= 13: print("детство") elif 13 < age <= 24: print("молодость") elif 24 < age <= 59: print("зрелость") elif age > 59: print("старость")
km=float(input('Quantos km percorridos: ')) d = float(input('Quantos dias alugado: ')) pago = (d * 60) + (km * 0.15) print('o total a pagar: r$ {} '.format(pago))
""" Desenvolva um programa que leia as duas notas de um aluno, calcule e mostre a sua média. """ nota1 = float(input('Digite a primeira nota: ')) nota2 = float(input('Digite a segunda nota: ')) media = (nota1 + nota2) / 2 print(f'Sua média é de: {media:.1f}')
username ="username" #your reddit username password = "password" #your reddit password client_id = "personal use script" #your personal use script client_secret = "secret" #your secret
# Solution for day2 of advent of code origValues = list(map(int, open('day2/input.txt').readline().rstrip().split(','))) print(origValues) def getOpCode(values, codeAndArgumentWidth, numberOfCodesEvaluated): currentOpCodeIndex = getCurrentOpCodeIndex(values, codeAndArgumentWidth, numberOfCodesEvaluated) retu...
site = 'ftp.skilldrick.co.uk' webRoot = '/public_html' localDir = '.' #by default use current directory remoteDir = 'tmpl' ignoreDirs = ['.git', 'fancybox', 'safeinc'] ignoreFileSuffixes = ['.py', '.pyc', '~', '#', '.swp', '.gitignore', '.lastrun', 'Makefile', '.bat', 'Thumb...
async def m001_initial(db): """ Initial lnurlpos table. """ await db.execute( f""" CREATE TABLE lnurlpos.lnurlposs ( id TEXT NOT NULL PRIMARY KEY, key TEXT NOT NULL, title TEXT NOT NULL, wallet TEXT NOT NULL, currency TEXT NOT ...
class Node: def __init__(self, data): self.data = data self.next = None class CircularLinkedList: def __init__(self): self.head = None self.tail = None self.length = 0 def append(self, data): new_node = Node(data) if not self.head: self....
n = 8 if n%2==0 and (n in range(2,6) or n>20 ): print ("Not Weird") else: print ("Weird")
routes = Blueprint("routes", __name__, template_folder="templates") if not os.path.exists(os.path.dirname(recipyGui.config.get("tinydb"))): os.mkdir(os.path.dirname(recipyGui.config.get("tinydb"))) @recipyGui.route("/") def index(): form = SearchForm() query = request.args.get("query", "").strip() escaped_query = r...
# -*- coding: utf-8 -*- """Extra utilities for webapp2 on Google App Engine. - class-based views for models, lists, forms, templates, redirection... - a pager for ndb requests - support of `webapp2_extras.i18n` translations in WTForms - customized fields for decimal, interger, date, datetime, json, ndb...
class Solution: def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> Optional[ListNode]: a = headA b = headB while a != b: if a: a = a.next else: a = headB if b: b = b.next else: b = headA return a
def reformat(string): string = string.replace('-', '').replace('(', '').replace(')', '') return string[-10:] if len(string) > 7 else '495' + string[-7:] n = 4 notes = [input() for i in range(n)] for note in notes[1:]: print('YES' if reformat(notes[0]) == reformat(note) else 'NO')
class SQLiteQueryResultSpy(object): def __init__(self, row_count, lazy_result): self.row_count = row_count self.number_of_elements = row_count self.lazy_result = lazy_result @property def rowcount(self): return self.row_count def fetchone(self): self.number_of_e...
def odeeuler(F,x0,y0,h,N): x = x0 y = y0 for i in range(1,N+1): y += h*F(x,y) x += h return y
"""Functions to get all the book's information.""" def get_title(soup_object: object) -> str: """Return book title.""" return soup_object.find("h1").text def get_universal_product_code(product_information_table: list) -> str: """Return book UPC.""" return product_information_table[0].text def get_...
REQUEST_LAUNCH_MSG = "Hello, I'm Otto Investment bot, I' here to inform you about your investments. Do you want me to tell you a report on your portfolio? Or maybe information about specific stock? " REQUEST_LAUNCH_REPROMPT = "Go on, tell me what can I do for you." REQUEST_END_MSG = "Bye bye. " # General INTENT_GENER...
# -*- coding: utf-8 -*- """ Created on Sat Feb 13 20:04:51 2021 @author: Charissa """ ''' ================================== Queue ================================== ''' class QNode: def __init__(self, data): self.data = data self.next = None class Queue: def __ini...
# A string index should always be within range s = "Hello" print(s[5]) # Syntax error - valid indices for s are 0-4
#!/anaconda3/bin/python3.6 # coding=utf-8 if __name__ == "__main__": print("suppliermgr package")
# encoding: utf-8 # Copyright 2008 California Institute of Technology. ALL RIGHTS # RESERVED. U.S. Government Sponsorship acknowledged. ''' EDRN RDF Service: unit and functional tests. '''
with open("input.txt") as input_file: lines = input_file.readlines() fish = [int(n) for n in lines[0].split(",")] print(fish) for _ in range(80): fish = [f-1 for f in fish] zeroes = fish.count(-1) for i, f in enumerate(fish): if f == -1: fish[i] = 6 fish.extend([8]*zeroes) pri...
def test_first(setup_teardown): text_logo = setup_teardown.find_element_by_id('logo').text assert text_logo == 'Your Store'
def calculaMulta (velocidade): if velocidade > 50 and velocidade < 55: return 230 elif velocidade > 55 and velocidade <= 60: return 340 elif velocidade > 60: valor = (velocidade-50) * 19.28 return valor else: return 0 vel = int(input("Informe a v...
class Solution: def removeElement(self, nums: List[int], val: int) -> int: for numbers in range(len(nums)): if val not in nums: break if len(nums) == 0: return 0 else: nums.remove(val) print(len(nums)) ...