content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def funny(x): if (x%2 == 1): return x+1 else: return funny(x-1) print(funny(7)) print(funny(6))
def funny(x): if x % 2 == 1: return x + 1 else: return funny(x - 1) print(funny(7)) print(funny(6))
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This package contains only the Brewery DB API key. It is necessary to provide an alternate method for this key entry when using chalice so that secrets aren't improperly shared. """ BREWERY_KEY = "<YOUR_BREWERY_DB_API_APP_KEY_HERE>" S3_BUCKET = "<YOUR_S3_BUCKET>"
""" This package contains only the Brewery DB API key. It is necessary to provide an alternate method for this key entry when using chalice so that secrets aren't improperly shared. """ brewery_key = '<YOUR_BREWERY_DB_API_APP_KEY_HERE>' s3_bucket = '<YOUR_S3_BUCKET>'
class TweetComplaint: def __init__(self, complain_text, city, state, tweet_id, username, image_url): self.complain_text = complain_text self.tweet_id = tweet_id self.username = username self.city = city self.state = state self.image_url = image_url self.statu...
class Tweetcomplaint: def __init__(self, complain_text, city, state, tweet_id, username, image_url): self.complain_text = complain_text self.tweet_id = tweet_id self.username = username self.city = city self.state = state self.image_url = image_url self.statu...
class Solution: def rob(self, num): ls = [[0, 0]] for e in num: ls.append([max(ls[-1][0], ls[-1][1]), ls[-1][0] + e]) return max(ls[-1])
class Solution: def rob(self, num): ls = [[0, 0]] for e in num: ls.append([max(ls[-1][0], ls[-1][1]), ls[-1][0] + e]) return max(ls[-1])
# -*- coding: utf-8 -*- __version__ = '0.16.1.dev0' PROJECT_NAME = "planemo" PROJECT_USERAME = "galaxyproject" RAW_CONTENT_URL = "https://raw.github.com/%s/%s/master/" % ( PROJECT_USERAME, PROJECT_NAME )
__version__ = '0.16.1.dev0' project_name = 'planemo' project_userame = 'galaxyproject' raw_content_url = 'https://raw.github.com/%s/%s/master/' % (PROJECT_USERAME, PROJECT_NAME)
"""This is the entry point of the program.""" def bubble_sort(list_of_numbers): for i in range(len(list_of_numbers)-1,0,-1): for j in range(i): if list_of_numbers[j] > list_of_numbers[j+1]: placeholder = list_of_numbers[j] list_of_numbers[j] = list_of_numbers[j+...
"""This is the entry point of the program.""" def bubble_sort(list_of_numbers): for i in range(len(list_of_numbers) - 1, 0, -1): for j in range(i): if list_of_numbers[j] > list_of_numbers[j + 1]: placeholder = list_of_numbers[j] list_of_numbers[j] = list_of_numbe...
spec = { 'name' : "ODL demo", 'external network name' : "exnet3", 'keypair' : "X220", 'controller' : "r720", 'dns' : "10.30.65.200", 'credentials' : { 'user' : "nic", 'password' : "nic", 'project' : "nic" }, # 'credentials' : { 'user' : "admin", 'password' : "admin", 'project' : "admin" }, ...
spec = {'name': 'ODL demo', 'external network name': 'exnet3', 'keypair': 'X220', 'controller': 'r720', 'dns': '10.30.65.200', 'credentials': {'user': 'nic', 'password': 'nic', 'project': 'nic'}, 'Networks': [{'name': 'odldemo', 'start': '192.168.50.2', 'end': '192.168.50.254', 'subnet': ' 192.168.50.0/24', 'gateway': ...
#encoding:utf-8 subreddit = 'kratom' t_channel = '@r_kratom' def send_post(submission, r2t): return r2t.send_simple(submission)
subreddit = 'kratom' t_channel = '@r_kratom' def send_post(submission, r2t): return r2t.send_simple(submission)
n = 5 count = 0 total = 0 startCount = n - 3 while True: if count == n: break elif count < n: x = int(input()) if count > startCount: total = total + x count = count + 1 print('') print('Sum is %d.' % total)
n = 5 count = 0 total = 0 start_count = n - 3 while True: if count == n: break elif count < n: x = int(input()) if count > startCount: total = total + x count = count + 1 print('') print('Sum is %d.' % total)
JPEG_10918 = ( 'SOF0', 'SOF1', 'SOF2', 'SOF3', 'SOF5', 'SOF6', 'SOF7', 'SOF9', 'SOF10', 'SOF11', 'SOF13', 'SOF14', 'SOF15', ) JPEG_14495 = ('SOF55', 'LSE', ) JPEG_15444 = ('SOC', ) PARSE_SUPPORTED = { '10918' : [ 'Process 1', 'Process 2', 'Process 4', 'Process 14', ...
jpeg_10918 = ('SOF0', 'SOF1', 'SOF2', 'SOF3', 'SOF5', 'SOF6', 'SOF7', 'SOF9', 'SOF10', 'SOF11', 'SOF13', 'SOF14', 'SOF15') jpeg_14495 = ('SOF55', 'LSE') jpeg_15444 = ('SOC',) parse_supported = {'10918': ['Process 1', 'Process 2', 'Process 4', 'Process 14']} decode_supported = {} encode_supported = {} zigzag = [0, 1, 5,...
class Solution: def numberOfArithmeticSlices(self, A: List[int]) -> int: count, currentSum = 0, 0 for i in range(2, len(A)): if A[i] - A[i - 1] == A[i - 1] - A[i - 2]: count += 1 else: currentSum += ((count + 1) * count) // 2 co...
class Solution: def number_of_arithmetic_slices(self, A: List[int]) -> int: (count, current_sum) = (0, 0) for i in range(2, len(A)): if A[i] - A[i - 1] == A[i - 1] - A[i - 2]: count += 1 else: current_sum += (count + 1) * count // 2 ...
#Add Key imports here! TRAIN_URL = "https://raw.githubusercontent.com/karkir0003/DSGT-Bootcamp-Material/main/Udemy%20Material/Airline%20Satisfaction/train.csv" def read_train_dataset(): """ This function should read in the train.csv and return it in whatever representation you like """ ###YOU...
train_url = 'https://raw.githubusercontent.com/karkir0003/DSGT-Bootcamp-Material/main/Udemy%20Material/Airline%20Satisfaction/train.csv' def read_train_dataset(): """ This function should read in the train.csv and return it in whatever representation you like """ raise not_implemented_error('Did n...
#!/usr/bin/env python # encoding: utf-8 """ candy.py Created by Shengwei on 2014-07-22. """ # https://oj.leetcode.com/problems/candy/ # tags: hard, array, greedy, logic """ There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the follo...
""" candy.py Created by Shengwei on 2014-07-22. """ '\nThere are N children standing in a line. Each child is assigned a rating value.\n\nYou are giving candies to these children subjected to the following requirements:\n\nEach child must have at least one candy.\nChildren with a higher rating get more candies than th...
""" Visualization styles. """ __author__ = "Alexander Urban" __email__ = "aurban@atomistic.net" __date__ = "2021-01-23" __version__ = "0.1" CPK = { 'H': 'white', 'C': 'black', 'N': 'blue', 'O': 'red', 'F': 'green', 'Cl': 'green', 'Br': '0x8b0000', 'I': '0x9400d3', 'He': 'cyan', ...
""" Visualization styles. """ __author__ = 'Alexander Urban' __email__ = 'aurban@atomistic.net' __date__ = '2021-01-23' __version__ = '0.1' cpk = {'H': 'white', 'C': 'black', 'N': 'blue', 'O': 'red', 'F': 'green', 'Cl': 'green', 'Br': '0x8b0000', 'I': '0x9400d3', 'He': 'cyan', 'Ne': 'cyan', 'Ar': 'cyan', 'Ce': 'cyan',...
app_name = 'tulius.profile' urlpatterns = [ ]
app_name = 'tulius.profile' urlpatterns = []
# # PySNMP MIB module CISCO-WBX-MEETING-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-WBX-MEETING-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:04:58 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, single_value_constraint, constraints_union, constraints_intersection) ...
# Column/Label Types NULL = 'null' CATEGORICAL = 'categorical' TEXT = 'text' NUMERICAL = 'numerical' ENTITY = 'entity' # Feature Types ARRAY = 'array' # backend PYTORCH = "pytorch" MXNET = "mxnet"
null = 'null' categorical = 'categorical' text = 'text' numerical = 'numerical' entity = 'entity' array = 'array' pytorch = 'pytorch' mxnet = 'mxnet'
def main(): a,b,c,k = map(int,input().split()) ans = 0 ans += min(a, k) ans -= max(0, k-a-b) print(ans) if __name__ == "__main__": main()
def main(): (a, b, c, k) = map(int, input().split()) ans = 0 ans += min(a, k) ans -= max(0, k - a - b) print(ans) if __name__ == '__main__': main()
def main(): # equilibrate then isolate cold finger info('Equilibrate then isolate coldfinger') close(name="C", description="Bone to Turbo") sleep(1) open(name="B", description="Bone to Diode Laser") sleep(20) close(name="B", description="Bone to Diode Laser")
def main(): info('Equilibrate then isolate coldfinger') close(name='C', description='Bone to Turbo') sleep(1) open(name='B', description='Bone to Diode Laser') sleep(20) close(name='B', description='Bone to Diode Laser')
#!/usr/bin/python3 """ Verifies which numbers from a list of postive integers are even, using filter and lambda. filter() constructs a list of elements which were successfully evaluated, according with the lambda function, upon the elements of an iterable (list, strings, etc.). """ __author__ = "@ivanleoncz" numb...
""" Verifies which numbers from a list of postive integers are even, using filter and lambda. filter() constructs a list of elements which were successfully evaluated, according with the lambda function, upon the elements of an iterable (list, strings, etc.). """ __author__ = '@ivanleoncz' numbers = [1, 2, 3, 4, 5,...
class AmrTypes: dbpedia = { "person": "dbo:Person", "family": "dbo:Agent", "animal": "dbo:Animal", "language": "dbo:Language", "nationality": "dbo:Country", "ethnic-group": "dbo:EthnicGroup", "regional-group": "dbo:EthnicGroup", "religious-group": "db...
class Amrtypes: dbpedia = {'person': 'dbo:Person', 'family': 'dbo:Agent', 'animal': 'dbo:Animal', 'language': 'dbo:Language', 'nationality': 'dbo:Country', 'ethnic-group': 'dbo:EthnicGroup', 'regional-group': 'dbo:EthnicGroup', 'religious-group': 'dbo:Religious', 'political-movement': 'dbo:PoliticalParty', 'organiz...
students = [] def get_students_titlecase(): students_titlecase = [] for student in students: students_titlecase.append(student['name'].title()) return students_titlecase def print_students_titlecase(): print(get_students_titlecase()) def add_student(name, student_id = 332): student = {'n...
students = [] def get_students_titlecase(): students_titlecase = [] for student in students: students_titlecase.append(student['name'].title()) return students_titlecase def print_students_titlecase(): print(get_students_titlecase()) def add_student(name, student_id=332): student = {'name...
# author: @s.gholami # ----------------------------------------------------------------------- # read_matrix_input.py # ----------------------------------------------------------------------- # Accept inputs from console # Populate the list with the inputs to form a matrix def equations_to_matrix() -> list: """ ...
def equations_to_matrix() -> list: """ :return: augmented matrix formed from user input (user inputs = linear equations) :rtype: list """ n = int(input('input number of rows ')) m = int(input('input number of columns ')) a = [] for row_space in range(n): print('input row ', row_...
class Solution: def numIslands(self, grid: List[List[str]]) -> int: return num_islands(grid) def num_islands(grid): res = 0 R = len(grid) C = len(grid[0]) def dfs(i, j): if grid[i][j] == '1': grid[i][j] = '0' if i > 0: dfs(i - 1, j) ...
class Solution: def num_islands(self, grid: List[List[str]]) -> int: return num_islands(grid) def num_islands(grid): res = 0 r = len(grid) c = len(grid[0]) def dfs(i, j): if grid[i][j] == '1': grid[i][j] = '0' if i > 0: dfs(i - 1, j) ...
sample_rate = 16000 audio_duration = 10 audio_samples = sample_rate * audio_duration audio_duration_flusense = 1 audio_samples_flusense = sample_rate * audio_duration_flusense window_size = 512 overlap = 256 mel_bins = 64 device = 'cuda' num_epochs = 30 gamma = 0.4 patience = 4 step = 10 random_seed = 36851234 split_...
sample_rate = 16000 audio_duration = 10 audio_samples = sample_rate * audio_duration audio_duration_flusense = 1 audio_samples_flusense = sample_rate * audio_duration_flusense window_size = 512 overlap = 256 mel_bins = 64 device = 'cuda' num_epochs = 30 gamma = 0.4 patience = 4 step = 10 random_seed = 36851234 split_ra...
def minion_game(string): # your code goes here vowels = frozenset('AEIOU') length = len(string) kev_sc = 0 stu_sc = 0 for i in range(length): if string[i] in vowels: kev_sc += length - i else: stu_sc += length - i if kev_sc > stu_sc: print('Kev...
def minion_game(string): vowels = frozenset('AEIOU') length = len(string) kev_sc = 0 stu_sc = 0 for i in range(length): if string[i] in vowels: kev_sc += length - i else: stu_sc += length - i if kev_sc > stu_sc: print('Kevin', kev_sc) elif kev_...
class Message: def __init__(self, to_channel): self.to_channel = to_channel self.timestamp = "" self.text = "" self.blocks = [] self.is_completed = False def get_message(self): return { "ts": self.timestamp, "channel": self.to_channel, ...
class Message: def __init__(self, to_channel): self.to_channel = to_channel self.timestamp = '' self.text = '' self.blocks = [] self.is_completed = False def get_message(self): return {'ts': self.timestamp, 'channel': self.to_channel, 'text': self.text, 'blocks'...
productions = { (52, 1): [1,25,47,53,49 ], (53, 2): [54, 57,59,62,64], (53, 3): [54,57,59,62,64], (53, 4): [54,57,59,62,64], (53, 5): [54,57,59,62,64], (53, 6): [54,57,59,62,64], (54, 2): [2,55,47], (54, 3): [0], (54, 4): [0], (54, 5): [0], (54, 6): [0], (55, 25): [25,56]...
productions = {(52, 1): [1, 25, 47, 53, 49], (53, 2): [54, 57, 59, 62, 64], (53, 3): [54, 57, 59, 62, 64], (53, 4): [54, 57, 59, 62, 64], (53, 5): [54, 57, 59, 62, 64], (53, 6): [54, 57, 59, 62, 64], (54, 2): [2, 55, 47], (54, 3): [0], (54, 4): [0], (54, 5): [0], (54, 6): [0], (55, 25): [25, 56], (56, 39): [0], (56, 46...
class CDI(): def __init__(self,v3,v2,v3SessionID,v3BaseURL,v2BaseURL,v2icSessionID): print("Created CDI Class") self._v3=v3 self._v2=v2 self._v3SessionID = v3SessionID self._v3BaseURL = v3BaseURL self._v2BaseURL = v2BaseURL self._v2icSessionID = v2icSessionID ...
class Cdi: def __init__(self, v3, v2, v3SessionID, v3BaseURL, v2BaseURL, v2icSessionID): print('Created CDI Class') self._v3 = v3 self._v2 = v2 self._v3SessionID = v3SessionID self._v3BaseURL = v3BaseURL self._v2BaseURL = v2BaseURL self._v2icSessionID = v2icS...
"""List all the extensions.""" names = [ "tourney", "season", "refresh", "misc", ]
"""List all the extensions.""" names = ['tourney', 'season', 'refresh', 'misc']
# ---------------------------------------------------------------------------- # MODES: serial # CLASSES: nightly # # Test Case: multicolor.py # # Tests: Tests setting colors using the multiColor field in some of # our plots. # Plots - Boundary, Contour, FilledBoundary, Subset # ...
def test_color_definitions(testname, colors): s = '' for c in colors: s = s + str(c) + '\n' test_text(testname, s) def test_multi_color(section, plotAtts, decreasingOpacity): m = plotAtts.GetMultiColor() test('multicolor_%d_00' % section) for i in range(len(m)): t = float(i) / f...
def run_tests_count_tokens(config): scenario = sp.test_scenario() admin, [alice, bob] = get_addresses() scenario.h1("Tests count token") #----------------------------------------------------- scenario.h2("Nothing is minted") contract = create_new_contract(config, admin, scenario, []) cou...
def run_tests_count_tokens(config): scenario = sp.test_scenario() (admin, [alice, bob]) = get_addresses() scenario.h1('Tests count token') scenario.h2('Nothing is minted') contract = create_new_contract(config, admin, scenario, []) count = contract.count_tokens() scenario.verify(count == 0) ...
gal_sgd = ['HP0370', 'HP0950', 'HP0371', 'HP0557', 'HP0202', 'HP0587', 'HP0618', 'HP1112', 'HP0255', 'HP0859', 'HP0089', 'HP0106', 'HP0738', 'HP0942', 'HP0976', 'HP1483', 'HP1280', 'HP1281', 'HP1282', 'HP0598', 'HP1505', 'HP0422', 'HP1399', 'HP1017', 'HP1189', 'HP0723', 'HP0034', 'HP1084', 'HP1229', 'HP0672', 'HP1406',...
gal_sgd = ['HP0370', 'HP0950', 'HP0371', 'HP0557', 'HP0202', 'HP0587', 'HP0618', 'HP1112', 'HP0255', 'HP0859', 'HP0089', 'HP0106', 'HP0738', 'HP0942', 'HP0976', 'HP1483', 'HP1280', 'HP1281', 'HP1282', 'HP0598', 'HP1505', 'HP0422', 'HP1399', 'HP1017', 'HP1189', 'HP0723', 'HP0034', 'HP1084', 'HP1229', 'HP0672', 'HP1406',...
# This is not for real use! # This is normally generated by the build and install so should not be used for anything or filled in with real values. # File generated from /opt/config # GLOBAL_INJECTED_AAI1_IP_ADDR = "10.0.1.1" GLOBAL_INJECTED_AAI2_IP_ADDR = "10.0.1.2" GLOBAL_INJECTED_APPC_IP_ADDR = "10.0.2.1" GLOBAL_INJ...
global_injected_aai1_ip_addr = '10.0.1.1' global_injected_aai2_ip_addr = '10.0.1.2' global_injected_appc_ip_addr = '10.0.2.1' global_injected_artifacts_version = '1.2.0' global_injected_clamp_ip_addr = '10.0.12.1' global_injected_cloud_env = 'openstack' global_injected_dcae_ip_addr = '10.0.4.1' global_injected_dns_ip_a...
############################################################################### # Copyright (c) 2017-2020 Koren Lev (Cisco Systems), # # Yaron Yogev (Cisco Systems), Ilia Abashin (Cisco Systems) and others # # # ...
vedge_id = '3858e121-d861-4348-9d64-a55fcd5bf60a' vedge = {'configurations': {'tunnel_types': ['vxlan'], 'tunneling_ip': '192.168.2.1'}, 'host': 'node-5.cisco.com', 'id': '3858e121-d861-4348-9d64-a55fcd5bf60a', 'tunnel_ports': {'vxlan-c0a80203': {}, 'br-tun': {}}, 'type': 'vedge'} vedge_without_configs = {} vedge_witho...
class RedbotMotorActor(object): # TODO(asydorchuk): load constants from the config file. _MAXIMUM_FREQUENCY = 50 def __init__(self, gpio, power_pin, direction_pin_1, direction_pin_2): self.gpio = gpio self.power_pin = power_pin self.direction_pin_1 = direction_pin_1 sel...
class Redbotmotoractor(object): _maximum_frequency = 50 def __init__(self, gpio, power_pin, direction_pin_1, direction_pin_2): self.gpio = gpio self.power_pin = power_pin self.direction_pin_1 = direction_pin_1 self.direction_pin_2 = direction_pin_2 self.gpio.setup(power_...
#!/usr/bin/env python3 print("// addTable") for a in range(0, 10): print(" '{0}': {{".format(a)) for b in range(a, 10): s = (a + b) % 10 c = (a + b) // 10 print(" '{0}': '{1}{2}',".format(b, s, c)) print(" },") print() print("// subTable") for a in range(0, ...
print('// addTable') for a in range(0, 10): print(" '{0}': {{".format(a)) for b in range(a, 10): s = (a + b) % 10 c = (a + b) // 10 print(" '{0}': '{1}{2}',".format(b, s, c)) print(' },') print() print('// subTable') for a in range(0, 10): print(" ...
n, k = map(int, input().split()) dis = input().split() m = n while True: m = str(m) for d in dis: if d in m: break else: print(m) exit() m = int(m) + 1
(n, k) = map(int, input().split()) dis = input().split() m = n while True: m = str(m) for d in dis: if d in m: break else: print(m) exit() m = int(m) + 1
def replay(adb): adb.tap(1720, 1000) def go_to_home(adb): adb.tap(1961, 40) def go_to_battle(adb): adb.tap(1943, 928) def go_to_event_battle(adb): adb.tap(1900, 345) def select_daily_event(adb): adb.tap(313, 267) def select_unit(adb): adb.tap(1935, 935) def sortie(adb): adb.tap(1930, 947) def stage_clear_ok(adb)...
def replay(adb): adb.tap(1720, 1000) def go_to_home(adb): adb.tap(1961, 40) def go_to_battle(adb): adb.tap(1943, 928) def go_to_event_battle(adb): adb.tap(1900, 345) def select_daily_event(adb): adb.tap(313, 267) def select_unit(adb): adb.tap(1935, 935) def sortie(adb): adb.tap(1930, 9...
player_1_position = 7 player_2_position = 10 player_1_score = 0 player_2_score = 0 def roll_die(): i = 1 while 1: yield i i += 1 if i > 100: i = 1 roll = roll_die() number_of_die_rolls = 0 # while (player_1_score < 1000 and player_2_score < 1000): # for i in range(6): whi...
player_1_position = 7 player_2_position = 10 player_1_score = 0 player_2_score = 0 def roll_die(): i = 1 while 1: yield i i += 1 if i > 100: i = 1 roll = roll_die() number_of_die_rolls = 0 while 1: three_die_rolls = next(roll) + next(roll) + next(roll) number_of_die_...
class RevasCalculations: '''Functions related to calculations go there ''' pass
class Revascalculations: """Functions related to calculations go there """ pass
""" write a first program in python3 How to run the program in terminal python3 filename.py """ print("HelloWorld in Python !!")
""" write a first program in python3 How to run the program in terminal python3 filename.py """ print('HelloWorld in Python !!')
list = [ 'abcd', 786 , 2.23, 'john', 70.2 ] tinylist = [123, 'john'] print(list) # Prints complete list print(list[0]) # Prints first element of the list print(list[1:3]) # Prints elements starting from 2nd till 3rd print(list[2:]) # Prints elements starting from 3rd element print(tinylist * 2) ...
list = ['abcd', 786, 2.23, 'john', 70.2] tinylist = [123, 'john'] print(list) print(list[0]) print(list[1:3]) print(list[2:]) print(tinylist * 2) print(list + tinylist)
class Node: """Node for bst.""" def __init__(self, val): """Instantiate node.""" self.val = val self.right = None self.left = None def __repr__(self): """Represent node.""" return '<Node Val: {}'.format(self.val) def __str__(self): """Node value....
class Node: """Node for bst.""" def __init__(self, val): """Instantiate node.""" self.val = val self.right = None self.left = None def __repr__(self): """Represent node.""" return '<Node Val: {}'.format(self.val) def __str__(self): """Node value...
"""Output the number of labs required for a certain number of students.""" SEATS = 24 students = input('Enter the number of students: ') while not students.isnumeric(): students = input( "Numbers are usually numeric. Let's try this again.\n" 'Enter the number of students: ' ) students = int(s...
"""Output the number of labs required for a certain number of students.""" seats = 24 students = input('Enter the number of students: ') while not students.isnumeric(): students = input("Numbers are usually numeric. Let's try this again.\nEnter the number of students: ") students = int(students) (labs, remaining) =...
def solve(s): word_list = s.split(' ') name_capitalized = [] for word in word_list: name_capitalized.append(word.capitalize()) word = ' '.join(name_capitalized) return word
def solve(s): word_list = s.split(' ') name_capitalized = [] for word in word_list: name_capitalized.append(word.capitalize()) word = ' '.join(name_capitalized) return word
"""Subscribe to a specific queue and consume the messages. """ class Subscriber: def __init__(self, adapter): """Create a new subscriber with an Adapter instance. :param BaseAdapter adapter: Connection Adapter """ self.adapter = adapter def consume(self, worker): """...
"""Subscribe to a specific queue and consume the messages. """ class Subscriber: def __init__(self, adapter): """Create a new subscriber with an Adapter instance. :param BaseAdapter adapter: Connection Adapter """ self.adapter = adapter def consume(self, worker): ""...
# # Copyright (c) 2019 Jonathan McGee <broken.source@etherealwake.com> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS I...
"""Common Implementation of GCC-Compatible C/C++ Toolchain.""" load('@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl', 'action_config', 'artifact_name_pattern', 'feature', 'flag_group', 'flag_set', 'variable_with_value', 'with_feature_set') load(':common.bzl', 'ACTION_NAMES', 'ALL_COMPILE_ACTIONS', 'ALL_LINK_ACTION...
#!/usr/bin/python print('Content-type: text/plain\n\n') print('script cgi with GET')
print('Content-type: text/plain\n\n') print('script cgi with GET')
# # GeomProc: geometry processing library in python + numpy # # Copyright (c) 2008-2021 Oliver van Kaick <ovankaic@gmail.com> # under the MIT License. # # See file LICENSE.txt for details on copyright licenses. # """This module contains the write_options class of the GeomProc geometry processing library. """ # Option...
"""This module contains the write_options class of the GeomProc geometry processing library. """ class Write_Options: """A class that holds options of what information to write when saving a file Attributes ---------- write_vertex_normals : boolean Save normal vectors stored at mesh vertices ...
OLD_EXP_PER_HOUR = 10 OLD_TIME_TO_LVL_DELTA = 5 NEW_EXP_PER_HOUR = 10 NEW_TIME_TO_LVL_DELTA = 7 NEW_TIME_TO_LVL_MULTIPLIER = 1.02 def old_level_to_exp(level, exp): total_exp = exp for i in range(2, level + 1): total_exp += i * OLD_TIME_TO_LVL_DELTA * OLD_EXP_PER_HOUR return total_exp def new_...
old_exp_per_hour = 10 old_time_to_lvl_delta = 5 new_exp_per_hour = 10 new_time_to_lvl_delta = 7 new_time_to_lvl_multiplier = 1.02 def old_level_to_exp(level, exp): total_exp = exp for i in range(2, level + 1): total_exp += i * OLD_TIME_TO_LVL_DELTA * OLD_EXP_PER_HOUR return total_exp def new_time_...
#!/usr/bin/env python3 # probleme des 8 dames def printGrid(grid): for y in range(8): print(8 - y, end=" |") for x in range(8): print(grid[x][y], "", end="") print() print("------------------") print("X |A B C D E F G H") grid = [[0] * 8 for _ in range(8)] for j in ran...
def print_grid(grid): for y in range(8): print(8 - y, end=' |') for x in range(8): print(grid[x][y], '', end='') print() print('------------------') print('X |A B C D E F G H') grid = [[0] * 8 for _ in range(8)] for j in range(8): for i in range(8): grid[i][j]...
class Bicicleta: def __init__(self, marca, aro, calibragem): self.marca = marca; self.aro = aro; self.calibragem = calibragem; def __str__(self): string = "Marca: "+self.marca+"\nAro: "+str(self.aro)+"\nCalibragem: "+str(self.calibragem) return string def getMarca(...
class Bicicleta: def __init__(self, marca, aro, calibragem): self.marca = marca self.aro = aro self.calibragem = calibragem def __str__(self): string = 'Marca: ' + self.marca + '\nAro: ' + str(self.aro) + '\nCalibragem: ' + str(self.calibragem) return string def ge...
class Node(object): def __init__(self, nm, name, capacity = 15): self.nm = nm self.name = name self.capacity = capacity self.values = [] def consume(self, from_name, value): """ All subclass need to override this function to do acturlly calculation """ pass def data_income(self, from_name, valu...
class Node(object): def __init__(self, nm, name, capacity=15): self.nm = nm self.name = name self.capacity = capacity self.values = [] def consume(self, from_name, value): """ All subclass need to override this function to do acturlly calculation """ pass...
#!/usr/bin/env python # encoding: utf-8 """ @author: su jian @contact: 121116111@qq.com @file: __init__.py.py @time: 2017/8/16 17:43 """ def func(): pass class Main(): def __init__(self): pass if __name__ == '__main__': pass
""" @author: su jian @contact: 121116111@qq.com @file: __init__.py.py @time: 2017/8/16 17:43 """ def func(): pass class Main: def __init__(self): pass if __name__ == '__main__': pass
with open("spiderman.txt") as song: print(song.read(2)) print(song.read(8)) print(song.read())
with open('spiderman.txt') as song: print(song.read(2)) print(song.read(8)) print(song.read())
# -*- coding: utf-8 -*- # # Specifies the name of the last variable considered # before plotting # lastvar = "k" # # Specifies the columns to be plotted # and its label (in grace format) # col_contents = [(1, "\\f{Symbol} <r>"), (2, "\\f{Symbol} <dr>"), (3, "U\\sl")] # # Specifies the grace format of the x axis # ...
lastvar = 'k' col_contents = [(1, '\\f{Symbol} <r>'), (2, '\\f{Symbol} <dr>'), (3, 'U\\sl')] xlabel = '\\f{Times-Italic}P'
print(open('teste_win1252.txt', errors='strict').read()) print(open('teste_win1252.txt', errors='replace').read()) print(open('teste_win1252.txt', errors='ignore').read()) print(open('teste_win1252.txt', errors='surrogateescape').read()) print(open('teste_win1252.txt', errors='backslashreplace').read())
print(open('teste_win1252.txt', errors='strict').read()) print(open('teste_win1252.txt', errors='replace').read()) print(open('teste_win1252.txt', errors='ignore').read()) print(open('teste_win1252.txt', errors='surrogateescape').read()) print(open('teste_win1252.txt', errors='backslashreplace').read())
# -------------- class_1 = ["Geoffrey Hinton", "Andrew Ng", "Sebastian Raschka", "Yoshua Bengio"] class_2 = ["Hilary Mason", "Carla Gentry", "Corinna Cortes"] new_class = class_1 + class_2 print(new_class) new_class.append("Peter Warden") print(new_class) new_class.remove("Carla Gentry") print(new_class) course...
class_1 = ['Geoffrey Hinton', 'Andrew Ng', 'Sebastian Raschka', 'Yoshua Bengio'] class_2 = ['Hilary Mason', 'Carla Gentry', 'Corinna Cortes'] new_class = class_1 + class_2 print(new_class) new_class.append('Peter Warden') print(new_class) new_class.remove('Carla Gentry') print(new_class) courses = {'Math': 65, 'English...
""" Regularization works by penalizing model complexity. If the initial model is not complex enough to correctly describe the data then no amount of regularization will help as the model needs to get more complex to improve, not less. """;
""" Regularization works by penalizing model complexity. If the initial model is not complex enough to correctly describe the data then no amount of regularization will help as the model needs to get more complex to improve, not less. """
first_name = "ada" last_name = "lovelace" full_name = f"{first_name} {last_name}" #print(full_name) #print(f"Hello, {full_name.title()}!") message = f"Hello, {full_name.title()}!" print(message) #print("\tPython") #print("Languages:\nPython\nC\nJavaScript") print("Languages:\n\tPython\n\tC\n\tJavaScript")
first_name = 'ada' last_name = 'lovelace' full_name = f'{first_name} {last_name}' message = f'Hello, {full_name.title()}!' print(message) print('Languages:\n\tPython\n\tC\n\tJavaScript')
class FakeConfig(object): def __init__( self, src_dir=None, spec_dir=None, stylesheet_urls=None, script_urls=None, stop_spec_on_expectation_failure=False, stop_on_spec_failure=False, random=True ): self._src_...
class Fakeconfig(object): def __init__(self, src_dir=None, spec_dir=None, stylesheet_urls=None, script_urls=None, stop_spec_on_expectation_failure=False, stop_on_spec_failure=False, random=True): self._src_dir = src_dir self._spec_dir = spec_dir self._stylesheet_urls = stylesheet_urls ...
class Timer: def __init__(self, bot, ring_every=1.0): self.bot = bot self.last_ring = 0.0 self.ring_every = ring_every @property def rings(self): if (self.bot.time - self.last_ring) >= self.ring_every: self.last_ring = self.bot.time return True ...
class Timer: def __init__(self, bot, ring_every=1.0): self.bot = bot self.last_ring = 0.0 self.ring_every = ring_every @property def rings(self): if self.bot.time - self.last_ring >= self.ring_every: self.last_ring = self.bot.time return True ...
#!/usr/bin/python3 class ComplexThing: def __init__(self, name, data): self.name = name self.data = data def __str__(self): return self.name + ": " + str(self.data)
class Complexthing: def __init__(self, name, data): self.name = name self.data = data def __str__(self): return self.name + ': ' + str(self.data)
# <<BEGIN-copyright>> # Copyright 2021, Lawrence Livermore National Security, LLC. # See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: BSD-3-Clause # <<END-copyright>> """ Dictionary storing numerical values. """ class NumberDict( dict ) : """ An instance of this class acts like an a...
""" Dictionary storing numerical values. """ class Numberdict(dict): """ An instance of this class acts like an array of numbers with generalized (non-integer) indices. A value of zero is assumed for undefined entries. NumberDict instances support addition, and subtraction with other NumberDict ins...
CATEGORIES = [ ('Arts & Entertainment', [ 'Books & Literature', 'Celebrity Fan/Gossip', 'Fine Art', 'Humor', 'Movies', 'Music', 'Television' ]), ('Automotive', [ 'Auto Parts', 'Auto Repair', 'Buying/Selling Cars', 'Car C...
categories = [('Arts & Entertainment', ['Books & Literature', 'Celebrity Fan/Gossip', 'Fine Art', 'Humor', 'Movies', 'Music', 'Television']), ('Automotive', ['Auto Parts', 'Auto Repair', 'Buying/Selling Cars', 'Car Culture', 'Certified Pre-Owned', 'Convertible', 'Coupe', 'Crossover', 'Diesel', 'Electric Vehicle', 'Hatc...
class VirusFoundException(Exception): """Exception raised for detecting a virus in a file upload""" pass class InvalidExtensionException(Exception): """Exception raised for an attachment with an invalid extension""" pass class InvalidFileTypeException(Exception): """Exception raised for an attachm...
class Virusfoundexception(Exception): """Exception raised for detecting a virus in a file upload""" pass class Invalidextensionexception(Exception): """Exception raised for an attachment with an invalid extension""" pass class Invalidfiletypeexception(Exception): """Exception raised for an attachm...
print( "Welcome to the Shape Generator:" ) cont = True shape1 = 0 shape2 = 0 shape3 = 0 shape4 = 0 shape5 = 0 shape6 = 0 drawAnotherShape = False def menu(): print() print( "This program draw the following shapes:" ) print( f"{'1) Horizontal Line':>20s}" ) print( f"{'2) Vertical Line':>18s}" ) pr...
print('Welcome to the Shape Generator:') cont = True shape1 = 0 shape2 = 0 shape3 = 0 shape4 = 0 shape5 = 0 shape6 = 0 draw_another_shape = False def menu(): print() print('This program draw the following shapes:') print(f"{'1) Horizontal Line':>20s}") print(f"{'2) Vertical Line':>18s}") print(f"{'...
num = 45 # symVal = {1000:'M',900:'CM',500:'D',400:'CD',100:'C',90:'XC',50:'L',40:'XL',10:'X',9:'IX',5:'V',4:'IV',1:'I'} # romanNum = '' # i = 0 # while num > 0 : # curVal = list(symVal)[i] # for _ in range(num // curVal): # # if (divmod(num,4)[1] == 0 or divmod(num,9)[1] == 0): # romanNum += ...
num = 45 class Solution(object): def __init__(self): self.roman = '' def int_to_roman(self, num): self.num = num self.checkRoman(1000, 'M') self.checkRoman(500, 'D') self.checkRoman(100, 'C') self.checkRoman(50, 'L') self.checkRoman(10, 'X') sel...
# -*- coding: utf-8 -*- TO_EXCLUDE = [ "ACITAK", "ACITAK", "ADASUW", "AFEHOL", "AFENAA", "AFENAA", "AMUTEI", "AQUCOF", "AQUCOF", "AQUDAS", "AQUDAS", "ARADEE", "ATAGOQ", "ATAGOR", "ATAGOR", "BAXLA", "BAXLAP", "BAXLAP", "BICPOV", "BICPOV", ...
to_exclude = ['ACITAK', 'ACITAK', 'ADASUW', 'AFEHOL', 'AFENAA', 'AFENAA', 'AMUTEI', 'AQUCOF', 'AQUCOF', 'AQUDAS', 'AQUDAS', 'ARADEE', 'ATAGOQ', 'ATAGOR', 'ATAGOR', 'BAXLA', 'BAXLAP', 'BAXLAP', 'BICPOV', 'BICPOV', 'BIYWAK', 'BIYWAK', 'BIZLOO', 'BUHVOP', 'BUPVEP', 'BUXZAX', 'CAVWEC', 'CIGXIA', 'COFYOM', 'COFYOM', 'COFYOM...
# -*- coding: utf-8 -*- URL = '127.0.0.1' PORT = 27017 DATABASE = 'MyFunctions' COLLECTION = 'FunctionCheckers' FILE_PATH = '../examples/functions.py' CATCHER = 'result' IMPORT_POST = True STATIC_POST = True FUNC_POST = True
url = '127.0.0.1' port = 27017 database = 'MyFunctions' collection = 'FunctionCheckers' file_path = '../examples/functions.py' catcher = 'result' import_post = True static_post = True func_post = True
""" =========== Exercise 1 ============= Using a list, create a shopping list of 5 items. Then print the whole list, and then each item individually. """ shopping_list = [] # Fill in with some values print(shopping_list) # Print the whole list print() # Figure out how to print individual values """ ...
""" =========== Exercise 1 ============= Using a list, create a shopping list of 5 items. Then print the whole list, and then each item individually. """ shopping_list = [] print(shopping_list) print() "\n =========== Exercise 2 =============\n\n Find something that you can eat that has nutrition\n ...
#Parsing and Extracting data= "From Stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008" atpos= data.find("@") print(atpos) atss= data.find(" ",atpos) #here it starts at 21 and then goes and find the next space print(atss) host= data[atpos+1: atss] #Now we are extracting the part that we are interested in print(host) #...
data = 'From Stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008' atpos = data.find('@') print(atpos) atss = data.find(' ', atpos) print(atss) host = data[atpos + 1:atss] print(host)
"""Code to add interactive highlighting of series in matplotlib plots.""" class SelectorCursor(object): """An abstract cursor that may traverse a sequence of fixed length in any order, repeatedly, and which includes a None position. Executes a notifier when a position becomes selected or desel...
"""Code to add interactive highlighting of series in matplotlib plots.""" class Selectorcursor(object): """An abstract cursor that may traverse a sequence of fixed length in any order, repeatedly, and which includes a None position. Executes a notifier when a position becomes selected or deselected. ""...
# Solution def part1(data): stack = [] meta_sum = 0 gen = input_gen(data) for x in gen: if x != 0 or len(stack) % 2 == 1: stack.append(x) continue m = next(gen) while m > 0 or len(stack) > 0: for _ in range(m): meta_sum += next(...
def part1(data): stack = [] meta_sum = 0 gen = input_gen(data) for x in gen: if x != 0 or len(stack) % 2 == 1: stack.append(x) continue m = next(gen) while m > 0 or len(stack) > 0: for _ in range(m): meta_sum += next(gen) ...
""" In this problem, we need a structure to store which character occurs how many times. It is best to use a dict object; but here we will use only lists. We will keep counts in a list of two element lists. For example: [["a",3],["b",5],["z",3]] """ def add_char(store,char): """add a character to the count store"...
""" In this problem, we need a structure to store which character occurs how many times. It is best to use a dict object; but here we will use only lists. We will keep counts in a list of two element lists. For example: [["a",3],["b",5],["z",3]] """ def add_char(store, char): """add a character to the count st...
## IMPORTANT: Must be loaded after `02-service-common.py ## announcement service service_env = dict() service_url = f'{hub_hostname}:{service_port}' if c.JupyterHub.internal_ssl: # if we are using end-to-end mTLS, then pass # certs to service and set scheme to `https` # TODO: Generate certs automatic...
service_env = dict() service_url = f'{hub_hostname}:{service_port}' if c.JupyterHub.internal_ssl: pki_store = c.JupyterHub.internal_certs_location service_env = {'JUPYTERHUB_SSL_CERTFILE': f'{PKI_STORE}/hub-internal/hub-internal.crt', 'JUPYTERHUB_SSL_KEYFILE': f'{PKI_STORE}/hub-internal/hub-internal.key', 'JUPY...
def test_binary_byte_str_code(fake): assert isinstance(fake.binary_byte_str(code=True), str) def test_decimal_byte_str_code(fake): assert isinstance(fake.decimal_byte_str(code=True), str) def test_binary_byte_str(fake): assert isinstance(fake.binary_byte_str(), str) def test_decimal_byte_str(fake): ...
def test_binary_byte_str_code(fake): assert isinstance(fake.binary_byte_str(code=True), str) def test_decimal_byte_str_code(fake): assert isinstance(fake.decimal_byte_str(code=True), str) def test_binary_byte_str(fake): assert isinstance(fake.binary_byte_str(), str) def test_decimal_byte_str(fake): a...
#Classe usada para erros gerais relacionados as arestas class ArestasIncompatibilityException(Exception): def __init__(self,message :str): super().__init__(message)
class Arestasincompatibilityexception(Exception): def __init__(self, message: str): super().__init__(message)
# -*- coding: utf-8 -*- """ @author: krakowiakpawel9@gmail.com @site: e-smartdata.org """ class Drzewo: nazwa = 'Sosna' wiek = 40 wysokosc = 25 drzewo_1 = Drzewo() drzewo_2 = Drzewo() # %% print(id(drzewo_1)) print(id(drzewo_2)) # %% dir(drzewo_1) # %% drzewo_1.nazwa drzewo_1.wiek drzewo_1.wysokosc ...
""" @author: krakowiakpawel9@gmail.com @site: e-smartdata.org """ class Drzewo: nazwa = 'Sosna' wiek = 40 wysokosc = 25 drzewo_1 = drzewo() drzewo_2 = drzewo() print(id(drzewo_1)) print(id(drzewo_2)) dir(drzewo_1) drzewo_1.nazwa drzewo_1.wiek drzewo_1.wysokosc drzewo_2.nazwa drzewo_2.wiek drzewo_1.stan = '...
#Embedded file name: /Users/versonator/Hudson/live/Projects/AppLive/Resources/MIDI Remote Scripts/LPD8/consts.py """ The following consts should be substituted with the Sys Ex messages for requesting a controller's ID response and that response to allow for automatic lookup""" ID_REQUEST = 0 ID_RESP = 0 GENERIC_STOP = ...
""" The following consts should be substituted with the Sys Ex messages for requesting a controller's ID response and that response to allow for automatic lookup""" id_request = 0 id_resp = 0 generic_stop = 23 generic_play = 24 generic_rec = 25 generic_loop = 20 generic_rwd = 21 generic_ffwd = 22 generic_transport = (G...
#Program 20 #Write a program to write roll no, name and marks of 'n' students in a data file "marks.dat" #Name: Vikhyat Jagini #Class: 12 #Date of Execution: 26/08/2021 n=int(input("Enter the number of students you want to store data of in the data file:")) f=open(r"C:\Python\Class 12 python\Lab Programs\BinaryFiles...
n = int(input('Enter the number of students you want to store data of in the data file:')) f = open('C:\\Python\\Class 12 python\\Lab Programs\\BinaryFiles\\marks.dat', 'a') for i in range(n): print('Enter details of student', i + 1, 'below') rol = int(input('Enter roll no of student:')) name = input('Enter...
def is_xpath_selector(selector): """ A basic method to determine if a selector is an xpath selector. """ if ( selector.startswith("/") or selector.startswith("./") or selector.startswith("(") ): return True return False def is_link_text_selector(sele...
def is_xpath_selector(selector): """ A basic method to determine if a selector is an xpath selector. """ if selector.startswith('/') or selector.startswith('./') or selector.startswith('('): return True return False def is_link_text_selector(selector): """ A basic method to determin...
# Qutebrowser config # Sessions c.auto_save.session = True c.session.lazy_restore = True # Tabs c.tabs.position = 'left' c.tabs.width = 200 c.tabs.new_position.unrelated = 'next' c.tabs.background = True # Hints c.hints.mode = 'number' c.hints.auto_follow = 'full-match' c.content.pdfjs = True c.content.javascript...
c.auto_save.session = True c.session.lazy_restore = True c.tabs.position = 'left' c.tabs.width = 200 c.tabs.new_position.unrelated = 'next' c.tabs.background = True c.hints.mode = 'number' c.hints.auto_follow = 'full-match' c.content.pdfjs = True c.content.javascript.enabled = False c.content.javascript.can_access_clip...
#!/usr/bin/env python3 """ Module with function to slice a matrix """ def np_slice(matrix, axes={}): """ Slices a matrix along a specific axes Returns the new matrix """ return matrix[-3:, -3:]
""" Module with function to slice a matrix """ def np_slice(matrix, axes={}): """ Slices a matrix along a specific axes Returns the new matrix """ return matrix[-3:, -3:]
class RichTextBoxSelectionTypes(Enum, IComparable, IFormattable, IConvertible): """ Specifies the type of selection in a System.Windows.Forms.RichTextBox control. enum (flags) RichTextBoxSelectionTypes,values: Empty (0),MultiChar (4),MultiObject (8),Object (2),Text (1) """ def __eq__(self, *arg...
class Richtextboxselectiontypes(Enum, IComparable, IFormattable, IConvertible): """ Specifies the type of selection in a System.Windows.Forms.RichTextBox control. enum (flags) RichTextBoxSelectionTypes,values: Empty (0),MultiChar (4),MultiObject (8),Object (2),Text (1) """ def __eq__(self, *args): ...
CODE_GAP = '-' CODE_BACKGROUND = '-' class State: """ Node in the HMM architecture, with emission probability """ def __init__(self, emission, module_id, state_id): """ :param emission: Multinomial distribution of nucleotide generation, one float value for each nucleotide :par...
code_gap = '-' code_background = '-' class State: """ Node in the HMM architecture, with emission probability """ def __init__(self, emission, module_id, state_id): """ :param emission: Multinomial distribution of nucleotide generation, one float value for each nucleotide :para...
def clean_string(s): result=[] for i in s: if i=="#": if result: result.pop(-1) else: result.append(i) return "".join(result)
def clean_string(s): result = [] for i in s: if i == '#': if result: result.pop(-1) else: result.append(i) return ''.join(result)
def dimensoes(matriz): li = len(matriz) c = 1 for i in matriz: c = len(i) return li, c def soma_matrizes(m1, m2): l, c = dimensoes(m1) if dimensoes(m1) == dimensoes(m2): m3 = m1 for i in range(0, l): for col in range(0, c): m3[i][col] = m...
def dimensoes(matriz): li = len(matriz) c = 1 for i in matriz: c = len(i) return (li, c) def soma_matrizes(m1, m2): (l, c) = dimensoes(m1) if dimensoes(m1) == dimensoes(m2): m3 = m1 for i in range(0, l): for col in range(0, c): m3[i][col] = m1...
"""Sorting Algorithms config.""" FILES_REPO = "files/" IN_REPO = "files/in/" OUT_REPO = "files/out/" LOGS_REPO = "files/out/logs/" SEPARATOR = " - " STR_SIZE = 50 STR_NUMBER = 50 MAIN_DESCRIPTION = 'Sorting Algorithms' ALGORITHM_DESCRIPTION = 'execute sorting algorithm (insertionsort, \ ...
"""Sorting Algorithms config.""" files_repo = 'files/' in_repo = 'files/in/' out_repo = 'files/out/' logs_repo = 'files/out/logs/' separator = ' - ' str_size = 50 str_number = 50 main_description = 'Sorting Algorithms' algorithm_description = 'execute sorting algorithm (insertionsort, ...
""" Description: A demo of the ord() and chr() functions in python\ for ASCII table reference, please visit http://www.asciitable.com/ """ __author__ = "Canadian Coding" # chr() takes an int and returns the corresponding ASCII character print(chr(65)) # prints 'A' print(chr(97)) # prints 'a' # ord() takes...
""" Description: A demo of the ord() and chr() functions in python for ASCII table reference, please visit http://www.asciitable.com/ """ __author__ = 'Canadian Coding' print(chr(65)) print(chr(97)) print(ord('A')) print(ord('a')) def alphabet_by_ord(): """Goes through and prints the uppercase alphabet ...
""" This module implements the Scorer Class. A Scorer tracks the match, mismatch, gap, and xdrop values. The Scorer is also responsible for calculating the dynamic programming function value and direction. """ class Scorer(): """Scorer Class""" def __init__ ( self, match, mismatch, gap, xdrop ): """ ...
""" This module implements the Scorer Class. A Scorer tracks the match, mismatch, gap, and xdrop values. The Scorer is also responsible for calculating the dynamic programming function value and direction. """ class Scorer: """Scorer Class""" def __init__(self, match, mismatch, gap, xdrop): """ ...
class Node: def __init__(self, value, next=None): self.value = value self.next = next class LinkedList: def __init__(self, head=None): self.head = head def insert(self, value): node = Node(value) # Node of [3] if self.head is not None: node.next = self...
class Node: def __init__(self, value, next=None): self.value = value self.next = next class Linkedlist: def __init__(self, head=None): self.head = head def insert(self, value): node = node(value) if self.head is not None: node.next = self.head ...
#!/usr/bin/env python # -*- coding: utf-8 -*- db = { 'host': 'localhost', 'port': 6379 } dbnames = { 'default': 1, 'ephermal': 8 }
db = {'host': 'localhost', 'port': 6379} dbnames = {'default': 1, 'ephermal': 8}
""" One of the most enjoyable hard questions on Leetcode. A really hard problem until you break it down into smaller subproblems """ class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right def maxPathSum(root: TreeNode) -> int:...
""" One of the most enjoyable hard questions on Leetcode. A really hard problem until you break it down into smaller subproblems """ class Treenode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right def max_path_sum(root: TreeNode) -> int...
class Tests(unittest.TestCase): def _sim_model(self, data: Tensor) -> Tensor: """ Simulated model for generating uncertainity scores. Intention is to be a placeholder until real models are used and for testing.""" return torch.rand(size=(data.shape[0],)) def setUp(self): ...
class Tests(unittest.TestCase): def _sim_model(self, data: Tensor) -> Tensor: """ Simulated model for generating uncertainity scores. Intention is to be a placeholder until real models are used and for testing.""" return torch.rand(size=(data.shape[0],)) def set_up(self): s...
# -*- coding: utf-8 -*- #: The title of this site SITE_TITLE='HasGeek Funnel' #: Support contact email SITE_SUPPORT_EMAIL = 'test@example.com' #: TypeKit code for fonts TYPEKIT_CODE='' #: Google Analytics code UA-XXXXXX-X GA_CODE='' #: Database backend SQLALCHEMY_DATABASE_URI = 'sqlite:///test.db' #: Secret key SECRET...
site_title = 'HasGeek Funnel' site_support_email = 'test@example.com' typekit_code = '' ga_code = '' sqlalchemy_database_uri = 'sqlite:///test.db' secret_key = 'make this something random' timezone = 'Asia/Calcutta' lastuser_server = 'https://auth.hasgeek.com/' lastuser_client_id = '' lastuser_client_secret = '' twitte...
""" Account: This clump of functions manage the account features for the API. Their functions are like: - Main account management. - Register with {username} {email} {password} {confirmation}. - Login with {username} {password}. - Reset password {recovery key} with {new password} {confirmation}. - Lo...
""" Account: This clump of functions manage the account features for the API. Their functions are like: - Main account management. - Register with {username} {email} {password} {confirmation}. - Login with {username} {password}. - Reset password {recovery key} with {new password} {confirmation}. - Lo...
class Node: def __init__(self, value): self.value = value self.next = None class Stack: def __init__(self): self.head = Node("head") self.size = 0 def __str__(self): cur = self.head.next out = "" while cur: out += str(cur.value) + "->" ...
class Node: def __init__(self, value): self.value = value self.next = None class Stack: def __init__(self): self.head = node('head') self.size = 0 def __str__(self): cur = self.head.next out = '' while cur: out += str(cur.value) + '->' ...
#!/usr/bin/python # related: http://stackoverflow.com/questions/36932/whats-the-best-way-to-implement-an-enum-in-python class Worker(): SUCCESS = 1 FAILURE = 2 def test(self): return Worker.FAILURE t = Worker() t.test() if (t.test() == Worker.FAILURE): print("I got a failure status") if (t...
class Worker: success = 1 failure = 2 def test(self): return Worker.FAILURE t = worker() t.test() if t.test() == Worker.FAILURE: print('I got a failure status') if t.test() == Worker.SUCCESS: print('I got a success status')