content
stringlengths
7
1.05M
# # PySNMP MIB module RBN-TC (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RBN-TC # Produced by pysmi-0.3.4 at Wed May 1 14:52:26 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, 09:23:15) ...
# Write a program that reads a floating­point number and prints “zero” if the number # is zero. Otherwise, print “positive” or “negative”. Add “small” if the absolute value # of the number is less than 1, or “large” if it exceeds 1,000,000. userInput = float(input("Enter a floating-point number: ")) if userInput == ...
def quicksort(ar:list): """ Sort a list with quicksort algorithm. The quicksort algorithm splits a list into two parts and recursively sorts those parts by making swaps based on the elements value in relation to the pivot value. It is an O(n log(n)) sort. Args: ar: list to so...
imports="" loader=""" //handle := C.MemoryLoadLibrary(unsafe.Pointer(&full_payload[0]),(C.size_t)(len(full_payload))) handle := C.MemoryLoadLibraryEx(unsafe.Pointer(&full_payload[0]), (C.size_t)(len(full_payload)), (*[0]byte)(C.MemoryDefaultLoad...
# Copyright (C) 2019 SignalFx, Inc. All rights reserved. name = 'signalfx_serverless_gcf' version = '0.0.1' user_agent = 'signalfx_serverless/' + version packages = ['signalfx_gcf', 'signalfx_gcf.serverless']
print("Hello! I am a script in python"); def Hi(firstName, lastName): print("Hello " + firstName + " " + lastName)
class GN3: def __init__(self): self.name = 'GN3' def __str__(self): return self.name
# Specialization: Google IT Automation with Python # Course 01: Crash Course with Python # Week 2 Module Part 1 Exercise 02 # Student: Shawn Solomon # Learning Platform: Coursera.org # Practice writing some expressions and conversions yourself. # In this scenario, we have a directory with 5 files in it. Each ...
''' Author: your name Date: 2021-01-29 16:15:21 LastEditTime: 2021-03-18 18:51:14 LastEditors: Please set LastEditors # Description: In User Settings Edit FilePath: \IOe:\代码练习\每日一刷\题源分类\LeetCode\LeetCode日刷\python\92.反转链表-ii.py ''' # # @lc app=leetcode.cn id=92 lang=python3 # # [92] 反转链表 II # # https://leetcode-cn.com/p...
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of xy-cli. # https://github.com/exiahuang/xy-cli # Licensed under the Apache License 2.0: # http://www.opensource.org/licenses/Apache-2.0 # Copyright (c) 2020, exiahuang <exia.huang@outlook.com> __version__ = '0.8' # NOQA __desc__ = 'xy command tools...
class Stack: def __init__(self) -> None: self.elements = [] def push(self, element): self.elements.append(element) def size(self): return len(self.elements) def pop(self): result = self.elements[self.size()-1] self.elements = self.elements[:self.size()-1] ...
# Lets attempt to draw two points and have them move also pos_1 = 0 velo_1 = 1 pos_2 = 9 velo_2 = -1 line = 10*[' '] # The code is beginning to be clustered and hard to read for i in range(10): line[pos_1] = '*' line[pos_2] = '*' print("".join(line)) line[pos_1] = ' ' line[pos_2] = ' ' pos_...
a = int(input("Enter a -: ")) b = int(input("Enter b -: ")) print("A, B se bada ya barabar h bhai") if a >= b else print( "B, A se bada h bhai")
# A postgres database url # postgresql://[user[:password]@][netloc][:port][/dbname] DATABASE_URL="" # Your discord bot token TOKEN=""
API_TOKEN = '5218149935:AAH8qNCC69ToT29CbWppROwM4lefow9WS7k' # токен от вашего бота в телеграме (взять тут t.me/botfather) number = '79049966033' # номер киви кошелька QIWI_SEC_TOKEN = 'eyJ2ZXJzaW9uIjoiUDJQIiwiZGF0YSI6eyJwYXlpbl9tZXJjaGFudF9zaXRlX3VpZCI6InY3NWU4MS0wMCIsInVzZXJfaWQiOiI3OTA0OTk2NjAzMyIsInNlY3JldCI6Ijk4...
# brute force def find_max_subarray_1(arr): max_sub = float('-inf ') start, end = 0, 0 for i in range(0, len(arr)): sum_of_sub = 0 for j in range(i, len(arr)): sum_of_sub += arr[j] if max_sub < sum_of_sub: max_sub = sum_of_sub start = ...
class Server(object): def __init__(self, crt_name, deploy_full_chain=False, **kwargs): r"""Default server implementation describing interface of a server This is an abstract class, so each specialized method must be overridden in parent class. :param crt_name: name of certificate on server...
def gcd(a,b): return gcd(b,a%b) if b>0 else a a,b,c=map(int,input().split()) if a*b//gcd(a,b) <=c: print("yes") else: print("no")
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def search_paths(self, root, sum, path, paths): if not(root): return sum -= root.val if sum < 0:...
load("@io_bazel_rules_go//go:def.bzl", "go_context", "go_rule") load("@bazel_skylib//lib:shell.bzl", "shell") def _go_vendor(ctx): go = go_context(ctx) out = ctx.actions.declare_file(ctx.label.name + ".sh") substitutions = { "@@GO@@": shell.quote(go.go.path), "@@GAZELLE@@": shell.quote(ctx.e...
# ------------------------------ # 137. Single Number II # # Description: # Given a non-empty array of integers, every element appears three times except for one, which appears exactly once. Find that single one. # Note: # Your algorithm should have a linear runtime complexity. Could you implement it without using ext...
class InputPin: """ The Rosetta graph input pin """ # TODO: Should be able to find connected output pin - so traversal up the graph is possible. def __init__(self, pin_name, mime_type_map, filter): """ c'tor :param pin_name: The name of the pin for diagnostics, etc. :...
# # PySNMP MIB module CTRON-SFPS-COMMON-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-SFPS-COMMON-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:30:50 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
print("git UNT ") print("git lunes")
def metaLine2metaDict(metaLine): metaDict = {} fields = metaLine.split(';') for field in fields: fl = field.split('=') subfieldName = fl[0] fieldInfo = fl[1] metaDict[subfieldName] = fieldInfo return metaDict def getGeneInformationFromGFFline(line, field): result = False if not line.startswith('#'): l...
s=input('Enter Main String:') subs=input('Enter Substring to search:') if subs in s: print(subs, 'Is found in Main String') else: print(subs, 'is not found in Main String')
class Solution(object): def maxProduct(self, nums): """ :type nums: List[int] :rtype: int """ max_product = local_min = local_max = nums[0] for i in range(1, len(nums)): cur = nums[i] local_min, local_max = min(min(cur*local_min, cur*local_max)...
# automatically generated by the FlatBuffers compiler, do not modify # namespace: FBS class FByteDataType(object): UINT8 = 0 FLOAT16 = 1 FLOAT32 = 2 PNG = 3 JPEG = 4 Other = 5
FILE_PATH = './Day4/input.txt' def parseData(recordData): record = {} for data in recordData: fieldPairs = data.split(' ') for fieldPair in fieldPairs: field, value = fieldPair.split(':') record[field] = value if field not in ['byr', 'iyr', 'eyr', 'hgt', '...
""" TASK1: Finding the Square Root of an Integer Find the square root of the integer without using any Python library. You have to find the floor value of the square root. For example if the given number is 16, then the answer would be 4. If the given number is 27, the answer would be 5 because sqrt(5) = 5.196 whose fl...
#– O nome com todas as letras maiúsculas e minúsculas. #– Quantas letras ao todo (sem considerar espaços). #– Quantas letras tem o primeiro nome. """""essas três aspas duplas é uma maneira de fazer um comentario grande""" """ essa é a primeira maneira n =str(input('Digite o seu nome completo')) print(n.upper()) pr...
print(60*'=') print(' CAIXA ELETRONICO ') print(60*'=') total = int(input('Que valor deseja sacar ? R$ ')) cedula = 50 totalced = 0 while True: if total >= cedula: total-=cedula totalced+=1 print(total) else: if totalced>0: print(f'Total de {tota...
class BaseRandomizer(): def __init__(self, projectName=None, seed=None, programMode=True) -> None: self.seed = seed if programMode: self.inputPath = f'projects/{projectName}/tmp/text/' else: self.inputPath = f'projects/{projectName}/text/'
""" This constant file was automatically generated by a quick script I wrote for the enum part and h2py for the constant part. It aims to help out remembering the enum values and constants, but probably as bugs... please refer to the actual documentation for the correct values (if something is not working) and feel fr...
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
def padlindromic_date1(date1): d,m,y = date1.split('/') return (d+y)[::-1] == y and (m+d) [::-1] == y def padlindromic_date2(date2): dd,mm,yyyy = date2.split('/') date11 = ''.join([dd,mm,yyyy]) date12 = ''.join([mm,dd,yyyy]) return date11 == date11[::-1] and date12 == date12[::-1] def ...
sum = 0 for i in range(1,1000): if i%3==0 or i%5==0: sum += i print(sum)
class ORMBaseException(Exception): def __init__(self): self.message = "" super().__init__() def __str__(self): return self.message class FieldDoesNotExist(ORMBaseException): def __init__(self, field: str): self.message = f"This field '{field}' is not avaible"
r""" Global variables to the migration simulations and plot analysis. """ END_TIME = 13.2 # total simulation time in Gyr # Width of each annulus in kpc # This needs modified *only* if running the plotting scripts. ZONE_WIDTH = 0.1 MAX_SF_RADIUS = 15.5 # Radius in kpc beyond which the SFR = 0 # Stellar mass of Milky...
#Translation table for atomic numbers to element names and vice versa #Note that the NIST database provides data up to atomic number 92 (= Uranium) #Last column contains material densities ElementaryData = [ (0, "Void", "X", 0), (1, "Hydrogen", "H", 8.375E-05), (2, "Helium", ...
# Copyright (c) 2013 Mirantis 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 writ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'Phoenix1327' a = 'ABC' b = a a = 'XYZ' print(b) # a --> 'ABC' # b --> a --> 'ABC'(i.e. b --> 'ABC') # a --> 'XYZ' #exercise n = 123 f = 456.789 s1 = 'Hello, world' s2 = 'Hello, \'Adam\'' s3 = r'Hello, "Bart"' s4 = r'''Hello, Lisa!''' print (n) print (f) p...
class URL(object): BASE_URL = 'https://uatapi.nimbbl.tech/api' ORDER_URL = "/orders" AUTHURL = "v2/generate-token"; ORDER_CREATE = "v2/create-order"; ORDER_GET = "v2/get-order"; ORDER_LIST = "orders/many?f=&pt=yes"; LIST_QUERYPARAM1 = "f"; LIST_QUERYPARAM2 = "pt"; NO = "no";...
#!/usr/bin/python # encoding: utf-8 def search(key, *args, kwargs): pass if __name__ == "__main__": pass
"""A utility module for ASP (Active Server Pages on MS Internet Info Server. Contains: iif -- A utility function to avoid using "if" statements in ASP <% tags """ def iif(cond, t, f): if cond: return t else: return f
dog = {} dog['name'] = 'Bruce' dog['color'] = 'Black' dog['Breed'] = 'Pitbull' dog['Leg'] = 10.3 dog['Idade'] = '2 Years' student = { 'firstname': 'Diego', 'lastname': 'Fregolente', 'gender': 'Male', 'marital status': 'Dating', 'country': 'Brazil', 'city': 'São Paulo', 'address': { ...
# -*- coding: utf-8 -*- # @Author: rish # @Date: 2020-08-02 23:03:40 # @Last Modified by: rish # @Last Modified time: 2020-08-04 01:20:05 def info(): print( 'er_extractor module - functionality for data collection of exchange\ rates based on provided arguments and persistence of data collected\ into the da...
class Node(object): def __init__(self, value = None, leftChild = None, rightChild = None): self.value = value self.leftChild = leftChild self.rightChild = rightChild
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def lowestCommonAncestor(self, root, p, q): if root is None or root == p or root == q: return root l = self.lowestCommonAncestor(root.left, p, q) ...
#!/usr/bin/env python3 """ A crude solver for [Move Here Move There] (https://www.newgrounds.com/portal/view/718498). """ board = { (0, 0): "X", (3, 0): "X", (4, 0): [(-3, 3)], (6, 0): "X", (0, 1): "X", (4, 2): "X", (0, 4): [(4, 0)], (3, 4): [(3, -3)], (4, 4): [(1, 0), (-1, 1)], ...
# -*- coding: utf-8 -*- """ Last update: Sep. 2, 2020 @author: Asieh Abolpour Mofrad Initialization values details This code is used for simulation results reported in an article entitled: ''Enhanced Equivalence Projective Simulation: a Framework for Modeling Formation of Stimulus Equivalence C...
class Writing: ''' --help = This class provides the working of TOEFL Writing section. ''' def question(self): pass def __init__(self): pass ## TODO: Label - instructions, question ## TODO: Text Field - Write answerd
class GameObject: def __init__(self, data, localizer): # self.key will be set prior to invoking _name() self.key = self._key(data) self.name = self._name(localizer) self.prerequisites = self._prerequisites(data[self.key]) def _name(self, localizer): return localizer.get(...
ALL_LETTERS = [ letter.lower() for letter in [ "E", "A", "R", "I", "O", "T", "N", "S", "L", "C", "U", "D", "P", "M", "H", "G", "B", "F", "Y", "W", ...
# delete the item ‘Indian’ created in the dictionary for L3_10 theDict = dict() theDict['Indian'] = 'Charles Bronson' theDict['1'] = 'Airplane' theDict['2'] = 'Car' theDict['3'] = 'Boat' print('theDict before: ', theDict) # now delete the item del theDict['Indian'] print('theDict after: ', theDict)
class PistonResponse: def __init__(self, data: dict) -> None: self.ran = data.get("ran") self.language = data.get("language") self.version = data.get("version") self.stdout = data.get("stdout") self.stderr = data.get("stderr") self.output = data.get("output"...
# 066 - TRATANDO VARIOS VALORES V1.0 # LER VARIOS NUMEROS INTEIROS, PARA QUANDO FOR DIGITADO 999 E SOMAR TODOS DIGITADOS # DESCONSIDERANDO 999 somar = qtd = 0 while True: n = int(input('Digite um numero: [Digite 999 para parar[: ')) if n == 999: break somar += n qtd += 1 print(f'Foram digitado...
""" LC 2156 The hash of a 0-indexed string s of length k, given integers p and m, is computed using the following function: hash(s, p, m) = (val(s[0]) * p0 + val(s[1]) * p1 + ... + val(s[k-1]) * pk-1) mod m. Where val(s[i]) represents the index of s[i] in the alphabet from val('a') = 1 to val('z') = 26. You are given...
numero = int(input('Digite um numero: ')) total = 0 for c in range(1, numero + 1): if numero % c == 0: print('\33[32m', end='') total += 1 else: print('\33[33m', end='') print(f'{c} ', end='') if total == 2: print(' numero é primo') else: print(' numero nao é prim...
# 本方法的目标是爬取某站点的资源到本地, # 然后上传至七牛云或者通过邮件附件发送到指定的email, 最后删除本地的文件 # 由于文件名是未知的, 是可以任意构造的, 所以最后删除本地文件的代码是致命的 # 解决方案: # a. 将下载文件放置一个文件夹 temp 下, 然后 rm -f temp/* # b. 将文件名使用base64等进行编码, 然后 rm -f encrypt_base64(filename) def download(self, url, email): # 解析下载链接 download_url = self.download_parser(url) ...
#Fatiamento oi = 'Curso em Vídeo Python' print(oi[3:14]) print(oi[9]) print(oi[0:21:2]) print(oi[:14]) print(oi[8:]) print(oi[8::3])
class MissingVenvException(Exception): def __init__(self, msg=''): super().__init__(msg) class CantRunProgramException(Exception): def __init__(self, msg=''): super().__init__(msg) class NoPythonExeFound(Exception): def __init__(self, msg=''): super().__init__(msg='') class N...
# Sem else Condicao simples # Com else Condicao composta nome = str(input('Qual eh o seu nome: ')) if nome == 'Rafael': print('Que nome lindo voce tem!') else: print('Seu nome eh tao normal!') print('Bom dia, {}' .format(nome))
class Cliente: def __init__(self, nome, sexo, data_nascimento, email, profissao, endereco): self.__nome = nome self.__sexo = sexo self.__data_nascimento = data_nascimento self.__email = email self.__profissao = profissao self.__endereco = endereco @property d...
# 3.3 Write a program to prompt for a score between 0.0 and 1.0. # If the score is out of range, print an error. # If the score is between 0.0 and 1.0, print a grade using the following table: # Score Grade # >= 0.9 A # >= 0.8 B # >= 0.7 C # >= 0.6 D # < 0.6 F # If the user enters a value out of range, # print a sui...
num_1 = int(input("Enter a number: ")) num_3 = 0 while num_1 > 0: num_2 = num_1 % 10 print(num_2,end = "") num_1 = num_1 // 10 num_3 = num_3 + num_2 print(" ",num_2**3) print(" ") print(num_3)
class Solution: def maximalRectangle(self, matrix): res, m, n = 0, len(matrix), len(matrix and matrix[0]) for i in range(m): for j in range(n): if matrix[i][j] != "0": if j > 0 and matrix[i][j - 1] != "0": matrix[i][j] = matrix[...
database = { 'name': 'splice_auth_db', 'user': 'postgres', 'password': '#100100Borjan', 'host': '127.0.0.1', 'port': 5432, } mail = { 'host': 'localhost', 'port': 25, 'user': '', 'password': '#100100Borjan', 'tls': False, 'ssl': False, }
class State(object): def __init__(self, data): self.data = data pass def change_data(self, data): self.data = data
# coding=utf-8 KEYBOARD_URL_MAPS = { 'default': [ [ 'Site wide shortcuts', # keyboard category [ # ('keyboard shortcut', 'keyboard info') ('s', 'Focus search bar'), ('g n', 'Go to Notifications'), ('g h', 'Go to person...
class Files: path = './coordinates/' qatar = 'qatar.csv' western_sahara = 'western_sahara.csv' uruguay = 'uruguay.csv' djibouti = 'djibouti.csv' random_10_cities = 'random_10_cities.csv' random_20_cities = 'random_20_cities.csv' random_30_cities = 'random_30_cities.csv' # config class ...
#Exercício página 241 class User(): """Modelar um usuário""" def __init__(self, first_name, last_name, age, location): self.first_name = first_name self.last_name = last_name self.age = age self.location = location self.full_name = first_name +" "+last_name self.l...
number = int(input("Which number do you want to check? ")) if number % 2==0: print("Even") else: print("Odd")
"""You kwow, a little of this, a little of that.""" class CacheDict(dict): def get(self, key): try: return self[key] except KeyError: return None def set(self, key, value, time): self[key] = value class SettingsRequired(RuntimeWarning): pass
def eigenvalues(eigenvalues_at_kpoints, kpoint_index=0, spin_index=0): """ Returns eigenvalues for a given kpoint and spin. Args: eigenvalues_at_kpoints (list): a list of eigenvalues for all kpoints. kpoint_index (int): kpoint index. spin_index (int): spin index. Returns: ...
class DataRandomAccess(): def __init__(self, dataset): self._dataset = dataset self._scheme = dataset._scheme def __getitem__(self, slice): return self._scheme.ra(slice)
# STRUCTURE INFORMATION WITH A SIMPLE STACK METHOD # Santiago Garcia Arango, July 2020 """ Stacks are simple data-structures that work really well, when we have a problem that involves adding or removing elements but following the concept of LIFO(Last-In, First-Out). This means that the operations affect always the "t...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/1/10 下午8:52 # @Author : Jason # @File : config.py MARKDOWN = { 'h1': ('\n# ', ''), 'h2': ('\n## ', ''), 'code': ('\n```\n', '\n```\n'), 'ul': ('', ''), 'ol': ('', ''), 'li': ('- ', ''), 'blockquote': ('\n> ', ''), 'i': ...
class Result(object): """ Base class for analysis results """ def __init__(self): self.results = [] self.header = 'Abstract analysis result' def is_ok(self): return len(self.results) == 0 def add(self, err): self.results.append(err) def format_header(self)...
num = int(input()) num2 = int(input()) soma = num + num2 print('X = {}'.format(soma))
print('hey its a calculator') print('select from thr below') print('select 1 for addtion, 2 for multiplication, 3 for division, 4 for substract') while True: try: opearation = int(input('select 1 or 2 or 3 or 4 : ')) break except ValueError: print("pls enter a number") while True: ...
def extractLilBlissNovels(item): """ """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or 'preview' in item['title'].lower(): return None if ':' in item['title'] and 'Side Story' in item['title'] and not postfix: postfix = item['title'].split(':')[-1] if 'Wei W...
def _single_fortran_object_impl(ctx): toolchain_cflags = (ctx.fragments.cpp.compiler_options([]) + ctx.fragments.cpp.c_options + ctx.fragments.cpp.unfiltered_compiler_options([]) + ['-fPIC', '-Wno-maybe-uninitialized', '-Wno-unused-dummy-argument', '-Wno-conversion', '-Wno-unused-variable', '...
# Column/Label Types NULL = 'null' CATEGORICAL = 'categorical' TEXT = 'text' NUMERICAL = 'numerical' ENTITY = 'entity' # Feature Types ARRAY = 'array'
def lift1d(n): """ Convert the first n arguments of the decorated function to 1d lists if they are not passed as lists, then unpack lists before returning """ def decorator(fn): def new_fn(*args, **kwargs): assert len(args) >= n, 'Expected first {} arguments to be non-keyword' ...
#Ordenacao de listas #1. Dada uma lista, retornar o elemento que esta a cabeca (ou seja, na posicao 0). def algorithmic_sort(lista,type): if type == 1: #Selection Sort for i in range(len(lista)): # Find the minimum element in remaining # unsorted array min_idx = i ...
class Driver: def __init__(self, cores: int) -> None: self._cores = cores def shield_cpu(self, *cpu): pass def unshield_cpu(self, *cpu): pass
i = 40 - 3 for j in range(3, 12, 2): print(j) i = i + 1 print(i)
#qualquer coisa c =10 d =2 print(c/d) a = c + d e = c + d
""" ## Questions: MEDIUM ### 1015. [Smallest Integer Divisible by K](https://leetcode.com/problems/smallest-integer-divisible-by-k) Given a positive integer K, you need find the smallest positive integer N such that N is divisible by K, and N only contains the digit 1. Return the length of N. If there is no such N,...
__author__ = "Adriaan van der Graaf" class Sample: """ Implements a sample. only name is stored. Attributes ---------- Name: str sample name Phenotype: can be a value, an array or dictionary of values, but initialized as None """ def __init__(self, name, phenotype=None): ...
# Jim Lawless # License: https://github.com/jimlawless/AoC2020/LICENSE x=0 y=0 # treat N,W as -1, S,W as +1. # NESW directions=[-1,1,1,-1] # begin with East direction=1 infile = open("input.txt","r") for line in infile: line=line.rstrip() cmd=line[0:1] arg=int(line[1:]) if cmd=="F": ...
print(4 + 4) print(10 - 2) print(2 * 4) print(int(64 / 8))
"""Color palette information for the Tetris game.""" WHITE = (255, 255, 255) GRAY = (185, 185, 185) BLACK = (0, 0, 0) CYAN = (4, 216, 219) LIGHT_CYAN = (3, 252, 255) BLUE = (20, 27, 194) LIGHT_BLUE = (25, 34, 251) ORANGE = (202, 131, 24) LIGHT_ORANGE = (250, 146, 0) YELLOW = (218, 217, 42) LIGHT_YELLOW = (255, 255, 0...
def next0(A,n,x): while x<n and A[x]!=0: x+=1 return x n=int(input()) A=[int(j) for j in input().split()] b=0 for i in range(n): if A[i]==1: b=next0(A,n,max(b,i)) if b==n: break A[i],A[b]=A[b],A[i] for i in A: print(i,end=" ")
c = get_config() # get the config object c.IPKernelApp.pylab = 'inline' # in-line figure when using Matplotlib c.NotebookApp.ip = '*' c.NotebookApp.allow_remote_access = True # allow access from outside localhost c.NotebookApp.open_browser = False # do not open a browser window by default when using notebooks c.Note...
class Solution: def reverse(self, x: int) -> int: reverse = '' num = x if num < 0: neg = True num = -1 * (num) num = str(num) for i in range (len(num),0,-1): reverse += num[i-1] final = (-1 * int(reverse)) ...
def groupAnagrams(strs): x=[[i,tuple(sorted(list(i)))] for i in strs] # print(x) d= {} for i,j in x: if j not in d: d[j] = [i] else: d[j].append(i) return(d.values())
class Pagination(object): # 定pagination类 page_size = 10 page_size_query_param = 'page_size' page_query_param = 'page' max_page_size = 100
number = "9,223,372,036,854,775,807" cleanedNumber = '' for i in range(0, len(number)): if number[i] in '0123456789': cleanedNumber = number[i] newNumber = int(cleanedNumber) print("The number is {} ".format(newNumber)) x = 23 x += 1 print(x) x -= 4 print(x) x *= 5 print(x) x /= 4 print(x) x **=2 p...