content
stringlengths
7
1.05M
class WorkflowException(Exception): pass class UnsupportedRequirement(WorkflowException): pass class ArgumentException(Exception): """Mismatched command line arguments provided.""" class GraphTargetMissingException(WorkflowException): """When a $graph is encountered and there is no target and no m...
class Solution: def partitionLabels(self, s: str) -> List[int]: # base case if we only have 1 letter if len(s)<2: return [1] #change to [len(s)] response = [] # final response memory = [] #track memory.append(s[0])# we already known that we have at least 2 letters ...
class Solution: def isPowerOfTwo(self, n: int) -> bool: b = bin(n) if b[2] != '1': return False for bit in b[3:]: if bit != '0': return False return True print(Solution().isPowerOfTwo(1)) print(Solution().isPowerOfTwo(16)) print(Solution()....
""" tool for combining dictionaries. IndexedValues is a list with a start index. It is for simulating dictionaries of {int: int>0} """ def generate_indexed_values(sorted_tuple_list): """ :param sorted_tuple_list: may not be empty.\n [(int, int>0), ...] """ start_val, values = make_start_inde...
class _Attribute: def __init__(self, name, value, deprecated=False): self.name = name self.value = value self.deprecated = deprecated def get_config(self): """Get in config format""" return ' %s: %s\n' % (self.name, self.value) if self.value else None def __str_...
#!/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: external_radius_server short_description: Resource module for External Radius Server description: - Manage operati...
"""Bogus module for testing.""" # pylint: disable=missing-docstring,disallowed-name,invalid-name class ModuleClass: def __init__(self, x, y): self.x = x self.y = y def a(self): return self.x + self.y def module_function(x, y): return x - y def kwargs_only_func1(foo, *, bar, ba...
# generated from genmsg/cmake/pkg-genmsg.context.in messages_str = "/home/kalyco/mfp_workspace/src/darknet_ros/darknet_ros_msgs/msg/BoundingBox.msg;/home/kalyco/mfp_workspace/src/darknet_ros/darknet_ros_msgs/msg/BoundingBoxes.msg;/home/kalyco/mfp_workspace/devel/.private/darknet_ros_msgs/share/darknet_ros_msgs/msg/Che...
# exit from infinite loop v.2 # using flag prompt = ("\nType 'x' to exit.\nEnter: ") flag = True while flag: msg = input(prompt) if msg == 'x': flag = False else: print(msg)
text = "".join(input().split()) for index,emoticon in enumerate(text): if emoticon == ":": print(f"{emoticon+text[index+1]}")
word_size = 4 num_words = 16 words_per_row = 1 local_array_size = 4 output_extended_config = True output_datasheet_info = True netlist_only = True nominal_corner_only = True
# Intersection Of Sorted Arrays # https://www.interviewbit.com/problems/intersection-of-sorted-arrays/ # # Find the intersection of two sorted arrays. # OR in other words, # Given 2 sorted arrays, find all the elements which occur in both the arrays. # # Example : # # Input : # A : [1 2 3 3 4 5 6] # B : [3 3 5]...
# ALTERANDO, ACRESCENTANDO E REMOVENDO ITENS DE UMA LISTA motorcycles = ['honda', 'yamaha', 'suzuki'] # ALTERANDO UM ITEM DE UMA LISTA print(motorcycles) motorcycles[0] = 'ducati' print(motorcycles) # ACRESCENTANDO ELEMENTOS EM UMA LISTA # CONCATENANDO ELEMENTOS NO FINAL DE UMA LISTA motorcycles = ['honda', 'yamaha'...
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------- # SNMP Error Codes # ---------------------------------------------------------------------- # Copyright (C) 2007-2017 The NOC Project # See LICENSE for details # -------------------------------------------------------------...
ACTORS = [ {"id":26073614,"name":"Al Pacino","photo":"https://placebear.com/342/479"}, {"id":77394988,"name":"Anthony Hopkins","photo":"https://placebear.com/305/469"}, {"id":44646271,"name":"Audrey Hepburn","photo":"https://placebear.com/390/442"}, {"id":85626345,"name":"Barbara Stanwyck","photo":"https://placebear.co...
class MyRouter(object): def db_for_read(self, model, **hints): # if model.__name__ == 'CommonVar': if model._meta.model_name == 'commontype': return 'pgsql-ms' if model._meta.app_label == 'other': return 'pgsql-ms' # elif model._meta.app_label in ['auth', 'adm...
TOKEN = 'YOUR_TOKEN' UPD_TIME = 30 # seconds LOGIN_URL = "https://www.unistudium.unipg.it/unistudium/login/index.php" MAIN_URL = "https://www.unistudium.unipg.it/unistudium/" type_to_sym = { "Pagina": "📄", "File": "💾", "Prenotazione": "📅", "URL": "🌐", "Cartella": "📂", "Feedback": "📣", ...
Desc = cellDescClass("RF1R1WX2") Desc.properties["cell_leakage_power"] = "1118.088198" Desc.properties["dont_touch"] = "true" Desc.properties["dont_use"] = "true" Desc.properties["cell_footprint"] = "regcrw" Desc.properties["area"] = "33.264000" Desc.pinOrder = ['IQ', 'IQN', 'RB', 'RW', 'RWN', 'WB', 'WW', 'next'] Desc....
def compareTriplets(a, b): alice = 0 bob = 0 for i, j in zip(a, b): if i > j: alice += 1 elif i < j: bob += 1 return alice, bob
""" Undirected Graph: There is no direction for Nodes Directed Graph : Nodes have Connection One application Example: Facebook Friend Suggestion, Flight Routes Different from a Tree: In A tree there is only one path between two Nodes Google maps uses Graphs to guide you to desired place to move to """ #Initializing a G...
# a single 3 input neuron inputs = [1, 2, 3] weights = [0.2, 0.8, -0.5] bias = 2 output = (inputs[0] * weights[0] + inputs[1] * weights[1] + inputs[2] * weights[2] + bias) print(output)
''' Adaptable File containing all relevant information everything that could be used to customise the app for redeployment ''' # file path to log file is '/CA3/sys.log' def return_local_location() -> str: ''' Return a string of the local city. To change your local city name change the returned string: ...
# Copyright 2019 Uber Technologies, Inc. All Rights Reserved. # Modifications copyright Microsoft # # 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/LICENS...
''' A 2d grid map of m rows and n columns is initially filled with water. We may perform an `addLand` operation which turns the water at position (row, col) into a land. Given a list of positions to operate, count the number of islands after each addLand operation. An island is surrounded by water and is formed by conn...
class ErrorsMixin: """Test for errors in corner case situations """ async def test_bad_authentication(self): request = await self.client.get( self.api_url('user'), headers=[('Authorization', 'bjchdbjshbcjd')] ) self.json(request.response, 400)
str1=str(input("Enter an unbalanced bracket sequence:")) op=0 #number of open brackets clo=0 #number of closed brackets #for calculating open and closed brackets for i in range(0,len(str1)): if (str1[i]=="("): op=op+1 if (str1[i]==")"): clo=clo+1 if (op==clo): x = "(" + str1 + "...
def print_to_number(number): """ Prints to the number value passed in, beginning at 1""" for counter in range(1,number): print (counter) if __name__ == "__main__": print_to_number(5)
""" @author: magician @date: 2019/12/19 @file: rm_element.py """ def remove_element(nums, val: int) -> int: """ remove_element :param nums: :param val: :return: """ num_list = [] for i in nums: if i != val: num_list.append(i) print(num_list) re...
Rainbow = ['Red', 'Orange', 'Yellow', 'Green', 'Blue', 'Indigo', 'Violet'] print("the first element of the list Rainbow is:",Rainbow[0]) print("The true colors of a rainbow are:") for i in range(len(Rainbow)): print(Rainbow[i]) #print all the elements in one line or one item per line. Here are two examples of th...
#!/usr/bin/env python3 """ What is an anagram? Well, two words are anagrams of each other if they both contain the same letters. For example: 'abba' & 'baab' == true 'abba' & 'bbaa' == true 'abba' & 'abbba' == false 'abba' & 'abca' == false Write a function that will find all the anagrams of a word from a list. You ...
#This program shows how many birds there are in each state. def texas() -> None: '''function output how many birds Texas has''' bird = 5000 print("Texas has", bird, "birds") def california() -> None: '''function output how many birds California has''' bird = 8000 print("California has", bird...
# Figure A.6 ZIGZAG = ( 0, 1, 5, 6, 14, 15, 27, 28, 2, 4, 7, 13, 16, 26, 29, 42, 3, 8, 12, 17, 25, 30, 41, 43, 9, 11, 18, 24, 31, 40, 44, 53, 10, 19, 23, 32, 39, 45, 52, 54, 20, 22, 33, 38, 46, 51, 55, 60, 21, 34, 37, 47, 50, 56, 59, 61, 35, 36, 48, 49, 57, 58, 62, 63 )
""" 给定两个字符串 s 和 t ,编写一个函数来判断 t 是否是 s 的字母异位词。 示例 1: 输入: s = "anagram", t = "nagaram" 输出: true 示例 2: 输入: s = "rat", t = "car" 输出: false 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/valid-anagram 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 """ class Solution: def isAnagram(self, s, t): dict_s = {} ...
class Person: def __init__(self, name: Name): self.name = name def test_barry_is_harry(): harry = Person(Name("Harry", "Percival")) barry = harry barry.name = Name("Barry", "Percival") assert harry is barry and barry is harry
def eh_par(n): if n < 2: return '' if n % 2 != 0: n -= 1 print(n) return eh_par(n-2) x = int(input()) print(eh_par(x))
# -*- coding: utf-8 -*- __author__ ='Charles Keith Brown' __email__ = 'charles.k.brown@gmail.com' __version__ = '0.1.1'
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution(object): def lengthOfLongestSubstring(self, s): """ :type s: str :rtype: int """ seen = {} b...
WOQL_IDGEN_JSON = { "@type": "woql:IDGenerator", "woql:base": { "@type": "woql:Datatype", "woql:datatype": {"@type": "xsd:string", "@value": "doc:Station"}, }, "woql:key_list": { "@type": "woql:Array", "woql:array_element": [ { "@type": "woql:A...
# # @lc app=leetcode.cn id=1632 lang=python3 # # [1632] number-of-good-ways-to-split-a-string # None # @lc code=end
# Copyright 2015 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. # Path where remote_file_reader should be installed on the device. REMOTE_FILE_READER_DEVICE_PATH = '/data/local/tmp/remote_file_reader' # Path where remote...
def setup(): pass def draw(): fill(255, 0, 0) ellipse(mouseX, mouseY, 20, 20)
class ValidationError(Exception): """ Error in validation stage """ pass _CODE_TO_DESCRIPTIONS = { -1: ( 'EINTERNAL', ( 'An internal error has occurred. Please submit a bug report, ' 'detailing the exact circumstances in which this error occurred' ) ...
#!/usr/bin/env python # -*- coding: utf-8 -*- class CacheDecorator: def __init__(self): self.cache = {} self.func = None def cachedFunc(self, *args): if args not in self.cache: print("Ergebnis berechnet") self.cache[args] = self.func(*args) else:...
def MA(series, period=5): """Calculate moving average with period 5 as default """ i = 0 moving_averages = [] while i < len(numbers) - period + 1: this_window = numbers[i: i + period] window_average = sum(this_window) / period moving_averages.append(window_average) i += 1 return ...
""" 1267. 핸드폰 요금 작성자: xCrypt0r 언어: Python 3 사용 메모리: 29,380 KB 소요 시간: 72 ms 해결 날짜: 2020년 9월 26일 """ def main(): input() seconds = list(map(int, input().split())) y, m = 0, 0 for s in seconds: y += s // 30 * 10 + 10 m += s // 60 * 15 + 15 print(f'Y {y}' if y < m else f'M {m}' if y...
#!/usr/bin/env python3 def gen_repr(obj, **kwargs): fields = ', '.join([ f'{key}={value}' for key, value in dict(obj.__dict__, **kwargs).items() ]) return f'{obj.__class__.__name__}({fields})' def __repr__(self): return gen_repr(self)
# -*- coding: utf-8 -*- # # Copyright (c) 2020 Baidu.com, Inc. All Rights Reserved # """ Authors: liyuncong(liyuncong@baidu.com) Date: 2020/5/25 14:54 """
# Challenge 58, intermediate # https://www.reddit.com/r/dailyprogrammer/comments/u8jn9/5282012_challenge_58_intermediate/ # Take an input number and return next palindrome # f(808) = 818 # f(999) = 1001 -- need to take char length increases into account # f(2133) = 2222 # what is f(3 ^ 39)? # what is f(7 ^ 100)? # B...
__all__ = [ 'MongoengineMigrateError', 'MigrationGraphError', 'ActionError', 'SchemaError', 'MigrationError', 'InconsistencyError' ] class MongoengineMigrateError(Exception): """Generic error""" class MigrationGraphError(MongoengineMigrateError): """Error related to migration modules...
produto1 = float(input("Digite o preço do primeiro produto: ")) produto2 = float(input("Digite o preço do segundo produto: ")) produto3 = float(input("Digite o preço do terceiro produto: ")) if produto1 < produto2 and produto1 < produto3: print("Você deve comprar o produto de R$%3.2f. " % produto1) elif produt...
#!/usr/bin/python # test 1: seed top level, no MIP map command += testtex_command (parent + " -res 256 256 -d uint8 -o out1.tif --testicwrite 1 blah") # test 2: seed top level, automip command += testtex_command (parent + " -res 256 256 -d uint8 -o out2.tif --testicwrite 1 --automip blah") # test 3: procedural MIP m...
""" Your task is to calculate the number of bit strings of length n. For example, if n=3, the correct answer is 8 because the possible bit strings are 000, 001, 010, 011, 100, 101, 110, and 111. Input The only input line has an integer n. Output Print the result modulo 10^9+7. Constraints 1≤n≤10^6 Example In...
# --- internal paths --- # mimic_root_dir = '/cluster/work/grlab/clinical/mimic/MIMIC-III/cdb_1.4/' root_dir = '/cluster/work/grlab/clinical/Inselspital/DataReleases/01-19-2017/InselSpital/' # --- all about mimic --- # source_data = mimic_root_dir + 'source_data/' derived = mimic_root_dir + 'derived_stephanie/' charte...
"""Functionality related to interactions between DIT and companies.""" INTERACTION_EMAIL_INGESTION_FEATURE_FLAG_NAME = 'interaction-email-ingestion' INTERACTION_EMAIL_NOTIFICATION_FEATURE_FLAG_NAME = 'interaction-email-notification' MAILBOX_INGESTION_FEATURE_FLAG_NAME = 'mailbox-ingestion' MAILBOX_NOTIFICATION_FEATUR...
class CompositorNodeZcombine: use_alpha = None use_antialias_z = None def update(self): pass
def tetra(n): t = (n * (n + 1) * (n + 2)) / 6 return t print(tetra(5))
class Platform(object): def __init__(self, id=None, name=None, slug=None, napalm_driver=None, rpc_client=None): self.id = id self.name = name self.slug = slug self.napalm_driver = napalm_driver self.rpc_client = rpc_client @classmethod def from_dict(cls, contents): ...
class Solution(object): def combine(self, n, k): ans = [] def dfs(list_start, list_end, k, start, depth, curr, ans): if depth == k: ans.append(curr[::]) for i in range(start, list_end): curr.append(list_start+i) ...
def getDimensions(tf): X = tf.constant([1, 0]) Y = tf.constant([0, 1]) BOTH = tf.constant([1, 1]) return X, Y, BOTH def compute_centroid(tf, points): # points {[2, ?]} tensor of float_64 """Computes the centroid of the points.""" return tf.reduce_mean(points, 0) def move_to_center(tf, poi...
# -*- coding: utf-8 -*- qte = int(input()) lista = {} for i in range(qte): v = int(input()) if(v in lista): lista[v] += 1 else: lista[v] = 1 chaves = lista.keys() chaves = sorted(chaves) for k in chaves: print("{} aparece {} vez(es)".format(k,lista[k]))
ES_HOST = 'localhost:9200' ES_INDEX = 'pending-mrcoc' ES_DOC_TYPE = 'cooccurence' API_PREFIX = 'mrcoc' API_VERSION = ''
# programa que recebe login e senha do usuário, e visa impedir que o nome do usuário seja utilizado como senha login = str(input('Nome do usuário: ')).strip senha = str(input('Senha: ')).strip while senha == login: print('ERRO! \nDigite uma senha diferente do seu nome de usuário.') login = str(input('Nome do ...
DEBUG = True SECRET_KEY = 'no' SQLALCHEMY_DATABASE_URI = 'sqlite:///master.sqlite3' CELERY_BROKER_URL = 'amqp://guest:guest@localhost:5672//' GITHUB_CLIENT_ID = 'da79a6b5868e690ab984' GITHUB_CLIENT_SECRET = '1701d3bd20bbb29012592fd3a9c64b827e0682d6' ALLOWED_EXTENSIONS = set(['csv', 'tsv', 'ods', 'xls', 'xlsx', 'txt']...
dict = {'a': 1, 'b': 2} list = [1,2,3] str = 'hh' num = 123 num2 = 0.4 class Test: def test(self): print("gg") t = Test() print(type(dict)) print(type(list)) print(type(str)) print(type(num)) print(type(num2)) print(type(Test)) print(type(t))
# -*- coding: utf-8 -*- description = "Denex detector setup" group = "optional" includes = ["det_common"] excludes = ["det2"] tango_base = "tango://phys.maria.frm2:10000/maria/" devices = dict( detimg = device("nicos.devices.tango.ImageChannel", description = "Denex detector image", tangodevice ...
""" the only requirements of a CAPTCHA module is that it's generate function returns a tuple of (challenge, solution) strings and that it takes one argument -- the modifiers (if there are any) the challenge string should be a data URI https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs prototypic...
class Solution: chars = [None, None, "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"] def letterCombinations(self, digits): """ :type digits: str :rtype: List[str] """ if len(digits) == 0: return [] if len(digits) == 1: return list(self.chars[int(digits)]) cs, co = self.chars[in...
#week 4 chapter 8 - Lists #data structures - a particular way of organizing data in a computer #list is a sequence of values, the values can be any type (strings, integer, floats ...) #values in list are called elements or sometimes items #create list by enclosing elements with square brackets: [0,3,2,500,"hello"] #...
n = int(input()) a = list(map(int, input().split(" "))) a.sort() for i in range(1, len(a)): a[i] += a[i - 1] print(sum(a))
# arr[i] may be present at arr[i+1] or arr[i-1]. # TC: O(log(N)) | SC: O(1) def search(nums, key): start = 0 end = len(nums)-1 while start <= end: mid = start+((end-start)//2) if nums[mid] == key: return mid if mid < len(nums)-1 and nums[mid+1] == key: re...
expected_output = { "version": { "bootldr": "System Bootstrap, Version 17.5.2r, RELEASE SOFTWARE (P)", "build_label": "BLD_POLARIS_DEV_LATEST_20210302_012043", "chassis": "C9300-24P", "chassis_sn": "FCW2223G0B9", "compiled_by": "mcpre", "compiled_date": "Tue 02-Mar-21...
user_number = input("Please enter your digit : ") total = 0 for i in range(1, 5): number = user_number * i total = total + int(number) print(total)
primary_separator = '\n' secondary_separator = ',' default_filename_classification = 'tests/test_classification.data' dafault_filename_regression = 'tests/test_regression.data' def load_data(data, isfile=True): if isfile: with open(data) as data_file: data_set = data_file.read() else: ...
def getColors(color): colors=set() if color not in inverseRules.keys(): return colors for c in inverseRules[color]: colors.add(c) colors.update(getColors(c)) return(colors) with open('day7/input.txt') as f: rules=dict([l.split(' contain') for l in f.read().replace(' bags', '...
# fig06_01.py """Using a dictionary to represent an instructor's grade book.""" grade_book = { 'Susan' : [92,85,100], 'Eduardo' : [83,95,79], 'Azizi': [91,89,82], 'Pantipa': [97,91,92] } all_grades_total = 0 all_grades_count = 0 for name, grades in grade_book.items(): total = sum(grades) print...
# # PySNMP MIB module OMNI-gx2Dm200-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/OMNI-gx2Dm200-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:33:11 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
year = int(input("Año: ")) month = int(input("Mes: ")) day = int(input("Dia: ")) while not (1900 < year < 2021 and 0<month<13 and 0 < day < 32) : print("Escribe un año correcto") year = int(input("Año: ")) month = int(input("Mes: ")) day = int(input("Dia: ")) print(year,"-",month,"-",day,sep="")
#aula 1 de strings x = "eu" y = "sou" z = " " #concatenação de strings a = x + y + z #numero não é uma string, logo o python nao permite juntar com outras variaveis numero = 5 #o usuario pode criar uma string para você string_do_usuario = input('digite sua string: ')
mybooltr= True #We declare the mybooltrue equal to True myboolfa= False #We declare the myboolfalse equal to False print(mybooltr == myboolfa) #It will print false because my mybooltr doesnt equal to myboolfa print(mybooltr != myboolfa) #it will print true for the same reason print(2 == 3) #It will print fals...
# # @lc app=leetcode id=717 lang=python # # [717] 1-bit and 2-bit Characters # # https://leetcode.com/problems/1-bit-and-2-bit-characters/description/ # # algorithms # Easy (49.25%) # Likes: 278 # Dislikes: 705 # Total Accepted: 44.9K # Total Submissions: 91.1K # Testcase Example: '[1,0,0]' # # We have two speci...
# Databricks notebook source # MAGIC %scala # MAGIC spark.conf.set("com.databricks.training.module_name", "Sensor_IoT") # MAGIC val dbNamePrefix = { # MAGIC val tags = com.databricks.logging.AttributionContext.current.tags # MAGIC val name = tags.getOrElse(com.databricks.logging.BaseTagDefinitions.TAG_USER, java.ut...
class Context(object): browser = None # строительство фермы, при ошибке строительства buildCornOnError = True queueProperties = None
# from https://gist.github.com/jalavik/976294 # original XML at http://www.w3.org/Math/characters/unicode.xml # XSL for conversion: https://gist.github.com/798546 unicode_to_latex = { u"\u0020": "\\space ", u"\u0023": "\\#", u"\u0024": "\\textdollar ", u"\u0025": "\\%", u"\u0026": "\\&amp;", u...
# 445. Add Two Numbers II ''' You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. You may assume the two numbers do not contain any leading zero, exce...
# If T-Rex is angry, hungry, and bored he will eat the Triceratops # Otherwise if T-Rex is tired and hungry, he will eat the Iguanadon # Otherwise if T-Rex is hungry and bored, he will eat the Stegasaurus. # Otherwise if T-Rex is tired, he goes to sleep # Otherwise if T-Rex is angry and bored, he will fight with the Ve...
# Gamemode Utilities def get_gamemode_name(id): if (id is 0): return "Conquest" if (id is 1): return "Domination" if (id is 2): return "Team Deathmatch" if (id is 3): return "Zombies" if (id is 4): return "Disarm"
#: Mapping of files from unihan-etl (UNIHAN database) UNIHAN_FILES = [ 'Unihan_DictionaryLikeData.txt', 'Unihan_IRGSources.txt', 'Unihan_NumericValues.txt', 'Unihan_RadicalStrokeCounts.txt', 'Unihan_Readings.txt', 'Unihan_Variants.txt', ] #: Mapping of field names from unihan-etl (UNIHAN datab...
"""This is python equivalent of Wrapping/Tcl/vtktesting/mccases.tcl. Used for setting vertex values for clipping, cutting, and contouring tests. This script is used while running python tests translated from Tcl.""" def case1 ( scalars, IN, OUT, caseLabel ): scalars.InsertValue(0,IN ) scalars.InsertValue...
def is_email_valid(email): if not '@' in email: return False name, domain = email.split('@', 1) if not name: return False return '.' in domain
class Solution: """ @param str: An array of char @param offset: An integer @return: nothing """ def rotateString(self, str, offset): ''' abcdefg dcba gfe efgabcd ''' n = len(str) if n == 0: return offset %= n s...
''' Doctor's Secret Cheeku is ill. He goes to Homeopathic Doctor - Dr. Thind. Doctor always recommends medicines after reading from a secret book that he has. This secret book has recipe to cure any disease. Cheeku is chalak. He wants to know if Doctor is giving him correct medicine or not. So he asks Doctor 2 quest...
# Copyright 2018 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. """Content public presubmit script See https://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details about the presubmit API bui...
# This file holds metadata about the project. It should import only from # standard library modules (this includes not importing other modules in the # package) so that it can be loaded by setup.py before dependencies are # installed. source = "https://github.com/wikimedia/wmfdata-python" version = "1.3.3"
''' Pattern Enter number of rows: 5 54321 4321 321 21 1 ''' print('number pattern: ') number_rows=int(input('Enter number of rows: ')) for row in range(number_rows,0,-1): for column in range(row,0,-1): if column < 10: print(f'0{column}',end=' ') else: print(column,end=' ') print()
frase = 'Curso Em Vídeo Python' print(frase.replace('Python','Android')) ''' |c|u|r|s|o| |e|m| |v|í|d|e|o| |p|y|t|h|o|n| 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 ''' #fatiamento print(frase[9]) print(frase[9:21]) # print(frase[9:21:2]) #x:y:z z = pular de 2 em 2 print(frase[:5]) #começa no 0 e termina no 5 print(fr...
class Solution: def threeSum(self, nums): arr = [] map = {nums[i]: i for i in range(len(nums))} if (len(list(map.keys())) == 1 and nums[0] == 0 and len(nums) > 3): return [[0]*3] for m in range(len(nums)-1): for n in range(m+1, len(nums)): targ...
def containsCloseNums(nums, k): ''' Given an array of integers nums and an integer k, determine whether there are two distinct indices i and j in the array where nums[i] = nums[j] and the absolute difference between i and j is less than or equal to k. Example For nums = [0, 1, 2, 3, 5, 2] and k = 3, the output sh...
class Solution: def projectionArea(self, grid): """ :type grid: List[List[int]] :rtype: int """ M, N = len(grid), len(grid[0]) rowMax, colMax = [0] * M, [0] * N xy = sum(0 if grid[i][j] == 0 else 1 for i in range(M) for j in range(N)) xz = sum(list(map...
class C(): pass # a really complex class class D(C, B): pass
num = 353 reverse_num = 0 temp = num # print(num,reverse_num) while(temp != 0): remainder = int(temp % 10) print(remainder) reverse_num = int((reverse_num*10) + remainder) print(reverse_num) temp = int(temp / 10) # print(reverse_num) if reverse_num == num: print('It is Palindrome') else: p...