content
stringlengths
7
1.05M
class EntityTypeBuilder: PERSON = "PER" ORGANIZATION = "ORG" LOCATION = "LOC" GEO_POLITICAL_ENTITY = "GPE" FACILITY = "FAC" _entities = { "PERSON": PERSON, "TITLE": PERSON, "ORGANIZATION": ORGANIZATION, "MISC": FACILITY, ## QUE ES MISC? "L...
""" :testcase_name user_credentials :author Sriteja Kummita :script_type Class :description Implementation using decorators in Python. Decorator 'validate_password' check the validity of the first argument passed to the function being invoked. 'set_password' is annotated with the decorator 'validate_password' to check ...
class Location: def __init__(self): self.name = None self.connections = { "north": None, "south": None, "east": None, "west": None, } self.description = "This location has no description... Yet..." self.hostility = 0 sel...
#!/usr/bin/env python def get_help_data_12577(): """ Alerts and Alarms help. Data store of information to be presented when a help request is made for port 12577. Returns a list of dictionaries associated with various requests supported on that port. """ help_data = [ { ...
# 获取变量所指的对象类型 a, b, c, d = 20, 5.5, True, 4+3j print(type(a), type(b), type(c), type(d)); e = 111 isinstance(e, int);
def isPalindrome(str) -> bool: letters = [letter for letter in str] head = 0 tail = len(letters) - 1 if len(letters) == 0: return False while (head < tail): if letters[head] != letters[tail]: return False head = head + 1 tail = tail - 1 return True if __name__ == '__m...
# ------------------------------------------------------------------------------ # Python API to access CodeHawk Binary Analyzer analysis results # Author: Henny Sipma # ------------------------------------------------------------------------------ # The MIT License (MIT) # # Copyright (c) 2016-2019 Kestrel Technology ...
X_threads = 16*33 Y_threads = 32*14 Invoc_count = 1 start_index = 0 end_index = 0 src_list = [] SHARED_MEM_USE = False total_shared_mem_size = 1024 domi_list = [25, 27,31,33,37,41,88,90,94,132,176,178,182,220,222,226,264,266,295,297] domi_val = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
''' 懒汉单例模式 ''' class Singleton(object): __instance = None ''' 区别: 对于”new”和”init”可以概括为: “new”方法在Python中是真正的构造方法(创建并返回实例),通过这个方法可以产生一个”cls”对应的实例对象,所以说”new”方法一定要有返回。 对于”init”方法,是一个初始化的方法,”self”代表由类产生出来的实例对象,”init”将对这个对象进行相应的初始化操作。 ''' def __new__(cls): # print('__new__...
def greater_than(x,y): if x == y: return "These numbers are the same" if x>y: return x if x<y: return y print(greater_than(2,4)) print(greater_than(7,4)) print(greater_than(-50,-50)) def graduation_reqs(credits): if credits >= 120: return "You have enough credits to graduate!" else: retu...
lista = list() for x in range (0,10): a = int(input('Digite um valor: ')) lista.append(a) lista.reverse() for x in lista: print(x)
class Validator(object): def validate(self, path): raise NotImplementedError class ValidationResult(object): def __init__(self, path, valid, message=None): self.path = path self.valid = valid self.message = message validators = {} def validates(*formats): def validates_d...
# Recursive merge sort #Aux array to do the merge def merge_sort(array): global temp temp = [None] * len(array) merge_sort_recursive(array, 0, len(array)-1) def merge_sort_recursive(array, l, r): if (l < r): mid = l + (r-l)//2 merge_sort_recursive(array, l, mid) merge_sort_rec...
""" This package is responsible for encoding/decoding RTMP amf messages. This package contains classes/methods to establish a connection to a RTMP server and to read/write amf messages on a connected stream. It also contains the PySocks (https://github.com/Anorov/PySocks) module to enable a connection to a RTMP server...
""" Contains the flag class, this is desgined to hold types of information about the target. These can be things entered by the catalogue when assuming values such as 'Temperature calculated' or personal tags like 'Priority Target' These are designed to be attached to a planet, system, star or binary class in .flags "...
""" An array is given, find length of the subarray having maximum sum. """ def max_sum_subarray(arr: list) -> int: max_sum, curr_max, curr_start, start, end = 0, 0, 0, -1, 0 for index, el in enumerate(arr): curr_max += el if curr_max > max_sum: start = curr_start end ...
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2021, Cisco Systems # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) DOCUMENTATION = r""" --- module: task short_description: Manage Task objects of Task description: - Returns Task(s) based on filter criteria. - Re...
class Property: __slots__ = ('object_id', 'type', 'value') def __init__(self, object_id, type, value): self.object_id = object_id self.type = type self.value = value def __eq__(self, other): return (self.__class__ == other.__class__ and all(getattr(self, n...
''' @author: l4zyc0d3r People who are happy makes other happy. I am gonna finish it slowly but definitely.cdt ''' class Solution: def suggestedProducts(self, P: List[str], sW: str) -> List[List[str]]: P.sort() prfx, ans = '', [] for c in sW: prfx+=c i = bisect.bisec...
def reverse(txt): return txt[::-1] def capitalize(txt): return txt.capitalize()
""" Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sum to target. Each number in candidates may only be used once in the combination. Note: The solution set must not contain duplicate combinations. Example 1:...
# data from EMSL: https://bse.pnl.gov/bse/portal # 4-31G EMSL Basis Set Exchange Library 11/9/12 10:13 AM # Elements References # -------- ---------- # H, C - F: R. Ditchfield, W.J. Hehre and J.A. Pople, J. Chem. Phys. 54, 724 # (1971). # He, Ne: ...
# -*- coding:utf-8 -*- # https://leetcode.com/problems/insert-interval/description/ # Definition for an interval. # class Interval(object): # def __init__(self, s=0, e=0): # self.start = s # self.end = e class Solution(object): def insert(self, intervals, newInterval): """ ...
KM = float(input("Digite a distância desejada: ")) preço1 = round(KM * 0.5, 2) preço2 = round(KM * 0.45, 2) if KM <= 200: print(f"O preço cobrado será {preço1}.") else: print(f"O preço cobrado será {preço2}.")
## ## # File auto-generated by PythonFileGenerator __all__ = [ 'resp', 'user' ]
# parsetab.py # This file is automatically generated. Do not edit. # pylint: disable=W,C,R _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'leftORleftANDrightNOTnonassocISISNULLNOTNULLleftMENORIGUALMAYORIGUALIGUALDIFDIF1MENORMAYORleftMASMENOSleftPORDIVIDIDOMODULOleftEXPrightUMENOSUMASnonassocBETWEENNOTBABS ...
#variable text1 = 'linux' angka1int = 100 angka2flo = 10.5 ''' NOTE* %s - digunakan untuk String %d - digunakan untuk Integer %f - digunakan untuk Float sumber referensi: https://www.learnpython.org/en/String_Formatting ''' #dengan menggunakan % bisa memanggil kata yang berada pada variable yang akan dipanggil print...
# Copyright (c) 2018 Via Technology Ltd. All Rights Reserved. # Consult your license regarding permissions and restrictions. """ Find intersections with a volume of airspace """ class AirspaceVolume: """ A class for an airspace volume. """ __slots__ = ('__name', '__bottom_altitude', '__top_altitude')...
def sortX(points): points.sort(key = lambda x:x[0]) return points def sortY(points): points.sort(key = lambda x:x[1]) return points def compareX(a,b): return a[0] - b[0] def compareY(a,b): return a[1] - b[1] def distance(a,b): return ((a[0] - b[0])**2 + (a[1] - b[1])**2)**0.5 def brutef...
######################################################################################################################## ### ### ### This module uses a width of max. 120 characters ...
# -*- coding: utf-8 -*- """Implementation of the ``somatic_neoepitope_prediction`` step The somatic_neoepitope_prediction step allows for the prediction of neoepitopes from somatic (small) variant calling results and a transcript database such as ENSEMBL. Further, the step allows for the binding prediction to a given...
def calc_score(ox_list): result_scores = [] for i in range(len(ox_list)): score = 0 O_cnt = 0 for s in ox_list[i]: if s == 'O': O_cnt += 1 score += O_cnt elif s == 'X': O_cnt = 0 result_scores.append(score) ...
# # PySNMP MIB module ORADB-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ORADB-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:35:28 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...
def decode_modified_utf8(s: bytes) -> str: """ Decodes a bytestring containing modified UTF-8 as defined in section 4.4.7 of the JVM specification. :param s: bytestring to be converted. :returns: A unicode representation of the original string. """ s_out = [] s_len = len(s) s_ix = 0...
class Config: """ Configuration parameters """ # Training Parameters learning_rate = 0.001 dropout = 0.25 epochs = 1000 test_size = 0.2 # Where the model and info is logged logdir = './models' # Where the training data is located datadir = 'C:/Users/ryanc/Drop...
text = ('this some is sample some text') x=text.split() word='this' l={} for i in set(x): if i in l.keys(): l.update({i:x.count(i)}) else: l[i]=1 print(l)
# This is to demonstrate user input. name = input('hello! what is your name? >') print('Welcome', name)
class ChineseFont: def __init__(self, file): # open data file self.__db_file = open(file, 'rb') self.__load_map() def get_font_size(self): return self.__font_size def is_exist(self, key): return key in self.__map def get_font_count(self): r...
# 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 balanceBST(self, root): """ :type root: TreeNode :rtype: TreeNode """ nodes = [] ...
#armstrong in interval def arms(a,b): for i in range(a,b+1): j=i c=[] while(j>0): x=j%10 c.append(x) j=j/10 #print(c) sum=0 for x in range(0,len(c)): sum=sum+(c[x]*c[x]*c[x]) #print(sum) if(sum==i): print(i) a=input("enter a") b=input("enter b") arms(a,b)
class MatrixR: def __init__(self, rows, columns): self.m = rows self.n =columns self.A = [[0 for y in range(self.n)] for x in range(self.m)] def add(self, i, j, q): self.A[i][j] *= 0 self.A[i][j] += q def __add__(self, B): if (self.m != B.m) or (self.n != B.n): print("\n\nDimension Error...
# coding=utf-8 # Name: # Date: """ proj04 practice with lists """ #Part I #Take a list, say for example this one: a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] #and write a program that prints out all the elements of the list that are less than 5. #Part II # Take two lists, say for example these two: b = [1, 1,...
#isPalin def isPali(s): s = s.lower() if (s == s[::-1]): print("True") else: print("False") s = "madAm" isPali(s)
"""Codewars: Sum of angles 7 kyu URL: https://www.codewars.com/kata/5a03b3f6a1c9040084001765/train/python Find the total sum of angles in an n sided shape. N will be greater than 2. """ def angle(n): return 180 * (n - 2) def main(): # Output: 180 # n = 3 # print(angle(n)) assert angle(3) == ...
"""Helper functions for Philips Hue v2.""" def normalize_hue_brightness(brightness): """Return calculated brightness values.""" if brightness is not None: # Hue uses a range of [0, 100] to control brightness. brightness = float((brightness / 255) * 100) return brightness def normalize_h...
my_zen_settings = { 'html': { 'abbreviations': { 'jq': '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>', 'demo': '<div id="demo"></div>' } } }
# -*- coding: utf-8 -*- """ Student Do: Grocery List. This script showcases basic operations of Python Lists to help Sally organize her grocery shopping list. """ # Create a list of groceries print("My list of groceries:") groceries = ["water", "butter", "eggs", "apples", "cinnamon", "sugar", "milk"] print(groceries)...
# Write a program to check a given number is even or odd x = float(input("Enter Value:-")) if(x%2==0): print("this ",x," is even number") else: print("this ",x," is odd number")
""" Faça um programa que leia um vetor de 5 númeors inteiros e mostre-os. """ vetor = [] for i in range(1, 6): num = int(input("Digite um numero {} de 5:".format(i))) vetor.append(num) for i in vetor: print(i)
''' This directory contains a minimal BSDL file parser that needs to be extended in order to be very useful. It also contains a data directory that has manufacturer's codes and known ID codes and instruction register capture codes for several parts. Finally, it contains a lookup utility/module for device identificati...
class Solution(object): def searchInsert(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ if target in nums: return nums.index(target) elif target<=nums[0]: return 0 else: for i in ran...
# 1. Delivery guy scanned the code and put the package to bin, # Locker system can help to find the available bin for the suitable # bin with the suitable size # 2. Once LockerSystem get the package stored in the bin, # system will send the notification to user, which includes the # barcode or PIN code # 3. User inp...
def pr(s,*argv,**argp): '''Print directly to stdout with no delay Author: Victor Kitov (v.v.kitov@yandex.ru), 03.2016.''' print(s,*argv,**argp) sys.stdout.flush() def progress(n,N,steps=100): '''Show progress - how many percent of total progress is made. n-current index and N-total count. ...
''' Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, two is written as II in Roman numeral, just two one's added together. Twelve is...
# # @lc app=leetcode.cn id=378 lang=python3 # # [378] kth-smallest-element-in-a-sorted-matrix # None # @lc code=end
""" Project Euler Problem 9: Special Pythagorean triplet """ # There exists exactly one Pythagorean triplet for which a + b + c = 1000. # Find the product abc. SUM = 1000 foundTriple = False m = 1 while not foundTriple: m += 1 for n in range(1,m): if SUM%(2*m*(m + n)) == 0: foundTriple = ...
# our prime list is empty here primes = [] def is_prime(x): a = True for i in primes: if x % i == 0: a = False break if i > int(x ** 0.5): break if a: primes.append(x) return a # this loop simply runs the fxn to add newer primes for i in ra...
# Generic Models, Of New Class which makes the subclasses of type type class Model(object): # Generic Class from which models will inherit from def __init__(self, item=None, item_id=0, list_of_items=None): self.item = item self.item_id = item_id self.list_of_items = list_of_items de...
def get_value_counts_for_column(data, col_name): counts_df = data.groupBy(col_name).count().orderBy('count', ascending=False) return counts_df.toPandas() def create_vocab(data, col_name, cutoff=5, unk_token=True, none_token=True): val_counts = get_value_counts_for_column(data, col_name) ...
# @name linked_list.py # @ref https://classroom.udacity.com/courses/ud513/lessons/7117335401/concepts/78875247320923 """The LinkedList code from before is provided below. Add three functions to the LinkedList. "get_position" returns the element at a certain position. The "insert" function will add an element to a part...
""" Python heapsort algorithms This function takes last element as pivot, places the pivot element at its correct position in sorted array, and places all smaller (smaller than pivot) to left of pivot and all greater elements to right of pivot """ def partition(array, low, high): i = low - 1 # index of smaller ...
# Credits: https://github.com/sriinampudi class Solution: def xorOperation(self, n: int, start: int) -> int: nums =[] c = start for i in range (0,n): nums.append(start+(2*i)) if(i>0): c = c ^ nums[i] return(c) ...
class Constants: inactive = "." active = "#" def read_data(file_path,part2,debug=True): file = open(file_path, "r") data = [] for line in file: if not line.rstrip(): continue row = [] for cube in line.rstrip(): if cube == Constants.inactive: ...
# Rearrange an array so that arr[i] becomes arr[arr[i]] with O(1) extra space # Given an array arr[] of size n where every element is in range from 0 to n-1. # Rearrange the given array so that arr[i] becomes arr[arr[i]]. # This should be done with O(1) extra space. # Examples: # Input: arr[] = {3, 2, 0, 1} # Outpu...
def fixFilter(params, filter): q={} for f in filter: if type(filter[f]) is list: for i in range(len(filter[f])): q['filter[{}][{}][{}]'.format(f, i, 'key')] = filter[f][i]['key'] q['filter[{}][{}][{}]'.format(f, i, 'value')] = filter[f][i]['value'] else: q['filt...
petar_budget = float(input()) video_cards = int(input()) processors = int(input()) ram = int(input()) video_cards_price = video_cards * 250 one_processors_price = video_cards_price * 0.35 processors_price = processors * one_processors_price one_ram_price = video_cards_price * 0.10 ram_price = one_ram_price * ram tota...
'''Elabore um programa que calcule o valor a ser pago por um produto, considerando o seu preço normal e condição de pagamento: -a vista dinheiro/ cheque: 10% de desconto (Código: D/CH) - a vista no cartão: 5% de desconto (Código: VC) - em até 2x no cartão: preço normal (Código: 2C) -3x ou mais no cartão: ...
#Number class used to store a number and a number which shows a cumulative sum of each numbers divisors from 1 to number class Number: def __init__(self, number, cumulativeSum): self.number = number self.cumulativeSum = cumulativeSum def get_number(self): return self.number #fi...
sal = float(input("Qual é o seu salário atual? ")) if sal > 1250: aume = 10 else: aume = 15 nsal = sal + ((sal * aume)/100) print("\033[32mO seu salário era {:.2f}, mas com um aumento de {}% ele passou a ser {:.2f}.".format(sal, aume, nsal))
class Lyric: def __init__(self, content, artist=None, album=None, title=None): self._content = content self._artist = artist self._album = album self._title = title def __repr__(self): artist = self._artist or 'Unnamed' title = self._title or 'Untitled' r...
### WHILE LOOPS ### ''' As a programmer, there will be times where you want your program to do the same thing over and over again. Before, when we made our game, we did that by letting our 'main()' function call itself whenever we wanted to repeat a task. This worked well for our purposes at the time, but for mos...
def counting_sticks(sticks): # Function defined accepts a list while len(sticks) > 0: # While loop to print results till size of all sticks become zero print(len(sticks)) # Printing the len of list or number of sticks in the list minimum = min(sticks) ...
def heap_sort(list): for start in range((len(list)- 2)//2, -1, -1): sift_down(list, start, len(list)-1) for end in range(len(list) - 1, 0, -1): list[0], list[end] = list[end], list[0] sift_down(list, 0, end - 1) return list def sift_down(lst, n, i): root = n while True: ...
# Configuration for PureScrape # Member's login information EMAIL = "" PIN = "" # Path to database sqlite_path = 'pure_db.sqlite3'
# -*- coding: utf-8 -*- """ Created on Tue Aug 20 15:45:08 2019 @author: Rivan """
#Logical and, or, not #and - both the condition should be true exp=10 age=45 if(exp>=10 and age>=45): print("Eligible to work") else: print("Not Eligible") #or - any one condition should be true x=10 print(x>5 or x<5) #not - returns false if the value is true and vice versa x="True" print(not(x...
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'includes': [ 'libwebm.gypi', ], 'targets': [ { 'target_name': 'libwebm', 'type': 'static_library', 'sources': [ '<...
#! python3 # __author__ = "YangJiaHao" # date: 2018/12/26 def number_of1(n): count = 0 while(n): count += 1 n = (n-1) & n return count if __name__ == '__main__': res = number_of1(-1) print(res)
class MarkPrice: def __init__(self): self.symbol = "" self.markPrice = 0.0 self.lastFundingRate = 0.0 self.nextFundingTime = 0 self.time = 0 @staticmethod def json_parse(json_data): result = MarkPrice() result.symbol = json_data.get_string("sym...
class Solution: def __init__(self): self.max_num = 0 def XXX(self, root: TreeNode) -> int: if root is None: return 0 l = self.XXX(root.left) r = self.XXX(root.right) self.max_num = max (max(l, r)+1, self.max_num) return self.max_num
print(""" 052) Faça um programa que leia um número inteiro e diga se ele é ou não um número primo. """) total = 0 numero = int(input('Digite um número: ')) for contador in range (1, numero + 1): if numero % contador == 0: total += 1 print('O número {} foi divisível {} vezes'.format(numero, total)) if total...
# Solution ID: 52181021 def closest_zero(street, empty_pose_value='0'): street_length = len(street) zeros = [ index for (index, number) in enumerate(street) if number == empty_pose_value ] result = [0] * street_length # Before first zero first_zero = zeros[0] for numb...
# Exercício 2.4 - Escreva um programa que exiba o resultado de 2a × 3b, onde a vale # 3 e b vale 5 a = 3 b = 5 print('\n') print('2a + 3b = {}'.format(2*a + 3*b)) print('\n')
def Sieve(N): result = [] arr = [True] * 100 for i in range(2, int(N**(1/2.0))): if arr[i] == True: for j in range(i + i, N, i): arr[j] = False for i in range(N): if arr[i] == True and i != 0 and i != 1: result.append(i) pri...
class Solution(object): def wiggleMaxLength(self, nums): """ :type nums: List[int] :rtype: int """ # one of the editorial solutions if not nums: return 0 max_len_peak, max_len_valley = 1, 1 for n1, n2 in zip(nums, nums[1:]): if ...
#!/usr/bin/env python3 """Define public exports.""" __all__ = ["COMMON", "CDNs", "CDNs_rev"] """Top 14 CDNs most commonly used.""" COMMON = { "Cloudflare": "Cloudflare - https://www.cloudflare.com", "Incapsula": "Incapsula - https://www.incapsula.com/", "Cloudfront": "Cloudfront - https://aws.amazon.com/c...
sso_params = { "cootek.authorize": "https://idcsso.corp.cootek.com/adfs/oauth2/authorize/", "cootek.token": "https://idcsso.corp.cootek.com/adfs/oauth2/token", "cootek.logout": "https://idcsso.corp.cootek.com/adfs/oauth2/logout", "cootek.client-id": "a6e7edae-e3b8-43fd-92bc-f6208368b8be", "cootek.client-secre...
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 """ This module contains tools for testing new distributions and distributions for testing new Pyro inference algorithms. """
# -*- coding: utf-8 -*- """ Created on Sat Oct 2 10:41:49 2021 @author: qizhe """ class Solution: def jump(self, nums) -> int: """ 第一反应有点像动态规划,又有点像回溯 回溯:第一次提交竟然超时了,是不是不应该暴力深度搜索? 4616 ms 15.4 MB 动态规划:找状态转移,第一次成功了,但用时还是太长,可以进一步优化 36 ms 15.3 MB 与答案思路一...
class Match(object): def __init__(self, data): self._data = data self._players = {} self._playersname = {} self._processPlayers() def _processPlayers(self): try: for identities in self._data["participantIdentities"]: self._players[identities["participantId"]] = identities["player"] self._player...
"""The Noam lr_scheduler used in "Attention is All you Need" Implementation Reference: https://nlp.seas.harvard.edu/2018/04/03/attention.html """ class NoamOpt(object): # Optim wrapper that implements rate. def __init__(self, hidden_size, factor, warmup, optimizer, writer=None): self.optimizer = optimi...
banner = """ _______ _____ _ _ |__ __| / ____| | | | | | | ___ ___ _ __ ___ | | __ ___ _ __ _ __ ___| |_| |_ ___ | |/ _ \/ __| '_ \ / _ \| | |_ ...
# -*- coding: utf-8 -*- description = 'setup for the shutter' group = 'lowlevel' includes = ['sps'] tangohost = 'phys.spheres.frm2' shutter = 'tango://%s:10000/spheres/profibus/' % tangohost devices = dict( shutter = device('nicos_mlz.spheres.devices.shutter.ShutterCluster', description = 'Display whet...
def _pipe(f, g): def inner(*arguments): return g(f(*arguments)) return inner
''' Given m arrays, and each array is sorted in ascending order. Now you can pick up two integers from two different arrays (each array picks one) and calculate the distance. We define the distance between two integers a and b to be their absolute difference |a-b|. Your task is to find the maximum distance. Example 1...
a = input('Digite algo: ') print(type(a)) print('É alphaNumérico:', format(a.isalnum())) print('É só letras:', format(a.isalpha())) print('É decimal:', format(a.isdecimal())) print('É só letras mínusculas:', format(a.islower())) print('É só letras grandes:', format(a.isupper())) print('É só números:', format(a.isnumeri...
class Solution: def matrixScore(self, A): """ :type A: List[List[int]] :rtype: int """ # toggle each value in a row or column # sum of rows intepreted as binary number for i, row in enumerate(A): if row[0] == 0: for j in range(len(r...
def saveFeat (lc, tName, cur, conn): #pass in lightcurve table and cursor feats_to_use = [ 'amplitude', 'flux_percentile_ratio_mid20', 'flux_percentile_ratio_mid35', 'flux_percentile_ratio_mid50', 'flux_percentile_ratio_mid65', ...
def func(a, b, c, d): print(a+b+c+d) lista = 1, 2, 3, 4 func(*lista) #passando sem * é como se estivessemos dizendo que a = lista e não tivessemos passando os valores de 'b', 'c', e 'd'
anna = {'name': 'Anna', 'age': 35, 'cats':True, 'beard': False, 'hair_color': 'pink'} ryan = dict(anna) ryan['beard'] = True ryan['hair_color'] = 'Brown' ryan['name'] = 'Ryan' ryan['cats'] = 'Nope!' print(ryan) print(anna) class Person(object): def __init__( self, na...