content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class MyOwnExceptionError(Exception): pass def do_exception(): try: 1/0 except ZeroDivisionError as error: raise MyOwnExceptionError from error if __name__ == "__main__": try: do_exception() except MyOwnExceptionError: print("My exception was caught!")
class Myownexceptionerror(Exception): pass def do_exception(): try: 1 / 0 except ZeroDivisionError as error: raise MyOwnExceptionError from error if __name__ == '__main__': try: do_exception() except MyOwnExceptionError: print('My exception was caught!')
temperature_change_rate = -2.3 * units.delta_degF / (10 * units.minutes) temperature = 25 * units.degC dt = 1.5 * units.hours print(temperature + temperature_change_rate * dt)
temperature_change_rate = -2.3 * units.delta_degF / (10 * units.minutes) temperature = 25 * units.degC dt = 1.5 * units.hours print(temperature + temperature_change_rate * dt)
# pylint: disable=no-member # -*- encoding: utf-8 -*- ''' @File : zones.py @Time : 2020/03/17 12:45:54 @Author : Kellan Fan @Version : 1.0 @Contact : kellanfan1989@gmail.com @Desc : None ''' # here put the import lib class Zones(object): def __init__(self, status='active'): self.__da...
""" @File : zones.py @Time : 2020/03/17 12:45:54 @Author : Kellan Fan @Version : 1.0 @Contact : kellanfan1989@gmail.com @Desc : None """ class Zones(object): def __init__(self, status='active'): self.__data = {'action': 'DescribeZones', 'status': status} def __call__(self): ...
# youtube-search-requests # parser/related_video_data.py # for mobile user-agent def parse_related_video_data1(data): try: d = data['contents']['singleColumnWatchNextResults']['results']['results']['contents'] except KeyError: return None for i in d: try: c = i['itemSect...
def parse_related_video_data1(data): try: d = data['contents']['singleColumnWatchNextResults']['results']['results']['contents'] except KeyError: return None for i in d: try: c = i['itemSectionRenderer']['contents'] except KeyError: continue ex...
t = int(input()) while(t!=0): n = input() if(n=='b' or n=='B'): print('BattleShip') elif(n=='c' or n=='C'): print('Cruiser') elif(n=='d' or n=='D'): print('Destroyer') elif(n=='f' or n=='F'): print('Frigate') t-=1
t = int(input()) while t != 0: n = input() if n == 'b' or n == 'B': print('BattleShip') elif n == 'c' or n == 'C': print('Cruiser') elif n == 'd' or n == 'D': print('Destroyer') elif n == 'f' or n == 'F': print('Frigate') t -= 1
""" not solved """ def get_prime(max_number): number_tiles = set(range(2, max_number)) prime_list = list() while len(number_tiles) > 0: min_number = min(number_tiles) prime_list.append(min_number) delete_tiles = set(range(min_number, max_number, min_number)) number_tiles ...
""" not solved """ def get_prime(max_number): number_tiles = set(range(2, max_number)) prime_list = list() while len(number_tiles) > 0: min_number = min(number_tiles) prime_list.append(min_number) delete_tiles = set(range(min_number, max_number, min_number)) number_tiles = n...
class NoSuchFileOrDirectory(Exception): def __init__(self): super().__init__("no such file or directory") class FileOrDirectoryAlreadyExist(Exception): def __init__(self): super().__init__("file or directory already exist") class NotAnDirectory(Exception): def __init__(self): sup...
class Nosuchfileordirectory(Exception): def __init__(self): super().__init__('no such file or directory') class Fileordirectoryalreadyexist(Exception): def __init__(self): super().__init__('file or directory already exist') class Notandirectory(Exception): def __init__(self): su...
class Solution: def findTheDifference(self, s: str, t: str) -> str: seen = {} for ch in s: if ch not in seen: seen[ch] = 0 seen[ch] += 1 for ch in t: if ch in seen and seen[ch] > 0: seen[ch] -= 1 else: ...
class Solution: def find_the_difference(self, s: str, t: str) -> str: seen = {} for ch in s: if ch not in seen: seen[ch] = 0 seen[ch] += 1 for ch in t: if ch in seen and seen[ch] > 0: seen[ch] -= 1 else: ...
"""Framework errors.""" class Error(Exception): """Base error type.""" class ConfigError(Error): """Raised on configuration error.""" class DocumentError(Error): """Base class for all document related errors.""" message = "document error" def __init__(self, message=None, document=None, field=...
"""Framework errors.""" class Error(Exception): """Base error type.""" class Configerror(Error): """Raised on configuration error.""" class Documenterror(Error): """Base class for all document related errors.""" message = 'document error' def __init__(self, message=None, document=None, field=Non...
""" This file references all the environment variables that can be passed to the application, and their default value. Kubemen will load its configuration from this file first, and then will try to override each variable with what is defined in the process environment. If a matching variable is found in the environmen...
""" This file references all the environment variables that can be passed to the application, and their default value. Kubemen will load its configuration from this file first, and then will try to override each variable with what is defined in the process environment. If a matching variable is found in the environmen...
AL = 'AL' NL = 'NL' MLB = 'MLB' LEAGUES = [AL, NL, MLB] def mlb_teams(year): """ For given year return teams active in the majors. Caveat, list is not complete; those included are only those with a current team still active. """ year = int(year) return sorted(al_teams(year) + nl_teams(y...
al = 'AL' nl = 'NL' mlb = 'MLB' leagues = [AL, NL, MLB] def mlb_teams(year): """ For given year return teams active in the majors. Caveat, list is not complete; those included are only those with a current team still active. """ year = int(year) return sorted(al_teams(year) + nl_teams(y...
# https://dmoj.ca/problem/dwite09c1p3 # https://dmoj.ca/submission/2184915 for i in range(5): n = int(input()) nums = [] for j in range(n): nums.append(int(input())) m = 0 for j in range(1,n+2): try: nums.index(j) except ValueError: m = j ...
for i in range(5): n = int(input()) nums = [] for j in range(n): nums.append(int(input())) m = 0 for j in range(1, n + 2): try: nums.index(j) except ValueError: m = j break print(m)
class Solution: def maximalSquare(self, matrix: List[List[str]]) -> int: res = 0 n = len(matrix) if n==0: return res m = len(matrix[0]) dp = [[0 for k in range(m)] for l in range(n)] for i in range(n): for j in ran...
class Solution: def maximal_square(self, matrix: List[List[str]]) -> int: res = 0 n = len(matrix) if n == 0: return res m = len(matrix[0]) dp = [[0 for k in range(m)] for l in range(n)] for i in range(n): for j in range(m): if ...
# -*- coding:utf-8 -*- # https://leetcode.com/problems/length-of-last-word/description/ class Solution(object): def lengthOfLastWord(self, s): """ :type s: str :rtype: int """ ret = 0 pos = len(s) - 1 while pos >= 0 and s[pos] == ' ': ...
class Solution(object): def length_of_last_word(self, s): """ :type s: str :rtype: int """ ret = 0 pos = len(s) - 1 while pos >= 0 and s[pos] == ' ': pos -= 1 while pos >= 0 and s[pos] != ' ': pos -= 1 ret += 1 ...
def countAndSay(n): seq = "1" for i in range(n-1): seq = getNext(seq) return seq def getNext(seq): i, next_seq = 0, "" while i < len(seq): count = 1 while i < len(seq) -1 and seq[i] == seq[i+1]: count += 1 i += 1 next_seq += str(count) + seq[...
def count_and_say(n): seq = '1' for i in range(n - 1): seq = get_next(seq) return seq def get_next(seq): (i, next_seq) = (0, '') while i < len(seq): count = 1 while i < len(seq) - 1 and seq[i] == seq[i + 1]: count += 1 i += 1 next_seq += str(c...
# coding=utf-8 """Edit distance problem Python solution.""" def edit_dist(s1, s2): dp = [[None for y in range(len(s2) + 1)] for x in range(len(s1) + 1)] for x in range(len(s1) + 1): for y in range(len(s2) + 1): if not x: dp[x][y] = y elif not y: ...
"""Edit distance problem Python solution.""" def edit_dist(s1, s2): dp = [[None for y in range(len(s2) + 1)] for x in range(len(s1) + 1)] for x in range(len(s1) + 1): for y in range(len(s2) + 1): if not x: dp[x][y] = y elif not y: dp[x][y] = x ...
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains errors/exceptions and warnings of general use for sunpy. Exceptions that are specific to a given subpackage should *not* be here, but rather in the particular subpackage. """ class SunpyWarning(Warning): """ The base warni...
""" This module contains errors/exceptions and warnings of general use for sunpy. Exceptions that are specific to a given subpackage should *not* be here, but rather in the particular subpackage. """ class Sunpywarning(Warning): """ The base warning class from which all Sunpy warnings should inherit. """ ...
# -*- coding: utf-8 -*- def get_default_options(num_machines=1, max_wallclock_seconds=1800): """ Return an instance of the options dictionary with the minimally required parameters for a JobCalculation and set to default values unless overriden :param num_machines: set the number of nodes, default=1 ...
def get_default_options(num_machines=1, max_wallclock_seconds=1800): """ Return an instance of the options dictionary with the minimally required parameters for a JobCalculation and set to default values unless overriden :param num_machines: set the number of nodes, default=1 :param max_wallclock_s...
# Instead of parsing cromwell metadata we pass the intermediate SS2 files ANALYSIS_FILE_INPUT = { "input_uuid": "0244354d-cf37-4483-8db3-425b7e504ca6", "input_file": "", "pipeline_type": "SS2", "workspace_version": "2021-10-19T17:43:52.000000Z", "ss2_bam_file": "call-HISAT2PairedEnd/cacheCopy/02443...
analysis_file_input = {'input_uuid': '0244354d-cf37-4483-8db3-425b7e504ca6', 'input_file': '', 'pipeline_type': 'SS2', 'workspace_version': '2021-10-19T17:43:52.000000Z', 'ss2_bam_file': 'call-HISAT2PairedEnd/cacheCopy/0244354d-cf37-4483-8db3-425b7e504ca6_qc.bam', 'ss2_bai_file': 'call-HISAT2PairedEnd/cacheCopy/0244354...
def login(): for n in range(3): username = input("username: ") password = input("password: ") print() if username == "admin" and password == "super_secure": return True print("Nice try @ssh013") def main(): session = login() if session: print("Welcom...
def login(): for n in range(3): username = input('username: ') password = input('password: ') print() if username == 'admin' and password == 'super_secure': return True print('Nice try @ssh013') def main(): session = login() if session: print('Welcome...
''' Rooms ''' f_number = int(input()) l_number = int(input()) step = l_number - f_number + 1 if ((l_number % step == 0) and (f_number % step == 1)): print('YES') elif (step == 1): print('YES') else: print('NO')
""" Rooms """ f_number = int(input()) l_number = int(input()) step = l_number - f_number + 1 if l_number % step == 0 and f_number % step == 1: print('YES') elif step == 1: print('YES') else: print('NO')
class ConfigError(Exception): ... class HTTPException(Exception): def __init__(self, status_code: int, detail: str = None) -> None: self.status_code = status_code self.detail = detail or 'no detail' def __repr__(self) -> str: class_name = self.__class__.__name__ return f"{...
class Configerror(Exception): ... class Httpexception(Exception): def __init__(self, status_code: int, detail: str=None) -> None: self.status_code = status_code self.detail = detail or 'no detail' def __repr__(self) -> str: class_name = self.__class__.__name__ return f'{cl...
# https://leetcode.com/problems/find-numbers-with-even-number-of-digits/ class Solution: def findNumbers(self, nums): #1 with string and len count=0 for i in range(0,len(nums)): if (len(str(nums[i]))%2==0): count+=1 return count ''' #2 Using...
class Solution: def find_numbers(self, nums): count = 0 for i in range(0, len(nums)): if len(str(nums[i])) % 2 == 0: count += 1 return count '\n #2 Using division\n count=0\n for i in nums:\n cur=0\n while(i>0):\...
sounds = { #'ON': 'data/bin/sounds/on.mp3', 'SUCCESS': ['data/bin/sounds/wicked_sick.mp3', 'data/bin/sounds/holyshit.mp3'], #'FAIL': 'data/bin/sounds/fail.mp3', 'STAGED': 'data/bin/sounds/pwned.mp3', 'KILL': 'data/bin/sounds/killing_spree.mp3', 'STAGER': 'data/bin/sounds/firstblood.mp3' }
sounds = {'SUCCESS': ['data/bin/sounds/wicked_sick.mp3', 'data/bin/sounds/holyshit.mp3'], 'STAGED': 'data/bin/sounds/pwned.mp3', 'KILL': 'data/bin/sounds/killing_spree.mp3', 'STAGER': 'data/bin/sounds/firstblood.mp3'}
class CodeforcesException(Exception): """Exception raised for errors in the input salary. Attributes: message -- explanation of the error """ def __init__(self, message="Salary is not in (5000, 15000) range"): self.message = message super().__init__(self.message) class Codefo...
class Codeforcesexception(Exception): """Exception raised for errors in the input salary. Attributes: message -- explanation of the error """ def __init__(self, message='Salary is not in (5000, 15000) range'): self.message = message super().__init__(self.message) class Codefor...
# Data mapping functions def zigbee2mqtt_device_name(topic, data, srv=None): """Return the last part of the MQTT topic name.""" return dict(name=topic.split("/")[-1]) # Filter functions def filter_xiaomi_aqara_battery_low(topic, message): """Ignore messages from Xiaomi Aqara when the battery is OK."""...
def zigbee2mqtt_device_name(topic, data, srv=None): """Return the last part of the MQTT topic name.""" return dict(name=topic.split('/')[-1]) def filter_xiaomi_aqara_battery_low(topic, message): """Ignore messages from Xiaomi Aqara when the battery is OK.""" data = json.loads(message) if 'battery' ...
# link: ######### # Approach1: find rotation index using BS and using BS search on left and # right part of rotation index # ######## class Solution(object): def search(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ if len(nums) == 0: return -1 if len(nums) == 1: ...
class Solution(object): def search(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ if len(nums) == 0: return -1 if len(nums) == 1: return 0 if nums[0] == target else -1 rotation_index = self.finRotationIndex(nums, 0, l...
class Solution: def restoreString(self, s: str, indices: List[int]) -> str: # Time complexity O(n) array = [0] * len(indices) for idx in range(len(indices)): array[indices[idx]] = s[idx] return "".join(array) class Solution: def restoreString(self,...
class Solution: def restore_string(self, s: str, indices: List[int]) -> str: array = [0] * len(indices) for idx in range(len(indices)): array[indices[idx]] = s[idx] return ''.join(array) class Solution: def restore_string(self, s: str, indices: List[int]) -> str: h...
FI_NAME, PYPATH = ( "preparation.py", "/home/nversbra/anaconda3/envs/py36/bin/python" ) with open('command_lines.txt', 'w') as f_output: for i in range(4096): n, file_name = i, "" while n > 0: file_name += str(n % 2) n //= 2 file_name = file_name +...
(fi_name, pypath) = ('preparation.py', '/home/nversbra/anaconda3/envs/py36/bin/python') with open('command_lines.txt', 'w') as f_output: for i in range(4096): (n, file_name) = (i, '') while n > 0: file_name += str(n % 2) n //= 2 file_name = file_name + '0' * (12 - len...
{ "targets" : [ { "target_name" : "edflib", "sources" : ["../lib/edf.cpp", "edfjs.cpp"], "conditions" : [ [ "OS == \"mac\"", { "xcode_settings": { "OTHER_CPLUSPLUSFLAGS" : ["-std=c++11","-stdlib=libc++"], "OTHER_LDFLAGS": ["-stdlib=libc++"], "MA...
{'targets': [{'target_name': 'edflib', 'sources': ['../lib/edf.cpp', 'edfjs.cpp'], 'conditions': [['OS == "mac"', {'xcode_settings': {'OTHER_CPLUSPLUSFLAGS': ['-std=c++11', '-stdlib=libc++'], 'OTHER_LDFLAGS': ['-stdlib=libc++'], 'MACOSX_DEPLOYMENT_TARGET': '10.7'}}]]}]}
def number(a,b): if(a%2==0 and b%2==0): print(min(a,b)) # if(a>b): # print (b) # else: # print (a) elif(a%2!=0 and b%2!=0): print(max(a,b)) # if(a>b): # print (a) # else: # print (b) else: print(max(...
def number(a, b): if a % 2 == 0 and b % 2 == 0: print(min(a, b)) elif a % 2 != 0 and b % 2 != 0: print(max(a, b)) else: print(max(a, b)) a = int(input('Enter the 1st number')) b = int(input('Enter the 2nd number')) number(a, b)
class Bin: def __init__(self, index, floor, ceiling, is_last_bin): self.index = index self.floor = floor self.ceiling = ceiling self.range = self.floor - self.ceiling self.is_last_bin = is_last_bin self.members_asc = [] def count(self): return len(self.members_asc)...
class Bin: def __init__(self, index, floor, ceiling, is_last_bin): self.index = index self.floor = floor self.ceiling = ceiling self.range = self.floor - self.ceiling self.is_last_bin = is_last_bin self.members_asc = [] def count(self): return len(self.m...
class PlayerBase: def __init__(self, position=None, team=None): self.position = position self.team = team self.hand = [] class Players(PlayerBase): def __init__(self, number_of_players=4): if number_of_players % 2: raise Exception('Error: number of players must ...
class Playerbase: def __init__(self, position=None, team=None): self.position = position self.team = team self.hand = [] class Players(PlayerBase): def __init__(self, number_of_players=4): if number_of_players % 2: raise exception('Error: number of players must be ...
logo_array = [['--------------------------------------', '--------------------------------------', '--------------------------------------', '---\\\\\\\\\\\\\\\\\\\\\\\\-----------------------', '----\\\\\\ \\\\\\----------------------', '-----\\\\\\ \\\\\\---------------------', '------\\\\\\ \\\\\\\\\\...
logo_array = [['--------------------------------------', '--------------------------------------', '--------------------------------------', '---\\\\\\\\\\\\\\\\\\\\\\\\-----------------------', '----\\\\\\ \\\\\\----------------------', '-----\\\\\\ \\\\\\---------------------', '------\\\\\\ \\\\\\\\\\...
def remove_none_entries(dictionary): keys = [k for k in dictionary if dictionary[k] is None] for k in keys: del dictionary[k] def make_dict_body(object): if object is None: return dict() if hasattr(object, 'to_dict'): return object.to_dict() return object def get_body_o...
def remove_none_entries(dictionary): keys = [k for k in dictionary if dictionary[k] is None] for k in keys: del dictionary[k] def make_dict_body(object): if object is None: return dict() if hasattr(object, 'to_dict'): return object.to_dict() return object def get_body_or_ra...
class Environment(object): def __init__(self, fl_server): self.fl_server = fl_server self.fl_server.boot() # Run federated learning self.fl_server.run() def reset(self): pass # Delete global model os.remove(self.fl_server.paths.mod...
class Environment(object): def __init__(self, fl_server): self.fl_server = fl_server self.fl_server.boot() self.fl_server.run() def reset(self): pass os.remove(self.fl_server.paths.model + '/global') def step(self, action): pass def get_reward(self): ...
# # PySNMP MIB module SWL2MGMT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SWL2MGMT-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:13:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019,...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_size_constraint, single_value_constraint, constraints_union, value_range_constraint) ...
""" If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. """ def is_multiple(number, multiple): return number % multiple == 0 def main(): i = 1 j = 0 while(i < 1000): if(is_mul...
""" If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. """ def is_multiple(number, multiple): return number % multiple == 0 def main(): i = 1 j = 0 while i < 1000: ...
#@title Train TUNIT Epoch def train_TUNIT(data_loader, networks, opts, epoch, args, additional): # avg meter d_losses = AverageMeter() d_advs = AverageMeter() d_gps = AverageMeter() g_losses = AverageMeter() g_advs = AverageMeter() g_imgrecs = AverageMeter() g_styconts = AverageMeter...
def train_tunit(data_loader, networks, opts, epoch, args, additional): d_losses = average_meter() d_advs = average_meter() d_gps = average_meter() g_losses = average_meter() g_advs = average_meter() g_imgrecs = average_meter() g_styconts = average_meter() c_losses = average_meter() m...
class BaseSave: def file(self, path, *args, **kwargs): raise NotImplementedError("Not implemented yet") def csv(self, path, *args, **kwargs): raise NotImplementedError("Not implemented yet") def xml(self, path, *args, **kwargs): raise NotImplementedError("Not implemented y...
class Basesave: def file(self, path, *args, **kwargs): raise not_implemented_error('Not implemented yet') def csv(self, path, *args, **kwargs): raise not_implemented_error('Not implemented yet') def xml(self, path, *args, **kwargs): raise not_implemented_error('Not implemented yet...
#Number letter counts# """ If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used? NOTE: Do not count spaces or hyph...
""" If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used? NOTE: Do not count spaces or hyphens. For example, 342 ...
#!/usr/bin/env python """ _BossAir_ MySQL DAO libraries for BossAir """ __all__ = []
""" _BossAir_ MySQL DAO libraries for BossAir """ __all__ = []
#!/usr/bin/python class Toy(): """ Toy definition """ # static class data count = 1 def __init__(self,name): """ Constructor """ self.name = name self.id = Toy.count Toy.count += 1
class Toy: """ Toy definition """ count = 1 def __init__(self, name): """ Constructor """ self.name = name self.id = Toy.count Toy.count += 1
#! /usr/bin/env python3 # -*- encoding: utf-8 -*- # import os # import sys press_id_file = "/boot/PRESS_ID" def get_press_id(): # Get the press_id from /boot/PRESS_ID file try: with open(press_id_file) as f: PRESS_ID = f.read() if PRESS_ID is not None: return...
press_id_file = '/boot/PRESS_ID' def get_press_id(): try: with open(press_id_file) as f: press_id = f.read() if PRESS_ID is not None: return PRESS_ID else: raise value_error('PRESS_ID is None!') except IOError: print(press_id_f...
class MemoryStorage: def __init__(self) -> None: self.data: dict[str, str] = {} def set(self, key: str, value: str) -> None: self.data[key] = value def get(self, key: str) -> str: return self.data.get(key, "") def close(self) -> bool: # NOTE: ideally, I would want this...
class Memorystorage: def __init__(self) -> None: self.data: dict[str, str] = {} def set(self, key: str, value: str) -> None: self.data[key] = value def get(self, key: str) -> str: return self.data.get(key, '') def close(self) -> bool: return True
''' Run this file as is from cp,,and line as : python file1.py ''' print("File1 __name__ = %s" % __name__) print("Full path/location for File1 __file__ = %s" % __file__) if __name__ == "__main__": print("File1 is being run directly") else: print("File1 is being imported") # Output: # File1 __name__ = __main_...
""" Run this file as is from cp,,and line as : python file1.py """ print('File1 __name__ = %s' % __name__) print('Full path/location for File1 __file__ = %s' % __file__) if __name__ == '__main__': print('File1 is being run directly') else: print('File1 is being imported')
# Code generated by font_to_py.py. # Font: Robotol.ttf # Cmd: ./font_to_py.py -x Robotol.ttf 30 myfont.py version = '0.33' def height(): return 31 def baseline(): return 24 def max_width(): return 26 def hmap(): return True def reverse(): return False def monospaced(): return False def mi...
version = '0.33' def height(): return 31 def baseline(): return 24 def max_width(): return 26 def hmap(): return True def reverse(): return False def monospaced(): return False def min_ch(): return 32 def max_ch(): return 126 _font = b'\r\x00\x00\x00\x00\x00\x00\x00\x03\xe0\x0f\x...
# Declaracion de operaciones def swap(a, b): ''' Recibe dos elementos y los intercambia ''' aux = a a = b b = aux return (a, b) def main(): ''' Cuerpo principal ''' # Entrada a = input('Ingrese el valor de a: ') b = input('Ingrese el valor de b: ') # Proceso print('Antes: ...
def swap(a, b): """ Recibe dos elementos y los intercambia """ aux = a a = b b = aux return (a, b) def main(): """ Cuerpo principal """ a = input('Ingrese el valor de a: ') b = input('Ingrese el valor de b: ') print('Antes: a = {}, b = {}'.format(a, b)) (a, b) = swap(a, b) p...
# El * se usa para indicarle una cantidad indefinida def devuelveSubElementos(*elementos): for iterador in elementos: # Devuelve un subelemento del elemento elemento dado yield from iterador nombres = devuelveSubElementos("John", "Doe") # Imprime los sub elementos del primer elemento print(next(no...
def devuelve_sub_elementos(*elementos): for iterador in elementos: yield from iterador nombres = devuelve_sub_elementos('John', 'Doe') print(next(nombres))
sample_rate = 16000 content_factor = 5 * 1e-9 loudness_factor = 0 style_factor = 1 variation_factor = 0 zero_factor = 0 fft_size = 1024
sample_rate = 16000 content_factor = 5 * 1e-09 loudness_factor = 0 style_factor = 1 variation_factor = 0 zero_factor = 0 fft_size = 1024
# The if and else blocks allow us to branch execution depending on # whether a condition is true or false. But what if there are more conditions # to take into account? This is where the elif statement, which is short for # else if, comes into play. But before we jump into how to use it, let's take a # look at why we n...
def number_group(number): if number > 0: return 'Positive' elif number < 0: return 'Negative' else: return 'Zero'
class NoClassificationError (Exception): """ When a ClassificationElement has no mapping yet set, but an operation required it. """ class MissingLabelError(Exception): """ Raised by ClassifierCollection.classify when requested classifier labels are missing from collection. """ def...
class Noclassificationerror(Exception): """ When a ClassificationElement has no mapping yet set, but an operation required it. """ class Missinglabelerror(Exception): """ Raised by ClassifierCollection.classify when requested classifier labels are missing from collection. """ def _...
"""939. Binary Tree Kth Floor Node """ """ Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ class Solution: """ @param root: the root node @param k: an integer @return: the number of nodes in the k-th layer of the...
"""939. Binary Tree Kth Floor Node """ '\nDefinition of TreeNode:\nclass TreeNode:\n def __init__(self, val):\n self.val = val\n self.left, self.right = None, None\n' class Solution: """ @param root: the root node @param k: an integer @return: the number of nodes in the k-th layer of t...
N,x=map(int,input().split()) A=list(map(int,input().split()))+[0] ans=0 for i in range(N): eated=max(0,A[i]+A[i-1]-x) ans+=eated A[i]-=eated print(ans)
(n, x) = map(int, input().split()) a = list(map(int, input().split())) + [0] ans = 0 for i in range(N): eated = max(0, A[i] + A[i - 1] - x) ans += eated A[i] -= eated print(ans)
# 5. Pounds to Dollars # Write a program that converts British pounds to US dollars formatted to the 3th decimal point. # 1 British Pound = 1.31 Dollars pound = int(input()) dollars = pound * 1.31 print(f'{dollars:.3f}')
pound = int(input()) dollars = pound * 1.31 print(f'{dollars:.3f}')
class I2C(): def __init__(self, interfaceNo): self.interfaceNo = interfaceNo self._read_result = {} self._read_arguments = {} self._write_arguments = {} def set_readfrom_mem_result(self, register, result_bytes): self._read_result[register] = result_bytes def readfr...
class I2C: def __init__(self, interfaceNo): self.interfaceNo = interfaceNo self._read_result = {} self._read_arguments = {} self._write_arguments = {} def set_readfrom_mem_result(self, register, result_bytes): self._read_result[register] = result_bytes def readfrom...
# encoding: utf-8 # module Tekla.Structures.Plugins calls itself Plugins # from Tekla.Structures.Plugins,Version=2017.0.0.0,Culture=neutral,PublicKeyToken=2f04dbe497b71114 # by generator 1.145 # no doc # no imports # no functions # classes class AutoDirectionTypeAttribute(Attribute): """ AutoDirectionTy...
class Autodirectiontypeattribute(Attribute): """ AutoDirectionTypeAttribute(Type: AutoDirectionTypeEnum) AutoDirectionTypeAttribute(Type: int) """ @staticmethod def __new__(self, Type): """ __new__(cls: type,Type: AutoDirectionTypeEnum) __new__(cls: type,Type: int) """ pass t...
# List variables are iterable and hold elements in series shopping_list = ["Tomatoes", "Bananas", "Crackers", "Sugar", "Icecream", "Bread", "Bananas", "Chocolate"] print(f"Here's the shopping list:\n{shopping_list}.\n") # You can count the number of items in a list num_items = len(shopping_list) pri...
shopping_list = ['Tomatoes', 'Bananas', 'Crackers', 'Sugar', 'Icecream', 'Bread', 'Bananas', 'Chocolate'] print(f"Here's the shopping list:\n{shopping_list}.\n") num_items = len(shopping_list) print(f'There are {num_items} things on it.') bananas_count = shopping_list.count('Bananas') print(f'"Bananas" is there {banana...
# -*- coding: utf-8 -*- """ Copyright (c) 2018, 2019 Red Hat, Inc All rights reserved. This software may be modified and distributed under the terms of the BSD license. See the LICENSE file for details. """ # Stubs for commonly-mocked classes class StubConfig(object): image_build_method = None release_env_va...
""" Copyright (c) 2018, 2019 Red Hat, Inc All rights reserved. This software may be modified and distributed under the terms of the BSD license. See the LICENSE file for details. """ class Stubconfig(object): image_build_method = None release_env_var = None class Stubsource(object): dockerfile_path = Non...
class HaydiException(BaseException): pass class TimeoutException(HaydiException): pass
class Haydiexception(BaseException): pass class Timeoutexception(HaydiException): pass
""" SimPy's monitoring capabilities will be added in version 3.1. """
""" SimPy's monitoring capabilities will be added in version 3.1. """
#map(funcao, *sequencia de args) --> Object map def qua(x): return x**2 mapa = map(qua, [1, 2, 3, 4, 5]) listmap = list(map(qua, [1, 2, 3, 4, 5])) ran = tuple(map(qua, range(10))) lamb = list(map(lambda x: x**3, range(10))) print(f''' map(...) = {mapa}\n list(map(...)) = {listmap}\n tuple(map(..., range(10))) = {...
def qua(x): return x ** 2 mapa = map(qua, [1, 2, 3, 4, 5]) listmap = list(map(qua, [1, 2, 3, 4, 5])) ran = tuple(map(qua, range(10))) lamb = list(map(lambda x: x ** 3, range(10))) print(f'\nmap(...) = {mapa}\n\nlist(map(...)) = {listmap}\n\ntuple(map(..., range(10))) = {ran}\n\nmap(funcao lambda, ...) = {lamb}\n\n ...
# Your Romeo API key, required for accessing the FACT API # override this in your local config ROMEO_API_KEY = "" # Base URL for requests against the FACT API FACT_BASE_URL = "http://www.sherpa.ac.uk/fact/api-beta" CLIENTJS_FACT_PROXY_ENDPOINT = "/fact"
romeo_api_key = '' fact_base_url = 'http://www.sherpa.ac.uk/fact/api-beta' clientjs_fact_proxy_endpoint = '/fact'
class AssignmentCode: def __init__(self,var,left,op=None,right=None): self.var = var self.left = left self.op = op self.right = right def __str__(self): if(self.op==None): return f'{self.var} = {self.left}' return f'{self.var} = {self.left}{self.op}{s...
class Assignmentcode: def __init__(self, var, left, op=None, right=None): self.var = var self.left = left self.op = op self.right = right def __str__(self): if self.op == None: return f'{self.var} = {self.left}' return f'{self.var} = {self.left}{self...
# -*- coding: utf-8 -*- class Animal: pass class Dog(Animal): def __init__(self,name): self.name=name class Cat(Animal): def __init__(self,name): self.name=name class Person: def __init__(self,name): self.name=name self.pet=None class Employee(Person): def __init...
class Animal: pass class Dog(Animal): def __init__(self, name): self.name = name class Cat(Animal): def __init__(self, name): self.name = name class Person: def __init__(self, name): self.name = name self.pet = None class Employee(Person): def __init__(self, n...
SEARCH_PARAMS = { "Sect1": "PTO2", "Sect2": "HITOFF", "u": "/netahtml/PTO/search-adv.htm", "r": "0", "p": "1", "f": "S", "l": "50", "Query": "", "d": "PTXT", } SEARCH_FIELDS = { "patent_number": "PN", "issue_date": "ISD", "title": "TTL", "abstract": "ABST", "clai...
search_params = {'Sect1': 'PTO2', 'Sect2': 'HITOFF', 'u': '/netahtml/PTO/search-adv.htm', 'r': '0', 'p': '1', 'f': 'S', 'l': '50', 'Query': '', 'd': 'PTXT'} search_fields = {'patent_number': 'PN', 'issue_date': 'ISD', 'title': 'TTL', 'abstract': 'ABST', 'claims': 'ACLM', 'specification': 'SPEC', 'current_us_classificat...
class Params: DATA_PATH = '../data/mimic-iii-clinical-database-1.4/NOTEEVENTS.csv' # Table attributes HADM_ID_STR = 'HADM_ID' CATEGORY_STR = 'CATEGORY' DESCRIPTION_STR = 'DESCRIPTION' TEXT_STR = 'TEXT' STORETIME_STR = 'STORETIME' # Category attribute - table values DISCHARGE_SUM...
class Params: data_path = '../data/mimic-iii-clinical-database-1.4/NOTEEVENTS.csv' hadm_id_str = 'HADM_ID' category_str = 'CATEGORY' description_str = 'DESCRIPTION' text_str = 'TEXT' storetime_str = 'STORETIME' discharge_summary_category_value_str = 'Discharge summary' echo_category_valu...
class MockError(object): def __init__(self, status, reason): self.status = status self.reason = reason self.extra = {'retry_after': 9, 'retry_limit': 10} def resolve_submitted(error_message, name): return MockError('submitted', 'a reason') def resolve_unavailable(error_message, name):...
class Mockerror(object): def __init__(self, status, reason): self.status = status self.reason = reason self.extra = {'retry_after': 9, 'retry_limit': 10} def resolve_submitted(error_message, name): return mock_error('submitted', 'a reason') def resolve_unavailable(error_message, name)...
""" Module to allow for the details on the extension to be encapsulated. """ # pylint: disable=too-many-instance-attributes class ExtensionDetails: """ Class to allow for the details on the extension to be encapsulated. """ # pylint: disable=too-many-arguments def __init__( self, ...
""" Module to allow for the details on the extension to be encapsulated. """ class Extensiondetails: """ Class to allow for the details on the extension to be encapsulated. """ def __init__(self, extension_id, extension_name, extension_description, extension_enabled_by_default, extension_version, exte...
with open("data.txt", 'w') as f: f.write("2 10 1 2 10\n") f.writelines(["1 2 1\n" for i in range(5)] + ["2 1 1\n" for i in range(5)]) # f.write("1 2 2\n")
with open('data.txt', 'w') as f: f.write('2 10 1 2 10\n') f.writelines(['1 2 1\n' for i in range(5)] + ['2 1 1\n' for i in range(5)])
test = { 'name': 'Problem 1', 'points': 1, 'suites': [ { 'cases': [ { 'code': r""" >>> ps = ['short', 'really long', 'tiny'] >>> s = lambda p: len(p) <= 5 >>> choose(ps, s, 0) 'short' >>> choose(ps, s, 1) 'tiny' >>> ...
test = {'name': 'Problem 1', 'points': 1, 'suites': [{'cases': [{'code': "\n >>> ps = ['short', 'really long', 'tiny']\n >>> s = lambda p: len(p) <= 5\n >>> choose(ps, s, 0)\n 'short'\n >>> choose(ps, s, 1)\n 'tiny'\n >>> choose(ps, s, 2)\n ''\n ...
def str_to_bool(x): x = str(x) return x.lower() in ('true', 't', 'yes', 'y', '1')
def str_to_bool(x): x = str(x) return x.lower() in ('true', 't', 'yes', 'y', '1')
DEFAULT_ENDPOINTS_PATH = "endpoints.yml" DEFAULT_CREDENTIALS_PATH = "credentials.yml" DEFAULT_CONFIG_PATH = "config.yml" DEFAULT_DOMAIN_PATH = "domain.yml" DEFAULT_ACTIONS_PATH = "actions" DEFAULT_MODELS_PATH = "models" DEFAULT_DATA_PATH = "data" DEFAULT_RESULTS_PATH = "results"
default_endpoints_path = 'endpoints.yml' default_credentials_path = 'credentials.yml' default_config_path = 'config.yml' default_domain_path = 'domain.yml' default_actions_path = 'actions' default_models_path = 'models' default_data_path = 'data' default_results_path = 'results'
#grid setup path = 'out' Nx = 20 Ny = 20 NxCell = 2 NyCell = 2 xmin = ymin = 0.0 xmax = ymax = 1.0
path = 'out' nx = 20 ny = 20 nx_cell = 2 ny_cell = 2 xmin = ymin = 0.0 xmax = ymax = 1.0
def calcular_itbms(valor): """ Calcualr el ITBMS (7%) Admite un valor subtotal para calcular el total (incluyendo el 7% del ITBMS) Parameters ----------- valor : float subtotal a aplicar ITBMS Returns ------- float Total con el ITBMS aplicado """ return val...
def calcular_itbms(valor): """ Calcualr el ITBMS (7%) Admite un valor subtotal para calcular el total (incluyendo el 7% del ITBMS) Parameters ----------- valor : float subtotal a aplicar ITBMS Returns ------- float Total con el ITBMS aplicado """ return val...
a=str(input("Enter the string:")) b=a.split() b.sort() print("The sorted words are:") for i in b: print(i)
a = str(input('Enter the string:')) b = a.split() b.sort() print('The sorted words are:') for i in b: print(i)
# pull an actual user out of the db to associate with these ideas ideas =[ { 'users_id': 1, 'title':'My color pallete for my home', "description":'Here is the color pallete for my apartment', 'image_url':'https://i.pinimg.com/564x/8c/f0/60/8cf06020e82ca94ddd8f65b990e84621.jpg', ...
ideas = [{'users_id': 1, 'title': 'My color pallete for my home', 'description': 'Here is the color pallete for my apartment', 'image_url': 'https://i.pinimg.com/564x/8c/f0/60/8cf06020e82ca94ddd8f65b990e84621.jpg', 'label': 'public', 'vote': 1}, {'users_id': 2, 'title': 'My next house', 'description': 'this is the plan...
word = input() word_list = list(word) reduce = [] pattern = int(input()) for index, letter in enumerate(word): counter = 0 oindex=index for i in range(pattern): if index > (len(word)-1): counter = 1 break if letter == word[index]: counter == 0 el...
word = input() word_list = list(word) reduce = [] pattern = int(input()) for (index, letter) in enumerate(word): counter = 0 oindex = index for i in range(pattern): if index > len(word) - 1: counter = 1 break if letter == word[index]: counter == 0 ...
with open('somefile.txt', 'a') as the_file: with open("wider_face_train_bbx_gt.txt") as fp: currentFileName = "" nextFileName = 0 nextBoundry = 1 boundryStart = 0 isValidBoundry = False wroteFileName = False for i, line in enum...
with open('somefile.txt', 'a') as the_file: with open('wider_face_train_bbx_gt.txt') as fp: current_file_name = '' next_file_name = 0 next_boundry = 1 boundry_start = 0 is_valid_boundry = False wrote_file_name = False for (i, line) in enumerate(fp): ...
class Cat: def __init__(self, new_name, new_age): self.name = new_name self.age = new_age def __str__(self): return "name: %s, age: %d." % (self.name, self.age) def eat(self): print("%s eat fish." % self.name) def drink(self): print("%s is drinking Cola..." % s...
class Cat: def __init__(self, new_name, new_age): self.name = new_name self.age = new_age def __str__(self): return 'name: %s, age: %d.' % (self.name, self.age) def eat(self): print('%s eat fish.' % self.name) def drink(self): print('%s is drinking Cola...' % ...
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def mergeKLists(self, lists): """ :type lists: List[ListNode] :rtype: ListNode """ head = now = ListNode(0) ...
class Solution(object): def merge_k_lists(self, lists): """ :type lists: List[ListNode] :rtype: ListNode """ head = now = list_node(0) d = {} for l in lists: while l: if not d.get(l.val, None): d[l.val] = [l] ...
def abc(base,powe): result = 1 for index in range(powe): result = result * base return result def add(a,b): sumb = a + b return sumb print(abc( int(input("Enter the base num : ")),int(input("Enter the power num : ")))) print(add( int(input("Enter num1 : ")),int(input("Enter num2 : "))))
def abc(base, powe): result = 1 for index in range(powe): result = result * base return result def add(a, b): sumb = a + b return sumb print(abc(int(input('Enter the base num : ')), int(input('Enter the power num : ')))) print(add(int(input('Enter num1 : ')), int(input('Enter num2 : '))))
description = 'Stanford SR-850 lock-in amplifier, for susceptibility measurements' group = 'optional' includes = ['base'] tango_base = 'tango://miractrl.mira.frm2:10000/mira/' devices = dict( M = device('nicos_mlz.mira.devices.sr850.Amplifier', description = 'SR850 lock-in amplifier', tangodevice...
description = 'Stanford SR-850 lock-in amplifier, for susceptibility measurements' group = 'optional' includes = ['base'] tango_base = 'tango://miractrl.mira.frm2:10000/mira/' devices = dict(M=device('nicos_mlz.mira.devices.sr850.Amplifier', description='SR850 lock-in amplifier', tangodevice=tango_base + 'sr850/io'), M...
def getsidelen(num: int): i = 3 while True: if i*i > num: return i i += 2 # inp = 44 inp = 361527 steps = 0 field = getsidelen(inp) print(field) # we need 603x603 fields = 363609 steps += field // 2 # steps to the center of 1 of the axis diff = 0 mid1 = (field * field) - fiel...
def getsidelen(num: int): i = 3 while True: if i * i > num: return i i += 2 inp = 361527 steps = 0 field = getsidelen(inp) print(field) steps += field // 2 diff = 0 mid1 = field * field - field // 2 diff = abs(inp - mid1) for i in range(3): mid1 -= field - 1 if abs(inp - mid1...
class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: hashTable = dict() for i in range(len(nums)): delta = target - nums[i] if delta in hashTable: return (i, hashTable[delta]) else: hashTable[nums[i]] = i ...
class Solution: def two_sum(self, nums: List[int], target: int) -> List[int]: hash_table = dict() for i in range(len(nums)): delta = target - nums[i] if delta in hashTable: return (i, hashTable[delta]) else: hashTable[nums[i]] = i ...
class Bar: pass def func(foo): """ Parameters: foo (Bar): ignored """ pass
class Bar: pass def func(foo): """ Parameters: foo (Bar): ignored """ pass
class Solution: # @param {integer[]} nums # @return {integer[][]} def permuteUnique(self, nums): if len(nums) == 1: return [nums] nums.sort() res = [] i = 0 while i < len(nums): sym = nums[i] tmp = nums[:i] + nums[i + 1:] ...
class Solution: def permute_unique(self, nums): if len(nums) == 1: return [nums] nums.sort() res = [] i = 0 while i < len(nums): sym = nums[i] tmp = nums[:i] + nums[i + 1:] sub = self.permuteUnique(tmp) res.extend([...
def sumOfDigit(n): if (n==0): return 0 return(n%10+sumOfDigit(int(n/10))) num=int(input("Enter number: ")) result=sumOfDigit(num) print("Output:",result)
def sum_of_digit(n): if n == 0: return 0 return n % 10 + sum_of_digit(int(n / 10)) num = int(input('Enter number: ')) result = sum_of_digit(num) print('Output:', result)
#-*- coding: utf-8 -*- # Release details for package name = "PyWavelets" version = "0.1.7" #revision = "$Revision: 118 $".split()[1] author = "Filip Wasilewski" author_email = "filip.wasilewski@gmail.com" url = "http://www.pybytes.com/pywavelets/" download_url = "http://pypi.python.org...
name = 'PyWavelets' version = '0.1.7' author = 'Filip Wasilewski' author_email = 'filip.wasilewski@gmail.com' url = 'http://www.pybytes.com/pywavelets/' download_url = 'http://pypi.python.org/pypi/PyWavelets/' license = 'MIT' description = 'PyWavelets, wavelet transform module.' keywords = ['wavelets', 'wavelet transfo...
""" Python 3 Object-Oriented Programming Case Study Chapter 10. The iterator pattern """ def test_placeholder(): pass
""" Python 3 Object-Oriented Programming Case Study Chapter 10. The iterator pattern """ def test_placeholder(): pass
valores = [334, 567, 435, 678] print( max(valores) )#exibe valor mais alto print( min(valores) )#exibe valor mais baixo pares = list(range(0,100, 2))#listando pares impar = list(range(1,101, 2))#listyando impares print(pares) print(impar) for valor in pares:#iterando valores range print(valor)
valores = [334, 567, 435, 678] print(max(valores)) print(min(valores)) pares = list(range(0, 100, 2)) impar = list(range(1, 101, 2)) print(pares) print(impar) for valor in pares: print(valor)
# https://leetcode.com/problems/maximum-product-subarray/ class Solution(object): def maxProduct(self, nums): """ Given an integer array nums, find a contiguous non-empty subarray within the array that has the largest product, and return the product. It is guaranteed that the answer will fit in a 3...
class Solution(object): def max_product(self, nums): """ Given an integer array nums, find a contiguous non-empty subarray within the array that has the largest product, and return the product. It is guaranteed that the answer will fit in a 32-bit integer. A subarray is a contiguous subsequence of ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. For example, given the following matrix: 1 0 1 0 0 1 0 1 1 1 1 1 1 1 1 1 0 0 1 0 Return 4. >>> s = Solution() >>> s.maximalSquare([['1', '1'], ...
""" Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. For example, given the following matrix: 1 0 1 0 0 1 0 1 1 1 1 1 1 1 1 1 0 0 1 0 Return 4. >>> s = Solution() >>> s.maximalSquare([['1', '1'], ['1', '1']]) 4 >>> s.maximalSquare([])...
# # PySNMP MIB module REDLINE-AN80I-IF-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/REDLINE-AN80I-IF-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:46:51 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, value_range_constraint, constraints_union, single_value_constraint) ...
class Solution: def permuteUnique(self, nums): dic = set() for p in itertools.permutations(nums): if p not in dic: dic.add(p) return list(dic)
class Solution: def permute_unique(self, nums): dic = set() for p in itertools.permutations(nums): if p not in dic: dic.add(p) return list(dic)
def plot_series(time, series, format="-", start=0, end=None): plt.plot(time[start:end], series[start:end], format) plt.xlabel("Time") plt.ylabel("Value") plt.grid(True)
def plot_series(time, series, format='-', start=0, end=None): plt.plot(time[start:end], series[start:end], format) plt.xlabel('Time') plt.ylabel('Value') plt.grid(True)
# the drivers that can be used to create thumbnails drivers = ["gee", "planet"] # the file types that can be digested by the app types = ["points", "shapes"] # define the extrems size of the thumbnails min_image = 500 max_image = 10000 # define the extreme size of the square min_square = 10 max_square = 500 # the c...
drivers = ['gee', 'planet'] types = ['points', 'shapes'] min_image = 500 max_image = 10000 min_square = 10 max_square = 500 polygon_colors = {'Red, Green, Blue': 'blue', 'Nir, Red, Green': 'yellow', 'Nir, Swir1, Red': 'yellow', 'Swir2, Nir, Red': 'yellow', 'Swir2, Swir1, Red': 'yellow', 'Swir2, Nir, Green': 'yellow', '...
kbm_text_map = { 'ConceptMouseRecenter':'Mouse Recenter', 'ConceptContextualInteraction':'Contextual Interaction', 'ConceptPitch_P':'Pitch Up', 'ConceptPitch_N':'Pitch Down', 'ConceptYaw_P':'Yaw Right', 'ConceptYaw_N':'Yaw Left', 'ConceptRoll_P':'Roll Right', 'ConceptRoll_N':'Roll Left', 'ConceptThrottle_P':'Throttle I...
kbm_text_map = {'ConceptMouseRecenter': 'Mouse Recenter', 'ConceptContextualInteraction': 'Contextual Interaction', 'ConceptPitch_P': 'Pitch Up', 'ConceptPitch_N': 'Pitch Down', 'ConceptYaw_P': 'Yaw Right', 'ConceptYaw_N': 'Yaw Left', 'ConceptRoll_P': 'Roll Right', 'ConceptRoll_N': 'Roll Left', 'ConceptThrottle_P': 'Th...
# *************************** LISTS FUNCTIONS ******************************* evenNum = [16, 4, 6, 8, 10, 12, 2 , 13] animalsPet = ["Cow","Rat","Cat","Goat","Goat"] animalsWild = ["Lion", "Tiger" , "Elephant"] print(evenNum) print(animalsPet) print(animalsWild) #Extend Function = it is use to extend or merge...
even_num = [16, 4, 6, 8, 10, 12, 2, 13] animals_pet = ['Cow', 'Rat', 'Cat', 'Goat', 'Goat'] animals_wild = ['Lion', 'Tiger', 'Elephant'] print(evenNum) print(animalsPet) print(animalsWild) animalsPet.extend(animalsWild) print(animalsPet) animalsPet.append('Rabbit') print(animalsPet) animalsWild.insert(2, 'Jackal') prin...
class Solution: def isPowerOfThree(self, n: int) -> bool: if n<=0: return False while(n>1): if n%3==0: n/=3 else: return False return True
class Solution: def is_power_of_three(self, n: int) -> bool: if n <= 0: return False while n > 1: if n % 3 == 0: n /= 3 else: return False return True