content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Solution: def multiply(self, num1: str, num2: str) -> str: n1 = len(num1) n2 = len(num2) if not n1 or not n2: return "" if n1 == 1 and num1[0] == '0': return "0" if n2 == 1 and num2[0] == '0': return "0" # arr_num1 = list(reve...
class Solution: def multiply(self, num1: str, num2: str) -> str: n1 = len(num1) n2 = len(num2) if not n1 or not n2: return '' if n1 == 1 and num1[0] == '0': return '0' if n2 == 1 and num2[0] == '0': return '0' arr_num1 = list(map(l...
c=1 menor = 9999 while True: numero =int(input()) #condicion para obtener el menor if numero < menor and numero != 0: menor = numero #condicion para detener el bucle if numero ==0: break c=c+1 print("Menor:",menor)
c = 1 menor = 9999 while True: numero = int(input()) if numero < menor and numero != 0: menor = numero if numero == 0: break c = c + 1 print('Menor:', menor)
class Solution: def rob(self, nums: List[int]) -> int: if not nums: raise Exception("Empty Array") if len(nums) == 1: return nums[0] if len(nums) == 2: return max(nums[0], nums[1]) # loop arr[0:N - 1] dp_0 = [0] * len(nums) dp_0[0]...
class Solution: def rob(self, nums: List[int]) -> int: if not nums: raise exception('Empty Array') if len(nums) == 1: return nums[0] if len(nums) == 2: return max(nums[0], nums[1]) dp_0 = [0] * len(nums) dp_0[0] = nums[0] dp_0[1] =...
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class FreeObject(object): pass class Solution: # @param {ListNode} l1 # @param {ListNode} l2 # @return {ListNode} def addTwoNumbers(self, l1, l2): bk = l3...
class Freeobject(object): pass class Solution: def add_two_numbers(self, l1, l2): bk = l3 = free_object() rest = 0 while l1 or l2 or rest: su = (l1.val if l1 else 0) + (l2.val if l2 else 0) + rest l3.next = list_node(su % 10) rest = (0, 1)[su >= 10] ...
# from adventofcode._2020.day11.challenge import main def test_input(): pass
def test_input(): pass
def largest_prime_factor(number): factor = 2 while number != 1: if number % factor == 0: number /= factor else: factor += 1 return factor
def largest_prime_factor(number): factor = 2 while number != 1: if number % factor == 0: number /= factor else: factor += 1 return factor
class Solution: def coinChange(self, coins, amount): if amount == 0: return 0 dp = [2 << 63] * (amount + 1) for coin in coins: if coin <= amount: dp[coin] = 1 for i in range(1, amount + 1): for j in range(len(coins)): ...
class Solution: def coin_change(self, coins, amount): if amount == 0: return 0 dp = [2 << 63] * (amount + 1) for coin in coins: if coin <= amount: dp[coin] = 1 for i in range(1, amount + 1): for j in range(len(coins)): ...
val = input() matsubi = val[-1:] if matsubi == "s": val2 = val + "es" else: val2 = val + "s" print(val2)
val = input() matsubi = val[-1:] if matsubi == 's': val2 = val + 'es' else: val2 = val + 's' print(val2)
# -*- coding: utf-8 -*- # @Time : 2020/8/26-19:48 # @Author : TuringEmmy # @Email : yonglonggeng@163.com # @WeChat : csy_lgy # @File : height_weight.py # @Project : Happy-Algorithm def first(): times = int(input()) height = input().split() weight = input().split() heights = [int(i) ...
def first(): times = int(input()) height = input().split() weight = input().split() heights = [int(i) for i in height] weights = [int(i) for i in weight] data_list = [[i + 1, heights[i], weights[i]] for i in range(times)] sor = lambda x: x[0] sor(data_list) print(data_list) def seco...
# Turtle topic name and type key constant KEY_TOPIC_MSG_TYPE = 'msg_type' KEY_TOPIC_NAME = 'name' # Logging frequency in seconds LOG_FREQUENCY = 10 # Publisher/Subscriber Queue size QUEUE_SIZE = 10 # Set angle and distance thresholds ANGULAR_DIST_THRESHOLD = 0.05 LINEAR_DIST_THRESHOLD = 0.05
key_topic_msg_type = 'msg_type' key_topic_name = 'name' log_frequency = 10 queue_size = 10 angular_dist_threshold = 0.05 linear_dist_threshold = 0.05
config = { "interfaces": { "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner": { "retry_codes": { "idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], "non_idempotent": [], }, "retry_params": { "default": { ...
config = {'interfaces': {'google.cloud.websecurityscanner.v1alpha.WebSecurityScanner': {'retry_codes': {'idempotent': ['DEADLINE_EXCEEDED', 'UNAVAILABLE'], 'non_idempotent': []}, 'retry_params': {'default': {'initial_retry_delay_millis': 100, 'retry_delay_multiplier': 1.3, 'max_retry_delay_millis': 60000, 'initial_rpc_...
infile=open('baublesin.txt','r').readline() ro,bo,s,rp,bp=map(int,infile.split()) answer=0 r=ro-rp b=bo-bp if s==0: if r<0 or b<0: answer=0 elif r>=b: if bo==0 or bp==0: answer+=r+1 else: answer+=b+1 elif b>r: if ro==0 or rp==0: ...
infile = open('baublesin.txt', 'r').readline() (ro, bo, s, rp, bp) = map(int, infile.split()) answer = 0 r = ro - rp b = bo - bp if s == 0: if r < 0 or b < 0: answer = 0 elif r >= b: if bo == 0 or bp == 0: answer += r + 1 else: answer += b + 1 elif b > r: ...
# Symbol of circle required to show Celsius degree on display. circle = [ [0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], ...
circle = [[0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]
# # PySNMP MIB module SONUS-NODE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SONUS-NODE-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:09:55 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...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, single_value_constraint, value_range_constraint, value_size_constraint) ...
# Lesson2: Operators with strings # source: code/strings_operators.py a = 'hello' b = 'class' c = '' c = a + b print(c) c = a * 5 print(c) c = 10 * b print(c)
a = 'hello' b = 'class' c = '' c = a + b print(c) c = a * 5 print(c) c = 10 * b print(c)
# CPU: 0.05 s instructions = input() nop_count = 0 idx = 0 for char in instructions: if char.isupper() and idx % 4 != 0: add = 4 * (idx // 4 + 1) - idx idx += add nop_count += add idx += 1 print(nop_count)
instructions = input() nop_count = 0 idx = 0 for char in instructions: if char.isupper() and idx % 4 != 0: add = 4 * (idx // 4 + 1) - idx idx += add nop_count += add idx += 1 print(nop_count)
# # PySNMP MIB module BayNetworks-AHB-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BayNetworks-AHB-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:25:19 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, value_size_constraint, value_range_constraint, constraints_union) ...
a = [1, 2, 3] a.append(4) a a.extend(5) a a.extend([5]) a a.insert(10, 3) a a.insert(3, 10) a a = [1, 2, 3] a a.append(4) a a.append(5) a a.extend([6, 7]) a a.extend(8) help(a.insert) a.insert(0, 10) a a.insert(2, 12) a a.remove(10) a a.remove(12) a a.append(1) a a.remove(1) a a.remove(1) a a.pop(0) a a.pop(1) a a = [1...
a = [1, 2, 3] a.append(4) a a.extend(5) a a.extend([5]) a a.insert(10, 3) a a.insert(3, 10) a a = [1, 2, 3] a a.append(4) a a.append(5) a a.extend([6, 7]) a a.extend(8) help(a.insert) a.insert(0, 10) a a.insert(2, 12) a a.remove(10) a a.remove(12) a a.append(1) a a.remove(1) a a.remove(1) a a.pop(0) a a.pop(1) a a = [1...
# ***************************************************************************** # Copyright 2004-2008 Steve Menard # # 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 # # htt...
class Windowadapter(object): def __init__(self, *mth, **kw): object.__init__(self) for (i, j) in kw.items(): setattr(self, i, j) def window_activated(self, e): pass def window_closed(self, e): pass def window_closing(self, e): pass def window_...
def run(): @_core.listen('test') def _(): print('a test 2') @_core.on('test') def _(): print('a test') _emit('test') _emit('test') _emit('test')
def run(): @_core.listen('test') def _(): print('a test 2') @_core.on('test') def _(): print('a test') _emit('test') _emit('test') _emit('test')
# Python3 program to generate pythagorean # triplets smaller than a given limit # Function to generate pythagorean # triplets smaller than limit def pythagoreanTriplets(limits) : c, m = 0, 2 # Limiting c would limit # all a, b and c while c < limits : # Now loop on n from 1 to m-1 for n in range(1...
def pythagorean_triplets(limits): (c, m) = (0, 2) while c < limits: for n in range(1, m): a = m * m - n * n b = 2 * m * n c = m * m + n * n if c > limits: break print(a, b, c) m = m + 1 if __name__ == '__main__': lim...
# https://www.acmicpc.net/problem/2580 def init(): for row in range(N): for col in range(N): if data[row][col] == 0: continue row_sets[row].add(data[row][col]) for col in range(N): for row in range(N): if data[row][col] == 0: ...
def init(): for row in range(N): for col in range(N): if data[row][col] == 0: continue row_sets[row].add(data[row][col]) for col in range(N): for row in range(N): if data[row][col] == 0: continue col_sets[col].add(da...
# https://leetcode.com/problems/letter-case-permutation/ # Given a string s, we can transform every letter individually to be lowercase or # uppercase to create another string. # Return a list of all possible strings we could create. You can return the output # in any order. #########################################...
class Solution: def letter_case_permutation(self, S: str) -> List[str]: if not S: return [] self.n = len(S) self.S = S self.ans = [] self.holder = [] self.dfs(0) return self.ans def dfs(self, pos): if len(self.holder) == self.n: ...
def sockMerchant(n, ar): # Write your code here dict_count = {i:ar.count(i) for i in ar} pairs = 0 for v in dict_count.values(): pairs+=v//2 #to get the quotient, % is used for remainder #print(pairs, dict_count) return pairs a = 9 ar= [10, 20, 20, 10, 10, 30, 50, 10, 20] print(sockMer...
def sock_merchant(n, ar): dict_count = {i: ar.count(i) for i in ar} pairs = 0 for v in dict_count.values(): pairs += v // 2 return pairs a = 9 ar = [10, 20, 20, 10, 10, 30, 50, 10, 20] print(sock_merchant(a, ar))
# # Copyright 2018 Red Hat | Ansible # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # ...
class Moduledocfragment(object): documentation = '\noptions:\n resource_definition:\n description:\n - "Provide a valid YAML definition (either as a string, list, or dict) for an object when creating or updating. NOTE: I(kind), I(api_version), I(name),\n and I(namespace) will be overwritten by correspon...
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------- # CISCO-PPPOE-MIB # Compiled MIB # Do not modify this file directly # Run ./noc mib make_cmib instead # ---------------------------------------------------------------------- # Copyright (C) 2007-2014 The NOC Proje...
name = 'CISCO-PPPOE-MIB' last_updated = '2011-04-25' compiled = '2014-11-21' mib = {'CISCO-PPPOE-MIB::ciscoPppoeMIB': '1.3.6.1.4.1.9.9.194', 'CISCO-PPPOE-MIB::ciscoPppoeMIBObjects': '1.3.6.1.4.1.9.9.194.1', 'CISCO-PPPOE-MIB::cPppoeSystemSessionInfo': '1.3.6.1.4.1.9.9.194.1.1', 'CISCO-PPPOE-MIB::cPppoeSystemCurrSessions...
rows, cols = [int(x) for x in input().split(' ')] matrix = [input().split() for _ in range(rows)] cmd = input() while cmd != 'END': cmd_args = cmd.split() if cmd_args[0] != 'swap' or len(cmd_args) != 5: print('Invalid input!') cmd = input() continue row1, col1 = int(cmd_args[1]), ...
(rows, cols) = [int(x) for x in input().split(' ')] matrix = [input().split() for _ in range(rows)] cmd = input() while cmd != 'END': cmd_args = cmd.split() if cmd_args[0] != 'swap' or len(cmd_args) != 5: print('Invalid input!') cmd = input() continue (row1, col1) = (int(cmd_args[1])...
# #1 # def last(*args): # last = args[-1] # try: # return last[-1] # except TypeError: # return last #2 def last(*args): try: return args[-1][-1] except: return args[-1]
def last(*args): try: return args[-1][-1] except: return args[-1]
def setup(): size(500, 500) smooth() noLoop() def draw(): background(100) stroke(142,36,197) strokeWeight(110) line(100, 150, 400, 150) stroke(203,29,163) strokeWeight(60) line(100, 250, 400, 250) stroke(204,27,27) strokeWeight(110) line(100, 350, ...
def setup(): size(500, 500) smooth() no_loop() def draw(): background(100) stroke(142, 36, 197) stroke_weight(110) line(100, 150, 400, 150) stroke(203, 29, 163) stroke_weight(60) line(100, 250, 400, 250) stroke(204, 27, 27) stroke_weight(110) line(100, 350, 400, 350)
class BadGrammarError(Exception): pass class EmptyGrammarError(BadGrammarError): pass
class Badgrammarerror(Exception): pass class Emptygrammarerror(BadGrammarError): pass
# Tutorial: http://www.learnpython.org/en/Loops # Loops # There are two types of loops in Python, for and while. # The "for" loop # For loops iterate over a given sequence. Here is an example: primes = [2, 3, 5, 7] for prime in primes: print(prime) # For loops can iterate over a sequence of numbers using th...
primes = [2, 3, 5, 7] for prime in primes: print(prime) for x in range(5): print(x) for x in range(3, 6): print(x) for x in range(3, 8, 2): print(x) count = 0 while count < 5: print(count) count += 1 count = 0 while True: print(count) count += 1 if count >= 5: break for x in ...
with open('recovered/arc/clusters/6.0.0_r1_acdc_clustered.rsf', encoding="utf8") as data_file: data = data_file.readlines() cluster = set() for line in data: cluster.add(line.split(" ")[1]) print(len(cluster))
with open('recovered/arc/clusters/6.0.0_r1_acdc_clustered.rsf', encoding='utf8') as data_file: data = data_file.readlines() cluster = set() for line in data: cluster.add(line.split(' ')[1]) print(len(cluster))
# Find square of a number without using multiplication and division operator def main(): a = -10 if a < 0: a = abs(a) square = 0 for i in range(0, a): square += a print(square) if __name__ == '__main__': main()
def main(): a = -10 if a < 0: a = abs(a) square = 0 for i in range(0, a): square += a print(square) if __name__ == '__main__': main()
def func(a, b): # a is state 1 # b is state 2 # this is horrible code but it works! :^) s = r"\frac{1}{6}" s1 = r"\frac{1}{2}" s2 = r"\frac{1}{3}" if a == 19 and b != 19: return 0 if a == b: if a == 19: return 1 else: return 0 ...
def func(a, b): s = '\\frac{1}{6}' s1 = '\\frac{1}{2}' s2 = '\\frac{1}{3}' if a == 19 and b != 19: return 0 if a == b: if a == 19: return 1 else: return 0 elif a == 0: if b <= 6: return s else: return 0 e...
# This file contains the credentials needed to connect to and use the TTN Lorawan network # # Steps: # 1. Populate the values below from your TTN configuration and device/modem. # (For RAK Wireless devices the dev_eui is printed on top of the device.) # 2.Then rename the file to: creds_config.py # # Done, the file ...
dev_eui = 'XXXXXXXXXXXXXX' dev_eui_rak4200 = 'XXXXXXXXXXXXXX' dev_eui_rak3172 = 'XXXXXXXXXXXXXX' app_eui = 'YYYYYYYYYYYYYY' app_key = 'ZZZZZZZZZZZZZZ'
def main(): n, m = [int(x) for x in input().split()] def wczytajJiro(): defs = [0]*n atks = [0]*n both = [0]*2*n defi = atki = bothi = 0 for i in range(n): pi, si = input().split() if (pi == 'ATK'): atks[atki] = int(si) ...
def main(): (n, m) = [int(x) for x in input().split()] def wczytaj_jiro(): defs = [0] * n atks = [0] * n both = [0] * 2 * n defi = atki = bothi = 0 for i in range(n): (pi, si) = input().split() if pi == 'ATK': atks[atki] = int(si) ...
load_modules = { 'hw_USBtin': {'port':'auto', 'debug':2, 'speed':500}, # IO hardware module 'ecu_controls': {'bus':'BMW_F10', 'commands':[ # Music actions {'High light - blink': '0x1ee:2:20ff', 'cmd':'127'}, {'TURN LEFT and RIGHT': '0x2fc:7:31000000000000', 'cmd':'126'}, ...
load_modules = {'hw_USBtin': {'port': 'auto', 'debug': 2, 'speed': 500}, 'ecu_controls': {'bus': 'BMW_F10', 'commands': [{'High light - blink': '0x1ee:2:20ff', 'cmd': '127'}, {'TURN LEFT and RIGHT': '0x2fc:7:31000000000000', 'cmd': '126'}, {'TURN right ON PERMANENT': '0x1ee:2:01ff', 'cmd': '124'}, {'TURN right x3 or OF...
#!/usr/bin/env python3 fname = input("Enter file name: ") fh = open(fname) lst = list() sorted_words = list() for line in fh: line = line.rstrip() words = line.split() for word in words: if lst.count(word) == 0: lst.append(word) lst.sort() print(lst)
fname = input('Enter file name: ') fh = open(fname) lst = list() sorted_words = list() for line in fh: line = line.rstrip() words = line.split() for word in words: if lst.count(word) == 0: lst.append(word) lst.sort() print(lst)
# Python3 program to add two numbers number1 = input("First number: ") number2 = input("\nSecond number: ") # Adding two numbers # User might also enter float numbers sum = float(number1) + float(number2) # Display the sum # will print value in float print("The sum of {0} and {1} is {2}" .format(number1, numbe...
number1 = input('First number: ') number2 = input('\nSecond number: ') sum = float(number1) + float(number2) print('The sum of {0} and {1} is {2}'.format(number1, number2, sum))
class Solution: # @param {string} a a number # @param {string} b a number # @return {string} the result def addBinary(self, a, b): # Write your code here max_len = max(len(a), len(b)) a = a.zfill(max_len) b = b.zfill(max_len) result = '' carry = 0 ...
class Solution: def add_binary(self, a, b): max_len = max(len(a), len(b)) a = a.zfill(max_len) b = b.zfill(max_len) result = '' carry = 0 for (a, b) in zip(a, b)[::-1]: bits_sum = carry bits_sum += int(a) + int(b) result = ('0' if ...
class Solution: def dailyTemperatures(self, T: list) -> list: if len(T) == 1: return [0] else: mono_stack = [(T[0], 0)] i = 1 res = [0] * len(T) while i < len(T): if T[i] <= mono_stack[-1][0]: ...
class Solution: def daily_temperatures(self, T: list) -> list: if len(T) == 1: return [0] else: mono_stack = [(T[0], 0)] i = 1 res = [0] * len(T) while i < len(T): if T[i] <= mono_stack[-1][0]: mono_stac...
with open("inputs_7.txt") as f: inputs = [x.strip() for x in f.readlines()] ex_inputs= [ "shiny gold bags contain 2 dark red bags.", "dark red bags contain 2 dark orange bags.", "dark orange bags contain 2 dark yellow bags.", "dark yellow bags contain 2 dark green bags.", "dark green bags contain 2 dark blue b...
with open('inputs_7.txt') as f: inputs = [x.strip() for x in f.readlines()] ex_inputs = ['shiny gold bags contain 2 dark red bags.', 'dark red bags contain 2 dark orange bags.', 'dark orange bags contain 2 dark yellow bags.', 'dark yellow bags contain 2 dark green bags.', 'dark green bags contain 2 dark blue bags.'...
#Simple calculator def add(x,y): return x+y def subs(x,y): return x-y def multi(x,y): return x*y def divide(x,y): return x/y num1 = int(input("Enter the Value of Num1 :")) num2 = int(input("Enter the Value of NUm2 :")) print("Choose 1 for '+'/ 2 for '-'/ 3 for '*'/ 4 for '/' :-") select = int(inpu...
def add(x, y): return x + y def subs(x, y): return x - y def multi(x, y): return x * y def divide(x, y): return x / y num1 = int(input('Enter the Value of Num1 :')) num2 = int(input('Enter the Value of NUm2 :')) print("Choose 1 for '+'/ 2 for '-'/ 3 for '*'/ 4 for '/' :-") select = int(input('Enter t...
PI = float(3.14159) raio = float(input()) print("A=%0.4f" %(PI * (raio * raio)))
pi = float(3.14159) raio = float(input()) print('A=%0.4f' % (PI * (raio * raio)))
x = {} with open('input.txt', 'r', encoding='utf8') as f: for line in f: line = line.strip() x[line] = x.get(line, 0) + 1 lol = [(y, x) for x, y in x.items()] lol.sort() with open('output.txt', 'w', encoding='utf8') as f: if lol[-1][0] / sum(x.values()) > 0.5: f.write(lol[-1][1]) el...
x = {} with open('input.txt', 'r', encoding='utf8') as f: for line in f: line = line.strip() x[line] = x.get(line, 0) + 1 lol = [(y, x) for (x, y) in x.items()] lol.sort() with open('output.txt', 'w', encoding='utf8') as f: if lol[-1][0] / sum(x.values()) > 0.5: f.write(lol[-1][1]) e...
{ "includes": [ "drafter/common.gypi" ], "targets": [ { "target_name": "protagonist", "include_dirs": [ "drafter/src", "<!(node -e \"require('nan')\")" ], "sources": [ "src/options_parser.cc", "src/parse_async.cc", "src/parse_sync.cc", ...
{'includes': ['drafter/common.gypi'], 'targets': [{'target_name': 'protagonist', 'include_dirs': ['drafter/src', '<!(node -e "require(\'nan\')")'], 'sources': ['src/options_parser.cc', 'src/parse_async.cc', 'src/parse_sync.cc', 'src/protagonist.cc', 'src/protagonist.h', 'src/refractToV8.cc', 'src/validate_async.cc', 's...
# Chalk Damage Skin success = sm.addDamageSkin(2433236) if success: sm.chat("The Chalk Damage Skin has been added to your account's damage skin collection.")
success = sm.addDamageSkin(2433236) if success: sm.chat("The Chalk Damage Skin has been added to your account's damage skin collection.")
N_T = input().split() N = int(N_T[0]) T = int(N_T[1]) interactions = [] input_condition = input() conditions = list(input_condition) conditions = [int(x) for x in conditions] for x in range(T): input_line = input().split() input_line = [int(x) for x in input_line] interactions.append(input_lin...
n_t = input().split() n = int(N_T[0]) t = int(N_T[1]) interactions = [] input_condition = input() conditions = list(input_condition) conditions = [int(x) for x in conditions] for x in range(T): input_line = input().split() input_line = [int(x) for x in input_line] interactions.append(input_line) sorted_inte...
#WAP to calculate and display the factorial of #an inputted number. num = int(input("enter the range for factorial: ")) f = 1 if num < 0: print("factorial does not exist") elif num == 0: print("The factorial of 0 is 1") else: for i in range(1,num + 1): f = f * i print("The factorial ...
num = int(input('enter the range for factorial: ')) f = 1 if num < 0: print('factorial does not exist') elif num == 0: print('The factorial of 0 is 1') else: for i in range(1, num + 1): f = f * i print('The factorial of', num, 'is', f)
def pascal_nth_row(line_num): if line_num == 0: return [1] line = [1] last_line = pascal_nth_row(line_num - 1) for i in range(len(last_line) - 1): line.append(last_line[i] + last_line[i + 1]) line.append(1) # line here will the line at num line_num return line print(pasca...
def pascal_nth_row(line_num): if line_num == 0: return [1] line = [1] last_line = pascal_nth_row(line_num - 1) for i in range(len(last_line) - 1): line.append(last_line[i] + last_line[i + 1]) line.append(1) return line print(pascal_nth_row(5))
#Attept a def isPerfectSquare(n): if n <= 1: return True start = 0 end = n//2 while((end - start) > 1): mid = (start + end)//2 sq = mid*mid print(mid, sq, start, end) if sq == n: return True if sq > n: end = mid if sq < ...
def is_perfect_square(n): if n <= 1: return True start = 0 end = n // 2 while end - start > 1: mid = (start + end) // 2 sq = mid * mid print(mid, sq, start, end) if sq == n: return True if sq > n: end = mid if sq < n: ...
#!/usr/bin/env python # -*- coding: utf-8 -*- base_url = "https://es.wikiquote.org/w/api.php" quote_of_the_day_url = "https://es.wikiquote.org/wiki/Portada" def quote_of_the_day_parser(html): table = html("table")[1]("table")[0] quote = table("td")[3].text.strip() author = table("td")[5].div.a.text.strip(...
base_url = 'https://es.wikiquote.org/w/api.php' quote_of_the_day_url = 'https://es.wikiquote.org/wiki/Portada' def quote_of_the_day_parser(html): table = html('table')[1]('table')[0] quote = table('td')[3].text.strip() author = table('td')[5].div.a.text.strip() return (quote, author) non_quote_sections...
# membuat tupple buah = ('anggur', 'jeruk', 'mangga') print(buah) # output: ('anggur', 'jeruk', 'mangga')
buah = ('anggur', 'jeruk', 'mangga') print(buah)
class Solution: def searchMatrix(self, matrix: 'List[List[int]]', target: int) -> bool: m = len(matrix) if m == 0: return False n = len(matrix[0]) if n == 0: return False left, right = 0, m * n while left + 1 < right: mid = (left + ...
class Solution: def search_matrix(self, matrix: 'List[List[int]]', target: int) -> bool: m = len(matrix) if m == 0: return False n = len(matrix[0]) if n == 0: return False (left, right) = (0, m * n) while left + 1 < right: mid = le...
#Eoin Lees student = { "name":"Mary", "modules": [ { "courseName":"Programming", "grade":45 }, { "courseName":"History", "grade":99 } ] } print ("Student: {}".format(student["name"])) for module in student["modules"]: print...
student = {'name': 'Mary', 'modules': [{'courseName': 'Programming', 'grade': 45}, {'courseName': 'History', 'grade': 99}]} print('Student: {}'.format(student['name'])) for module in student['modules']: print('\t {} \t: {}'.format(module['courseName'], module['grade']))
# crypto_test.py 21/05/2016 D.J.Whale # # Placeholder for test harness for crypto.py #TODO: print("no tests defined") # END
print('no tests defined')
class Node: def __init__(self, data): self.data = data self.both = id(data) def __repr__(self): return str(self.data) a = Node("a") b = Node("b") c = Node("c") d = Node("d") e = Node("e") # id_map simulates object pointer values id_map = dict() id_map[id("a")] = a id_map[id("b")] = b ...
class Node: def __init__(self, data): self.data = data self.both = id(data) def __repr__(self): return str(self.data) a = node('a') b = node('b') c = node('c') d = node('d') e = node('e') id_map = dict() id_map[id('a')] = a id_map[id('b')] = b id_map[id('c')] = c id_map[id('d')] = d id...
#!/usr/bin/env python3 # --------------------( LICENSE )-------------------- # Copyright (c) 2014-2022 Beartype authors. # See "LICENSE" for further details. ''' Project-wide **unimportable data submodule.** This submodule exercises dynamic importability by providing an unimportable submodul...
""" Project-wide **unimportable data submodule.** This submodule exercises dynamic importability by providing an unimportable submodule defining an arbitrary attribute. External unit tests are expected to dynamically import this attribute from this submodule. """ raise value_error('Can you imagine a fulfilled society?...
while True: print("hello") if 2<1: 2 print('hi')
while True: print('hello') if 2 < 1: 2 print('hi')
''' A submodule for doing basic error analysis for experimental physics results. ''' def average(values): # TODO: add documentation pass def percent_diff(expected, actual): # TODO: add documentation pass
""" A submodule for doing basic error analysis for experimental physics results. """ def average(values): pass def percent_diff(expected, actual): pass
# A list is a collection which is ordered and changeable. In Python lists are written with square brackets. thislist = ["apple", "banana", "cherry", "orange", "kiwi", "melon", "mango"] print(thislist) # You access the list items by referring to the index number # Print the second item of the list print("The second e...
thislist = ['apple', 'banana', 'cherry', 'orange', 'kiwi', 'melon', 'mango'] print(thislist) print('The second element of list are:' + thislist[1]) print('The last element of list are:' + thislist[-1]) print('The 3rd 4th and 5th item of list are:') print(thislist[2:5]) print(thislist[:4]) print(thislist[2:]) print(this...
with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="gprpy", version="1.0.8", author="Alain Plattner", author_email="plattner@alumni.ethz.ch", description="GPRPy - open source ground penetrating radar processing and visualization", entry_points={'cons...
with open('README.md', 'r') as fh: long_description = fh.read() setuptools.setup(name='gprpy', version='1.0.8', author='Alain Plattner', author_email='plattner@alumni.ethz.ch', description='GPRPy - open source ground penetrating radar processing and visualization', entry_points={'console_scripts': ['gprpy = gprpy._...
class _Emojis: def __init__(self): self.key = "\U0001F511" self.link = "\U0001F4CE" self.alert = "\U0001F6A8" self.ghost = "\U0001F47B" self.package = "\U0001F4E6" self.folder = "\U0001F5C2" self.bell = "\U0001F514" self.dissy = "\U0001F4AB" se...
class _Emojis: def __init__(self): self.key = 'πŸ”‘' self.link = 'πŸ“Ž' self.alert = '🚨' self.ghost = 'πŸ‘»' self.package = 'πŸ“¦' self.folder = 'πŸ—‚' self.bell = 'πŸ””' self.dissy = 'πŸ’«' self.genie = '🧞' self.linked_paperclip = 'πŸ–‡' se...
icu_sources = [ 'utypes.cpp', 'uloc.cpp', 'ustring.cpp', 'ucase.cpp', 'ubrk.cpp', 'brkiter.cpp', 'filteredbrk.cpp', 'ucharstriebuilder.cpp', 'uobject.cpp', 'resbund.cpp', 'servrbf.cpp', 'servlkf.cpp', 'serv.cpp', 'servnotf.cpp', 'servls.cpp', 'servlk.cpp',...
icu_sources = ['utypes.cpp', 'uloc.cpp', 'ustring.cpp', 'ucase.cpp', 'ubrk.cpp', 'brkiter.cpp', 'filteredbrk.cpp', 'ucharstriebuilder.cpp', 'uobject.cpp', 'resbund.cpp', 'servrbf.cpp', 'servlkf.cpp', 'serv.cpp', 'servnotf.cpp', 'servls.cpp', 'servlk.cpp', 'servslkf.cpp', 'stringtriebuilder.cpp', 'uvector.cpp', 'ustrenu...
while(True): try: x, a, y, b = map(int, input().split()) if(x * b == a * y): print("=") elif (x * b > a * y): print(">") else: print("<") except: exit()
while True: try: (x, a, y, b) = map(int, input().split()) if x * b == a * y: print('=') elif x * b > a * y: print('>') else: print('<') except: exit()
META = [{ 'lookup': 'city', 'tag': 'city', 'path': ['names','en'], },{ 'lookup': 'continent', 'tag': 'continent', 'path': ['names','en'], },{ 'lookup': 'continent_code', 'tag': 'continent', 'path': ['code'], },{ 'loo...
meta = [{'lookup': 'city', 'tag': 'city', 'path': ['names', 'en']}, {'lookup': 'continent', 'tag': 'continent', 'path': ['names', 'en']}, {'lookup': 'continent_code', 'tag': 'continent', 'path': ['code']}, {'lookup': 'country', 'tag': 'country', 'path': ['names', 'en']}, {'lookup': 'iso_code', 'tag': 'country', 'path':...
# Example: Fetch single bridge by ID my_bridge = api.get_bridge('brg-bridgeId') print(my_bridge) ## { 'bridgeAudio': True, ## 'calls' : 'https://api.catapult.inetwork.com/v1/users/u-123/bridges/brg-bridgeId/calls', ## 'createdTime': '2017-01-26T01:15:09Z', ## 'id' : 'brg-bridgeId', ## 's...
my_bridge = api.get_bridge('brg-bridgeId') print(my_bridge) print(my_bridge['state'])
class Solution: def isAdditiveNumber(self, num: str) -> bool: l = len(num) for i in range(1, (2 * l) // 3): for j in range(0, i): if num[0] == "0" and j + 1 != 1: break if num[j + 1] == "0" and i - j != 1: continue ...
class Solution: def is_additive_number(self, num: str) -> bool: l = len(num) for i in range(1, 2 * l // 3): for j in range(0, i): if num[0] == '0' and j + 1 != 1: break if num[j + 1] == '0' and i - j != 1: continue ...
# Database Config config = { 'MYSQL_DATABASE_USER' : 'root', #Username for mysql 'MYSQL_DATABASE_DB' : 'CoveServices', 'MYSQL_DATABASE_PASSWORD' : 'root', # Password to connect to mysql 'MYSQL_DATABASE_HOST' : 'localhost', 'USERNAME' : '', 'USERID' :'', }
config = {'MYSQL_DATABASE_USER': 'root', 'MYSQL_DATABASE_DB': 'CoveServices', 'MYSQL_DATABASE_PASSWORD': 'root', 'MYSQL_DATABASE_HOST': 'localhost', 'USERNAME': '', 'USERID': ''}
nota1 = float(input()) while nota1 > 10 or nota1 < 0: print('nota invalida') nota1 = float(input()) nota2 = float(input()) while nota2 > 10 or nota2 < 0: print('nota invalida') nota2 = float(input()) media = (nota1+nota2)/2 print('media = %.2f'%media)
nota1 = float(input()) while nota1 > 10 or nota1 < 0: print('nota invalida') nota1 = float(input()) nota2 = float(input()) while nota2 > 10 or nota2 < 0: print('nota invalida') nota2 = float(input()) media = (nota1 + nota2) / 2 print('media = %.2f' % media)
# -*- coding: utf-8 -*- # TODO: deprecated URL_DID_SIGN_IN = '/api/v2/did/signin' URL_DID_AUTH = '/api/v2/did/auth' URL_DID_BACKUP_AUTH = '/api/v2/did/backup_auth' URL_BACKUP_SERVICE = '/api/v2/internal_backup/service' URL_BACKUP_FINISH = '/api/v2/internal_backup/finished_confirmation' URL_BACKUP_FILES = '/api/v2/inte...
url_did_sign_in = '/api/v2/did/signin' url_did_auth = '/api/v2/did/auth' url_did_backup_auth = '/api/v2/did/backup_auth' url_backup_service = '/api/v2/internal_backup/service' url_backup_finish = '/api/v2/internal_backup/finished_confirmation' url_backup_files = '/api/v2/internal_backup/files' url_backup_file = '/api/v...
def input(channel): pass def wait_for_edge(channel, edge_type, timeout=None): pass def add_event_detect(channel, edge_type, callback=None, bouncetime=None): pass def add_event_callback(channel, callback, bouncetime=None): pass def event_detected(channel): pass def remove_event_detect(chann...
def input(channel): pass def wait_for_edge(channel, edge_type, timeout=None): pass def add_event_detect(channel, edge_type, callback=None, bouncetime=None): pass def add_event_callback(channel, callback, bouncetime=None): pass def event_detected(channel): pass def remove_event_detect(channel): ...
class Solution: def generateParenthesis(self, n: int) -> List[str]: st = [] res = [] def backtracking(op ,cl): if op == cl == n : res.append("".join(st)) return if op < n : st.append("(") ...
class Solution: def generate_parenthesis(self, n: int) -> List[str]: st = [] res = [] def backtracking(op, cl): if op == cl == n: res.append(''.join(st)) return if op < n: st.append('(') backtracking(op...
# Do not edit this file directly. # It was auto-generated by: code/programs/reflexivity/reflexive_refresh load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def glog(): http_archive( name="glog" , sha256="bae42ec37b50e156071f5b92d2ff09aa5ece56fd8c58d2175fc1ffea85137664" , ...
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') def glog(): http_archive(name='glog', sha256='bae42ec37b50e156071f5b92d2ff09aa5ece56fd8c58d2175fc1ffea85137664', strip_prefix='glog-0a2e5931bd5ff22fd3bf8999eb8ce776f159cda6', urls=['https://github.com/Unilang/glog/archive/0a2e5931bd5ff22fd3bf8999...
''' Created on 14.10.2019 @author: JM ''' class TMC2130_register_variant: " ===== TMC2130 register variants ===== " "..."
""" Created on 14.10.2019 @author: JM """ class Tmc2130_Register_Variant: """ ===== TMC2130 register variants ===== """ '...'
# Rainbow Grid handgezeichnet add_library('handy') def setup(): global h h = HandyRenderer(this) size(600, 600) this.surface.setTitle("Rainbow Grid Handy") rectMode(CENTER) h.setRoughness(1) h.setFillWeight(0.9) h.setFillGap(0.9) def draw(): colorMode(RGB) background(235, 215, ...
add_library('handy') def setup(): global h h = handy_renderer(this) size(600, 600) this.surface.setTitle('Rainbow Grid Handy') rect_mode(CENTER) h.setRoughness(1) h.setFillWeight(0.9) h.setFillGap(0.9) def draw(): color_mode(RGB) background(235, 215, 182) color_mode(HSB) ...
set_name(0x800A0CD8, "VID_OpenModule__Fv", SN_NOWARN) set_name(0x800A0D98, "InitScreens__Fv", SN_NOWARN) set_name(0x800A0E88, "MEM_SetupMem__Fv", SN_NOWARN) set_name(0x800A0EB4, "SetupWorkRam__Fv", SN_NOWARN) set_name(0x800A0F44, "SYSI_Init__Fv", SN_NOWARN) set_name(0x800A1050, "GM_Open__Fv", SN_NOWARN) set_name(0x800A...
set_name(2148142296, 'VID_OpenModule__Fv', SN_NOWARN) set_name(2148142488, 'InitScreens__Fv', SN_NOWARN) set_name(2148142728, 'MEM_SetupMem__Fv', SN_NOWARN) set_name(2148142772, 'SetupWorkRam__Fv', SN_NOWARN) set_name(2148142916, 'SYSI_Init__Fv', SN_NOWARN) set_name(2148143184, 'GM_Open__Fv', SN_NOWARN) set_name(214814...
__title__ = "Django REST framework Caching Tools" __version__ = "1.0.3" __author__ = "Vincent Wantchalk" __license__ = "MIT" __copyright__ = "Copyright 2011-2019 xsudo.com" # Version synonym VERSION = __version__ # Header encoding (see RFC5987) HTTP_HEADER_ENCODING = "iso-8859-1" default_app_config = "drf_cache.apps...
__title__ = 'Django REST framework Caching Tools' __version__ = '1.0.3' __author__ = 'Vincent Wantchalk' __license__ = 'MIT' __copyright__ = 'Copyright 2011-2019 xsudo.com' version = __version__ http_header_encoding = 'iso-8859-1' default_app_config = 'drf_cache.apps.DOTConfig'
# Generate input data for EM 514, Homework Problem 8 def DefineInputs(): area = 200.0e-6 nodes = [{'x': 0.0e0, 'y': 0.0e0, 'z': 0.0e0, 'xflag': 'd', 'xbcval': 0.0, 'yflag': 'd', 'ybcval': 0.0e0, 'zflag': 'd', 'zbcval': 0.0e0}] nodes.append({'x': 3.0e0, 'y': 0.0e0, 'z': 0.0e0, 'xflag': 'f', 'xb...
def define_inputs(): area = 0.0002 nodes = [{'x': 0.0, 'y': 0.0, 'z': 0.0, 'xflag': 'd', 'xbcval': 0.0, 'yflag': 'd', 'ybcval': 0.0, 'zflag': 'd', 'zbcval': 0.0}] nodes.append({'x': 3.0, 'y': 0.0, 'z': 0.0, 'xflag': 'f', 'xbcval': 0.0, 'yflag': 'f', 'ybcval': 0.0, 'zflag': 'd', 'zbcval': 0.0}) nodes.app...
n = int(input('Valor do produto: ')) val = (n*5) / 100 res = val print('O VALOR FINAL COM 5% DE DESCONTO VAI SER ${}:'.format(val))
n = int(input('Valor do produto: ')) val = n * 5 / 100 res = val print('O VALOR FINAL COM 5% DE DESCONTO VAI SER ${}:'.format(val))
quarter = (dta.inspection_date.dt.month - 1) // 3 quarter_size = dta.groupby((quarter, violation_num)).size() axes = quarter_size.unstack(level=0).plot.bar( figsize=(14, 8), )
quarter = (dta.inspection_date.dt.month - 1) // 3 quarter_size = dta.groupby((quarter, violation_num)).size() axes = quarter_size.unstack(level=0).plot.bar(figsize=(14, 8))
# pin numbers # http://micropython-on-wemos-d1-mini.readthedocs.io/en/latest/setup.html # https://forum.micropython.org/viewtopic.php?t=2503 D0 = 16 # wake D5 = 14 # sck D6 = 12 # miso D7 = 13 # mosi D8 = 15 # cs PULL-DOWN 10k D4 = 2 # boot PULL-UP 10k D3 = 0 # flash PULL-UP 10k D2 = 4 # sda D1 = 5 # scl RX...
d0 = 16 d5 = 14 d6 = 12 d7 = 13 d8 = 15 d4 = 2 d3 = 0 d2 = 4 d1 = 5 rx = 3 tx = 1 led = D4
CENTRALIZED = False EXAMPLE_PAIR = "ZRX-WETH" USE_ETHEREUM_WALLET = True FEE_TYPE = "FlatFee" FEE_TOKEN = "ETH" DEFAULT_FEES = [0, 0.00001]
centralized = False example_pair = 'ZRX-WETH' use_ethereum_wallet = True fee_type = 'FlatFee' fee_token = 'ETH' default_fees = [0, 1e-05]
''' 154. Find Minimum in Rotated Sorted Array II https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/ similar problem: "153. Find Minimum in Rotated Sorted Array" https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/ Suppose an array sorted in ascending order is rotated at some pivot u...
""" 154. Find Minimum in Rotated Sorted Array II https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/ similar problem: "153. Find Minimum in Rotated Sorted Array" https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/ Suppose an array sorted in ascending order is rotated at some pivot u...
def self_powers(final:int): sum_pows = 0 for integer in range(1, final + 1): power = 1 for _ in range(integer): power = (power * integer) % (10**11) sum_pows += power return sum_pows % (10 ** 10) if __name__ == "__main__": print(self_powers(1000))
def self_powers(final: int): sum_pows = 0 for integer in range(1, final + 1): power = 1 for _ in range(integer): power = power * integer % 10 ** 11 sum_pows += power return sum_pows % 10 ** 10 if __name__ == '__main__': print(self_powers(1000))
SP500 = {'A.O. Smith Corp': 'AOS', 'Abbott Laboratories': 'ABT', 'AbbVie Inc.': 'ABBV', 'Accenture plc': 'ACN', 'Activision Blizzard': 'ATVI', 'Acuity Brands Inc': 'AYI', 'Adobe Systems Inc': 'ADBE', 'Advance Auto Parts': 'AAP', 'Advanced Micro Dev...
sp500 = {'A.O. Smith Corp': 'AOS', 'Abbott Laboratories': 'ABT', 'AbbVie Inc.': 'ABBV', 'Accenture plc': 'ACN', 'Activision Blizzard': 'ATVI', 'Acuity Brands Inc': 'AYI', 'Adobe Systems Inc': 'ADBE', 'Advance Auto Parts': 'AAP', 'Advanced Micro Devices Inc': 'AMD', 'AES Corp': 'AES', 'Aetna Inc': 'AET', 'Affiliated Man...
a= int(input()) if (a%4 == 0) and (a%100 != 0): print(1) elif a%400 ==0: print(1) else: print(0)
a = int(input()) if a % 4 == 0 and a % 100 != 0: print(1) elif a % 400 == 0: print(1) else: print(0)
c = 0 while(True): c+=1 inp = input() if(inp == '0'): break n = int(inp) inp = input().split(' ') su = 0 for j in range(0,len(inp)): su += int(inp[j]) av = int(su / len(inp)) count = 0 for j in range(0,len(inp)): count += abs(av - int(inp[j])) print('Set #' + str(c)) print('The minimum...
c = 0 while True: c += 1 inp = input() if inp == '0': break n = int(inp) inp = input().split(' ') su = 0 for j in range(0, len(inp)): su += int(inp[j]) av = int(su / len(inp)) count = 0 for j in range(0, len(inp)): count += abs(av - int(inp[j])) print(...
# cook your dish here def highestPowerOf2(n): return (n & (~(n - 1))) for t in range(int(input())): ts=int(input()) sum=0 if ts%2==1: print((ts-1)//2) else: x=highestPowerOf2(ts) print(ts//((x*2)))
def highest_power_of2(n): return n & ~(n - 1) for t in range(int(input())): ts = int(input()) sum = 0 if ts % 2 == 1: print((ts - 1) // 2) else: x = highest_power_of2(ts) print(ts // (x * 2))
'''rig pipeline prototype by Ben Barker, copyright (c) 2015 ben.barker@gmail.com for license info see license.txt '''
"""rig pipeline prototype by Ben Barker, copyright (c) 2015 ben.barker@gmail.com for license info see license.txt """
def main(): # Manage input file input = open(r"C:\Users\lawht\Desktop\Github\ROSALIND\Bioinformatics Stronghold\(2) Transcribing DNA into RNA\(2) Transcribing DNA into RNA\rosalind_rna.txt","r"); DNA_string = input.readline(); # take first line of input file for counting # Take in input file of DNA st...
def main(): input = open('C:\\Users\\lawht\\Desktop\\Github\\ROSALIND\\Bioinformatics Stronghold\\(2) Transcribing DNA into RNA\\(2) Transcribing DNA into RNA\\rosalind_rna.txt', 'r') dna_string = input.readline() print(dna_to_rna(DNA_string)) input.close() def dna_to_rna(s): rna = '' for n in ...
class Solution: def minDifference(self, nums: List[int]) -> int: # pick three values if len(nums) <= 4: return 0 nums.sort() ans = nums[-1] - nums[0] for i in range(4): ans = min(nums[-1 - (3 - i)] - nums[i], ans) return ans
class Solution: def min_difference(self, nums: List[int]) -> int: if len(nums) <= 4: return 0 nums.sort() ans = nums[-1] - nums[0] for i in range(4): ans = min(nums[-1 - (3 - i)] - nums[i], ans) return ans
'''https://practice.geeksforgeeks.org/problems/bottom-view-of-binary-tree/1 https://www.geeksforgeeks.org/bottom-view-binary-tree/ Bottom View of Binary Tree Medium Accuracy: 45.32% Submissions: 90429 Points: 4 Given a binary tree, print the bottom view from left to right. A node is included in bottom view if it can b...
"""https://practice.geeksforgeeks.org/problems/bottom-view-of-binary-tree/1 https://www.geeksforgeeks.org/bottom-view-binary-tree/ Bottom View of Binary Tree Medium Accuracy: 45.32% Submissions: 90429 Points: 4 Given a binary tree, print the bottom view from left to right. A node is included in bottom view if it can b...
class dotControlObject_t(object): # no doc aName = None Color = None Extension = None IsMagnetic = None ModelObject = None Plane = None
class Dotcontrolobject_T(object): a_name = None color = None extension = None is_magnetic = None model_object = None plane = None
#Ask User for his role and save it in a variable role = input ("Are you an administrator, teacher, or student?: ") #If role "administrator or teacher" print they have keys if role == "administrator" or role == "teacher": print ("Administrators and teachers get keys!") #If role "Student" print they dont get ke...
role = input('Are you an administrator, teacher, or student?: ') if role == 'administrator' or role == 'teacher': print('Administrators and teachers get keys!') elif role == 'student': print('Students do not get keys') else: print('You can only be an administrator, teacher, or student!')
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # def f_gold ( k , s1 , s2 ) : n = len ( s1 ) m = len ( s2 ) lcs = [ [ 0 for x in range ( m + 1 ) ] for y in range ( n...
def f_gold(k, s1, s2): n = len(s1) m = len(s2) lcs = [[0 for x in range(m + 1)] for y in range(n + 1)] cnt = [[0 for x in range(m + 1)] for y in range(n + 1)] for i in range(1, n + 1): for j in range(1, m + 1): lcs[i][j] = max(lcs[i - 1][j], lcs[i][j - 1]) if s1[i - 1...
name = 'Zed A. Shaw' age = 35 height = 74 weight = 180 # lbs eyes = 'Blue' teeth = 'White' hair = 'Brown' print(f"Let's talk about {name}.") print(f"He's {height} inches tall.") print(f"He's {weight} pounds heavy.") print("Actually it's not too heavy") print(f"He's got {eyes} eyes and {hair} hair.") print(f"His teeth ...
name = 'Zed A. Shaw' age = 35 height = 74 weight = 180 eyes = 'Blue' teeth = 'White' hair = 'Brown' print(f"Let's talk about {name}.") print(f"He's {height} inches tall.") print(f"He's {weight} pounds heavy.") print("Actually it's not too heavy") print(f"He's got {eyes} eyes and {hair} hair.") print(f'His teeth are usu...
def get_data(path): try: file_handler = open(path, "r") except: return 0 data = [] for line in file_handler: values = line.strip().split(" ") data.append([int(values[1]), int(values[2]), int(values[3])]) return data def sensortxt_parser(path): order = ['lu', 'ru', 'lu', 'ru'] order2 = ['ld', 'rd', ...
def get_data(path): try: file_handler = open(path, 'r') except: return 0 data = [] for line in file_handler: values = line.strip().split(' ') data.append([int(values[1]), int(values[2]), int(values[3])]) return data def sensortxt_parser(path): order = ['lu', 'ru'...
# first line: 1 @mem.cache def get_data(filename): data=load_svmlight_file(filename) return data[0],data[1]
@mem.cache def get_data(filename): data = load_svmlight_file(filename) return (data[0], data[1])
# # Copyright 2017, Data61 # Commonwealth Scientific and Industrial Research Organisation (CSIRO) # ABN 41 687 119 230. # # This software may be distributed and modified according to the terms of # the BSD 2-Clause license. Note that NO WARRANTY is provided. # See "LICENSE_BSD2.txt" for details. # # @TAG(DATA61_BSD) # ...
""" Helpers for accessing architecture-specific information """ def is_64_bit_arch(arch): return arch in ('x86_64', 'aarch64') def min_untyped_size(arch): return 4 def max_untyped_size(arch): if is_64_bit_arch(arch): return 47 else: return 29