content
stringlengths
7
1.05M
# Cache bitcode CACHE = False # Save object file for module ASM = False # Write LLVM dump to file DUMP = True # Enable AST debugging dump DEBUG = True # Write dump files to same directory as module? # if False, this will write all dumps to one "debug" file in the main dir DUMP_TO_DIR = False
nome = str(input('Qual é o seu nome: ')) if nome == 'Gustavo': print('Seu nome é legal!') else: print('Seu nome é normal!') print('Bom dia, {}!'.format(nome))
""" Batch processing examples - Griatch 2012 """
''' Common settings for using in a project scope ''' MODEL_ZIP_FILE_NAME_ENV_VAR = 'TF_AWS_MODEL_ZIP_FILE_NAME' MODEL_PROTOBUF_FILE_NAME_ENV_VAR = 'TF_AWS_MODEL_PROTOBUF_FILE_NAME' S3_MODEL_BUCKET_NAME_ENV_VAR = 'TF_AWS_S3_MODEL_BUCKET_NAME'
# Vitauts def is_pangram_en(mytext, a=set('abcdefghijklmnopqrstuvwxyz')): return len(set(mytext.lower()).intersection(a)) == 26 def is_pangram_lv(mytext, a='aābcčdeēfgģhiījkķlļmnņoprsštuūvzž'): return len(set(mytext.lower()).intersection(a)) == 33 def main(): print(is_pangram_en('The quick brown fox jum...
expected_output = { 'pid': 'CISCO3945-CHASSIS', 'os': 'ios', 'platform': 'c3900', 'version': '15.0(1)M7', }
class RobertException(Exception): def __init__(self, message: str = None): message = 'An fatal error has occurred' if message is None else message super().__init__(message) class LanguageNotSupported(RobertException): def __init__(self): super().__init__('That language is not supported'...
# TODO: Use these simplified dataclasses once support for Python 3.6 is # dropped. Meanwhile we'll use the "polyfill" classes defined below. # # from dataclasses import dataclass, field # # @dataclass # class Client: # user_id: str # user_type: str = field(default="client", init=False) # # # @dataclass # class ...
def update_dict(old_dict, values): """ Update dictionary without change the original object """ new_dict = old_dict.copy() new_dict.update(values) return new_dict
add = 3+2 print (add) subtract = 3-2 print (subtract) multiply = 3*2 print (multiply) division = 3/2 print (division) modulus = 3%2 print (modulus) lessThan = 3<2 print (lessThan) greaterThan = 3>2 print(greaterThan) equals = 3==3 print (equals) logicalAnd = (2==2) and (3==3) and (4==4) print (logicalAnd) logi...
#!/usr/bin/env python3 #variable delaration names = [] address = [] age = [] institute = [] dept = [] print('------+++++++Welcome to student info software+++++++------\n') names.insert(0, input('Enter your Full name: ')) address.insert(0, input('Enter your Address: ')) age.insert(0, input('Enter your Ag...
def valid_palindrome(str): left, right = 0, len(str) - 1 while left < right: if not str[left].isalnum(): left += 1 elif not str[right].isalnum(): right -= 1 else: if str[left].lower() != str[right].lower(): print('False') ...
{ 4 : { "operator" : "aggregation", "numgroups" : 1000000 } }
def get_numbers_between(set_a, set_b): numbers_between = 0 for candidate in range(1, 101): found = True for item in set_a: if candidate % item: found = False break if not found: continue for item in set_b: if...
""" For each single peak, set a probability distribution over all the possibile assignment. Given a function phi(p,p') = {1/dist(p, p')} / {\sum_s 1/dist(p, s)} definiamo le probabilità in base allo scarto con il valor medio anzichè assegnare il particolare picco tale per cui lo scarto con il valor medio sia minim...
socket_to_sc = {} # 已建立的安全通道列表 # 不一定是登入状态,只是连接 scs = [] def remove_sc_from_socket_mapping(sc): if sc in scs: scs.remove(sc) if sc.socket in socket_to_sc: del socket_to_sc[sc.socket]
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def python_dependencies_early(): http_archive( name = "rules_python", url = "https://github.com/bazelbuild/rules_python/releases/download/0.0.1/rules_python-0.0.1.tar.gz", sha256 = "aa96a691d3a8177f3215b14b0edc9641787abaaa...
# Pow(x, n): https://leetcode.com/problems/powx-n/ # Implement pow(x, n), which calculates x raised to the power n (i.e., xn). # This problem is pretty straight forward we simply iterate over the n times # multiplying the input every time. The only tricky thing is that if we have # a negative number we need to make s...
# User input num1=float(input("Enter the 1st number: ")) num2=float(input("Enter your 2nd number: ")) # Operations the program should perform sum = num1 + num2 difference = num1 - num2 product = num1 * num2 divide = num1 / num2 modulus = num1 % num2 # Computer output print(sum) print(difference) print(product) print(...
def main(): print("Iterative:") print("n=0 ->", fibonacci_iterative(0)) print("n=1 ->", fibonacci_iterative(1)) print("n=6 ->", fibonacci_iterative(6)) print() print("Recursive:") print("n=0 ->", fibonacci_recursive(0)) print("n=1 ->", fibonacci_recursive(1)) print("n=6 ->", fibonacc...
wanted_income = float(input()) total_income = 0 cocktail = input() while cocktail != "Party!": order = int(input()) cocktail_price = len(cocktail) cocktail_price = order * cocktail_price if cocktail_price % 2 != 0: discount = cocktail_price - (cocktail_price * 0.25) total_income +=...
#!/usr/bin/env python3 strings = [ "sszojmmrrkwuftyv", "isaljhemltsdzlum", "fujcyucsrxgatisb", "qiqqlmcgnhzparyg", "oijbmduquhfactbc", "jqzuvtggpdqcekgk", "zwqadogmpjmmxijf", "uilzxjythsqhwndh", "gtssqejjknzkkpvw", "wrggegukhhatygfi", "vhtcgqzerxonhsye", "tedlwzdjfppbmtd...
""" Time Complexity = O(log(N)) Space Complexity = O(1) Implement int sqrt(int x). Compute and return the square root of x, where x is guaranteed to be a non-negative integer. Since the return type is an integer, the decimal digits are truncated and only the integer part of the result is return...
#!/usr/bin/python3.6 """ The following iterative sequence is defined for the set of positive integers: n → n/2 (n is even) n → 3n + 1 (n is odd) Using the rule above and starting with 13, we generate the following sequence: 13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1 """ def collatz(n): lt = [n] wh...
minha_matriz1 = [[1], [2], [3]] minha_matriz2 = [[1, 2, 3], [4, 5, 6]] def imprime_matriz(matriz): for i in matriz: linha = '' for j in i: linha += str(j) print(" ".join(linha), end="") print() # imprime_matriz(minha_matriz1) # imprime_matriz(minha_matriz2)
def get_column(game, col_num): ''' Get the columns ''' col = col_num result = [] for i in range(0, 3): temp = game[i] result.append(temp[col]) return result def print_odd_cubes_to_number(number): ''' Print odds and their cubes ''' if number < 1: print('ER...
class Transformer(object): mappings = {} value_mappings_functions = {} def __init__(self, initial_data): self.initial_data = initial_data def transform_dict(self, obj: dict): result = {} for k, v in obj.items(): if k in self.mappings.keys(): if k in ...
# Main driver file for user input and displaying # Also checks legal moves and keep a move log class GameState(): def __init__(self): # Initial board state # Board is 8x8 2d list with each element having 2 characters # First character represents the color: w = white & b = black # Se...
"""Directives and roles for documenting traitlets config options. :: .. configtrait:: Application.log_datefmt Description goes here. Cross reference like this: :configtrait:`Application.log_datefmt`. """ def setup(app): app.add_object_type('configtrait', 'configtrait', objname='Config option')...
""" Implementation of a vertex, as used in graphs """ ################################################################################ # # # Undirected # # ...
def aumentar(preco,taxa): res = preco * (1 + taxa) return res def diminuir(preco,taxa): res = preco * (1 - taxa) return res def dobro(preco): res = preco * 2 return res def metade(preco): res = preco/2 return res
"""All Lena exceptions are subclasses of :exc:`LenaException` and corresponding Python exceptions (if they exist). """ # pylint: disable=missing-docstring # Most Exceptions here are familiar to Python programmers # and are self-explanatory. class LenaException(Exception): """Base class for all Lena exceptions.""...
def ps(uid='-1',det='default',suffix='default',shift=.5,logplot='off',figure_number=999): ''' function to determine statistic on line profile (assumes either peak or erf-profile)\n calling sequence: uid='-1',det='default',suffix='default',shift=.5)\n det='default' -> get detector from metadata, otherwis...
""" Question 38 : Define a function which can generated a list where the values are square of numbers between 1 and 20 (both included). Then the function need to print the last 5 elements in the list. Hints : Use ** operator to get power of a number. Use range() for loop. Use list.append() to add v...
# Copyright (c) Ville de Montreal. All rights reserved. # Licensed under the MIT license. # See LICENSE file in the project root for full license information. CITYSCAPE_LABELS = [ ('unlabeled', 0, 0, 0, 0), ('ego vehicle', 1, 0, 0, 0), ('rectification border', 2, 0, 0, 0), ('out of roi', 3, 0, 0, 0), ...
email = input() while True: commands = input().split() command = commands[0] if command == "Complete": break if command == "Make": case = commands[1] if case == "Upper": email = email.upper() elif case == "Lower": email = email.lower() pr...
#tuples are immutable like strings eggs = ('hello', 42, 0.5) eggs[0] 'hello' eggs[1:3] (42, 0.5) print(len(eggs)) type(('hello',)) #class 'tuple' type(('hello')) #class 'str' #Converting Types with the list() and tuple() Functions tuple(['cat', 'dog', 5]) #('cat', 'dog', 5) list(('cat', 'dog', 5)) ...
#!/usr/bin/python class Problem7: ''' 10001st prime Problem 7 104743 By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number? ''' def solution(self): primes = [] nextPrime = 2 for i ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Contains all abstract class definitions """ __author__ = 'San Kilkis' class AttrDict(dict): """ Nested Attribute Dictionary A class to convert a nested Dictionary into an object with key-values accessibly using attribute notation (AttrDict.attribute) i...
# -*- coding: utf-8 -*- """ Created on Mon Dec 14 13:29:10 2020 @author: Ham """ def locate(ar, target): lft = 0 rgt = len(ar) - 1 while lft <= rgt: mid = (lft + rgt) // 2 if ar[mid] == target: return mid if target < ar[mid]: rgt = mid - 1 ...
class_ds = \ """A One-Group Light Water Reactor Fuel Cycle Component. This is a daughter class of Reactor1G and a granddaughter of FCComp. Parameters ---------- lib : str, optional The path the the LWR HDF5 data library. This value is set to Reactor1G.libfile and used by Reactor1G.loadlib(). rp : ReactorPa...
class Solution: # Top Down DP (Accepted), O(n^2) time, O(1) space def minimumTotal(self, triangle: List[List[int]]) -> int: for i in range(1, len(triangle)): row = triangle[i] row[0] += triangle[i-1][0] row[-1] += triangle[i-1][-1] for j in range(1, len(ro...
#! /usr/bin/env python #Asking for input until a list of 10 integers given while True: num = input("Enter a list of 10 integers separated by a ',' : ").split(',') l = len(num) try: for i in range(l): num[i] = int(num[i]) p = (l==10) if p: break except: ...
#!/usr/bin/env python3 # Lists # Create a list list_1 = [] # Creates an empty list using parantheses list_2 = list() # Creates an empty list using the list() builtin # Lists can accomodate different/multiple data types list_2 = [1, 2, 3] list_3 = ["a", "b", "c"] list_4 = ["a", "hello", 1, "5"] # Lists can accomod...
class File: def __init__(self, name: str, mode: str): self.file = open(name, mode) def write(self, line: str): self.file.write(line + "\n") def write_dict(self, dict): for key, val in dict.items(): self.write(f"{key}: {val}") def close(self): self.file.clos...
""" There are n people, each of them has a unique ID from 0 to n - 1 and each person of them belongs to exactly one group. Given an integer array groupSizes which indicated that the person with ID = i belongs to a group of groupSize[i] persons. Return an array of the groups where ans[j] contains t...
query_set = [ "SELECT subscriber.s_id, subscriber.sub_nbr, \ subscriber.bit_1, subscriber.bit_2, subscriber.bit_3, subscriber.bit_4, subscriber.bit_5, subscriber.bit_6, subscriber.bit_7, \ subscriber.bit_8, subscriber.bit_9, subscriber.bit_10, \ subscriber.hex...
class Solution(object): def wordBreak(self, s, wordDict): """ :type s: str :type wordDict: Set[str] :rtype: bool """ ## DP dp = [False for _ in range(len(s) + 1)] dp[0] = True for j in range(1, len(s) + 1): for i in range(0, j): ...
## https://leetcode.com/problems/find-all-duplicates-in-an-array/ ## pretty simple solution -- use a set to keep track of the numbers ## that have already appeared (because lookup time is O(1) given ## the implementation in python via a hash table). Gives me an O(N) ## runtime ## runetime is 79th percentile; memory...
world_cities = ['Dubai', 'New Orleans', 'Santorini', 'Gaza', 'Seoul'] print('***********') print(world_cities) print('***********') print(sorted(world_cities)) print('***********') print(world_cities) print('***********') print(sorted(world_cities, reverse=True)) print('***********') print(world_cities) print('********...
# Given a non-negative integer num, return the number of steps to reduce it to zero. # If the current number is even, you have to divide it by 2, # otherwise, you have to subtract 1 from it. def count_steps(num): steps = 0 while num != 0: if num % 2 == 1: num -= 1 else: ...
# https://leetcode.com/problems/is-subsequence/ class Solution: def isSubsequence(self, s: str, t: str) -> bool: if len(s) == 0: return True sIndex = 0 for tIndex, tChar in enumerate(t): if s[sIndex] == tChar: sIndex += 1 ...
# # PySNMP MIB module H3C-FTM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/H3C-FTM-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:09:18 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, 0...
# Row-by-column representation of the board BOARD_SIZE = 6, 7 # Define size of each cell in the GUI of the game CELL_SIZE = 100 # Define radius of dot RADIUS = (CELL_SIZE // 2) - 5 # Define size of GUI screen GUI_SIZE = (BOARD_SIZE[0] + 1) * CELL_SIZE, (BOARD_SIZE[1]) * CELL_SIZE # Define various colors used on the GUI...
'''This tnsertion sort algorithm which is shown in most websites and books, is slower than another insertion sort algorithm.''' def insertion_sort_slow(arr): for i in range(1, len(arr)): key = arr[i] j = i-1 while j >= 0 and key < arr[j]: arr[j + 1] = arr[j] j -=...
"""class krypton_patch: def __init__(self, driver) -> None: self.driver = driver self.js = driver.driver.execute_script driver.driver.execute_script("javascript/index.js") #patch 0.1 def FakeReply(self, korban, pesan, chat_id, MsgId, teks): return self.js(f"return await FakeR...
# Solution for the problem "Cats and a mouse" # https://www.hackerrank.com/challenges/cats-and-a-mouse/problem # Number of test cases numQueries = int(input()) # Running the queries for queryIndex in range(0, numQueries): # Locations of Cat A, Cat B and mouse locCatA, locCatB, locMouse = map(int, input().stri...
""" DESCRIPTION: Write a code to extract each digit from an integer, in the reverse order EXAMPLE Input: n = 1234 Output: "4 3 2 1" """ def main(n: int) -> str: ret_val: str = "" # Enter the code below return ret_val
# configuration for building the network y_dim = 6 tr_dim = 7 ir_dim = 10 latent_dim = 128 z_dim = 128 batch_size = 128 lr = 0.0002 beta1 = 0.5 # configuration for the supervisor logdir = "./log" sampledir = "./example" max_steps = 30000 sample_every_n_steps = 100 summary_every_n_steps = 1 save_model_secs = 120 checkp...
N = int(input()) s = [input() for _ in range(N)] for y in range(N): for x in range(N): print(s[N - 1 - x][y], end='') print('')
class Message(object): """`Message` stores the SMS text and the originating phone number. """ def __init__(self, from_number, text, provider=None, *args, **kwargs): self.from_number = from_number self.text = text self._provider = provider def reply(self, text): self._pro...
S = input() def check_even(stri): if len(stri) % 2 !=0: return False else: half = int(len(stri)/2) if stri[:half] == stri[half:]: return True else: return False for i in range(len(S)): if check_even(S[:-(i+1)]): print(len(S)-(i+1)) ...
N = int(input("Cuantos digitos quiere ingresar? ")) lista = [] lista2 = [] for i in range(N): lista.append(int(input("Digite un numero: "))) print("Su lista es: ", lista) for i in range(N): lista2.append(1*(lista[i]+1)) print("La segunda lista es: ", lista2)
# 各漫画のHTMLを作成 def make_html(output_path, src_path, manga_title): with open(src_path + "/template.html") as f: html = f.read().replace("manga_title", manga_title) with open(output_path + "/" + manga_title + "/index.html", "w") as f: f.write(html)
# @dependency 001-main/002-createrepository.py frontend.json( "repositories", expect={ "repositories": [critic_json] }) frontend.json( "repositories/1", expect=critic_json) frontend.json( "repositories", params={ "name": "critic" }, expect=critic_json) frontend.json( "repositories/47...
#!/usr/bin/env python # -*- coding: utf-8; py-indent-offset:4 -*- ############################################################################### # Copyright (C) 2020 Daniel Rodriguez # Use of this source code is governed by the MIT License ###############################################################################...
##Patterns: E0103 def test(): while True: break ##Err: E0103 break for letter in 'Python': if letter == 'h': continue ##Err: E0103 continue
def checkio(f, g): def call(function, *args, **kwargs): try: return function(*args, **kwargs) except Exception: return None def h(*args, **kwargs): value_f, value_g = call(f, *args, **kwargs), call(g, *args, **kwargs) status = "" if (value_f is None and value_g...
# -------------- # Code starts here class_1 = ['Geoffrey Hinton' , 'Andrew Ng' , 'Sebastian Raschka' , 'Yoshua Bengio'] class_2 = ['Hilary Mason' , 'Carla Gentry' , 'Corinna Cortes'] new_class = class_1+class_2 print(new_class) new_class.append('Peter Warden') print(new_class) new_class.remove('Carla Gentry') print(...
N = int(input()) a,b = 1,1 print(0,end=' ') for i in range(1,N-1): if i != N: print(a,end=' ') a,b = b,a+b print(a,end='\n')
# This is a dummy file to allow the automatic loading of modules without error on none. def setup(robot_config): return def say(*args): return def mute(): return def unmute(): return def volume(level): return
class FeeValidator: def __init__(self, specifier) -> None: super().__init__() self.specifier = specifier def validate(self, fee): failed=False try: if fee != 0 and not 1 <= fee <= 100: failed=True except TypeError: failed=True ...
#!/usr/bin/env python3 """ Get information on the inferface. """ help(gdb) help(gdb.command) help(gdb.events) help(gdb.function)
INSERT_ONE_BY_BYTE = "insert_one_by_byte" INSERT_ONE_BY_PATH = "insert_one_by_path" INSERT_MANY_BY_BYTE = "insert_many_by_byte" INSERT_MANY_BY_DIR = "insert_many_by_dir" INSERT_MANY_BY_PATHS = "insert_many_by_paths" DELETE_ONE_BY_ID = "delete_one_by_id" DELETE_MANY_BY_IDS = "delete_many_by_ids" DELETE_ALL = "delete_al...
lista = [] lista_par = [] lista_impar = [] while True: n = (int(input('Digite os numeros: '))) lista.append(n) if n % 2 == 0: lista_par.append(n) else: lista_impar.append(n) res = str(input('Quer continuar [S/N] : ')) if res in 'Nn': break print(f'O numeros da...
input = """ 1 2 0 0 1 3 0 0 1 4 0 0 1 5 0 0 1 6 0 0 1 7 0 0 1 8 0 0 1 9 0 0 1 10 0 0 1 11 0 0 1 12 0 0 1 13 0 0 1 14 0 0 1 15 0 0 1 16 0 0 1 17 0 0 1 18 1 1 19 1 20 1 1 21 1 22 1 1 23 1 24 1 1 25 1 26 1 1 27 1 28 1 1 29 1 19 1 1 18 1 21 1 1 20 1 23 1 1 22 1 25 1 1 24 1 27 1 1 26 1 29 1 1 28 1 1 1 1 18 2 30 2 0 2 22 20 ...
test = [11.0, "Alice has a cat", 12, 4, "5"] print("len(test) = " + str(len(test))) print("test[1] = " + str(test[1])) print("test[3:6] = " + str(test[3:6])) print("test[1:6:2] = " + str(test[1:6:2])) print("test[:6] = " + str(test[:6])) print("test[-2] = " + str(test[-2])) test.append(121) test2 = test + [1, 2, 3...
class dotStringProperty_t(object): # no doc aName=None aValueString=None FatherId=None ValueStringIteration=None
#!/usr/bin/env python # encoding: utf-8 # The MIT License # # Copyright (c) 2011 Wyss Institute at Harvard University # # 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, i...
# pylint: disable=missing-function-docstring, missing-module-docstring/ @toto # pylint: disable=undefined-variable def f(): pass
class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None class Solution: """ @param root: An object of TreeNode, denote the root of the binary tree. This method will be invoked first, you should design your own algorithm to serialize a binary tree ...
x = 50 def func(x): print('x is',x) x = 2 print('Changed local x to',x) func(x) print('x is still',x)
# -*- coding:UTF-8 -*- # Author:Tiny Snow # Date: Mon, 22 Feb 2021, 13:49 # Project Euler # 045 Triangular, pentagonal, and hexagonal #======================================================================================================Solution def is_pentagon(num): n = int(((2 / 3) * num) ** 0.5) + 1 if n * ...
"""Adapters for twisted.vfs. This package provides adapters to hook up systems SFTP and FTP to the IFileSystemLeaf and IFileSystemDirectory interfaces of VFS. """
class WebEncoderException(Exception): pass class InvalidEncodingErrors(WebEncoderException): """Exception raised for errors in the input value of encoding_errors attribute of WebEncoder class. Args: message: explanation of the error """ def __init__(self, message=None): self.mess...
class Node(): def __init__(self, value="", frequency=0.0): self.frequency = frequency self.value = value self.children = {} self.stop = False def __getitem__(self, key): if key in self.children: return self.children[key] return None def __set...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"PairwiseDistance": "00_distance.ipynb", "pairwise_dist_gram": "00_distance.ipynb", "stackoverflow_pairwise_distance": "00_distance.ipynb", "PairwiseDistance.stackoverflow_pairwise_...
class AppUserProfile: types = { 'username': str, 'password': str } def __init__(self): self.username = None # str self.password = None # str
"""Hydra Library Tools & Applications. """ __all__ = ( "app", "hy", "log", "rpc", "test", "util" ) VERSION = "2.6.5"
class Container: def __init__(self, container=None): if container == None or type(container) != dict: self._container = dict() else: self._container = container def __iter__(self): return iter(self._container.items()) def addObject(self, name, object_:ob...
""" Ilustração lista = ['Ian', 80kg] 0 1 """ cadastro = [] dados = [] mai = 0 men = 0 x = 0 resposta = 's' print('----------CADASTRO DE PESSOAS----------') while resposta == 's': resposta = input("Deseja cadastra uma pessoa? [s/n] ") if resposta == 'n': break ...
# -*- coding: utf-8 -*- DESC = "cvm-2017-03-12" INFO = { "CreateImage": { "params": [ { "name": "ImageName", "desc": "Image name" }, { "name": "InstanceId", "desc": "Instance ID used to create an image." }, { "name": "ImageDescription", ...
# Numeral System Converter """ TODO 1. Convert from any system to decimal """ def binary_to_decimal(bin_string:str) -> int: bin_string = str(bin_string).strip() if not bin_string: raise ValueError("Empty string was passed to the function") is_negative = bin_string[0] == "-" if is_negative: ...
class AcousticParam(object): def __init__( self, sampling_rate: int = 24000, pad_second: float = 0, threshold_db: float = None, frame_period: int = 5, order: int = 8, alpha: float = 0.466, f0_floor: float = 71, ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Sep 11 12:52:32 2018 @author: cyril-kubu """
def print_vars(obj): """ Prints all non-private attributes variables (does not start with '_' and not method) :param obj: :return: """ for attr in dir(obj): if attr[0] is "_" or callable(getattr(obj,attr)): continue print(attr, ":", getattr(obj, attr)) def print_met...
""" Class for storing method parameters. """ class JavaMethodParameter: def __init__(self, identifier, parameter_type): self.__identifier = identifier self.__type = parameter_type @property def identifier(self): return self.__identifier @property def parameter_type(self):...
def get_headers(text): list_a = text.split("\n")[1:] list_headers = [] for i in list_a: if not i: break list_headers.append(i.split(": ")) return dict(list_headers)
#WAP to find, a given number is prime or not num = int(input("enter number")) if num>1: #check for factors for i in range(2,num): if(num / i) == 0: print(num," is not prime number") break else: print(num," is not a prime number")
# Description: Print the B-factors of a residue. # Source: placeHolder """ cmd.do('remove element h; iterate resi ${1: 1:13}, print(resi, name,b);') """ cmd.do('remove element h; iterate resi 1:13, print(resi, name,b);')