content
stringlengths
7
1.05M
# list of experiments exported to calling script exps = [] # add experiments to the global list. # a local function that keeps the internal variables from becoming global def define_experiments(): binary = False binaryflag = "" if binary else "--no-binary" partfunc = "twitternew" if binary else "twitternew...
# Copyright 2018 Google 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 required by applicable law or a...
a = int(input('Digite mais um número:')), int(input('Digite mais um número:')), int(input('Digite mais um número:')), int(input('Digite mais um número:')) contpar = 0 if 9 in a: print(f'O número 9 apareceu {a.count(9)} vezes') else: print('ERRO! Não temos o número 9 nos números digitados.') if 3 in a: ...
def main(): file = open('input.txt', 'r') data = file.readlines() gamma_rate = '' epsilon_rate = '' length = len(data[0]) -1 for i in range(length): zeros = 0 ones = 0 for j in range(len(data)): if(data[j][i] == '0' ): zeros += 1 else: ones += 1 if(zeros > ones): gamma_rate += '0' ...
# file reading (in bytes mode) f = open('exception_learning.py', 'rb') file_content = f.read(3) print(file_content) file_content = f.read(3) print(file_content) f.seek(0) file_content = f.read(3) print(file_content) f.close() # file writing (in text mode) f = open('new_file.txt', mode='w') f.write('123457890') f.seek(...
z = int(input()) while z > 0: num = int(input()) temp = s = 0 for y in range(0 , num): if temp == 0: s += 1 temp = 1 else: s -= 1 temp = 0 print(s) z -= 1
class Node: def __init__(self, value): self.value = value self.left = None self.right = None def insert(self, value): if self.value >= value: self.insert_left(value) else: self.insert_right(value) def insert_left(self, value): if ...
__name__ = 'debiasmedimg' major = 0 minor = 0 patch = 0 __version__ = '{}.{}.{}'.format(major, minor, patch) __author__ = 'Ann-Katrin Thebille' __fname__, *_, __lname__ = __author__.lower().split(' ') __university__ = 'uni-hamburg' __institute__ = 'zmnh' __domain__ = '{}{}{}.de'.format(__institute__, '.' if __unive...
def extractCaelumLexCom(item): ''' Parser for 'caelum-lex.com' ''' # Wat return False
ChartInfo = provider(fields=["chartname", "version", "repository"]) def _helm_chart_impl(ctx): # make the dependencies.yaml template requirements = "cat <<EOF\ndependencies:\n" for dep in ctx.attr.deps: requirements += "- name: \"%s\"\n" % (dep[ChartInfo].chartname,) requirements += " ver...
""" Mi Aporte! Tema: Map (Con lambda y operador ternario) """ class Empleado: def __init__(self, nombre, cargo, salario): self.nombre = nombre self.cargo = cargo self.salario = salario def __str__(self): return f'Mi nombre es {self.nombre} y tengo un salario de {self.salari...
'''Functions for accessing databases This library contains functions that will allow you to write high performance code for accessing various databases. Currently it only has access to Postgres libraries. Specifications of the locations of the databases are assumed to be present within the ``../config/db.json`...
class DeploymentParameter(object): CURRENT_DESIRED = {'name': 'current.desired.state', 'description': "Desired state of the container's current task."} CURRENT_STATE = {'name': 'current.state', 'description': "Actual state of the container's current task."} CU...
class Solution(object): def isAnagram(self, s, t): """ :type s: str :type t: str :rtype: bool """ s=list(s) s=sorted(s) t=list(t) t=sorted(t) return t==s
# https://www.hackerrank.com/challenges/python-quest-1/problem for i in range( 1, int(input()) ): # More than 2 lines will result in 0 score. Do not leave a blank line also print((10 ** (i) // 9) * i)
def prime_factors(n): factors = {} while n != 1: divider = 2 while n%divider != 0: divider += 1 n /= divider factors[divider] = factors[divider] + 1 if factors.get(divider) else 1 return ''.join(f'({divider}**{quantity})' if quantity > 1 else f'({divider})' for divider,qu...
def khan(graph): n = len(graph) in_degree = [0] * n idx = [0] * n for i in range(n): for edge in graph[i]: in_degree[edge] += 1 # print("The indegree is:", in_degree) q = [] topo_sort = [] # Adding all elements with indegree zero into the queue for i in range(...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: ans = None def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': def dfs(root): ...
class Solution: def threeSum(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ nums.sort() res = [] i = 0 for i in range(len(nums)): if i == 0 or nums[i] > nums[i - 1]: l = i + 1 r = len(nums...
""" 字符串压缩。利用字符重复出现的次数,编写一种方法,实现基本的字符串压缩功能。 比如,字符串aabcccccaaa会变为a2b1c5a3。 若“压缩”后的字符串没有变短,则返回原先的字符串。 你可以假设字符串中只包含大小写英文字母(a至z)。 示例1: 输入:"aabcccccaaa" 输出:"a2b1c5a3" 示例2: 输入:"abbccd" 输出:"abbccd" 解释:"abbccd"压缩后为"a1b2c2d1",比原字符串长度更长。 """ class Solution: def compressString(self, S: str) -> str: result = self.co...
""" Definition of ListNode class ListNode(object): def __init__(self, val, next=None): self.val = val self.next = next """ class Solution: """ @param lists: a list of ListNode @return: The head of one sorted list. """ def mergeKLists(self, lists): L = len(lists) ...
''' Faça um programa que leia algo pelo teclado e mostre na tela o seu tipo primitivo e todas as informações possiveis sobre ele. ''' var = input('Digite algo: ') print(type(var)) print(var.isalnum()) print(var.isalpha()) print(var.isdecimal()) print(var.isnumeric()) print(var.isspace()) print(var.islower()) print(v...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def findLeaves(self, root): """ :type root: TreeNode :rtype: List[List[int]] """ results = [] ...
class Dispatcher: def can_dispatch(self, request): raise NotImplementedError() def dispatch(self, request): raise NotImplementedError() class Transport: def can_transport(self, request): pass def send_request(self, context, data): raise NotImplementedError() def ...
print("what is your name?") name = input() print("How old are you?", end=' ') age = input() print("How tall are you?", end=' ') height = input() print("How much do you weigh?", end=' ') weight = input() print(f"So, {name}, you're {age} old, {height} tall and {weight} pounds heavy.")
for row in range(4): for col in range(8): if row-col==0 or row+col==6: print('*', end = '') else: print(' ', end = '') print()
order = { "starter": {1: "Salad", 2: "Soup"}, "main": {1: ["Burger", "Fries"], 2: ["Steak"]}, "dessert": {1: ["Ice Cream"], 2: []}, } print(order["main"][2][0])
def binary_search(array, target): left = 0 right = len(array) - 1 while left <= right: mid = left + (right - left) // 2 if array[mid] == target: return mid elif array[mid] > target: right = mid - 1 else: left = mid + 1 return -1 def t...
{ "targets": [ { "target_name": "my_addon", "sources": ["my_addon.cc"], "include_dirs" : [ "<!(node -e \"require('nan')\")" ] } ] }
# 反转一个单链表。 # # 示例: # # 输入: 1->2->3->4->5->NULL # 输出: 5->4->3->2->1->NULL # # 进阶: # 你可以迭代或递归地反转链表。你能否用两种方法解决这道题? # Related Topics 链表 # leetcode submit region begin(Prohibit modification and deletion) # Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next ...
#!/usr/bin/env python # -*- coding: utf-8 -*- owner_users = {'email': 'slam_ua@mail.ru', 'password': 'qwe123qwe'} provider_users = {'nik.urgant@mail.ru': 'qwe123qwe', 'maks.sotnikov.62@mail.ru': 'qwe123qwe', 'provider123@i.ua': 'provider-123', 'prov...
course_config = { "type": "object", "patternProperties": {"": {"type": "array", "items": {"type": "string"}}}, } grading_stage = { "type": ["object", "null"], "properties": { "image": {"type": "string"}, "env": {"type": "object"}, "entrypoint": {"type": "array", "items": {"type"...
""" This package contains the DirectGui system, a set of classes responsible for drawing graphical widgets to the 2-D scene graph. It is based on the lower-level PGui system, which is implemented in C++. For convenience, all of the DirectGui widgets may be imported from a single module as follows:: from direct.gu...
############################################################################## # Parte do livro Introdução à Programação com Python # Autor: Nilo Ney Coutinho Menezes # Editora Novatec (c) 2010-2020 # Primeira edição - Novembro/2010 - ISBN 978-85-7522-250-8 # Segunda edição - Junho/2014 - ISBN 978-85-7522-408-3 # Terce...
print() print("000560_02_test01") # What is the output of this code? list = [1, 1, 2, 3, 5, 8, 13] print(list[list[4]]) input() print() print("000560_02_test02") # What does this code do? for i in range(10): if not i % 2 == 0: print(i + 1) input() print() print("000560_02_test03_looping") # How many lines...
""" The main modules in this package are: * vnc_cfg_api_server * gen.resource_common * gen.resource_xsd * vnc_cfg_ifmap * vnc_addr_mgmt * vnc_cfg_types * vnc_cpu_info """
""" Asked by: Dropbox [Medium]. Given the root to a binary search tree, find the second largest node in the tree. """
class Node: def __init__(self, data): self.data = data self.next = None def __str__(self): return self.data class LinkedList: def __init__(self, data=None): self._head = Node(data) self._size = 1 if data else 0 def __len__(self): return self._size ...
#[STEPIK] # Программирование на Python https://stepik.org/67 # 03_02_07 Словари ''' Имеется реализованная функция f(x), принимающая на вход целое число x, которая вычисляет некоторое целочисленое значение и возвращает его в качестве результата работы. Функция вычисляется достаточно долго, ничего не выводит на экран, ...
#!/usr/bin/env python3 #coding: utf-8 """ 1. Используя множественное наследование переопределите метод базового класса 2. Как можно вызвать переопределнный метод базового класса """ class Base(): def run(self): print ('Base: I can run' ) class Mixin1(): def run(self): print ("Mixin:I can f...
# Non-overlapping Intervals ''' Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping. Example 1: Input: [[1,2],[2,3],[3,4],[1,3]] Output: 1 Explanation: [1,3] can be removed and the rest of intervals are non-overlapping. Example 2...
""" Sudoku Solver URL: https://www.codewars.com/kata/sudoku-solver/python Write a function that will solve a 9x9 Sudoku puzzle. The function will take one argument consisting of the 2D puzzle array, with the value 0 representing an unknown square. The Sudokus tested against your function will be "easy" (i.e. det...
# ----------------------------------------------------------------------------- # Name: arc.py # Purpose: Object for storing the syntactic unit of an arc # # Author: Robert Snarrenberg # Copyright: (c) 2022 by Robert Snarrenberg # License: BSD, see license.txt # ------------------------------...
class Tag(): @property def title(self) -> str: return self._title @title.setter def title(self, value: str): if not isinstance(value, str): raise TypeError("value must be a string") self._title = value
name = input("Enter file:") if len(name) < 1 : name = "mbox-short.txt" handle = open(name) counts = dict() for line in handle: line = line.rstrip() if not line.startswith('From ') : continue line2 = line.split() line3 = line2[5] line4 = line3.split(':') counts[line4[0]] = counts.get(line4[0], 0)...
def quicksort(array): if len(array) < 2: return array else: pivot = array[0] # best to choose a random element as the pivot less = [i for i in array[1:] if i <= pivot] greater = [i for i in array[1:] if i > pivot] return quicksort(less) + [pivot] + quicksort(greater) def...
""" Implementation of the public HTTP APIs related to locating a user based on provided data. """
def remove_duplicated(uris): temp = [] result = [] for uri in uris: if uri not in temp: result.append(uri) temp.append(uri) return result uris = ['1234', '2222', '2222', '1234', '323232', '1234', '1234', 'dfddf', 'dfddf', '2222', '2323'] uris = remove_duplicated(uris) print(...
"""Package for db repository. """ class Repository(object): """Abstract repository class. """ def fingerprint_count(self): pass def property_count(self, property_name, property_value): pass def save_fingerprint(self, fingerprint): pass def identical...
class StateFieldRegistry: def __init__(self): self.fields = {} """ Set a single value in the SFR. """ def set(self, key: str, value): self.fields[key] = value """ Returns None if [key] is not in SFR """ def get(self, key: str): return self.fields.get(key) """ SFR as ...
'''THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OT...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Feb 18 12:00:00 2020 @author: divyanshvinayak """ for _ in range(int(input())): N, P = map(int, input().split()) D = list(map(int, input().split())) L = [0] * N F = 1 for I in range(N - 1, -1, -1): if P % D[I] ...
class TokenMetaClass(type): @classmethod def __prepare__(metaCls, name, bases): cls = super().__prepare__(metaCls, name, bases) cls["__slots__"] = () return cls def __contains__(self, item: "Token") -> bool: return self is type(item) class Token(metaclass=TokenMetaClass):...
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def addTwoNumbers(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ c=0 ...
# Description: 给定一个字符串 (s) 和一个字符模式 (p)。实现支持 '.' 和 '*' 的正则表达式匹配。 # # '.' 匹配任意单个字符。 # '*' 匹配零个或多个前面的元素。 # 匹配应该覆盖整个字符串 (s) ,而不是部分字符串。 # 说明: # 1. s 可能为空,且只包含从 a-z 的小写字母。 # 2. p 可能为空,且只包含从 a-z 的小写字母,以及字符 . 和 *。 # 注意空...
# -*- coding: utf-8 -*- class TemperatureConversionClass(object): def __init__(self , Choice): self.Choice = Choice while True: Degree = int(input('Enter the value to convert : ')) if self.Choice == 'CF': print('{} F' , self.celsius_to_fahrenheit(Degr...
VERSION_MAJOR = "0" VERSION_MINOR = "5" VERSION_TINY = "0" VERSION = "%s.%s.%s" % (VERSION_MAJOR, VERSION_MINOR, VERSION_TINY)
for i in range(1,100): if i % 15 == 0: print("FizzBuzz,", end=' ') elif i%3==0: print("Fizz,", end=" ") elif i%5==0: print("Buzz,",end=' ') else: print(i,",",end=" ") print(100)
# You are given a map of a server center, represented as a m * n integer matrix grid, # where 1 means that on that cell there is a server and 0 means that it is no server. # Two servers are said to communicate if they are on the same row or on the same column. # Return the number of servers that communicate with any ...
# Faça um programa que pergunte a quantidade de Km percorridos por um carro alugado # e a quantidade de dias pelos quais ele foi alugado. Calcule o preço a pagar, # sabendo que o carro custa R$:60 por dia e R$:0,15 por Km rodado. km = float(input("Quantos KM rodados?")) dias = float(input("Quantos dias de aluguel?"))...
'''https://practice.geeksforgeeks.org/problems/first-and-last-occurrences-of-x3116/1 First and last occurrences of x Basic Accuracy: 53.04% Submissions: 41057 Points: 1 Given a sorted array arr containing n elements with possibly duplicate elements, the task is to find indexes of first and last occurrences of an eleme...
''' Created on Aug 29, 2015 @author: kevinchien ''' CACHED_PREFIX_USER = 'user' CACHED_PREFIX_AUTH = 'auth' CACHED_PREFIX_PROFILE = 'profile' CACHED_PREFIX_SERVC = 'servc'
# # PySNMP MIB module VIDEOFRAME-SIGMON-VM0010-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/VIDEOFRAME-SIGMON-VM0010-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:34:26 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python vers...
""" https://leetcode.com/problems/maximum-subarray/ """ class Solution(object): def maxSubArray(self, nums): """ :type nums: List[int] :rtype: int """ if len(nums) == 1: return nums[0] sum = nums[0] current_max = nums[0] for index in rang...
input_file = 'input.txt' def process_input(): with open(input_file) as f: content = f.readlines() # stripping whitespace stripped = [x.strip() for x in content] return stripped def line_set_op(elements, op): # for each 'group' (separated by double whitespace), # creates a character set for each lin...
class CyclesVisibilitySettings: camera = None diffuse = None glossy = None scatter = None shadow = None transmission = None
#! python3 print("Task 9.1") class Restaurant(): """Class about opening restaurant""" def __init__(self, restaurant_name, cuisine_type): self.restaurant_name = restaurant_name.title() self.cuisine_type = cuisine_type.title() def describe_restaurant(self): print(f'My restaurant is ...
#!/usr/bin/env python3 with open('day23-input.txt') as f: day23_input_lines = f.read().split("\n") def parse_instructions(lines): return [line.replace(",", "").split() for line in lines] def run_instructions(instructions, registers): addr = 0 while addr < len(instructions): line = instructi...
#转义字符 print('hello\nworld') #换行 print('hello\tworld') #空格 print('hello\bworld') #退一格 print('hello\rworl') #重头输入,覆盖前文 print('http:\\\\baidu.com') print('\'大家好\'') print(r'hello\nworld') #原字符r/R,不希望转义字符起作用,而是输出本来意思 #注意,最后结尾不能是\ print(r'hello\nworld\\') n1=90 print(n1,type(n1)) ## n2=1.1 n3=2.2 print(...
""" Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area. Example: Input: [ ["1","0","1","0","0"], ["1","0","1","1","1"], ["1","1","1","1","1"], ["1","0","0","1","0"] ] Output: 6 """ # 2018-6-27 # Maximal Rectangel # Build on the last question ...
# -*- encoding: utf-8 -*- """ @File Name : python_class_test.py @Create Time : 2022/2/21 11:50 @Description : @Version : @License : MIT @Author : diklios @Contact Email : diklios5768@gmail.com @Github : https://github.com/diklios5768 @Blog : @...
''' 01 - Counting missing rows with left join The Movie Database is supported by volunteers going out into the world, collecting data, and entering it into the database. This includes financial data, such as movie budget and revenue. If you wanted to know which movies are still missing data, you could use a lef...
"A file to test providers not defined in the same file." DepProviderInfo = provider( doc = "This provider does something.", )
prefix = "++" # The bot's prefix; default is ++, can be changed token = "" # The bot's token, create an application at discord.com/developers osu_key = "" # osu! API key, create one at osu.ppy.sh/p/api
""" 66. Plus One Easy 2313 3185 Add to List Share Given a non-empty array of decimal digits representing a non-negative integer, increment one to the integer. The digits are stored such that the most significant digit is at the head of the list, and each element in the array contains a single digit. You may assum...
# coding=utf-8 # created by Ge Zhang @ Mar 25, 2020 # filters for graph(code snippets) KEY_LIBS = ['statsmodels', 'gensim', 'keras', 'sklearn', 'xgboost', 'scipy', 'pandas'] def key_lib(graph): funcs = graph['funcs'] heads = [f.split('.')[0] for f in funcs] if any([h in KEY_LIBS for h in head...
# -*- coding: utf-8 -*- # # Copyright (C) 2017 Hewlett Packard Enterprise Development LP # # 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 # # U...
"""Custom exception class for handling extra arguments.""" class SAMLAuthError(Exception): extra = None def __init__(self, msg, extra=None): self.message = msg self.extra = extra
class Config: URLS = [ 'https://learning.oreilly.com/videos/ios-augmented-reality/9781788479332', 'https://learning.oreilly.com/videos/the-complete-arkit/9781789958775', 'https://learning.oreilly.com/videos/ios-12-and/100000006A0477/', ] DOMAIN = '' OUTPUT_FOLDER = './Downloa...
soma = 0 contar = 0 for j in range(1, 7): n = int(input('digite um número ')) soma += n contar += 1 print('pelos {} números que você falou a soma vai dar {}'.format(contar, soma)) #tia esse eu só entendi depois do Guanabra fazer mas entendi de vez agora :)
# ---------------------------------- MANIPULANDO CADEIAS DE CARACTERES ---------------------------------- # FATIAMENTO # ANÁLISE # ******* FUNÇÕES DE TRANSFORMAÇÕES #fase.strip() -> Utilizada para remover espaços inúteis no começo ou fim da frase #fase.rstrip() -> Remove somente espaços inúteis no fim da frase #fas...
# # PySNMP MIB module SDLC-OPT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SDLC-OPT-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:01:34 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,...
class Email(): # Simple object to hold email data def __init__(self): self.sender_name = "" self.sender_email = "" self.receiver_name = "" self.receiver_email = "" self.date = "" self.time = "" self.datetime_hotmail_format = "" self.subject = "...
BUFFER_SIZE = 1 << 10 def get_str(bytes): try: return bytes.decode() except: return bytes def read_all(stream): stream.seek(0) parts = [] while True: part = stream.read(BUFFER_SIZE) if not part: break parts.append(part) ...
def bubbleSort(nlist): for passnum in range(len(nlist)-1,0,-1): for i in range(passnum): if nlist[i]>nlist[i+1]: temp = nlist[i] nlist[i] = nlist[i+1] nlist[i+1] = temp nlist = [int(x) for x in input("Enter element to sort: ").split()] bubbleSort(...
def serialize_sqla(data, serialize_date=True): """ Serialiation function to serialize any dicts or lists. This is needed for conversion of sqlalchemy objects to JSON format. """ # If has to_dict this is asumed working and it is used if hasattr(data, 'to_dict'): return data.to_dict(seria...
class Solution: def shuffle(self, nums: List[int], n: int) -> List[int]: nums[::2], nums[1::2] = nums[:n], nums[n:] return nums
""" Validate the given sudoku solution. https://www.codewars.com/kata/sudoku-solution-validator/python """ def validSolution(board): """Check if the given board is a valid sudoku solution. Expects an input as a list of rows.""" # Create sets with expected values rows = [set(range(1, 10)) for _ in range(0,...
__author__ = 'Shane' class CSSFile: def __init__(self, src): self.src = src self.classes = [] def addClass(self, cssClass): self.classes.append(cssClass) def render(self): fileString = "" for each in self.classes: fileString += each.render() + "\n" return fileString
# 22002 | Sandwich for Breakfast (Evan intro) sm.setSpeakerID(1013101) sm.sendNext("Did you feed Bulldog? You should have some breakfast now then, Evan. Today's breakfast is Handmade Sandwich. I've brought it with me. Hee hee. I was going to eat it myself if you didn't agree to feed Bulldog") if sm.sendAskYesNo("Here...
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright 2020 Colton Hughes <colton.hughes@firemon.com> # 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 limi...
# # PySNMP MIB module TRAPEZE-NETWORKS-TRAP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TRAPEZE-NETWORKS-TRAP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:20:06 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3....
class IngestorException(Exception): pass class ConfigurationException(IngestorException): "Errors in the configuration of the ingestors (e.g. missing settings)." pass class SystemException(IngestorException): "Errors caused by external failures (e.g. missing external dependencies)." pass cla...
name = input("Give me your name: ") print("Your name is " + name) age = int(input("Enter your age: ")) print("Your age is " + str(age))
# -*- coding: utf-8 -*- """ Module to collect useful functions for economic calculations. """ def epc(capex, n, u, wacc, cost_decrease = 0, oc = 0): """ function represents equivalent periodical costs of an economic activity parameters ---------- capex: float capital expenditure for first...
""" link: https://leetcode.com/problems/binary-tree-paths problem: 输出树所有根到叶子的路径 solution: DFS遍历 """ # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def binaryTreePaths(self, root: T...
#CONDITIONALS x = 4 #BASIC IF if x < 6 : print(f'{x} is less than 6') #IF ELSE if x < 6: print('This is true') else: print('This is false') #ELSE IF color = 'red' if color == 'red': print('Color is red') elif color == 'blue': print('Color is blue') else: print('Color is not red or blue') #NESTE...
#You do not put quotes around a number unless it is in a piece of text... #To turn a number in string form into an integer... #Make use of the int() function... #To do vice versa the str() function is used... #There are different symbols of operation... #But take notice of the "%" symbol and the "**" symbol #Th...
inputString = "Hello World" l = len(inputString) newString = "" # looping through the string for i in range(0, len(inputString)): if l < 2: break else: if i in (0, 1, l-2, l-1): newString = newString + inputString[i] else: continue # Printing New String print("Input string : " + inputString) print("Ne...
class Solution: def twoSum(self, nums, target): count = 0 for num in nums: for idx in range(len(nums)): if idx != count: if nums[idx] + num == target: if idx < count: return [idx,count] ...