content
stringlengths
7
1.05M
def attritems(class_): def _getitem(self, key): return getattr(self, key) setattr(class_, '__getitem__', _getitem) if getattr(class_, '__setitem__', None): delattr(class_, '__setitem__') if getattr(class_, '__delitem__', None): delattr(class_, '__delitem__') return class_...
""" # Definition for a Node. class Node: def __init__(self, val=None, children=None): self.val = val self.children = children """ class Solution: def postorder(self, root: 'Node') -> List[int]: if not root: return [] result, q = [], [root] while q: node = ...
BINGO_BOARD_LENGTH = 5 class BingoField: def __init__(self, number): self.number = number self.marked = False class BingoBoard: def __init__(self, numbers: list): self.board = [[], [], [], [], []] self.already_won = False for row_idx, _ in enumerate(numbers): ...
x=input('first number?') y=input('second number?') outcome=int(x)*int(y) print (outcome)
# -*- coding: utf-8 -*- # ##### BEGIN GPL LICENSE BLOCK ##### # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # ...
def validate_extension(filename: str) -> bool: """ Validate file extension :param filename: file name as string :return: True if extension is allowed """ allowed_extensions = {'png', 'jpg', 'jpeg'} return '.' in filename and filename.rsplit('.', 1)[1].lower() in allowed_extensions
my_dict = { "key":"value", "key2":"value2" } # dictに要素[key3:value3]を追加してみよう! my_dict["key3"] = "value3" print(my_dict) # 識別子key2を削除してみよう! my_dict.pop("key2") print(my_dict)
''' Design a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order, not the kth distinct element. Implement KthLargest class: KthLargest(int k, int[] nums) Initializes the object with the integer k and the stream of integers nums. int add(int val) Appends the i...
# Challenge 9 : Write a function named same_values() that takes two lists of numbers of equal size as parameters. # The function should return a list of the indices where the values were equal in lst1 and lst2. # Date : Sun 07 Jun 2020 09:28:38 AM IST def same_values(lst1, lst2): newList = [] ...
def info(a): a = raw_input("type your height here: ") return a
""" Collections: High-performance container Datatypes Tradução: Tipo de dados de container de alta performance Counter: Recebe um iterável como parâmetro e cria um objeto do tipo "Collection Counter" que é parecido com um dicionário, contendo como chave cada elemento da lista passado no parâmetro e como valor, a quant...
class Solution(object): def toHex(self, num): """ :type num: int :rtype: str """ if num == 0: return '0' elif num < 0: num += 2**32 hex_chars, res = '0123456789abcdef', '' while num: res = hex_chars[num % 16] + res ...
def strategy(history, memory): if memory is None: memory = (0, 0) defections = memory[0] count = memory[1] choice = 1 if count > 0: if count < defections: choice = 0 count += 1 elif count == defections: count += 1 elif count > defections: count = 0 elif history.shape[1] >= 1 an...
def get_2(digits, one, seven, four): for digit in digits: if len(digit - one - seven - four) == 2: return digit assert False, f"2 cannot be calculated from {digits=} using {one=}, {seven=} and {four=}" def get_3(digits, two): for digit in digits: if len(digit - two) == 1: ...
# Firstly, get the flatfile from the user. def getFile(): file_path = input("Input the path to the flat file: ") try: keypath = open(file_path, "r") return keypath except: print("No file found there.") # Secondly, iterate through the file and update a state dictionary containing str...
def linear_service_fee(principal, fee=0.0): """Calculate service fee proportional to the principal. If :math:`S` is the principal and :math:`g` is the fee aliquot, then the fee is given by :math:`gS`. """ return float(principal * fee)
#!/usr/bin/env python """ generated source for module Event """ # package: org.ggp.base.util.observer class Event(object): """ generated source for class Event """
# # @lc app=leetcode id=83 lang=python3 # # [83] Remove Duplicates from Sorted List # # https://leetcode.com/problems/remove-duplicates-from-sorted-list/description/ # # algorithms # Easy (41.95%) # Likes: 774 # Dislikes: 82 # Total Accepted: 333.1K # Total Submissions: 779.9K # Testcase Example: '[...
i = 0 s = 0 m = 0 while True: print('-' * 24) print('{:^24}'.format('CADASTRE UMA PESSOA')) print('-' * 24) nome = str(input('Nome: ')) idade = int(input('Idade: ')) if idade > 18: i += 1 sexo = str(input('Sexo [M/F]: ')).upper().strip()[0] if sexo == 'M': s += 1 if i...
#!/usr/bin/env python3 # Write a program that prints the numbers from 1 to 100 # For multiples of 3 print “Fizz” instead of the number # For the multiples of 5 print “Buzz” # For numbers which are multiples of both 3 and 5 print “FizzBuzz”. for a in range(1, 101): b = 3 c = 5 t = a % b f = a % c if t == 0 and ...
def high_and_low(numbers): numbers = list((max(map(int,numbers.split())),min(map(int,numbers.split())))) return ' '.join(map(str,numbers)) def high_and_lowB(numbers): nn = [int(s) for s in numbers.split(" ")] return "%i %i" % (max(nn),min(nn))
""" Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water. Example 1: Input: 11110 11010 11000 00000 Output: 1 Exam...
grid = [['.', '.', '.', '.', '.', '.'], ['.', 'O', 'O', '.', '.', '.'], ['O', 'O', 'O', 'O', '.', '.'], ['O', 'O', 'O', 'O', 'O', '.'], ['.', 'O', 'O', 'O', 'O', 'O'], ['O', 'O', 'O', 'O', 'O', '.'], ['O', 'O', 'O', 'O', '.', '.'], ['.', 'O', 'O', '.', '.', '.'], ...
#coding=utf-8 #coding=utf-8 ''' Created on 2017年4月26日 @author: ethan ''' class VM_TaskParameterGroup(object): ''' classdocs ''' def __init__(self,dm_task_parameter_group): ''' Constructor ''' self.parameter_group=dm_task_parameter_group @property def...
# TYPES = [('int', 'INT'), ('varchar', 'VARCHAR'), ('boolean', 'BOOLEAN'), ('json', 'JSON'), ('timestamp', 'TIMESTAMP'), ('enum', 'ENUM')] class UnknownType(Exception): pass class NotImplementeD(Exception): pass class SQLTypes(object): __slots__ = ['_type',...
t = int(input()) for i in range(t): b,c=map(int,input().split()) ans = (2*b-c-1)//2 print(2*ans)
def moveZeroes(nums): lastNonZero = 0 for i in range(len(nums)): if nums[i] != 0: nums[lastNonZero], nums[i] = nums[i], nums[lastNonZero] lastNonZero += 1 nums = [0, 1, 0, 3, 12] moveZeroes(nums) print(nums) # [1, 3, 12, 0, 0] nums = [4, 2, 4, 0, 0, 3, 0, 5, 1, 0] moveZeroes(nu...
def move(n, a, b, c): if n == 1: print(str(a) + " " + str(c)) else: move(n - 1, a, c, b) print(str(a) + " " + str(c)) move(n - 1, b, a, c) def Num11729(): n = int(input()) print(2 ** n -1) move(n, 1, 2, 3) Num11729()
def get_synset(path='../data/imagenet_synset_words.txt'): with open(path, 'r') as f: # Strip off the first word (until space, maxsplit=1), then synset is remainder return [ line.strip().split(' ', 1)[1] for line in f]
""" Cloudless Package Information """ __title__ = 'cloudless' __description__ = 'The cloudless infrastructure project.' __url__ = 'https://github.com/sverch/cloudless' __version__ = '0.0.5' __author__ = 'Shaun Verch' __author_email__ = 'shaun@getcloudless.com' __license__ = 'Apache 2.0' __copyright__ = 'Copyright 2018 ...
""" [2015-12-16] Challenge #245 [Intermediate] Ggggggg gggg Ggggg-ggggg! https://www.reddit.com/r/dailyprogrammer/comments/3x3hqa/20151216_challenge_245_intermediate_ggggggg_gggg/ We have discovered a new species of aliens! They look like [this](https://www.redditstatic.com/about/assets/reddit-alien.png) and are tryi...
class Deque: def __init__(self): self.deque =[] def addFront(self,element): self.deque.append(element) print("After adding from front the deque value is : ", self.deque) def addRear(self,element): self.deque.insert(0,element) print("After adding from end t...
# (C) Datadog, Inc. 2021-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) class Metric(object): """ Metric object contains: - the metric sub prefix, - metrics mapping (response JSON key to metric name and metric type) - tags mapping (response JS...
things = [ 'An old Box', 'Ancient Knife', 'Oppenheimer Blue Diamond', '1962 Ferrari 250 GTO Berlinetta', 'Hindoostan Antique Map 1826', 'Rare 19th C. Mughal Indian ZANGHAL Axe with Strong', '1850 $5 Baldwin Gold Half Eagle UNCIRCULATED', 'Chevrolet Corvette 1963' ]
x,y=0,0 for i in range(5): b=input("").split() for j in range(5): if(b[j]=='1'): x=i+1 y=j+1 x=x-3; y=y-3; if(x<0): x=-x if(y<0): y=-y print(x+y) a=[[],[],[]] b=len(a[1])//2 a[b][b],a[i][j]=a[i][j],a[b][b] a=tan(3.33)
class Salary: def __init__(self, pay): self._pay = pay def get_total(self): return (self._pay * 12) // 4.9545 class SalarySenior: def __init__(self, pay): self._pay = pay def get_total(self): return (self._pay * 24) // 4.9545 class Employee: def __init__(self, p...
changes = {'.': 0, ',': 1, '+': 2, '-': 3, '>':4, '<': 5, '[': 6, ']': 7} def convert(code): current = 0 x = "" for i in code: dest = changes.get(i) if dest is None: continue diff = (dest - current) % 8 x += "+" * diff + "!" current = dest print(cu...
# Esta función carga en un diccionario los usuarios de prueba def cargar_personas_predeterminadas(datos_usuarios): if "agustinaf19" not in datos_usuarios: # Cargo persona de prueba 1 datos_usuarios["agustinaf19"] = {"Nombre": "Agustina", "Apellido": "Fernande...
{'application':{'type':'Application', 'name':'webgrabber', 'backgrounds': [ {'type':'Background', 'name':'bgGrabber', 'title':'webgrabber PythonCard Application', 'size':(540, 172), 'statusBar':1, 'menubar': {'type':'MenuBar', 'menus': [ ...
# ------------------------------------------------------------------------------------ # Tutorial: The replace method replaces a specified string with another specified string. # ------------------------------------------------------------------------------------ # Example 1. # Replace all occurences of "dog" with "ca...
is_day = False lights_on = not is_day print("Daytime?") print(is_day) print("Lights on?") print(lights_on)
def insertionSort(arr): output = arr[:] #go through each element for index in range(1, len(output)): #grab current element current = output[index] #get last index of sorted output j = index #shift up all sorted elements that are greater than current one whi...
"""Namespace of all tag system in tvm Each operator can be tagged by a tag, which indicate its type. Generic categories - tag.ELEMWISE="elemwise": Elementwise operator, for example :code:`out[i, j] = input[i, j]` - tag.BROADCAST="broadcast": Broadcasting operator, can always map output axis to the input in or...
SCHEMA_URL = "https://raw.githubusercontent.com/vz-risk/veris/master/verisc-merged.json" VARIETY_AMT_ENUMS = ['asset.assets', 'attribute.confidentiality.data', 'impact.loss'] VARIETY_AMT = ['variety', 'amount'] ASSETMAP = {'S ' : 'Server', 'N ' : 'Network', 'U ' : 'User Dev', 'M ' : 'Media', 'P ' : 'Person'...
N = int(input()) ans = min(9, N) + max(0, min(999, N) - 99) + max(0, min(99999, N) - 9999) print(ans)
__author__ = 'vlosing' class BaseClassifier(object): """ Base class for classifier. """ def __init__(self): pass def fit(self, samples, labels, epochs): raise NotImplementedError() def partial_fit(self, samples, labels, classes): raise NotImplementedError() def alt...
''' done ''' def Jumlah(a, b): return a + b print(Jumlah(2, 8))
ValorCasa = float(input('Qual o valor da casa ?')) Salario = float(input('Qual o seu Salário ? ')) AnosPagar = int(input('Quantos anos pretende pagar ?')) print('Analisando seu pedido de mepréstimo') x = (0.3*(Salario)) y = (ValorCasa)/(AnosPagar*12) if y <= x: print('Empréstimo aprovoado') else: print('Empr...
# thomas (Desnord) # objetivo: realizar operações com uma lista de RAs # imprimir,ordenar crescente,ordenar decrescente, # realizar busca binaria, remover valor, adicionar valor. #A entrada consiste de: uma lista com n inteiros (RA de cada aluno) #e uma lista de operações a serem realizadas finalizada pelo caractere ...
# flake8: noqa RAW_DATA = { "album": { "album_type": "album", "artists": [ { "external_urls": { "spotify": "https://open.spotify.com/artist/3agVasaCG20vNRxAE8niec" }, "href": "https://api.spotify.com/v1/artists/3agVasaC...
greetings = ["hello", "world", "Jenn"] for greeting in greetings: print(f"{greeting}, World") def add_number(x, y): return x + y add_number(1, 2) things_to_do = ["pickup meds", "shower", "change bandage", "python", "brush Baby and pack dogs", "Whole Foods", "Jocelyn"]
class Solution: #Function to convert a binary tree into its mirror tree. def mirror(self,root): # Code here if(root == None): return else: self.mirror(root.left) self.mirror(root.right) root.left, root.right = root.right, root....
class InvalidTableIdException(Exception): """ Indicate that the table id was not 0xFC as required """ pass class ReservedBitsException(Exception): """ Indicate that bits reserved by the specification were not set to 1 as required """ pass class SectionParsingErrorException(Exception)...
## robot_servant.py ## This code implements a search space model for a robot ## that can move around a house and pick up and put down ## objects. ## The function calls provided for a general search algorithm are: ## robot_print_problem_info() ## robot_initial_state ## robot_possible_actions(state) ## robot_successor...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # 有理数的四则运算 class Rational: def __init__(self, p, q): self.p = p self.q = q self.gys = Rational.gcb(p, q) @classmethod def gcb(cls, a, b): while b: a, b = b, a % b return a def __str__(self): ...
# -*- coding: utf-8 -*- # # Copyright (C) 2019 CERN. # # Invenio-Files-Transformer is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see LICENSE file for more # details. """Invenio module for transforming and/or processing files.""" # TODO: This is an example file. Remov...
# [Root Abyss] The World Girl MYSTERIOUS_GIRL = 1064001 # npc Id sm.removeEscapeButton() sm.lockInGameUI(True) sm.setPlayerAsSpeaker() sm.sendNext("If you're really the World Tree, can't you just like... magic yourself outta here?") sm.setSpeakerID(MYSTERIOUS_GIRL) sm.sendNext("No! Those bad people did this to me!") ...
def extractWatermelons(item): """ # World of Watermelons """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or 'preview' in item['title'].lower(): return None matches = re.search('\\bB(\\d+)C(\\d+)\\b', item['title']) if 'The Desolate Era' in item['tags'] and mat...
#!usr/bin/python # -*- coding:utf8 -*- class MyException(Exception): pass try: raise MyException('my exception') # exception MyException as e: except Exception as e: print(e)
# Author: Kay Hartmann <kg.hartma@gmail.com> def weight_filler(m): classname = m.__class__.__name__ if classname.find('MultiConv') != -1: for conv in m.convs: conv.weight.data.normal_(0.0, 1.) if conv.bias is not None: conv.bias.data.fill_(0.) elif classname...
# Copyright (c) 2021 Arm Limited. # # SPDX-License-Identifier: MIT # # 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, cop...
class Solution: def orderOfLargestPlusSign(self, N: int, mines: List[List[int]]) -> int: """DP. Running time: O(N*N). """ mines = set(tuple(mine) for mine in mines) counts = [[0] * N for i in range(N)] res = 0 for i in range(N): ...
class Figura(): def __init__(self, figura): self.__figura = figura def area(self): return self.__figura.area() def perimetro(self): return self.__figura.perimetro()
### ### NOTICE: this file did not exit in the original Dimorphite_DL release. ### The is newly created based on "sites_substructures.smarts" file ### - made a readable Python module from it. Andrey Frolov, 2020-09-15 ### - added last column with acid-base classification. Andrey Frolov, 2020-09-11 ### - added TATA sub...
""" Modification of existing parameters in this file is NOT encouraged. """ Sct_Cen = {'B-begin': 0, 'B-end': 430, 'R-kink': 4.91, 'B-kink': 67, 'psi-before': -12.5, 'psi-between': -15, 'psi-after': -11.7, 'l-tangency': 145, 'w-kink': 0.23} Norma = {'B-begin': 30, 'B-end': 481, 'R-kink': 4.46, '...
n=int(input("enter a number")) if(n%5==0 or n%7==0): print("divisible by 5 or 7") else: print("not divisible")
""" ssh-keygen -t ecdsa -b 521 ssh-keygen -t ecdsa -b 521 -f /home/.ssh/myprivatekey #specify output location #sur le serveur distant vim /home/user/.ssh/authorized_keys ou ssh-copy-id -i /home/.ssh/myprivatekey user@remotehost remarque: on peut rajouter dans les fichiers from="10.0.0.2" #utilisation de la cle ssh ...
# # PySNMP MIB module HM2-DHCPS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HM2-DHCPS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:18: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 201...
# # PySNMP MIB module HUAWEI-UNIMNG-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-UNIMNG-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:49:14 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
"""A wrapper class for optimizer""" class TransformerOptimizer(object): """A simple wrapper class for learning rate scheduling""" def __init__(self, optimizer, k, d_model, warmup_steps=4000, step_num=0): self.optimizer = optimizer self.k = k self.init_lr = d_model ** (-0.5) se...
class Node: def __init__(self, data): self.data = data self.next = None self.prev = None class DoublyLinkedList: def __init__(self, head=None): self.head = head self.length = 1 def append(self, element): """ Adds the `element` at the end of the Link...
# -*- coding: utf-8 -*- # Copyright 2021 Cohesity Inc. class CombineMethodEnum(object): """Implementation of the 'CombineMethod' enum. Specifies how to combine the children of this node. The combining strategy for child devices. Some of these strategies imply constraint on the number of child devices...
i = 0 숫자들 = [] while i < 6: print(f"꼭대기에서 i는 {i}") 숫자들.append(i) i = i + 1 print("숫자는 이제: ", 숫자들) print(f"바닥에서 i는 {i}") print("숫자: ") for 숫자 in 숫자들: print(숫자)
''' NAME Program that calculates the percentage of a list of amino acids. VERSION [1.0] AUTHOR Rodrigo Daniel Hernandez Barrera <<rodrigoh@lcg.unam.mx>> DESCRIPTION This program takes a sequence of amino acids from a protein and a list of amino acids, looks for these in the sequen...
#Gary Cunningham. 27/03/19 #My program intends to convert the string inputted by removing every second word on the output. #Adaptation from python tutorials, class content and w3schools.com interactive tutorials. #Attempted this solution alongside the inputs from the learnings of previous solutions in this problem set....
distance = int(input('Inform the distance: ')) if distance <= 200: price = distance * 0.5 else: price = distance * 0.45 print('Your trip cost \033[1;33;44mR$ {:.2f}\033[m.'.format(price))
#!/usr/bin/env python imagedir = parent + "/oiio-images" command += oiiotool (imagedir+"/grid.tif --scanline -o grid.iff") command += diff_command (imagedir+"/grid.tif", "grid.iff")
"""Helper functions.""" # Given a number, finds the next number that meets # criteria 4 (digits never decrease). # # Returns that number and whether or not the new # number meets criteria 3 (two adjacent digits are the same) def part1_inc(n): digits = list(str(n + 1)) will_succeed = False for i in range(1, len(...
class Sang: def __init__(self, tittel, artist): self._tittel = tittel self._artist = artist def spill(self): print('\t Spiller av', self._tittel, 'av', self._artist) def sjekkArtist(self, navn): liste = navn.split() for i in liste: if i in self._artist: ...
""" hopeit.engine CLI (Command Line Interface) module provides implementation for the following CLI commands: * **openapi** (hopeit_openapi): creation, diff and update openapi.json spec files * **server** (hopeit_server): tool for running a server instance """
def searchInsert(nums, target): if target in nums: return nums.index(target) elif target <= nums[0]: return 0 elif target >= nums[-1]: return len(nums) else: for idx, val in enumerate(nums): if target < val: nums.index(idx, target) ...
# __init__.py """ Docstring TBD """
class Solution(object): def numIslands(self, grid): """ :type grid: List[List[str]] :rtype: int """ # edge case if not(grid): return 0 cnt = 0 n = len(grid) if n == 0: return 0 m = len(grid[0]) for i in range(n): ...
l = [6,2,5,5,4,5,6,3,7,6] for _ in range(int(input())): a,b = map(int,input().split()) ans = a + b val = 0 for i in str(ans): val += l[int(i)] print(val)
def measure(bucket1, bucket2, goal, start_bucket): if start_bucket == "one": liter1 = bucket1 liter2 = 0 elif start_bucket == "two": liter1 = 0 liter2 = bucket2 return bfs(bucket1, bucket2, liter1, liter2, goal, start_bucket) def bfs(bucket1, bucket2, liter1, liter2, goal,...
def problem039(): """ If p is the perimeter of a right angle triangle with integral length sides, {a,b,c}, there are exactly three solutions for p = 120. {20,48,52}, {24,45,51}, {30,40,50} For which value of p ≤ 1000, is the number of solutions maximised? """ ans = max(range(1,...
class SymbolManager: def __init__(self): self.symbol_dic = {} def add_symbol(self, symbol): if symbol is None: return self.symbol_dic[symbol.symbol_code] = symbol def find_symbol(self, symbol_code): for symbol in self.symbol_dic.items(): if symbol[1...
x=0 y=-1 s=0 cont=True while cont == True: x = input("Introduce numeros y usa el 0 para indicar que no añades mas numeros:") a = float(x) cont=bool(a) s = s + a y=y+1 cont=False print(f"la suma de los números añadidos es {s}") prom = s / y print(f"el promedio de los números añadidos es {prom}")
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: Pieter Huycke email: pieter.huycke@ugent.be GitHub: phuycke """ #%% numbers = [] # collect the 3 numbers for i in range(3): number = input("Please provide a number: ") while True: try: number = int(number) number...
# Constants for the Lines and Boxes game WINDOW_WIDTH = 800 WINDOW_HEIGHT = 450 WHITE = (255, 255, 255) BLACK = (0, 0, 0) GRAY = (220, 220, 220) FRAMES_PER_SECOND = 40 NROWS = 5 NCOLS = 5 NSQUARES = NROWS * NCOLS SPACING = 43 NLINES = 60 EMPTY = 'empty' HUMAN = 'human' COMPUTER = 'computer' STARTING_X = 72 STARTI...
class LinkedList: """ We represent a Linked List using Linked List class having states and behaviours states of SLL includes- self.head as an instance variable. Behaviour of LL class will include any behaviours that we implement on a Singly list list. Whenever a LL instance is initialized ...
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def insert_node(root, value): if root.data: if value < root.data: if root.left is None: root.left = Node(value) else: insert_node(ro...
# # PySNMP MIB module A3COM-SWITCHING-SYSTEMS-ROUTEPOLICY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM-SWITCHING-SYSTEMS-ROUTEPOLICY-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:08:29 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwan...
def leiaInt(mgn): print('-' * 30) while True: n = str(input(mgn)) if n.isnumeric(): return n break else: print('\033[31mErro! Digite um número inteiro válido.\033[m') n = leiaInt('Digite um número: ') print(f'Você acabou de digitar o número {n}')
class HttpQueryError(Exception): def __init__(self, status_code, message=None, is_graphql_error=False, headers=None): """Create a HTTP query error. You need to pass the HTTP status code, the message that shall be shown, whether this is a GraphQL error, and the HTTP headers that shall be s...
#Programa para saber la nota nota = int(input("Introduce tu nota: ")) if nota < 5: print("Insuficiente: esfuerzate mas") elif nota < 6: print("Suficiente") elif nota < 7: print("Bien") elif nota < 9: print("Notable") else: print("Sobresaliente: eres un/a crack")
"""Utility for configurable dictionary merges.""" class NoValue(object): """ Placeholder for a no-value type. """ pass # singleton for NoValue no_value = NoValue() def discard(dst, src, key, default): """Does nothing, effectively discarding the merged value.""" return no_value def override(left,...
# -*- coding: utf-8 -*- """Top-level package for PoC DependaBot.""" __author__ = """Ivan Ogasawara""" __email__ = 'ivan.ogasawara@gmail.com' __version__ = '1.0.0'
# Data Types a = 5 print(a, "is of type", type(a)) a = 2.0 print(a, "is of type", type(a)) a = 1+2j print(a, "is complex number?", isinstance(1+2j,complex))
#! /usr/bin/python3 #Note: Binary to Decimal Calculator #Author: Khondakar choice = int(input("[1] Decimal to Binary conversion. " + "\n[2] Binary to Decimal conversion. \nEnter choice: ")) # print("1: Decimal to Binary") # print("2: Binary to Decimal") val = "" if choice == 1: numb = int(input("Enter your whole...