content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
size(300, 300) _total_w = 0 def flow(w, h): global _total_w if _total_w + w*2 >= WIDTH: translate(-_total_w, h) _total_w = 0 else: translate(w, 0) _total_w += w x, y = 10, 10 rect(x, y, 50, 50) flow(60, 60) rect(x, y, 50, 50, 0.6) flow(60, 60) oval(x, y, 50, 50) flow(60, 6...
size(300, 300) _total_w = 0 def flow(w, h): global _total_w if _total_w + w * 2 >= WIDTH: translate(-_total_w, h) _total_w = 0 else: translate(w, 0) _total_w += w (x, y) = (10, 10) rect(x, y, 50, 50) flow(60, 60) rect(x, y, 50, 50, 0.6) flow(60, 60) oval(x, y, 50, 50) flow(6...
class Solution: def recoverFromPreorder(self, S: str) -> TreeNode: if not S: return l = S.split('-') s, depth = [[TreeNode(l[0]), 0]], 1 for item in l[1:]: if not item: depth += 1 continue node = TreeNode(item) while...
class Solution: def recover_from_preorder(self, S: str) -> TreeNode: if not S: return l = S.split('-') (s, depth) = ([[tree_node(l[0]), 0]], 1) for item in l[1:]: if not item: depth += 1 continue node = tree_node(it...
{ 'targets': [ { 'include_dirs': ['/usr/include', '/usr/local/include'], 'libraries': ['-L/usr/lib', '-L/usr/local/lib'], 'target_name': 'gzbz2', 'sources': ['compress.cc'], 'link_settings': { 'libraries': [ '-lbz2' ] }, 'conditions': [ [...
{'targets': [{'include_dirs': ['/usr/include', '/usr/local/include'], 'libraries': ['-L/usr/lib', '-L/usr/local/lib'], 'target_name': 'gzbz2', 'sources': ['compress.cc'], 'link_settings': {'libraries': ['-lbz2']}, 'conditions': [['OS=="linux"', {'cflags': ['-Wall', '-O2', '-fexceptions'], 'cflags_cc!': ['-fno-exception...
# Uses python3 def get_fibonacci_huge_naive(n, m): if n <= 1: return n previous = 0 current = 1 for _ in range(n - 1): previous, current = current, previous + current return current % m def get_fibonacci_period(m): P = [0] prv, cur = 0, 1 while (prv, cur) != (1, 0...
def get_fibonacci_huge_naive(n, m): if n <= 1: return n previous = 0 current = 1 for _ in range(n - 1): (previous, current) = (current, previous + current) return current % m def get_fibonacci_period(m): p = [0] (prv, cur) = (0, 1) while (prv, cur) != (1, 0): P.a...
#----------------------------------------------------------------------------- # Runtime: 44ms # Memory Usage: # Link: #----------------------------------------------------------------------------- class Solution: def intToRoman(self, num: int) -> str: result = [] if num >= 1000: resu...
class Solution: def int_to_roman(self, num: int) -> str: result = [] if num >= 1000: result.append('M' * (num // 1000)) num %= 1000 if num >= 900: result.append('CM') num -= 900 if num >= 500: result.append('D') ...
# is_hot = False # is_clod = False # # # if is_hot: # print("it is hot day ") # print("drink plentry of water ") # elif is_clod: # print("it is clod day ") # print("Wear warm Clothes") # else: # print("it is a Lovely day ") # print("Enjoy Your Day ") # has_high_income = False # has_good_credi...
name = 'shivam singh' if len(name) < 3: print('name must at least 3 charters') elif len(name) > 50: print('name must be a maximum 50 charters') else: print('name Looks Good ')
# SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2020 Ericsson AB name = "paf"
name = 'paf'
# -*- coding: utf-8 -*- class Solution: def bitwiseComplement(self, N: int) -> int: return int(''.join('1' if c == '0' else '0' for c in format(N, 'b')), 2) if __name__ == '__main__': solution = Solution() assert 2 == solution.bitwiseComplement(5) assert 0 == solution.bitwiseComplement(7) ...
class Solution: def bitwise_complement(self, N: int) -> int: return int(''.join(('1' if c == '0' else '0' for c in format(N, 'b'))), 2) if __name__ == '__main__': solution = solution() assert 2 == solution.bitwiseComplement(5) assert 0 == solution.bitwiseComplement(7) assert 5 == solution.b...
description = 'Placeholders for devices not yet present.' group = 'lowlevel' devices = dict( xs = device('nicos.devices.generic.VirtualMotor', description = 'Sample x position', abslimits = (0, 730), unit = 'mm', curvalue = 2500 ), xd2 = device('nicos.devices.generic.Virtua...
description = 'Placeholders for devices not yet present.' group = 'lowlevel' devices = dict(xs=device('nicos.devices.generic.VirtualMotor', description='Sample x position', abslimits=(0, 730), unit='mm', curvalue=2500), xd2=device('nicos.devices.generic.VirtualMotor', description='Diaphragm2 x position', abslimits=(0, ...
# -*- coding: utf-8 -*- # 2021/10/29 # create by: snower class Parser(object): def __init__(self, content): self.content = content def parse(self): raise NotImplementedError
class Parser(object): def __init__(self, content): self.content = content def parse(self): raise NotImplementedError
class GreatClass: def __init__(self, x): self.x = x def do_stuff(self): pass class LilGreatClass: def __init__(self, things, stuff): self.things = things self.stuff = stuff
class Greatclass: def __init__(self, x): self.x = x def do_stuff(self): pass class Lilgreatclass: def __init__(self, things, stuff): self.things = things self.stuff = stuff
# Grid elements STRUCT = 0 P1 = 1 P2 = 2 WALL = 3 HOLE = 4 # Timeout (in ms) ROUND_TIMEOUT = 6000.0 GLOBAL_TIMEOUT = 60000.0 # Gauges state and speed # Gauge state is in gauge units GAUGE_STATE_INIT = 65535 # Gauges speed are in gauge units per milliseconds ROUND_GAUGE_SPEED_INIT = GAUGE_STATE_INIT/R...
struct = 0 p1 = 1 p2 = 2 wall = 3 hole = 4 round_timeout = 6000.0 global_timeout = 60000.0 gauge_state_init = 65535 round_gauge_speed_init = GAUGE_STATE_INIT / ROUND_TIMEOUT global_gauge_speed = GAUGE_STATE_INIT / GLOBAL_TIMEOUT m = 15 n = 6 tap_left = 2001 tap_right = 2002 two_finger_swipe = 2003 hide_struct = 2004
# A simple User model for logging in/registering # Created by: Mark Mott class User: # A single underline denotes a private method/variable. # Default is a Guest user def __init__(self, username='Guest', password='guest', permission=0): print(username) self.username = username self.p...
class User: def __init__(self, username='Guest', password='guest', permission=0): print(username) self.username = username self.password = password self.permission = permission def setusername(self, username): self.username = username def getusername(self): ...
#!/usr/bin/python # -*- coding: utf-8 -*- # created: 2015-04-15 class WebConst(object): ROUTER_PARAM_PATH = '_http_router_url' ROUTER_PARAM_OPT = '_http_router_opt' ROUTER_PARAM_VIEW_FUNC_PARAMS = '_http_router_view_params' ROUTER_VIEW_FUNC_KWS_REQUEST = 'request' ROUTER_VIEW_FUNC_KWS_METHOD = 'm...
class Webconst(object): router_param_path = '_http_router_url' router_param_opt = '_http_router_opt' router_param_view_func_params = '_http_router_view_params' router_view_func_kws_request = 'request' router_view_func_kws_method = 'method' request_method_get = 'GET' request_method_post = 'PO...
def cgi_content(type="text/html"): return('Content type: ' + type + '\n\n') def webpage_start(): return('<html>') def web_title(title): return('<head><title>' + title + '</title></head>') def body_start(h1_message): return('<h1 align="center">' + h1_message + '</h1><p align="center">') def body_end(): return("...
def cgi_content(type='text/html'): return 'Content type: ' + type + '\n\n' def webpage_start(): return '<html>' def web_title(title): return '<head><title>' + title + '</title></head>' def body_start(h1_message): return '<h1 align="center">' + h1_message + '</h1><p align="center">' def body_end(): ...
class GTDException(Exception): '''single parameter indicates exit code for the interpreter, because this exception typically results in a return of control to the terminal''' def __init__(self, errno): self.errno = errno
class Gtdexception(Exception): """single parameter indicates exit code for the interpreter, because this exception typically results in a return of control to the terminal""" def __init__(self, errno): self.errno = errno
class ExcalValueError(ValueError): pass class ExcalFileExistsError(FileExistsError): pass
class Excalvalueerror(ValueError): pass class Excalfileexistserror(FileExistsError): pass
my_family = { 'wife': { 'name': 'Julia', 'age': 32 }, 'daughter': { 'name': 'Aurelia', 'age': 2 }, 'son': { 'name': 'Lazarus', 'age': .5 }, 'father': { 'name': 'Rodney', 'age': 62 } } # use a dictionary comprehension to produce output that looks like this: # Krista is my siste...
my_family = {'wife': {'name': 'Julia', 'age': 32}, 'daughter': {'name': 'Aurelia', 'age': 2}, 'son': {'name': 'Lazarus', 'age': 0.5}, 'father': {'name': 'Rodney', 'age': 62}} for (relationship, information) in my_family.items(): family_member = relationship name = information['name'] age = information['age'...
fieldname_list = [ "file_name", "file_path", "v_format", "v_info", "v_profile", "v_settings", "v_settings_cabac", "v_settings_reframes", "v_format_settings_gop", "v_codec_id", "v_codec_id_info", "v_duration", "v_bit_rate_mode", "v_bit_rate", "v_max_bit_rate", ...
fieldname_list = ['file_name', 'file_path', 'v_format', 'v_info', 'v_profile', 'v_settings', 'v_settings_cabac', 'v_settings_reframes', 'v_format_settings_gop', 'v_codec_id', 'v_codec_id_info', 'v_duration', 'v_bit_rate_mode', 'v_bit_rate', 'v_max_bit_rate', 'v_frame_rate', 'v_frame_rate_mode', 'v_width', 'v_height', '...
#binary search class BinarySearch: def __init__(self): self.elements = [10,12,15,18,19,22,27,32,38] def SearchElm(self,elem): start = 0 stop = len(self.elements)-1 while start <= stop: mid_point = start + (stop - start) if self.elements[mid_point] == ...
class Binarysearch: def __init__(self): self.elements = [10, 12, 15, 18, 19, 22, 27, 32, 38] def search_elm(self, elem): start = 0 stop = len(self.elements) - 1 while start <= stop: mid_point = start + (stop - start) if self.elements[mid_point] == elem: ...
''' This problem was asked by Facebook. Given a string of round, curly, and square open and closing brackets, return whether the brackets are balanced (well-formed). For example, given the string "([])[]({})", you should return true. Given the string "([)]" or "((()", you should return false. ''' bracket_vocab = {...
""" This problem was asked by Facebook. Given a string of round, curly, and square open and closing brackets, return whether the brackets are balanced (well-formed). For example, given the string "([])[]({})", you should return true. Given the string "([)]" or "((()", you should return false. """ bracket_vocab = {'(...
# Write a program that repeatedly prompts a user for integer numbers until the user enters 'done'. # Once 'done' is entered, print out the largest and smallest of the numbers. # If the user enters anything other than a valid number catch it with a try/except and put out an appropriate message and ignore the number. ...
ps = None tss = None while True: new = input('Enter any number') if new == 'done': break try: new = int(new) except: print('Invalid input') continue if ps == None or ps > new: ps = new if tss == None or tss < new: tss = new print('Maximum is', tss)...
# Can you find the needle in the haystack? # Write a function findNeedle() that takes an array full of junk but containing one "needle" # After your function finds the needle it should return a message (as a string) that says: # "found the needle at position " plus the index it found the needle, so: # Python, Ruby ...
def find_needle(haystack): for el in haystack: if el == 'needle': return 'found the needle at position ' + str(haystack.index(el)) print(find_needle([1, 2, 3, 4, 'needle']))
# # @lc app=leetcode id=859 lang=python3 # # [859] Buddy Strings # # @lc code=start class Solution: def buddyStrings(self, A: str, B: str) -> bool: if len(A) <= 1 or len(B) <= 1 or len(A) != len(B): return False if A == B: return len(set(A)) < len(A) i = 0 wh...
class Solution: def buddy_strings(self, A: str, B: str) -> bool: if len(A) <= 1 or len(B) <= 1 or len(A) != len(B): return False if A == B: return len(set(A)) < len(A) i = 0 while A[i] == B[i]: i += 1 for j in range(i + 1, len(A)): ...
# # @lc app=leetcode.cn id=114 lang=python3 # # [114] flatten-binary-tree-to-linked-list # None # @lc code=end
None
def get_counter_and_increment(filename="counter.dat"): with open(filename, "a+") as f: f.seek(0) val = int(f.read() or 0) + 1 f.seek(0) f.truncate() f.write(str(val)) return val def get_counter(filename="counter.dat"): with open(filename, "a+") as f: f....
def get_counter_and_increment(filename='counter.dat'): with open(filename, 'a+') as f: f.seek(0) val = int(f.read() or 0) + 1 f.seek(0) f.truncate() f.write(str(val)) return val def get_counter(filename='counter.dat'): with open(filename, 'a+') as f: f.se...
# # Keys under which options are stored. OPTIONS_UNKNOWN = 0 OPTIONS_FILE_OUTPUT = 1 OPTIONS_CPU = 2 OPTIONS_STANDARD = 3 # General options that belong to no specific collection. OPTION_UNKNOWN = 0 OPTION_DISABLE_OPTIMISATIONS = 1 OPTION_DEFAULT_FILE_NAME = 2 # CPU optons. CPU_UNKNOWN = 0 CPU_MC60000 = 1 CPU_MC60010...
options_unknown = 0 options_file_output = 1 options_cpu = 2 options_standard = 3 option_unknown = 0 option_disable_optimisations = 1 option_default_file_name = 2 cpu_unknown = 0 cpu_mc60000 = 1 cpu_mc60010 = 2 cpu_mc60020 = 3 cpu_mc60030 = 4 cpu_mc60040 = 5 cpu_mc60060 = 7 def get_cpu_name_by_id(cpu_id): for (k, v...
class seq: def __init__(self, strbases): self.strbases = strbases def len(self): return len(self.strbases) def complement(self): comp = '' for e in self.strbases: if e == 'A': comp += 'T' elif e == 'C': comp += 'G' ...
class Seq: def __init__(self, strbases): self.strbases = strbases def len(self): return len(self.strbases) def complement(self): comp = '' for e in self.strbases: if e == 'A': comp += 'T' elif e == 'C': comp += 'G' ...
class Solution: def dominantIndex(self, nums: List[int]) -> int: max_num = max(nums) for i in nums: if i != max_num and max_num < 2*i: return -1 return nums.index(max_num)
class Solution: def dominant_index(self, nums: List[int]) -> int: max_num = max(nums) for i in nums: if i != max_num and max_num < 2 * i: return -1 return nums.index(max_num)
# Program to print first n tribonacci # numbers Matrix Multiplication # function for 3*3 matrix def multiply(T, M): a = (T[0][0] * M[0][0] + T[0][1] * M[1][0] + T[0][2] * M[2][0]) b = (T[0][0] * M[0][1] + T[0][1] * M[1][1] + T[0][2] * M[2][1]) c = (T[0][0] * M[0][2] + T[0...
def multiply(T, M): a = T[0][0] * M[0][0] + T[0][1] * M[1][0] + T[0][2] * M[2][0] b = T[0][0] * M[0][1] + T[0][1] * M[1][1] + T[0][2] * M[2][1] c = T[0][0] * M[0][2] + T[0][1] * M[1][2] + T[0][2] * M[2][2] d = T[1][0] * M[0][0] + T[1][1] * M[1][0] + T[1][2] * M[2][0] e = T[1][0] * M[0][1] + T[1][1] ...
''' Problem 5. Write a program that finds out whether a given name is present in a list or not.''' # Name search genrator using the Python names = ["Vasudev","Ridhi","hritik","Hanuman", "Gaurav"] name = input("Enter the Name : ") if name in names: print("Your name is in the list") else: print("Your name is ...
""" Problem 5. Write a program that finds out whether a given name is present in a list or not.""" names = ['Vasudev', 'Ridhi', 'hritik', 'Hanuman', 'Gaurav'] name = input('Enter the Name : ') if name in names: print('Your name is in the list') else: print('Your name is not in the list')
FLAG_OK = 0 FLAG_WARNING = 1 FLAG_ERROR = 2 FLAG_UNKNOWN = 3 FLAG_OK_STR = "OK" FLAG_WARNING_STR = "WARNING" FLAG_ERROR_STR = "ERROR" FLAG_UNKNOWN_STR = "UNKNOWN" FLAG_MAP = { FLAG_OK_STR: FLAG_OK, FLAG_WARNING_STR: FLAG_WARNING, FLAG_ERROR_STR: FLAG_ERROR, FLAG_UNKNOWN_STR: FLAG_UNKNOWN, }
flag_ok = 0 flag_warning = 1 flag_error = 2 flag_unknown = 3 flag_ok_str = 'OK' flag_warning_str = 'WARNING' flag_error_str = 'ERROR' flag_unknown_str = 'UNKNOWN' flag_map = {FLAG_OK_STR: FLAG_OK, FLAG_WARNING_STR: FLAG_WARNING, FLAG_ERROR_STR: FLAG_ERROR, FLAG_UNKNOWN_STR: FLAG_UNKNOWN}
kernel_weight = 0.03 bias_weight = 0.03 model_iris_l1 = models.Sequential([ layers.Input(shape = (4,)), layers.Dense(32, activation='relu', kernel_regularizer=regularizers.l1(kernel_weight), bias_regularizer=regularizers.l2(bias_weight)), layers.Dense(32, activation='relu', kernel_regularizer=regularizers.l1(kern...
kernel_weight = 0.03 bias_weight = 0.03 model_iris_l1 = models.Sequential([layers.Input(shape=(4,)), layers.Dense(32, activation='relu', kernel_regularizer=regularizers.l1(kernel_weight), bias_regularizer=regularizers.l2(bias_weight)), layers.Dense(32, activation='relu', kernel_regularizer=regularizers.l1(kernel_weight...
DEBUG = False # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '{{ secret_key }}' ALLOWED_HOSTS = ['{{ host }}'] DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': '{{ database_name }}', 'USER': '{{ database_user }}', 'PASS...
debug = False secret_key = '{{ secret_key }}' allowed_hosts = ['{{ host }}'] databases = {'default': {'ENGINE': 'django.db.backends.postgresql', 'NAME': '{{ database_name }}', 'USER': '{{ database_user }}', 'PASSWORD': '{{ database_password }}', 'HOST': '{{ database_host }}', 'PORT': '{{database_port }}', 'CONN_MAX_AGE...
class ParkingSystem: def __init__(self, big: int, medium: int, small: int): self.bigSize, self.bigCount, self.mediumSize, self.mediumCount, self.smallSize, self.smallCount = big, 0, medium, 0, small, 0 def addCar(self, carType: int) -> bool: if carType == 1: if self.bigCount < self...
class Parkingsystem: def __init__(self, big: int, medium: int, small: int): (self.bigSize, self.bigCount, self.mediumSize, self.mediumCount, self.smallSize, self.smallCount) = (big, 0, medium, 0, small, 0) def add_car(self, carType: int) -> bool: if carType == 1: if self.bigCount <...
# # PySNMP MIB module CISCO-IMAGE-TC (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-IMAGE-TC # Produced by pysmi-0.3.4 at Mon Apr 29 17:39:18 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection, constraints_union) ...
class DisjointSet: def __init__(self, n, data): self.graph = data self.n = n self.parent = [i for i in range(self.n)] self.rank = [1] * self.n def find_parent(self, x): if self.parent[x] != x: self.parent[x] = self.find_parent(self.parent[x]) return s...
class Disjointset: def __init__(self, n, data): self.graph = data self.n = n self.parent = [i for i in range(self.n)] self.rank = [1] * self.n def find_parent(self, x): if self.parent[x] != x: self.parent[x] = self.find_parent(self.parent[x]) return ...
# coding: utf-8 DEFAULT_USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) ' \ 'Chrome/55.0.2883.95 Safari/537.36 ' DATA_FOLDER = "data"
default_user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36 ' data_folder = 'data'
def my_decorator(func): def wrapper(): print("before the function is called.") func() print("after the function is called.") return wrapper @my_decorator def say_hi_HTA_with_syntax(): print("Hi! HTA with_syntax") def say_hi_HTA_without_syntax(): print('Hi! HTA without_syntax') ...
def my_decorator(func): def wrapper(): print('before the function is called.') func() print('after the function is called.') return wrapper @my_decorator def say_hi_hta_with_syntax(): print('Hi! HTA with_syntax') def say_hi_hta_without_syntax(): print('Hi! HTA without_syntax')...
N = int(input()) XL = [list(map(int, input().split())) for _ in range(N)] t = [(x + l, x - l) for x, l in XL] t.sort() max_r = -float('inf') result = 0 for i in range(N): r, l = t[i] if max_r <= l: result += 1 max_r = r print(result)
n = int(input()) xl = [list(map(int, input().split())) for _ in range(N)] t = [(x + l, x - l) for (x, l) in XL] t.sort() max_r = -float('inf') result = 0 for i in range(N): (r, l) = t[i] if max_r <= l: result += 1 max_r = r print(result)
def solution(xs): maxp = 1 negs = [] for i in xs: if i < 0: negs.append(i) elif i > 1: maxp *= i if len(negs) < 2 and max(xs) < 2: return str(max(xs)) negs.sort() while len(negs) > 1: maxp *= negs.pop(0) * negs.pop(0) return str(maxp)
def solution(xs): maxp = 1 negs = [] for i in xs: if i < 0: negs.append(i) elif i > 1: maxp *= i if len(negs) < 2 and max(xs) < 2: return str(max(xs)) negs.sort() while len(negs) > 1: maxp *= negs.pop(0) * negs.pop(0) return str(maxp)
# Stairs # https://www.interviewbit.com/problems/stairs/ # # You are climbing a stair case. It takes n steps to reach to the top. # # Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? # # Example : # # Input : 3 # Return : 3 # # Steps : [1 1 1], [1 2], [2 1] # # # # # # # ...
class Solution: def climb_stairs(self, A): result = [0] * A if A < 2: return A (result[0], result[1]) = (1, 2) for i in range(2, A): result[i] = result[i - 1] + result[i - 2] return result[-1]
''' A Python program to add two objects if both objects are an integer type. ''' def areObjectsInteger (inputNum01, inputNum02): if not (isinstance(inputNum01, int) and isinstance(inputNum02, int)): return False return inputNum01 + inputNum02 def main (): a,b = [float(x) for x in input("Enter ...
""" A Python program to add two objects if both objects are an integer type. """ def are_objects_integer(inputNum01, inputNum02): if not (isinstance(inputNum01, int) and isinstance(inputNum02, int)): return False return inputNum01 + inputNum02 def main(): (a, b) = [float(x) for x in input('Enter t...
def next_line(line): res = [] prev = 0 nb = 0 for i in range(len(line)): if prev == 0: prev = line[i] nb = 1 else: if prev == line[i]: nb += 1 else: res.append(nb) res.append(prev) ...
def next_line(line): res = [] prev = 0 nb = 0 for i in range(len(line)): if prev == 0: prev = line[i] nb = 1 elif prev == line[i]: nb += 1 else: res.append(nb) res.append(prev) prev = line[i] nb =...
#!/usr/bin/env python name = 'Bob' age = 2002 if name == 'Alice': print('Hi, Alice!') elif age < 12: print('You are not Alice, kiddo!') elif age > 2000: print('Unlike you, Alice is not undead, immortal vampire.') elif age > 100: print('You are not Alice, grannie.')
name = 'Bob' age = 2002 if name == 'Alice': print('Hi, Alice!') elif age < 12: print('You are not Alice, kiddo!') elif age > 2000: print('Unlike you, Alice is not undead, immortal vampire.') elif age > 100: print('You are not Alice, grannie.')
# 1. CREATE A DICTIONARY # Remember, dictionaries are essentially objects. # Make a dictionary with five different keys relating to your favorite celebrity. You must include at least four different data types as values for those keys. # ================ CODE HERE ================ # ================ END CODE ========...
fruits = ['apple', 'banana', 'strawberry', 'orange', 'grape'] count = 1
#!/usr/bin/python with open('README.md', 'w') as README: with open('docs/list_of__modules.rst', 'r') as index: README.write(''' # Cisco ACI modules for Ansible This project is working on upstreaming Cisco ACI support within the Ansible project. We currently have 30+ modules available, and many more are b...
with open('README.md', 'w') as readme: with open('docs/list_of__modules.rst', 'r') as index: README.write('\n# Cisco ACI modules for Ansible\n\nThis project is working on upstreaming Cisco ACI support within the Ansible project.\nWe currently have 30+ modules available, and many more are being added.\n\n\n#...
# Generated from 'Events.h' nullEvent = 0 mouseDown = 1 mouseUp = 2 keyDown = 3 keyUp = 4 autoKey = 5 updateEvt = 6 diskEvt = 7 activateEvt = 8 osEvt = 15 kHighLevelEvent = 23 mDownMask = 1 << mouseDown mUpMask = 1 << mouseUp keyDownMask = 1 << keyDown keyUpMask = 1 << keyUp autoKeyMask = 1 << autoKey updateMask = 1 <...
null_event = 0 mouse_down = 1 mouse_up = 2 key_down = 3 key_up = 4 auto_key = 5 update_evt = 6 disk_evt = 7 activate_evt = 8 os_evt = 15 k_high_level_event = 23 m_down_mask = 1 << mouseDown m_up_mask = 1 << mouseUp key_down_mask = 1 << keyDown key_up_mask = 1 << keyUp auto_key_mask = 1 << autoKey update_mask = 1 << upd...
SOLUTIONS = '/view' STATUS = '/status' DOWNLOADS = '/download' SHARED = '/shared' GIT = '/git/<int:course_id>/<int:exercise_number>.git'
solutions = '/view' status = '/status' downloads = '/download' shared = '/shared' git = '/git/<int:course_id>/<int:exercise_number>.git'
# GATES OGORK # SPRING 2021 FINAL PROJECT # IS 3220 # PASSWORD GENERATOR # MAY 2, 2021 def reverse(app_name): # this function reverses whatever word the user inputs app_name = app_name.lower() return app_name[::-1] def a_replace(name): # this function replaces every "a" with "@" ret...
def reverse(app_name): app_name = app_name.lower() return app_name[::-1] def a_replace(name): return name.replace('a', '@') def o_replace(name): return name.replace('o', '0') def fifth_replace(name): name = list(name) name[4] = '#' name = ''.join(name) return name def duplicate(name)...
# Copyright (c) 2017-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
def cityscapes_to_coco(cityscapes_id): lookup = {0: 0, 1: 2, 2: 3, 3: 1, 4: 7, 5: 8, 6: 4, 7: 6, 8: -1} return lookup[cityscapes_id] def cityscapes_to_coco_with_rider(cityscapes_id): lookup = {0: 0, 1: 2, 2: 3, 3: 1, 4: 7, 5: 8, 6: 4, 7: 6, 8: 1} return lookup[cityscapes_id] def cityscapes_to_coco_wit...
__author__ = 'roland' NORMAL = "/_/_/_/normal" IDMAP = { # Webfinger "rp-discovery-webfinger-url": NORMAL, "rp-discovery-webfinger-acct": NORMAL, 'rp-discovery-webfinger-http-href': '/_/_/httphref/normal', 'rp-discovery-webfinger-unknown-member': '/_/_/wfunknown/normal', # Discovery "rp-di...
__author__ = 'roland' normal = '/_/_/_/normal' idmap = {'rp-discovery-webfinger-url': NORMAL, 'rp-discovery-webfinger-acct': NORMAL, 'rp-discovery-webfinger-http-href': '/_/_/httphref/normal', 'rp-discovery-webfinger-unknown-member': '/_/_/wfunknown/normal', 'rp-discovery-openid-configuration': NORMAL, 'rp-discovery-jw...
lista = ['A', 'B', 'C'] for i, itens in enumerate(lista): print (i + 1, ' = ', itens) lista[-1] = 'D' lista[-2] = 'F' lista[-3] = 'M' for e, itens in enumerate(lista): print (e + 1, ' -> ', itens) lista.remove('F') for d, itens in enumerate(lista): print(d + 1, ' == ', itens) lista.extend(['B', 'C', 'A']) l...
lista = ['A', 'B', 'C'] for (i, itens) in enumerate(lista): print(i + 1, ' = ', itens) lista[-1] = 'D' lista[-2] = 'F' lista[-3] = 'M' for (e, itens) in enumerate(lista): print(e + 1, ' -> ', itens) lista.remove('F') for (d, itens) in enumerate(lista): print(d + 1, ' == ', itens) lista.extend(['B', 'C', 'A'...
class Register: def __init__(self, id): self.id = id regs = [Register(i) for i in range(16)] RG0, RG1, RG2, RG3, RG4, RG5, RG6, RG7, RG8, RG9, RG10, RG11, RG12, RG13, RIP, RBANK = regs
class Register: def __init__(self, id): self.id = id regs = [register(i) for i in range(16)] (rg0, rg1, rg2, rg3, rg4, rg5, rg6, rg7, rg8, rg9, rg10, rg11, rg12, rg13, rip, rbank) = regs
oscar_number = int(input()) message = '' if oscar_number == 88: message = 'Leo finally won the Oscar! Leo is happy' elif oscar_number == 86: message = 'Not even for Wolf of Wall Street?!' elif oscar_number < 88 and oscar_number != 86: message = 'When will you give Leo an Oscar?' elif oscar_number ...
oscar_number = int(input()) message = '' if oscar_number == 88: message = 'Leo finally won the Oscar! Leo is happy' elif oscar_number == 86: message = 'Not even for Wolf of Wall Street?!' elif oscar_number < 88 and oscar_number != 86: message = 'When will you give Leo an Oscar?' elif oscar_number > 88: ...
test_cases = int(input().strip()) for t in range(1, test_cases + 1): N, M = map(int, input().strip().split()) binary = bin(M)[2:].zfill(N)[-N:] result = 'ON' if '0' in binary: result = 'OFF' print('#{} {}'.format(t, result))
test_cases = int(input().strip()) for t in range(1, test_cases + 1): (n, m) = map(int, input().strip().split()) binary = bin(M)[2:].zfill(N)[-N:] result = 'ON' if '0' in binary: result = 'OFF' print('#{} {}'.format(t, result))
# # Project Euler Math Functions # Soren Rasmussen 5/14/2015 # #!/usr/bin/python def sieveOfEratosthenes(n): primes = [0]*n output = [] for i in range(2,n): if primes[i] == 0: output.append(i) j=2*i while j < n: primes[j] = 1 ...
def sieve_of_eratosthenes(n): primes = [0] * n output = [] for i in range(2, n): if primes[i] == 0: output.append(i) j = 2 * i while j < n: primes[j] = 1 j += i return output
a=int(input()) b=int(input()) c=int(input()) d=int(input()) print((a^b)&(c|d)^((b&c)|(a^d)))
a = int(input()) b = int(input()) c = int(input()) d = int(input()) print((a ^ b) & (c | d) ^ (b & c | a ^ d))
def map(nums_list, operation): ''' Return a sequence of values obtained by applying the operation function to each number in nums_list. ''' return [operation(num) for num in nums_list] def double(num): return num * 2 def triple(num): return num * 3 nums_list = (1, 3, -10) for operation in (doubl...
def map(nums_list, operation): """ Return a sequence of values obtained by applying the operation function to each number in nums_list. """ return [operation(num) for num in nums_list] def double(num): return num * 2 def triple(num): return num * 3 nums_list = (1, 3, -10) for operation in (double,...
# -*- coding: utf-8 -*- if __name__ == '__main__': crawl_name = 'maomi_china_selfie' cmd = 'scrapy crawl {0}'.format(crawl_name) # cmdline.execute(['scrapy','crawl','csgbidding']) cmdline.execute(cmd.split())
if __name__ == '__main__': crawl_name = 'maomi_china_selfie' cmd = 'scrapy crawl {0}'.format(crawl_name) cmdline.execute(cmd.split())
class TestApplication: # Will the application start? def test_start(self, application): application.start()
class Testapplication: def test_start(self, application): application.start()
class ProviderException(Exception): pass class NoProviderException(ProviderException): def __init__(self, hostname) -> None: self.hostname = hostname def __str__(self) -> str: return "No provider for {0}".format(self.hostname)
class Providerexception(Exception): pass class Noproviderexception(ProviderException): def __init__(self, hostname) -> None: self.hostname = hostname def __str__(self) -> str: return 'No provider for {0}'.format(self.hostname)
#!/usr/bin/env python NAME = 'Alert Logic (Alert Logic)' def is_waf(self): for attack in self.attacks: r = attack(self) if r is None: return _, page = r if all(i in page for i in (b'<title>Requested URL cannot be found</title>', b'Proceed to homepage', ...
name = 'Alert Logic (Alert Logic)' def is_waf(self): for attack in self.attacks: r = attack(self) if r is None: return (_, page) = r if all((i in page for i in (b'<title>Requested URL cannot be found</title>', b'Proceed to homepage', b'Back to previous page', b'We are so...
str = "This is string example" print("Reversed string is: "+str[::-1]) ss = str.split(" ") print("Reversed words are: "+ss[0][::-1]+" "+ss[1][::-1]+" "+ss[2][::-1]+" "+ss[3][::-1]) print("Reversed letters are: "+ss[0][0:2][::-1]) print("*".join(ss)) print("Replaced by was is: "+ss[0]+" "+ss[1].replace("is","was")+...
str = 'This is string example' print('Reversed string is: ' + str[::-1]) ss = str.split(' ') print('Reversed words are: ' + ss[0][::-1] + ' ' + ss[1][::-1] + ' ' + ss[2][::-1] + ' ' + ss[3][::-1]) print('Reversed letters are: ' + ss[0][0:2][::-1]) print('*'.join(ss)) print('Replaced by was is: ' + ss[0] + ' ' + ss[1].r...
class Solution: def lengthOfLastWord(self, s): s=s.split() if len(s)==0: return 0 return len(s[-1])
class Solution: def length_of_last_word(self, s): s = s.split() if len(s) == 0: return 0 return len(s[-1])
schema = { 'user': [ { 'mail_id': 'string', 'patient': [ { 'name': 'string', 'mob': 9929929922, 'address': 'string', 'stats': {...}, }, {...} ], 're...
schema = {'user': [{'mail_id': 'string', 'patient': [{'name': 'string', 'mob': 9929929922, 'address': 'string', 'stats': {...}}, {...}], 'reports': {'heart': [{'patient_id': 932003, 'time': 'datetime', 'stats': {}}, {...}], 'diabetes': [{'patient_id': 392, 'time': 'datetime'}]}}, {...}], 'suggestions': {'heart': ['poin...
# parsetab.py # This file is automatically generated. Do not edit. _tabversion = '3.2' _lr_method = 'LALR' _lr_signature = '\xcc\xb5(e\x9f\xabO\r,\xe6J\x922\x85M\xb7' _lr_action_items = {'LOGOR':([6,11,12,17,20,21,22,28,32,33,35,47,48,49,50,51,80,81,88,89,92,100,101,102,103,104,105,106,107,108,109,110,111,112,1...
_tabversion = '3.2' _lr_method = 'LALR' _lr_signature = '̵(e\x9f«O\r,æJ\x922\x85M·' _lr_action_items = {'LOGOR': ([6, 11, 12, 17, 20, 21, 22, 28, 32, 33, 35, 47, 48, 49, 50, 51, 80, 81, 88, 89, 92, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 118, 122, 124, 129, 132, 135, 136], ...
class JobResultExample(object): IN_PROGRESS = { "status": { "state": "IN PROGRESS" }, "configuration": { "copy": { "sourceTable": { "projectId": "source_project_id", "tableId": "source_table_id$123", ...
class Jobresultexample(object): in_progress = {'status': {'state': 'IN PROGRESS'}, 'configuration': {'copy': {'sourceTable': {'projectId': 'source_project_id', 'tableId': 'source_table_id$123', 'datasetId': 'source_dataset_id'}, 'destinationTable': {'projectId': 'target_project_id', 'tableId': 'target_table_id', 'd...
mongo = { 'server': '127.0.0.1', 'database': 'geodigger', 'collection': 'data', } email = { 'server': '', 'username': '', 'address': '', 'password': '', } ui = { 'tmp': '/tmp/geodiggerui', }
mongo = {'server': '127.0.0.1', 'database': 'geodigger', 'collection': 'data'} email = {'server': '', 'username': '', 'address': '', 'password': ''} ui = {'tmp': '/tmp/geodiggerui'}
#Conditions sur les nombres pairs et impairs a = int(input("saisir nombre : ")) if a%2 == 0: print("le nombre est pair") else: print("le nombre est impair")
a = int(input('saisir nombre : ')) if a % 2 == 0: print('le nombre est pair') else: print('le nombre est impair')
myBag = 'shiny gold' rules = [] midBags = set() midBags.add(myBag) #i've the feeling that never attended an algo class is making this too much fucking difficult #pradella i'm ready def part2(string): numberTemp = 1 if string == myBag: numberTemp = 0 for line in rules: outerBag, innerBags = line.spl...
my_bag = 'shiny gold' rules = [] mid_bags = set() midBags.add(myBag) def part2(string): number_temp = 1 if string == myBag: number_temp = 0 for line in rules: (outer_bag, inner_bags) = line.split(' bags contain ') inner_bags = innerBags.replace(', ', '.').replace('bags', '').replace...
s = input() a = 2 b = a + a x = 1 y = x print(y) if not ((s)): print('bar')
s = input() a = 2 b = a + a x = 1 y = x print(y) if not s: print('bar')
# coding:utf-8 ''' @Copyright:LintCode @Author: lilsweetcaligula @Problem: http://www.lintcode.com/problem/reverse-words-in-a-string @Language: Python @Datetime: 17-02-15 15:03 ''' class Solution: # @param s : A string # @return : A string def reverseWords(self, s): return ' '.join(reversed(s.sp...
""" @Copyright:LintCode @Author: lilsweetcaligula @Problem: http://www.lintcode.com/problem/reverse-words-in-a-string @Language: Python @Datetime: 17-02-15 15:03 """ class Solution: def reverse_words(self, s): return ' '.join(reversed(s.split()))
dict={11:"th",12:"th",13:"th",1:"st",2:"nd",3:"rd"} def number_to_ordinal(n): if n>10: check=int(str(n)[-2:]) temp=dict.get(check%10, "th") return f"{n}{dict[check]}" if check in dict else f"{n}{temp}" else: temp=dict.get(n%10, "th") return f"{n}{temp}" if n else "0"
dict = {11: 'th', 12: 'th', 13: 'th', 1: 'st', 2: 'nd', 3: 'rd'} def number_to_ordinal(n): if n > 10: check = int(str(n)[-2:]) temp = dict.get(check % 10, 'th') return f'{n}{dict[check]}' if check in dict else f'{n}{temp}' else: temp = dict.get(n % 10, 'th') return f'{n}...
#quiz game def check_guess(guess, answer): global score still_guessing = True attempt = 0 while still_guessing and attempt < 3: if guess.lower() == answer.lower(): print("Correct Answer") score = score + 1 still_guessing = False else: if a...
def check_guess(guess, answer): global score still_guessing = True attempt = 0 while still_guessing and attempt < 3: if guess.lower() == answer.lower(): print('Correct Answer') score = score + 1 still_guessing = False else: if attempt < 2: ...
# # PySNMP MIB module HIPATH-WIRELESS-HWC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HIPATH-WIRELESS-HWC-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:30:43 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, value_size_constraint, value_range_constraint, single_value_constraint) ...
ans = [] while True: a, b = list(map(int, input().split())) if a == 0 and b == 0: break ans.append(a + b) for a in ans: print(a)
ans = [] while True: (a, b) = list(map(int, input().split())) if a == 0 and b == 0: break ans.append(a + b) for a in ans: print(a)
# -*- coding: utf-8 -*- major = 0 minor = 0 patch = 1 semantic = '{}.{}.{}'.format(major, minor, patch)
major = 0 minor = 0 patch = 1 semantic = '{}.{}.{}'.format(major, minor, patch)
#Ermittle alle denkbaren Sequenzen mit den vier Basenpaaren AT, TA, CG, GC paare="AT","TA","CG","GC" for a in paare: for b in paare: for c in paare: for d in paare: print(a+b+c+d,end=" ")
paare = ('AT', 'TA', 'CG', 'GC') for a in paare: for b in paare: for c in paare: for d in paare: print(a + b + c + d, end=' ')
class QuotaExceptionExceeded(Exception): pass class QuotaMaxSimultaneousExceeded(QuotaExceptionExceeded): pass class QuotaCpuExceeded(QuotaExceptionExceeded): pass class QuotaMemoryExceeded(QuotaExceptionExceeded): pass class QuotaHddExceeded(QuotaExceptionExceeded): pass class ResourceAlr...
class Quotaexceptionexceeded(Exception): pass class Quotamaxsimultaneousexceeded(QuotaExceptionExceeded): pass class Quotacpuexceeded(QuotaExceptionExceeded): pass class Quotamemoryexceeded(QuotaExceptionExceeded): pass class Quotahddexceeded(QuotaExceptionExceeded): pass class Resourcealreadyl...
class QueryReader: def __init__(self, delim="\t"): self.delim = delim def __call__(self, query_path, include_relevancy=False): with open(query_path, "r") as fp: for line in fp: if include_relevancy == True: line = line.st...
class Queryreader: def __init__(self, delim='\t'): self.delim = delim def __call__(self, query_path, include_relevancy=False): with open(query_path, 'r') as fp: for line in fp: if include_relevancy == True: line = line.strip() ...
def gangs(divisors,k): res=set() for i in range(1, k+1): res.add(helper(divisors, i)) return len(res) def helper(divisors, n): res=tuple() for i in divisors: if n%i==0: res+=(i, ) return res
def gangs(divisors, k): res = set() for i in range(1, k + 1): res.add(helper(divisors, i)) return len(res) def helper(divisors, n): res = tuple() for i in divisors: if n % i == 0: res += (i,) return res
#!/usr/bin/env python3 # ***************************************** # PiFire Display Prototype Interface Library # ***************************************** # # Description: This library simulates a display. # # ***************************************** # ***************************************** # Imported Libraries ...
class Display: def __init__(self): self.DisplaySplash() def display_status(self, in_data, status_data): print('====[Display]=====') print('* Grill Temp: ' + str(in_data['GrillTemp'])[:5] + 'F') print('* Grill SetPoint: ' + str(in_data['GrillSetPoint']) + 'F') print('* P...
# 4-6. Odd Numbers odd_numbers = list(range(1,21,2)) print(odd_numbers)
odd_numbers = list(range(1, 21, 2)) print(odd_numbers)
def proCategorization(pros, preferences): pref_dict = {} for i in range(len(pros)): name = pros[i] prefs = preferences[i] for j in range(len(prefs)): p = prefs[j] if p not in pref_dict: pref_dict[p] = [name] else: pr...
def pro_categorization(pros, preferences): pref_dict = {} for i in range(len(pros)): name = pros[i] prefs = preferences[i] for j in range(len(prefs)): p = prefs[j] if p not in pref_dict: pref_dict[p] = [name] else: pref_...
def app(): # pragma: no cover return None def returns_app(): # pragma: no cover return app
def app(): return None def returns_app(): return app
def test_success(): assert True def add_and_del(startnum, addnum, delnum): return startnum + addnum - delnum
def test_success(): assert True def add_and_del(startnum, addnum, delnum): return startnum + addnum - delnum
# dp + recursion (top to down) # Runtime: 688 ms, faster than 26.38% of Python3 online submissions for Burst Balloons. # Memory Usage: 13.6 MB, less than 55.82% of Python3 online submissions for Burst Balloons. class Solution: def maxCoins(self, nums: List[int]) -> int: nums = [1] + nums + [1] n = l...
class Solution: def max_coins(self, nums: List[int]) -> int: nums = [1] + nums + [1] n = len(nums) dp = [[0 for _ in range(n)] for _ in range(n)] def calculate(nums, dp, left, right): if dp[left][right] or right == left + 1: return dp[left][right] ...
class Solution(object): def repeatedSubstringPattern(self, s): for l in range(1, len(s)//2+1): if len(s)%l == 0: str_sub = s[:l] n = len(s)//l if str_sub * n == s: return True return False print(Solution().repeatedSubs...
class Solution(object): def repeated_substring_pattern(self, s): for l in range(1, len(s) // 2 + 1): if len(s) % l == 0: str_sub = s[:l] n = len(s) // l if str_sub * n == s: return True return False print(solution().rep...
# n = A.length # time = O(n) # space = O(n) # done time = 30m class Solution: def prefixesDivBy5(self, A: List[int]) -> List[bool]: num = 0 ret = [] for a in A: num = (num << 1) + a ret.append(num % 5 == 0) return ret
class Solution: def prefixes_div_by5(self, A: List[int]) -> List[bool]: num = 0 ret = [] for a in A: num = (num << 1) + a ret.append(num % 5 == 0) return ret
author_activate = ''' mutation { upsertAuthor(name: "Paulinna", author: { active: true }) { successful messages { field message } result { name active } } } ''' author_set_active = ''' mutation SetActive($active: Boolean!){ upsertAuthor(na...
author_activate = '\n mutation {\n upsertAuthor(name: "Paulinna", author: { active: true }) {\n successful\n messages {\n field\n message\n }\n result {\n name\n active\n }\n }\n }\n' author_set_active = '\n mutation SetActive($active: Boolean!){\n upsert...
class Solution: def minDistance(self, word1: str, word2: str) -> int: m, n = len(word1), len(word2) if m * n == 0: return max(m, n) dp = [[0] * (n + 1) for _ in range(m + 1)] for i in range(1, m + 1): dp[i][0] = i for i in range(1, n + 1): ...
class Solution: def min_distance(self, word1: str, word2: str) -> int: (m, n) = (len(word1), len(word2)) if m * n == 0: return max(m, n) dp = [[0] * (n + 1) for _ in range(m + 1)] for i in range(1, m + 1): dp[i][0] = i for i in range(1, n + 1): ...
''' SNMP Device Defines ''' BMCSTATUS = { 1: 'ok', 2: 'minor', 3: 'major', 4: 'critical', 5: 'absence', 6: 'unknown', } BMCPRESENCE = { 1: 'absence', 2: 'presence', 3: 'unknown', } BMCPCESTATUS = { 1: 'disable', 2: 'enable', } BMCPCFA = { 1: '...
""" SNMP Device Defines """ bmcstatus = {1: 'ok', 2: 'minor', 3: 'major', 4: 'critical', 5: 'absence', 6: 'unknown'} bmcpresence = {1: 'absence', 2: 'presence', 3: 'unknown'} bmcpcestatus = {1: 'disable', 2: 'enable'} bmcpcfa = {1: 'eventlog(1)', 2: 'eventlogAndPowerOff(2)'} bmcbootstr = {1: 'No override', 2: 'PXE', 3:...
def getData(): dataset = pd.read_csv('FUTURES MINUTE.txt', header = None) dataset.columns = ['Date','time',"1. open","2. high",'3. low','4. close','5. volume'] dataset['date'] = dataset['Date'] +" "+ dataset['time'] dataset.drop('Date', axis=1, inplace=True) dataset.drop('time', axis=1, inplace...
def get_data(): dataset = pd.read_csv('FUTURES MINUTE.txt', header=None) dataset.columns = ['Date', 'time', '1. open', '2. high', '3. low', '4. close', '5. volume'] dataset['date'] = dataset['Date'] + ' ' + dataset['time'] dataset.drop('Date', axis=1, inplace=True) dataset.drop('time', axis=1, inpla...
n = input() s = set(map(int, input().split())) q=int(input()) for x in range(q): t=input().split() try: if(t[0]=="pop"): s.pop() elif(t[0]=="remove"): s.remove(int(t[1])) else: s.discard(int(t[1])) except: continue print(sum(s))
n = input() s = set(map(int, input().split())) q = int(input()) for x in range(q): t = input().split() try: if t[0] == 'pop': s.pop() elif t[0] == 'remove': s.remove(int(t[1])) else: s.discard(int(t[1])) except: continue print(sum(s))
load("//scala:scala.bzl", "scala_test") def analyzer_tests_scala_2(): common_jvm_flags = [ "-Dplugin.jar.location=$(execpath //third_party/dependency_analyzer/src/main:dependency_analyzer)", "-Dscala.library.location=$(rootpath @io_bazel_rules_scala_scala_library)", "-Dscala.reflect.locatio...
load('//scala:scala.bzl', 'scala_test') def analyzer_tests_scala_2(): common_jvm_flags = ['-Dplugin.jar.location=$(execpath //third_party/dependency_analyzer/src/main:dependency_analyzer)', '-Dscala.library.location=$(rootpath @io_bazel_rules_scala_scala_library)', '-Dscala.reflect.location=$(rootpath @io_bazel_ru...
# This __about__.py file for storing project metadata is inspired by # - github.com/delph-in/pydelphin/blob/master/delphin/__about__.py # referencing (apud) # - github.com/pypa/warehouse/blob/master/warehouse/__about__.py __name__ = "Delphin RDF" __summary__ = "DELPH-IN formats in RDF" __version__ = "1.0.4" __aut...
__name__ = 'Delphin RDF' __summary__ = 'DELPH-IN formats in RDF' __version__ = '1.0.4' __author__ = 'foo' __email__ = 'foo' __url__ = 'foo' __license__ = 'MIT'
#### USEFUL FUNCTIONS FOR CLAUSES AND LITERALS #### # Return true if the clause is unit, false otherwise. def is_unit_clause(clause): return len(clause) == 1 # Return true if the clause is empty, false otherwise. def is_empty_clause(clause): return len(clause) == 0 # Return true if the literal is positive, fal...
def is_unit_clause(clause): return len(clause) == 1 def is_empty_clause(clause): return len(clause) == 0 def is_positive_literal(lit): return lit > 0 def lit_to_var(lit): return abs(lit) if __name__ == '__main__': (unused1, unused2, v, c) = input().split() v = int(V) c = int(C) lit_to...
if __name__ == "__main__": s = input() new_s = "" for i in range(len(s)-1, -1, -1): new_s += s[i] print(new_s) if s == new_s: print("haha got ya !") else: print("NOpe")
if __name__ == '__main__': s = input() new_s = '' for i in range(len(s) - 1, -1, -1): new_s += s[i] print(new_s) if s == new_s: print('haha got ya !') else: print('NOpe')
n = int(input()) total = [] for i in range(n): a = [int(item) for item in input().split()] temp = 0 for j in range(a[0]): temp +=a[j + 1] temp -= (a[0] - 1) total.append(temp) a = [] for i in total: print(i)
n = int(input()) total = [] for i in range(n): a = [int(item) for item in input().split()] temp = 0 for j in range(a[0]): temp += a[j + 1] temp -= a[0] - 1 total.append(temp) a = [] for i in total: print(i)