content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
var.nexus_allowAllDigitNames = True # put it somewhere else var.doCheckForDuplicateSequences = False t = var.trees[0] a = var.alignments[0] t.data = Data() t.model.dump() print('\nAfter optimizing, the composition of the model for the non-root nodes is:') print(t.model.parts[0].comps[0].val) print('...and:') prin...
var.nexus_allowAllDigitNames = True var.doCheckForDuplicateSequences = False t = var.trees[0] a = var.alignments[0] t.data = data() t.model.dump() print('\nAfter optimizing, the composition of the model for the non-root nodes is:') print(t.model.parts[0].comps[0].val) print('...and:') print(t.model.parts[0].comps[1].va...
# # PySNMP MIB module HUAWEI-DATASYNC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-DATASYNC-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:43:58 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, value_size_constraint, value_range_constraint, constraints_intersection) ...
def main(name="User", name2="Your Pal"): print(f"Hello, {name}! I am {name2}!") if __name__=="__main__": main()
def main(name='User', name2='Your Pal'): print(f'Hello, {name}! I am {name2}!') if __name__ == '__main__': main()
class PeekableIterator: def __init__(self, nums): self.nums = nums self.i = 0 def peek(self): return self.nums[self.i] def next(self): self.i += 1 return self.nums[self.i-1] def hasnext(self): return self.i < len(self.nums)
class Peekableiterator: def __init__(self, nums): self.nums = nums self.i = 0 def peek(self): return self.nums[self.i] def next(self): self.i += 1 return self.nums[self.i - 1] def hasnext(self): return self.i < len(self.nums)
_champernownes_constant = "" def _calculate_champernownes_nth_decimal(length): res = [] curr_length = 0 i = 1 while curr_length < length: res += [str(i)] curr_length += len(res[-1]) i += 1 return "".join(res) def champernownes_nth_decimal(n): global _champernownes_con...
_champernownes_constant = '' def _calculate_champernownes_nth_decimal(length): res = [] curr_length = 0 i = 1 while curr_length < length: res += [str(i)] curr_length += len(res[-1]) i += 1 return ''.join(res) def champernownes_nth_decimal(n): global _champernownes_const...
class Solution: solution = [] def inorderTraversal(self, root: TreeNode) -> List[int]: if (root == None): return self.solution = [] self.inorderHelper(root) return self.solution def inorderHelper(self, root: TreeNode): if (root == None): ...
class Solution: solution = [] def inorder_traversal(self, root: TreeNode) -> List[int]: if root == None: return self.solution = [] self.inorderHelper(root) return self.solution def inorder_helper(self, root: TreeNode): if root == None: return...
winClass = window.get_active_class() if winClass not in ("code.Code", "emacs.Emacs"): # Regular window keyboard.send_keys('<home>') else: # VS Code keyboard.send_keys('<alt>+a')
win_class = window.get_active_class() if winClass not in ('code.Code', 'emacs.Emacs'): keyboard.send_keys('<home>') else: keyboard.send_keys('<alt>+a')
# GYP project file for TDesktop { 'targets': [ { 'target_name': 'libtgvoip', 'type': 'static_library', 'dependencies': [], 'defines': [ 'WEBRTC_APM_DEBUG_DUMP=0', 'TGVOIP_USE_DESKTOP_DSP', 'WEBRTC_NS_FLOAT', ], 'variables': { ...
{'targets': [{'target_name': 'libtgvoip', 'type': 'static_library', 'dependencies': [], 'defines': ['WEBRTC_APM_DEBUG_DUMP=0', 'TGVOIP_USE_DESKTOP_DSP', 'WEBRTC_NS_FLOAT'], 'variables': {'tgvoip_src_loc': '.', 'official_build_target%': '', 'linux_path_opus_include%': '<(DEPTH)/../../../Libraries/opus/include'}, 'includ...
print("####################################################") print("#FILENAME:\t\ta1p3.py\t\t\t #") print("#ASSIGNMENT:\t\tHomework Assignment 1 Pt. 3#") print("#COURSE/SECTION:\tCIS 3389.251\t\t #") print("#DUE DATE:\t\tWednesday, 12.February 2020#") print("####################################################\n\...
print('####################################################') print('#FILENAME:\t\ta1p3.py\t\t\t #') print('#ASSIGNMENT:\t\tHomework Assignment 1 Pt. 3#') print('#COURSE/SECTION:\tCIS 3389.251\t\t #') print('#DUE DATE:\t\tWednesday, 12.February 2020#') print('####################################################\n\n...
description = '' pages = ['header', 'checkout'] def setup(data): pass def test(data): navigate('http://store.demoqa.com/') click(header.go_to_checkout) verify_text_in_element(checkout.title, 'Checkout') capture('Checkout page is displayed') def teardown(data): pass
description = '' pages = ['header', 'checkout'] def setup(data): pass def test(data): navigate('http://store.demoqa.com/') click(header.go_to_checkout) verify_text_in_element(checkout.title, 'Checkout') capture('Checkout page is displayed') def teardown(data): pass
# ENUM definitions # Symbol type SYMBOL_TYPE_SPOT = 'SPOT' # Order status ORDER_STATUS_NEW = 'NEW' ORDER_STATUS_PARTIALLY_FILLED = 'PARTIALLY_FILLED' ORDER_STATUS_FILLED = 'FILLED' ORDER_STATUS_CANCELED = 'CANCELED' ORDER_STATUS_PENDING_CANCEL = 'PENDING_CANCEL' ORDER_STATUS_REJECTED = 'REJECTED' ORDER_STATUS_EXPIRED ...
symbol_type_spot = 'SPOT' order_status_new = 'NEW' order_status_partially_filled = 'PARTIALLY_FILLED' order_status_filled = 'FILLED' order_status_canceled = 'CANCELED' order_status_pending_cancel = 'PENDING_CANCEL' order_status_rejected = 'REJECTED' order_status_expired = 'EXPIRED' order_type_limit = 'LIMIT' order_type...
# cases where DictAchievement should unlock # >> CASE {'name': 'John Doe', 'age': 24} # >> CASE { 'name': 'John Doe', 'age': 24 } # >> CASE func({'name': 'John Doe', 'age': 24})
{'name': 'John Doe', 'age': 24} {'name': 'John Doe', 'age': 24} func({'name': 'John Doe', 'age': 24})
#!/usr/bin/env python3 # default arguments, assume a default value if one is not provided def display_info(name, age='42'): print('Name: ', name, 'Age', age) display_info(age='56', name='Marc Wilson') display_info(name='Marc Wilson')
def display_info(name, age='42'): print('Name: ', name, 'Age', age) display_info(age='56', name='Marc Wilson') display_info(name='Marc Wilson')
#!/usr/bin/env python ''' Copyright (C) 2019, WAFW00F Developers. See the LICENSE file for copying permission. ''' NAME = 'Malcare (Inactiv)' def is_waf(self): schemes = [ self.matchContent(r'firewall.{0,15}?powered.by.{0,15}?malcare.{0,15}?pro'), self.matchContent('blocked because of malicious a...
""" Copyright (C) 2019, WAFW00F Developers. See the LICENSE file for copying permission. """ name = 'Malcare (Inactiv)' def is_waf(self): schemes = [self.matchContent('firewall.{0,15}?powered.by.{0,15}?malcare.{0,15}?pro'), self.matchContent('blocked because of malicious activities')] if any((i for i in scheme...
n,k=map(int,input().split()) if k<n//2 or (n==1 and k!=0): print(-1) else: if n==1: print(1) else: x=r=k-(n-2)//2 while r<=x+n: r+=x ans=[r,x] for i in range(2,n): ans.append(ans[1]+i-1) print(*ans)
(n, k) = map(int, input().split()) if k < n // 2 or (n == 1 and k != 0): print(-1) elif n == 1: print(1) else: x = r = k - (n - 2) // 2 while r <= x + n: r += x ans = [r, x] for i in range(2, n): ans.append(ans[1] + i - 1) print(*ans)
class news_source: ''' News Source Class to define News Source Objects ''' def __init__(self, id, name, homepage_url, description): self.id = id self.name = name self.homepage_url = homepage_url self.description = description # self.logo = logo class Articles: ...
class News_Source: """ News Source Class to define News Source Objects """ def __init__(self, id, name, homepage_url, description): self.id = id self.name = name self.homepage_url = homepage_url self.description = description class Articles: """ Articles class t...
class MarkerPosition: def __init__(self, markers_points, rotation_vector, translation_vector): self.markers_points = markers_points self.rotation_vector = rotation_vector self.translation_vector = translation_vector def set_markers_points(self, markers_points): self.markers_poi...
class Markerposition: def __init__(self, markers_points, rotation_vector, translation_vector): self.markers_points = markers_points self.rotation_vector = rotation_vector self.translation_vector = translation_vector def set_markers_points(self, markers_points): self.markers_poi...
#import formatter #import htmllib url="http://www.cnn.com" filehandle = urllib.urlopen(url) #w = formatter.DumbWriter() # plain text #f = formatter.AbstractFormatter(w) #p = htmllib.HTMLParser(f) #p.feed(filehandle.read()) #p.close() #filehandle.close() fromaddr = "ahouman2@hatswitch.crhc.illinois.edu" msg =...
url = 'http://www.cnn.com' filehandle = urllib.urlopen(url) fromaddr = 'ahouman2@hatswitch.crhc.illinois.edu' msg = mime_multipart() msg['From'] = 'amir' msg['To'] = 'asdsadad' msg['Date'] = formatdate(localtime=True) msg['Subject'] = 'salam' text = 'saaalaaam' msg.attach(mime_text(text)) part = mime_base('application'...
class WebPageCssSelect: def __init__(self, url, ua_type, selector_name, value): self.url = url self.ua_type = ua_type self.selector_name = selector_name self.value = value def output(self): return self.url + ',' + self.ua_type + ',' + self.selector_name + ',' + self.value
class Webpagecssselect: def __init__(self, url, ua_type, selector_name, value): self.url = url self.ua_type = ua_type self.selector_name = selector_name self.value = value def output(self): return self.url + ',' + self.ua_type + ',' + self.selector_name + ',' + self.val...
num = 10 num1 = 10 num2 = 20 num3 = 30
num = 10 num1 = 10 num2 = 20 num3 = 30
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
class Context: def __init__(self): self.containers = [] def push(self, o): self.containers.append(o) def pop(self): return self.containers.pop() class Values: def __init__(self, *values): self.values = values def validate(self, o, ctx): if not o in self....
''' https://leetcode.com/problems/longest-valid-parentheses/ ''' class Solution: def longestValidParentheses(self, s: str) -> int: stack=[-1] maxValid=0 for i in range(0,len(s)): if s[i]=="(": stack.append(i) else: stack.pop() if stack=...
""" https://leetcode.com/problems/longest-valid-parentheses/ """ class Solution: def longest_valid_parentheses(self, s: str) -> int: stack = [-1] max_valid = 0 for i in range(0, len(s)): if s[i] == '(': stack.append(i) else: stack.pop...
class Response: def __init__(self, inst): self.instance = inst @property def id(self): return self.instance['status'] @property def status(self): return self.instance['status']
class Response: def __init__(self, inst): self.instance = inst @property def id(self): return self.instance['status'] @property def status(self): return self.instance['status']
NUM_ROWS = 10 NUM_COLS = 10 with open('input.txt') as file: octopi = [] num_flashes = 0 for row in range(NUM_ROWS): line = file.readline() octopi.append([]) for col in range(NUM_COLS): octopi[row].append(int(line[col])) for step in range(100): flashes = [] ...
num_rows = 10 num_cols = 10 with open('input.txt') as file: octopi = [] num_flashes = 0 for row in range(NUM_ROWS): line = file.readline() octopi.append([]) for col in range(NUM_COLS): octopi[row].append(int(line[col])) for step in range(100): flashes = [] ...
FILTERS_KEY = 'FILTERS' SAMPLE_RATE_METRIC_KEY = '_sample_rate' SAMPLING_PRIORITY_KEY = '_sampling_priority_v1' ANALYTICS_SAMPLE_RATE_KEY = '_dd1.sr.eausr' ORIGIN_KEY = '_dd.origin' HOSTNAME_KEY = '_dd.hostname' ENV_KEY = 'env' NUMERIC_TAGS = (ANALYTICS_SAMPLE_RATE_KEY, ) MANUAL_DROP_KEY = 'manual.drop' MANUAL_KEEP_K...
filters_key = 'FILTERS' sample_rate_metric_key = '_sample_rate' sampling_priority_key = '_sampling_priority_v1' analytics_sample_rate_key = '_dd1.sr.eausr' origin_key = '_dd.origin' hostname_key = '_dd.hostname' env_key = 'env' numeric_tags = (ANALYTICS_SAMPLE_RATE_KEY,) manual_drop_key = 'manual.drop' manual_keep_key ...
def init(bot, data): @bot.command() async def add(ctx): await ctx.send("Add Ludus to your server: <https://discordapp.com/api/oauth2/authorize?client_id=593828724001079297&permissions=124992&scope=bot>") @bot.command() async def github(ctx): await ctx.send("Ludus is open source! You...
def init(bot, data): @bot.command() async def add(ctx): await ctx.send('Add Ludus to your server: <https://discordapp.com/api/oauth2/authorize?client_id=593828724001079297&permissions=124992&scope=bot>') @bot.command() async def github(ctx): await ctx.send('Ludus is open source! You ca...
#! /usr/bin/env zxpy ~'echo Hello world!' def print_file_count(): file_count = ~'ls -1 | wc -l' ~"echo -n 'file count is: '" print(file_count) print_file_count()
~'echo Hello world!' def print_file_count(): file_count = ~'ls -1 | wc -l' ~"echo -n 'file count is: '" print(file_count) print_file_count()
## Capitalizes the first letter of a string. ## Capitalizes the fist letter of the sring and then adds it with rest of the string. Omit the lower_rest parameter to keep the rest of the string intact, or set it to true to convert to lowercase. def capitalize(string, lower_rest=False): return string[:1].upper() ...
def capitalize(string, lower_rest=False): return string[:1].upper() + (string[1:].lower() if lower_rest else string[1:])
# Rock, paper, scissors game print("--------------------------------") print(" Rock, Paper, Scissors v1") print("--------------------------------") player1 = input("Player 1, enter your name: ") player2 = input("Player 2, enter your name: ") rolls = ["rock", "paper", "scissors"] roll1 = input(f"{player1}, enter y...
print('--------------------------------') print(' Rock, Paper, Scissors v1') print('--------------------------------') player1 = input('Player 1, enter your name: ') player2 = input('Player 2, enter your name: ') rolls = ['rock', 'paper', 'scissors'] roll1 = input(f'{player1}, enter your roll [rock, paper, scissors]:...
class VkError(Exception): def __init__(self, code, message, request_params): super(VkError, self).__init__() self.code = code self.message = message self.request_params = request_params def __str__(self): return 'VkError {}: {} (request_params: {})'.format(self.code, sel...
class Vkerror(Exception): def __init__(self, code, message, request_params): super(VkError, self).__init__() self.code = code self.message = message self.request_params = request_params def __str__(self): return 'VkError {}: {} (request_params: {})'.format(self.code, se...
#!/usr/bin/env python # -*- coding: utf-8 -*- print(''' .intel_syntax noprefix .extern isr_common ''') print('// Interrupt Service Routines') for i in range(255): print('''isr{0}: cli {1} push {0} jmp isr_common '''.format(i, 'push 0' if i not in [8, 10, 11, 12, 13, 14, 17] else 'nop'...
print('\n.intel_syntax noprefix\n.extern isr_common\n') print('// Interrupt Service Routines') for i in range(255): print('isr{0}:\n cli\n {1}\n push {0}\n jmp isr_common\n '.format(i, 'push 0' if i not in [8, 10, 11, 12, 13, 14, 17] else 'nop')) print('\n\n// Vector table\n\n.section .data\n.global ...
# This sample tests the logic that infers parameter types based on # default argument values or annotated base class methods. class Parent: def func1(self, a: int, b: str) -> float: ... class Child(Parent): def func1(self, a, b): reveal_type(self, expected_text="Self@Child") reveal_t...
class Parent: def func1(self, a: int, b: str) -> float: ... class Child(Parent): def func1(self, a, b): reveal_type(self, expected_text='Self@Child') reveal_type(a, expected_text='int') reveal_type(b, expected_text='str') return a def func2(a, b=0, c=None): reveal...
#!/usr/bin/python3 class Solution: def isPalindrome(self, x: int) -> bool: if x < 0: return False s = str(x) for i in range(int(len(s)/2)): last = len(s) - i - 1 if s[i] != s[last]: return False return True if __name__ == "__main_...
class Solution: def is_palindrome(self, x: int) -> bool: if x < 0: return False s = str(x) for i in range(int(len(s) / 2)): last = len(s) - i - 1 if s[i] != s[last]: return False return True if __name__ == '__main__': solution ...
# *** DEFINE CONSTANTS *** # DO NOT ADD TO VERSION CONTROL AFTER ENTERING PERSONAL INFO # LOCATION WHERE BLOTTER FILE IS LOCATED (INPUT) SRCPATH = "D:/financial/" SRCFILE = "blotter.xlsx" # OUTPUT DATA DESTINATION (WINDOWS FORMAT) outpath = "D://financial//" outpath_linux = "/mnt/d/financial/" # OUTPUT FILE NAMES ou...
srcpath = 'D:/financial/' srcfile = 'blotter.xlsx' outpath = 'D://financial//' outpath_linux = '/mnt/d/financial/' outfile = 'stock_data_output.xlsx' out_screener = 'screener_output.xlsx' hist_db_server = 'sqlite' hist_db_name = 'hist.db' hist_db_schema = 'db_schema.sql' max_sector_pct = 0.2 max_stock_pct = 0.1 discoun...
def get_num(capacity, p): cell = [] for i in range(len(p) + 1): cell.append([]) for j in range(capacity + 1): cell[i].append(0) for i in range(1, len(p) + 1): for j in range(1, capacity + 1): if p[i - 1] <= i: cell[i][j] = max(p[i -1], cell[i]...
def get_num(capacity, p): cell = [] for i in range(len(p) + 1): cell.append([]) for j in range(capacity + 1): cell[i].append(0) for i in range(1, len(p) + 1): for j in range(1, capacity + 1): if p[i - 1] <= i: cell[i][j] = max(p[i - 1], cell[i]...
#!/usr/bin/env python # examples of Church numerals zero = lambda f: lambda x: x one = lambda f: lambda x: f(x) two = lambda f: lambda x: f(f(x)) three = lambda f: lambda x: f(f(f(x))) four = lambda f: lambda x: f(f(f(f(x)))) five = lambda f: lambda x: f(f(f(f(f(x))))) def to_intp(f): print (f(lam...
zero = lambda f: lambda x: x one = lambda f: lambda x: f(x) two = lambda f: lambda x: f(f(x)) three = lambda f: lambda x: f(f(f(x))) four = lambda f: lambda x: f(f(f(f(x)))) five = lambda f: lambda x: f(f(f(f(f(x))))) def to_intp(f): print(f(lambda x: x + 1)(0)) def to_int(f): return f(lambda x: x + 1)(0) tru...
#!/usr/bin/env python3 # https://arc098.contest.atcoder.jp/tasks/arc098_a n = int(input()) s = input() a = [0] * n if s[0] == 'W': a[0] = 1 for i in range(1, n): c = s[i] if c == 'E': a[i] = a[i - 1] else: a[i] = a[i - 1] + 1 b = [0] * n if s[n - 1] == 'E': b[n - 1] = 1 for i in range(n - 2,...
n = int(input()) s = input() a = [0] * n if s[0] == 'W': a[0] = 1 for i in range(1, n): c = s[i] if c == 'E': a[i] = a[i - 1] else: a[i] = a[i - 1] + 1 b = [0] * n if s[n - 1] == 'E': b[n - 1] = 1 for i in range(n - 2, -1, -1): c = s[i] if c == 'W': b[i] = b[i + 1] ...
def reverse_string(string): reverse = '' for char in range(len(string) - 1, -1, -1): reverse += string[char] print(reverse)
def reverse_string(string): reverse = '' for char in range(len(string) - 1, -1, -1): reverse += string[char] print(reverse)
class RestException(Exception): pass class ResourceException(RestException): pass class RestServerException(RestException): pass
class Restexception(Exception): pass class Resourceexception(RestException): pass class Restserverexception(RestException): pass
class CreateAuth: def __init__(self, repository): self.auth_repository = repository async def create(self): return await self.auth_repository.create()
class Createauth: def __init__(self, repository): self.auth_repository = repository async def create(self): return await self.auth_repository.create()
length = int( input("Enter the length of rectagle: ") ) width = int( input("Enter the width of rectange: ") ) perimeter = 2 * (length + width) area = length * width print("Area: ", area, "square cm") print("Perimeter:", perimeter, "cm")
length = int(input('Enter the length of rectagle: ')) width = int(input('Enter the width of rectange: ')) perimeter = 2 * (length + width) area = length * width print('Area: ', area, 'square cm') print('Perimeter:', perimeter, 'cm')
def read_matrix(): (rows, columns) = map(int, input().split(" ")) matrix = [] for r in range(rows): row = input().split(" ") matrix.append(row) return matrix, rows, columns def subsqares_count(matrix,subsquare, rows, columns): count = 0 for r in range(rows - (subsquare - 1)): ...
def read_matrix(): (rows, columns) = map(int, input().split(' ')) matrix = [] for r in range(rows): row = input().split(' ') matrix.append(row) return (matrix, rows, columns) def subsqares_count(matrix, subsquare, rows, columns): count = 0 for r in range(rows - (subsquare - 1)):...
DEBUG = True APP_DIR = '/home/harish/django_projects/cinepura/' STATIC_MEDIA_PREFIX = '/static_media/cinepura'
debug = True app_dir = '/home/harish/django_projects/cinepura/' static_media_prefix = '/static_media/cinepura'
def reverse_num(x: int) -> int : if x == 0: return 0 else: num_temp = str(x) tam = len(num_temp) num_zeros = 0 if num_temp[0] == "-": if num_temp[tam - 1] == "0": dici = {"0": 0} for value in num_temp[:1:-1]: ...
def reverse_num(x: int) -> int: if x == 0: return 0 else: num_temp = str(x) tam = len(num_temp) num_zeros = 0 if num_temp[0] == '-': if num_temp[tam - 1] == '0': dici = {'0': 0} for value in num_temp[:1:-1]: ...
class BasicPagination: items_per_page = 1 max_items_per_page = 100 def __init__(self, pagination: dict = None, items_per_page: int = None, max_items_per_page: int = None): pagination = pagination or {} self.page = pagination.get('page', 0) ...
class Basicpagination: items_per_page = 1 max_items_per_page = 100 def __init__(self, pagination: dict=None, items_per_page: int=None, max_items_per_page: int=None): pagination = pagination or {} self.page = pagination.get('page', 0) self.max_items_per_page = max_items_per_page ...
''' This problem was recently asked by Apple: You are given two singly linked lists. The lists intersect at some node. Find, and return the node. Note: the lists are non-cyclical. Example: A = 1 -> 2 -> 3 -> 4 B = 6 -> 3 -> 4 This should return 3 (you may assume that any nodes with the same value are the same nod...
""" This problem was recently asked by Apple: You are given two singly linked lists. The lists intersect at some node. Find, and return the node. Note: the lists are non-cyclical. Example: A = 1 -> 2 -> 3 -> 4 B = 6 -> 3 -> 4 This should return 3 (you may assume that any nodes with the same value are the same node)...
WELCOME_DIALOG_TEXT = ( "Welcome to NVDA dialog Welcome to NVDA! Most commands for controlling NVDA require you to hold " "down the NVDA key while pressing other keys. By default, the numpad Insert and main Insert keys " "may both be used as the NVDA key. You can also configure NVDA to use the Caps Lock as the ...
welcome_dialog_text = 'Welcome to NVDA dialog Welcome to NVDA! Most commands for controlling NVDA require you to hold down the NVDA key while pressing other keys. By default, the numpad Insert and main Insert keys may both be used as the NVDA key. You can also configure NVDA to use the Caps Lock as the NVDA key. Pres...
__author__ = "NuoDB, Inc." __copyright__ = "(C) Copyright NuoDB, Inc. 2019" __license__ = "MIT" __version__ = "1.0" __maintainer__ = "NuoDB Drivers" __email__ = "drivers@nuodb.com" __status__ = "Production"
__author__ = 'NuoDB, Inc.' __copyright__ = '(C) Copyright NuoDB, Inc. 2019' __license__ = 'MIT' __version__ = '1.0' __maintainer__ = 'NuoDB Drivers' __email__ = 'drivers@nuodb.com' __status__ = 'Production'
class Jaro: def similarity(self, s, t): if not s and not t: return 1 if not s or not t: return 0 if len(s) > len(t): s, t = t, s max_dist = (len(t) // 2) - 1 s_matched = [] t_matched = [] ...
class Jaro: def similarity(self, s, t): if not s and (not t): return 1 if not s or not t: return 0 if len(s) > len(t): (s, t) = (t, s) max_dist = len(t) // 2 - 1 s_matched = [] t_matched = [] matches = 0 for (i, c) ...
class Smartphone: def gallary(self): print("Gallary") def browser(self): print("Browser") def app_store(self): print("App Store") x = Smartphone() x.gallary() x.browser() x.gallary()
class Smartphone: def gallary(self): print('Gallary') def browser(self): print('Browser') def app_store(self): print('App Store') x = smartphone() x.gallary() x.browser() x.gallary()
''' @file ion/core/__init__.py @mainpage Overview @section intro Introduction This is the repository that defines the COI services. @note Initially, all ION services are defined here and later moved to subsystem repositories. COI services are intended to be deployed as part of the ION system launch. Services are d...
""" @file ion/core/__init__.py @mainpage Overview @section intro Introduction This is the repository that defines the COI services. @note Initially, all ION services are defined here and later moved to subsystem repositories. COI services are intended to be deployed as part of the ION system launch. Services are d...
PATH_IMAGE = "img" BACKGROUND_IMAGE = 'background' LOOT_IMAGE = 'point_5' GHOST_RED_IMAGE = 'ghost_red_30' GHOST_BLUE_IMAGE = 'ghost_blue_30' GHOST_PINK_IMAGE = 'ghost_pink_30' GHOST_ORANGE_IMAGE = 'ghost_orange_30' FONT_REGULAR = 'couriernew_regular.ttf' FONT_BOLD = 'couriernew_bold.ttf' PACMAN_SIZE = (30...
path_image = 'img' background_image = 'background' loot_image = 'point_5' ghost_red_image = 'ghost_red_30' ghost_blue_image = 'ghost_blue_30' ghost_pink_image = 'ghost_pink_30' ghost_orange_image = 'ghost_orange_30' font_regular = 'couriernew_regular.ttf' font_bold = 'couriernew_bold.ttf' pacman_size = (30, 30) ghost_s...
''' Created on Sat 04/04/2020 11:55:38 99 Bottles of Beer @author: MarsCandyBars ''' class BottlesOfBeer(): def __init__(self): ''' Description: This method provides attributes for the main lyrics of the song to make looping cleaner. Args: None. ...
""" Created on Sat 04/04/2020 11:55:38 99 Bottles of Beer @author: MarsCandyBars """ class Bottlesofbeer: def __init__(self): """ Description: This method provides attributes for the main lyrics of the song to make looping cleaner. Args: None. Re...
class Library: def __init__(self, id, books, signup_days, book_p_day): self.id = id self.books = books self.signup_days = signup_days self.book_p_day = book_p_day def score(self, books_so_far): possible_reward = sum([self.books[id] for id in self.books.keys() if id not ...
class Library: def __init__(self, id, books, signup_days, book_p_day): self.id = id self.books = books self.signup_days = signup_days self.book_p_day = book_p_day def score(self, books_so_far): possible_reward = sum([self.books[id] for id in self.books.keys() if id not ...
#Write a program that prompts for a file name, then opens that file and reads through the file, looking for lines of the form: #X-DSPAM-Confidence: 0.8475 #Count these lines and extract the floating point values from each of the lines and compute the average of those values #and produce an output as shown below. Do ...
fname = input('Enter file name: ') fh = open(fname) count = 0 add = 0 for line in fh: if not line.startswith('X-DSPAM-Confidence:'): continue bnpos = line.find('0') host = line[bnpos:] fhost = float(host) count = count + 1 add = add + fhost print('Average spam confidence', add / count)
''' ''' __version__ = '0.1-dev' device_config_name = 'Devices' exp_config_name = 'experiment'
""" """ __version__ = '0.1-dev' device_config_name = 'Devices' exp_config_name = 'experiment'
# Python code to demonstrate naive # method to compute gcd ( Euclidean algo ) def computeGCD(x, y): while(y): x, y = y, x % y return x a = 60 b= 48 # prints 12 print ("The gcd of 60 and 48 is : ",end="") print (computeGCD(60,48))
def compute_gcd(x, y): while y: (x, y) = (y, x % y) return x a = 60 b = 48 print('The gcd of 60 and 48 is : ', end='') print(compute_gcd(60, 48))
# URI Online Judge 2787 L = int(input()) C = int(input()) if L % 2 == 0: if C % 2 == 0: print(1) else: print(0) else: if C % 2 == 0: print(0) else: print(1)
l = int(input()) c = int(input()) if L % 2 == 0: if C % 2 == 0: print(1) else: print(0) elif C % 2 == 0: print(0) else: print(1)
def convert_string_to_int(list_a): new_list = [] for item in list_a: num = int(item) new_list.append(num) return new_list str_num_list = input().split(",") rotate_times = int(input()) int_list = convert_string_to_int(str_num_list) len_of_list = len(int_list) val = rotate_times % len_of...
def convert_string_to_int(list_a): new_list = [] for item in list_a: num = int(item) new_list.append(num) return new_list str_num_list = input().split(',') rotate_times = int(input()) int_list = convert_string_to_int(str_num_list) len_of_list = len(int_list) val = rotate_times % len_of_list ...
class Publisher: def __init__(self): self.observers = [] def add(self, observer): if observer not in self.observers: self.observers.append(observer) else: print('Failed to add: {}'.format(observer)) def remove(self, observer): try: self.o...
class Publisher: def __init__(self): self.observers = [] def add(self, observer): if observer not in self.observers: self.observers.append(observer) else: print('Failed to add: {}'.format(observer)) def remove(self, observer): try: self....
Version = "5.6.5" if __name__ == "__main__": print (Version)
version = '5.6.5' if __name__ == '__main__': print(Version)
'''Implements /src/Resource/index.ts''' class Resource: ''' Enum implemenation ''' class Types: WOOD = 'wood' COAL = 'coal' URANIUM = 'uranium' def __init__(self, type, amount) -> None: self.type = type self.amount = amount
"""Implements /src/Resource/index.ts""" class Resource: """ Enum implemenation """ class Types: wood = 'wood' coal = 'coal' uranium = 'uranium' def __init__(self, type, amount) -> None: self.type = type self.amount = amount
t = int(input()) i=0 while i < t: st = str(input()) length = len(st) j = 0 cnt = 0 while j < length: num = int(st[j]) #print(num) if num == 4: cnt = cnt + 1 j=j+1 print(cnt) i=i+1
t = int(input()) i = 0 while i < t: st = str(input()) length = len(st) j = 0 cnt = 0 while j < length: num = int(st[j]) if num == 4: cnt = cnt + 1 j = j + 1 print(cnt) i = i + 1
# # @lc app=leetcode id=693 lang=python3 # # [693] Binary Number with Alternating Bits # # https://leetcode.com/problems/binary-number-with-alternating-bits/description/ # # algorithms # Easy (58.47%) # Likes: 359 # Dislikes: 74 # Total Accepted: 52.4K # Total Submissions: 89.1K # Testcase Example: '5' # # Given...
class Solution: def has_alternating_bits(self, n: int) -> bool: b = list(bin(n)[2:]) if len(b) < 2: return True else: return b[0] != b[1] and len(set(b[::2])) == 1 and (len(set(b[1::2])) == 1)
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'targets': [ { 'target_name': 'memconsumer', 'type': 'none', 'dependencies': [ 'memconsumer_apk', ], }, { ...
{'targets': [{'target_name': 'memconsumer', 'type': 'none', 'dependencies': ['memconsumer_apk']}, {'target_name': 'memconsumer_apk', 'type': 'none', 'variables': {'apk_name': 'MemConsumer', 'java_in_dir': 'java', 'resource_dir': 'java/res', 'native_lib_target': 'libmemconsumer'}, 'dependencies': ['libmemconsumer'], 'in...
# https://leetcode.com/problems/contains-duplicate class Solution: def containsDuplicate(self, nums): hs = set() for num in nums: hs.add(num) return len(hs) != len(nums)
class Solution: def contains_duplicate(self, nums): hs = set() for num in nums: hs.add(num) return len(hs) != len(nums)
#!/usr/bin/env python3 # # Author: # Tamas Jos (@skelsec) # class CommentStreamA: def __init__(self): self.data = None @staticmethod def parse(dir, buff): csa = CommentStreamA() buff.seek(dir.Location.Rva) csa.data = buff.read(dir.Location.DataSize).decode() return csa def __str__(self): return 'Co...
class Commentstreama: def __init__(self): self.data = None @staticmethod def parse(dir, buff): csa = comment_stream_a() buff.seek(dir.Location.Rva) csa.data = buff.read(dir.Location.DataSize).decode() return csa def __str__(self): return 'CommentA: %s' ...
# # PySNMP MIB module Nortel-MsCarrier-MscPassport-DataCollectionMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-DataCollectionMIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:20:12 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 ...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection) ...
for i in range(1,101) : if(i % 2 != 0): pass else: print(i,"is even number")
for i in range(1, 101): if i % 2 != 0: pass else: print(i, 'is even number')
class PriorityQueueBase: ''' abstract base class for a priority queue ''' class _Item: __slots_ = '_key', '_value' def __init__(self, k, v): self._key = k self._value = v def __lt__(self, other): return self._key < other._key def is_empty(self...
class Priorityqueuebase: """ abstract base class for a priority queue """ class _Item: __slots_ = ('_key', '_value') def __init__(self, k, v): self._key = k self._value = v def __lt__(self, other): return self._key < other._key def is_empty(sel...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"example_func": "00_core.ipynb", "process_data": "01_cli.ipynb", "train": "01_cli.ipynb", "evaluate": "01_cli.ipynb", "reproduce": "01_cli.ipynb"} modules = ["core.py", ...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'example_func': '00_core.ipynb', 'process_data': '01_cli.ipynb', 'train': '01_cli.ipynb', 'evaluate': '01_cli.ipynb', 'reproduce': '01_cli.ipynb'} modules = ['core.py', 'cli.py'] doc_url = 'https://wm-semeru.github.io/mlproj_template/' git_url = 'ht...
class RPGinfo(): author = 'BigBoi' def __init__(self,name): self.title = name def welcome(self): print("Welcome to " + self.title) @staticmethod def info(): print("Made using my amazing powers and Raseberry Pi's awesome team") @classmethod def credits(c...
class Rpginfo: author = 'BigBoi' def __init__(self, name): self.title = name def welcome(self): print('Welcome to ' + self.title) @staticmethod def info(): print("Made using my amazing powers and Raseberry Pi's awesome team") @classmethod def credits(cls, name): ...
def previous_answer(): #1. num1 = int(input("Please enter your number!")) if num1 % 2 == 0: print("Your number is EVEN number!") else: print("Your number is ODD number!") #2. num2 = int(input("Please enter second number!")) num3 = int(input("Please enter third number!")) ...
def previous_answer(): num1 = int(input('Please enter your number!')) if num1 % 2 == 0: print('Your number is EVEN number!') else: print('Your number is ODD number!') num2 = int(input('Please enter second number!')) num3 = int(input('Please enter third number!')) if num2 % num3 =...
merge_tags = { "StudyDate": 0x00080020, "StudyTime": 0x00080030, "AccessionNumber": 0x00080050, "ReferringPhysicianName": 0x00080090, "StudyInstanceUID": 0x0020000D, "StudyID": 0x00200010, "Modality": 0x00080060, # "ModalitiesInStudy": , "SeriesInstanceUID": 0x0020000E, "SeriesNu...
merge_tags = {'StudyDate': 524320, 'StudyTime': 524336, 'AccessionNumber': 524368, 'ReferringPhysicianName': 524432, 'StudyInstanceUID': 2097165, 'StudyID': 2097168, 'Modality': 524384, 'SeriesInstanceUID': 2097166, 'SeriesNumber': 2097169, 'SOPClassUID': 524310, 'SOPInstanceUID': 524312, 'PatientAge': 1052688, 'Patien...
APP_V1 = '1.0' APP_V2 = '2.0' MAJOR_RELEASE_TO_VERSION = { "1": APP_V1, "2": APP_V2, } CAREPLAN_GOAL = 'careplan_goal' CAREPLAN_TASK = 'careplan_task' CAREPLAN_CASE_NAMES = { CAREPLAN_GOAL: 'Goal', CAREPLAN_TASK: 'Task' } CT_REQUISITION_MODE_3 = '3-step' CT_REQUISITION_MODE_4 = '4-step' CT_REQUISITION...
app_v1 = '1.0' app_v2 = '2.0' major_release_to_version = {'1': APP_V1, '2': APP_V2} careplan_goal = 'careplan_goal' careplan_task = 'careplan_task' careplan_case_names = {CAREPLAN_GOAL: 'Goal', CAREPLAN_TASK: 'Task'} ct_requisition_mode_3 = '3-step' ct_requisition_mode_4 = '4-step' ct_requisition_modes = [CT_REQUISITIO...
'''4. Write a Python program to concatenate elements of a list. ''' num = ['1', '2', '3', '4', '5'] print('-'.join(num)) print(''.join(num))
"""4. Write a Python program to concatenate elements of a list. """ num = ['1', '2', '3', '4', '5'] print('-'.join(num)) print(''.join(num))
print ("Hello World") n = int(input("numero: ")) print(type(n)) print(bin(3))
print('Hello World') n = int(input('numero: ')) print(type(n)) print(bin(3))
d, m = map(int, input().split()) month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] days = ['Thursday', 'Friday', 'Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wednesday'] sumOfMonths = 0 for i in range(m - 1): sumOfMonths += month[i] result = sumOfMonths + d - 1 print(days[result % 7])
(d, m) = map(int, input().split()) month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] days = ['Thursday', 'Friday', 'Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wednesday'] sum_of_months = 0 for i in range(m - 1): sum_of_months += month[i] result = sumOfMonths + d - 1 print(days[result % 7])
# # PySNMP MIB module HM2-PLATFORM-SWITCHING-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HM2-PLATFORM-SWITCHING-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:19:34 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version ...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint) ...
def pytest_addoption(parser): # Where to find curl-impersonate's binaries parser.addoption("--install-dir", action="store", default="/usr/local") parser.addoption("--capture-interface", action="store", default="eth0")
def pytest_addoption(parser): parser.addoption('--install-dir', action='store', default='/usr/local') parser.addoption('--capture-interface', action='store', default='eth0')
#INPUT lines = open('input.txt').read().split() dummy = ['forward', '5', 'down', '5', 'forward', '8', 'up', '3', 'down', '8', 'forward', '2'] #FIRST PROBLEM def problemPart1(data): horizontal = 0 depth = 0 for i in range(0, len(data), 2): if data[i] == 'down': depth += int(data[i+1]) ...
lines = open('input.txt').read().split() dummy = ['forward', '5', 'down', '5', 'forward', '8', 'up', '3', 'down', '8', 'forward', '2'] def problem_part1(data): horizontal = 0 depth = 0 for i in range(0, len(data), 2): if data[i] == 'down': depth += int(data[i + 1]) elif data[i] ...
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. class HlsColor: def __init__(self, hue, luminance, saturation): self.hue = hue self.luminance = luminance self.saturation = saturation def Lighten(self, percent): self.luminance *= (1.0 + percent) ...
class Hlscolor: def __init__(self, hue, luminance, saturation): self.hue = hue self.luminance = luminance self.saturation = saturation def lighten(self, percent): self.luminance *= 1.0 + percent if self.luminance > 1.0: self.luminance = 1.0 def darken(s...
class DataFile: def __init__(self, datetime, chart, datafile): self.Datetime = datetime self.Chart = chart self.Datafile = datafile return
class Datafile: def __init__(self, datetime, chart, datafile): self.Datetime = datetime self.Chart = chart self.Datafile = datafile return
entries = [ { 'env-title': 'atari-alien', 'env-variant': 'No-op start', 'score': 3166, }, { 'env-title': 'atari-amidar', 'env-variant': 'No-op start', 'score': 1735, }, { 'env-title': 'atari-assault', 'env-variant': 'No-op start', ...
entries = [{'env-title': 'atari-alien', 'env-variant': 'No-op start', 'score': 3166}, {'env-title': 'atari-amidar', 'env-variant': 'No-op start', 'score': 1735}, {'env-title': 'atari-assault', 'env-variant': 'No-op start', 'score': 7203}, {'env-title': 'atari-asterix', 'env-variant': 'No-op start', 'score': 406211}, {'...
def first_last6(nums): if nums[0] == 6 or nums[-1] == 6: return True else: return False def same_first_last(nums): if len(nums) >= 1 and nums[0] == nums[-1]: return True else: return False def make_pi(): return [3, 1, 4] def common_end(a, b): if a[-1] == b[-1] or a[0] == b[0]: return ...
def first_last6(nums): if nums[0] == 6 or nums[-1] == 6: return True else: return False def same_first_last(nums): if len(nums) >= 1 and nums[0] == nums[-1]: return True else: return False def make_pi(): return [3, 1, 4] def common_end(a, b): if a[-1] == b[-1] ...
data_set = [] # UNix time stamp PHASE_1 = 1341214200 # before 02-07-2012 01:00:00 PM PHASE_2 = 1341253799 # After PHASE_1 till 02-07-2012 11:59:59 PM PHASE_3 = 1341368999 # After PHASE_2 till 04-07-2012 07:59:59 AM file1 = 0 file2 = 0 file3 = 0 file4 = 0 def extract_in_list(): with open("/home/darkmatter/Do...
data_set = [] phase_1 = 1341214200 phase_2 = 1341253799 phase_3 = 1341368999 file1 = 0 file2 = 0 file3 = 0 file4 = 0 def extract_in_list(): with open('/home/darkmatter/Documents/Network/data/higgs-activity_time.txt') as data_file: for text in data_file: text = text.strip() data_set....
class Solution: def oddCells(self, n, m, indices): rows, cols = {}, {} for r, c in indices: if r in rows: rows[r] += 1 else: rows[r] = 1 if c in cols: cols[c] += 1 else: cols[c] = 1 ...
class Solution: def odd_cells(self, n, m, indices): (rows, cols) = ({}, {}) for (r, c) in indices: if r in rows: rows[r] += 1 else: rows[r] = 1 if c in cols: cols[c] += 1 else: cols[c] = ...
# puzzle easy // https://www.codingame.com/ide/puzzle/object-insertion # needed values obj, grid, start, sol= [], [], [], [] count_star = 0 # game input() row_all, cal_all = [int(i) for i in input().split()] for i in range(row_all): obj.append(input()) c, d = [int(i) for i in input().split()] for i in range(c): gr...
(obj, grid, start, sol) = ([], [], [], []) count_star = 0 (row_all, cal_all) = [int(i) for i in input().split()] for i in range(row_all): obj.append(input()) (c, d) = [int(i) for i in input().split()] for i in range(c): grid.append(input()) count_star = sum((_.count('*') for _ in obj)) def way(row_o, cal_o, ro...
def bfs(graph, s): explored = [] q = [s] while q: u = q.pop(0) for (v, w) in [(v, w) for (v, w) in graph if v == u and w not in explored]: explored.append(w) q.append(w) print(explored) if __name__ == '__main__': graph = [('s', 'a'), ('s', 'b'), ('a', 'c'),...
def bfs(graph, s): explored = [] q = [s] while q: u = q.pop(0) for (v, w) in [(v, w) for (v, w) in graph if v == u and w not in explored]: explored.append(w) q.append(w) print(explored) if __name__ == '__main__': graph = [('s', 'a'), ('s', 'b'), ('a', 'c'), ('...
class Statistics: def __init__(self): self.stat={ 'python':0, 'sql': 0, 'django': 0, 'rest': 0, 'c++': 0, 'linux': 0, 'api': 0, 'http': 0, 'flask': 0, 'java': 0, 'git': 0, ...
class Statistics: def __init__(self): self.stat = {'python': 0, 'sql': 0, 'django': 0, 'rest': 0, 'c++': 0, 'linux': 0, 'api': 0, 'http': 0, 'flask': 0, 'java': 0, 'git': 0, 'javascript': 0, 'pytest': 0, 'postgresql': 0, 'oracle': 0, 'mysql': 0, 'mssql': 0} def go_seek(self, s): n = 0 ...
v1 = int(input('Digite um valor:')) v2 = int(input('Digite outro valor:')) re = (v1+v2) print ('O valor da soma entre {} e {} tem o resultado {}!'.format(v1,v2,re))
v1 = int(input('Digite um valor:')) v2 = int(input('Digite outro valor:')) re = v1 + v2 print('O valor da soma entre {} e {} tem o resultado {}!'.format(v1, v2, re))
# Generate random rewards for each treatment if self.action["treatment"] == "1": self.reward["value"] = np.random.binomial(1,0.5) else: #Treatment = 2 self.reward["value"] = np.random.binomial(1,0.3)
if self.action['treatment'] == '1': self.reward['value'] = np.random.binomial(1, 0.5) else: self.reward['value'] = np.random.binomial(1, 0.3)
def create_matrix(size): matrix = [] for _ in range(size): matrix.append([x for x in input().split()]) return matrix def find_start(matrix, size): for r in range(size): for c in range(size): if matrix[r][c] == 's': return r, c def get_coals_count(matrix, s...
def create_matrix(size): matrix = [] for _ in range(size): matrix.append([x for x in input().split()]) return matrix def find_start(matrix, size): for r in range(size): for c in range(size): if matrix[r][c] == 's': return (r, c) def get_coals_count(matrix, s...
# -*- coding: utf-8 -*- def main(): a, s = map(int, input().split()) if a >= s: print('Congratulations!') else: print('Enjoy another semester...') if __name__ == '__main__': main()
def main(): (a, s) = map(int, input().split()) if a >= s: print('Congratulations!') else: print('Enjoy another semester...') if __name__ == '__main__': main()
''' Edit the program provided so that it receives a series of numbers from the user and allows the user to press the enter key to indicate that he or she is finished providing inputs. After the user presses the enter key, the program should print: The sum of the numbers The average of the numbers An example of the pr...
""" Edit the program provided so that it receives a series of numbers from the user and allows the user to press the enter key to indicate that he or she is finished providing inputs. After the user presses the enter key, the program should print: The sum of the numbers The average of the numbers An example of the pr...
# you will learn more about superclass and subclass print("Hello let's start the class") class parents: var1 = "one" var2 = "two" class child(parents): # var1 = "one" # var2 = "two" var2 = "three" obj = parents() cobj = child() print(obj.var1) print(obj.var2) print(cobj.var1) pri...
print("Hello let's start the class") class Parents: var1 = 'one' var2 = 'two' class Child(parents): var2 = 'three' obj = parents() cobj = child() print(obj.var1) print(obj.var2) print(cobj.var1) print(cobj.var2)
def cal(n): k=0 while n>0: k+=(n%10)**5 n//=10 return k sum=0 for i in range(2,1000000): if cal(i)==i: sum+=i print(sum)
def cal(n): k = 0 while n > 0: k += (n % 10) ** 5 n //= 10 return k sum = 0 for i in range(2, 1000000): if cal(i) == i: sum += i print(sum)
books_file = 'books.txt' def create_book_table(): with open(books_file, 'w') as file: pass # just to make sure the file is there def get_all_books(): with open(books_file, 'r') as file: lines = [line.strip().split(',') for line in file.readlines()] return [ {'name': line[0], 'a...
books_file = 'books.txt' def create_book_table(): with open(books_file, 'w') as file: pass def get_all_books(): with open(books_file, 'r') as file: lines = [line.strip().split(',') for line in file.readlines()] return [{'name': line[0], 'author': line[1], 'read': line[2]} for line in lines...
def entrance_light(payload): jval = json.loads(payload) if("click" in jval and jval["click"] == "single"): if(lights["Entrance White 1"].on): lights["Entrance White 1"].on = False lights["Entrance White 2"].on = False log.debug("entrance_light> off") else: ...
def entrance_light(payload): jval = json.loads(payload) if 'click' in jval and jval['click'] == 'single': if lights['Entrance White 1'].on: lights['Entrance White 1'].on = False lights['Entrance White 2'].on = False log.debug('entrance_light> off') else: ...
class Solution: def maxWidthRamp(self, A): result = 0 if not A: return result stack = [] for i, num in enumerate(A): if not stack or A[stack[-1]] > num: stack.append(i) for j in reversed(range(len(A))): while stack and A[sta...
class Solution: def max_width_ramp(self, A): result = 0 if not A: return result stack = [] for (i, num) in enumerate(A): if not stack or A[stack[-1]] > num: stack.append(i) for j in reversed(range(len(A))): while stack and ...