content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
smile_dict = [b"\xF0\x9F\x98\x81", b"\xF0\x9F\x98\x82", b"\xF0\x9F\x98\x83", b"\xF0\x9F\x98\x84", b"\xF0\x9F\x98\x85", b"\xF0\x9F\x98\x86", b"\xF0\x9F\x98\x89", b"\xF0\x9F\x98\x8A", b"\xF0\x9F\x98\x8B", b"\xF0\x9F\x98\x8C", b"\xF0\x9F\x98\x8D", b"\xF0\x9F\x98\x8F", b"\xF0\x9F\x98\x92", b"\xF0\x9F\x98\x93",...
smile_dict = [b'\xf0\x9f\x98\x81', b'\xf0\x9f\x98\x82', b'\xf0\x9f\x98\x83', b'\xf0\x9f\x98\x84', b'\xf0\x9f\x98\x85', b'\xf0\x9f\x98\x86', b'\xf0\x9f\x98\x89', b'\xf0\x9f\x98\x8a', b'\xf0\x9f\x98\x8b', b'\xf0\x9f\x98\x8c', b'\xf0\x9f\x98\x8d', b'\xf0\x9f\x98\x8f', b'\xf0\x9f\x98\x92', b'\xf0\x9f\x98\x93', b'\xf0\x9f\x...
# Code generated by font-to-py.py. # Font: dsm.ttf version = '0.26' def height(): return 21 def max_width(): return 12 def hmap(): return True def reverse(): return False def monospaced(): return False def min_ch(): return 32 def max_ch(): return 126 _font =\...
version = '0.26' def height(): return 21 def max_width(): return 12 def hmap(): return True def reverse(): return False def monospaced(): return False def min_ch(): return 32 def max_ch(): return 126 _font = b'\x0c\x00\x00\x00|\x00\xfe\x00\x87\x00\x03\x00\x03\x00\x07\x00\x0e\x00\x1c\x...
# CPU: 0.42 s ids = set() for _ in range(int(input())): ids.add(int(input())) m = 1 while True: reduced_ids = set() for id_ in ids: reduced_id = id_ % m if reduced_id not in reduced_ids: reduced_ids.add(reduced_id) else: break else: break m += 1 print(m)
ids = set() for _ in range(int(input())): ids.add(int(input())) m = 1 while True: reduced_ids = set() for id_ in ids: reduced_id = id_ % m if reduced_id not in reduced_ids: reduced_ids.add(reduced_id) else: break else: break m += 1 print(m)
_item_fullname_='mdtraj.Topology' def is_mdtraj_Topology(item): item_fullname = item.__class__.__module__+'.'+item.__class__.__name__ return _item_fullname_==item_fullname
_item_fullname_ = 'mdtraj.Topology' def is_mdtraj__topology(item): item_fullname = item.__class__.__module__ + '.' + item.__class__.__name__ return _item_fullname_ == item_fullname
# Find the Runner-Up Score or Finding second largest number n = int(input()) arr = list(map(int, input().split())) l = max(arr) for i in range(n): if l == max(arr): arr.remove(max(arr)) print(max(arr))
n = int(input()) arr = list(map(int, input().split())) l = max(arr) for i in range(n): if l == max(arr): arr.remove(max(arr)) print(max(arr))
class Solution: def findMedianSortedArrays(self, A: List[int], B: List[int]) -> float: def helper(A, B, k): if not A or not B: return (A or B)[k] else: ia, ib = len(A) // 2, len(B) // 2 ma, mb = A[ia], B[ib] if k > ia + ...
class Solution: def find_median_sorted_arrays(self, A: List[int], B: List[int]) -> float: def helper(A, B, k): if not A or not B: return (A or B)[k] else: (ia, ib) = (len(A) // 2, len(B) // 2) (ma, mb) = (A[ia], B[ib]) ...
while True: try: l = int(input()) except EOFError: break lesmas = map(int, input().split()) maior = max(lesmas) if maior < 10: print(1) elif maior >= 10 and maior < 20: print(2) else: print(3)
while True: try: l = int(input()) except EOFError: break lesmas = map(int, input().split()) maior = max(lesmas) if maior < 10: print(1) elif maior >= 10 and maior < 20: print(2) else: print(3)
# Module to flatten a list def flatten(array, flattened=[]): for value in array: if(isinstance(value, list)): flatten(value, flattened) else: flattened.append(value) return flattened
def flatten(array, flattened=[]): for value in array: if isinstance(value, list): flatten(value, flattened) else: flattened.append(value) return flattened
class BaseAgent(object): def __init__(self, config): self.device = config.device self.num_actions = config.action_dim self.observation_dim = config.observation_dim self.discount_factor = config.discount_factor self.grad_clip_val = config.grad_clip_val self.batch_siz...
class Baseagent(object): def __init__(self, config): self.device = config.device self.num_actions = config.action_dim self.observation_dim = config.observation_dim self.discount_factor = config.discount_factor self.grad_clip_val = config.grad_clip_val self.batch_size...
inp = input("please enter the text") print("The original string : " + inp) res = [int(i) for i in inp.split() if i.isdigit()] # this basically makes a list of all the numbers for i in res: if len(str(i))==10: print("the phone number in the text is:" + str(i))
inp = input('please enter the text') print('The original string : ' + inp) res = [int(i) for i in inp.split() if i.isdigit()] for i in res: if len(str(i)) == 10: print('the phone number in the text is:' + str(i))
### Static Array Sequence Implementation # Static array has fixed size and can't grow or shrink. # Static array has a O(1) constant time for get_at and set_at operations. # Static array has a O(n) time for insert and delete operations at the back of the array. # Reference implementation: MIT Introduction to Algorith...
class Array_Seq: def __init__(self): self.A = [] self.size = 0 def __len__self(self): return self.size def __iter__(self): yield from self.A def build(self, X): self.A = [a for a in X] self.size = len(X) def get_at(self, i): return self.A[...
# This sample tests the case where super() is used within a metaclass # __init__ method. class Metaclass(type): def __init__(self, name, bases, attrs): super().__init__(name, bases, attrs)
class Metaclass(type): def __init__(self, name, bases, attrs): super().__init__(name, bases, attrs)
__author__ = 'studentmac' def make_negative( number ): if number >0: number *=-1 return number
__author__ = 'studentmac' def make_negative(number): if number > 0: number *= -1 return number
{ "targets": [ { "target_name": "rsvg", "sources": [ "src/Rsvg.cc", "src/Enums.cc", "src/Autocrop.cc" ], "variables": { "packages": "librsvg-2.0 cairo-png cairo-pdf cairo-svg", "libraries": "<!(pkg-config --libs-only-l <(packages))", "ldflags": "<!(pkg-config --libs-only-L --libs-...
{'targets': [{'target_name': 'rsvg', 'sources': ['src/Rsvg.cc', 'src/Enums.cc', 'src/Autocrop.cc'], 'variables': {'packages': 'librsvg-2.0 cairo-png cairo-pdf cairo-svg', 'libraries': '<!(pkg-config --libs-only-l <(packages))', 'ldflags': '<!(pkg-config --libs-only-L --libs-only-other <(packages))', 'cflags': '<!(pkg-c...
#!/usr/bin/python class me: # initialization routine def __init__(self, foo): self.myvar = foo def getval(self): return self.myvar # this is an instance of the "me" class my = me("this") # my instantiation/assignment allows access to getval method x = my.getval() print(x)
class Me: def __init__(self, foo): self.myvar = foo def getval(self): return self.myvar my = me('this') x = my.getval() print(x)
# OpenWeatherMap API Key weather_api_key = "48ae7399e76d973a4b9ac9efe89908a3" # Google API Key g_key = "AIzaSyBrlKm1v_NyDl4nT9LOZWE5s_sQa2D5Hoc"
weather_api_key = '48ae7399e76d973a4b9ac9efe89908a3' g_key = 'AIzaSyBrlKm1v_NyDl4nT9LOZWE5s_sQa2D5Hoc'
height=list(map(int,input().split())) height def trapped_water(h): n=len(h) total=0 for i in range(1,n-1): left=h[i] for j in range(i): left=max(h[j],left) right=h[i] for j in range(i+1,n): right=max(h[j],right) total+=min(left,right)-h[i] return total print(trapped...
height = list(map(int, input().split())) height def trapped_water(h): n = len(h) total = 0 for i in range(1, n - 1): left = h[i] for j in range(i): left = max(h[j], left) right = h[i] for j in range(i + 1, n): right = max(h[j], right) total +=...
a=((1, 1, 1, 1), # matrix A # (2, 4, 8, 16), (3, 9, 27, 81), (4, 16, 64, 256)) b=(( 4 , -3 , 4/3., -1/4. ), # matrix B # (-13/3., 19/4., -7/3., 11/24.), ( 3/2., -2. , 7/6., -1/4. ), ( -1/6., 1/4., -1/6., 1/24.)) def MatrixMul( mtx_a, mtx_b): tpos_b = list(zip(...
a = ((1, 1, 1, 1), (2, 4, 8, 16), (3, 9, 27, 81), (4, 16, 64, 256)) b = ((4, -3, 4 / 3.0, -1 / 4.0), (-13 / 3.0, 19 / 4.0, -7 / 3.0, 11 / 24.0), (3 / 2.0, -2.0, 7 / 6.0, -1 / 4.0), (-1 / 6.0, 1 / 4.0, -1 / 6.0, 1 / 24.0)) def matrix_mul(mtx_a, mtx_b): tpos_b = list(zip(*mtx_b)) rtn = [[sum((ea * eb for (ea, eb...
# # PySNMP MIB module HPN-ICF-WEB-AUTHENTICATION-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-WEB-AUTHENTICATION-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:42:05 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python ...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection, constraints_union) ...
COLORS = { 'darkest_blue': '#111111', 'background_blue': '#0C172D', 'text_green': '#54F041', 'dev_purple': '#ab52c5', 'loc_pink': '#f6c6fa', 'great_depression_red': '#C90705', 'walter_white': '#FFFFFF' }
colors = {'darkest_blue': '#111111', 'background_blue': '#0C172D', 'text_green': '#54F041', 'dev_purple': '#ab52c5', 'loc_pink': '#f6c6fa', 'great_depression_red': '#C90705', 'walter_white': '#FFFFFF'}
class Order: Clayful = None name = 'Order' path = 'orders' @staticmethod def config(clayful): Order.Clayful = clayful return Order @staticmethod def accept_refund(*args): return Order.Clayful.call_api({ 'model_name': Order.name, 'method_name': 'accept_refund', 'http_method': ...
class Order: clayful = None name = 'Order' path = 'orders' @staticmethod def config(clayful): Order.Clayful = clayful return Order @staticmethod def accept_refund(*args): return Order.Clayful.call_api({'model_name': Order.name, 'method_name': 'accept_refund', 'http_...
def neighboors(active, x, y, width, height): number = 0 for i in range(-1, 2): for j in range(-1, 2): #Skip the choosen block if 0 <= x+i < width and 0 <= y+j < height: if i == 0 and j == 0: pass elif active[x+i][y+j] == 1: ...
def neighboors(active, x, y, width, height): number = 0 for i in range(-1, 2): for j in range(-1, 2): if 0 <= x + i < width and 0 <= y + j < height: if i == 0 and j == 0: pass elif active[x + i][y + j] == 1: number += 1 ...
''' --- Day 10: Balance botValues --- You come upon a factory in which many robots are zooming around handing small microchips to each other. Upon closer examination, you notice that each bot only proceeds when it has two microchips, and once it does, it gives each one to a different bot or puts it in a marked "outpu...
""" --- Day 10: Balance botValues --- You come upon a factory in which many robots are zooming around handing small microchips to each other. Upon closer examination, you notice that each bot only proceeds when it has two microchips, and once it does, it gives each one to a different bot or puts it in a marked "outpu...
#conjunto de cartas class Card: def __init__(self,suit,value): super().__init__() self.suit =suit self.value = value #reescribimos la salida al imprimir def __repr__(self): return " of ".join((self.value,self.suit))
class Card: def __init__(self, suit, value): super().__init__() self.suit = suit self.value = value def __repr__(self): return ' of '.join((self.value, self.suit))
#!/usr/bin/python filename = input("Please enter your file name: ") with open(filename, 'r') as f: lines = f.readlines() l = list(line.rstrip('\n') for line in lines) measurements_count = 0 while len(l) != 1: if l[0] < l[1]: measurements_count += 1 del(l[0]) else: print(f"There are {measurements_count} measur...
filename = input('Please enter your file name: ') with open(filename, 'r') as f: lines = f.readlines() l = list((line.rstrip('\n') for line in lines)) measurements_count = 0 while len(l) != 1: if l[0] < l[1]: measurements_count += 1 del l[0] else: print(f'There are {measurements_count} measurmen...
class BasePlugin: name = None description = None package_name = None class ExportPlugin(BasePlugin): format_type = None def format(self): raise NotImplementedError() def help(self): return f"For help check the official documentation for '{self.package_name}' plugin."
class Baseplugin: name = None description = None package_name = None class Exportplugin(BasePlugin): format_type = None def format(self): raise not_implemented_error() def help(self): return f"For help check the official documentation for '{self.package_name}' plugin."
''' A builder design pattern is a type of design pattern in which large complex objects are created without letting end user know about the complexity fo teh objects E.g: In the example below teh document object is made up of text,image, line, table objects but the end used is not aware of creation of all these obje...
""" A builder design pattern is a type of design pattern in which large complex objects are created without letting end user know about the complexity fo teh objects E.g: In the example below teh document object is made up of text,image, line, table objects but the end used is not aware of creation of all these obje...
# -*- coding: utf-8 -*- class Data: def __init__(self, d): seqs = tuple, list, set, frozenset for i, j in d.items(): if isinstance(j, dict): setattr(self, i, Data(j)) elif isinstance(j, seqs): setattr(self, i, type(j)(Data(sj) if isinstance(sj...
class Data: def __init__(self, d): seqs = (tuple, list, set, frozenset) for (i, j) in d.items(): if isinstance(j, dict): setattr(self, i, data(j)) elif isinstance(j, seqs): setattr(self, i, type(j)((data(sj) if isinstance(sj, dict) else sj for...
#! /usr/bin/env python3 days = int(input("Enter days:")) months = days // 30 days = days % 30 print("Months = {} Days = {}".format(months, days))
days = int(input('Enter days:')) months = days // 30 days = days % 30 print('Months = {} Days = {}'.format(months, days))
# # PySNMP MIB module CISCO-ITP-TC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ITP-TC-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:46:02 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, constraints_union, value_range_constraint, value_size_constraint) ...
nums = [1, 2, 3, 4, 5] for num in nums: print(num+1) print('-------------') for i in range(3): print(i)
nums = [1, 2, 3, 4, 5] for num in nums: print(num + 1) print('-------------') for i in range(3): print(i)
class Node: def __init__(self, data: int): self.data: int = data self.next: Node = None class LinkedList: def __init__(self, head: Node = None): self.head = head def push(self, data: int): node = Node(data) if not self.head: self.head = node el...
class Node: def __init__(self, data: int): self.data: int = data self.next: Node = None class Linkedlist: def __init__(self, head: Node=None): self.head = head def push(self, data: int): node = node(data) if not self.head: self.head = node else...
def convert(file_1, file_2, file_out): def read_origin(file_in): # Dumps from sfrolov are raw arrays of bytes strictly following the internal address space of 1/2 of BRP unit. return file_in.read() if file_in is not None else bytes(2048) def write_derivative(bytes_4096, file_out): s = ...
def convert(file_1, file_2, file_out): def read_origin(file_in): return file_in.read() if file_in is not None else bytes(2048) def write_derivative(bytes_4096, file_out): s = bytes_4096.hex('\t').expandtabs(2) file_out.write(''.join([s[i:i + 8 * 4].strip() + '\n' for i in range(0, len(...
def binSearchClosest(list, key): if list==[]: return None elif len(list)==1: return 0 left=0; right=len(list)-1 # binary search while left<right: mid = (left + right) // 2 if list[mid]==key: # found return mid elif list[mid]>key: righ...
def bin_search_closest(list, key): if list == []: return None elif len(list) == 1: return 0 left = 0 right = len(list) - 1 while left < right: mid = (left + right) // 2 if list[mid] == key: return mid elif list[mid] > key: right = mid -...
harmonization_table = { "Trees": ["Trees", "CEO_Trees", "GO_Trees"], "Shrubland": ["Shrubland", "CEO_Shrubland", "GO_Shrub"], "Grassland": ["Grassland", "CEO_Grassland", "GO_Grass"], "Cropland": ["Cropland", "CEO_Cropland", "GO_Cultivated"], "Built-up": ["Built-up", "CEO_BuiltUp", "GO_BuiltUp"], ...
harmonization_table = {'Trees': ['Trees', 'CEO_Trees', 'GO_Trees'], 'Shrubland': ['Shrubland', 'CEO_Shrubland', 'GO_Shrub'], 'Grassland': ['Grassland', 'CEO_Grassland', 'GO_Grass'], 'Cropland': ['Cropland', 'CEO_Cropland', 'GO_Cultivated'], 'Built-up': ['Built-up', 'CEO_BuiltUp', 'GO_BuiltUp'], 'Barren': ['Barren / Spa...
#!/usr/bin/env python # coding: utf-8 _JOINT_NAMES_1 = [ 'Waist', 'Torso', 'Neck', 'Head', 'LeftShoulder', 'LeftElbow', 'LeftWrist', 'LeftHand', 'RightShoulder', 'RightElbow', 'RightWrist', 'RightHand', 'LeftHip', 'LeftKnee', 'LeftAnkle', 'LeftFoot', 'RightHip', 'RightKnee', 'RightAnkle', 'RightFoo...
_joint_names_1 = ['Waist', 'Torso', 'Neck', 'Head', 'LeftShoulder', 'LeftElbow', 'LeftWrist', 'LeftHand', 'RightShoulder', 'RightElbow', 'RightWrist', 'RightHand', 'LeftHip', 'LeftKnee', 'LeftAnkle', 'LeftFoot', 'RightHip', 'RightKnee', 'RightAnkle', 'RightFoot'] _articulated_figure_angles_1 = {'rshldr_theta': ('RightS...
F_BOIL_TEMP = 212.0 F_FREEZE_TEMP = 32.0 C_BOIL_TEMP = 100.0 C_FREEZE_TEMP = 0.0 F_RANGE = F_BOIL_TEMP - F_FREEZE_TEMP C_RANGE = C_BOIL_TEMP - C_FREEZE_TEMP F_C_RATIO = C_RANGE / F_RANGE def ftoc(f_temp): "Convert Fahrenheit temperature <f_temp> to Celsius and return it." c_temp = (f_temp - F_FREEZE_TEMP) * F_...
f_boil_temp = 212.0 f_freeze_temp = 32.0 c_boil_temp = 100.0 c_freeze_temp = 0.0 f_range = F_BOIL_TEMP - F_FREEZE_TEMP c_range = C_BOIL_TEMP - C_FREEZE_TEMP f_c_ratio = C_RANGE / F_RANGE def ftoc(f_temp): """Convert Fahrenheit temperature <f_temp> to Celsius and return it.""" c_temp = (f_temp - F_FREEZE_TEMP) ...
S = input() t = 0 for i in range(0, len(S), 5): if S[i:i + 5] == '(^^*)': t += 1 print(t, len(S) // 5 - t)
s = input() t = 0 for i in range(0, len(S), 5): if S[i:i + 5] == '(^^*)': t += 1 print(t, len(S) // 5 - t)
class BasePayload(object): _name = "Default" _code = None _activated = False _conf = None _stager_path = "" def setHandler(self, IP, PORT): d = dict() d['SERVER'] = IP d['PORT'] = PORT self.setCode(d) def setActivated(self, status): ...
class Basepayload(object): _name = 'Default' _code = None _activated = False _conf = None _stager_path = '' def set_handler(self, IP, PORT): d = dict() d['SERVER'] = IP d['PORT'] = PORT self.setCode(d) def set_activated(self, status): self._activated...
n = int(input()) registered_users = dict() for i in range(n): command = input() tokens = command.split(' ') action = tokens[0] if action == 'register': username = tokens[1] licence_plate = tokens[2] if username not in registered_users: registered_users[usern...
n = int(input()) registered_users = dict() for i in range(n): command = input() tokens = command.split(' ') action = tokens[0] if action == 'register': username = tokens[1] licence_plate = tokens[2] if username not in registered_users: registered_users[username] = lic...
# How do you read and write to a specific file : # We have a few different ways to do that using a file stream : # To open a file, you create a stream object # we determine the file name and the mode, most of time we leave the buffer_size ti the default stream = open(file_name, mode, buffer_size) # Modes : # r - Rea...
stream = open(file_name, mode, buffer_size) print(stream.readable()) print(stream.readable(1)) print(stream.readline()) stream.close() stream = open('output.txt', 'wt') stream.write('H') stream.writelines(['ello', 'World']) stream.write('\n') names = ['Ali', 'Hani'] stream.writelines(names) stream.close() stream = open...
number_employee = int(input('')) hours = int(input()) value_work_hour = float(input()) salary = hours * value_work_hour print('NUMBER = {}'.format(number_employee)) print('SALARY = U$ {:.2f}'.format(salary))
number_employee = int(input('')) hours = int(input()) value_work_hour = float(input()) salary = hours * value_work_hour print('NUMBER = {}'.format(number_employee)) print('SALARY = U$ {:.2f}'.format(salary))
# dummy request object class DummyReq: # constructor def __init__(self,env,): # environ self.subprocess_env = env # header self.headers_in = {} # content-length if self.subprocess_env.has_key('CONTENT_LENGTH'): self.headers_in["content-length"] = self....
class Dummyreq: def __init__(self, env): self.subprocess_env = env self.headers_in = {} if self.subprocess_env.has_key('CONTENT_LENGTH'): self.headers_in['content-length'] = self.subprocess_env['CONTENT_LENGTH'] def get_remote_host(self): if self.subprocess_env.has_...
class Person(object): def __init__(self, fn, ln): self.first_name = fn self.last_name = ln
class Person(object): def __init__(self, fn, ln): self.first_name = fn self.last_name = ln
class Solution: def minCostToMoveChips(self, chips: List[int]) -> int: count = [0] * 2 for chip in chips: count[chip % 2] += 1 return min(count[0], count[1])
class Solution: def min_cost_to_move_chips(self, chips: List[int]) -> int: count = [0] * 2 for chip in chips: count[chip % 2] += 1 return min(count[0], count[1])
print("Welcome to the professor quality calculator by MillenniumWare!") print("Follow the prompts below to calculate how good your professor is!!!") print("************************") print("") name = input("Enter your professor's name! >") print("") print("On a scale of 1-5 (1 being horrible, 2 tolerable, 3 adequ...
print('Welcome to the professor quality calculator by MillenniumWare!') print('Follow the prompts below to calculate how good your professor is!!!') print('************************') print('') name = input("Enter your professor's name! >") print('') print('On a scale of 1-5 (1 being horrible, 2 tolerable, 3 adequate, 4...
class Solution(object): def atMostNGivenDigitSet(self, D, N): B = len(D) # bijective-base B S = str(N) K = len(S) A = [] # The largest valid number in bijective-base-B. for c in S: if c in D: A.append(D.index(c) + 1) else: ...
class Solution(object): def at_most_n_given_digit_set(self, D, N): b = len(D) s = str(N) k = len(S) a = [] for c in S: if c in D: A.append(D.index(c) + 1) else: i = bisect.bisect(D, c) A.append(i) ...
#!/usr/bin/python3 def check(dx,dy): f=open("input","r") l=f.readlines() l=[l.strip('\n\r') for l in l] x=0 y=0 c=0 while(y<len(l)): if l[y][x]=='#': c+=1 x+=dx if x>=len(l[0]): x-=len(l[0]) y+=dy return (c) ...
def check(dx, dy): f = open('input', 'r') l = f.readlines() l = [l.strip('\n\r') for l in l] x = 0 y = 0 c = 0 while y < len(l): if l[y][x] == '#': c += 1 x += dx if x >= len(l[0]): x -= len(l[0]) y += dy return c print('1: ' + str(...
Import("env") # Access to global construction environment build_tag = env['PIOENV'] # Dump construction environment (for debug purpose) # print(env.Dump()) # Rename binary according to environnement/board # ex: firmware_esp32dev.bin or firmware_nodemcuv2.bin env.Replace(PROGNAME="firmware_%s" % build_tag)
import('env') build_tag = env['PIOENV'] env.Replace(PROGNAME='firmware_%s' % build_tag)
class Solution: def findRepeatedDnaSequences(self, s: str) -> List[str]: res = set() dic = {} for i in range(len(s)): temp = s[i:i+10] if temp not in dic: dic[temp]=1 else: res.add(temp) return res ...
class Solution: def find_repeated_dna_sequences(self, s: str) -> List[str]: res = set() dic = {} for i in range(len(s)): temp = s[i:i + 10] if temp not in dic: dic[temp] = 1 else: res.add(temp) return res
def make_exchange_name(namespace, exchange_type, extra=""): return "{}.{}".format(namespace, exchange_type) if not extra else "{}.{}@{}".format(namespace, exchange_type, extra) def make_channel_name(namespace, exchange_type): return "channel_on_{}.{}".format(namespace, exchange_type) def make_queue_name...
def make_exchange_name(namespace, exchange_type, extra=''): return '{}.{}'.format(namespace, exchange_type) if not extra else '{}.{}@{}'.format(namespace, exchange_type, extra) def make_channel_name(namespace, exchange_type): return 'channel_on_{}.{}'.format(namespace, exchange_type) def make_queue_name(names...
def build_model(): pass def save_model(): pass def load_model(model_path): pass def load_best_model(): pass
def build_model(): pass def save_model(): pass def load_model(model_path): pass def load_best_model(): pass
# Databricks notebook source print("hello world") # COMMAND ---------- print("let's make some changes and commit!") # COMMAND ----------
print('hello world') print("let's make some changes and commit!")
#!/usr/bin/env python # test print('test!')
print('test!')
N = int(input()) V = list(map(int, input().split())) V.sort() v_sum = (V[0]+V[1]) / (2**(len(V)-1)) for i in range(2, len(V)): v_sum += V[i] / (2**(len(V)-i)) print(v_sum)
n = int(input()) v = list(map(int, input().split())) V.sort() v_sum = (V[0] + V[1]) / 2 ** (len(V) - 1) for i in range(2, len(V)): v_sum += V[i] / 2 ** (len(V) - i) print(v_sum)
class KeyValue: def __init__(self, key: None, value: None): self.key = key self.value = value class HashMap: def __init__(self, size:int = 11): self.size: int = size self.items: list = [None] * self.size self.length: int = 0 def put(self, key, value): keyVal...
class Keyvalue: def __init__(self, key: None, value: None): self.key = key self.value = value class Hashmap: def __init__(self, size: int=11): self.size: int = size self.items: list = [None] * self.size self.length: int = 0 def put(self, key, value): key_v...
class EllysTSP: def getMax(self, places): c = places.count('C') v = len(places) - c return 2 * min(c, v) + min(abs(c-v), 1)
class Ellystsp: def get_max(self, places): c = places.count('C') v = len(places) - c return 2 * min(c, v) + min(abs(c - v), 1)
students = [] def get_students_titlecase(): students_titlecase = [] for student in students: students_titlecase = student.title() return students_titlecase def print_students_titlecase(): student_titlecase = get_students_titlecase() print(students_titlecase) def add_student(name, student_id=223): student...
students = [] def get_students_titlecase(): students_titlecase = [] for student in students: students_titlecase = student.title() return students_titlecase def print_students_titlecase(): student_titlecase = get_students_titlecase() print(students_titlecase) def add_student(name, student_...
def posicionesAdyacentes2(self,fila,columna,mapa): retorno=[] #Norte if(fila>=1 and (mapa[fila-1][columna]!="W" and mapa[fila-1][columna]!="X")): retorno.append([fila-1,columna]) #Este if(columna<=10 and (mapa[fila][columna+1]!="W" and mapa[fila][columna+1]!="X")): ...
def posiciones_adyacentes2(self, fila, columna, mapa): retorno = [] if fila >= 1 and (mapa[fila - 1][columna] != 'W' and mapa[fila - 1][columna] != 'X'): retorno.append([fila - 1, columna]) if columna <= 10 and (mapa[fila][columna + 1] != 'W' and mapa[fila][columna + 1] != 'X'): retorno.appe...
for t in range(int(input())): a, b, threshold = map(int, input().split()) steps = 0 while a <= threshold and b <= threshold: if a < b: a += b else: b += a steps += 1 print(steps)
for t in range(int(input())): (a, b, threshold) = map(int, input().split()) steps = 0 while a <= threshold and b <= threshold: if a < b: a += b else: b += a steps += 1 print(steps)
n = int(input().strip()) x = [int(i) for i in input().strip().split(' ')] w = [int(i) for i in input().strip().split(' ')] s = sum([x[i]*w[i] for i in range(0,n)]) wmean = s/sum(w) print("{:0.1f}".format(wmean))
n = int(input().strip()) x = [int(i) for i in input().strip().split(' ')] w = [int(i) for i in input().strip().split(' ')] s = sum([x[i] * w[i] for i in range(0, n)]) wmean = s / sum(w) print('{:0.1f}'.format(wmean))
# Solution-1 - Lisa Murray # User needs to enter integer number = input("Please enter a positive integer:") # Number needs to be converted from string format to number format, and add 1 to inclued the number chosen num2 = int(number) + 1 # Creating variable for sum sum = 0 # create loop to loop through all numbers ...
number = input('Please enter a positive integer:') num2 = int(number) + 1 sum = 0 for i in range(num2): sum += i print(sum)
words = ('Oi', 'eu', 'aprendo', 'Python', 'pelo', 'Curso', 'em', 'video') for p in words: print(f'\nNa palavra {p.upper()} temos ', end='') for letra in p: if letra.lower() in 'aeiou': print(letra, end=' ')
words = ('Oi', 'eu', 'aprendo', 'Python', 'pelo', 'Curso', 'em', 'video') for p in words: print(f'\nNa palavra {p.upper()} temos ', end='') for letra in p: if letra.lower() in 'aeiou': print(letra, end=' ')
# Event: LCCS Python Fundamental Skills Workshop # Date: May 2018 # Author: Joe English, PDST # eMail: computerscience@pdst.ie # Purpose: A program to calculate the average height of 5 people # Version: 1.0 (This program contains deliberate errors) print("Average height calculator") print("====================...
print('Average height calculator') print('=========================') h1 = int(input('Enter first height (cm): ')) h2 = int(input('Enter second height (cm): ')) h3 = int(input('Enter third height (cm): ')) h4 = int(input('Enter fourth height (cm): ')) h5 = int(input('Enter fifth height (cm): ')) avg_heigth = h1 + h2 + ...
class Solution: # @param word1 & word2: Two string. # @return: The minimum number of steps. def minDistance(self, word1, word2): # write your code here if word1 == word2: return 0 if len(word1) == 0: return len(word2) if len(word2) == 0: re...
class Solution: def min_distance(self, word1, word2): if word1 == word2: return 0 if len(word1) == 0: return len(word2) if len(word2) == 0: return len(word1) (m, n) = (len(word1), len(word2)) d = [[0 for j in xrange(n + 1)] for i in xrange...
def analyze(vw): for fva in vw.getFunctions(): analyzeFunction(vw, fva) def analyzeFunction(vw, fva): fakename = vw.getName(fva+1) if fakename is not None: vw.makeName(fva+1, None) vw.makeName(fva, fakename)
def analyze(vw): for fva in vw.getFunctions(): analyze_function(vw, fva) def analyze_function(vw, fva): fakename = vw.getName(fva + 1) if fakename is not None: vw.makeName(fva + 1, None) vw.makeName(fva, fakename)
# problem : https://leetcode.com/problems/first-missing-positive/ # time complexity : O(N) class Solution: def firstMissingPositive(self, nums: List[int]) -> int: s = set(nums) ans = 1 for num in nums: if(ans in s): ans += 1 else: brea...
class Solution: def first_missing_positive(self, nums: List[int]) -> int: s = set(nums) ans = 1 for num in nums: if ans in s: ans += 1 else: break return ans
M = [] Schedule = [] def maximum(a,b): if a > b : return a else: return b def calculate_predecessor(jobs,n): p = [0 for i in range(n+1)] cur_job = n chosen_job = cur_job - 1 while cur_job > 1 : if chosen_job <= 0 : p[cur_job] = 0 cur_job=cur_job-1 ...
m = [] schedule = [] def maximum(a, b): if a > b: return a else: return b def calculate_predecessor(jobs, n): p = [0 for i in range(n + 1)] cur_job = n chosen_job = cur_job - 1 while cur_job > 1: if chosen_job <= 0: p[cur_job] = 0 cur_job = cur_j...
# This file defines the board layout, as well as some other information # about the bitmaps. BaseName = '@/usr/home/srn/work/scrabble/bitmaps/' Bitmaps = { 'D':{'bitmap':BaseName + 'DW.xbm', 'background':'pink'}, 'd':{'bitmap':BaseName + 'DL.xbm', 'background':'sky blue'}, 'T':{'bitmap':BaseName + 'TW.xbm', 'backgr...
base_name = '@/usr/home/srn/work/scrabble/bitmaps/' bitmaps = {'D': {'bitmap': BaseName + 'DW.xbm', 'background': 'pink'}, 'd': {'bitmap': BaseName + 'DL.xbm', 'background': 'sky blue'}, 'T': {'bitmap': BaseName + 'TW.xbm', 'background': 'red'}, 't': {'bitmap': BaseName + 'TL.xbm', 'background': 'blue'}, ' ': {'bitmap'...
def je_prastevilo(n): if n < 2 or n % 2 == 0: return n == 2 i = 3 while i * i <= n: if n % i == 0: return False i += 2 return True def poljuben_krog(n): return ( 2 * n - 1 ) ** 2 - ( 2 * ( n - 1 ) - 1 ) ** 2 if n != 1 else 1 def je_lih_kvadrat(n): return n *...
def je_prastevilo(n): if n < 2 or n % 2 == 0: return n == 2 i = 3 while i * i <= n: if n % i == 0: return False i += 2 return True def poljuben_krog(n): return (2 * n - 1) ** 2 - (2 * (n - 1) - 1) ** 2 if n != 1 else 1 def je_lih_kvadrat(n): return n ** (1 /...
# # PySNMP MIB module ASYNCOS-MAIL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASYNCOS-MAIL-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:13:32 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') (constraints_union, value_size_constraint, value_range_constraint, constraints_intersection, single_value_constraint) ...
def bytes_to_iso(i): numbers = [(1000, 'k'), (1000000, 'M'), (1000000000, 'G'), (1000000000000, 'T')] if i < 1000: return '{} B'.format(i) for n in numbers: if i < n[0] * 1000: return '{:.1f} {}B'.format(i / n[0], n[1]) return '{:.1f} PB'.format(i) def iso_to...
def bytes_to_iso(i): numbers = [(1000, 'k'), (1000000, 'M'), (1000000000, 'G'), (1000000000000, 'T')] if i < 1000: return '{} B'.format(i) for n in numbers: if i < n[0] * 1000: return '{:.1f} {}B'.format(i / n[0], n[1]) return '{:.1f} PB'.format(i) def iso_to_bytes(i): n...
dataset_type = 'SUNRGBDDataset' data_root = 'data/sunrgbd/' class_names = ('bed', 'table', 'sofa', 'chair', 'toilet', 'desk', 'dresser', 'night_stand', 'bookshelf', 'bathtub') train_pipeline = [ dict( type='LoadPointsFromFile', coord_type='DEPTH', shift_height=True, lo...
dataset_type = 'SUNRGBDDataset' data_root = 'data/sunrgbd/' class_names = ('bed', 'table', 'sofa', 'chair', 'toilet', 'desk', 'dresser', 'night_stand', 'bookshelf', 'bathtub') train_pipeline = [dict(type='LoadPointsFromFile', coord_type='DEPTH', shift_height=True, load_dim=6, use_dim=[0, 1, 2]), dict(type='LoadAnnotati...
n = int(input()) while n != 0: db = {} for i in range(n): name = input() color_size = input() if color_size in db: aux = db[color_size] aux.append(name) db[color_size] = aux else: db[color_size] = [name] print('') if ...
n = int(input()) while n != 0: db = {} for i in range(n): name = input() color_size = input() if color_size in db: aux = db[color_size] aux.append(name) db[color_size] = aux else: db[color_size] = [name] print('') if 'white ...
#intitial Variable setup List_Base = [] Image_Scale = [] Image=[] def Input(): # Gets the users input values for the image, makes sure input is exactly 100 characters and only includes 1 and 0 User_Input = str(input("Enter values here: \n")) while any(c.isalpha() for c in User_Input) is True: print("\...
list__base = [] image__scale = [] image = [] def input(): user__input = str(input('Enter values here: \n')) while any((c.isalpha() for c in User_Input)) is True: print("\nERROR: Input can only contain 1's and 0's.\n") user__input = str(input('Enter values here: \n')) while len(User_Input) !...
def detail_samtools(Regions, Read_depth): # create a detailed list with all depth values from the same region in a sub list. From samtools depth calculations # samtools generates a depth file with: chr, position and coverage depth value # Regeions comes from the bed file with chr, start, stop, region name ...
def detail_samtools(Regions, Read_depth): detailed = [] list_temp = [] previous_chr = Read_depth[0][0] region_row = 0 count = 0 index = 0 size_list = len(Read_depth) for line in Read_depth: region_row = Regions[index] if str(line[0]) == str(previous_chr) and int(line[1]) ...
target_prime = 10000 current_num = 2 current_denominator = current_num - 1 while True: if current_denominator == 1: # this is a prime number # print(current_num) target_prime = target_prime - 1 if target_prime == 0: print("Prime number is " + str(current_num)) break current_num = curr...
target_prime = 10000 current_num = 2 current_denominator = current_num - 1 while True: if current_denominator == 1: target_prime = target_prime - 1 if target_prime == 0: print('Prime number is ' + str(current_num)) break current_num = current_num + 1 current_d...
s = open('day01.txt', 'r').read() left = 0 right = 0 for i in range(len(s)): if s[i] == '(': left += 1 else: right += 1 if left - right == -1: print(i) break
s = open('day01.txt', 'r').read() left = 0 right = 0 for i in range(len(s)): if s[i] == '(': left += 1 else: right += 1 if left - right == -1: print(i) break
N = int(input()) # input() gets the whole line, int() converts from string to int dictionary = {} # dictionaries appear to work the same as objects in javascript for i in range(0, N): inputArray = input().split() # okay this line is cool, converts indices 1->end of inputArray to floats, puts them in a list ...
n = int(input()) dictionary = {} for i in range(0, N): input_array = input().split() marks = list(map(float, inputArray[1:])) dictionary[inputArray[0]] = sum(marks) / float(len(marks)) print('%.2f' % dictionary[input()])
# Bo Pace, Oct 2016 # Quicksort # Quicksort has a similar divide-and-conquer strategy to that # of merge sort, but has a space advantage of doing all of the # sorting in place. The worst case complexity is worse than # merge sort, however. Quicksort has a best and average case # complexity of O(nlogn), with a worst cas...
def quicksort(arr, first=0, last=None): if last == None: last = len(arr) - 1 if first < last: split_index = partition(arr, first, last) quicksort(arr, first, split_index - 1) quicksort(arr, split_index + 1, last) return arr def partition(arr, first, last): pivot_val = ar...
# This file is part of the pylint-ignore project # https://github.com/mbarkhau/pylint-ignore # # Copyright (c) 2020 Manuel Barkhau (mbarkhau@gmail.com) - MIT License # SPDX-License-Identifier: MIT __version__ = "2020.1017"
__version__ = '2020.1017'
#Kunal Gautam #Codewars : @Kunalpod #Problem name: CamelCase Method #Problem level: 6 kyu def camel_case(string): return ''.join([x[0].upper()+x[1:] for x in string.lower().split()])
def camel_case(string): return ''.join([x[0].upper() + x[1:] for x in string.lower().split()])
RUN_TEST = False TEST_SOLUTION = 26 TEST_INPUT_FILE = 'test_input_day_11.txt' INPUT_FILE = 'input_day_11.txt' MIN_NUM_SEATS_TO_MAKE_EMPTY = 5 ARGS = [MIN_NUM_SEATS_TO_MAKE_EMPTY] def main_part2(input_file, min_num_seats_to_make_empty): with open(input_file) as file: seat_occupations = list(map(lambda li...
run_test = False test_solution = 26 test_input_file = 'test_input_day_11.txt' input_file = 'input_day_11.txt' min_num_seats_to_make_empty = 5 args = [MIN_NUM_SEATS_TO_MAKE_EMPTY] def main_part2(input_file, min_num_seats_to_make_empty): with open(input_file) as file: seat_occupations = list(map(lambda line:...
# Problem 1: What will be the output of the following code x = 1 def f(): return x print (x) # Ans-1 print (f()) # Ans-1 #Problem 2: What will be the output of the following program? x = 1 def f(): x = 2 return x print (x) # Ans-1 print (f()) # Ans-2 print (x) # Ans-1 #Problem 3: What wi...
x = 1 def f(): return x print(x) print(f()) x = 1 def f(): x = 2 return x print(x) print(f()) print(x) x = 1 def f(): x = 2 y = 1 return x + y print(x) print(f()) print(x) x = 2 def f(a): x = a * a return x y = f(3) print(x, y) def difference(x, y): return x - y difference(5, 2)...
# https://leetcode.com/submissions/detail/433325047/?from=explore&item_id=3577 # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def isBalanced(self, root: TreeNode) ->...
class Treenode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def is_balanced(self, root: TreeNode) -> bool: def helper(node): if not node: return (0, True) (l_heigh...
class constants: # username, Type: String # this email id shouldn't have 2 factor authentication username = "<enter a valid email id>" # password, Type: String password = "<enter the appropriate password>" # to email addresses => Enter a valid to email address and this email id need not disable the...
class Constants: username = '<enter a valid email id>' password = '<enter the appropriate password>' to_addresses = ['<--to email address-->'] req_age = 18 req_slot = 1 pincode = [530040] pin_code_url = 'api/v2/appointment/sessions/public/findByPin' day_check_count = 3 sleep_peak_tim...
class Solution: def countStudents(self, students: List[int], sandwiches: List[int]) -> int: sandwiches = deque(sandwiches) students = deque(students) while not (all(a!=sandwiches[0] for a in students)): if students[0] == sandwiches[0]: students.popleft() ...
class Solution: def count_students(self, students: List[int], sandwiches: List[int]) -> int: sandwiches = deque(sandwiches) students = deque(students) while not all((a != sandwiches[0] for a in students)): if students[0] == sandwiches[0]: students.popleft() ...
class DictX(dict): def __getattr__(self, key): try: return self[key] except KeyError as k: raise AttributeError(k) def __setattr__(self, key, value): self[key] = value def __delattr__(self, key): try: del self[key] ex...
class Dictx(dict): def __getattr__(self, key): try: return self[key] except KeyError as k: raise attribute_error(k) def __setattr__(self, key, value): self[key] = value def __delattr__(self, key): try: del self[key] except KeyErr...
class Model: def __init__(self, model, feature_names): self.model = model self.feature_names = feature_names self.ID = "" def get_ID(self): return self.ID def fit(self, X, y): self.model.fit(X, y) def predict(self, X): return self.model.predict(X) ...
class Model: def __init__(self, model, feature_names): self.model = model self.feature_names = feature_names self.ID = '' def get_id(self): return self.ID def fit(self, X, y): self.model.fit(X, y) def predict(self, X): return self.model.predict(X) ...
#input={'names_raw':names_raw,'orders_raw':orders_raw,'phones_raw':phones_raw,'emails_raw':emails_raw,'start_index':0,'limit':500,'length':1251} start_index = int(float(input['start_index'])) limit = int(input['limit']) length = int(float(input['length'])) if (start_index+limit) >= length: end_index = length ...
start_index = int(float(input['start_index'])) limit = int(input['limit']) length = int(float(input['length'])) if start_index + limit >= length: end_index = length finished = True else: end_index = start_index + limit finished = False names = input['names_raw'].split('*')[start_index:end_index] orders ...
''' def find( element, list): for i, j in enumerate( list): if( j == element): return i; return -1 data_path = "../data/data_uci.pgn" fd = open( data_path) ''' def find( element, list): for i, j in enumerate( list): if( j[0:2] == element): return i; return -1 data_path = "../data/data_uci.pgn" ...
""" def find( element, list): for i, j in enumerate( list): if( j == element): return i; return -1 data_path = "../data/data_uci.pgn" fd = open( data_path) """ def find(element, list): for (i, j) in enumerate(list): if j[0:2] == element: return i return -1 data_path = '../data/d...
power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate...
power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate Leakage': 0.00662954, 'Peak Dynamic': 0.0, 'Runtime Dynamic': 0.0, 'Subthres...
numbers = [1,3,5,4,6,2,8,9,7] prime_numbers = [] non_prime_numbers = [] i = 0 while i < len(numbers): if numbers[i] % 2 == 0: prime_numbers.append(numbers[i]) else: non_prime_numbers.append(numbers[i]) i += 1 print(f'Obshii spisok {numbers}') print(f'4etnye 4islami: {prime_numbers}') print...
numbers = [1, 3, 5, 4, 6, 2, 8, 9, 7] prime_numbers = [] non_prime_numbers = [] i = 0 while i < len(numbers): if numbers[i] % 2 == 0: prime_numbers.append(numbers[i]) else: non_prime_numbers.append(numbers[i]) i += 1 print(f'Obshii spisok {numbers}') print(f'4etnye 4islami: {prime_numbers}')...
# # PySNMP MIB module TRAPEZE-NETWORKS-INFO-RF-DETECT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TRAPEZE-NETWORKS-INFO-RF-DETECT-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:27:18 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Usi...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_union, value_range_constraint, constraints_intersection, single_value_constraint) ...
# Created by MechAviv # Kinesis Introduction # Map ID :: 331001000 # Hideout :: HQ JAY = 1531001 sm.setNpcOverrideBoxChat(JAY) if sm.sendAskYesNo("You lost your gear? Ugh, dude! Don't trash my stuff! It takes time to hack those things together. Here, I have backups of your primary and secondary, but only the basic mo...
jay = 1531001 sm.setNpcOverrideBoxChat(JAY) if sm.sendAskYesNo("You lost your gear? Ugh, dude! Don't trash my stuff! It takes time to hack those things together. Here, I have backups of your primary and secondary, but only the basic models. TRY to respect these, hmm?"): sm.giveItem(1353200) sm.giveItem(1262000)
users = [] class User(): def __init__(self, username, pin, balance=0): self.username = username self.pin = pin self.balance = balance def deposit(self, amount): self.balance += amount print(f"Deposited ${amount} into account {self.username}") self.print_balance(...
users = [] class User: def __init__(self, username, pin, balance=0): self.username = username self.pin = pin self.balance = balance def deposit(self, amount): self.balance += amount print(f'Deposited ${amount} into account {self.username}') self.print_balance()...
def is_it_true(anything): if anything: print('yes, it is true') else: print('no, it is false')
def is_it_true(anything): if anything: print('yes, it is true') else: print('no, it is false')
# -*- coding: utf-8 -*- def split_data(filename): data = {} with open(filename, 'r') as openFile: f = openFile.readlines()[1:] for line in f: line_elements = line.rstrip('\r\n').split(',') key = line_elements[1] if key in data: data[key].appen...
def split_data(filename): data = {} with open(filename, 'r') as open_file: f = openFile.readlines()[1:] for line in f: line_elements = line.rstrip('\r\n').split(',') key = line_elements[1] if key in data: data[key].append([line_elements[0], lin...
# Duolingo username and password USERNAME = 'username' PASSWORD = 'password' # Locations # Production # DB_FILE = r"db/personal.db" # LOG_DIR = 'path to logging directory' # WEB_PAGE = 'path to destination web page' # TEMPLATE_PAGE = 'path to template for web page' # Development & Test DB_FILE = r"db/personal.db" L...
username = 'username' password = 'password' db_file = 'db/personal.db' log_dir = './example/logs/' web_page = './example/duo.html' template_page = './templates/duo_template.html'
print("Question 1:") ''' Use for, .split(), and if to create a Statement that will print out words that start with 's': st = 'Print only the words that start with s in this sentence' ''' st = 'Print only the words that start with s in this sentence' list_worlds = st.split(' ') for word in list_worlds: if word[0] ...
print('Question 1:') "\nUse for, .split(), and if to create a Statement that will print out words that start with 's':\n\nst = 'Print only the words that start with s in this sentence'\n" st = 'Print only the words that start with s in this sentence' list_worlds = st.split(' ') for word in list_worlds: if word[0] =...