content
stringlengths
7
1.05M
S = [int(x) for x in input()] N = len(S) if S[0] == 0 or S[-1] == 1 or any(S[i] != S[-i - 2] for i in range(N - 1)): print(-1) quit() edge = [(1, 2)] root, now = 2, 3 for i in range(1, N // 2 + 1): edge.append((root, now)) if S[i] == 1: root = now now += 1 while now <= N: edge.append((r...
MANO_CONF_ROOT_DIR = './' # Attetion: pretrained detnet and iknet are only trained for left model! use left hand DETECTION_MODEL_PATH = MANO_CONF_ROOT_DIR+'model/detnet/detnet.ckpt' IK_MODEL_PATH = MANO_CONF_ROOT_DIR+'model/iknet/iknet.ckpt' # Convert 'HAND_MESH_MODEL_PATH' to 'HAND_MESH_MODEL_PATH_JSON' with 'prepar...
# # 1a. # 1 == 1 # => True # # 1b. # 1 != 1 # => False # # 1c. # (5 + 2) == 7 # => True # # 1d. # (5 + 2) == '7' # => False # # 1e. # 2 != (2 - 1) # => True # # 1f. # (2 > 1) or (2 < 1) # => True # # 1g. # 'tim' == 'tim' or 'tim' == 'alice' # => True # # 1h. # 'tim' == 'tim' and not 'alice' == 'alice' # ...
# PyAlgoTrade # # Copyright 2012 Gabriel Martin Becedillas Ruiz # # 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 applica...
# MEDIUM # sliding window size: [Start,i] # increment start if window size - most frequent char > k # time O(N) Space O(1) class Solution: def characterReplacement(self, s: str, k: int) -> int: count = [0]* 26 result,gmax,start = 0,0,0 for i in range(len(s)): count[ord(s...
def urlopen(): pass usocket = None
def LABELS(): LABELS1 = { "1": "speed limit 30 (prohibitory)", "0": "speed limit 20 (prohibitory)", "2": "speed limit 50 (prohibitory)", "3": "speed limit 60 (prohibitory)", "4": "speed limit 70 (prohibitory)", "5": "speed limit 80 (prohibitory)", "6": "restr...
""" Name: Srinivas Jakkula CIS 41A Spring 2020 Unit G Take-Home Assignment """ def part1(): max_pop = 0 max_state = "" file_obj = open("States.txt", "r") for line in file_obj: line_list = line.split() pop = int(line_list[2]) if line_list[1] == "Midwest" and pop > max_pop: ...
""" This module contains heuristic search algorithm implemtations, like A*. The ``lib.search.graph.Graph`` is supposed to be used as a bases for these implementations. """
"""Application base, containing global templates.""" default_app_config = 'pontoon.base.apps.BaseConfig' MOZILLA_REPOS = ( 'ssh://hg.mozilla.org/users/m_owca.info/firefox-beta/', 'ssh://hg.mozilla.org/users/m_owca.info/firefox-for-android-beta/', 'ssh://hg.mozilla.org/users/m_owca.info/thunderbird-beta/',...
def reverse(x: int): """ takes in integer and output it's reverse """ result = 0 if x < 0: x = x*(-1) a = -1 else: a = 1 while x > 0: carry = x%10 result = result*10+carry x = x//10 result = result*a if result < -2**31 or result > (2**3...
SKIP = 2 driver.add_pipeline('Create', [ Filter(Service, CreateService), CreateCounter(), Filter(Message, [UnitCreated]), Timer('unit creation intervals', SKIP) ]) units_per_level = Counter('units ordered per level', LinearOrderExtended, lambda entry: entry[Size]) timing_freq = Timer('timing unit deci...
# super() deep dive # mechanism of super() # super() can also take two parameter: # the first is the subclass, the second is an object that is an instance of # that subclass class Rectangle: def __init__(self, length, width): self.length = length self.width = width def area(self): ret...
#create list List = [1,2,3,4] Tuple = (8,1,2011) print("Size of list:", List.__sizeof__()) print("Size of tuple:", Tuple.__sizeof__())
def categorize(biblio, root, directory_keyname, category_keyname): skip_len = len(root) + 1 for book in biblio: directory = book[directory_keyname] structure = directory[skip_len:] category = structure.split('\\') book[category_keyname] = category
name, age = "Harikrishnan", 25 username = "hari94codes" print ('Hello!') print("Name: {}\nAge: {}\nUsername: {}".format(name, age, username))
matriz = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] somap = somac3 = p = 0 for l in range(0, 3): for c in range(0, 3): matriz[l][c] = int(input(f'Digite os números para compor a matriz na posição [{l}, {c}]: ')) for l in range(0, 3): for c in range(0, 3): print(f'[{matriz[l][c]:^7}]', end='') print()...
wsHub = { "endPoint": "ws://192.168.0.163:8080/", "onConnection": "hubConnected", "onReceived": "receivedNote", } wsHassio = { "endPoint": "ws://192.168.0.163:8123/api/websocket", "onConnection": "hassioConnected", "onReceived": "receivedNotice", } wsClient = wsHub ttyBridge = { "onReceiv...
def divide1(x, y): try: # Floor Division : Gives only Fractional Part as Answer result = x // y print("Yeah ! Your answer is :", result) except ZeroDivisionError: print("Sorry ! You are dividing by zero ") def divide2(x, y): try: print(f'{x}/{y} is {x / y}') ...
#!/usr/bin/env python # -*-coding:UTF-8 -*- class Stack(object): def __init__(self): self.stack = [] def push(self,object): self.stack.append(object) def pop(self): return self.stack.pop() def length(self): return len(self.stack) class Stack1(list): #为栈接口提供p...
class Solution: def removeDuplicates(self, nums: List[int]) -> int: # base case if len(nums) <= 1: return len(nums) count = 1 j = 1 for i in range(len(nums) - 1): while j < len(nums): if nums[i] == nums[j]: ...
class Unit(object): def __init__(self): pass def __str__(self): pass class Seconds(Unit): def __init__(self): super().__init__() def __str__(self): return "(s)"
# write a python program to add two numbers num1 = 1.5 num2 = 6.3 sum = num1 + num2 print(f'Sum: {sum}') # write a python function to add two user provided numbers and return the sum def add_two_numbers(num1, num2): sum = num1 + num2 return sum # write a program to find and print the largest among three nu...
# Databricks notebook source # MAGIC %md-sandbox # MAGIC # MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;"> # MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px"> # MAGIC </div> # COMMAND ---------- # M...
# -*- coding: utf-8 -*- STATE_START = 1 STATE_EXPORT_CHOOSE_FORMAT = 1 STATE_EXPORT = 2 STATE_CHOOSE_EXECUTIVES = 2 STATE_CHOOSE_DOCUMENT = 3 STATE_CHOOSE_STAGE = 4 TRANSLATION_SERVICE_ID = CHAPTER_STATE_TRANSLATION = 1 EDITING_SERVICE_ID = CHAPTER_STATE_EDITING = 2 CHAPTER_STATE_FINAL_EDITING = 10 CHAPTER_STATE_PU...
followers = {} while True: command = input().split(": ") if command[0] == "Log out": break username = command[1] if command[0] == "New follower": if username not in followers: followers[username] = (0, 0) elif command[0] == "Like": count = int(command[2]) ...
BIRD = [212, 4] REPTILE = [358, 4] MOLLUSCS = [52, 4] CHEPHALOPODS = [136, 5] MAMMAL = [359, 4] RODENTS = [1459, 5] FISSIPEDIA = [732, 5] MUSTELIDAE = [5307, 6] # badgers, weasels, martens, ferrets, minks and wolverines CANIDAE = [9701, 6] # domestic dogs, wolves, foxes, jackals, coyotes, CANIS = [5219142, 7] # ...
""" Data format for unit commitment problem """ IG = 1 PG = 2
# Copyright 2015-2017 Cisco Systems, Inc. # 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://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
""" This is multi-language commands list in order to use for visionRecog.py, vision_recog_with_hotword.py and vision_recog_with_button.py. This file contains the versions of English, Spanish and Japanese, but you can edit and add commands in other languages by adding the following dictionary. """ words_dict = { ...
"""Helper functions for small things done in many places.""" def dot_join(*args): """Join the args together.""" return '.'.join(args)
NAMESPACE_FILE = '/var/run/secrets/kubernetes.io/serviceaccount/namespace' def get_k8s_namespace(): with open(NAMESPACE_FILE, 'r') as f: return f.read()
# !/usr/bin/python # -*- encoding: utf-8 -*- """ :开发者: 陈浩 :开发日期: 2018年12月5日 :邮箱地址: chenhao1010@163.com :个人博客: https://www.chenhao-home.cn/ :开发芯片: ESP-32 :修订日志: 1、字符生成请使用PCtoLCD2002(完美版) 2、 3、 4、 5、 """ byte = { 0xe696b0: [ 0x00,0x08,0x0C,0x7F,0x22,...
# PySNMP SMI module. Autogenerated from smidump -f python TOKEN-RING-RMON-MIB # by libsmi2pysnmp-0.1.3 at Mon Apr 2 20:39:46 2012, # Python version sys.version_info(major=2, minor=7, micro=2, releaselevel='final', serial=0) # Imports ( Integer, ObjectIdentifier, OctetString, ) = mibBuilder.importSymbols("ASN1", "I...
#Body """ Compare two linked list head could be None as well for empty list Node is defined as class Node(object): def __init__(self, data=None, next_node=None): self.data = data self.next = next_node return back the head of the linked list in the below method. """ class Node(object): def _...
HOST = "0.0.0.0" PORT = 8140 # https://docs.sqlalchemy.org/en/14/dialects/postgresql.html POSTGRESQL_URL = "postgresql+asyncpg://imgsmlr:imgsmlr-123456@127.0.0.1:5400/imgsmlr" SQL_DEBUG = False SEARCH_LIMIT = 50 SEARCH_SIMR_THRESHOLD = 4.5
# Copyright (c) 2018 PrimeVR # Distributed under the MIT software license, see the accompanying # file LICENSE or http://www.opensource.org/licenses/mit-license.php def united_bitcoin_qualification(span): ubtc_start = 494000 ubtc_end = 502315 if not span['defunded']: return None if (span['defun...
""" Profile ../profile-datasets-py/div83/010.py file automaticaly created by prof_gen.py script """ self["ID"] = "../profile-datasets-py/div83/010.py" self["Q"] = numpy.array([ 2.095776, 2.465104, 3.1296 , 3.963974, 5.003875, 5.921015, 6.371809, 6.473068, 6.457728, 6.4...
class Protocol: def __init__(self, data): self.iniciator = data.get('iniciator', {}) self.responder = data.get('responder', {})
N = int(input()) t_list = [int(input()) for _ in range(N)] if N == 1: print(t_list[0]) exit() ans = float("inf") for bit in range(2 ** N): one = 0 zero = 0 for j in range(N): if 1 & bit >> j: one += t_list[j] else: zero += t_list[j] ans = min(ans, max(one...
#"Automatizando tarefas maçantes com Python", capítulo 4, exercício 2 (pág.158 # do pdf) #Objetivo: criar código para reproduzir, a partir do grid, a figura: #..OO.OO.. #.OOOOOOO. #.OOOOOOO. #..OOOOO.. #...OOO... #....O.... #Ou seja, transformar as colunas em linhas. grid = [['.', '.', '.', '.', '.', '.'], ['.', ...
""" This script is used for course notes. Author: Erick Marin Date: 11/28/2020 """ # Creating a file object and assigning a variable. file = open("Course_2/Week_2/spider.txt") # The operating system checks that we have permissions to access that file and # then gives our code a file descriptor. This is a token gener...
# This controls how frequently the whole batch is iterated over vs only # {QUICK_EVAL_PERCENT} of the data QUICK_EVAL_FREQUENCY = 0 QUICK_EVAL_PERCENT = 0.05 QUICK_EVAL_TRAIN_PERCENT = 0.025 def train( device, model, manifold, dimension, data, optimizer, loss_pa...
class MyClass: def __init__(self, value): self.__value = value def __int__(self): return int(self.__value) c = MyClass(1.23) print(int(c))
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"component_save_data_fixture": "tst.components.ipynb", "column_transformer_data_fixture": "tst.compose.ipynb", "multi_split_data_fixture": "tst.compose.ipynb", "test_pipeline_find_l...
def solution(): data = open(r'inputs\day13.in').readlines() print('Part 1 result: ' + str(part1(data))) print('Part 2 result: ' + str(part2(data))) def part1(data): # build out the grid and instructions from our data grid, fold_instructions = build_grid_and_instructions(data) # run the first f...
if 3 > 0: print('yes') if 3 < 0: print('ok') if 3 < 0: print('ok') else: print('not ok') print('*' * 40) # 数据类型也可以作为判断条件。任何值为0的数字都是False,非0为True # 其他非空对象为True,空对象为False。 # None也表示False if -0.0: print('0 is False') if 101: print('101 is True') if ' ': print('white space is True') if ''...
cappacity = 0 lines = int(input()) for i in range(0, lines): water = int(input()) if cappacity + water > 255: print("Insufficient capacity!") continue else: cappacity += water print(cappacity)
# -*- coding: utf-8 -*- # This file is generated automatically by: ECConverter # Raw excel directory name: example_enum # Do not modify this file manually # Your modification will be overridden when the automatic generation is performed # Unless you know what you are doing class GameGlobalEvent(object): """ 游...
# Write your code here def query(arr, x, l, r, k): for i in range(l-1,r): if arr[i] == x: k -= 1 if k == 0: print(i+1) return print(-1) return def update(arr, ind, value): arr[ind-1] = value n,x = map(int, input().split()) arr ...
""" makers ====== Auxjad's leaf making classes. """
def foo(a, b): a = a + b print(a, b) def bar(x): x += 1 print(x+1) x = x + 1 return x def multi( a, b, c=12): pass if a is None: print(123) if a == b and \ True: print(bla) class A: def bar(self, aa): print(aa)
def part_one(data_input: list) -> int: frequency = 0 for line in data_input: frequency += int(line) return frequency def part_two(data_input: list) -> int: change_after_iteration = sum(data_input) if not change_after_iteration: return change_after_iteration best_n_repetition =...
''' This is the 5th problem on Day 3 based on if else and if statements In this problem, we are going to build a love calculator which shall calculate compatibility between 2 people if score < 10 or score > 90, we have to print Your score is this, you go together like coke and mentos if score >=40 and score <= 50 we h...
"""merge 886b65 and f94174 Revision ID: 99822318096d Revises: f94174183e7e, 886b65e82e3e Create Date: 2020-10-29 15:54:09.623122 """ # revision identifiers, used by Alembic. revision = '99822318096d' down_revision = ('f94174183e7e', '886b65e82e3e') branch_labels = None depends_on = None def upgrade(): pass ...
# learn about boolean #a=True #b=False a=not True b=not False print(a) print(b)
def affiche_table(liste): ... def construit_table(largeur, hauteur): tab = [[],[]] for nb in range(largeur): tab[0].append(nb+1) for nb in range(hauteur): tab[1].append(nb+1) for line in hauteur: tab.append([]) return tab
name = "Gary" number = len(name) * 3 print("Hello {}, your lucky number is {}".format(name, number))
# DP N = int(input()) A = [list(map(int, input().split())) for _ in range(2)] b = [[0] * N for _ in range(2)] b[0][0] = A[0][0] for i in range(1, N): b[0][i] = b[0][i - 1] + A[0][i] b[1][0] = b[0][0] + A[1][0] for i in range(1, N): b[1][i] = max(b[1][i - 1], b[0][i]) + A[1][i] print(b[1][N - 1])
class Solution: def missingNumber(self, nums: List[int]) -> int: ideal_sum = 0 actual_sum = 0 for i in range(0, len(nums)): ideal_sum += i actual_sum += nums[i] ideal_sum += len(nums) return ideal_sum - actual_sum
class TokenType: ID = 'ID' STRING = 'STRING' NUMBER = 'NUMBER' REGEX = 'REGEX' COMMA = 'COMMA' L_BRACKET = 'LEFT BRACKET' R_BRACKET = 'RIGHT BRACKET' COLON = 'COLON' SEMICOLON = 'SEMICOLON' NEW_LINE = 'NEW LINE' TAB = 'TAB' class Token: def __init__(self, token_type, lex...
''' 给定一个整数数组,其中第 i 个元素代表了第 i 天的股票价格 。​ 设计一个算法计算出最大利润。在满足以下约束条件下,你可以尽可能地完成更多的交易(多次买卖一支股票): 你不能同时参与多笔交易(你必须在再次购买前出售掉之前的股票)。 卖出股票后,你无法在第二天买入股票 (即冷冻期为 1 天)。 示例: 输入: [1,2,3,0,2] 输出: 3 解释: 对应的交易状态为: [买入, 卖出, 冷冻期, 买入, 卖出] 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-with-cooldown '''...
array = list(input().split(",")) def find_single(array): for item in array: if array.count(item) == 1: return item print(find_single(array))
n = int(input()) height = list(map(int,input().strip(" ").split())) distinct = set(height) average = sum(distinct)/len(distinct) print(average)
# Write your solution for 1.4 here! def is_prime(x): a=0 for i in range(2,x): if x%i==0: a+=1 if a==1: return(False) print("False") else: return(True) print("True") is_prime(13) is_prime(4)
def runner_cli(augury, args): assert args.cmd == 'runner' paths = { 'status': set_status, 'config': get_config, 'artifacts': add_artifacts, } paths[args.runner_cmd](augury, args) def set_status(augury, args): if args.status: print(augury.set_runner_status(args.stat...
locit_settings = { 'scaling': 'none' } coral_settings = { 'scaling': 'none' # needs to be none with separate test set! } pwmstl_settings = { 'mu': 0.1, 'rho': 1.0, 'beta1': 10.0, 'beta2': 10.0, 'kernel': 'linear', 'max_alpha': 10.0, 'tau_lambda': 1.0 }
total = int(input('Quanto vc quer sacar? R$ ')) nota = 50 totalNotas = 0 while True: if total >= nota: total -= nota totalNotas += 1 else: if totalNotas > 0: print(f'Serão {totalNotas} de R${nota}') if nota == 50: nota = 20 elif nota == 20: ...
# # Copyright 2022 Duncan Rose # # 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...
errors = { 'NotFound': { 'status': 404, }, 'BadRequest': { 'status': 400, }, 'MethodNotAllowed': { 'status': 405, } }
num = list() pares = list() impares = list() print(f'Informe 10 números para colocar em uma lista:') for a in range(0, 10): num.append((int(input(f'Informe o {a + 1}º número: ')))) for p in num: if p % 2 == 0: pares.append(p) else: impares.append(p) num.sort() pares.sort() impares.sort(...
# Copyright (c) 2019-2020 Intel Corporation # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publi...
# This is my first Python Project using Project Euler. # Find the sum of all the multiples of 3 or 5 below 1000. # The easy and efficient way # (1 + 2 + 3 + .... n) = 1/2 n(n+1) print(0.5*((333*1002)+(199*1000)-(66*1005))) # The second way # I am defining a function to sum up all of the multiples of 3 and 5...
#!python3 print("Nome válido") print("") nome = input("Digite o nome completo de uma pessoa: ") nomeValido = True for i in range(0, len(nome)): caractere = nome[i] if (not caractere.isalpha()) and (not caractere.isspace()): nomeValido = False break if nomeValido: print("O nome informado é válido") els...
# Grandes magicos: Comece com uma copia de seu programa do Exercicio 8.9. Escreva uma funcao chamada make_great() que modifique a lista de magicos acrescentando a expressao o Grande ao nome de cada magico. Chame show_magicians() para ver se a lista foi realmente modificada. def make_great(m): for c in range(0, 6):...
""" Adds the even valued numbers of the fibonacci series below limit Author: Juan Rios """ def fibonacci_sum(limit): a = 1 b = 2 sum = 0 while (b<limit): if (b%2==0): sum += b temp = b b += a a = temp return sum if __name__ == "__main__": limit = 400...
'''Crie um programa onde o usuário possa digitar 5 valores numéricos e cadastre-os em uma lista, já na posição correta de inserção. No final, mostre a lista ordenada na tela.''' num = list() for n in range(0, 5): num.append(int(input('Informe um número: '))) num.sort() print(f'Os números cadastrados na lista s...
''' File: __init__.py Project: src File Created: Sunday, 28th February 2021 3:03:13 am Author: Sparsh Dutta (sparsh.dtt@gmail.com) ----- Last Modified: Sunday, 28th February 2021 3:03:13 am Modified By: Sparsh Dutta (sparsh.dtt@gmail.com>) ----- Copyright 2021 Sparsh Dutta '''
""":mod:`Stock` -- Provides an interface for Neopets stocks .. module:: Stock :synopsis: Provides an interface for Neopets stocks .. moduleauthor:: Kelly McBride <kemcbride28@gmail.com> """ def clean_numeric(string_value): # Clean commas cleaned = string_value.replace(',', '') # Clean percent signs ...
jpg1 = 0 jpg2 = 0 img1 = 0 img2 = 0 def setup(): global jpg1, jpg2 background(100) smooth() size(1200, 700) noStroke() jpg1 = loadImage ('br1.jpg') jpg2 = loadImage ('bread1.gif') def draw(): global jpg1, jpg2 if ( frameCount == 1): image...
def slices(series, length): if len(series) <= 0 or length <= 0: raise ValueError("invalid arguments.") if length > len(series): raise ValueError(f"Cannot get {length} digit series from a {len(series)} digit string.") resultList = [] diff = len(series) - length +1 for i in range (...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Mar 10 19:48:36 2019 @author: dvdgmf """ class MeteorologicalDiagnosis: def __init__(self, obs, pred): self.tptn = self.get_TPTN(obs, pred) self.tn = self.tptn.count('TN') self.tp = self.tptn.count('TP') self.f...
#desafio-040 nota1 = float(input('Digite a primeira nota: ')) nota2 = float(input('Digite a segunda nota: ')) med = (nota1 + nota2) / 2 if med > 7: print('Você foi Aprovado PARABENS! ') elif med < 5: print('Você está REPROVADO ! ') else: med >= 5.1 or med >= 6.9 print('Você está de RECUPERACAO!!!')
s = input('informe o seu sexo [M/F]: ') while s not in 'MmFf': s = input('Dados inválidos. Por favor, informe seu sexo[M/F]: ') if s in 'Mm': print('Sexo Masculino registrado com sucesso!') elif s in 'Ff': print('Sexo feminino registrado com sucesso!')
""" .. module:: base_geometry :platform: Unix, Windows :synopsis: Base classes for geometry """ def validate_knot(knot): """ Confirm a knot is in the range [0, 1] Parameters ---------- knot : float Parameter to verify Returns ------- bool Whether or not the knot is...
class Solution: def removeDuplicates(self, nums): """ :type nums: List[int] :rtype: int """ if not nums: return 0 if len(nums) == 1: return 1 idx = 1 for n in nums[2:]: if n > nums[idx - 1]: idx += 1 ...
class Solution: def gameOfLife(self, board: List[List[int]]) -> None: """ Do not return anything, modify board in-place instead. """
print('{:=^40}'.format(' LOJAS LACRAU ')) valorProduto = float(input('Qual o valor do produto? R$ ')) print('''FORMAS DE PAGAMENTO: [ 1 ] À vista no dinheiro/cheque: 10% de desconto; [ 2 ] À vista no cartão de débito/crédito: 5% de desconto; [ 3 ] Em até 2x no cartão: preço normal; [ 4 ] 3x o...
# parsetab.py # This file is automatically generated. Do not edit. # pylint: disable=W,C,R _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'AND ASSIGN COMMA DEF DIFF DIVIDE ELIF ELSE EQ FALSE FLOAT FOR GET GT ID IF IN INTEGER LBRACE LBRACKET LET LPAREN LT MINUS MINUSMINUS MULTIPLY NOT OR PLUS PLUSPLUS RBRAC...
# To create a variable character_name = "Jin" character_age = "99" print(character_name + " is " + character_age + " years old.") # reassigning the variable character_name = "mochi" print(character_name + " is " + character_age + " years old.") print("jin\nacademy") print(len(character_name)) # to create a new line ...
'''Crie um programa que crie uma matriz de dimensão 3x3 e a preencha com um valores lidos pelo teclado: #visualizar o exemplo no video No final, mostre a matriz na tela, com a formatação correta.''' '''lista = [[],[],[]] for c in range (0,3): for v in range (0,3): lista[c].append(int(input(f'Digite um val...
def gimme5(): return 5 def gimme3(): return 3
class Solution: def maxArea(self, height): """ :type height: List[int] :rtype: int """ p1 = 0 p2 = len(height) - 1 ret = 0 while p1 < p2: ret = max(min(height[p1], height[p2]) * (p2 - p1), ret) if height[p2] > height[p1]: ...
# -*- coding:utf8 -*- # Power by zuosc 2016-09-27 # 递归函数 def fact(n): if n == 1: return 1 return n * fact(n - 1) fact(7)
def sqrt_approx(num): i = 0 minsq = 0 maxsq = 0 while i <= num: if i * i <= num: minsq = i if i * i >= num: maxsq = i break i = i + 1 return minsq, maxsq for i in range(0, 26): print(i, sqrt_approx(i))
# # PySNMP MIB module Wellfleet-IPEX-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-IPEX-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:40:34 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
## lists7.py def main(): pals = ['Bob','Rob','Fred','Amy','Sarah'] pals2 = pals ## both variables refer to SAME LIST pals.remove('Fred') print(pals2) ### crude pals3 = [] for p in pals: pals3.append(p) print(pals3) ### crude dump del pals[0] ### dele...
""" 1. The oscillations start getting larger and larger which could in the end become uncontrollable 2. Looking at the shape of the spiral """
""" Definition of ParentTreeNode: class ParentTreeNode: def __init__(self, val): self.val = val self.parent, self.left, self.right = None, None, None """ class Solution: """ @param: root: The root of the tree @param: A: node in the tree @param: B: node in the tree @return: The ...
# Copyright 2021 John Millikin and the rust-fuse contributors. # # 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...