content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# determine unique number n=input("Enter the number \n") c=0 for i in n: for j in n: if(i==j): c+=1 if c>1: print("not a unique number") break else: c=0 if(c<=1): print("unique number")
n = input('Enter the number \n') c = 0 for i in n: for j in n: if i == j: c += 1 if c > 1: print('not a unique number') break else: c = 0 if c <= 1: print('unique number')
#X_train shape = (S,T,h,f,i) see figure 4 in the paper def KARI_MODEL_convlstm(X_train,n_classes): model = tf.keras.Sequential() print(X_train.shape) model.add(tf.keras.layers.ConvLSTM2D(filters=40, kernel_size=(3, 3), input_shape=(X_train.shape[1],X_train.shape[2],X_train.shape[3],X_...
def kari_model_convlstm(X_train, n_classes): model = tf.keras.Sequential() print(X_train.shape) model.add(tf.keras.layers.ConvLSTM2D(filters=40, kernel_size=(3, 3), input_shape=(X_train.shape[1], X_train.shape[2], X_train.shape[3], X_train.shape[4]), padding='same', return_sequences=True)) model.add(tf....
"""Module for text processing utility functions and classes.""" def strip_join(text_list, join_with=' '): joined_text = join_with.join(text.strip() for text in text_list if text is not None) return joined_text def paragraph_join(text_list): return '\n\n'.join([replace(te...
"""Module for text processing utility functions and classes.""" def strip_join(text_list, join_with=' '): joined_text = join_with.join((text.strip() for text in text_list if text is not None)) return joined_text def paragraph_join(text_list): return '\n\n'.join([replace(text, '\n', ' ') for text in strip_...
def store_evt_number(evt, dic): dic["Event"] = evt.GetLeaf("event").GetValue() default_attrs = ["pt", "eta", "phi"] def store(evt, dic, name, index, branch_prefix, attrs = default_attrs): for attr in attrs: if attr == "pdgId" and branch_prefix == "Tau": dic["{}_{}".format(name, "pdgId")] = ...
def store_evt_number(evt, dic): dic['Event'] = evt.GetLeaf('event').GetValue() default_attrs = ['pt', 'eta', 'phi'] def store(evt, dic, name, index, branch_prefix, attrs=default_attrs): for attr in attrs: if attr == 'pdgId' and branch_prefix == 'Tau': dic['{}_{}'.format(name, 'pdgId')] = ev...
""" Adapters - interfaces to 3rd-party services Alert - Send alerts over slack, zapier, email, and/or logging. Email - Send emails by modifying templates with params Storage - Upload and download blobs from cloud storage Each represent abstract access to whatever services are specified in the global_config. Therefor...
""" Adapters - interfaces to 3rd-party services Alert - Send alerts over slack, zapier, email, and/or logging. Email - Send emails by modifying templates with params Storage - Upload and download blobs from cloud storage Each represent abstract access to whatever services are specified in the global_config. Therefor...
numero_de_notas = 0 promedio = 0.0 print("Cuantas notas tienes?") numero_de_notas = int(input()) count = 0 while count != numero_de_notas: print("Entre nota en decimal") nota = float(input()) promedio = promedio + nota count = count + 1 promedio = promedio / numero_de_notas print("El promedio es...
numero_de_notas = 0 promedio = 0.0 print('Cuantas notas tienes?') numero_de_notas = int(input()) count = 0 while count != numero_de_notas: print('Entre nota en decimal') nota = float(input()) promedio = promedio + nota count = count + 1 promedio = promedio / numero_de_notas print('El promedio es') print...
def say_hello(name, age): return f'hello {name} you are {age} years old' hello = say_hello(name='nico', age='12') print(hello) items = ['marina', 9, 5, 'fernanda', 4, 20020, 'Irraaa', 9.5] def parse_lists(some_list): str_list_items = [] num_list_items = [] for i in some_list: if isinstance(i, float) or i...
def say_hello(name, age): return f'hello {name} you are {age} years old' hello = say_hello(name='nico', age='12') print(hello) items = ['marina', 9, 5, 'fernanda', 4, 20020, 'Irraaa', 9.5] def parse_lists(some_list): str_list_items = [] num_list_items = [] for i in some_list: if isinstance(i, f...
class Error(Exception): pass class InvalidKeysInFile(Error): def __init__(self, fileName,message = 'Keys are in invalid format'): self.file = fileName self.message = message super().__init__(message) def __str__(self): return f'{self.message} in the file {self.file}' class...
class Error(Exception): pass class Invalidkeysinfile(Error): def __init__(self, fileName, message='Keys are in invalid format'): self.file = fileName self.message = message super().__init__(message) def __str__(self): return f'{self.message} in the file {self.file}' class...
# Product Inventory Project # Create an application which manages an inventory of products. # Create a product class which has a price, ID, and qty on hand. # Then create an inventory class which keeps track of various # products and can sum up the inventory value. class product(object): if __name...
class Product(object): if __name__ == '__main__': inventory = [[], [], [], []] types = {'pid': 0, 'name': 1, 'price': 2, 'qty': 3} def __init__(self): self.pid = self.inventory[0] self.name = self.inventory[1] self.price = self.inventory[2] se...
fname = input("Enter file name: ") if len(fname) < 1 : fname = "mbox-short.txt" fh = open(fname) count = 0 for line in fh:#?????? if not line.startswith("From ") : continue From_address=line.split() address=From_address[1] count=count+1 print(address) print ("There were", count, "lines in the file w...
fname = input('Enter file name: ') if len(fname) < 1: fname = 'mbox-short.txt' fh = open(fname) count = 0 for line in fh: if not line.startswith('From '): continue from_address = line.split() address = From_address[1] count = count + 1 print(address) print('There were', count, 'lines in ...
# # Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a tree consists of a node in s and all of this node's descendants. The tree s could also be considered as a subtree of itself. # # # Example 1: # # Given tree s: # ...
class Solution: def is_subtree(self, s: TreeNode, t: TreeNode) -> bool: string_s = self.traverse_tree(s) string_t = self.traverse_tree(t) if string_t in string_s: return True return False def traverse_tree(self, s): if s: return f'#{s.val} {self....
#!/usr/bin/env python3 """Two Sums. Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. https://leetcode.com/problems/two-sum/description/ """ def two_s...
"""Two Sums. Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. https://leetcode.com/problems/two-sum/description/ """ def two_sums_brute_force(nums: lis...
fig, ax = plt.subplots(figsize=(20, 10)) for p in world_map(sph2wkl3, shapefile_path=shapefile_path): ax.add_patch( PolygonPatch(p, fc="#6699cc", ec="#6699cc", alpha=0.5, zorder=2) ) graticule(ax, (-180, 181), (-90, 91), sph2wkl3, 10) # Great circle line = geod.npts(cdg[1], cdg[0], tokyo[1], tokyo[0],...
(fig, ax) = plt.subplots(figsize=(20, 10)) for p in world_map(sph2wkl3, shapefile_path=shapefile_path): ax.add_patch(polygon_patch(p, fc='#6699cc', ec='#6699cc', alpha=0.5, zorder=2)) graticule(ax, (-180, 181), (-90, 91), sph2wkl3, 10) line = geod.npts(cdg[1], cdg[0], tokyo[1], tokyo[0], 200) ax.plot(*sph2wkl3(*np....
''' since it requires output from left to right, from up to bottom. using level order traverse, a.k.a BFS ''' # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def verticalOrder(self, roo...
""" since it requires output from left to right, from up to bottom. using level order traverse, a.k.a BFS """ class Solution: def vertical_order(self, root: TreeNode) -> List[List[int]]: if not root: return [] c = collections.defaultdict(list) res = [] queue = collectio...
""" GraphQL Query to fetch data. """ query = """ query ossQuery($timedelta: DateTime!, $username: String!, $dataCount: Int!, $issueCommentDataCount: Int!, $pullReqCursor: String, $pullreqreviewcursor: String, $issueCursor: String , $issueCommentsCursor: String, $repoCursor: String) { user(login: $username) { use...
""" GraphQL Query to fetch data. """ query = '\nquery ossQuery($timedelta: DateTime!, $username: String!, $dataCount: Int!, $issueCommentDataCount: Int!, $pullReqCursor: String, $pullreqreviewcursor: String, $issueCursor: String , $issueCommentsCursor: String, $repoCursor: String) {\n user(login: $username) {\n use...
# Define the function shout def shout(): """Print a string with three exclamation marks""" # Concatenate the strings: shout_word shout_word = 'congratulations' + '!!!' # Print shout_word print(shout_word) # Call shout shout()
def shout(): """Print a string with three exclamation marks""" shout_word = 'congratulations' + '!!!' print(shout_word) shout()
FORM_NUM = 7 # DATA FORM DF_SCALAR = 0 DF_VECTOR = 1 DF_PAIR = 2 DF_MATRIX = 3 DF_SET = 4 DF_DICTIONARY = 5 DF_TABLE = 6 DF_CHART = 7 TYPE_NUM = 27 # DATA TYPE DT_VOID = 0 DT_BOOL = 1 DT_BYTE = 2 DT_SHORT = 3 DT_INT = 4 DT_LONG = 5 DT_DATE = 6 DT_MONTH = 7 DT_TIME = 8 DT_MINUTE = 9 DT_SECOND = 10 DT_DATETIME = 11 DT_...
form_num = 7 df_scalar = 0 df_vector = 1 df_pair = 2 df_matrix = 3 df_set = 4 df_dictionary = 5 df_table = 6 df_chart = 7 type_num = 27 dt_void = 0 dt_bool = 1 dt_byte = 2 dt_short = 3 dt_int = 4 dt_long = 5 dt_date = 6 dt_month = 7 dt_time = 8 dt_minute = 9 dt_second = 10 dt_datetime = 11 dt_timestamp = 12 dt_nanotime...
""" Miscellaneous classes used throughout the |gv| codebase. .. only:: development_administrator Created on Jul. 24, 2020 @author: Jonathan Gossage """ class Counter(int): """ Implements an integer that is used as a counter. A counter counts the number of occurrences of an object or an event...
""" Miscellaneous classes used throughout the |gv| codebase. .. only:: development_administrator Created on Jul. 24, 2020 @author: Jonathan Gossage """ class Counter(int): """ Implements an integer that is used as a counter. A counter counts the number of occurrences of an object or an event...
fo = open("abalone.data","r+") c2 = [] for l in fo: s = list(l.split(',')) c2.append(float(s[1])) n = len(c2) print(round((sum(c2)/n),6))
fo = open('abalone.data', 'r+') c2 = [] for l in fo: s = list(l.split(',')) c2.append(float(s[1])) n = len(c2) print(round(sum(c2) / n, 6))
''' The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
""" The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
# This file specifies which version of Go to build and test with. It is # overridden in CI to implement multi-version testing. GO_VERSION = "1.15.5"
go_version = '1.15.5'
class Scan: def __init__(self, session): self.s = session r = session.get(url=session.url + "/api/v1/scanProfiles") self.profile = r.json()['scanProfiles'][0]['name'] self.scanProfiles = r.json()['scanProfiles'] def getProfileDetails(self, scanProfile): profileDetails ...
class Scan: def __init__(self, session): self.s = session r = session.get(url=session.url + '/api/v1/scanProfiles') self.profile = r.json()['scanProfiles'][0]['name'] self.scanProfiles = r.json()['scanProfiles'] def get_profile_details(self, scanProfile): profile_detail...
# __init__.py def get_prime(): prime = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83, 89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179, 181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271, 277,281,283,293,307,311,313,317,331,337,347,349,353,359...
def get_prime(): prime = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311,...
# # Copyright (C) 2009 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and th...
{'includes': ['../../WebKit/chromium/features.gypi', '../WebCore.gypi'], 'conditions': [['inside_chromium_build==0', {'variables': {'chromium_src_dir': '../../WebKit/chromium', 'libjpeg_gyp_path': '<(chromium_src_dir)/third_party/libjpeg_turbo/libjpeg.gyp'}}, {'variables': {'chromium_src_dir': '../../../../..'}}], ['OS...
""" Standardized application codes. """ # Exit status codes. AppStatusOkay = 0 AppStatusError = 1 AppStatusArgumentError = 2 AppStatusInitializationError = 3
""" Standardized application codes. """ app_status_okay = 0 app_status_error = 1 app_status_argument_error = 2 app_status_initialization_error = 3
N = int(input()) L = list(map(int,input().split())) D = [99999999]*(N+200) D[0] = 0 for i in range(N): for j in range(1,L[i]+1): if D[i+j] > D[i] + 1: D[i+j] = D[i]+1 if D[N-1] == 99999999: print(-1) else: print(D[N-1])
n = int(input()) l = list(map(int, input().split())) d = [99999999] * (N + 200) D[0] = 0 for i in range(N): for j in range(1, L[i] + 1): if D[i + j] > D[i] + 1: D[i + j] = D[i] + 1 if D[N - 1] == 99999999: print(-1) else: print(D[N - 1])
MAILQUEUE_CELERY = False MAILQUEUE_LIMIT = 30 MAILQUEUE_QUEUE_UP = False MAILQUEUE_CLEAR_OFFSET = 0
mailqueue_celery = False mailqueue_limit = 30 mailqueue_queue_up = False mailqueue_clear_offset = 0
# 4 10 5 / * --> 4 * (10 / 5) = 8 # 12 4 10 5 / * - 3 + --> 12 - 4 * (10 / 5) + 3 = 7 # Algorithm # for each item # if number: push it to stack # if operation: (i) pop two numbers (ii) apply operation (iii) push the result to the stack def reverse_polish_notation(s): stack = [] for item in s: i...
def reverse_polish_notation(s): stack = [] for item in s: if item in '+-*/': second = stack.pop() first = stack.pop() if item == '+': result = first + second elif item == '-': result = first - second elif item ==...
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def swapPairs(self, head): """ :type head: ListNode :rtype: ListNode """ sentinel = ListNode(None) sentinel.next = he...
class Solution: def swap_pairs(self, head): """ :type head: ListNode :rtype: ListNode """ sentinel = list_node(None) sentinel.next = head x = sentinel while x.next is not None and x.next.next is not None: y = x.next z = y.next ...
RAW_SKETCH_MARGIN = 50 RAW_WALL_COLOR = (255, 0, 0) RAW_ENTRANCE_COLOR = (0, 0, 255) RAW_LABEL_COLOR = (255, 255, 255, 128) RAW_STAIR_COLOR = (0, 255, 0) RAW_OBJECT_COLOR = (255, 0, 0) RAW_DOOR_COLOR = (255, 255, 0) ROOM_SKETCH_MARGIN = 50 ROOM_SKETCH_WALL_COLOR = (0, 255, 0) ROOM_SKETCH_HOLE_COLOR = (0, 255, 255) ROOM...
raw_sketch_margin = 50 raw_wall_color = (255, 0, 0) raw_entrance_color = (0, 0, 255) raw_label_color = (255, 255, 255, 128) raw_stair_color = (0, 255, 0) raw_object_color = (255, 0, 0) raw_door_color = (255, 255, 0) room_sketch_margin = 50 room_sketch_wall_color = (0, 255, 0) room_sketch_hole_color = (0, 255, 255) room...
"""Rasterio warnings.""" class NodataShadowWarning(Warning): """Warn that a dataset's nodata attribute is shadowing its alpha band""" def __str__(self): return ("The dataset's nodata attribute is shadowing " "the alpha band. All masks will be determined " "by the nodata...
"""Rasterio warnings.""" class Nodatashadowwarning(Warning): """Warn that a dataset's nodata attribute is shadowing its alpha band""" def __str__(self): return "The dataset's nodata attribute is shadowing the alpha band. All masks will be determined by the nodata attribute"
class MemberEntity: def __init__(self): self.email = None self.slack_member = None self.notified = False self.name = None def load(self, data: dict): self.email = data.get("email") self.slack_member = data.get("slack_member") self.name = data.get("name")
class Memberentity: def __init__(self): self.email = None self.slack_member = None self.notified = False self.name = None def load(self, data: dict): self.email = data.get('email') self.slack_member = data.get('slack_member') self.name = data.get('name')
""" Project Euler - Problem Solution 004 Copyright (c) Justin McGettigan. All rights reserved. https://github.com/jwmcgettigan/project-euler-solutions """ def is_palindrome(product) -> bool: return str(product) == str(product)[::-1] def largest_palindrome_of_products(lower_limit, upper_limit) -> int: products = [...
""" Project Euler - Problem Solution 004 Copyright (c) Justin McGettigan. All rights reserved. https://github.com/jwmcgettigan/project-euler-solutions """ def is_palindrome(product) -> bool: return str(product) == str(product)[::-1] def largest_palindrome_of_products(lower_limit, upper_limit) -> int: products...
''' This file is part of Python-Slim. Python-Slim is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Python-Slim is di...
""" This file is part of Python-Slim. Python-Slim is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Python-Slim is di...
class AlignmentError(Exception): """Raised when a data cube cannot be aligned to a given shape. This occurs for example when evaluating multivariate expressions for pixels in a data cube using the evaluate verb, filtering values in a data cube using the filter verb, or splitting a data cube into distinct gro...
class Alignmenterror(Exception): """Raised when a data cube cannot be aligned to a given shape. This occurs for example when evaluating multivariate expressions for pixels in a data cube using the evaluate verb, filtering values in a data cube using the filter verb, or splitting a data cube into distinct g...
""" Base class for runners which execute commands via a shell """ class BaseShellExec(object): def __init__(self, *args, **kwargs): raise NotImplementedError() def copy(self, rcp_cmd, files, dest): raise NotImplementedError() def execute(self, cmd, persist=False, timeout=60): raise ...
""" Base class for runners which execute commands via a shell """ class Baseshellexec(object): def __init__(self, *args, **kwargs): raise not_implemented_error() def copy(self, rcp_cmd, files, dest): raise not_implemented_error() def execute(self, cmd, persist=False, timeout=60): ...
class Solution(object): def hasAlternatingBits(self, n): """ :type n: int :rtype: bool """ s = bin(n)[2:] prev = s[0] for c in s[1:]: if c == prev: return False prev = c return True def test_has_alternating_bit...
class Solution(object): def has_alternating_bits(self, n): """ :type n: int :rtype: bool """ s = bin(n)[2:] prev = s[0] for c in s[1:]: if c == prev: return False prev = c return True def test_has_alternating_b...
input = """ a | a. b1 | b2. b1 | b4. b3 | b5. b3 | b4. b5 | b4. b2 :- b5. b2 :- b3. b3 :- b1. b4 :- a, b2. b4 :- a, b5. b5 :- b1, b4. b1 :- b5, b3. """ output = """ {a, b2, b4, b3} {a, b2, b4, b5} """
input = '\na | a.\n\nb1 | b2.\nb1 | b4.\nb3 | b5.\nb3 | b4.\nb5 | b4.\n\nb2 :- b5.\nb2 :- b3.\nb3 :- b1.\n\nb4 :- a, b2.\nb4 :- a, b5.\n\nb5 :- b1, b4.\nb1 :- b5, b3.\n' output = '\n{a, b2, b4, b3}\n{a, b2, b4, b5}\n'
''' 409. Longest Palindrome Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters. This is case sensitive, for example "Aa" is not considered a palindrome here. Note: Assume the length of given string will not exceed 1,010. E...
""" 409. Longest Palindrome Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters. This is case sensitive, for example "Aa" is not considered a palindrome here. Note: Assume the length of given string will not exceed 1,010. E...
''' --------------------------------------- experiment args --------------------------------------- ''' test_ratio, seed = 0.33, 42 n1, o, t, c = 100, 50, 3, 300 epochs, batch_size, log_interval = 50, 30, 10 lr, mmt, wd = 5e-5, 1, 0.01 test_ratio, random_seed = 0.33, 233
""" --------------------------------------- experiment args --------------------------------------- """ (test_ratio, seed) = (0.33, 42) (n1, o, t, c) = (100, 50, 3, 300) (epochs, batch_size, log_interval) = (50, 30, 10) (lr, mmt, wd) = (5e-05, 1, 0.01) (test_ratio, random_seed) = (0.33, 233)
CODE = [] REGISTERS = {'a': 0, 'b': 0, 'c': 0, 'd': 0} ip: int = 0 def val_or_reg(x): if x.lstrip('+-').isdigit(): return int(x) else: return REGISTERS[x] def ins_cpy(x, y): REGISTERS[y] = val_or_reg(x) return 1 def ins_inc(x): REGISTERS[x] += 1 return 1 def ins_dec(x): ...
code = [] registers = {'a': 0, 'b': 0, 'c': 0, 'd': 0} ip: int = 0 def val_or_reg(x): if x.lstrip('+-').isdigit(): return int(x) else: return REGISTERS[x] def ins_cpy(x, y): REGISTERS[y] = val_or_reg(x) return 1 def ins_inc(x): REGISTERS[x] += 1 return 1 def ins_dec(x): R...
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2021, Cisco Systems # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) DOCUMENTATION = r""" --- module: pnp_workflow short_description: Manage PnpWorkflow objects of DeviceOnboardingPnp description: - > Returns the...
documentation = "\n---\nmodule: pnp_workflow\nshort_description: Manage PnpWorkflow objects of DeviceOnboardingPnp\ndescription:\n- >\n Returns the list of workflows based on filter criteria. If a limit is not specified, it will default to return 50\n workflows. Pagination and sorting are also supported by this end...
""" election results model """ def get_office_result(office): """SQL query to read office results from database Args: office (integer): office id to get results of candidate (integer): candidate id to get results of """ sql = """ SELECT office_id, candidate_id, COUNT(candidate_id)...
""" election results model """ def get_office_result(office): """SQL query to read office results from database Args: office (integer): office id to get results of candidate (integer): candidate id to get results of """ sql = '\n SELECT office_id, candidate_id, COUNT(candidate_id) A...
# # @lc app=leetcode id=2 lang=python3 # # [2] Add Two Numbers # # https://leetcode.com/problems/add-two-numbers/description/ # # algorithms # Medium (30.54%) # Total Accepted: 764K # Total Submissions: 2.5M # Testcase Example: '[2,4,3]\n[5,6,4]' # # You are given two non-empty linked lists representing two non-neg...
class Solution: def reverse_list(self, lst): """ Reverse the given list. """ end = lst head = list_node(end.val) end = end.next while end is not None: tmp = list_node(end.val) tmp.next = head head = tmp end = en...
with open("input.txt") as f: lines = f.readlines() acc_fuel = 0 for line in lines: mass = int(line) while mass > 0: mass = int(mass / 3) - 2 if mass > 0: acc_fuel += mass print(acc_fuel)
with open('input.txt') as f: lines = f.readlines() acc_fuel = 0 for line in lines: mass = int(line) while mass > 0: mass = int(mass / 3) - 2 if mass > 0: acc_fuel += mass print(acc_fuel)
# Bradley Grose def foo(a, b, c, *args): return len(args) def bar(a, b, c, **kwargs): return kwargs["magicnumber"] == 7 # test code if foo(1,2,3,4) == 1: print("Good.") if foo(1,2,3,4,5) == 2: print("Better.") if bar(1,2,3,magicnumber = 6) == False: print("Great.") if bar(1,2,3,magicnumber = 7) ...
def foo(a, b, c, *args): return len(args) def bar(a, b, c, **kwargs): return kwargs['magicnumber'] == 7 if foo(1, 2, 3, 4) == 1: print('Good.') if foo(1, 2, 3, 4, 5) == 2: print('Better.') if bar(1, 2, 3, magicnumber=6) == False: print('Great.') if bar(1, 2, 3, magicnumber=7) == True: print('Aw...
# CS5nm, E01 2009M # This is question from an old midterm # It has some test cases written in the old "check_expect" style. # Here is what those test cases would look like today, using pytest def theLongerOne(s1,s2): return "stub" # this is an incorrect solution def test_theLongerOne_1(): assert theLongerOn...
def the_longer_one(s1, s2): return 'stub' def test_the_longer_one_1(): assert the_longer_one('mouse', 'cat') == 'mouse' def test_the_longer_one_2(): assert the_longer_one('mouse', 'chicken') == 'chicken' def test_the_longer_one_3(): assert the_longer_one('cat', 'dog') == 'cat'
def select(obj: dict, keys: list[str]) -> dict: return {k: obj[k] for k in obj if k in keys} def transform( data: object, *, ignore: list[str] = [], cast: dict[str,] = {}, maps: dict[str, str] = {} ) -> dict[str,]: res = {} for key, value in data.__dict__.items(): if key i...
def select(obj: dict, keys: list[str]) -> dict: return {k: obj[k] for k in obj if k in keys} def transform(data: object, *, ignore: list[str]=[], cast: dict[str,]={}, maps: dict[str, str]={}) -> dict[str,]: res = {} for (key, value) in data.__dict__.items(): if key in ignore: continue ...
def track_error(history, track_metric = 'error'): # keep a global variable to keep track referring to the same name global tracking_df train_err = history[track_metric] val_err = history['val_' + track_metric] row = dict(train_error = train_err, val_error = val_err) row_df = pd.DataFrame(row, index = [0]) ...
def track_error(history, track_metric='error'): global tracking_df train_err = history[track_metric] val_err = history['val_' + track_metric] row = dict(train_error=train_err, val_error=val_err) row_df = pd.DataFrame(row, index=[0]) tracking_df = pd.concat([tracking_df, entry_df]) tracking_d...
# Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. # The brackets must close in the correct order, "()" and "()[]{}" are all valid but "(]" and "([)]" are not. class Solution(object): def isValid(self, s): """ O(N) O(N) ...
class Solution(object): def is_valid(self, s): """ O(N) O(N) :type s: str :rtype: bool """ dic = {')': '(', ']': '[', '}': '{'} stack = [] for each_char in s: if each_char not in dic: stack.append(each_char) ...
kFiltersToolTip = [] kAddOverride = [] kStaticSelectTooltipStr = [] kRelativeWarning = [] kDragDropFilter = [] kIncludeHierarchy = [] kCollectionFilters = [] kExpressionTooltipStr = [] kSelect = [] kStaticAddTooltipStr = [] kSelectAll = [] kAddOverrideTooltipStr = [] kInverse = [] kExpressionSelectTooltipS...
k_filters_tool_tip = [] k_add_override = [] k_static_select_tooltip_str = [] k_relative_warning = [] k_drag_drop_filter = [] k_include_hierarchy = [] k_collection_filters = [] k_expression_tooltip_str = [] k_select = [] k_static_add_tooltip_str = [] k_select_all = [] k_add_override_tooltip_str = [] k_inverse = [] k_exp...
def make_exchange_name(namespace, exchange_type, extra=""): return "{}.{}".format(namespace, exchange_type) if not extra else "{}.{}@{}".format(namespace, exchange_type, extra) def make_channel_name(namespace, exchange_type): return "channel_on_{}.{}".format(namespace, exchange_type) def make_queue_name(names...
def make_exchange_name(namespace, exchange_type, extra=''): return '{}.{}'.format(namespace, exchange_type) if not extra else '{}.{}@{}'.format(namespace, exchange_type, extra) def make_channel_name(namespace, exchange_type): return 'channel_on_{}.{}'.format(namespace, exchange_type) def make_queue_name(names...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Sep 18 00:33:46 2019 @author: usrivastava """ class QueryResponse: def __init__(self, response): self.response = response.get("response")[0] print('*********QueryResponse************') print(self.response) self.inpu...
""" Created on Wed Sep 18 00:33:46 2019 @author: usrivastava """ class Queryresponse: def __init__(self, response): self.response = response.get('response')[0] print('*********QueryResponse************') print(self.response) self.input_circumstance = response.get('input_circumstan...
def memoize_left_rec(func): def memoize_left_rec_wrapper(self, *args): pos = self.mark() memo = self.memos.get(pos) if memo is None: memo = self.memos[pos] = {} key = (func, args) if key in memo: res, endpos = memo[key] self.reset(endpos) ...
def memoize_left_rec(func): def memoize_left_rec_wrapper(self, *args): pos = self.mark() memo = self.memos.get(pos) if memo is None: memo = self.memos[pos] = {} key = (func, args) if key in memo: (res, endpos) = memo[key] self.reset(endpos...
# -*- coding: utf-8 -*- """ Created on Wed Apr 01 21:38:37 2015 @author: Mickael Grima """ # Strings START = "Start" QUIT = "Quit" STOP = "Stop" START_FILE = "/home/mickael/Documents/projects/petrinetX/data/start_image.gif" # Integers BUTTON_PADX = 10 SPEED = 500 WINDOW = { 'MAIN': { 'LENGTH': 400, ...
""" Created on Wed Apr 01 21:38:37 2015 @author: Mickael Grima """ start = 'Start' quit = 'Quit' stop = 'Stop' start_file = '/home/mickael/Documents/projects/petrinetX/data/start_image.gif' button_padx = 10 speed = 500 window = {'MAIN': {'LENGTH': 400, 'WIDTH': 400}} running = True stopped = False
def make_url_from_title(string: str) -> str: return "-".join(string.split()) def make_title_from_url(string: str) -> str: return " ".join(string.split("-"))
def make_url_from_title(string: str) -> str: return '-'.join(string.split()) def make_title_from_url(string: str) -> str: return ' '.join(string.split('-'))
zodiac_elements = {"water": ["Cancer", "Scorpio", "Pisces"], "fire": ["Aries", "Leo", "Sagittarius"], "earth": ["Taurus", "Virgo", "Capricorn"], "air":["Gemini", "Libra", "Aquarius"]} zodiac_elements.update({"energy":"Not a Zodiac element"}) print(zodiac_elements["energy"])
zodiac_elements = {'water': ['Cancer', 'Scorpio', 'Pisces'], 'fire': ['Aries', 'Leo', 'Sagittarius'], 'earth': ['Taurus', 'Virgo', 'Capricorn'], 'air': ['Gemini', 'Libra', 'Aquarius']} zodiac_elements.update({'energy': 'Not a Zodiac element'}) print(zodiac_elements['energy'])
''' Fizz Buzz ''' class Solution(object): def fizzBuzz(self, n): """ :type n: int :rtype: List[str] """ outputs = [] for x in range(1, n + 1): result = "" if x % 3 == 0: result += "Fizz" if x % 5 == 0: ...
""" Fizz Buzz """ class Solution(object): def fizz_buzz(self, n): """ :type n: int :rtype: List[str] """ outputs = [] for x in range(1, n + 1): result = '' if x % 3 == 0: result += 'Fizz' if x % 5 == 0: ...
class Solution: def minDifficulty(self, jobDifficulty: List[int], d: int) -> int: n = len(jobDifficulty) if d > n: return -1 # dp[i][k] := min difficulty to schedule the first i jobs in k days dp = [[math.inf] * (d + 1) for _ in range(n + 1)] dp[0][0] = 0 for i in range(1, n + 1): ...
class Solution: def min_difficulty(self, jobDifficulty: List[int], d: int) -> int: n = len(jobDifficulty) if d > n: return -1 dp = [[math.inf] * (d + 1) for _ in range(n + 1)] dp[0][0] = 0 for i in range(1, n + 1): for k in range(1, d + 1): ...
class Solution: def firstcharacterwhichisunique(self, text): """ :type text: str :rtype: char """ lookup = dict() for char in text: if char in lookup: lookup[char] = lookup[char] + 1 else: lookup[char] = 1 ...
class Solution: def firstcharacterwhichisunique(self, text): """ :type text: str :rtype: char """ lookup = dict() for char in text: if char in lookup: lookup[char] = lookup[char] + 1 else: lookup[char] = 1 ...
#!/usr/bin/env python # encoding: utf-8 # @author: Zhipeng Ye # @contact: Zhipeng.ye19@xjtlu.edu.cn # @file: kthinanarray.py # @time: 2020-02-18 15:42 # @desc: def findKthLargest( nums, k): return findKthSmallest(nums,len(nums)-k+1) def findKthSmallest( nums, k): nums_length = len(nums) i = 0 j = nu...
def find_kth_largest(nums, k): return find_kth_smallest(nums, len(nums) - k + 1) def find_kth_smallest(nums, k): nums_length = len(nums) i = 0 j = nums_length - 1 key = nums[0] while i != j: while i < j and nums[j] > key: j -= 1 (nums[i], nums[j]) = (nums[j], nums[i]...
#General Tree Implementation class TreeNode: def __init__(self,name, data): self.name =name self.data = data self.children = [] self.parent = None def add_child(self,child): child.parent = self self.children.append(child) #getting the level of Tree element ...
class Treenode: def __init__(self, name, data): self.name = name self.data = data self.children = [] self.parent = None def add_child(self, child): child.parent = self self.children.append(child) def get_level(self): level = 0 par = self.par...
'''Linked List Intersection. Given two singly linked lists that intersect at some point, find the intersecting node. Assume the lists are non-cyclical. For example, given A = 3 -> 7 -> 8 -> 10, B = 99 -> 1 -> 8 -> 10 return the node with value 8. In this example, assume nodes with the same value are the exact sam...
"""Linked List Intersection. Given two singly linked lists that intersect at some point, find the intersecting node. Assume the lists are non-cyclical. For example, given A = 3 -> 7 -> 8 -> 10, B = 99 -> 1 -> 8 -> 10 return the node with value 8. In this example, assume nodes with the same value are the exact sam...
# Copyright (c) 2016, MD2K Center of Excellence # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list of conditio...
class Storemetadata: def store_datastrem(self, datastreamID: int=None, studyIDs: int=None, userID: int=None, processingModuleID: int=None, sourceIDs: dict=None, datastreamType: str=None, metadata: dict=None) -> int: """ This method will update a record if datastreamID is provided else it would inse...
class Solution(object): def __init__(self): self.memo = dict() self.memo[0] = 1 self.memo[1] = 1 def climbStairs(self, n): """ :type n: int :rtype: int """ if n in self.memo: return self.memo[n] steps = self.climbStairs(n -...
class Solution(object): def __init__(self): self.memo = dict() self.memo[0] = 1 self.memo[1] = 1 def climb_stairs(self, n): """ :type n: int :rtype: int """ if n in self.memo: return self.memo[n] steps = self.climbStairs(n - 1...
class SequenceColorBalance: pass
class Sequencecolorbalance: pass
class Address: def __init__(self, board: str = None, processor: str = None, actor: str = None, proc: str = None): self.processor = processor self.actor = actor self.proc = proc def equals(self, other: "Address") -> bool: return (self.processor == other.proces...
class Address: def __init__(self, board: str=None, processor: str=None, actor: str=None, proc: str=None): self.processor = processor self.actor = actor self.proc = proc def equals(self, other: 'Address') -> bool: return self.processor == other.processor and self.actor == other....
"""This module contains specific exceptions to be handled by Flask""" class UserError(Exception): def __init__(self, message, status_code=400, **kwargs): super(UserError, self).__init__(self) self.message = message self.status_code = status_code self.kwargs = kwargs def to_dic...
"""This module contains specific exceptions to be handled by Flask""" class Usererror(Exception): def __init__(self, message, status_code=400, **kwargs): super(UserError, self).__init__(self) self.message = message self.status_code = status_code self.kwargs = kwargs def to_dic...
# This is the naive implementation array_of_digits = [0,1,2,3,4,5,6,7,8,9] def next_permutation(digits): # Find largest k s. t. a[k] < a[k+1] # Find largest l > k s.t. a[k] < a[l] # Swap a[k], a[l] # Reverse a[k+1] to a[n] the final element length = len(digits) k = None l = None i =...
array_of_digits = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] def next_permutation(digits): length = len(digits) k = None l = None i = 0 while i < length - 1: if digits[i] < digits[i + 1]: k = i i += 1 if k is None: raise value_error('Max number of iterations reached') ...
# -*- coding: utf-8 -*- """Top-level package for eclipse.builder.""" __author__ = """Laurent Almeras""" __email__ = 'lalmeras@gmail.com' __version__ = '0.1.1'
"""Top-level package for eclipse.builder.""" __author__ = 'Laurent Almeras' __email__ = 'lalmeras@gmail.com' __version__ = '0.1.1'
z,w=10,-10 while(z<50): if (z>0 or w<0): print(z**2, w**3) z = z+10 w=w+10 ''' output 100 -1000 400 0 900 1000 1600 8000 '''
(z, w) = (10, -10) while z < 50: if z > 0 or w < 0: print(z ** 2, w ** 3) z = z + 10 w = w + 10 ' output\n100 -1000\n400 0\n900 1000\n1600 8000\n\n'
class Solution: def longestValidParentheses(self, s: str) -> int: if not s: return 0 ans = 0 start = len(s) - 1 while start >= 0: # Let's find the longest valid parentheses start from end if s[start] == '(': start -= 1 ...
class Solution: def longest_valid_parentheses(self, s: str) -> int: if not s: return 0 ans = 0 start = len(s) - 1 while start >= 0: if s[start] == '(': start -= 1 continue stack = [] cn = 0 f...
# parsetab.py # This file is automatically generated. Do not edit. _tabversion = '3.8' _lr_method = 'LALR' _lr_signature = 'AAF35586F16F71C8D6034AAF4C600B4A' _lr_action_items = {'DECIMAL_LITERAL':([13,19,21,22,24,25,30,40,65,68,],[21,21,-21,-19,21,-20,21,21,66,21,]),'WORD':([1,8,13,19,21,22,24,25,30,40,68,],[4,...
_tabversion = '3.8' _lr_method = 'LALR' _lr_signature = 'AAF35586F16F71C8D6034AAF4C600B4A' _lr_action_items = {'DECIMAL_LITERAL': ([13, 19, 21, 22, 24, 25, 30, 40, 65, 68], [21, 21, -21, -19, 21, -20, 21, 21, 66, 21]), 'WORD': ([1, 8, 13, 19, 21, 22, 24, 25, 30, 40, 68], [4, 15, 22, 22, -21, -19, 22, -20, 22, 22, 22]),...
#!/usr/bin/python # @copyright Copyright 2019 United States Government as represented by the Administrator of the # National Aeronautics and Space Administration. All Rights Reserved. # # @revs_title # @revs_begin # @rev_entry(Jason Harvey, CACI, GUNNS, February 2019, --, Initial implementation.} # @revs_en...
def success(dt): print('...\x1b[32mcompleted\x1b[0m in ' + str(dt) + ' seconds!') def note(msg): return '\x1b[36mNote:\x1b[0m ' + msg def warn(msg): return '\x1b[33mWarning:\x1b[0m ' + msg def abort(msg): return '\x1b[31mAborted:\x1b[0m ' + msg
class ErrorMessage(Exception): def __init__(self, msg): self.value = msg def __str__(self): return repr(self.value)
class Errormessage(Exception): def __init__(self, msg): self.value = msg def __str__(self): return repr(self.value)
class HammingCoder: # the encoding matrix G = ['1101', '1011', '1000', '0111', '0100', '0010', '0001'] def encode(self, x): y = ''.join([str(bin(int(i, 2) & int(x, 2)).count('1') % 2) for i in self.G]) return y
class Hammingcoder: g = ['1101', '1011', '1000', '0111', '0100', '0010', '0001'] def encode(self, x): y = ''.join([str(bin(int(i, 2) & int(x, 2)).count('1') % 2) for i in self.G]) return y
x = 5 y = 7 while x > 0: print("hello", x) x = x - 1 else: print("done", x)
x = 5 y = 7 while x > 0: print('hello', x) x = x - 1 else: print('done', x)
class Feature: """Feature for ContextClassifier to keep track of""" def __init__(self, name, contextFunc, featureFunc): # The name is purely for documentation purposes self.name = name # Map from (path, file content, cursor location) --> context self.contextFunc = contextFunc # Map...
class Feature: """Feature for ContextClassifier to keep track of""" def __init__(self, name, contextFunc, featureFunc): self.name = name self.contextFunc = contextFunc self.featureFunc = featureFunc class Featurechain: """Chain of features for KNFeatureChain to keep track of""" ...
n = int(input()) for i in range(n): karan = 0 j = 0 ls = list(map(int, input().split())) for x in range(len(ls) - 1): if abs(ls[x] - ls[x + 1]) > ls[x]: karan += ls[x + 1] - ls[x] * 2 print(karan)
n = int(input()) for i in range(n): karan = 0 j = 0 ls = list(map(int, input().split())) for x in range(len(ls) - 1): if abs(ls[x] - ls[x + 1]) > ls[x]: karan += ls[x + 1] - ls[x] * 2 print(karan)
def exponent(x, n): if n == 0: return x else: return x * exponent(x, n - 1) x = exponent(2,16) print(x)
def exponent(x, n): if n == 0: return x else: return x * exponent(x, n - 1) x = exponent(2, 16) print(x)
# Miguel Vaz Silva # Data Structures and Algorithms in Python - Dequeue Implementation # Copyright 2018 class Dequeue(object): def __init__(self): self.items = [] def addFront(self,n): self.items.insert(0,n) def addBack(self,n): self.items.append(n) de...
class Dequeue(object): def __init__(self): self.items = [] def add_front(self, n): self.items.insert(0, n) def add_back(self, n): self.items.append(n) def remove_back(self): return self.items.pop() def remove_front(self): return self.items.pop(0) def...
""" """ ## __all__ declaration __all__ = ()
""" """ __all__ = ()
class DateIsInappropriate(Exception): pass # print("The time of starting the journey is smaller than the time of the end") class FolderNotFound(Exception): pass class FormatIsInappropriate(Exception): pass
class Dateisinappropriate(Exception): pass class Foldernotfound(Exception): pass class Formatisinappropriate(Exception): pass
class Loc: def __init__(self, mapId:str, name: str, info:dict=None, **kwargs): self.id = '' self.mapId = mapId self.name = name self.planCoordinate = {'x': 0, 'y': 0, 'z': 0} self.actualCoordinate = {'x': 0, 'y': 0, 'z': 0} for k, v in kwargs.items(): self...
class Loc: def __init__(self, mapId: str, name: str, info: dict=None, **kwargs): self.id = '' self.mapId = mapId self.name = name self.planCoordinate = {'x': 0, 'y': 0, 'z': 0} self.actualCoordinate = {'x': 0, 'y': 0, 'z': 0} for (k, v) in kwargs.items(): ...
class Error(Exception): """Generic error class for invalid wordnet operations.""" # reset the module so the user sees the public name __module__ = 'wn'
class Error(Exception): """Generic error class for invalid wordnet operations.""" __module__ = 'wn'
# Write a program to calculate the voltage for a given values of resistance and current resistance = float(input("Enter the resistance: ")) current = float(input("Enter the current: ")) voltage = resistance * current print(f"{voltage} V")
resistance = float(input('Enter the resistance: ')) current = float(input('Enter the current: ')) voltage = resistance * current print(f'{voltage} V')
#!/usr/bin/env python """ generated source for module LogTypeConstants """ # package: com.qgs.qreservoir.global_.constants.log # TODO define in a .json file ? # Need separate set for non default SI unit for the log? class LogTypeConstants(object): """ generated source for class LogTypeConstants """ MAX_VOLTS ...
""" generated source for module LogTypeConstants """ class Logtypeconstants(object): """ generated source for class LogTypeConstants """ max_volts = 100000 min_volts = -100000 max_resistivity = 500000 min_resistivity = 0 max_temperature = 500 min_temperature = -100 max_density = 12.0 ...
# coding: utf-8 """ Created on 30.07.2018 :author: Polianok Bogdan """ class Leg: """ Class represented Leg object in skyskanner website response """ def __init__(self, jsonLeg): self.id = jsonLeg['id'] self.arrival = jsonLeg['arrival'] self.departure = jsonLeg['departure']...
""" Created on 30.07.2018 :author: Polianok Bogdan """ class Leg: """ Class represented Leg object in skyskanner website response """ def __init__(self, jsonLeg): self.id = jsonLeg['id'] self.arrival = jsonLeg['arrival'] self.departure = jsonLeg['departure'] self.dest...
def location_name(country=None, state=None): """return the name of the country and/or state used in the current filter""" locations = [] if state: locations.append(state) if country: locations.append(country) return " - ".join(locations) if len(locations) > 0 else "everywhere"
def location_name(country=None, state=None): """return the name of the country and/or state used in the current filter""" locations = [] if state: locations.append(state) if country: locations.append(country) return ' - '.join(locations) if len(locations) > 0 else 'everywhere'
nome = input('qual seu nome?') print('prazer meu amigo!!') idade = input('qual sua idade?') peso = input('qual seu peso?') print(nome,idade,peso)
nome = input('qual seu nome?') print('prazer meu amigo!!') idade = input('qual sua idade?') peso = input('qual seu peso?') print(nome, idade, peso)
# TC: O(n^2) | SC: O(1) def solution_1(arr): counter = 0 for i in range(0, len(arr)-1): for j in range(i+1, len(arr)): if arr[i] > arr[j]: counter += 1 return counter # TC: O(n log n) | SC: O(n) # Using merge method. def merge(arr, start, mid, end): i = start j...
def solution_1(arr): counter = 0 for i in range(0, len(arr) - 1): for j in range(i + 1, len(arr)): if arr[i] > arr[j]: counter += 1 return counter def merge(arr, start, mid, end): i = start j = mid + 1 temp = [] temp_index = 0 count = 0 while i <=...
# class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def levelOrder(self, root: TreeNode) -> List[List[int]]: q1 = [root] q2 = [] result = [] while len(q1) > 0: cur = [] f...
class Solution: def level_order(self, root: TreeNode) -> List[List[int]]: q1 = [root] q2 = [] result = [] while len(q1) > 0: cur = [] for t in q1: if t is None: continue q2.append(t.left) q2....
class AbstractQuery(): params: dict nome: str def __init__(self, nome: str, params): self.params = params self.nome = nome
class Abstractquery: params: dict nome: str def __init__(self, nome: str, params): self.params = params self.nome = nome
class FilesOpener(object): def __init__(self, paths, key_format='file{}'): if not isinstance(paths, list): paths = [paths] self.paths = paths self.key_format = key_format self.opened_files = [] def __enter__(self): return self.open_files() def __exit__(...
class Filesopener(object): def __init__(self, paths, key_format='file{}'): if not isinstance(paths, list): paths = [paths] self.paths = paths self.key_format = key_format self.opened_files = [] def __enter__(self): return self.open_files() def __exit__(...
def sv_score_parser(filename): """ parse score into notes """ with open(filename, "r") as file_handle: lines_score = file_handle.readlines() list_note = [] for ls in lines_score: note = ls.split('\t') list_note.append([float(note[0]), int(note[1]), float(...
def sv_score_parser(filename): """ parse score into notes """ with open(filename, 'r') as file_handle: lines_score = file_handle.readlines() list_note = [] for ls in lines_score: note = ls.split('\t') list_note.append([float(note[0]), int(note[1]), float(n...
__author__ = "Sylvain Dangin" __licence__ = "Apache 2.0" __version__ = "1.0" __maintainer__ = "Sylvain Dangin" __email__ = "sylvain.dangin@gmail.com" __status__ = "Development" class up_all_first_letters(): def transform(input_data): """Up the firsts letters of all words. :param input_data...
__author__ = 'Sylvain Dangin' __licence__ = 'Apache 2.0' __version__ = '1.0' __maintainer__ = 'Sylvain Dangin' __email__ = 'sylvain.dangin@gmail.com' __status__ = 'Development' class Up_All_First_Letters: def transform(input_data): """Up the firsts letters of all words. :param input_data:...
for n in range(1, 101): s = '' is_div_3 = n % 3 == 0 is_div_5 = n % 5 == 0 if is_div_3 or is_div_5: if is_div_3: s += 'Fizz' if is_div_5: s += 'Buzz' else: s = n print(s)
for n in range(1, 101): s = '' is_div_3 = n % 3 == 0 is_div_5 = n % 5 == 0 if is_div_3 or is_div_5: if is_div_3: s += 'Fizz' if is_div_5: s += 'Buzz' else: s = n print(s)
"""Convert Json Patch format into MongoDB update referenced from: - [jsonpatch to mongodb](https://www.npmjs.com/package/jsonpatch-to-mongodb) - [jsonpatch to mongodb - golang](https://github.com/ZaninAndrea/json-patch-to-mongo/blob/main/main.go) """ class JsonPatch2PyMongoException(Exception): pass def to_dot(...
"""Convert Json Patch format into MongoDB update referenced from: - [jsonpatch to mongodb](https://www.npmjs.com/package/jsonpatch-to-mongodb) - [jsonpatch to mongodb - golang](https://github.com/ZaninAndrea/json-patch-to-mongo/blob/main/main.go) """ class Jsonpatch2Pymongoexception(Exception): pass def to_dot(pa...
class RetryException(Exception): """ A RetryException is raised when a retry count is exceeded when trying to execute a given function. """ pass class InitException(Exception): """ An InitException is raised if an exceptional case occurs in the initialization of a given object. """...
class Retryexception(Exception): """ A RetryException is raised when a retry count is exceeded when trying to execute a given function. """ pass class Initexception(Exception): """ An InitException is raised if an exceptional case occurs in the initialization of a given object. """ ...
def success(self, urlrequest, result): print("Success") latitude = result['Response']['View'][0]['Result'][0]['Location']['NavigationPosition'][0]['Latitude'] longitude = result['Response']['View'][0]['Result'][0]['Location']['NavigationPosition'][0]['Longitude'] app = App.get_running_ap...
def success(self, urlrequest, result): print('Success') latitude = result['Response']['View'][0]['Result'][0]['Location']['NavigationPosition'][0]['Latitude'] longitude = result['Response']['View'][0]['Result'][0]['Location']['NavigationPosition'][0]['Longitude'] app = App.get_running_app() mapview ...