content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
#!/usr/bin/env python # Created by Bruce yuan on 18-2-13. class Solution: def isIsomorphic(self, s, t): """ :type s: str :type t: str :rtype: bool """ if len(s) != len(t): return False s_arr = [0] * len(s) t_arr = [0] * len(s) s_d...
class Solution: def is_isomorphic(self, s, t): """ :type s: str :type t: str :rtype: bool """ if len(s) != len(t): return False s_arr = [0] * len(s) t_arr = [0] * len(s) s_dict = {} t_dict = {} for i in range(len(s)...
def parseCaptions(filename): retVal = [] with open(filename, 'r') as f: for line in f.read().split("\n"): if ("Captions for image" in line): image = line[19:-1] #print("\""+image+"\"") if (" 0)" in line): best = line[5:-13] ...
def parse_captions(filename): ret_val = [] with open(filename, 'r') as f: for line in f.read().split('\n'): if 'Captions for image' in line: image = line[19:-1] if ' 0)' in line: best = line[5:-13] retVal.append((image, best)) ...
''' Pattern Enter number of rows: 5 54321 5432 543 54 5 ''' print('Number pattern: ') number_rows=int(input('Enter number of rows: ')) for row in range(1,number_rows+1): for column in range(number_rows,row,-1): if column < 10: print(f'0{column}',end=' ') else: print(column,end=' ') print(...
""" Pattern Enter number of rows: 5 54321 5432 543 54 5 """ print('Number pattern: ') number_rows = int(input('Enter number of rows: ')) for row in range(1, number_rows + 1): for column in range(number_rows, row, -1): if column < 10: print(f'0{column}', end=' ') else: print(...
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") def msbuild_rules_dependencies(): maybe( http_archive, name = "platforms", strip_prefix =...
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') load('@bazel_tools//tools/build_defs/repo:git.bzl', 'git_repository') load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'maybe') def msbuild_rules_dependencies(): maybe(http_archive, name='platforms', strip_prefix='platforms-0.0.1', urls=['ht...
""" Given a set of distinct integers, nums, return all possible subsets. Note: The solution set must not contain duplicate subsets. For example, If nums = [1,2,3], a solution is: [ [3], [1], [2], [1,2,3], [1,3], [2,3], [1,2], [] ] """ class Solution(object): ...
""" Given a set of distinct integers, nums, return all possible subsets. Note: The solution set must not contain duplicate subsets. For example, If nums = [1,2,3], a solution is: [ [3], [1], [2], [1,2,3], [1,3], [2,3], [1,2], [] ] """ class Solution(object): ...
# Key-value pair, mutable, unordered my_dict = {"name": "Jawad", "age": 27, "email": "abc@xyz.com"} print(my_dict["name"]) # Adding items my_dict["lastname"] = "Sonalkar" print(my_dict) # Modify my_dict["age"] = 28 print(my_dict) # Deleting del my_dict["email"] print(my_dict) # Pop my_dict.pop("age") print(my_dict) # ...
my_dict = {'name': 'Jawad', 'age': 27, 'email': 'abc@xyz.com'} print(my_dict['name']) my_dict['lastname'] = 'Sonalkar' print(my_dict) my_dict['age'] = 28 print(my_dict) del my_dict['email'] print(my_dict) my_dict.pop('age') print(my_dict) if 'name' in my_dict: print(f"Name exist: {my_dict['name']}") try: print(...
def words_list(): '''gets words to use''' words = {} # storing the words in a dictionary with open('/usr/share/dict/words') as f: for line in f: word = line.strip() words[word] = 1 return words def anagram_dict(words): ''' splitting words into a list and...
def words_list(): """gets words to use""" words = {} with open('/usr/share/dict/words') as f: for line in f: word = line.strip() words[word] = 1 return words def anagram_dict(words): """ splitting words into a list and checking list if they sort more than...
# -*- coding: utf-8 -*- thrift_client_timeout = 1 bind = ["0.0.0.0:8002", ]
thrift_client_timeout = 1 bind = ['0.0.0.0:8002']
# # Copyright (c) 2017-2018 Joy Diamond. All rights reserved. # @gem('Sapphire.Parse1From') def gem(): require_gem('Sapphire.BookcaseKeywordDualStatement') def parse1_statement_from_module(index): s = qs() # #<name1> # m1 = name_match(s, index) if m1 is non...
@gem('Sapphire.Parse1From') def gem(): require_gem('Sapphire.BookcaseKeywordDualStatement') def parse1_statement_from_module(index): s = qs() m1 = name_match(s, index) if m1 is none: raise_unknown_line() module = conjure_name(m1.group()) while true: ...
_lookup_overhead = { 'c': 0.55, 'c++': 0.63, 'cpp': 0.63, 'matlab': 10.85, 'python': 1.43} def calculate_speedup(src_lang, dst_lang, nloops, tinitA, t1A, t2A, t3A, tfinalA, tinitB, t1B, t2B, t3B, tfinalB, t_comm=None, T_overhead=Non...
_lookup_overhead = {'c': 0.55, 'c++': 0.63, 'cpp': 0.63, 'matlab': 10.85, 'python': 1.43} def calculate_speedup(src_lang, dst_lang, nloops, tinitA, t1A, t2A, t3A, tfinalA, tinitB, t1B, t2B, t3B, tfinalB, t_comm=None, T_overhead=None): """Function to calculate the speedup resulting from parallelism and asynchro...
""" """ __all__ = \ [ 'classproperty' , '_call_with_frames_removed' ] class _ClassPropertyDescriptor(object): def __init__(self, fget=None, fset=None): self.fget = fget self.fset = fset def __get__(self, obj, cls=None): if not self.fget: rai...
""" """ __all__ = ['classproperty', '_call_with_frames_removed'] class _Classpropertydescriptor(object): def __init__(self, fget=None, fset=None): self.fget = fget self.fset = fset def __get__(self, obj, cls=None): if not self.fget: raise attribute_error("can't get attrib...
'''Find the largest palindrome made from the product of two 3-digit numbers.''' def is_palindrome(n): return str(n) == str(n)[::-1] print(max((i*j, i, j) for i in range(100,1000) for j in range(100,1000) if is_palindrome(i*j)))
"""Find the largest palindrome made from the product of two 3-digit numbers.""" def is_palindrome(n): return str(n) == str(n)[::-1] print(max(((i * j, i, j) for i in range(100, 1000) for j in range(100, 1000) if is_palindrome(i * j))))
line1=input(); line2=input(); line3=input() gameField=[[],[],[]] k=0; j=0; i=0 while k<len(line1): num="" if line1[k]!=" ": for b in range(k,len(line1)): if line1[b]!=" ": num=line1[b] k+=1 else: k+=1 bre...
line1 = input() line2 = input() line3 = input() game_field = [[], [], []] k = 0 j = 0 i = 0 while k < len(line1): num = '' if line1[k] != ' ': for b in range(k, len(line1)): if line1[b] != ' ': num = line1[b] k += 1 else: k += 1 ...
class Solution(object): def intersect(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: List[int] """ memo = dict() res = list() for ni in nums1: if ni in memo: memo[ni] += 1 else: ...
class Solution(object): def intersect(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: List[int] """ memo = dict() res = list() for ni in nums1: if ni in memo: memo[ni] += 1 else: ...
class ScoreBoard: MIN_THRESHOLD = 1000 FINISH_THRESHOLD = 10000 def __init__(self, players): # Set the score board up with starting scores of zero self.scores = dict() for player in players: self.scores[player] = 0 def __str__(self): return "Scoreboard: %s" ...
class Scoreboard: min_threshold = 1000 finish_threshold = 10000 def __init__(self, players): self.scores = dict() for player in players: self.scores[player] = 0 def __str__(self): return 'Scoreboard: %s' % self.scores def get_score(self, player): return...
RODENSTOCK_SERIAL_NUMBERS = ((1910, 50000), (1920, 200000), (1930, 400000), (1935, 700000), (1938, 900000), (1940, 950000), (1945, 2000000), ...
rodenstock_serial_numbers = ((1910, 50000), (1920, 200000), (1930, 400000), (1935, 700000), (1938, 900000), (1940, 950000), (1945, 2000000), (1952, 2500000), (1954, 3000000), (1957, 4000000), (1961, 5000000), (1966, 6000000), (1971, 7000000), (1973, 8000000), (1974, 9000000), (1977, 9500000), (1979, 10000000), (1984, 1...
def find_multiples(inputdata): multiples = [] for x in range(1, inputdata): if x % 3 == 0 or x % 5 == 0: multiples.append(x) return sum(multiples) sum_of_multiples = find_multiples(1000) print(sum_of_multiples)
def find_multiples(inputdata): multiples = [] for x in range(1, inputdata): if x % 3 == 0 or x % 5 == 0: multiples.append(x) return sum(multiples) sum_of_multiples = find_multiples(1000) print(sum_of_multiples)
class Solution(object): def isPalindrome(self, s): """ :type s: str :rtype: bool """ s = [ch.lower() for ch in s if ch.isalnum()] return s == s[::-1]
class Solution(object): def is_palindrome(self, s): """ :type s: str :rtype: bool """ s = [ch.lower() for ch in s if ch.isalnum()] return s == s[::-1]
# # PySNMP MIB module TIARA-NETWORKS-CONFIG-MGMT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TIARA-NETWORKS-CONFIG-MGMT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:09:03 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python ...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, constraints_union, single_value_constraint, constraints_intersection) ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ UTILITIES - util.py This file provides useful methods that don't relate to any specific class """ class Util: """Provides different utility methods""" @staticmethod def get_num_range(range_string, fill=False): """Creates a integer lis...
""" UTILITIES - util.py This file provides useful methods that don't relate to any specific class """ class Util: """Provides different utility methods""" @staticmethod def get_num_range(range_string, fill=False): """Creates a integer list of a number range represented by a strin...
class Solution: def rob(self, nums): """ :type nums: List[int] :rtype: int """ if len(nums) == 0: return 0 if len(nums) <= 2: return max(nums) cache = [ 0 for _ in nums] cache[0] = nums[0] cache[1] = m...
class Solution: def rob(self, nums): """ :type nums: List[int] :rtype: int """ if len(nums) == 0: return 0 if len(nums) <= 2: return max(nums) cache = [0 for _ in nums] cache[0] = nums[0] cache[1] = max(nums[1], nums[0]...
class Error(Exception): """Base class for exceptions.""" pass class ResponseError(Error): """Exception raised for errors in the request response.""" def __init__(self, message): self.message = message
class Error(Exception): """Base class for exceptions.""" pass class Responseerror(Error): """Exception raised for errors in the request response.""" def __init__(self, message): self.message = message
def array_previous_less(items): less = [-1 for _ in items] for i in range(len(items)): for j in range(i-1, -1, -1): if items[i] > items[j]: less[i] = items[j] break return less if __name__ == '__main__': items = [3, 5, 2, 4, 5] print(array_previou...
def array_previous_less(items): less = [-1 for _ in items] for i in range(len(items)): for j in range(i - 1, -1, -1): if items[i] > items[j]: less[i] = items[j] break return less if __name__ == '__main__': items = [3, 5, 2, 4, 5] print(array_previo...
""" 200 / 200 test cases passed. Runtime: 40 ms Memory Usage: 15.9 MB """ class Solution: def maxProfit(self, prices: List[int]) -> int: ans = 0 for i in range(1, len(prices)): if prices[i] > prices[i - 1]: ans += prices[i] - prices[i - 1] return ans
""" 200 / 200 test cases passed. Runtime: 40 ms Memory Usage: 15.9 MB """ class Solution: def max_profit(self, prices: List[int]) -> int: ans = 0 for i in range(1, len(prices)): if prices[i] > prices[i - 1]: ans += prices[i] - prices[i - 1] return ans
def add_stacking_base_pairs(graph_list=None): for g in graph_list: # iterate over nodes for n, d in g.nodes_iter(data=True): if d.get('position', False) == 0 or d.get('position', False) is not False: pos = d['position'] # identify stacking neigbors ...
def add_stacking_base_pairs(graph_list=None): for g in graph_list: for (n, d) in g.nodes_iter(data=True): if d.get('position', False) == 0 or d.get('position', False) is not False: pos = d['position'] neighbors = g.neighbors(n) if len(neighbors) >=...
'''vjudge_UVA-254 - Towers of Hanoi We define a recursive formula as seen below. Essentially we see if the biggest piece has been moved. In each case, modify the initial, destination and intermediate pegs. Time: O(n), Space: O(1) ''' while True: n, m = map(int, input().split()) if (n == 0 and m == 0): break ...
"""vjudge_UVA-254 - Towers of Hanoi We define a recursive formula as seen below. Essentially we see if the biggest piece has been moved. In each case, modify the initial, destination and intermediate pegs. Time: O(n), Space: O(1) """ while True: (n, m) = map(int, input().split()) if n == 0 and m == 0: ...
class HTTPError(Exception): def __init__(self, status_code, message=""): """ Raise this exception to return an http response indicating an error. This is a boilerplate exception that was originally from Crane project. :param status_code: HTTP status code. It's a good idea to get th...
class Httperror(Exception): def __init__(self, status_code, message=''): """ Raise this exception to return an http response indicating an error. This is a boilerplate exception that was originally from Crane project. :param status_code: HTTP status code. It's a good idea to get t...
# Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def increasingBST(self, root): """ :type root: TreeNode :rtype: TreeNode """ head = TreeN...
class Treenode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def increasing_bst(self, root): """ :type root: TreeNode :rtype: TreeNode """ head = tree_node(0) pre = [head] ...
# BASE PATHS base_path = "DataBase/Queries/{query}" # Credentials credential = open(base_path.format(query="credential.sql"), 'r').read() # Descriptors descriptors = open(base_path.format(query="descriptors.sql"), 'r').read() # Mapper dictionary = open(base_path.format(query="dictionary.sql"), 'r').read()
base_path = 'DataBase/Queries/{query}' credential = open(base_path.format(query='credential.sql'), 'r').read() descriptors = open(base_path.format(query='descriptors.sql'), 'r').read() dictionary = open(base_path.format(query='dictionary.sql'), 'r').read()
# -*- coding: utf-8 -*- """ Created on Mon Mar 14 14:40:53 2016 @author: kurner """ def Primes(): """generate successive prime numbers (trial by division)""" candidate = 1 _primes_so_far = [2] # first prime, only even prime yield _primes_so_far[-1] while True: candidate += 2 # ch...
""" Created on Mon Mar 14 14:40:53 2016 @author: kurner """ def primes(): """generate successive prime numbers (trial by division)""" candidate = 1 _primes_so_far = [2] yield _primes_so_far[-1] while True: candidate += 2 for prev in _primes_so_far: if prev ** 2 > candid...
class DjangoAdminMixin: """A mixin to add django-admin utilities to a browser. """ def click_save(self): return self(xpath="//input[@name='_save']").click() def click_save_cont(self): return self(xpath="//input[@name='_continue']").click() def click_save_add(self): return ...
class Djangoadminmixin: """A mixin to add django-admin utilities to a browser. """ def click_save(self): return self(xpath="//input[@name='_save']").click() def click_save_cont(self): return self(xpath="//input[@name='_continue']").click() def click_save_add(self): return ...
def on_button_pressed_a(): global fred fred += 1 def on_button_pressed_b(): global fred fred += -1 fred = 0 def on_forever(): basic.show_number(fred) basic.forever(on_forever)
def on_button_pressed_a(): global fred fred += 1 def on_button_pressed_b(): global fred fred += -1 fred = 0 def on_forever(): basic.show_number(fred) basic.forever(on_forever)
# Values in meters LANE_OFFSET = 2 # Distance to which each lane is going to be moved LANE_OFFSET_LENGTH_REDUCTION = 0.5 # Distance reduction of each offsetted segment. # The further the lane is - the shorter it is INTERSECTION_OFFSET = 3 # Shorten segment which neighbors an intersection by this length NODES_POSIT...
lane_offset = 2 lane_offset_length_reduction = 0.5 intersection_offset = 3 nodes_position_error = 1 min_pair_length = 2
def divide(a, b): return a // b def multiply(a, b): return a * b
def divide(a, b): return a // b def multiply(a, b): return a * b
x = float(raw_input("Enter one number: ")) epsilon = 0.01 num = 0 #the number of cycle low = 0 high = x ans = (low+high)/2.0 while abs(ans**2 - x) >= epsilon: print('low = ' + str(low) + ' high = '+str(high) + ' ans = '+str(ans)) num += 1 if ans**2 > x: high = ans else: low = ans ...
x = float(raw_input('Enter one number: ')) epsilon = 0.01 num = 0 low = 0 high = x ans = (low + high) / 2.0 while abs(ans ** 2 - x) >= epsilon: print('low = ' + str(low) + ' high = ' + str(high) + ' ans = ' + str(ans)) num += 1 if ans ** 2 > x: high = ans else: low = ans ans = (low +...
# Copyright 2014 Modelling, Simulation and Design Lab (MSDL) at # McGill University and the University of Antwerp (http://msdl.cs.mcgill.ca/) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at...
""" Defines the colors to be used when drawing the model, should be colors that are understood by GraphViz. If more nodes are used than colors are provided here, they will be shown in white. """ colors = ['red', 'green', 'blue', 'yellow', 'cyan', 'magenta', 'azure', 'violet', 'rose', 'orange', 'chartreuse', 'vermili...
#!/usr/bin/env python3 """ Module description """ class Blocker: def __init__(self): self.keys = [] def fit(self, data=None): raise NotImplementedError("Please call child class method") def transform(self): raise NotImplementedError("Please call child class method") def get...
""" Module description """ class Blocker: def __init__(self): self.keys = [] def fit(self, data=None): raise not_implemented_error('Please call child class method') def transform(self): raise not_implemented_error('Please call child class method') def get_keys(self): ...
## # Copyright (c) 2007-2013 Cyrus Daboo. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
class Freebusy(object): free = 0 busytentative = 1 busyunavailable = 2 busy = 3 def __init__(self, type=None, period=None): self.mType = type if type else FreeBusy.FREE self.mPeriod = period.duplicate() if period is not None else None def duplicate(self): return free_bu...
#! /usr/bin/python3 data = [] with open('texts-data.txt','r') as file: for line in file: data.append(line) print(data)
data = [] with open('texts-data.txt', 'r') as file: for line in file: data.append(line) print(data)
""" Conf file for base_url """ base_url = "https://www.codecademy.com/"
""" Conf file for base_url """ base_url = 'https://www.codecademy.com/'
n=int(input("Enter the number of strings:")) lst=[] tc=0 for i in range(n): x=input("Enter a string:") lst.append(x) overall_lst = ''.join(lst) uniq_elems= set(overall_lst) for ch in uniq_elems: c=0 for l in lst: if ch in l: c = c+1 if c == len(lst): tc = tc+1 print(tc)
n = int(input('Enter the number of strings:')) lst = [] tc = 0 for i in range(n): x = input('Enter a string:') lst.append(x) overall_lst = ''.join(lst) uniq_elems = set(overall_lst) for ch in uniq_elems: c = 0 for l in lst: if ch in l: c = c + 1 if c == len(lst): tc = tc ...
# AUTOGENERATED! DO NOT EDIT! File to edit: 00_core.ipynb (unless otherwise specified). __all__ = ['double', 'triple', 'power'] # Cell def double(x): """Doubles an input number >>> double(2) 4 """ return x * 2 # Cell def triple(x): """ Triples an input number >>> triple(3) 9 "...
__all__ = ['double', 'triple', 'power'] def double(x): """Doubles an input number >>> double(2) 4 """ return x * 2 def triple(x): """ Triples an input number >>> triple(3) 9 """ return x * 3 def power(x, y): """ Raises x ** y > power(2, 3) 8 """ return x...
if __name__ == '__main__': command = 62 hex_command = '0x08' print(hex(command)) print(int(hex_command, 0))
if __name__ == '__main__': command = 62 hex_command = '0x08' print(hex(command)) print(int(hex_command, 0))
""" User configuration file. """ #------------------------------------------------------------------------------ # Change the values below according to your requirements. # RESOURCE = "stampede.tacc.utexas.edu" # The name of the remote machine. USERNAME = "tg802352" # Your username on the r...
""" User configuration file. """ resource = 'stampede.tacc.utexas.edu' username = 'tg802352' allocation = 'TG-MCB090174' workdir = '/work/00988/tg802352/HT-BAC/' maxcpus = 1024 server = 'mongodb://ec2-184-72-89-141.compute-1.amazonaws.com:27017' dbname = 'radical-ensemblemd' sampledata = 'http://testing.saga-project.or...
API_DATA = b"Q0sJVEtPDWt7bmg2YnhtY344enZlMSRsPjxtaTI7P2Q0PTRhNWc=" API_DATA_OAUTH = b"eW91c3V3dn9mYjF2az48bzM7Pm4wZzdlZzpk" CURRENT_DB_VERSION = 3
api_data = b'Q0sJVEtPDWt7bmg2YnhtY344enZlMSRsPjxtaTI7P2Q0PTRhNWc=' api_data_oauth = b'eW91c3V3dn9mYjF2az48bzM7Pm4wZzdlZzpk' current_db_version = 3
##\param t_shape a string of the form: ",|,|,| ... ,|," #\return a string of the form ",;,|,;,|...|,;," def omg_generator(t_shape): """ Generates the shape of OMG from the corresponding T-shape Generates the LABEL_DESCR of OMG from the LABEL_DESCR of the corresponding T for multireference cases. ...
def omg_generator(t_shape): """ Generates the shape of OMG from the corresponding T-shape Generates the LABEL_DESCR of OMG from the LABEL_DESCR of the corresponding T for multireference cases. e.g: P,H|PV,HV=>,;P,H|,;,V;PV,H This function is for cases without alternatives of the form [HV]. ""...
class Debuggable: def __init__(self, debug_text=None, show_class_name=True): self.show_class_name = show_class_name if debug_text is not None: self.debug_text = str(debug_text) @property def class_name(self): return self.__class__ # All child classes must implement ...
class Debuggable: def __init__(self, debug_text=None, show_class_name=True): self.show_class_name = show_class_name if debug_text is not None: self.debug_text = str(debug_text) @property def class_name(self): return self.__class__ def get_debug_output(self): ...
def Fibonacci(input_val): if input_val<0: pass elif input_val==1: return 0 elif input_val==2: return 1 else: return Fibonacci(input_val-1)+Fibonacci(input_val-2)
def fibonacci(input_val): if input_val < 0: pass elif input_val == 1: return 0 elif input_val == 2: return 1 else: return fibonacci(input_val - 1) + fibonacci(input_val - 2)
''' Resetting the index of a DataFrame After pivoting airquality_melt in the previous exercise, you didn't quite get back the original DataFrame. What you got back instead was a pandas DataFrame with a hierarchical index (also known as a MultiIndex). Hierarchical indexes are covered in depth in Manipulating DataFram...
""" Resetting the index of a DataFrame After pivoting airquality_melt in the previous exercise, you didn't quite get back the original DataFrame. What you got back instead was a pandas DataFrame with a hierarchical index (also known as a MultiIndex). Hierarchical indexes are covered in depth in Manipulating DataFram...
class Solution: def crackSafe(self, n: int, k: int) -> str: total = k ** n path = [0] * n seen = {tuple([0] * n)} def dfs(path): if len(seen) == total: return True else: last = path[-(n - 1):] if n > 1 else [] fo...
class Solution: def crack_safe(self, n: int, k: int) -> str: total = k ** n path = [0] * n seen = {tuple([0] * n)} def dfs(path): if len(seen) == total: return True else: last = path[-(n - 1):] if n > 1 else [] ...
_base_ = 'mask_rcnn_r50_fpn_syncbn-all_rpn-2conv_lsj_100e_coco.py' # Use RepeatDataset to speed up training # change repeat time from 4 (for 100 epochs) to 2 (for 50 epochs) data = dict(train=dict(times=2))
_base_ = 'mask_rcnn_r50_fpn_syncbn-all_rpn-2conv_lsj_100e_coco.py' data = dict(train=dict(times=2))
x=6 def sant(): print(x) sant() def sant_overwrite(): global x x+=5 print(x) sant_overwrite()
x = 6 def sant(): print(x) sant() def sant_overwrite(): global x x += 5 print(x) sant_overwrite()
# Uses python3 def get_change(m): num_of_coins = 0 coins = [10, 5, 1] index = 0 while m > 0: coin = coins[index] count = m // coin num_of_coins += count m = m - (count*coin) index = index + 1 return num_of_coins if __name__ == '__main__': m = int(input(...
def get_change(m): num_of_coins = 0 coins = [10, 5, 1] index = 0 while m > 0: coin = coins[index] count = m // coin num_of_coins += count m = m - count * coin index = index + 1 return num_of_coins if __name__ == '__main__': m = int(input()) print(get_c...
class Solution: def tester(self, A): A.append(5) if __name__=='__main__': nums1 = [1,2,3] Solution().tester(nums1) print(nums1)
class Solution: def tester(self, A): A.append(5) if __name__ == '__main__': nums1 = [1, 2, 3] solution().tester(nums1) print(nums1)
toolname = 'skewt' sources = Split(""" Adiabats.cpp IsoMR.cpp IsoPleth.cpp IsoTherms.cpp IsoPress.cpp PAdiabats.cpp PresRect.cpp Rect.cpp SkewT.cpp SkewTAdapter.cpp SkewTMetFormulas.cpp SkewTRect.cpp SkewTtrace.cpp WindBarb.cpp WindBarbs.cpp SkewTAdapterS...
toolname = 'skewt' sources = split('\n Adiabats.cpp\n IsoMR.cpp\n IsoPleth.cpp\n IsoTherms.cpp\n IsoPress.cpp\n PAdiabats.cpp\n PresRect.cpp\n Rect.cpp\n SkewT.cpp\n SkewTAdapter.cpp\n SkewTMetFormulas.cpp\n SkewTRect.cpp\n SkewTtrace.cpp\n WindBarb.cpp\n WindBarbs.cpp\n ...
"""Init Revision ID: 8dac2ad15a8d Revises: Create Date: 2021-02-23 13:57:21.708647+00:00 """ # revision identifiers, used by Alembic. revision = "8dac2ad15a8d" down_revision = None branch_labels = None depends_on = None def upgrade(): pass def downgrade(): pass
"""Init Revision ID: 8dac2ad15a8d Revises: Create Date: 2021-02-23 13:57:21.708647+00:00 """ revision = '8dac2ad15a8d' down_revision = None branch_labels = None depends_on = None def upgrade(): pass def downgrade(): pass
#utils/misc.py def custom_show_toolbar(request): return False #return "1" == request.COOKIES.get('DebugToolbar', False)
def custom_show_toolbar(request): return False
class Solution: def reverse(self, x: int) -> int: max_ = 2 ** 31 - 1 min_ = -2 ** 31 if x < min_: return 0 if x > max_: return 0 list_ = [] negative_flag = 0 if x > 0 else 1 x = x if x > 0 else -x while x: list_.appe...
class Solution: def reverse(self, x: int) -> int: max_ = 2 ** 31 - 1 min_ = -2 ** 31 if x < min_: return 0 if x > max_: return 0 list_ = [] negative_flag = 0 if x > 0 else 1 x = x if x > 0 else -x while x: list_.app...
######################################################## # Copyright (c) 2015-2017 by European Commission. # # All Rights Reserved. # ######################################################## extends("BaseKPI.py") """ Loss Of Load (h) ------------------------ Indexed by * scope ...
extends('BaseKPI.py') '\nLoss Of Load (h)\n------------------------\n\nIndexed by\n\t* scope\n\t* delivery point\n\t* energy\n\t* test case\n\nLoss Of Load (LOL), also called Loss Of Load Expectation (LOLE) represents the number of hours per year in which there is a situation of loss of load (i.e. that supply does not ...
n = int(input()) cnt = 0 for i in range(1, n+1): if n % i == 0: cnt += 1 print(cnt)
n = int(input()) cnt = 0 for i in range(1, n + 1): if n % i == 0: cnt += 1 print(cnt)
# defines an array of colors (R, G, B) # You can just look these up on the internet # Added new colors WHITE = (255, 255, 255) BLACK = (0, 0, 0) DARKGREY = (40, 40, 40) LIGHTGREY = (100, 100, 100) GREEN = (0, 255, 0) RED = (255, 0, 0) YELLOW = (255, 255, 0) # Here are the new colors I have added: GOLD = (255,215,0) PIN...
white = (255, 255, 255) black = (0, 0, 0) darkgrey = (40, 40, 40) lightgrey = (100, 100, 100) green = (0, 255, 0) red = (255, 0, 0) yellow = (255, 255, 0) gold = (255, 215, 0) pink = (255, 192, 203) blue = (0, 0, 255) title = 'Jumpy!' width = 480 height = 600 fps = 60 gravity = 9.8 player_acc = 0.5 player_friction = -0...
# Given an integer list where each number represents the number of hops you can # make, determine whether you can reach to the last index starting at index 0. def reachable(nums): index = 0 while index != len(nums) - 1: if nums[index] == 0: return False index += nums[inde...
def reachable(nums): index = 0 while index != len(nums) - 1: if nums[index] == 0: return False index += nums[index] if index >= len(nums): return False return True if __name__ == '__main__': for nums in [[2, 0, 1, 0], [1, 1, 0, 1]]: print(nums, ':'...
a = int(input()) while a != 0: saida = [] for k in range(a): saida.append([1]*a) for i in range(1, int(a/2)+1): for j in range(i, a-i): for k in range(i, a-i): saida[j][k] = i+1 out = ' '.join(["%3s"]*a) for linha in saida: print(out%tuple(linha...
a = int(input()) while a != 0: saida = [] for k in range(a): saida.append([1] * a) for i in range(1, int(a / 2) + 1): for j in range(i, a - i): for k in range(i, a - i): saida[j][k] = i + 1 out = ' '.join(['%3s'] * a) for linha in saida: print(out ...
# Question 8 - Calculate power # Asmit De # 03/24/2017 # Enter number and exponent num = int(input('Enter a number 1: ')) exp = int(input('Enter a number 2: ')) # Initialize loop counter and result i = 1 result = 1 # Run loop exp times while i <= exp: # Calculate num raised to i result *= nu...
num = int(input('Enter a number 1: ')) exp = int(input('Enter a number 2: ')) i = 1 result = 1 while i <= exp: result *= num i += 1 print(num, '**', exp, 'is', result)
abc = 'with there words' sttuff = abc.split() print(sttuff) print(len(sttuff)) print(sttuff[0]) for w in sttuff: print(w)
abc = 'with there words' sttuff = abc.split() print(sttuff) print(len(sttuff)) print(sttuff[0]) for w in sttuff: print(w)
def merge(L1: list, L2: list) -> list: """Merge sorted lists L1 and L2 into a new list and return that new list. >>> >>> merge([1, 3, 4, 6], [1, 2, 5, 7]) 1, 1, 2, 3, 4, 5, 6, 7] """ newL = [] i1 = 0 i2 = 0 # For each pair of items L1[i1] and L2[i2], copy the smaller into newL. whi...
def merge(L1: list, L2: list) -> list: """Merge sorted lists L1 and L2 into a new list and return that new list. >>> >>> merge([1, 3, 4, 6], [1, 2, 5, 7]) 1, 1, 2, 3, 4, 5, 6, 7] """ new_l = [] i1 = 0 i2 = 0 while i1 != len(L1) and i2 != len(L2): if L1[i1] <= L2[i2]: ...
""" This module tree mirrors the Linux /proc file system and provides access to it. """
""" This module tree mirrors the Linux /proc file system and provides access to it. """
## \file OutputFormat.py # \author Samuel J. Crawford, Brooks MacLachlan, and W. Spencer Smith # \brief Provides the function for writing outputs ## \brief Writes the output values to output.txt # \param s output message as a string # \param d_offset distance between the target position and the landing position: the of...
def write_output(s, d_offset): outputfile = open('output.txt', 'w') print('s = ', end='', file=outputfile) print(s, file=outputfile) print('d_offset = ', end='', file=outputfile) print(d_offset, file=outputfile) outputfile.close()
# -*- coding: utf-8 -*- """ Created on Fri Feb 26 12:26:30 2021 @author: Mark Skinner """ FONTNAME = {'Andika Afr': "AndikaAfr-R.ttf", \ 'Harmattan': "Harmattan-Regular.ttf", \ 'Scheherezade': "ScheherezadeNew-Regular.ttf", 'Ezra':'SILEOT.ttf'}
""" Created on Fri Feb 26 12:26:30 2021 @author: Mark Skinner """ fontname = {'Andika Afr': 'AndikaAfr-R.ttf', 'Harmattan': 'Harmattan-Regular.ttf', 'Scheherezade': 'ScheherezadeNew-Regular.ttf', 'Ezra': 'SILEOT.ttf'}
class ConfigurationError(Exception): pass class DiscordError(Exception): pass
class Configurationerror(Exception): pass class Discorderror(Exception): pass
class Outcome: def __init__(self, is_positive: bool, is_hard: bool): self.is_positive = is_positive self.is_hard = is_hard def __eq__(self, other): return other.is_positive == self.is_positive and other.is_hard == self.is_hard def __str__(self): return f"{'hard' if self.is...
class Outcome: def __init__(self, is_positive: bool, is_hard: bool): self.is_positive = is_positive self.is_hard = is_hard def __eq__(self, other): return other.is_positive == self.is_positive and other.is_hard == self.is_hard def __str__(self): return f"{('hard' if self.i...
#!/usr/bin/env python3 class Vertex: def __init__(self, val): self.val = val self.neighbors = [] class DiGraph: def __init__(self, n, edges): self.vertices = [Vertex(i) for i in range(n)] self.add_edges(edges) def add_edges(self, edges): for s, e in edges: ...
class Vertex: def __init__(self, val): self.val = val self.neighbors = [] class Digraph: def __init__(self, n, edges): self.vertices = [vertex(i) for i in range(n)] self.add_edges(edges) def add_edges(self, edges): for (s, e) in edges: self.vertices[s]...
AUDIO = 'audio' VIDEO = 'video' FLOW = 'flow' ENCODERS = [AUDIO, VIDEO, FLOW] NO_SEPARATION = 'none' FREQ_MASK = 'unet_mask' SEPARATION = [NO_SEPARATION, FREQ_MASK] FFT_WINDOW = 25 * 0.001 # sec FFT_OVERLAP_R = 2 # number of window overlaps NUM_SEP_TRACKS_DEF = 32 CTX_FEATS_FCUNITS_DEF = [64, 128, 128...
audio = 'audio' video = 'video' flow = 'flow' encoders = [AUDIO, VIDEO, FLOW] no_separation = 'none' freq_mask = 'unet_mask' separation = [NO_SEPARATION, FREQ_MASK] fft_window = 25 * 0.001 fft_overlap_r = 2 num_sep_tracks_def = 32 ctx_feats_fcunits_def = [64, 128, 128] sep_freq_mask_fcunits_def = [256] loc_fcunits_def ...
def plot_img(state, img, caption="", title="Image"): vis = state["vis"] img = img / 2 + 0.5 # unnormalize vis.images(img.numpy(), padding=1, opts={"title": title, "caption": caption}, win="image-" + title, nrow=4)
def plot_img(state, img, caption='', title='Image'): vis = state['vis'] img = img / 2 + 0.5 vis.images(img.numpy(), padding=1, opts={'title': title, 'caption': caption}, win='image-' + title, nrow=4)
test_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] min_num = 0 max_num = 0 for i in range(1, len(test_list)): if test_list[i] > test_list[max_num]: max_num = i if test_list[i] < test_list[min_num]: min_num = i test_list[min_num], test_list[max_num] = test_list[max_num], test_list[min_num] print(' '.joi...
test_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] min_num = 0 max_num = 0 for i in range(1, len(test_list)): if test_list[i] > test_list[max_num]: max_num = i if test_list[i] < test_list[min_num]: min_num = i (test_list[min_num], test_list[max_num]) = (test_list[max_num], test_list[min_num]) print(' '...
# # PySNMP MIB module Fore-FileXfr-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Fore-FileXfr-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:03:28 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, constraints_union, value_size_constraint, single_value_constraint) ...
# Order the input string by ASC (a -> z, 0 -> 9) with any string a = input("nhap vao chuoi: ") b = ''.join(sorted(str(a))) print("chuoi sau khi sap xep: " + str(b))
a = input('nhap vao chuoi: ') b = ''.join(sorted(str(a))) print('chuoi sau khi sap xep: ' + str(b))
class Repository: def __init__(self, repository): self.client_args = self._get_client_args() pass def _get_client_args(self): pass def check_for_image(self, git_commit_ref): pass def client(self): if not hasattr(self, "_client"): self._client = Doc...
class Repository: def __init__(self, repository): self.client_args = self._get_client_args() pass def _get_client_args(self): pass def check_for_image(self, git_commit_ref): pass def client(self): if not hasattr(self, '_client'): self._client = doc...
class BaseWidget: def on_key_down(self, *args, **kwargs): pass def on_key_up(self, *args, **kwargs): pass def on_mouse_down(self, *args, **kwargs): pass def on_mouse_up(self, *args, **kwargs): pass def on_mouse_motion(self, *args, **kwargs): pass def ...
class Basewidget: def on_key_down(self, *args, **kwargs): pass def on_key_up(self, *args, **kwargs): pass def on_mouse_down(self, *args, **kwargs): pass def on_mouse_up(self, *args, **kwargs): pass def on_mouse_motion(self, *args, **kwargs): pass def...
""" """ def get_remote_address(request): """ :param: request: request object of sanic :return: the ip address of given request (or 127.0.0.1 if none found) """ return request.remote_addr or request.ip
""" """ def get_remote_address(request): """ :param: request: request object of sanic :return: the ip address of given request (or 127.0.0.1 if none found) """ return request.remote_addr or request.ip
class UserGroups(object): """ A class to manage all core functionalities for AirWatch Organization Groups. """ jheader = {"Content-Type": "application/json"} def __init__(self, client): self.client = client def search(self, **kwargs): """Returns the Users Groups matching the s...
class Usergroups(object): """ A class to manage all core functionalities for AirWatch Organization Groups. """ jheader = {'Content-Type': 'application/json'} def __init__(self, client): self.client = client def search(self, **kwargs): """Returns the Users Groups matching the se...
#step 4: take and return input def Keyboard(): keyin = input("Command:") return (keyin) def Voice(): print("Work in progress") return 1
def keyboard(): keyin = input('Command:') return keyin def voice(): print('Work in progress') return 1
def maxLen(n, arr): # A hash map to map the sum until now to the first index where the sum was encountered # We stert with a sum=0 at the initial index position of -1 hash_map = {0:-1} summ = 0 max_count = 0 for i in range(n) : summ += arr[i] # If the sum is already present th...
def max_len(n, arr): hash_map = {0: -1} summ = 0 max_count = 0 for i in range(n): summ += arr[i] if summ in hash_map: max_count = max(max_count, i - hash_map[summ]) else: hash_map[summ] = i return max_count if __name__ == '__main__': t = int(input(...
class MemoizedRecursiveDynamicProgrammingSolver: #[memoization def __init__(self, createMap: "IForwardStateSpace -> IMap<State, R>"=lambda space: dict()): self.createMap = createMap def solve(self, space: "IBackwardsStateSpace", semiring: "ISemiRing<R>", w:"State,...
class Memoizedrecursivedynamicprogrammingsolver: def __init__(self, createMap: 'IForwardStateSpace -> IMap<State, R>'=lambda space: dict()): self.createMap = createMap def solve(self, space: 'IBackwardsStateSpace', semiring: 'ISemiRing<R>', w: 'State, Decision -> R') -> 'R': def _solve(s: 'St...
class Solution(object): def canJump(self, nums): """ :type nums: List[int] :rtype: bool """ if len(nums) == 1: return True if nums[0] == 0: return False # find the max jump in nums maxNum = max(nums) # check 0s in nums # since only the 0s will block way to the end ...
class Solution(object): def can_jump(self, nums): """ :type nums: List[int] :rtype: bool """ if len(nums) == 1: return True if nums[0] == 0: return False max_num = max(nums) for i in range(nums.count(0)): index = nums.index(0) ...
# write a Python program to check whether variable is of integer or string var = "hello" try: print(int(var)) print(f'{var} is an integer') except ValueError: print(f'{var} is a string')
var = 'hello' try: print(int(var)) print(f'{var} is an integer') except ValueError: print(f'{var} is a string')
elements = [] #for i in range (0,98): # elements.append([]) # index 0 for lift, 1 for toilet, 2 for stairs #from 0 elements.append(["turn left and go straight 2 to 3 metres","turn right and go straight 4 to 5 metres","turn left and go straight 7 to 8 metres"]) #from 1 to 10 elements.append(["turn back and move 5 to ...
elements = [] elements.append(['turn left and go straight 2 to 3 metres', 'turn right and go straight 4 to 5 metres', 'turn left and go straight 7 to 8 metres']) elements.append(['turn back and move 5 to 6 metres then take right', 'turn back and move 5 to 6 metres then take right', 'turn back and move 5 to 6 metres and...
class Solution: def reverseBits(self, n: int) -> int: return self.__onePass(n) # return self.__twoPointers(n) # time complexity: O(n), space complexity: O(1) def __onePass(self, n: int) -> int: ans = 0 for i in range(32): bit = n >> i & 1 ans = ans <<...
class Solution: def reverse_bits(self, n: int) -> int: return self.__onePass(n) def __one_pass(self, n: int) -> int: ans = 0 for i in range(32): bit = n >> i & 1 ans = ans << 1 ans = ans | bit return ans def __swap_bits(self, n, l: int, ...
# -*- coding: utf-8 -*- MEDIA_ROOT = '' MEDIA_URL = '' STATIC_ROOT = '' STATIC_URL = '/static/' STATICFILES_DIRS = () STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', )
media_root = '' media_url = '' static_root = '' static_url = '/static/' staticfiles_dirs = () staticfiles_finders = ('django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder')
n = input() a = sorted(map(int, input().strip().split())) d = [c2 - c1 for c1, c2 in zip(a, a[1:])] m = min(d) print(f"{m} {d.count(m)}")
n = input() a = sorted(map(int, input().strip().split())) d = [c2 - c1 for (c1, c2) in zip(a, a[1:])] m = min(d) print(f'{m} {d.count(m)}')
x,y=map(int,input().split()) if(y<45 and x>0): print(x-1,y+15) elif(y>44): print(x,y-45) else: print(23,y+15)
(x, y) = map(int, input().split()) if y < 45 and x > 0: print(x - 1, y + 15) elif y > 44: print(x, y - 45) else: print(23, y + 15)
words = { "giant", "robes", "harry", "stars", "albus", "james", "books", "wands", "knuts", "fangs", "ginny", "percy", "twins", "goyle", "draco", "snape", "filch", "hooch", "argus", "binns", "boils", "slugs", "patil", "pince"...
words = {'giant', 'robes', 'harry', 'stars', 'albus', 'james', 'books', 'wands', 'knuts', 'fangs', 'ginny', 'percy', 'twins', 'goyle', 'draco', 'snape', 'filch', 'hooch', 'argus', 'binns', 'boils', 'slugs', 'patil', 'pince', 'teddy', 'dobby', 'errol', 'molly', 'loony', 'runes', 'lumos', 'lupin', 'moony', 'chang', 'zonk...
class CachedSingleton(object): """Provides caching singleton storage for data access decoration. Usage: class CachedSingletonClass(CachedSingleton): def _getitem(self, name): # implement data getting routine, such as db access CachedSingletonClass().attribute...
class Cachedsingleton(object): """Provides caching singleton storage for data access decoration. Usage: class CachedSingletonClass(CachedSingleton): def _getitem(self, name): # implement data getting routine, such as db access CachedSingletonClass().attribute...
def install(job): service = job.service prefab = service.executor.prefab if 'redis' not in service.producers: raise j.exceptions.AYSNotFound("Can't find redis service in producers.") # configure redis connection for AYS redis = service.producers['redis'][0] # this line create the defau...
def install(job): service = job.service prefab = service.executor.prefab if 'redis' not in service.producers: raise j.exceptions.AYSNotFound("Can't find redis service in producers.") redis = service.producers['redis'][0] cfg_path = prefab.core.replace('$JSCFGDIR/jumpscale/ays.yaml') conf...
#!/usr/bin/env python3 class EmptyStackError(Exception): """Exception for operations when stack is empty.""" def __init__(self): super().__init__("Stack is empty.") class FullStackError(Exception): """Exception for operations when stack is full.""" def __init__(self): super().__init_...
class Emptystackerror(Exception): """Exception for operations when stack is empty.""" def __init__(self): super().__init__('Stack is empty.') class Fullstackerror(Exception): """Exception for operations when stack is full.""" def __init__(self): super().__init__('Stack is full.') cla...
class Solution: def search(self, reader, target): """ :type reader: ArrayReader :type target: int :rtype: int """
class Solution: def search(self, reader, target): """ :type reader: ArrayReader :type target: int :rtype: int """
original_list = [2, 2, 2, 7, 23, 1, 44, 44, 3, 2, 10, 7, 4, 11] def remove_duplicates(numbers): unique_numbers = set() for number in numbers: if original_list.count(number) > 1: continue if number not in unique_numbers: yield number unique_numbers.add(number)...
original_list = [2, 2, 2, 7, 23, 1, 44, 44, 3, 2, 10, 7, 4, 11] def remove_duplicates(numbers): unique_numbers = set() for number in numbers: if original_list.count(number) > 1: continue if number not in unique_numbers: yield number unique_numbers.add(number)...
# -*- coding: utf-8 -*- # # Copyright (C) 2020 CERN. # # Invenio-Files-Processor is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see LICENSE file for more # details. """Processors configuration.""" FILES_PROCESSOR_TIKA_SERVER_ENDPOINT = 'http://localhost:9998' FILES_PR...
"""Processors configuration.""" files_processor_tika_server_endpoint = 'http://localhost:9998' files_processor_tika_request_options = {'timeout': 60}
# Pode ter mais que um except try: a = int(input('Digite:')) b = int(input('Digite:')) r = a / b except Exception as erro: print(f'Infelizmente tivemos um problema , foi {erro.__class__}') else: print(r) finally: print('Volte sempre! Muito obrigado')
try: a = int(input('Digite:')) b = int(input('Digite:')) r = a / b except Exception as erro: print(f'Infelizmente tivemos um problema , foi {erro.__class__}') else: print(r) finally: print('Volte sempre! Muito obrigado')
class humidityTemp: """Declare an humidity and temperature object to interact with I2C SHT85 connected sensor""" def __init__(self, bus): self.bus = bus self.address = 0x44 self.datablock = 6 self.temperature = 0 self.relHumidity = 0 def read(self): """Read r...
class Humiditytemp: """Declare an humidity and temperature object to interact with I2C SHT85 connected sensor""" def __init__(self, bus): self.bus = bus self.address = 68 self.datablock = 6 self.temperature = 0 self.relHumidity = 0 def read(self): """Read re...