content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
#!/usr/bin/env python # Use generators to avoid crashed in memory when needed to interate on large set of data # Generators can be built with the syntax of list comprehensions but inside () names = ['Tim', 'Mark', 'Donna', 'Albert', 'Sara'] gen_a = (len(n) for n in names) print(next(gen_a)) print(next(gen_a)) # Yo...
names = ['Tim', 'Mark', 'Donna', 'Albert', 'Sara'] gen_a = (len(n) for n in names) print(next(gen_a)) print(next(gen_a)) def my_generator(): names = ['Gianluca', 'Lisa', 'Sofia', 'Giulia'] for i in names: yield i gen = my_generator() print(next(gen)) print(next(gen)) for val in gen: print(val)
def largest_product(a_list): if len(a_list) == 0: return False column = 0 row = 0 big = a_list[0][0] * a_list[0][1] while column < len(a_list) - 1: if a_list[column][row] * a_list[column][row + 1] > big: big = a_list[column][row] * a_list[column][row + 1] if a_lis...
def largest_product(a_list): if len(a_list) == 0: return False column = 0 row = 0 big = a_list[0][0] * a_list[0][1] while column < len(a_list) - 1: if a_list[column][row] * a_list[column][row + 1] > big: big = a_list[column][row] * a_list[column][row + 1] if a_lis...
### Dielectric class class Dielectric: ## Intialization function with all properties def __init__(self, pos_x, pos_y, width, height, eps_r): self.pos_x = pos_x self.pos_y = pos_y self.width = width self.height = height self.eps_r = eps_r ## String representation func...
class Dielectric: def __init__(self, pos_x, pos_y, width, height, eps_r): self.pos_x = pos_x self.pos_y = pos_y self.width = width self.height = height self.eps_r = eps_r def __str__(self): return 'x: {}, y: {}, w: {}, h: {}, eps_r: {}'.format(self.pos_x, self.p...
def ceaser(message): ciphered = "" for c in message: if c.isalpha(): if c.isupper(): upper = True else: upper = False c = c.upper() place = ord(c) if place+13 > 90: place = (place+13 - 90) + 64...
def ceaser(message): ciphered = '' for c in message: if c.isalpha(): if c.isupper(): upper = True else: upper = False c = c.upper() place = ord(c) if place + 13 > 90: place = place + 13 - 90 + 64 ...
# # PySNMP MIB module CONV-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CONV-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:11:06 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:1...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection) ...
# 268. Missing Number # Runtime: 132 ms, faster than 76.58% of Python3 online submissions for Missing Number. # Memory Usage: 15.5 MB, less than 51.40% of Python3 online submissions for Missing Number. class Solution: # Gauss' Formula def missingNumber(self, nums: list[int]) -> int: expected_sum = l...
class Solution: def missing_number(self, nums: list[int]) -> int: expected_sum = len(nums) * (len(nums) + 1) // 2 return expected_sum - sum(nums)
class Solution: def removeOuterParentheses(self, S: str) -> str: res = "" level = 0 start = 0 for i, c in enumerate(S): if c == "(": level += 1 if c == ")": level -= 1 if level == 0: res += S[start...
class Solution: def remove_outer_parentheses(self, S: str) -> str: res = '' level = 0 start = 0 for (i, c) in enumerate(S): if c == '(': level += 1 if c == ')': level -= 1 if level == 0: res += S[sta...
class Linked_List: class __Node: def __init__(self, val): # declare and initialize the private attributes # for objects of the Node class. # TODO replace pass with your implementation self.val=val self.prev=None self.next=None def __init__(self): # declare and initial...
class Linked_List: class __Node: def __init__(self, val): self.val = val self.prev = None self.next = None def __init__(self): self.__header = self.__Node(None) self.__trailer = self.__Node(None) self.__header.next = self.__trailer s...
which_one = int(input("What Months (1-12)?")) months = ['January' , 'February' , 'March' , 'April' , 'May' , 'June' , 'July' , 'August' , 'September' , 'October', 'November' , 'December'] if 1 <= which_one <= 12: print("Months " , months[which_one - 1])
which_one = int(input('What Months (1-12)?')) months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] if 1 <= which_one <= 12: print('Months ', months[which_one - 1])
# Example 1 def setup(): # Set to the same size as the source image # https://unsplash.com/photos/mGy1Jjr2e6M size(900, 600) # Load and display and position the image image(loadImage("file.jpg"), 0, 0)
def setup(): size(900, 600) image(load_image('file.jpg'), 0, 0)
MOUSE_BTN_LEFT = b"\x90" MOUSE_BTN_RIGHT = b"\x91" MOUSE_BTN_MIDDLE = b"\x92" KEY_LEFT_CTRL = b"\xe0" KEY_LEFT_SHIFT = b"\xe1" KEY_LEFT_ALT = b"\xe2" KEY_LEFT_GUI = b"\xe3" KEY_RIGHT_CTRL = b"\xe4" KEY_RIGHT_SHIFT = b"\xe5" KEY_RIGHT_ALT = b"\xe6" KEY_RIGHT_GUI = b"\xe8" KEY_A = b"\x04" KEY_B = b"\x05" KEY_C = b"\x06...
mouse_btn_left = b'\x90' mouse_btn_right = b'\x91' mouse_btn_middle = b'\x92' key_left_ctrl = b'\xe0' key_left_shift = b'\xe1' key_left_alt = b'\xe2' key_left_gui = b'\xe3' key_right_ctrl = b'\xe4' key_right_shift = b'\xe5' key_right_alt = b'\xe6' key_right_gui = b'\xe8' key_a = b'\x04' key_b = b'\x05' key_c = b'\x06' ...
x = 6 y = 7 # # Simple if # if x == y: # print(f'{x} is equal to {y}') # else: # print(f'{x} is not equal to {y}') # # Elif # if x > y: # print(f'{x} is bigger to {y}') # elif x == y: # print(f'{x} is equal to {y}') # else: # print(f'{x} is not equal to {y}') # Nested if # if x > 2: # if x <=...
x = 6 y = 7 numbers = [1, 2, 3, 4, 5] if x is y: print(x is y) if x is not y: print(x is y) if x is not y: print(x is not y)
# https://leetcode.com/problems/max-consecutive-ones class Solution: def findMaxConsecutiveOnes(self, nums): is_consec = False cnt, ans = 0, 0 for i in range(len(nums)): if (nums[i] == 1) and is_consec: cnt += 1 ans = max(ans, cnt) el...
class Solution: def find_max_consecutive_ones(self, nums): is_consec = False (cnt, ans) = (0, 0) for i in range(len(nums)): if nums[i] == 1 and is_consec: cnt += 1 ans = max(ans, cnt) elif nums[i] == 1 and (not is_consec): ...
a = 1 b = 2 print('a = ' + str(a) + ',' + 'b = ' + str(b)) temp = a a = b b = temp print('a = ' + str(a) + ',' + 'b = ' + str(b))
a = 1 b = 2 print('a = ' + str(a) + ',' + 'b = ' + str(b)) temp = a a = b b = temp print('a = ' + str(a) + ',' + 'b = ' + str(b))
THRESHOLD = 4 HEADER = '<?xml version="1.0" encoding="utf-8"?>\n\t<output>\n' FOOTER = '\t</output>\n' valMap = { '<': '', '>': '', '&': '', '\"': '' } keyMap = { '~': '', '`': '', '!': '', '@': '', '$': '', '%': '', '^': '', '&': '', '*': '', '(': '', ')': ...
threshold = 4 header = '<?xml version="1.0" encoding="utf-8"?>\n\t<output>\n' footer = '\t</output>\n' val_map = {'<': '', '>': '', '&': '', '"': ''} key_map = {'~': '', '`': '', '!': '', '@': '', '$': '', '%': '', '^': '', '&': '', '*': '', '(': '', ')': '', '+': '', '=': '', '{': '', '}': '', '[': '', ']': '', "'": '...
# Whitelist of generated features in dev STATUS for quicker execution TSFRESH_FEATURE_WHITELIST = [ 'agg_autocorrelation', 'autocorrelation', 'mean', 'mean_change', 'median', 'standard_deviation', 'variance', 'minimum', ] # Size of the time-windows used for generating single time-series...
tsfresh_feature_whitelist = ['agg_autocorrelation', 'autocorrelation', 'mean', 'mean_change', 'median', 'standard_deviation', 'variance', 'minimum'] tsfresh_time_windows = 14
# # solver_porting.py # # Description: # Hard code the solution values from the paper # Sin-Chung Chang, # "The Method of Space-Time Conservation Element # and Solution Element - A New Approach for Solving the Navier-Stokes # and Euler Equations", # Journal of Computational Physics, Volume 119, # Issue 2...
def get_specific_solution_for_unit_test(): solution_porting = [(-0.505, 1.0, 0.0, 1.0), (-0.495, 1.0, 0.0, 1.0), (-0.485, 1.0, 0.0, 1.0), (-0.475, 1.0, 0.0, 1.0), (-0.465, 1.0, 0.0, 1.0), (-0.455, 1.0, 0.0, 1.0), (-0.445, 1.0, 0.0, 1.0), (-0.435, 1.0, 0.0, 1.0), (-0.425, 1.0, 0.0, 1.0), (-0.415, 1.0, 0.0, 1.0), (-0...
# __version__.py # autogenerated by poetry-hooks 0.1.0 __version__ = "0.1.0a0" __title__ = "pytorch-caldera" __authors__ = ["Justin Vrana <justin.vrana@gmail.com>"] __repository__ = "" __homepage__ = "http://www.github.com/jvrana/caldera" __description__ = "" __maintainers__ = "" __readme__ = "" __license__ = ""
__version__ = '0.1.0a0' __title__ = 'pytorch-caldera' __authors__ = ['Justin Vrana <justin.vrana@gmail.com>'] __repository__ = '' __homepage__ = 'http://www.github.com/jvrana/caldera' __description__ = '' __maintainers__ = '' __readme__ = '' __license__ = ''
n = int(input()) data = [] c1, c2 = 0, 0 flag = 0 for i in range(n): val = list(map(int, input().split())) data.append(tuple(val)) c1 += val[0] c2 += val[1] if (c1 % 2) != (c2 % 2): flag = 1 if c1 % 2 == 1 and c2 % 2 == 1 and (c1+c2) % 2 == 0 and n > 1 and flag == 1: print(1) elif c1 % ...
n = int(input()) data = [] (c1, c2) = (0, 0) flag = 0 for i in range(n): val = list(map(int, input().split())) data.append(tuple(val)) c1 += val[0] c2 += val[1] if c1 % 2 != c2 % 2: flag = 1 if c1 % 2 == 1 and c2 % 2 == 1 and ((c1 + c2) % 2 == 0) and (n > 1) and (flag == 1): print(1) eli...
FULL_SCREEN = "FULL_SCREEN" MOVE_UP = "MOVE_UP" MOVE_LEFT = "MOVE_LEFT" MOVE_RIGHT = "MOVE_RIGHT" MOVE_DOWN = "MOVE_DOWN" ATTACK = "ATTACK" INVENTORY = "INVENTORY" MOVEMENT_ACTION = [ MOVE_DOWN, MOVE_UP, MOVE_RIGHT, MOVE_LEFT, ]
full_screen = 'FULL_SCREEN' move_up = 'MOVE_UP' move_left = 'MOVE_LEFT' move_right = 'MOVE_RIGHT' move_down = 'MOVE_DOWN' attack = 'ATTACK' inventory = 'INVENTORY' movement_action = [MOVE_DOWN, MOVE_UP, MOVE_RIGHT, MOVE_LEFT]
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: current_carry = 0 current = ListNode(0) head = current ...
class Solution: def add_two_numbers(self, l1: ListNode, l2: ListNode) -> ListNode: current_carry = 0 current = list_node(0) head = current while l1 or l2 or current_carry: current_val = current_carry current_val += 0 if l1 is None else l1.val curr...
#!/usr/bin/python3 class Node: def __init__(self, data, lchild=None, rchild=None): self.data = data self.lchild = lchild self.rchild = rchild def pre_order(root): if root != None: print(root.data, end=' ') pre_order(root.lchild) pre_order(root.rchild) def in_or...
class Node: def __init__(self, data, lchild=None, rchild=None): self.data = data self.lchild = lchild self.rchild = rchild def pre_order(root): if root != None: print(root.data, end=' ') pre_order(root.lchild) pre_order(root.rchild) def in_order(root): if r...
DEBUG = False SECRET_KEY = b'_5#y2L"F4Q8z\n\xec]/' SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://hlapse:h91040635!@rm-uf6gm31bj3hm81y14to.mysql.rds.aliyuncs.com/rss' + '?charset=utf8mb4' SQLALCHEMY_TRACK_MODIFICATIONS = False # JWT JWT_ERROR_MESSAGE_KEY = "messsage" JWT_ACCESS_TOKEN_EXPIRES = False # APScheduler SCHEDUL...
debug = False secret_key = b'_5#y2L"F4Q8z\n\xec]/' sqlalchemy_database_uri = 'mysql+pymysql://hlapse:h91040635!@rm-uf6gm31bj3hm81y14to.mysql.rds.aliyuncs.com/rss' + '?charset=utf8mb4' sqlalchemy_track_modifications = False jwt_error_message_key = 'messsage' jwt_access_token_expires = False scheduler_api_enabled = True ...
ROTATED_PROXY_ENABLED = True PROXY_STORAGE = 'scrapy_rotated_proxy.extensions.file_storage.FileProxyStorage' PROXY_FILE_PATH = '' # PROXY_STORAGE = 'scrapy_rotated_proxy.extensions.mongodb_storage.MongoDBProxyStorage' PROXY_MONGODB_HOST = '127.0.0.1' PROXY_MONGODB_PORT = 27017 PROXY_MONGODB_USERNAME = None PROXY_MONGOD...
rotated_proxy_enabled = True proxy_storage = 'scrapy_rotated_proxy.extensions.file_storage.FileProxyStorage' proxy_file_path = '' proxy_mongodb_host = '127.0.0.1' proxy_mongodb_port = 27017 proxy_mongodb_username = None proxy_mongodb_password = None proxy_mongodb_auth_db = 'admin' proxy_mongodb_db = 'proxy_management' ...
# Copyright 2016 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': 'cast_extension_discoverer', # 'includes': ['../../../compile_js2.gypi'], # }, # { # 'target_nam...
{'targets': []}
def iscomplex(a): # TODO(beam2d): Implement it raise NotImplementedError def iscomplexobj(x): # TODO(beam2d): Implement it raise NotImplementedError def isfortran(a): # TODO(beam2d): Implement it raise NotImplementedError def isreal(x): # TODO(beam2d): Implement it raise NotImpleme...
def iscomplex(a): raise NotImplementedError def iscomplexobj(x): raise NotImplementedError def isfortran(a): raise NotImplementedError def isreal(x): raise NotImplementedError def isrealobj(x): raise NotImplementedError
N, K = map(int, input().split()) S = list(input()) S[K-1] = S[K-1].swapcase() print("".join(S))
(n, k) = map(int, input().split()) s = list(input()) S[K - 1] = S[K - 1].swapcase() print(''.join(S))
full_submit = { 'processes' : [ { 'name': 'mkdir', 'cmd': 'mkdir -p /mnt/mesos/sandbox/sandbox/__jobio/input /mnt/mesos/sandbox/sandbox/__jobio/output' }, { 'name': 'symlink_in', 'cmd': 'ln -s /mnt/mesos/sandbox/sandbox/__jobio/input /job/input' }, { 'name': 'symlink_out', 'cmd': 'ln -s /mnt/mesos/sandbox/...
full_submit = {'processes': [{'name': 'mkdir', 'cmd': 'mkdir -p /mnt/mesos/sandbox/sandbox/__jobio/input /mnt/mesos/sandbox/sandbox/__jobio/output'}, {'name': 'symlink_in', 'cmd': 'ln -s /mnt/mesos/sandbox/sandbox/__jobio/input /job/input'}, {'name': 'symlink_out', 'cmd': 'ln -s /mnt/mesos/sandbox/sandbox/__jobio/outpu...
class TreasureMap: def __init__(self): self.map = {} def populate_map(self): self.map['beach'] = 'sandy shore' self.map['coast'] = 'ocean reef' self.map['volcano'] = 'hot lava' self.map['x'] = 'marks the spot' return
class Treasuremap: def __init__(self): self.map = {} def populate_map(self): self.map['beach'] = 'sandy shore' self.map['coast'] = 'ocean reef' self.map['volcano'] = 'hot lava' self.map['x'] = 'marks the spot' return
def sum(n): a = 0 for b in range(1,n+1,4): a+=b*b # b ** 2 return a n = int(input('n=')) print(sum(n))
def sum(n): a = 0 for b in range(1, n + 1, 4): a += b * b return a n = int(input('n=')) print(sum(n))
#------------------------------------------------------------------------------ # interpreter/interpreter.py # Copyright 2011 Joseph Schilz # Licensed under Apache v2 #------------------------------------------------------------------------------ articles = [" a ", " the "] def verb(command): # A function ...
articles = [' a ', ' the '] def verb(command): this_verb = '' the_rest = '' first_space = command.find(' ') if first_space > 0: this_verb = command[0:first_space] the_rest = command[first_space + 1:len(command)] else: this_verb = command if command[0] == "'": thi...
URLs = [ ["https://www.oryxspioenkop.com/2022/02/attack-on-europe-documenting-equipment.html", True], # Current version ["https://web.archive.org/web/20220413213804/https://www.oryxspioenkop.com/2022/02/attack-on-europe-documenting-equipment.html", True], # Apr 13 - 21:38:04 UTC ["https://web.archive.org/we...
ur_ls = [['https://www.oryxspioenkop.com/2022/02/attack-on-europe-documenting-equipment.html', True], ['https://web.archive.org/web/20220413213804/https://www.oryxspioenkop.com/2022/02/attack-on-europe-documenting-equipment.html', True], ['https://web.archive.org/web/20220412213745/https://www.oryxspioenkop.com/2022/02...
#Enquiry Form name=input('Enter your First Name ') Class=int(input('Enter your class ')) school=input('Enter your school name ') address=input('Enter your Address ') number=int(input('Enter your phone number ')) #print("Name- ",name,"Class- ",Class,"School- ",school,"Address- ",address,"Phone Number- ",number,sep='\n')...
name = input('Enter your First Name ') class = int(input('Enter your class ')) school = input('Enter your school name ') address = input('Enter your Address ') number = int(input('Enter your phone number ')) print('Name- ', name) print('Class- ', Class) print('School- ', school) print('Address- ', address) print('Phone...
'''ftoc.py - Fahrenheit to Celsius temperature converter''' def f_to_c(f): c = (f - 32) * (5/9) return c def input_float(prompt): ans = input(prompt) return float(ans) f = input_float("What is the temperature (in degrees Fahrenheit)? ") c = f_to_c(f) print("That is", round(c, 1), "degrees Celsius")
"""ftoc.py - Fahrenheit to Celsius temperature converter""" def f_to_c(f): c = (f - 32) * (5 / 9) return c def input_float(prompt): ans = input(prompt) return float(ans) f = input_float('What is the temperature (in degrees Fahrenheit)? ') c = f_to_c(f) print('That is', round(c, 1), 'degrees Celsius')
class Solution: # Sort (Accepted), O(n log n) time, O(n) space def maxProductDifference(self, nums: List[int]) -> int: nums.sort() return (nums[-1] * nums[-2]) - (nums[0] * nums[1]) # One Pass (Top Voted), O(n) time, O(1) space def maxProductDifference(self, nums: List[int]) -> int: ...
class Solution: def max_product_difference(self, nums: List[int]) -> int: nums.sort() return nums[-1] * nums[-2] - nums[0] * nums[1] def max_product_difference(self, nums: List[int]) -> int: min1 = min2 = float('inf') max1 = max2 = float('-inf') for n in nums: ...
nota = float(input('Digite sua nota, Valor entre "0 e 10": ')) while True: if nota >= 8.5 and nota <= 10: print('Nota igual a A') elif nota >= 7.0 and nota <= 8.4: print('Nota igual a B') elif nota >= 5.0 and nota <= 6.9: print('Nota igual a C') elif nota >= 4.0 and nota <= 4.9: ...
nota = float(input('Digite sua nota, Valor entre "0 e 10": ')) while True: if nota >= 8.5 and nota <= 10: print('Nota igual a A') elif nota >= 7.0 and nota <= 8.4: print('Nota igual a B') elif nota >= 5.0 and nota <= 6.9: print('Nota igual a C') elif nota >= 4.0 and nota <= 4.9: ...
INVALID_VALUE = -9999 def search_in_dictionary_list(dictionary_list, key_name, key_value): for dictionary in dictionary_list: if dictionary[key_name] == key_value: return dictionary return None def search_value_in_dictionary_list(dictionary_list, key_name, key_value, value_key): dict...
invalid_value = -9999 def search_in_dictionary_list(dictionary_list, key_name, key_value): for dictionary in dictionary_list: if dictionary[key_name] == key_value: return dictionary return None def search_value_in_dictionary_list(dictionary_list, key_name, key_value, value_key): dictio...
expected_output = { "global_drop_stats": { "Ipv4NoAdj": {"octets": 296, "packets": 7}, "Ipv4NoRoute": {"octets": 7964, "packets": 181}, "PuntPerCausePolicerDrops": {"octets": 184230, "packets": 2003}, "UidbNotCfgd": {"octets": 29312827, "packets": 466391}, "UnconfiguredIpv4Fi...
expected_output = {'global_drop_stats': {'Ipv4NoAdj': {'octets': 296, 'packets': 7}, 'Ipv4NoRoute': {'octets': 7964, 'packets': 181}, 'PuntPerCausePolicerDrops': {'octets': 184230, 'packets': 2003}, 'UidbNotCfgd': {'octets': 29312827, 'packets': 466391}, 'UnconfiguredIpv4Fia': {'octets': 360, 'packets': 6}}}
def func(ord_list, num): result = True if num in ord_list else False return result if __name__ == "__main__": l = [-1,3,5,6,8,9] # using binary search def find(ordered_list, element): start_index = 0 end_index = len(ordered_list) - 1 while True: middle_index = int((end_index + start_index) / 2)...
def func(ord_list, num): result = True if num in ord_list else False return result if __name__ == '__main__': l = [-1, 3, 5, 6, 8, 9] def find(ordered_list, element): start_index = 0 end_index = len(ordered_list) - 1 while True: middle_index = int((end_index + start_index) / 2) ...
# 54. Spiral Matrix class Solution: def spiralOrder(self, matrix): if not matrix: return matrix m, n = len(matrix), len(matrix[0]) visited = [[False] * n for _ in range(m)] ans = [] dirs = ((0,1), (1,0), (0,-1), (-1,0)) cur = 0 i = j = 0 ...
class Solution: def spiral_order(self, matrix): if not matrix: return matrix (m, n) = (len(matrix), len(matrix[0])) visited = [[False] * n for _ in range(m)] ans = [] dirs = ((0, 1), (1, 0), (0, -1), (-1, 0)) cur = 0 i = j = 0 while len(an...
class Solution: # @param s, a string # @param wordDict, a set<string> # @return a boolean def wordBreak(self, s, wordDict): n = len(s) if n == 0: return True res = [] chars = ''.join(wordDict) for i in xrange(n): if s[i] not in chars: ...
class Solution: def word_break(self, s, wordDict): n = len(s) if n == 0: return True res = [] chars = ''.join(wordDict) for i in xrange(n): if s[i] not in chars: return False lw = s[-1] lw_end = False for word i...
clan = { } def add_member(tag, name, age, level): clan[tag] = { "Name": name, "age": age, "level": level } return clan def display_clan(): print(clan) add_member("Voodoo", "Andre Williams", 26, "Beginner") display_clan()
clan = {} def add_member(tag, name, age, level): clan[tag] = {'Name': name, 'age': age, 'level': level} return clan def display_clan(): print(clan) add_member('Voodoo', 'Andre Williams', 26, 'Beginner') display_clan()
class CRSError(Exception): pass class DriverError(Exception): pass class TransactionError(RuntimeError): pass class UnsupportedGeometryTypeError(Exception): pass class DriverIOError(IOError): pass
class Crserror(Exception): pass class Drivererror(Exception): pass class Transactionerror(RuntimeError): pass class Unsupportedgeometrytypeerror(Exception): pass class Driverioerror(IOError): pass
# Search Part Problem n = int(input()) part_list = list(map(int, input().split())) m = int(input()) require_list = list(map(int, input().split())) def binary_search(array, target, start, end): mid = (start + end) // 2 if start >= end: return "no" if array[mid] == target: return "yes" ...
n = int(input()) part_list = list(map(int, input().split())) m = int(input()) require_list = list(map(int, input().split())) def binary_search(array, target, start, end): mid = (start + end) // 2 if start >= end: return 'no' if array[mid] == target: return 'yes' if array[mid] > target: ...
time_convert = {"s": 1, "m": 60, "h": 3600, "d": 86400} def convert_time_to_seconds(time): try: return int(time[:-1]) * time_convert[time[-1]] except: raise ValueError
time_convert = {'s': 1, 'm': 60, 'h': 3600, 'd': 86400} def convert_time_to_seconds(time): try: return int(time[:-1]) * time_convert[time[-1]] except: raise ValueError
def loadfile(name): lines = [] f = open(name, "r") for x in f: if x.endswith('\n'): x = x[:-1] lines.append(x.split("-")) return lines def pathFromPosition (position, graph, path, s, e, goingTwice, bt): beenThere = bt.copy() path = path + "-" + position print(pa...
def loadfile(name): lines = [] f = open(name, 'r') for x in f: if x.endswith('\n'): x = x[:-1] lines.append(x.split('-')) return lines def path_from_position(position, graph, path, s, e, goingTwice, bt): been_there = bt.copy() path = path + '-' + position print(p...
def launch(self, Dialog, **kwargs): # This is where the magic happens! # The lx module is persistent so you can store stuff there # and access it in commands. lx._widget = Dialog lx._widgetOptions = kwargs # widgetWrapper creates whatever widget is set via lx._widget above # note we're using launchScript whi...
def launch(self, Dialog, **kwargs): lx._widget = Dialog lx._widgetOptions = kwargs lx.eval('launchWidget') try: return lx._widgetInstance except: return None
test = { 'name': 'q1_2', 'points': 1, 'suites': [ { 'cases': [ {'code': '>>> sum(standard_units(make_array(1,2,3,4,5))) == 0\nTrue', 'hidden': False, 'locked': False}, {'code': '>>> np.isclose(standard_units(make_array(1,2,3,4,5))[0], -1.41421356)\nTrue', 'hidden': Fal...
test = {'name': 'q1_2', 'points': 1, 'suites': [{'cases': [{'code': '>>> sum(standard_units(make_array(1,2,3,4,5))) == 0\nTrue', 'hidden': False, 'locked': False}, {'code': '>>> np.isclose(standard_units(make_array(1,2,3,4,5))[0], -1.41421356)\nTrue', 'hidden': False, 'locked': False}], 'scored': True, 'setup': '', 'te...
x = input() total = 0 while x != "NoMoreMoney": money = float(x) if money > 0: total += money print(f"Increase: {money:.2f}") x = input() elif money < 0: print("Invalid operation!") break print(f"Total: {total:.2f}")
x = input() total = 0 while x != 'NoMoreMoney': money = float(x) if money > 0: total += money print(f'Increase: {money:.2f}') x = input() elif money < 0: print('Invalid operation!') break print(f'Total: {total:.2f}')
#File Locations EXTRACT_LIST_FILE = "ExtractList.xlsx" RAW_DATA_FILE = "../../output/WorldBank/WDIData.csv" OUTPUT_PATH = "../../output/WorldBank/split_output/"
extract_list_file = 'ExtractList.xlsx' raw_data_file = '../../output/WorldBank/WDIData.csv' output_path = '../../output/WorldBank/split_output/'
# https://leetcode.com/problems/lucky-numbers-in-a-matrix def lucky_numbers(matrix): all_lucky_numbers, all_mins = [], [] for row in matrix: found_min, col_index = float('Inf'), -1 for index, column in enumerate(row): if column < found_min: found_min = ...
def lucky_numbers(matrix): (all_lucky_numbers, all_mins) = ([], []) for row in matrix: (found_min, col_index) = (float('Inf'), -1) for (index, column) in enumerate(row): if column < found_min: found_min = column col_index = index all_mins.appen...
[ [float("NaN"), float("NaN"), 66.66666667, 33.33333333, 0.0], [float("NaN"), float("NaN"), 33.33333333, 66.66666667, 66.66666667], [float("NaN"), float("NaN"), 0.0, 0.0, 33.33333333], ]
[[float('NaN'), float('NaN'), 66.66666667, 33.33333333, 0.0], [float('NaN'), float('NaN'), 33.33333333, 66.66666667, 66.66666667], [float('NaN'), float('NaN'), 0.0, 0.0, 33.33333333]]
encrypted_string = 'OMQEMDUEQMEK' for i in range(1,27): temp_str = "" for x in encrypted_string: int_val = ord(x) + i if int_val > 90: # 90 is the numerical value for 'Z' # 65 is the numerical value for 'A' # If int_val is greater than Z then # t...
encrypted_string = 'OMQEMDUEQMEK' for i in range(1, 27): temp_str = '' for x in encrypted_string: int_val = ord(x) + i if int_val > 90: int_val = 64 + (int_val - 90) temp_str += chr(int_val) print(f'{i} {temp_str}')
# -*- coding: utf-8 -*- ## \package dbr.moduleaccess # MIT licensing # See: docs/LICENSE.txt ## This class allows access to a 'name' attribute # # \param module_name # \b \e unicode|str : Ideally set to the module's __name__ attribute class ModuleAccessCtrl: def __init__(self, moduleName): self.ModuleName = mo...
class Moduleaccessctrl: def __init__(self, moduleName): self.ModuleName = moduleName def get_module_name(self): return self.ModuleName
# ternary method num1 = int(input('Enter the number 1::')) num2 = int(input('\nEnter the number 2::')) num3 = int(input('\nEnter the number 3::')) max = (num1 if (num1 > num2 and num1 > num3) else (num2 if(num2 > num3 and num2 > num1) else num3)) print('\n\nThe maximum number is ::', max) #with pre-...
num1 = int(input('Enter the number 1::')) num2 = int(input('\nEnter the number 2::')) num3 = int(input('\nEnter the number 3::')) max = num1 if num1 > num2 and num1 > num3 else num2 if num2 > num3 and num2 > num1 else num3 print('\n\nThe maximum number is ::', max)
num1 = int(input()) num2 = int(input()) if(num1>=num2): print(num1) else:print(num2)
num1 = int(input()) num2 = int(input()) if num1 >= num2: print(num1) else: print(num2)
class Solution: def leastInterval(self, tasks: List[str], n: int) -> int: tasksDict = collections.Counter(tasks) heap = [] c = 0 for k, v in tasksDict.items(): heappush(heap, (-v, k)) while heap: i = 0 stack = [] while i <= n: ...
class Solution: def least_interval(self, tasks: List[str], n: int) -> int: tasks_dict = collections.Counter(tasks) heap = [] c = 0 for (k, v) in tasksDict.items(): heappush(heap, (-v, k)) while heap: i = 0 stack = [] while i <=...
# Written 9/10/14 by dh4gan # Some useful functions for classifying eigenvalues and defining structure def classify_eigenvalue(eigenvalues, threshold): '''Given 3 eigenvalues, and some threshold, returns an integer 'iclass' corresponding to the number of eigenvalues below the threshold iclass = 0 --> ...
def classify_eigenvalue(eigenvalues, threshold): """Given 3 eigenvalues, and some threshold, returns an integer 'iclass' corresponding to the number of eigenvalues below the threshold iclass = 0 --> clusters (3 +ve eigenvalues, 0 -ve) iclass = 1 --> filaments (2 +ve eigenvalues, 1 -ve) iclass =...
# ------------------------------------------------------------------------- # # THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, # EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES # OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. # ----------------...
_batch_account_name = '' _batch_account_key = '' _batch_account_url = '' _storage_account_name = '' _storage_account_key = '' _input_blob_prefix = '' _input_container = '' _output_container = '' _pool_id = '' _dedicated_pool_node_count = 0 _low_priority_pool_node_count = 1 _pool_vm_size = 'STANDARD_D64_v3' _job_id = ''
minombre = "NaCho" minombre = minombre.lower() print (minombre) for i in range(100): print(i) break
minombre = 'NaCho' minombre = minombre.lower() print(minombre) for i in range(100): print(i) break
class SceneManager: def __init__(self): self.scene_list = {} self.current_scene = None def append_scene(self, scene_name, scene): self.scene_list[scene_name] = scene def set_current_scene(self, scene_name): self.current_scene = self.scene_list[scene_name] class Scene: ...
class Scenemanager: def __init__(self): self.scene_list = {} self.current_scene = None def append_scene(self, scene_name, scene): self.scene_list[scene_name] = scene def set_current_scene(self, scene_name): self.current_scene = self.scene_list[scene_name] class Scene: ...
class Solution: def binary_search(self, array, val): index = bisect_left(array, val) if index != len(array) and array[index] == val: return index else: return -1 def smallestCommonElement(self, mat: List[List[int]]) -> int: values = mat[0] mat...
class Solution: def binary_search(self, array, val): index = bisect_left(array, val) if index != len(array) and array[index] == val: return index else: return -1 def smallest_common_element(self, mat: List[List[int]]) -> int: values = mat[0] mat....
# This problem was asked by Facebook. # Given a binary tree, return all paths from the root to leaves. # For example, given the tree # 1 # / \ # 2 3 # / \ # 4 5 # it should return [[1, 2], [1, 3, 4], [1, 3, 5]]. #### class Node: def __init__(self, val = None, left = None, right = None): sel...
class Node: def __init__(self, val=None, left=None, right=None): self.val = val self.left = left self.right = right l1 = node(5) l2 = node(3) l3 = node(7) l4 = node(4) m1 = node(2, l1, l2) m2 = node(1, l3, l4) root = node(6, m1, m2) def paths(root): if not root: return [] i...
class ApiConfig: api_key = None api_base = 'https://www.quandl.com/api/v3' api_version = None page_limit = 100
class Apiconfig: api_key = None api_base = 'https://www.quandl.com/api/v3' api_version = None page_limit = 100
_BEGIN = 0 ZERO=0 RAND=1 _END = 10
_begin = 0 zero = 0 rand = 1 _end = 10
# -*- coding: utf-8 -*- def main(): n, d = map(int, input().split()) s = [input() for _ in range(d)] ans = 0 for i in range(d): for j in range(i, d): if i != j: count = 0 for si, sj in zip(s[i], s[j]): if si == 'o'...
def main(): (n, d) = map(int, input().split()) s = [input() for _ in range(d)] ans = 0 for i in range(d): for j in range(i, d): if i != j: count = 0 for (si, sj) in zip(s[i], s[j]): if si == 'o' or sj == 'o': ...
TOPIC = "test.mosquitto.org" # Temperature and umidity publish interval (seconds) DATA_PUBLISH_INTERVAL = 5 # Data amount needed to start processing (reset after) DATA_PROCESS_AMOUNT = 5 # Percentage of mean temperature which will be sent to the air conditioner AIR_CONDITIONER_PERCENTAGE = 0.8 # Humidity below this...
topic = 'test.mosquitto.org' data_publish_interval = 5 data_process_amount = 5 air_conditioner_percentage = 0.8 humidifier_lower_threshold = 50 humidifier_upper_threshold = 80
PAGINATE_MODULES = { "Leads": { "stream_name": "leads", "module_name": "Leads", "params": {"per_page": 200, "sort_by": "Modified_Time", "sort_order": "asc"}, "bookmark_key": "Modified_Time", }, "Deals": { "stream_name": "deals", "module_name": "Deals", ...
paginate_modules = {'Leads': {'stream_name': 'leads', 'module_name': 'Leads', 'params': {'per_page': 200, 'sort_by': 'Modified_Time', 'sort_order': 'asc'}, 'bookmark_key': 'Modified_Time'}, 'Deals': {'stream_name': 'deals', 'module_name': 'Deals', 'params': {'per_page': 200, 'sort_by': 'Modified_Time', 'sort_order': 'a...
for arquivo in os.listdir(caminho): caminho_completo = os.path.join(caminho, arquivo) #zip.write(caminho_completo, arquivo) print(caminho_completo)
for arquivo in os.listdir(caminho): caminho_completo = os.path.join(caminho, arquivo) print(caminho_completo)
class Solution: def removeCoveredIntervals(self, intervals: List[List[int]]) -> int: intervals.sort(key=lambda x: (x[0], -x[1])) count = 0 end = -1 for a, b in intervals: if b > end: count += 1 end = b return count
class Solution: def remove_covered_intervals(self, intervals: List[List[int]]) -> int: intervals.sort(key=lambda x: (x[0], -x[1])) count = 0 end = -1 for (a, b) in intervals: if b > end: count += 1 end = b return count
def comb(n, k): nCk = 1 MOD = 10**9+7 for i in range(n-k+1, n+1): nCk *= i nCk %= MOD for i in range(1, k+1): nCk *= pow(i, MOD-2, MOD) nCk %= MOD return nCk n, a, b = map(int, input().split()) mod = 10**9+7 ans = pow(2, n, mod)-1-comb(n, a)-comb(n, b) print(ans %...
def comb(n, k): n_ck = 1 mod = 10 ** 9 + 7 for i in range(n - k + 1, n + 1): n_ck *= i n_ck %= MOD for i in range(1, k + 1): n_ck *= pow(i, MOD - 2, MOD) n_ck %= MOD return nCk (n, a, b) = map(int, input().split()) mod = 10 ** 9 + 7 ans = pow(2, n, mod) - 1 - comb(n, ...
dict1={1:"John",2:"Bob",3:"Bill"} print(dict1) print(dict1.items()) k=dict1.keys() for key in k: print(key) v=dict1.values() for value in v: print(value) print(dict1[3]) del dict1[2] print(dict1)
dict1 = {1: 'John', 2: 'Bob', 3: 'Bill'} print(dict1) print(dict1.items()) k = dict1.keys() for key in k: print(key) v = dict1.values() for value in v: print(value) print(dict1[3]) del dict1[2] print(dict1)
# Copyright (c) 2012 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. # lzma_sdk for standalone build. { 'targets': [ { 'target_name': 'ots_lzma_sdk', 'type': 'static_library', 'defines': [ '...
{'targets': [{'target_name': 'ots_lzma_sdk', 'type': 'static_library', 'defines': ['_7ZIP_ST', '_LZMA_PROB32'], 'sources': ['Alloc.c', 'Alloc.h', 'LzFind.c', 'LzFind.h', 'LzHash.h', 'LzmaEnc.c', 'LzmaEnc.h', 'LzmaDec.c', 'LzmaDec.h', 'LzmaLib.c', 'LzmaLib.h', 'Types.h'], 'include_dirs': ['.'], 'direct_dependent_setting...
# Create a sequence where each element is an individual base of DNA. # Make the array 15 bases long. bases = 'ATTCGGTCATGCTAA' # Print the length of the sequence print("DNA sequence length:", len(bases)) # Create a for loop to output every base of the sequence on a new line. print("All bases:") for base in bases: ...
bases = 'ATTCGGTCATGCTAA' print('DNA sequence length:', len(bases)) print('All bases:') for base in bases: print(base)
# Team 5 def save_to_json(datatables: list, directory=None): pass def open_json(): pass
def save_to_json(datatables: list, directory=None): pass def open_json(): pass
_base_ = "./FlowNet512_1.5AugCosyAAEGray_AggressiveV2_Flat_Pbr_01_ape.py" OUTPUT_DIR = "output/deepim/lmPbrSO/FlowNet512_1.5AugCosyAAEGray_AggressiveV2_Flat_lmPbr_SO/duck" DATASETS = dict(TRAIN=("lm_pbr_duck_train",), TEST=("lm_real_duck_test",)) # bbnc6 # objects duck Avg(1) # ad_2 4.23 4.23 # ad_5 26....
_base_ = './FlowNet512_1.5AugCosyAAEGray_AggressiveV2_Flat_Pbr_01_ape.py' output_dir = 'output/deepim/lmPbrSO/FlowNet512_1.5AugCosyAAEGray_AggressiveV2_Flat_lmPbr_SO/duck' datasets = dict(TRAIN=('lm_pbr_duck_train',), TEST=('lm_real_duck_test',))
class Solution: def sortArray(self, nums: List[int]) -> List[int]: temp = [0] * len(nums) def mergeSort(start, end): if start < end: mid = (start + end) // 2 mergeSort(start, mid) mergeSort(mid + 1, end) i = k = start ...
class Solution: def sort_array(self, nums: List[int]) -> List[int]: temp = [0] * len(nums) def merge_sort(start, end): if start < end: mid = (start + end) // 2 merge_sort(start, mid) merge_sort(mid + 1, end) i = k = start ...
class Foo0(): def __init__(self): pass foo1 = Foo0() class Foo0(): ## error: redefined class def __init__(self, a): pass foo2 = Foo0()
class Foo0: def __init__(self): pass foo1 = foo0() class Foo0: def __init__(self, a): pass foo2 = foo0()
# List of possible Pokemon types types = [ "Normal", "Fire", "Water", "Electric", "Grass", "Ice", "Fighting", "Poison", "Ground", "Flying", "Psychic", "Bug", "Rock", "Ghost", "Dragon", "Dark", "Steel", "Fairy" ] # Chart of type weaknesses. type_dict["Water"]["Fire"] assumes water is attacking fire. type_dict = {"N...
types = ['Normal', 'Fire', 'Water', 'Electric', 'Grass', 'Ice', 'Fighting', 'Poison', 'Ground', 'Flying', 'Psychic', 'Bug', 'Rock', 'Ghost', 'Dragon', 'Dark', 'Steel', 'Fairy'] type_dict = {'Normal': {'Normal': 1, 'Fire': 1, 'Water': 1, 'Electric': 1, 'Grass': 1, 'Ice': 1, 'Fighting': 1, 'Poison': 1, 'Ground': 1, 'Flyi...
class Solution: def checkValidString(self, s: str) -> bool: left_count = 0 star_count = 0 for char in s: if char == '(': left_count += 1 elif char == '*': star_count += 1 else: if left_count > 0: ...
class Solution: def check_valid_string(self, s: str) -> bool: left_count = 0 star_count = 0 for char in s: if char == '(': left_count += 1 elif char == '*': star_count += 1 elif left_count > 0: left_count -=...
# Given an array of ints length 3, return an array with the elements "rotated # left" so {1, 2, 3} yields {2, 3, 1}. # rotate_left3([1, 2, 3]) --> [2, 3, 1] # rotate_left3([5, 11, 9]) --> [11, 9, 5] # rotate_left3([7, 0, 0]) --> [0, 0, 7] def rotate_left3(nums): nums.append(nums.pop(0)) return nums print(rotate...
def rotate_left3(nums): nums.append(nums.pop(0)) return nums print(rotate_left3([1, 2, 3])) print(rotate_left3([5, 11, 9])) print(rotate_left3([7, 0, 0]))
#!/usr/bin/env python3 # Parse input lines = [] with open("10/input.txt", "r") as fd: for line in fd: lines.append(line.rstrip()) illegal = [] for line in lines: stack = list() for c in line: if c == "(": stack.append(")") elif c == "[": stack.append("]") ...
lines = [] with open('10/input.txt', 'r') as fd: for line in fd: lines.append(line.rstrip()) illegal = [] for line in lines: stack = list() for c in line: if c == '(': stack.append(')') elif c == '[': stack.append(']') elif c == '{': stack....
class Node: def __init__(self, data): self.data = data self.next = None class Queue: def __init__(self): self.front = self.back = None def isEmpty(self): return self.front == None def EnQueue(self, item): temp = Node(item) if(self.back == None): ...
class Node: def __init__(self, data): self.data = data self.next = None class Queue: def __init__(self): self.front = self.back = None def is_empty(self): return self.front == None def en_queue(self, item): temp = node(item) if self.back == None: ...
#/* *** ODSATag: RFact *** */ # Recursively compute and return n! def rfact(n): if n < 0: raise ValueError if n <= 1: return 1 # Base case: return base solution return n * rfact(n-1) # Recursive call for n > 1 #/* *** ODSAendTag: RFact *** */ #/* *** ODSATag: Sfact *** */ # Return n! def sfact(n): ...
def rfact(n): if n < 0: raise ValueError if n <= 1: return 1 return n * rfact(n - 1) def sfact(n): if n < 0: raise ValueError s = a_stack(n) while n > 1: S.push(n) n -= 1 result = 1 while S.length() > 0: result = result * S.pop() retur...
r1, c1 = map(int, input().split()) r2, c2 = map(int, input().split()) if abs(r1 - r2) + abs(c1 - c2) == 0: print(0) exit() # Move if abs(r1 - r2) + abs(c1 - c2) <= 3: print(1) exit() r3 = r2 t = abs(r1 - r2) if abs(c1 + t - c2) < abs(c1 - t - c2): c3 = c1 + t else: c3 = c1 - t # Bishop warp ...
(r1, c1) = map(int, input().split()) (r2, c2) = map(int, input().split()) if abs(r1 - r2) + abs(c1 - c2) == 0: print(0) exit() if abs(r1 - r2) + abs(c1 - c2) <= 3: print(1) exit() r3 = r2 t = abs(r1 - r2) if abs(c1 + t - c2) < abs(c1 - t - c2): c3 = c1 + t else: c3 = c1 - t if c3 == c2: prin...
age = 10 num = 0 while num < age: if num == 0: num += 1 continue if num % 2 == 0: print(num) if num > 4: break num += 1
age = 10 num = 0 while num < age: if num == 0: num += 1 continue if num % 2 == 0: print(num) if num > 4: break num += 1
# This is Stack build using Singly Linked List class StackNode: def __init__(self, value): self.value = value self._next = None class Stack: def __init__(self): self.head = None # bottom self.tail = None # top self.size = 0 def __len__(self): return sel...
class Stacknode: def __init__(self, value): self.value = value self._next = None class Stack: def __init__(self): self.head = None self.tail = None self.size = 0 def __len__(self): return self.size def _size(self): return self.size def is...
def create_data(n): temp = [i for i in range(n)] return temp n = 100 target = n + 11 ma_list = create_data(n) def binary_search(input_list,target): found = False low = 0 high = len(input_list) - 1 mid = int((high + low) / 2) while (low <=high) and (not found): curr = input_list[mi...
def create_data(n): temp = [i for i in range(n)] return temp n = 100 target = n + 11 ma_list = create_data(n) def binary_search(input_list, target): found = False low = 0 high = len(input_list) - 1 mid = int((high + low) / 2) while low <= high and (not found): curr = input_list[mid]...
# @Author: Ozan YILDIZ@2022 # Simple printing operation val = 12 if __name__ == '__main__': #print operation print("Boolean True (True)", val)
val = 12 if __name__ == '__main__': print('Boolean True (True)', val)
#Finding least trial def least_trial_num(n): #making 1000001 size buffer buffer = [] for i in range(1000001): buffer += [0] #Minimum calculation of 1 is 0 times. buffer[1] = 0 #Minimum calculations of other values for i in range(2, n + 1): #Since calculations of...
def least_trial_num(n): buffer = [] for i in range(1000001): buffer += [0] buffer[1] = 0 for i in range(2, n + 1): buffer[i] = buffer[i - 1] + 1 if i % 2 == 0: buffer[i] = min2(buffer[i], buffer[i // 2] + 1) if i % 3 == 0: buffer[i] = min2(buffer[i...
# environment variables ATOM_PROGRAM = '/home/physics/bin/atm' ATOM_UTILS_DIR ='/home/physics/bin/pseudo' element = "Al" equil_volume = 16.4796 # general calculation parameters calc = {"element": element, "lattice": "FCC", "xc": "pb", "n_core": 3, "n_val": 2, "is_spin_pol": Fa...
atom_program = '/home/physics/bin/atm' atom_utils_dir = '/home/physics/bin/pseudo' element = 'Al' equil_volume = 16.4796 calc = {'element': element, 'lattice': 'FCC', 'xc': 'pb', 'n_core': 3, 'n_val': 2, 'is_spin_pol': False, 'core': True} electrons = [2, 1] radii = [2.4, 2.8, 2.3, 2.3, 0.7] siesta_calc = {'element': e...
idir="<path to public/template database>/"; odir=idir+"output/"; public_dir='DPA_contest2_public_base_diff_vcc_a128_2009_12_23/' template_dir='DPA_contest2_template_base_diff_vcc_a128_2009_12_23/' template_index_file=idir+'DPA_contest2_template_base_index_file' public_index_file=idir+'DPA_contest2_public_base_inde...
idir = '<path to public/template database>/' odir = idir + 'output/' public_dir = 'DPA_contest2_public_base_diff_vcc_a128_2009_12_23/' template_dir = 'DPA_contest2_template_base_diff_vcc_a128_2009_12_23/' template_index_file = idir + 'DPA_contest2_template_base_index_file' public_index_file = idir + 'DPA_contest2_publi...
def getNoZeroIntegers(self, n: int) -> List[int]: for i in range(1, n): a = i b = n - i if "0" in str(a) or "0" in str(b): continue return [a, b]
def get_no_zero_integers(self, n: int) -> List[int]: for i in range(1, n): a = i b = n - i if '0' in str(a) or '0' in str(b): continue return [a, b]
province = input('Enter you province: ') if province.lower() == 'surigao': print('Hi, I am from Surigao too.') else: print(f'Hi, so your from { province.capitalize() }')
province = input('Enter you province: ') if province.lower() == 'surigao': print('Hi, I am from Surigao too.') else: print(f'Hi, so your from {province.capitalize()}')
PrimeNums = [] Target = 10001 Number = 0 while len(PrimeNums) < Target: isPrime = True Number += 1 for x in range(2,9): if Number % x == 0 and Number != x: isPrime = False if isPrime: if Number == 1: False else: PrimeNums.append(Number) print...
prime_nums = [] target = 10001 number = 0 while len(PrimeNums) < Target: is_prime = True number += 1 for x in range(2, 9): if Number % x == 0 and Number != x: is_prime = False if isPrime: if Number == 1: False else: PrimeNums.append(Number) pri...
# SET MISMATCH LEETCODE SOLUTION: # creating a class. class Solution(object): # creating a function to solve the problem. def findErrorNums(self, nums): # creating multiple variables to store various sums. actual_sum = sum(nums) set_sum = sum(set(nums)) a_sum = len(...
class Solution(object): def find_error_nums(self, nums): actual_sum = sum(nums) set_sum = sum(set(nums)) a_sum = len(nums) * (len(nums) + 1) / 2 return [actual_sum - set_sum, a_sum - set_sum]
s = input() t = input() print()
s = input() t = input() print()
def front_back(str): if len(str) < 2: return str n = len(str) first_char = str[0] last_char = str[n-1] middle_chars = str[1:(n-1)] return last_char + middle_chars + first_char
def front_back(str): if len(str) < 2: return str n = len(str) first_char = str[0] last_char = str[n - 1] middle_chars = str[1:n - 1] return last_char + middle_chars + first_char
''' Mr. X's birthday is in next month. This time he is planning to invite N of his friends. He wants to distribute some chocolates to all of his friends after party. He went to a shop to buy a packet of chocolates. At chocolate shop, each packet is having different number of chocolates. He wants to buy such a packet wh...
""" Mr. X's birthday is in next month. This time he is planning to invite N of his friends. He wants to distribute some chocolates to all of his friends after party. He went to a shop to buy a packet of chocolates. At chocolate shop, each packet is having different number of chocolates. He wants to buy such a packet wh...
# print ("hello world") # import sys # print(sys.version) # columns = [0,2,4,6,8,10,12,14,16,18,20,22,24,25,27,29,31,33,35,37,39,41,43,45,47,49,50,52,54,56,58,60,62,64,66,68,70,72,74,75,77,79,81,83,85,87,89,91,93,95,97,] for x in range(0, 125): print('P[c:{0}] (0,255,0), '.format(x%125), end='') # Green print...
for x in range(0, 125): print('P[c:{0}] (0,255,0), '.format(x % 125), end='') print('P[c:{0}] (255,255,0), '.format((x + 25) % 125), end='') print('P[c:{0}] (255,255,255), '.format((x + 50) % 125), end='') print('P[c:{0}] (127,0,255), '.format((x + 75) % 125), end='') print('P[c:{0}] (0,0,255)'.form...