content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
#!/usr/bin/python3 class FctCheck: def __init__(self): pass def ding_dong(self): print('') def _check_me(self, arg): return True if arg is not None else False
class Fctcheck: def __init__(self): pass def ding_dong(self): print('') def _check_me(self, arg): return True if arg is not None else False
def greet(name): print(f'Good Day, {name}') name = input('Enter your name: ') greet(name)
def greet(name): print(f'Good Day, {name}') name = input('Enter your name: ') greet(name)
def ver1(sum): if sum == 1501500: print("Correct!") return else: print("Incorrect") return def hint1(): print("Remember to increment the loop in 3s. Also make sure that the last element is 3001, as it will not be included.") return def ver2(product): if product == 430...
def ver1(sum): if sum == 1501500: print('Correct!') return else: print('Incorrect') return def hint1(): print('Remember to increment the loop in 3s. Also make sure that the last element is 3001, as it will not be included.') return def ver2(product): if product == 4...
mat = [[x for x in range(4)], [x for x in range(4,8)], [x for x in range(8,12)], [x for x in range(12,16)]] print(mat) d = 4 for k in range(0,d): print("d: ",end=" ") row , col = range(0,k + 1), range(k,-1,-1) for i,j in zip(row,col): print(mat[i][j],end =" ") ...
mat = [[x for x in range(4)], [x for x in range(4, 8)], [x for x in range(8, 12)], [x for x in range(12, 16)]] print(mat) d = 4 for k in range(0, d): print('d: ', end=' ') (row, col) = (range(0, k + 1), range(k, -1, -1)) for (i, j) in zip(row, col): print(mat[i][j], end=' ') print('') for k in r...
# class LLNode: # def __init__(self, val, next=None): # self.val = val # self.next = next class Solution: def solve(self, node): count = 0 currentNode = node while currentNode: count += 1 currentNode = currentNode.next return cou...
class Solution: def solve(self, node): count = 0 current_node = node while currentNode: count += 1 current_node = currentNode.next return count
test = open("needsConversion", "r") split = test.readlines() out = """from enum import Enum class MeshTag(Enum): """ i = 0 for l in split: if "*" in l: continue stripped = [x for x in l.replace("\n", "").split(" ") if x != "" and x != "\n"] if len(stripped) == 0: continue out += "\t" ...
test = open('needsConversion', 'r') split = test.readlines() out = 'from enum import Enum\n\nclass MeshTag(Enum):\n' i = 0 for l in split: if '*' in l: continue stripped = [x for x in l.replace('\n', '').split(' ') if x != '' and x != '\n'] if len(stripped) == 0: continue out += '\t' + s...
""" PASSENGERS """ numPassengers = 15271 passenger_arriving = ( (2, 7, 3, 3, 0, 1, 1, 1, 0, 0, 1, 1, 0, 9, 0, 3, 2, 3, 1, 2, 1, 1, 2, 0, 0, 0), # 0 (6, 4, 3, 2, 1, 2, 2, 2, 0, 0, 1, 0, 0, 7, 5, 3, 1, 2, 3, 1, 2, 1, 2, 0, 1, 0), # 1 (1, 4, 2, 4, 5, 3, 1, 1, 0, 1, 0, 0, 0, 9, 3, 2, 3, 3, 0, 1, 1, 0, 3, 0, 0, 0), ...
""" PASSENGERS """ num_passengers = 15271 passenger_arriving = ((2, 7, 3, 3, 0, 1, 1, 1, 0, 0, 1, 1, 0, 9, 0, 3, 2, 3, 1, 2, 1, 1, 2, 0, 0, 0), (6, 4, 3, 2, 1, 2, 2, 2, 0, 0, 1, 0, 0, 7, 5, 3, 1, 2, 3, 1, 2, 1, 2, 0, 1, 0), (1, 4, 2, 4, 5, 3, 1, 1, 0, 1, 0, 0, 0, 9, 3, 2, 3, 3, 0, 1, 1, 0, 3, 0, 0, 0), (2, 4, 2, 3, 4, ...
class FastaParser(object): def __init__(self, in_file): self.in_file = in_file try: (".fasta" in in_file) == True except ValueError: raise Exception("%s is not a .fasta file." % (in_file)) try: os.path.exists(in_file) == True except IOError: raise Exception("%s can not be found." % (in_file))
class Fastaparser(object): def __init__(self, in_file): self.in_file = in_file try: ('.fasta' in in_file) == True except ValueError: raise exception('%s is not a .fasta file.' % in_file) try: os.path.exists(in_file) == True except IOError:...
class Shape: def __init__(self): self.__matrix = [[1]] self.color = '' self.xy = [0, 0] def set_matrix(self, new_matrix): self.__matrix = new_matrix[:] def is_colored_block(self, x, y): return self.__matrix[y][x] == 1 def is_shape(self, x, y): x -= self...
class Shape: def __init__(self): self.__matrix = [[1]] self.color = '' self.xy = [0, 0] def set_matrix(self, new_matrix): self.__matrix = new_matrix[:] def is_colored_block(self, x, y): return self.__matrix[y][x] == 1 def is_shape(self, x, y): x -= sel...
"""LeetCode, 937 1. The first word in log is the identifier. 2. The letter logs come before all digit logs. 3. The letter-logs are sorted lexicographically by their contents. If their contents are the same, then sort them lexicographically by their identifiers. 4. The digit-logs maintain their relative ordering.""" de...
"""LeetCode, 937 1. The first word in log is the identifier. 2. The letter logs come before all digit logs. 3. The letter-logs are sorted lexicographically by their contents. If their contents are the same, then sort them lexicographically by their identifiers. 4. The digit-logs maintain their relative ordering.""" de...
# -*- coding: utf-8 -*- """ This exercise is from the book "Think Python: How to Think Like a Computer Scientist" by Allen B. Downey """ def right_justify(string): """ Takes a string as a parameter and prints the string with enough leading spaces so that the last letter of the string is in column 70 of t...
""" This exercise is from the book "Think Python: How to Think Like a Computer Scientist" by Allen B. Downey """ def right_justify(string): """ Takes a string as a parameter and prints the string with enough leading spaces so that the last letter of the string is in column 70 of the display. Exa...
# fizzbuzz in python for i in range(1, 101): printed = False if i % 3 == 0: printed = True print('Fizz', end='') if i % 5 == 0: printed = True print('Buzz', end='') if not printed: print(i, end='') print()
for i in range(1, 101): printed = False if i % 3 == 0: printed = True print('Fizz', end='') if i % 5 == 0: printed = True print('Buzz', end='') if not printed: print(i, end='') print()
# noinspection PyUnusedLocal def fizz_buzz(number): if (number % 3 == 0 or '3' in str(number)) and (number % 5 == 0 or '5' in str(number)): delux = deluxe(number) if delux: return "fizz buzz " + delux return "fizz buzz" if number % 3 == 0 or '3' in str(number): ...
def fizz_buzz(number): if (number % 3 == 0 or '3' in str(number)) and (number % 5 == 0 or '5' in str(number)): delux = deluxe(number) if delux: return 'fizz buzz ' + delux return 'fizz buzz' if number % 3 == 0 or '3' in str(number): delux = deluxe(number) if d...
# @file Validate Binary Search Tree # @brief Given a binary tree, check if it is a valid binary search tree (BST). # https://leetcode.com/problems/validate-binary-search-tree ''' Assume a BST is defined as follows: Left subtree of a node contains only nodes with keys lesser than node's key. Right subtree of a node c...
""" Assume a BST is defined as follows: Left subtree of a node contains only nodes with keys lesser than node's key. Right subtree of a node contains only nodes with keys greater than node's key. Both the left and right subtrees must also be binary search trees. """ def is_valid_bst(self, root, min_val=float('-inf'), ...
class BatchTaskCreateOutDTO(object): def __init__(self): self.taskID = None def getTaskID(self): return self.taskID def setTaskID(self, taskID): self.taskID = taskID
class Batchtaskcreateoutdto(object): def __init__(self): self.taskID = None def get_task_id(self): return self.taskID def set_task_id(self, taskID): self.taskID = taskID
def resolve_path2d(seq1, seq2, path): ''' Given path dictionary, resolve the aligned sequence pair (which means it supports only DP2d) #! NOTE: path[(i, j)] = ('prev_step', (prev_x, prev_y)) @param: seq1 & seq2: sequences used to generate the path dictionary in method DP2d() #! seq1: x ...
def resolve_path2d(seq1, seq2, path): """ Given path dictionary, resolve the aligned sequence pair (which means it supports only DP2d) #! NOTE: path[(i, j)] = ('prev_step', (prev_x, prev_y)) @param: seq1 & seq2: sequences used to generate the path dictionary in method DP2d() #! seq1: x ...
# # PySNMP MIB module TRAPEZE-NETWORKS-SYSTEM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TRAPEZE-NETWORKS-SYSTEM-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:27:26 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python versio...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, single_value_constraint, constraints_union, value_size_constraint) ...
""" Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that: Only one letter can be changed at a time Each intermediate word must exist in the word list For example, Given: beginWord = "hit" endWord = "cog" wordLis...
""" Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that: Only one letter can be changed at a time Each intermediate word must exist in the word list For example, Given: beginWord = "hit" endWord = "cog" wordLis...
"""Errors for PyGLEIF.""" class PyGLEIFError(Exception): """Base Error""" pass class NoMatchError(PyGLEIFError): """An error happened sending or receiving a command.""" pass
"""Errors for PyGLEIF.""" class Pygleiferror(Exception): """Base Error""" pass class Nomatcherror(PyGLEIFError): """An error happened sending or receiving a command.""" pass
# model model = dict(type='ResNet', depth=18, num_classes=10, maxpool=False) loss = dict(type='CrossEntropyLoss') # dataset root = '/path/to/your/dataset' mean = (0.4914, 0.4822, 0.4465) std = (0.2023, 0.1994, 0.2010) batch_size = 512 num_workers = 4 data = dict( train=dict( ds_dict=dict( type=...
model = dict(type='ResNet', depth=18, num_classes=10, maxpool=False) loss = dict(type='CrossEntropyLoss') root = '/path/to/your/dataset' mean = (0.4914, 0.4822, 0.4465) std = (0.2023, 0.1994, 0.201) batch_size = 512 num_workers = 4 data = dict(train=dict(ds_dict=dict(type='CIFAR10', root=root, train=True), trans_dict=d...
# Copyright (c) 2018-2019 Simons Observatory. # Full license can be found in the top level "LICENSE" file. """Test Suite for Simons Observatory TOD Simulation and Processing. This directory contains the unittest suite. """
"""Test Suite for Simons Observatory TOD Simulation and Processing. This directory contains the unittest suite. """
#!/usr/bin/env python # encoding: utf-8 """ binary_tree_level_order_traversal.py Created by Shengwei on 2014-07-29. """ # https://oj.leetcode.com/problems/binary-tree-level-order-traversal/ # tags: easy, tree, traversal, bfs """ Given a binary tree, return the level order traversal of its nodes' values. (ie, from le...
""" binary_tree_level_order_traversal.py Created by Shengwei on 2014-07-29. """ "\nGiven a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).\n\nFor example:\nGiven binary tree {3,9,20,#,#,15,7},\n 3\n / 9 20\n / 15 7\nreturn its level order t...
class DNSError(Exception): """Raised when the resolv cannot be done""" pass class TimeExceeded(Exception): """Raised when the packet cannot reach the destination""" pass class UnknownError(Exception): """Raised when the error is unknown (not implemented yet)""" pass
class Dnserror(Exception): """Raised when the resolv cannot be done""" pass class Timeexceeded(Exception): """Raised when the packet cannot reach the destination""" pass class Unknownerror(Exception): """Raised when the error is unknown (not implemented yet)""" pass
# -*- coding: utf-8 -*- """ exceptions.py ~~~~~~~~~~~~~ <Add description of the module here>. :copyright: (c) 2015-2020 by Jochen Gerhaeusser. :license: BSD, see LICENSE for details """ class ByteOrderTypeError(TypeError): """ Raised if an inappropriate byte order type is assigned to a field class. """ ...
""" exceptions.py ~~~~~~~~~~~~~ <Add description of the module here>. :copyright: (c) 2015-2020 by Jochen Gerhaeusser. :license: BSD, see LICENSE for details """ class Byteordertypeerror(TypeError): """ Raised if an inappropriate byte order type is assigned to a field class. """ def __init__(self, field,...
# d.update((['two', 'II'], ['four', 4])) d = {'one': 1, 'two': 2, 'three': 3} print(d.update((['two', 'II'], ['four', 4]))) print(d)
d = {'one': 1, 'two': 2, 'three': 3} print(d.update((['two', 'II'], ['four', 4]))) print(d)
""" File: boggle.py Name: Justin Huang ---------------------------------------- TODO: Boggle Mission """ # This is the file name of the dictionary txt file # we will be checking if a word exists by searching through it FILE = 'dictionary.txt' dic_list = [] time = 0 def main(): """ TODO: """ boggle = [] read_dic...
""" File: boggle.py Name: Justin Huang ---------------------------------------- TODO: Boggle Mission """ file = 'dictionary.txt' dic_list = [] time = 0 def main(): """ TODO: """ boggle = [] read_dictionary() for i in range(4): print(i + 1, end='') cha = input(' row of letters: ').stri...
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # @param head, a ListNode # @return a list node def detectCycle(self, head): if head is None or head.next is None: return None sl...
class Solution: def detect_cycle(self, head): if head is None or head.next is None: return None slow = head fast = head while fast is not None and fast.next is not None: slow = slow.next fast = fast.next.next if fast == slow: ...
BASE_URL = 'https://storyweaver.org.in/api/v1/illustrations-search' DEFAULT_PAGE_NUM = 1 DEFAULT_PER_PAGE = 10 MAX_PAGE_NUM = 1164 DATA_FOLDER_PATH = '\\Documents\\Github\\Storyweaver\\static\\data\\' MODEL_FOLDER_PATH = '\\Documents\\Github\\Storyweaver\\model\\' DETECTED_OBJECT_OUTPUT_PATH = '\\Documents\\Github\\Sto...
base_url = 'https://storyweaver.org.in/api/v1/illustrations-search' default_page_num = 1 default_per_page = 10 max_page_num = 1164 data_folder_path = '\\Documents\\Github\\Storyweaver\\static\\data\\' model_folder_path = '\\Documents\\Github\\Storyweaver\\model\\' detected_object_output_path = '\\Documents\\Github\\Sto...
class JobService: def update_status(self): pass
class Jobservice: def update_status(self): pass
try: name, surname = input().split() print(f"Welcome to our party, {name} {surname}") except ValueError: print("You need to enter exactly 2 words. Try again!")
try: (name, surname) = input().split() print(f'Welcome to our party, {name} {surname}') except ValueError: print('You need to enter exactly 2 words. Try again!')
class Status: def __init__(self, x, y): self.x = x self.y = y self.active = False def max_y(self): # Het maximale ei gehalte is # 1 stapje = 0.30mm # max = 3 meter max_mm = 3 * 1000 max_steps = max_mm / 0.30 return max_steps def set_y(self, y): self.y = y f = open('/boot/y.txt', 'w') f.writ...
class Status: def __init__(self, x, y): self.x = x self.y = y self.active = False def max_y(self): max_mm = 3 * 1000 max_steps = max_mm / 0.3 return max_steps def set_y(self, y): self.y = y f = open('/boot/y.txt', 'w') f.write(str(y)...
""" Database module """ class Database(object): """ Defines data structures and methods to store article content. """ # pylint: disable=W0613 def merge(self, url, ids): """ Merges the results of an existing database into the current database. This method returns a list of i...
""" Database module """ class Database(object): """ Defines data structures and methods to store article content. """ def merge(self, url, ids): """ Merges the results of an existing database into the current database. This method returns a list of ids not merged, which means t...
def MAIN(Number): if Number > 0: return Number return 0 if __name__ == "__main__": print( "Hello, World") MAIN(0)
def main(Number): if Number > 0: return Number return 0 if __name__ == '__main__': print('Hello, World') main(0)
returnedDate = [ int( x ) for x in input( ).split( ' ' ) ] dueDate = [ int( x ) for x in input( ).split( ' ' ) ] fine = 0 if returnedDate[ 2 ] > dueDate[ 2 ]: fine = 10000 elif returnedDate[ 2 ] < dueDate[ 2 ]: fine = 0 elif returnedDate[ 2 ] == dueDate[ 2 ] and returnedDate[ 1 ] > dueDate[ 1 ]: fine = 50...
returned_date = [int(x) for x in input().split(' ')] due_date = [int(x) for x in input().split(' ')] fine = 0 if returnedDate[2] > dueDate[2]: fine = 10000 elif returnedDate[2] < dueDate[2]: fine = 0 elif returnedDate[2] == dueDate[2] and returnedDate[1] > dueDate[1]: fine = 500 * (returnedDate[1] - dueDate...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2021 by DeepLn # Distributed under the MIT software license, see the accompanying KLINE_INTERVAL = [ "1m", "3m", "5m", "15m", "30m", "1h", "2h", "4h", "6h", "8h", "12h"...
kline_interval = ['1m', '3m', '5m', '15m', '30m', '1h', '2h', '4h', '6h', '8h', '12h', '1d', '3d', '1w', '1m'] depth = [5, 10, 20, 50, 100, 500, 1000] contract_type = ['PERPETUAL', 'CURRENT_MONTH', 'NEXT_MONTH', 'CURRENT_QUARTER', 'NEXT_QUARTER'] period = ['5m', '15m', '30m', '1h', '2h', '4h', '6h', '12h', '1d'] income...
# Copyright Notice: # Copyright 2017, Fitbit, Inc. # 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/LICENSE-2.0 # Unless required by applicable law or agreed to ...
class Thriftservice(object): """ Provides a representation of a service declared in thrift. """ class Endpoint(object): def __init__(self, return_type, name, fields=None, oneway=False): self.return_type = return_type self.name = name self.fields = fields if fields i...
# -*- coding: utf-8 -*- # Author: XuMing <shibing624@126.com> # Data: 17/10/15 # Brief: with open("1.txt", "r", encoding="utf-8") as f: for i in f: parts = i.strip().split("\t") print(parts[22])
with open('1.txt', 'r', encoding='utf-8') as f: for i in f: parts = i.strip().split('\t') print(parts[22])
donor_dict = \ { 1: 3, 2: 6, 3: 9, 4: 12, 5: 11, 6: 8, 7: 5, 8: 2, 9: 1, 10: 4, 11: 7, 12: 10, } cell_dict = { 'CD68': { 'legend': "Macrophage (CD68+)", 'full': "Macrophage (CD68+)", 'sho...
donor_dict = {1: 3, 2: 6, 3: 9, 4: 12, 5: 11, 6: 8, 7: 5, 8: 2, 9: 1, 10: 4, 11: 7, 12: 10} cell_dict = {'CD68': {'legend': 'Macrophage (CD68+)', 'full': 'Macrophage (CD68+)', 'short': 'Macrophage', 'group': 'Immune Cells', 'color': 'gold', 'marker': 'circle', 'size': 15.89, 'histogram_location': [3, 1]}, 'CD31': {'leg...
# File type implements the Context Manager Protocol # can therefore use a file in a with as statement with open('myfile.txt', 'r') as f: lines = f.readlines() for line in lines: print(line, end='') print('Done')
with open('myfile.txt', 'r') as f: lines = f.readlines() for line in lines: print(line, end='') print('Done')
# -*- coding:utf-8 -*- """ @author: Alden @email: sunzhenhy@gmail.com @date: 2018/4/6 @version: 1.0.0.0 """ # Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def getIntersectionNode(self, headA, headB): ...
""" @author: Alden @email: sunzhenhy@gmail.com @date: 2018/4/6 @version: 1.0.0.0 """ class Listnode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def get_intersection_node(self, headA, headB): """ :type head1, head1: ListNode :r...
class Solution: def numberOfSubarrays(self, nums: 'List[int]', k: int) -> int: odds = [] x = 0 for i, num in enumerate(nums): if num % 2 == 1: odds.append(x) x = 0 else: x += 1 odds.append(x) res = 0 ...
class Solution: def number_of_subarrays(self, nums: 'List[int]', k: int) -> int: odds = [] x = 0 for (i, num) in enumerate(nums): if num % 2 == 1: odds.append(x) x = 0 else: x += 1 odds.append(x) res = 0...
""" DAG (Directed Acyclic Graph) """ class Node: _id = 0 def __init__(self, weights, # parent: list = [], # edges: list = [], _id=None, creator=None): # id if _id != None: self._id = _id ...
""" DAG (Directed Acyclic Graph) """ class Node: _id = 0 def __init__(self, weights, _id=None, creator=None): if _id != None: self._id = _id else: self._id = Node._id Node._id += 1 self.weights = weights self.creator = creator def get_id...
# the following file holds meta information about the sunpy package sunpy_releases = {'0.9': '2018/04/22', '0.8': '2017/08/17', '0.7': '2016/05/24', '0.6': '2015/07/21', '0.5': '2014/06/13', '0.4': '2014/02/14', '0.3': '2013/08/30', '0.2': '2012/11/26', '0.1': '2011/09/28'} repo_pa...
sunpy_releases = {'0.9': '2018/04/22', '0.8': '2017/08/17', '0.7': '2016/05/24', '0.6': '2015/07/21', '0.5': '2014/06/13', '0.4': '2014/02/14', '0.3': '2013/08/30', '0.2': '2012/11/26', '0.1': '2011/09/28'} repo_path = '/Users/sdchris1/Developer/repositories/sunpy/'
def parse(filename: str): with open(filename) as file: fileLines = file.read().split('\n') width, height = len(fileLines[0]), len(fileLines) eastHerd, southHerd = set(), set() for y, line in enumerate(fileLines): for x, char in enumerate(line): if char ==...
def parse(filename: str): with open(filename) as file: file_lines = file.read().split('\n') (width, height) = (len(fileLines[0]), len(fileLines)) (east_herd, south_herd) = (set(), set()) for (y, line) in enumerate(fileLines): for (x, char) in enumerate(line): ...
USES_BASE64 = True REDIRECT = None AUTHOR = 'BrocaProgs' APPNAME = 'PyQt_Socius'
uses_base64 = True redirect = None author = 'BrocaProgs' appname = 'PyQt_Socius'
"""profile_ex This module contains supporting code to be used by cProfile The cProfile can be run on this file (from the commandline) as: $python -m cProfile profile_ex.py This module is compatible with Python 3.5.x. It contains supporting code for the book, Learning Python Application Development, Packt Publishing. ...
"""profile_ex This module contains supporting code to be used by cProfile The cProfile can be run on this file (from the commandline) as: $python -m cProfile profile_ex.py This module is compatible with Python 3.5.x. It contains supporting code for the book, Learning Python Application Development, Packt Publishing. ...
#!/usr/bin/env python # encoding: utf-8 def run(whatweb, pluginname): whatweb.recog_from_content(pluginname, "dedecms") whatweb.recog_from_file(pluginname, "templets/default/style/dedecms.css", "DedeCMS")
def run(whatweb, pluginname): whatweb.recog_from_content(pluginname, 'dedecms') whatweb.recog_from_file(pluginname, 'templets/default/style/dedecms.css', 'DedeCMS')
# Python function to print leaders in array def printLeaders(l, size): m=[] max_element = l[size-1] m.append(max_element) for i in range(size-2, -1, -1): if max_element <= l[i]: m.append(l[i]) max_element = l[i] for k in range(len(m)-1...
def print_leaders(l, size): m = [] max_element = l[size - 1] m.append(max_element) for i in range(size - 2, -1, -1): if max_element <= l[i]: m.append(l[i]) max_element = l[i] for k in range(len(m) - 1, -1, -1): print(m[k], end=' ') arr = [16, 17, 4, 3, 5, 2] p...
class Parser: def __init__(self): pass def parse(self, record): raise NotImplementedError('the parse method should be implemented by subclasses') class Success(Parser): def __init__(self): super().__init__() def parse(self, record): return [('', record)] class Pre...
class Parser: def __init__(self): pass def parse(self, record): raise not_implemented_error('the parse method should be implemented by subclasses') class Success(Parser): def __init__(self): super().__init__() def parse(self, record): return [('', record)] class Pre...
a < b < c x in y x not in y x is y x is not y x < y x > y x >= y x <= y x == y x != y
a < b < c x in y x not in y x is y x is not y x < y x > y x >= y x <= y x == y x != y
VERSION = '0.0.1' WELCOME_MSG = """\ Kite REPL, version: {}\ """.format(VERSION) REPL_USAGE = """\ ?, :h, :help - Show help message :e, :env - Show current dynamic environment :d, :del <name> - Delete name from the environment (todo) :b, :builtin - Show built-in environment :l, :load ...
version = '0.0.1' welcome_msg = 'Kite REPL, version: {}'.format(VERSION) repl_usage = ' ?, :h, :help - Show help message\n :e, :env - Show current dynamic environment\n :d, :del <name> - Delete name from the environment (todo)\n :b, :builtin - Show built-in environment\n :l, :load - Lo...
# url -> https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/11/ALDS1_11_A N = int(input().rstrip()) def generateGraph(N): graph = [[0]*N for _ in range(N)] for _ in range(N): U, A, *B = map(int, input().rstrip().split()) for i in range(A): graph[U-1][B[i]-1] = 1 ...
n = int(input().rstrip()) def generate_graph(N): graph = [[0] * N for _ in range(N)] for _ in range(N): (u, a, *b) = map(int, input().rstrip().split()) for i in range(A): graph[U - 1][B[i] - 1] = 1 return graph result = generate_graph(N) for i in range(len(result)): print(*r...
# Copyright 2016 Anselm Binninger, Thomas Maier, Ralph Schaumann # # 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/LICENSE-2.0 # # Unless required by appl...
__author__ = 'Anselm Binninger, Thomas Maier, Ralph Schaumann' message_code_announce = 500 message_code_notify = 501 message_code_notification = 502 message_code_validation = 503 message_code_peer_request = 510 message_code_peer_response = 511 message_code_peer_update = 512 message_code_peer_init = 513 message_code_gos...
#! Metanit.com - Python: Chapter 2, lesson 3 "Operations with Numbers". y = 0x0a # hexadecimal system, 11 a = 0o11 # octal system, 9 x = 0b101 # binary system, 5 z = x + y # Awesome string formatters. print("{0} in binary {0:08b}; in hex {0:02x} in octal {0:02o}".format(z)) # {:n} - 'n' indicates h...
y = 10 a = 9 x = 5 z = x + y print('{0} in binary {0:08b}; in hex {0:02x} in octal {0:02o}'.format(z)) number = 3 + 4 * 5 ** 2 + 7 print(number) number = (3 + 4) * (5 ** 2 + 7) print(number) number = 12 number += 5 print(number) number -= 3 print(number) number *= 4 print(number) number //= 9 print(number) number **= 4...
# Python - 3.6.0 test.assert_equals(string_to_number('1234'), 1234) test.assert_equals(string_to_number('605'), 605) test.assert_equals(string_to_number('1405'), 1405) test.assert_equals(string_to_number('1234'), 1234)
test.assert_equals(string_to_number('1234'), 1234) test.assert_equals(string_to_number('605'), 605) test.assert_equals(string_to_number('1405'), 1405) test.assert_equals(string_to_number('1234'), 1234)
"""Calculate the simple edit distance. Calculates the simple edit distance by calculating a Longest Common Subsequence (LCS) alignment [1]_. The implementation is adapted from [2]_. This method is useful when only the simple edit distance is needed (not an or all alignments). See Also -------- algebra.lcs.all_lcs : C...
"""Calculate the simple edit distance. Calculates the simple edit distance by calculating a Longest Common Subsequence (LCS) alignment [1]_. The implementation is adapted from [2]_. This method is useful when only the simple edit distance is needed (not an or all alignments). See Also -------- algebra.lcs.all_lcs : C...
def get_formatted(first_name, last_name): full_name = first_name + ' ' + last_name return full_name.title() while True: print('Please tell me your name:') # print('Press "q" to quit') f_name = input('Fist Name: ') l_name = input('Last Name: ') formatted_name = get_formatted(f_name, l_name)...
def get_formatted(first_name, last_name): full_name = first_name + ' ' + last_name return full_name.title() while True: print('Please tell me your name:') f_name = input('Fist Name: ') l_name = input('Last Name: ') formatted_name = get_formatted(f_name, l_name) print('Hello, ' + formatted_na...
find_sum_of_squearse = lambda x, y: x**2 + y**2 print(find_sum_of_squearse(3, 5)) words = ["hello", "monkey", "python"] wordsSort = max(words, key = lambda x: x.count("1")) print(wordsSort)
find_sum_of_squearse = lambda x, y: x ** 2 + y ** 2 print(find_sum_of_squearse(3, 5)) words = ['hello', 'monkey', 'python'] words_sort = max(words, key=lambda x: x.count('1')) print(wordsSort)
class KomodoRPC: node_addr = '127.0.0.1' rpc_port = 7777 req_method = 'POST' rpc_username = '' rpc_password = '' req_auth = { 'user': rpc_username, 'pass': rpc_password } req_url = 'http://{0}:{1}/'.format(str(node_addr), str(rpc_port)) req_headers = { ...
class Komodorpc: node_addr = '127.0.0.1' rpc_port = 7777 req_method = 'POST' rpc_username = '' rpc_password = '' req_auth = {'user': rpc_username, 'pass': rpc_password} req_url = 'http://{0}:{1}/'.format(str(node_addr), str(rpc_port)) req_headers = {'content-type': 'text/plain;'} jso...
def josephus(n, k): q = [i for i in range(1, n + 1)] j = 0 while len(q) > 1: j = (j + k - 1) % len(q) q.pop(j) return q[0] print(josephus(41, 3))
def josephus(n, k): q = [i for i in range(1, n + 1)] j = 0 while len(q) > 1: j = (j + k - 1) % len(q) q.pop(j) return q[0] print(josephus(41, 3))
# Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order. # # Example 1: # # Input: "Let's take LeetCode contest" # Output: "s'teL ekat edoCteeL tsetnoc" # # # # Note: # In the string, each word is separated by single spac...
class Solution: def reverse_words(self, s: str) -> str: if not s or s == ' ' or len(s) is 1: return s result = '' tmp = '' for c in s: if c == ' ': result += tmp[::-1] + ' ' tmp = '' else: tmp += c ...
#python program to print strings and type str1 = "Hi my name is Matthew. I am String" str2 = 'Hi my name is Precious. I am also String' #displaying string str1 and its type print(str1) print(type(str1)) #displaying string str1 and its type print(str2) print(type(str2))
str1 = 'Hi my name is Matthew. I am String' str2 = 'Hi my name is Precious. I am also String' print(str1) print(type(str1)) print(str2) print(type(str2))
# Define a String str = "python" # Convert String in Upper Case and assign to variable strupper strupper = str.upper(); # Print both the original and the converted fields print(str+ " is converted to the Upper Case as "+ strupper);
str = 'python' strupper = str.upper() print(str + ' is converted to the Upper Case as ' + strupper)
Search_Amish={ 'Amish+Romance':['http://www.amazon.com/s/ref=sr_pg_5?rh=i%3Aaps%2Ck%3AAmish+Romance&page=1','http://www.amazon.com/s/ref=sr_pg_5?rh=i%3Aaps%2Ck%3AAmish+Romance&page=2','http://www.amazon.com/s/ref=sr_pg_5?rh=i%3Aaps%2Ck%3AAmish+Romance&page=3','http://www.amazon.com/s/ref=sr_pg_5?rh=i%3Aaps%2Ck%3AAmish+...
search__amish = {'Amish+Romance': ['http://www.amazon.com/s/ref=sr_pg_5?rh=i%3Aaps%2Ck%3AAmish+Romance&page=1', 'http://www.amazon.com/s/ref=sr_pg_5?rh=i%3Aaps%2Ck%3AAmish+Romance&page=2', 'http://www.amazon.com/s/ref=sr_pg_5?rh=i%3Aaps%2Ck%3AAmish+Romance&page=3', 'http://www.amazon.com/s/ref=sr_pg_5?rh=i%3Aaps%2Ck%3A...
class Solution: def coinChange(self, coins, amount): """ :type coins: List[int] :type amount: int :rtype: int """ dp = [0] + [float('inf')] * amount for i in range(1, amount + 1): dp[i] = min([dp[i - c] if i - c >= 0 else float('inf') for c in coins]) + 1 ...
class Solution: def coin_change(self, coins, amount): """ :type coins: List[int] :type amount: int :rtype: int """ dp = [0] + [float('inf')] * amount for i in range(1, amount + 1): dp[i] = min([dp[i - c] if i - c >= 0 else float('inf') for c in co...
def find(searchList, elem): endList = [] for indElem in range(0,len(elem)): resultList = [] for ind in range(0, len(searchList)): if searchList[ind] == elem[indElem]: resultList.append(ind) endList.extend([resultList]) retur...
def find(searchList, elem): end_list = [] for ind_elem in range(0, len(elem)): result_list = [] for ind in range(0, len(searchList)): if searchList[ind] == elem[indElem]: resultList.append(ind) endList.extend([resultList]) return endList
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 title = "AJAX Helper" host = "localhost" port = 8001
title = 'AJAX Helper' host = 'localhost' port = 8001
Names = ["John","Steve","Brian","Jim","Alex","Paul","Micheal","Bruce","Alfred","Buzz","Eric","Gary"] Nombre = [i for i in range(1,1000000)] def affiche(names): for name in names: yield name def nextSquare(): i = 1; # An Infinite loop to generate squares while True: yield i*i i...
names = ['John', 'Steve', 'Brian', 'Jim', 'Alex', 'Paul', 'Micheal', 'Bruce', 'Alfred', 'Buzz', 'Eric', 'Gary'] nombre = [i for i in range(1, 1000000)] def affiche(names): for name in names: yield name def next_square(): i = 1 while True: yield (i * i) i += 1 def main(): test ...
# # # def palindrom(word): try: word = word[::-1] except TypeError: print("I execute myself only if an exception happens") print("You can't type only strings") else: print("I just execute myself only if no exceptions happens") print(word) finally: print(...
def palindrom(word): try: word = word[::-1] except TypeError: print('I execute myself only if an exception happens') print("You can't type only strings") else: print('I just execute myself only if no exceptions happens') print(word) finally: print('I alway...
f1 = 1.0 s1 = 'string' s2 = "string" s3 = '''multiline string''' s4 = """multiline string""" s5 = r'raw text' s6 = r"more raw text" s7 = r'''raw multiline string''' s8 = r"""raw multiline string""" print('done')
f1 = 1.0 s1 = 'string' s2 = 'string' s3 = 'multiline string' s4 = 'multiline string' s5 = 'raw text' s6 = 'more raw text' s7 = 'raw multiline string' s8 = 'raw multiline string' print('done')
class Solution(object): def max_sub_array(self, nums): """ Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. :type nums: List[int] :rtype: int """ # NOTE: we are going to u...
class Solution(object): def max_sub_array(self, nums): """ Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. :type nums: List[int] :rtype: int """ start = end = 0 ...
""" Copied from: https://github.com/jerrymarino/xcbuildkit/blob/master/third_party/repositories.bzl """ load( "@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository", ) load("//rules/third_party:xcbuildkit_version.bzl", "repo_info") NAMESPACE_PREFIX = "xcbuildkit-" def names...
""" Copied from: https://github.com/jerrymarino/xcbuildkit/blob/master/third_party/repositories.bzl """ load('@bazel_tools//tools/build_defs/repo:git.bzl', 'git_repository', 'new_git_repository') load('//rules/third_party:xcbuildkit_version.bzl', 'repo_info') namespace_prefix = 'xcbuildkit-' def namespaced_name(name):...
def normal_function(func): print(func(10)) normal_function(lambda value: 10 + value) def normal_function2(func, *args): for argument in args: print(func(argument)) normal_function2(lambda value: value / 5, 10, 15, 20, 25, 30, 35, 40, 45, 50) def normal_function3(func, *args): for argument in ar...
def normal_function(func): print(func(10)) normal_function(lambda value: 10 + value) def normal_function2(func, *args): for argument in args: print(func(argument)) normal_function2(lambda value: value / 5, 10, 15, 20, 25, 30, 35, 40, 45, 50) def normal_function3(func, *args): for argument in args:...
# Theory: Class instances # By now, you already know what classes are and how they're # created and used in Python, Now let's get into the details about # class instances. # A class instance is an object of the class. If, for example, there # was a class River, we could create such instances as Volga, # Seine, and Ni...
class River: all_rivers = [] def __init__(self, name, length): self.name = name self.length = length River.all_rivers.append(self) volga = river('Volga', 3530) seine = river('Seine', 776) nile = river('Nile', 6852) for river in River.all_rivers: print(river.name) class River: a...
#From https://notepad-plus-plus.org/community/topic/14501/has-a-plugin-like-sublime-plugin-brackethighlighter/7 try: BH__dict except NameError: BH__dict = dict() BH__dict['indic_for_box_at_caret'] = 10 # pick a free indicator number def indicatorOptionsSet(indicator_number, indicator_style, rgb_c...
try: BH__dict except NameError: bh__dict = dict() BH__dict['indic_for_box_at_caret'] = 10 def indicator_options_set(indicator_number, indicator_style, rgb_color_tup, alpha, outline_alpha, draw_under_text, which_editor=editor): which_editor.indicSetStyle(indicator_number, indicator_style) ...
class Solution: def evalRPN(self, tokens: List[str]) -> int: num_stack = [] for token in tokens: if token in "+-*/": num2, num1 = num_stack.pop(), num_stack.pop() if token == "+": num_stack.append(num1 + num2) el...
class Solution: def eval_rpn(self, tokens: List[str]) -> int: num_stack = [] for token in tokens: if token in '+-*/': (num2, num1) = (num_stack.pop(), num_stack.pop()) if token == '+': num_stack.append(num1 + num2) elif...
# # @lc app=leetcode id=221 lang=python3 # # [221] Maximal Square # # @lc code=start class Solution: def maximalSquare(self, matrix: List[List[str]]) -> int: for i in range(len(matrix)): for j in range(len(matrix[0])): matrix[i][j] = int(matrix[i][j]) if i and ...
class Solution: def maximal_square(self, matrix: List[List[str]]) -> int: for i in range(len(matrix)): for j in range(len(matrix[0])): matrix[i][j] = int(matrix[i][j]) if i and j and matrix[i][j]: matrix[i][j] = min(matrix[i - 1][j - 1], matri...
seq_to_protein = dict( AUG="Methionine", UUU="Phenylalanine", UUC="Phenylalanine", UUA="Leucine", UUG="Leucine", UCU="Serine", UCC="Serine", UCA="Serine", UCG="Serine", UAU="Tyrosine", UAC="Tyrosine", UGU="Cysteine", UGC="Cysteine", UGG="Tryptophan", UAA="STOP...
seq_to_protein = dict(AUG='Methionine', UUU='Phenylalanine', UUC='Phenylalanine', UUA='Leucine', UUG='Leucine', UCU='Serine', UCC='Serine', UCA='Serine', UCG='Serine', UAU='Tyrosine', UAC='Tyrosine', UGU='Cysteine', UGC='Cysteine', UGG='Tryptophan', UAA='STOP', UAG='STOP', UGA='STOP') def get_sequences(strand: str): ...
class Solution(object): def wiggleMaxLength(self, nums): """ :type nums: List[int] :rtype: int """ if len(nums) < 2: return len(nums) res = 0 for i in xrange(1, len(nums) - 1): if nums[i] == nums[i + 1]: nums[i + 1], nu...
class Solution(object): def wiggle_max_length(self, nums): """ :type nums: List[int] :rtype: int """ if len(nums) < 2: return len(nums) res = 0 for i in xrange(1, len(nums) - 1): if nums[i] == nums[i + 1]: (nums[i + 1],...
poly = [2, 8] const = 5 out = [const] for index in range(len(poly)): out.append(poly[index] / (index + 1)) print(out)
poly = [2, 8] const = 5 out = [const] for index in range(len(poly)): out.append(poly[index] / (index + 1)) print(out)
token = '1111:example' # @ShowJsonBot chat_ids = [12345] games = [ 'monopoly', ]
token = '1111:example' chat_ids = [12345] games = ['monopoly']
# # Write a query that returns all the species in the zoo, and how many animals of # each species there are, sorted with the most populous species at the top. # # The result should have two columns: species and number. # # The animals table has columns (name, species, birthdate) for each individual. # QUERY ...
query = 'select species, count(species) number from animals group by species order by number desc'
while True: numero=int(input("")) if(numero==2002): print("Accceso Permitido") break else: print("Senha Invalida")
while True: numero = int(input('')) if numero == 2002: print('Accceso Permitido') break else: print('Senha Invalida')
""" To work around the problem of python3 not properly unpickling python2's datetime objects. Taken from http://stackoverflow.com/questions/22840092/unpickling-data-from-python-2-with-unicode-strings-in-python-3 """ def bytes_to_unicode(ob): t = type(ob) if t in (list, tuple): l = [str(i, 'utf-8') if...
""" To work around the problem of python3 not properly unpickling python2's datetime objects. Taken from http://stackoverflow.com/questions/22840092/unpickling-data-from-python-2-with-unicode-strings-in-python-3 """ def bytes_to_unicode(ob): t = type(ob) if t in (list, tuple): l = [str(i, 'utf-8') if ...
x = 25 epsilon = 0.01 #step = epsilon ** 2 numGuesses = 0 low = 0 high = max(1, x) ans = (high + low) / 2 while abs(ans**2 - x) >= epsilon: print(f"low = {low}, high ={high} , ans = {ans}") numGuesses += 1 if ans**2 < x : low = ans else: high = ans ans = (high + low) / 2 print(numG...
x = 25 epsilon = 0.01 num_guesses = 0 low = 0 high = max(1, x) ans = (high + low) / 2 while abs(ans ** 2 - x) >= epsilon: print(f'low = {low}, high ={high} , ans = {ans}') num_guesses += 1 if ans ** 2 < x: low = ans else: high = ans ans = (high + low) / 2 print(numGuesses) print(f' {...
# The optimized implementation def fib(n): if (n == 1 or n == 2): return 1 prev = 1 curr = 1 for i in range(2, n): sums = prev + curr prev = curr curr = sums return curr print(fib(50))
def fib(n): if n == 1 or n == 2: return 1 prev = 1 curr = 1 for i in range(2, n): sums = prev + curr prev = curr curr = sums return curr print(fib(50))
#@<OUT> get cluster status { "clusterName": "testCluster", "defaultReplicaSet": { "name": "default", "topology": [ { "address": "<<<hostname>>>:<<<__mysql_sandbox_port2>>>", "label": "<<<hostname>>>:<<<__mysql_sandbox_port2>>>", "ro...
{'clusterName': 'testCluster', 'defaultReplicaSet': {'name': 'default', 'topology': [{'address': '<<<hostname>>>:<<<__mysql_sandbox_port2>>>', 'label': '<<<hostname>>>:<<<__mysql_sandbox_port2>>>', 'role': 'HA'}, {'address': '<<<hostname>>>:<<<__mysql_sandbox_port1>>>', 'label': '<<<hostname>>>:<<<__mysql_sandbox_port1...
s = input().split() for i in range(len(s)): if int(s[i]) % 2 == 0: print(s[i], end=' ')
s = input().split() for i in range(len(s)): if int(s[i]) % 2 == 0: print(s[i], end=' ')
CERT_FILE = 'release.pem' SETUP_USERS_FILE = 'setup_users.sh' CERTIFICATE_FOLDER = '/opt/instance' ALLOWED_EXTENSIONS = {'pem'} ISO_REPO_URL = 'https://yum.128technology.com/isos/' ISO_RE = '(.+)\.iso$' IMAGE_FOLDER = '/opt/images' SCRIPT_FOLDER = '/opt/scripts' PRE_BOOTSTRAP = 'pre' POST_BOOTSTRAP = 'post' PRE_BOOTSTR...
cert_file = 'release.pem' setup_users_file = 'setup_users.sh' certificate_folder = '/opt/instance' allowed_extensions = {'pem'} iso_repo_url = 'https://yum.128technology.com/isos/' iso_re = '(.+)\\.iso$' image_folder = '/opt/images' script_folder = '/opt/scripts' pre_bootstrap = 'pre' post_bootstrap = 'post' pre_bootst...
#Class for sources table class Sources: def __init__(self, cursor): self.cursor = cursor #read from db #check existing pagespeed of stored sources def getSpeed(cursor, hash): sql= "SELECT sources_speed from sources WHERE sources_hash=%s LIMIT 1" data = (hash,) cursor.execut...
class Sources: def __init__(self, cursor): self.cursor = cursor def get_speed(cursor, hash): sql = 'SELECT sources_speed from sources WHERE sources_hash=%s LIMIT 1' data = (hash,) cursor.execute(sql, data) rows = cursor.fetchall() return rows def get_source...
class VectorizableBackedModel(object): r""" Mixin for models constructed from a set of :map:`Vectorizable` objects. Supports models for which visualizing the meaning of a set of components is trivial. Requires that the following methods are implemented: 1. `component_vector(index)` 2. `ins...
class Vectorizablebackedmodel(object): """ Mixin for models constructed from a set of :map:`Vectorizable` objects. Supports models for which visualizing the meaning of a set of components is trivial. Requires that the following methods are implemented: 1. `component_vector(index)` 2. `inst...
class Dog: def __init__(self, name, color): self.name = name self.color = color def bark(self): print('Woof!') fido = Dog("Fido", "brown") print(fido.name) print(fido.color) fido.bark()
class Dog: def __init__(self, name, color): self.name = name self.color = color def bark(self): print('Woof!') fido = dog('Fido', 'brown') print(fido.name) print(fido.color) fido.bark()
#!/usr/bin/env python3 #encoding=utf-8 #--------------------------------------------- # Usage: python3 4-spam_class2.py # Description: Code that needs to manage per-class instance counters, for example, # might be best off leveraging class methods. In the following, the # top-level supercla...
class Spamclass: instance_counter = 0 def count(cls): cls.instance_counter += 1 def __init__(self): self.count() count = classmethod(count) class Spamsub(SpamClass): instance_counter = 0 def __init__(self): SpamClass.__init__(self) class Spamsubother(SpamClass): ...
a=int(input()) e=[] def cont(no,arr): arr=list(set(arr)) for i in range(len(arr)): if(no==arr[i]): return True for i in range(a): b=int(input()) c=list(map(int,input().split())) e.append(c) for i in range(len(e)): e[i].sort() for i in e: f=[] g=[] for j in range(len(i)): if(cont(i[j]...
a = int(input()) e = [] def cont(no, arr): arr = list(set(arr)) for i in range(len(arr)): if no == arr[i]: return True for i in range(a): b = int(input()) c = list(map(int, input().split())) e.append(c) for i in range(len(e)): e[i].sort() for i in e: f = [] g = [] ...
def three_highest(cars): return sorted(cars, key=lambda car: car.dimensions[2], reverse=True)[:3] def three_fastest(cars): return sorted(cars, key=lambda car: car.to100km)[:3]
def three_highest(cars): return sorted(cars, key=lambda car: car.dimensions[2], reverse=True)[:3] def three_fastest(cars): return sorted(cars, key=lambda car: car.to100km)[:3]
class VPNError(Exception): """Base exception for all other project exceptions. """ pass class ConnectError(VPNError): """Exception raised on connection failure. """ pass class ParseError(VPNError): """Exception for all management interface parsing errors. """ pass
class Vpnerror(Exception): """Base exception for all other project exceptions. """ pass class Connecterror(VPNError): """Exception raised on connection failure. """ pass class Parseerror(VPNError): """Exception for all management interface parsing errors. """ pass
dollar={"rupees":75.53,"yen":107.50,"dirham":3.67,"euro":0.91,"pound":0.81} def mainCurrency(query): splitQuery=query.split() value,fromCurrency,toCurrency=splitQuery[1],splitQuery[2],splitQuery[4] if fromCurrency=="dollars":finalValue=float(value)*dollar[toCurrency] elif toCurrency=="dollars":finalValu...
dollar = {'rupees': 75.53, 'yen': 107.5, 'dirham': 3.67, 'euro': 0.91, 'pound': 0.81} def main_currency(query): split_query = query.split() (value, from_currency, to_currency) = (splitQuery[1], splitQuery[2], splitQuery[4]) if fromCurrency == 'dollars': final_value = float(value) * dollar[toCurrenc...
class Node: def __init__(self, idx, name, shape="box", color="#d6d6d6"): self.idx = idx self.name = name self.shape = shape self.color = color
class Node: def __init__(self, idx, name, shape='box', color='#d6d6d6'): self.idx = idx self.name = name self.shape = shape self.color = color
''' Created on 1.12.2016 @author: Darren '''''' Given a positive integer num, write a function which returns True if num is a perfect square else False. Note: Do not use any built-in library function such as sqrt. Example 1: Input: 16 Returns: True Example 2: Input: 14 Returns: False Cr...
""" Created on 1.12.2016 @author: Darren Given a positive integer num, write a function which returns True if num is a perfect square else False. Note: Do not use any built-in library function such as sqrt. Example 1: Input: 16 Returns: True Example 2: Input: 14 Returns: False Credits:Special thanks to @e...
#!/usr/bin/python # -*- coding: utf-8 -*- DEBUG = True SECRET_KEY = 'development key' WEB_HOST = '0.0.0.0' WEB_PORT = 8888 REDIS_HOST = 'localhost' REDIS_PORT = 7778 REDIS_PASS = 'r3'
debug = True secret_key = 'development key' web_host = '0.0.0.0' web_port = 8888 redis_host = 'localhost' redis_port = 7778 redis_pass = 'r3'