content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
print("hola mundo") x=4 y=2 print(x+y) #suma=x+y #print(suma) #suma
print('hola mundo') x = 4 y = 2 print(x + y)
# -*- coding: latin-1 -*- generation = 8 def evolve(addressbook): """No longer needed."""
generation = 8 def evolve(addressbook): """No longer needed."""
# # PySNMP MIB module REDLINE-AN50-PMP-V2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/REDLINE-AN50-PMP-V2-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:46:50 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_range_constraint, single_value_constraint, constraints_intersection, value_size_constraint) ...
# -*- coding: utf-8 -*- # @Time: 2020/5/8 22:38 # @Author: GraceKoo # @File: interview_2.py # @Desc: https://leetcode-cn.com/problems/ti-huan-kong-ge-lcof/ class Solution: def replaceSpace(self, s: str) -> str: s_list = list() for s_value in s: if s_value == " ": s_list...
class Solution: def replace_space(self, s: str) -> str: s_list = list() for s_value in s: if s_value == ' ': s_list.append('%20') else: s_list.append(s_value) return ''.join(s_list) so = solution() print(so.replaceSpace('We are happy.'...
class Statement: transactions = [] def append_transaction(self, transaction): self.transactions.append(transaction) def print(self): for transaction in self.transactions: print(str(transaction))
class Statement: transactions = [] def append_transaction(self, transaction): self.transactions.append(transaction) def print(self): for transaction in self.transactions: print(str(transaction))
lista = [] dados = [] oper = '' maior = menor = 0 nomeMaior = '' nomeMenor = '' while oper != 'sair': dados.append(str(input('Digite o seu nome: '))) dados.append(int(input('Digite o seu peso: '))) if len(lista) == 0: maior = menor = dados[1] else: if dados[1] > maior: maior...
lista = [] dados = [] oper = '' maior = menor = 0 nome_maior = '' nome_menor = '' while oper != 'sair': dados.append(str(input('Digite o seu nome: '))) dados.append(int(input('Digite o seu peso: '))) if len(lista) == 0: maior = menor = dados[1] else: if dados[1] > maior: maio...
"""Leetcode 3. Longest Substring Without Repeating Characters Medium URL: https://leetcode.com/problems/longest-substring-without-repeating-characters/ Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer is "abc", wit...
"""Leetcode 3. Longest Substring Without Repeating Characters Medium URL: https://leetcode.com/problems/longest-substring-without-repeating-characters/ Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer is "abc", wit...
""" Author: Stephen Thomas Date Created: 23 December 2017 Basic implementation of an undirected graph Github Link: https://github.com/Mewzyk/stephen_AI.git """ class Node: def __init__(self, key, neighbors = []): self.key = key self.neighbors = set(neighbors) class Graph: def __init__(self, gr...
""" Author: Stephen Thomas Date Created: 23 December 2017 Basic implementation of an undirected graph Github Link: https://github.com/Mewzyk/stephen_AI.git """ class Node: def __init__(self, key, neighbors=[]): self.key = key self.neighbors = set(neighbors) class Graph: def __init__(self, gr...
class FeedException(Exception): def __init__(self, *args, **kwargs): self.message = kwargs.pop('message')
class Feedexception(Exception): def __init__(self, *args, **kwargs): self.message = kwargs.pop('message')
# -*- coding: utf-8 -*- _name1 = [ 'Chikorita', 'Bayleef', 'Meganium', 'Cyndaquil', 'Quilava', 'Typhlosion', 'Totodile', 'Croconaw', 'Feraligatr', 'Sentret', 'Furret', 'Hoothoot', 'Noctowl', 'Ledyba', 'Ledian', 'Spinarak', 'Ariados', 'Crobat', 'Chinchou', 'Lanturn', 'Pichu', 'Cleffa', 'Igglybuff', ...
_name1 = ['Chikorita', 'Bayleef', 'Meganium', 'Cyndaquil', 'Quilava', 'Typhlosion', 'Totodile', 'Croconaw', 'Feraligatr', 'Sentret', 'Furret', 'Hoothoot', 'Noctowl', 'Ledyba', 'Ledian', 'Spinarak', 'Ariados', 'Crobat', 'Chinchou', 'Lanturn', 'Pichu', 'Cleffa', 'Igglybuff', 'Togepi', 'Togetic', 'Natu', 'Xatu', 'Mareep',...
# Solution to part 2 of day 14 of AOC 2015, Reindeer Olympics # https://adventofcode.com/2015/day/14 f = open('input.txt') whole_text = f.read() f.close() race = 2503 deers = {} all_deers = {} for line in whole_text.split('\n'): # print(line) # Example, # Comet can fly 14 km/s for 10 seconds, but then m...
f = open('input.txt') whole_text = f.read() f.close() race = 2503 deers = {} all_deers = {} for line in whole_text.split('\n'): (reindeer, _, _, speed_str, _, _, fly_str, _, _, _, _, _, _, rest_str, _) = line.split(' ') (speed, fly, rest) = (int(speed_str), int(fly_str), int(rest_str)) deers[reindeer] = 0 ...
# Copyright (c) 2011-2014 Turbulenz Limited """HTTP exceptions Apps Provides API Level exceptions for webdevelopers (those exceptions get caught and passed back as error Callbacks to the client) """ class PostOnlyException(BaseException): def __init__(self, value): super(PostOnlyException, self).__init__...
"""HTTP exceptions Apps Provides API Level exceptions for webdevelopers (those exceptions get caught and passed back as error Callbacks to the client) """ class Postonlyexception(BaseException): def __init__(self, value): super(PostOnlyException, self).__init__() self.value = value def __st...
class Solution: def isPalindrome(self, x): """ :type x: int :rtype: bool """ self.x=x if x<0: return False x=str(x) length=len(x) i=0 j=length-1 for i in range(length//2): if x[i]!=x[len...
class Solution: def is_palindrome(self, x): """ :type x: int :rtype: bool """ self.x = x if x < 0: return False x = str(x) length = len(x) i = 0 j = length - 1 for i in range(length // 2): if x[i] != x[l...
"""Metric base class for new user-defined metrics.""" class MetricBase(object): """Metric template class.""" def __init__( self, *args, **kwds ): pass def process_token(self, token): """Handle processing for each token.""" pass def display(self): """Display the metric ...
"""Metric base class for new user-defined metrics.""" class Metricbase(object): """Metric template class.""" def __init__(self, *args, **kwds): pass def process_token(self, token): """Handle processing for each token.""" pass def display(self): """Display the metric f...
word=input() n=int(input()) first_half=word[:n] second_half=word[n+1:] result=(first_half+second_half) print(result)
word = input() n = int(input()) first_half = word[:n] second_half = word[n + 1:] result = first_half + second_half print(result)
class Test: """ This is the class """ _prop = 1 @property def prop(self): """ This is the getter """ return self._prop @prop.setter def prop(self, val): """ This is the setter """ self._prop = val
class Test: """ This is the class """ _prop = 1 @property def prop(self): """ This is the getter """ return self._prop @prop.setter def prop(self, val): """ This is the setter """ self._prop = val
# pyre-ignore-all-errors # TODO: Change `pyre-ignore-all-errors` to `pyre-strict` on line 1, so we get # to see all type errors in this file. # We mentioned in the talk that consuming values of union type often requires a # case split. But there are also cases where the case split is not necessary. # This example dem...
class Dog: def bark(self) -> None: print('Whoof! Whoof!') def play(self) -> None: print('Dog playing!') def chase(self, dog: Dog) -> None: print('Dog is chasing another dog!') class Cat: def meow(self) -> None: print('Meow! Meow!') def play(self) -> None: ...
def calculateWeight(name, allSupporters): summation = 0 if (len(allSupporters[name]) > 1): for e in allSupporters[name][1]: summation += calculateWeight(e, allSupporters) return allSupporters[name][0]+summation def findAppropriateTree(name, allSupporters): allWeights = [] for i ...
def calculate_weight(name, allSupporters): summation = 0 if len(allSupporters[name]) > 1: for e in allSupporters[name][1]: summation += calculate_weight(e, allSupporters) return allSupporters[name][0] + summation def find_appropriate_tree(name, allSupporters): all_weights = [] f...
# Task 1 - Highest occurrence def highest_occurrence(array): """ Time: O(n) Space: O(n) :param array: strings, int or floats, can be mixed :return: array containing element(s) with the highest occurrences without type coercion. Returns an empty array if given array is empty. """ # h...
def highest_occurrence(array): """ Time: O(n) Space: O(n) :param array: strings, int or floats, can be mixed :return: array containing element(s) with the highest occurrences without type coercion. Returns an empty array if given array is empty. """ counted = {} for item in array...
# Performing operations on the DataFrame # DataFrame transformations # select() # filter() # groupby() # orderby() # dropDuplicates() # withColumnRenamed() # DataFrame actions # printSchema() # head() # show() # count() # columns # describe() # 1. Initial EDA # Print the first 10 observations people_df.show(10) # ...
people_df.show(10) print('There are {} rows in the people_df DataFrame.'.format(people_df.count())) print('There are {} columns in the people_df DataFrame and their names are {}'.format(len(people_df.columns), people_df.columns)) people_df_sub = people_df.select('name', 'sex', 'date of birth') people_df_sub.show(10) pe...
# Headers copied directly from browser request static = { 'accept': 'application/json, text/plain, */*', 'accept-encoding': 'gzip, deflate, br', 'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8', 'referer': 'https://www.nowgatewayx.com/login', 'sec-ch-ua': '"Chromium";v="94", "Google Chrome";v="94", "...
static = {'accept': 'application/json, text/plain, */*', 'accept-encoding': 'gzip, deflate, br', 'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8', 'referer': 'https://www.nowgatewayx.com/login', 'sec-ch-ua': '"Chromium";v="94", "Google Chrome";v="94", ";Not A Brand";v="99"', 'sec-ch-ua-mobile': '?0', 'sec-ch-ua-platform...
def return_func(): pass def func(): return return_func a = func() a()
def return_func(): pass def func(): return return_func a = func() a()
n = int(input()) a = set(map(int, input().split())) m = int(input()) b = set(map(int, input().split())) d = list(a.union(b).difference(a.intersection(b))) d.sort() for i in d: print(i)
n = int(input()) a = set(map(int, input().split())) m = int(input()) b = set(map(int, input().split())) d = list(a.union(b).difference(a.intersection(b))) d.sort() for i in d: print(i)
# # @lc app=leetcode.cn id=43 lang=python3 # # [43] multiply-strings # None # @lc code=end
None
class AdbNoStartError(Exception): pass class NoSuchProcessNameError(Exception): pass class CommandError(Exception): pass class ConfigError(Exception): pass class PlatformNoSupport(Warning): """ Base class for warnings about deprecated features. """ pass
class Adbnostarterror(Exception): pass class Nosuchprocessnameerror(Exception): pass class Commanderror(Exception): pass class Configerror(Exception): pass class Platformnosupport(Warning): """ Base class for warnings about deprecated features. """ pass
"""Performance analysis of different implementations of 2d finite difference wave propagation. """ __version__ = '0.0.1'
"""Performance analysis of different implementations of 2d finite difference wave propagation. """ __version__ = '0.0.1'
class PortfolioFilter: def __init__(self, column, options=None, portfolio_options=None, values=None, industry_codes=None, inverted=False, include_null=False, domain=None): self.key = column + '-0' self.column = column self.options = options if options is not None else [] ...
class Portfoliofilter: def __init__(self, column, options=None, portfolio_options=None, values=None, industry_codes=None, inverted=False, include_null=False, domain=None): self.key = column + '-0' self.column = column self.options = options if options is not None else [] self.portfo...
"""Constants needed by ISAPI filters and extensions.""" # ====================================================================== # Copyright 2002-2003 by Blackdog Software Pty Ltd. # # All Rights Reserved # # Permission to use, copy, modify, and distribute this software and # its document...
"""Constants needed by ISAPI filters and extensions.""" http_continue = 100 http_switching_protocols = 101 http_processing = 102 http_ok = 200 http_created = 201 http_accepted = 202 http_non_authoritative = 203 http_no_content = 204 http_reset_content = 205 http_partial_content = 206 http_multi_status = 207 http_multip...
# There's no logic or real code here... just data. You need to add some code to # the test! alice_name = "Alice" alice_age = 20 alice_is_drinking = True bob_name = "Bob" bob_age = 12 bob_is_drinking = False charles_name = "Charles" charles_age = 22 charles_is_drinking = True
alice_name = 'Alice' alice_age = 20 alice_is_drinking = True bob_name = 'Bob' bob_age = 12 bob_is_drinking = False charles_name = 'Charles' charles_age = 22 charles_is_drinking = True
def test_role_check(test_role): test_role = test_role.refresh() assert test_role.id assert test_role.slug == "test" def test_role_update(test_role): assert test_role.slug == "test" test_role.slug = "test1" test_role.save() assert test_role.refresh().slug == "test1"
def test_role_check(test_role): test_role = test_role.refresh() assert test_role.id assert test_role.slug == 'test' def test_role_update(test_role): assert test_role.slug == 'test' test_role.slug = 'test1' test_role.save() assert test_role.refresh().slug == 'test1'
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None # Solution 1 class Solution(object): def inorderTraversal(self, root): """ :type root: TreeNode :rtype: List[int] ...
class Solution(object): def inorder_traversal(self, root): """ :type root: TreeNode :rtype: List[int] """ (stack, result) = ([], []) current_node = root while currentNode is not None or len(stack) > 0: while currentNode is not None: ...
# Couchbase metrics list couchbase_metrics = { 'cluster': { 'url': '/pools/default/', 'metrics': [ {'name':'storageTotals.ram.total','id':'storageTotals.ram.total','suffix':'bytes','labels':['name']}, {'name':'storageTotals.ram.used','id':'storageTotals.ram.used','suffix':'by...
couchbase_metrics = {'cluster': {'url': '/pools/default/', 'metrics': [{'name': 'storageTotals.ram.total', 'id': 'storageTotals.ram.total', 'suffix': 'bytes', 'labels': ['name']}, {'name': 'storageTotals.ram.used', 'id': 'storageTotals.ram.used', 'suffix': 'bytes', 'labels': ['name']}, {'name': 'storageTotals.ram.usedB...
# # 12. Integer to Roman # # Roman numerals are represented by seven different symbols: I, V, X, L, C, D, M # # Symbols Value # # I 1 # V 5 # X 10 # L 50 # C 100 # D 500 # M 1000 # # For example, two is written ...
class Solution(object): def int_to_roman(self, num): """ :type num: int :rtype: str """ mapping = [(1000, 'M'), (900, 'CM'), (500, 'D'), (400, 'CD'), (100, 'C'), (90, 'XC'), (50, 'L'), (40, 'XL'), (10, 'X'), (9, 'IX'), (5, 'V'), (4, 'IV'), (1, 'I')] nums = [] ...
# for i in [0, 1, 2, 3, 4, 5]: # print(i) # for j in range(10): # print(j) names = ["Harry", "Ron", "Hermione", "Ginny"] for character in names: print(character)
names = ['Harry', 'Ron', 'Hermione', 'Ginny'] for character in names: print(character)
def _get_parent_index(child_index): if child_index == 0: return None return (child_index - 1) // 2 def _get_left_child_index(parent_index): return parent_index * 2 + 1 def _get_right_child_index(child_index): return child_index * 2 + 2 def _check_min_heap_invariant(min_heap): if min_he...
def _get_parent_index(child_index): if child_index == 0: return None return (child_index - 1) // 2 def _get_left_child_index(parent_index): return parent_index * 2 + 1 def _get_right_child_index(child_index): return child_index * 2 + 2 def _check_min_heap_invariant(min_heap): if min_heap....
class Product(): def __init__(self, requirements: list): self.requirements = [] for r in requirements: self.requirements.append(r.type) class Requirement(): def __init__(self, _type: str, name): self.name = name self.type = _type
class Product: def __init__(self, requirements: list): self.requirements = [] for r in requirements: self.requirements.append(r.type) class Requirement: def __init__(self, _type: str, name): self.name = name self.type = _type
p = 196732205348849427366498732223276547339 secret = 4919 # Solved through brute force that secret = 4919, see sageSecret def calc_root(num, mod, n): #Create a modular ring with mod as the modulus f = GF(mod) # temp = num mod Modulus temp = f(num) #Calculate the nth root temp on this modular field ...
p = 196732205348849427366498732223276547339 secret = 4919 def calc_root(num, mod, n): f = gf(mod) temp = f(num) return temp.nth_root(n) def gen_v_list(primelist, p, secret): a = [] for prime in primelist: a.append(calc_root(prime, p, secret)) return a def decode_int(i, primelist): ...
n = int(input()) a = list(map(int, input().split())) ss = sum(a) a.sort() if ss%2 == 1: for i in range(0, n): if a[i]%2 == 1: ss -= a[i] break print(ss)
n = int(input()) a = list(map(int, input().split())) ss = sum(a) a.sort() if ss % 2 == 1: for i in range(0, n): if a[i] % 2 == 1: ss -= a[i] break print(ss)
n = input("Enter a binary number to convert to decimal: ") bit_exp = 0 decimals = [] for bit in n[::-1]: if int(bit) == 1: decimals.append(2**bit_exp) bit_exp += 1 decimal = sum(decimals) print(decimals) print(decimal) '''Varigarble -- 2020'''
n = input('Enter a binary number to convert to decimal: ') bit_exp = 0 decimals = [] for bit in n[::-1]: if int(bit) == 1: decimals.append(2 ** bit_exp) bit_exp += 1 decimal = sum(decimals) print(decimals) print(decimal) 'Varigarble -- 2020'
def main(data,n): initial = n dict = {} for i in range(n): dict[data[i]] = True # Check for initial value if data[i]==initial: s = '' while initial in dict: s += str(initial) + ' ' initial -= 1 print(s) else:...
def main(data, n): initial = n dict = {} for i in range(n): dict[data[i]] = True if data[i] == initial: s = '' while initial in dict: s += str(initial) + ' ' initial -= 1 print(s) else: print(' ') if __na...
# __init__.py # Version of the turtlefy package __version__ = "0.8.12"
__version__ = '0.8.12'
#enter the celcius temperature to be converted Celcius_temperature = float(input("Enter celcius temperature: ")) #formula for converting celcius temperature to fahrenheit temperature Fahrenheit = (Celcius_temperature * (9/5)) + 32 #printing the fahrenheit temperature print(Fahrenheit)
celcius_temperature = float(input('Enter celcius temperature: ')) fahrenheit = Celcius_temperature * (9 / 5) + 32 print(Fahrenheit)
n=int(input()) matrix=[0]*(n+1) dp=[[[0]*2 for j in range(n+1)] for i in range(n+1)] dp2=[[[0]*2 for j in range(n+1)] for i in range(n+1)] for i in range(1,n+1): matrix[i]=[0] matrix[i].extend([*map(int,input().split())]) ans=0 for i in range(1,n+1): for j in range(1,n+1): dp[i][j][1]=dp2[i][j][1]=...
n = int(input()) matrix = [0] * (n + 1) dp = [[[0] * 2 for j in range(n + 1)] for i in range(n + 1)] dp2 = [[[0] * 2 for j in range(n + 1)] for i in range(n + 1)] for i in range(1, n + 1): matrix[i] = [0] matrix[i].extend([*map(int, input().split())]) ans = 0 for i in range(1, n + 1): for j in range(1, n + ...
def readint(): while True: try: num = int(input('Insert a integer:')) if type(num) == int: return num except: print('\033[1;31mERROR: Please, insert a valid integer.\033[m')
def readint(): while True: try: num = int(input('Insert a integer:')) if type(num) == int: return num except: print('\x1b[1;31mERROR: Please, insert a valid integer.\x1b[m')
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
project = 'Fortran Programming Language' copyright = '' author = '' extensions = ['ablog', 'myst_parser', 'sphinx_panels', 'sphinx.ext.intersphinx'] templates_path = ['_templates'] exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] html_theme = 'pydata_sphinx_theme' html_static_path = ['_static'] html_css_files = ...
def tem_bomba_direita(board, position): if position + 1 >= len(board): return False if board[position+1] == "*": return True return False def tem_bomba_esquerda(board, position): if position - 1 < 0: return False if board[position-1] == "*": return True return F...
def tem_bomba_direita(board, position): if position + 1 >= len(board): return False if board[position + 1] == '*': return True return False def tem_bomba_esquerda(board, position): if position - 1 < 0: return False if board[position - 1] == '*': return True retur...
class Error(Exception): """Base class for exceptions in this module.""" pass class UnknownError(Error): def __init__(self, text=''): message = 'An internal error has occurred. Please try your query again at a later time.' if text == '': log_message = 'Unknown error occurred. P...
class Error(Exception): """Base class for exceptions in this module.""" pass class Unknownerror(Error): def __init__(self, text=''): message = 'An internal error has occurred. Please try your query again at a later time.' if text == '': log_message = 'Unknown error occurred. Pe...
i01.integratedMovement.removeObject("pole") i01.integratedMovement.removeAi("kinect",i01.integratedMovement.Ai.AVOID_COLLISION) i01.rest() sleep(3) i01.integratedMovement.moveTo("rightArm",-300,500,400) mouth.speakBlocking("Hello, I am vinmoov") sleep(3) i01.rest() mouth.speakBlocking("I want to talk to you about a new...
i01.integratedMovement.removeObject('pole') i01.integratedMovement.removeAi('kinect', i01.integratedMovement.Ai.AVOID_COLLISION) i01.rest() sleep(3) i01.integratedMovement.moveTo('rightArm', -300, 500, 400) mouth.speakBlocking('Hello, I am vinmoov') sleep(3) i01.rest() mouth.speakBlocking('I want to talk to you about a...
# Authors: David Mutchler, Dave Fisher, and many others before them. print('Hello, World') print('hi there') print('one', 'two', 'through my shoe') print(3 + 9) print('3 + 9', 'versus', 3 + 9) # done: After we talk together about the above, add PRINT statements that print: # done: 1. A Hello message to a friend. ...
print('Hello, World') print('hi there') print('one', 'two', 'through my shoe') print(3 + 9) print('3 + 9', 'versus', 3 + 9) print('hi mommy') print('2345 + 3467 =', 2345 + 3467) print('3607 * 34227 =', 3607 * 34227) for x in range(10): print('I Love You Daddy!') for x in range(10): print('I love you', x + 2)
def removeDuplicates(nums): n = len(nums) mp = {} for i in range(0 , n): if nums[i] not in mp: mp[nums[i]] = nums[i] op = mp.keys() return op op = removeDuplicates([0,0,1,1,1,2,2,3,3,4]) print(op)
def remove_duplicates(nums): n = len(nums) mp = {} for i in range(0, n): if nums[i] not in mp: mp[nums[i]] = nums[i] op = mp.keys() return op op = remove_duplicates([0, 0, 1, 1, 1, 2, 2, 3, 3, 4]) print(op)
c.NotebookApp.open_browser = False c.NotebookApp.ip='0.0.0.0' #'*' c.NotebookApp.port = 8192 c.NotebookApp.password = u'sha1:45f7d7ac038c:c36b98f22eac5921c435095af65a9a00b0e1eeb9' c.Authenticator.admin_users = {'jupyter'} c.LocalAuthenticator.create_system_users = True
c.NotebookApp.open_browser = False c.NotebookApp.ip = '0.0.0.0' c.NotebookApp.port = 8192 c.NotebookApp.password = u'sha1:45f7d7ac038c:c36b98f22eac5921c435095af65a9a00b0e1eeb9' c.Authenticator.admin_users = {'jupyter'} c.LocalAuthenticator.create_system_users = True
#Actividad 7 Ejercicios For numeros = [1, 2, 3, 4, 5, 6, 7, 8 , 9, 10] numeros2 = [1, 2, 3, 4, 5, 6, 7, 8 , 9, 10] cadena="BIENVENIDOS" indice=0 for letra in "UNIVERSIDAD ESTATAL DE SONORA": print(letra) else: print("FIN DEL BUCLE") for i in numeros: print(i) print("") for x in numeros: ...
numeros = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] numeros2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] cadena = 'BIENVENIDOS' indice = 0 for letra in 'UNIVERSIDAD ESTATAL DE SONORA': print(letra) else: print('FIN DEL BUCLE') for i in numeros: print(i) print('') for x in numeros: x *= 20 print(x) for x in numeros:...
sulfideToNitrileAddition = [ruleGMLString("""rule [ ruleID "Sulfide to Nitrile Addition" labelType "term" left [ edge [ source 2 target 3 label "#" ] edge [ source 4 target 5 label "-" ] ] context [ edge [ source 1 target 2 label "-" ] edge [ source 5 target 6 label "-" ] node [ id 1 label "*" ] n...
sulfide_to_nitrile_addition = [rule_gml_string('rule [\n\truleID "Sulfide to Nitrile Addition" \n labelType "term"\n\tleft [\n\t\tedge [ source 2 target 3 label "#" ]\n\t\tedge [ source 4 target 5 label "-" ]\n\t] \n\tcontext [\n\t\tedge [ source 1 target 2 label "-" ]\n\t\tedge [ source 5 target 6 label "-" ]\n\t\t...
# Kalman filter | KalmanFilter(VAR, EST_VAR) STD_DEV = 0.075 VAR = 0.1 EST_VAR = STD_DEV ** 2 # PID P_ = 3.6 I_ = 0.02 D_ = 0.6 PID_MIN_VAL = -50 PID_MAX_VAL = 50
std_dev = 0.075 var = 0.1 est_var = STD_DEV ** 2 p_ = 3.6 i_ = 0.02 d_ = 0.6 pid_min_val = -50 pid_max_val = 50
class Solution: def countGoodTriplets(self, arr: List[int], a: int, b: int, c: int) -> int: s1=0 x=len(arr) for i in range(x-2): for j in range(i+1,x-1): if abs(arr[i]-arr[j])<=a: for k in range(j+1,x): if abs(arr[j]-arr...
class Solution: def count_good_triplets(self, arr: List[int], a: int, b: int, c: int) -> int: s1 = 0 x = len(arr) for i in range(x - 2): for j in range(i + 1, x - 1): if abs(arr[i] - arr[j]) <= a: for k in range(j + 1, x): ...
for i in range(int(input())): x = list(map(int, input().split())) x.sort() print(x[-2])
for i in range(int(input())): x = list(map(int, input().split())) x.sort() print(x[-2])
# # PySNMP MIB module VPMT-OPT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/VPMT-OPT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:28:31 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,...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constraint, single_value_constraint, constraints_intersection, constraints_union) ...
# Define minimum distance threshold in map dist_thresh = 0.5 scaling_factor = int(1 / dist_thresh) # Define threshold around goal goal_thresh = int(scaling_factor * 1.5) # Define map size width, height = 300, 200 map_size = (scaling_factor * height), (scaling_factor * width) # Define all the possible no. of actions max...
dist_thresh = 0.5 scaling_factor = int(1 / dist_thresh) goal_thresh = int(scaling_factor * 1.5) (width, height) = (300, 200) map_size = (scaling_factor * height, scaling_factor * width) max_actions = 5 half_actions = max_actions // 2 total_angle = 360 no_parent = -1 node_generated = 1 start_parent = -99
def outside(r, c, size): if r < 0 or c < 0 or r >= size or c >= size: return True return False def get_next_pos(r, c, command): if command == 'up': return r - 1, c elif command == 'down': return r + 1, c elif command == 'left': return r, c - 1 elif command == 'r...
def outside(r, c, size): if r < 0 or c < 0 or r >= size or (c >= size): return True return False def get_next_pos(r, c, command): if command == 'up': return (r - 1, c) elif command == 'down': return (r + 1, c) elif command == 'left': return (r, c - 1) elif comman...
# eradicate a destroyed file system snapshot named myfs.mysnap client.delete_file_system_snapshots(names=["myfs.mysnap"]) # Other valid fields: ids # See section "Common Fields" for examples
client.delete_file_system_snapshots(names=['myfs.mysnap'])
''' The Olympic competitions between 1952 and 1988 took place during the height of the Cold War between the United States of America (USA) & the Union of Soviet Socialist Republics (USSR). Your goal in this exercise is to aggregate the number of distinct sports in which the USA and the USSR won medals during the Cold W...
""" The Olympic competitions between 1952 and 1988 took place during the height of the Cold War between the United States of America (USA) & the Union of Soviet Socialist Republics (USSR). Your goal in this exercise is to aggregate the number of distinct sports in which the USA and the USSR won medals during the Cold W...
grades = int(input()) name_exam = str(input()) grade = int(input()) poor_grade = 0 pas = True average = 0 problems_solved = 0 last_name_exam = str() while name_exam != "Enough": if int(grade) <= 4: poor_grade += 1 if poor_grade == grades: pas = False break problems_solved += 1 a...
grades = int(input()) name_exam = str(input()) grade = int(input()) poor_grade = 0 pas = True average = 0 problems_solved = 0 last_name_exam = str() while name_exam != 'Enough': if int(grade) <= 4: poor_grade += 1 if poor_grade == grades: pas = False break problems_solved += 1 av...
# Coding is all about making things easier for ourselves. # Some times you will be writing the same code over and # over again. When this happens, it is often best to write # a function. # functions are defined with the def keyword: def paulsFunction(): # anything inside the function will execute when I call it ...
def pauls_function(): print('Hello! Nice function!') pauls_function()
#! /usr/bin/env python """A package that implements HTTP 1.1""" __all__ = ['grammar', 'params', 'messages', 'auth', 'client']
"""A package that implements HTTP 1.1""" __all__ = ['grammar', 'params', 'messages', 'auth', 'client']
def narcissistic(num): sum = 0 iterableNum = str(num) for i in iterableNum: sum += int(i) ** len(iterableNum) return True if sum == num else False # One-liner: def narcissistic2(num): return num == sum(int(i) ** len(str(num)) for i in str(num))
def narcissistic(num): sum = 0 iterable_num = str(num) for i in iterableNum: sum += int(i) ** len(iterableNum) return True if sum == num else False def narcissistic2(num): return num == sum((int(i) ** len(str(num)) for i in str(num)))
def answer_type(request, json_list, nested): for question in json_list: if question['payload']['object_type'] == 'task_instance': question['answer_class'] = 'task_answer'
def answer_type(request, json_list, nested): for question in json_list: if question['payload']['object_type'] == 'task_instance': question['answer_class'] = 'task_answer'
def test_example_resource(example_resource): """Check that the example resource was loaded correctly.""" assert len(example_resource) == 4 assert example_resource[0]["average"] == 6.29
def test_example_resource(example_resource): """Check that the example resource was loaded correctly.""" assert len(example_resource) == 4 assert example_resource[0]['average'] == 6.29
#!/usr/bin/env python # Copyright (c) 2013. Mark E. Madsen <mark@madsenlab.org> # # This work is licensed under the terms of the Apache Software License, Version 2.0. See the file LICENSE for details. """ Description here """ def getMingConfiguration(modules): config = {} for module in modules: url...
""" Description here """ def get_ming_configuration(modules): config = {} for module in modules: urlstring = 'mongodb://' urlstring += dbhost urlstring += ':' urlstring += dbport urlstring += '/' key = '' key += 'ming.' key += module._get_dataobj...
# Solution 1 # def remove_duplicates(arr): # val_tracker = {} # for num in arr: # if num not in arr: # val_tracker[num] = 1 # else: # print('True') # return True # print('False') # return False # Solution 2 def remove_duplicates(arr): unique ...
def remove_duplicates(arr): unique = set(arr) if len(unique) != len(arr): print('True') return True else: print('False') return False test_arr = [1, 1, 1, 1, 2, 3, 4, 5, 5, 5] answer_arr = set(test_arr) remove_duplicates(test_arr)
index = 1 result = 0 while index < 1000: if index % 3 ==0 or index % 5 == 0: result = result + index index = index + 1 print(result)
index = 1 result = 0 while index < 1000: if index % 3 == 0 or index % 5 == 0: result = result + index index = index + 1 print(result)
class NoticeModel: def __init__(self, dbRow): self.ID = dbRow["ID"] self.Message = dbRow["Message"] self.Timestamp = dbRow["Timestamp"]
class Noticemodel: def __init__(self, dbRow): self.ID = dbRow['ID'] self.Message = dbRow['Message'] self.Timestamp = dbRow['Timestamp']
def keep_one_mRNA_with_same_stop_codon_position(f): output = [] nameset = set() with open(f, 'r') as FILE: for line in FILE: if line[0] == '#': output.append(line.strip()) else: s = line.strip().split('\t') if s[6] ==...
def keep_one_m_rna_with_same_stop_codon_position(f): output = [] nameset = set() with open(f, 'r') as file: for line in FILE: if line[0] == '#': output.append(line.strip()) else: s = line.strip().split('\t') if s[6] == '+': ...
class Building(object): def __init__(self, south, west, width_WE, width_NS, height=10): self.south = south self.west = west self.width_WE = width_WE self.width_NS = width_NS self.height = height def corners(self): north_west = [self.south+self.width_NS, self....
class Building(object): def __init__(self, south, west, width_WE, width_NS, height=10): self.south = south self.west = west self.width_WE = width_WE self.width_NS = width_NS self.height = height def corners(self): north_west = [self.south + self.width_NS, self.w...
def bio(*args): header = ["Name", "Roll no.", "Regd no.", "Branch", "Stream", "Sem", "Phone no.", "Address"] for head, data in zip(header, args): print("%-10s: %s"%(head, data)) bio("Md.Azharuddin", "36725", "1701105431", "CSE", "B.Tech", "7th", "9078600498", "Arad Bazar, Balasore")
def bio(*args): header = ['Name', 'Roll no.', 'Regd no.', 'Branch', 'Stream', 'Sem', 'Phone no.', 'Address'] for (head, data) in zip(header, args): print('%-10s: %s' % (head, data)) bio('Md.Azharuddin', '36725', '1701105431', 'CSE', 'B.Tech', '7th', '9078600498', 'Arad Bazar, Balasore')
# -*- coding: utf-8 -*- """ HackerRank practice problems Companies: Dialpad, etc """ "print odd numbers between l and r" def oddNumbers(l, r): odd = [] while l<=r: if l%2!=0: odd.append(l) l+=2 elif l==0: l+=1 else: l+=1 return odd "pr...
""" HackerRank practice problems Companies: Dialpad, etc """ 'print odd numbers between l and r' def odd_numbers(l, r): odd = [] while l <= r: if l % 2 != 0: odd.append(l) l += 2 elif l == 0: l += 1 else: l += 1 return odd 'print multi...
def sum_list(x): sum = 0 for i in x: sum += i return sum def str_cvt_lower(s): """konversi besar->kecil""" return s.lower() def str_cvt_upper(s): """konversi kecil->besar""" return s.upper()
def sum_list(x): sum = 0 for i in x: sum += i return sum def str_cvt_lower(s): """konversi besar->kecil""" return s.lower() def str_cvt_upper(s): """konversi kecil->besar""" return s.upper()
def sum_of_multiples(limit: int, factors: list) -> int: """Give sum of all the multiples of given numbers untill given limit""" set_of_multiples = {i for factor in factors if factor != 0 for i in range(factor, limit, factor) ...
def sum_of_multiples(limit: int, factors: list) -> int: """Give sum of all the multiples of given numbers untill given limit""" set_of_multiples = {i for factor in factors if factor != 0 for i in range(factor, limit, factor)} return sum(set_of_multiples)
class Subscription(object): def __init__(self, sid, subject, queue, callback, connetion): self.sid = sid self.subject = subject self.queue = queue self.connetion = connetion self.callback = callback self.received = 0 self.delivered = 0 self.bytes = 0 ...
class Subscription(object): def __init__(self, sid, subject, queue, callback, connetion): self.sid = sid self.subject = subject self.queue = queue self.connetion = connetion self.callback = callback self.received = 0 self.delivered = 0 self.bytes = 0 ...
""" Global Django Town exception and warning classes. """ class SettingError(Exception): pass class ThirdPartyDependencyError(Exception): pass
""" Global Django Town exception and warning classes. """ class Settingerror(Exception): pass class Thirdpartydependencyerror(Exception): pass
class Animation(): def __init__(self): self.vertex_n = 0 self.verticies = [] def get_coord(self, V_kind): print("\n\t***\nFor vertex %s please enter:\n" % V_kind) x = input('X: ') y = input('Y: ') z = input('Z: ') pos = [x, y, z] return pos def add_Vertex(self):...
class Animation: def __init__(self): self.vertex_n = 0 self.verticies = [] def get_coord(self, V_kind): print('\n\t***\nFor vertex %s please enter:\n' % V_kind) x = input('X: ') y = input('Y: ') z = input('Z: ') pos = [x, y, z] return pos de...
with open("input.txt", "r") as f: lines = [line.strip() for line in f.readlines()] gamma = "" epsilon = "" for i in range(0, len(lines[0])): zero = 0 one = 0 for line in lines: if line[i] == "0": zero += 1 else: one += 1 if(zero >...
with open('input.txt', 'r') as f: lines = [line.strip() for line in f.readlines()] gamma = '' epsilon = '' for i in range(0, len(lines[0])): zero = 0 one = 0 for line in lines: if line[i] == '0': zero += 1 else: one += 1 ...
def comp_height(self): """Compute the height of the Hole (Rmax-Rmin) Parameters ---------- self : Hole A Hole object Returns ------- H : float Height of the hole """ (Rmin, Rmax) = self.comp_radius() return Rmax - Rmin
def comp_height(self): """Compute the height of the Hole (Rmax-Rmin) Parameters ---------- self : Hole A Hole object Returns ------- H : float Height of the hole """ (rmin, rmax) = self.comp_radius() return Rmax - Rmin
COLOUR_CHOICES = [ ('white', 'White'), ('grey', 'Grey'), ('blue', 'Blue'), ] COLUMN_CHOICES = [ ('12', 'Full Width'), ('11', '11/12'), ('10', '5/6'), ('9', 'Three Quarters'), ('8', 'Two Thirds'), ('7', '7/12'), ('6', 'Half Width'), ('5', '5/12'), ('4', 'One Third'), ...
colour_choices = [('white', 'White'), ('grey', 'Grey'), ('blue', 'Blue')] column_choices = [('12', 'Full Width'), ('11', '11/12'), ('10', '5/6'), ('9', 'Three Quarters'), ('8', 'Two Thirds'), ('7', '7/12'), ('6', 'Half Width'), ('5', '5/12'), ('4', 'One Third'), ('3', 'One Quarter'), ('2', '1/6'), ('1', '1/12')] langua...
#$Id$# class ExchangeRateList: """This class is used to create object for Exchange Rate List.""" def __init__(self): """Initialize parameters for exchange rate list.""" self.exchange_rates = [] def set_exchange_rates(self, exchange_rate): """Set exchange rate. Args: ...
class Exchangeratelist: """This class is used to create object for Exchange Rate List.""" def __init__(self): """Initialize parameters for exchange rate list.""" self.exchange_rates = [] def set_exchange_rates(self, exchange_rate): """Set exchange rate. Args: e...
x = 1 # int y = 2.8 # float z = 1j # complex # convert from int to float a = float(x) # convert from float to int b = int(y) # convert from int to complex c = complex(x) print(a) print(b) print(c) print(type(a)) print(type(b)) print(type(c))
x = 1 y = 2.8 z = 1j a = float(x) b = int(y) c = complex(x) print(a) print(b) print(c) print(type(a)) print(type(b)) print(type(c))
"""Module containing the exception class for regexapp.""" class PatternError(Exception): """Use to capture error during pattern conversion.""" class EscapePatternError(PatternError): """Use to capture error during performing do_soft_regex_escape""" class PatternReferenceError(PatternError): """Use to ...
"""Module containing the exception class for regexapp.""" class Patternerror(Exception): """Use to capture error during pattern conversion.""" class Escapepatternerror(PatternError): """Use to capture error during performing do_soft_regex_escape""" class Patternreferenceerror(PatternError): """Use to cap...
class Identifier: def __init__(self, id): self.id = id def eval(self, env): if self.id in env: return env[self.id] else: error("Referencing " + self.id + " before assignment") def __repr__(self): return "Identifier: {0}".format(self.i...
class Identifier: def __init__(self, id): self.id = id def eval(self, env): if self.id in env: return env[self.id] else: error('Referencing ' + self.id + ' before assignment') def __repr__(self): return 'Identifier: {0}'.format(self.id)
WORKERS = 50 RESULT_FILE = 'results.json' ZIP_CODE_FILE = './reference/zips.csv'
workers = 50 result_file = 'results.json' zip_code_file = './reference/zips.csv'
NAME = 'send_message.py' ORIGINAL_AUTHORS = [ 'Justin Walker' ] ABOUT = ''' Sends a message to another channel. ''' COMMANDS = ''' >>> .send #channel .u riceabove .m how are you? Sends a message to #channel like 'IronPenguin from #channel says to riceabove: how are you?' >>> .send #channel hi all Sends a messag...
name = 'send_message.py' original_authors = ['Justin Walker'] about = '\nSends a message to another channel.\n' commands = '\n>>> .send #channel .u riceabove .m how are you?\nSends a message to #channel like\n\'IronPenguin from #channel says to riceabove: how are you?\'\n\n>>> .send #channel hi all\nSends a message to ...
class Node: def __init__(self, data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None def printList(self): temp = self.head while temp : print(temp.data, end=" ") temp = temp.next def append(self, new_data): new_node = Node(new_data) if self.hea...
class Node: def __init__(self, data): self.data = data self.next = None class Linkedlist: def __init__(self): self.head = None def print_list(self): temp = self.head while temp: print(temp.data, end=' ') temp = temp.next def append(sel...
class IUserCommandRepository: def create_user(self, user): pass def update_user_auth_token(self, user_id, auth_token): pass def increment_user_score(self, user_id, score): pass
class Iusercommandrepository: def create_user(self, user): pass def update_user_auth_token(self, user_id, auth_token): pass def increment_user_score(self, user_id, score): pass
out = [] push = out.append concate = ' '.join while True: try: a, b = [int(x) for x in input().split()] except EOFError: break ans = [] ans_append = ans.append for num in range(a, b+1): num = str(num) length = len(num) check = str(sum(pow(int(x), length) for x...
out = [] push = out.append concate = ' '.join while True: try: (a, b) = [int(x) for x in input().split()] except EOFError: break ans = [] ans_append = ans.append for num in range(a, b + 1): num = str(num) length = len(num) check = str(sum((pow(int(x), length) ...
def characters_between(start: str, end: str): start = ord(start) end = ord(end) if start < end: for letter in range(start + 1, end): print(chr(letter), end=' ') else: for i in range(end + 1, start, -1): print(chr(i), end=' ') a = input() b = input() characters_b...
def characters_between(start: str, end: str): start = ord(start) end = ord(end) if start < end: for letter in range(start + 1, end): print(chr(letter), end=' ') else: for i in range(end + 1, start, -1): print(chr(i), end=' ') a = input() b = input() characters_bet...
def solve(sudoku): find = find_empty(sudoku) if not find: return True else: row, col = find for i in range(1,10): if valid(sudoku, i, (row, col)): sudoku[row][col] = i if solve(sudoku): return True sudoku[row][col] = 0 r...
def solve(sudoku): find = find_empty(sudoku) if not find: return True else: (row, col) = find for i in range(1, 10): if valid(sudoku, i, (row, col)): sudoku[row][col] = i if solve(sudoku): return True sudoku[row][col] = 0 re...
MONGODB_URI = "mongodb://localhost:27017" MONGODB_DATABASE = 'Cose2' MONGODB_USER_COLLECTION = 'users' MONGODB_TOPIC_COLLECTION = 'topics' MONGODB_COMMENT_COLLECTION = 'comments'
mongodb_uri = 'mongodb://localhost:27017' mongodb_database = 'Cose2' mongodb_user_collection = 'users' mongodb_topic_collection = 'topics' mongodb_comment_collection = 'comments'
# # Copyright (c) 2010-2016, Fabric Software Inc. All rights reserved. # ext.add_cpp_quoted_include('Opaque.hpp') ty = ext.add_opaque_type('MyOpaque') ty = ext.add_opaque_type('MyOpaqueDer', extends='MyOpaque') ext.add_func('MyOpaque_New', 'MyOpaque *', ['int']) ext.add_func('MyOpaque_GetX', 'int', ['MyOpaque *']) e...
ext.add_cpp_quoted_include('Opaque.hpp') ty = ext.add_opaque_type('MyOpaque') ty = ext.add_opaque_type('MyOpaqueDer', extends='MyOpaque') ext.add_func('MyOpaque_New', 'MyOpaque *', ['int']) ext.add_func('MyOpaque_GetX', 'int', ['MyOpaque *']) ext.add_func('MyOpaque_SetX', None, ['MyOpaque *', 'int']) ext.add_func('MyOp...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/1/11 12:10 # @File : leetCode_459.py class Solution(object): def repeatedSubstringPattern(self, s): """ :type s: str :rtype: bool """ for i in range(len(s)): tmp = s[i: i+2] for j in...
class Solution(object): def repeated_substring_pattern(self, s): """ :type s: str :rtype: bool """ for i in range(len(s)): tmp = s[i:i + 2] for j in range(1, len(tmp) - 1): if s[j:2] == tmp: return True retu...
''' Created on Mar 31, 2018 @author: Burkhard A. Meier ''' # list with loop loop_numbers = [] # create an empty list for number in range(1, 101): # use for loop loop_numbers.append(number) # append 100 numbers to list print(loop_numbers) # list compreh...
""" Created on Mar 31, 2018 @author: Burkhard A. Meier """ loop_numbers = [] for number in range(1, 101): loop_numbers.append(number) print(loop_numbers) comp_numbers = [number for number in range(1, 101)] print(comp_numbers) comp_numbers_three = [number for number in range(1, 101) if number % 3 == 0] print(comp_n...
Rt = [[1,2,3 ], [2, 4, 5], [3,6,7], [4,8,9],[5,10,11],[6,12,13],[7,14,15]] def findRoot(RT): S = set() for i in RT: for j in i: S.add( j ) print (S) for i in RT : for j in i[1:]: S.remove( j ) print (S) try : for i in S : ...
rt = [[1, 2, 3], [2, 4, 5], [3, 6, 7], [4, 8, 9], [5, 10, 11], [6, 12, 13], [7, 14, 15]] def find_root(RT): s = set() for i in RT: for j in i: S.add(j) print(S) for i in RT: for j in i[1:]: S.remove(j) print(S) try: for i in S: retval ...
def f(param): """ Args: param """
def f(param): """ Args: param """