content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
courses = ['History', 'Math', 'Physics', 'CompSci'] for item in courses: print(item) # loop with an index for index, course in enumerate(courses): print(index, course) # loop with a starting index value for index, course in enumerate(courses, start=1): print(index, course)
courses = ['History', 'Math', 'Physics', 'CompSci'] for item in courses: print(item) for (index, course) in enumerate(courses): print(index, course) for (index, course) in enumerate(courses, start=1): print(index, course)
# settings.py - place to store constants for template-gen ACS_API = '2016-03-30' BASE_API = '2016-09-01' COMP_API = '2017-03-30' #COMP_API = '2016-04-30-preview' INSIGHTS_API = '2015-04-01' INSIGHTS_METRICS_API = '2016-03-01' INSIGHTS_PREVIEW_API = '2016-06-01' MEDIA_API = '2015-10-01' NETWORK_API = '2016-09-01' STORA...
acs_api = '2016-03-30' base_api = '2016-09-01' comp_api = '2017-03-30' insights_api = '2015-04-01' insights_metrics_api = '2016-03-01' insights_preview_api = '2016-06-01' media_api = '2015-10-01' network_api = '2016-09-01' storage_api = '2016-01-01'
fileref = open("olympics.txt", "r") ## Mind it the file should be in the same folder of the program execution. lines = fileref.readlines() print(len(lines)) total_char = 0 for line in lines: total_char += len(line) print(line.strip()) print(total_char) fileref.close()
fileref = open('olympics.txt', 'r') lines = fileref.readlines() print(len(lines)) total_char = 0 for line in lines: total_char += len(line) print(line.strip()) print(total_char) fileref.close()
################################################################################ # # Author: francescodilillo # Purpose: practice with dictionaries # Last Edit Date: 18-03-2020 # # ################################################################################ person = {"name": "Francesco", "gender": "M", "age": 27,...
person = {'name': 'Francesco', 'gender': 'M', 'age': 27, 'address': '15 Rue de Ville, Luxembourg', 'phone': 34566112233} request = input('What info would you need to learn about the person? ').lower() output = person.get(request, "The request can't be fulfilled since there is no field " + request) print(request, ': ', ...
""" Given a positive integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. Example: Input: 3 Output: [ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7, 6, 5 ] ] """ class Solution(object): def generateMatrix(self, n): """ :type n: int :rtype: List[List[int]] ""...
""" Given a positive integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. Example: Input: 3 Output: [ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7, 6, 5 ] ] """ class Solution(object): def generate_matrix(self, n): """ :type n: int :rtype: List[List[int]] "...
""" Exceptions. """ class OperationFailError(Exception): """Operation fail exception.""" pass class TaskNameDuplicateError(Exception): """Duplicate task name exception.""" pass class TaskNotFoundError(Exception): """Task is not registered in schedule manager.""" pass class TimeFormatError(Ex...
""" Exceptions. """ class Operationfailerror(Exception): """Operation fail exception.""" pass class Tasknameduplicateerror(Exception): """Duplicate task name exception.""" pass class Tasknotfounderror(Exception): """Task is not registered in schedule manager.""" pass class Timeformaterror(Ex...
EXPERIMENTAL_MODE = True # header chunk id HEADER = 0x1 class Chunks13: SHADERS = 0x2 VISUALS = 0x3 PORTALS = 0x4 LIGHT_DYNAMIC = 0x6 GLOWS = 0x7 SECTORS = 0x8 VB = 0x9 IB = 0xa SWIS = 0xb class Chunks12: SHADERS = 0x2 VISUALS = 0x3 PORTALS = 0x4 LIGHT_DYNAMIC = 0...
experimental_mode = True header = 1 class Chunks13: shaders = 2 visuals = 3 portals = 4 light_dynamic = 6 glows = 7 sectors = 8 vb = 9 ib = 10 swis = 11 class Chunks12: shaders = 2 visuals = 3 portals = 4 light_dynamic = 6 glows = 7 sectors = 8 ib = 9 ...
""" Author: Samrat Banerjee Date: 01-06-2018 Description: Names, Variables, Code, Functions """ # this one is like your scripts with argv def print_two(*args): arg1, arg2=args print("arg1: %r,arg2: %r"%(arg1,arg2)) # ok, that *args is actually pointless, we can just do this def print_two_again(arg1,arg2): ...
""" Author: Samrat Banerjee Date: 01-06-2018 Description: Names, Variables, Code, Functions """ def print_two(*args): (arg1, arg2) = args print('arg1: %r,arg2: %r' % (arg1, arg2)) def print_two_again(arg1, arg2): print('arg1: %r,arg2: %r' % (arg1, arg2)) def print_one(arg1): print('arg1: %r' % arg1...
class Solution: # time: O(1) # space: O(1) def findComplement(self, num: int) -> int: i = 1 while i <= num: i = i << 1 return (i - 1) ^ num
class Solution: def find_complement(self, num: int) -> int: i = 1 while i <= num: i = i << 1 return i - 1 ^ num
def anagrams(word, words): #your code here word_list = list(word) word_list.sort() l = [] for i in words: j = list(i) j.sort() if(j == word_list): l.append(i) return l
def anagrams(word, words): word_list = list(word) word_list.sort() l = [] for i in words: j = list(i) j.sort() if j == word_list: l.append(i) return l
#!/usr/bin/env python3 #! @author: @ruhend(Mudigonda Himansh) ''' Here in this program i have used one function to do both the encoding and decoding part of it. this works with the basic principle, of division. while division the remainder is returned. Encoding doesnt make use of it, but while decoding...
""" Here in this program i have used one function to do both the encoding and decoding part of it. this works with the basic principle, of division. while division the remainder is returned. Encoding doesnt make use of it, but while decoding the remainder is == 0, if True, then it is not corrupted, else...
class ExerciseStep: def __init__(self, main_text:str, sub_text=""): self.main_text = main_text self.sub_text = sub_text
class Exercisestep: def __init__(self, main_text: str, sub_text=''): self.main_text = main_text self.sub_text = sub_text
class BackEnd: def __init__(self, id, Nome, Descricao, Versao): self.id = id self.nome = Nome self.descricao = Descricao self.versao = Versao def __str__(self): return f"{self.id},{self.nome},{self.descricao},{self.versao}"
class Backend: def __init__(self, id, Nome, Descricao, Versao): self.id = id self.nome = Nome self.descricao = Descricao self.versao = Versao def __str__(self): return f'{self.id},{self.nome},{self.descricao},{self.versao}'
_base_ = [ '../_base_/models/faster_rcnn_r50_fpn.py', '../_base_/datasets/rect_blur_detection.py', '../_base_/schedules/schedule_2x.py', '../_base_/default_runtime.py'] optimizer = dict(type='SGD', lr=0.0005, momentum=0.9, weight_decay=0.0001) model = dict( roi_head=dict( type='DoubleHeadRoIHe...
_base_ = ['../_base_/models/faster_rcnn_r50_fpn.py', '../_base_/datasets/rect_blur_detection.py', '../_base_/schedules/schedule_2x.py', '../_base_/default_runtime.py'] optimizer = dict(type='SGD', lr=0.0005, momentum=0.9, weight_decay=0.0001) model = dict(roi_head=dict(type='DoubleHeadRoIHead', reg_roi_scale_factor=1.3...
trip_price = float(input()) money_balance = float(input()) spend_times = 0 days_count = 0 while spend_times < 5 and money_balance < trip_price: action = input() sum = float(input()) days_count += 1 if action == "spend": spend_times += 1 if sum >= money_balance: money_balanc...
trip_price = float(input()) money_balance = float(input()) spend_times = 0 days_count = 0 while spend_times < 5 and money_balance < trip_price: action = input() sum = float(input()) days_count += 1 if action == 'spend': spend_times += 1 if sum >= money_balance: money_balance ...
def floodFill(graph, visited, start): if (start == -1): return(0) s = 0 if (not visited[start]): s += 1 visited[start] = 1 for v in graph[start]: s += floodFill(graph, visited, v) return(s) size = int(input()) graph = [[] for i in range(size)] for i in range(...
def flood_fill(graph, visited, start): if start == -1: return 0 s = 0 if not visited[start]: s += 1 visited[start] = 1 for v in graph[start]: s += flood_fill(graph, visited, v) return s size = int(input()) graph = [[] for i in range(size)] for i in range(size ...
def keyword_from_deeper_submodule(): return 'hi again' class Sub: def keyword_from_class_in_deeper_submodule(self): return 'bye'
def keyword_from_deeper_submodule(): return 'hi again' class Sub: def keyword_from_class_in_deeper_submodule(self): return 'bye'
# Pulled from Scikit-Learn's official Github Repo (18 Sep 2020) to speed up 'caer' package import speeds (since this was the only method referenced from sklearn) MAXPRINT = 50 class spmatrix(object): """ This class provides a base class for all sparse matrices. It cannot be instantiated. Most of the work is...
maxprint = 50 class Spmatrix(object): """ This class provides a base class for all sparse matrices. It cannot be instantiated. Most of the work is provided by subclasses. """ def __init__(self, maxprint=MAXPRINT): self._shape = None if self.__class__.__name__ == 'spmatrix': ...
""" Copyright: MAXON Computer GmbH Author: Maxime Adam Description: - Example to customize the icon used for a script. - The icon should be named like the .py file. - Should be a TIF with a size of 32x32. """
""" Copyright: MAXON Computer GmbH Author: Maxime Adam Description: - Example to customize the icon used for a script. - The icon should be named like the .py file. - Should be a TIF with a size of 32x32. """
#!/usr/bin/python # -*- coding: utf-8 -*- print("Note : Starting GUI...")
print('Note : Starting GUI...')
# # PySNMP MIB module CISCO-CDSTV-INGESTMGR-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-CDSTV-INGESTMGR-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:53:05 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3....
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, value_range_constraint, value_size_constraint, single_value_constraint) ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Apr 9 13:59:28 2020 @author: Muhammad """ # Parsing a text file for numerical data covid = open('COVID.txt') word_list = covid.read().split() numbers = [int(x) for x in word_list if x.isdigit()] #numbers.sort() print(numbers) covid.close()
""" Created on Thu Apr 9 13:59:28 2020 @author: Muhammad """ covid = open('COVID.txt') word_list = covid.read().split() numbers = [int(x) for x in word_list if x.isdigit()] print(numbers) covid.close()
# you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(S, P, Q): # write your code in Python 3.6 A = [0]*len(S) APrefixSum = [0]*len(S) C = [0]*len(S) CPrefixSum = [0]*len(S) G = [0]*len(S) GPrefixSum = [0]*len(S) T = [0]*le...
def solution(S, P, Q): a = [0] * len(S) a_prefix_sum = [0] * len(S) c = [0] * len(S) c_prefix_sum = [0] * len(S) g = [0] * len(S) g_prefix_sum = [0] * len(S) t = [0] * len(S) t_prefix_sum = [0] * len(S) for index in range(len(S)): if S[index] == 'A': A[index] = 1 ...
#! /usr/bin/env python # coding: utf-8 class ClientError(Exception): def __init__(self): pass class BadRequest(ClientError): def __init__(self, key, detail=None): self.key = key self.detail = detail class ConflictRequest(ClientError): def __init__(self, detail=None): ...
class Clienterror(Exception): def __init__(self): pass class Badrequest(ClientError): def __init__(self, key, detail=None): self.key = key self.detail = detail class Conflictrequest(ClientError): def __init__(self, detail=None): self.detail = detail class Resourcenotfou...
class TimeRegister: def __init__(self, emp_id, date, hours): self.emp_id = emp_id self.date = date self.hours = hours def get_emp_id(self): return self.emp_id def set_emp_id(self, new_id): self.emp_id = new_id def get_date(self): return self.__date d...
class Timeregister: def __init__(self, emp_id, date, hours): self.emp_id = emp_id self.date = date self.hours = hours def get_emp_id(self): return self.emp_id def set_emp_id(self, new_id): self.emp_id = new_id def get_date(self): return self.__date ...
# import levels YES = 'y' NO = 'n' INDENT = ' ' NAME_CHARS = (' ', ',', '-', '.') # ============================================================================== # I/O # ============================================================================== def in_print(s: str, indent: int=0): print(f'{INDENT * inden...
yes = 'y' no = 'n' indent = ' ' name_chars = (' ', ',', '-', '.') def in_print(s: str, indent: int=0): print(f'{INDENT * indent}{s}') def in_prompt(s: str, indent: int=0): return input(f'{INDENT * indent}{s}: ').strip() def invalid(s: str, indent: int=0): in_print(f'Invalid: {s}\n', indent) def v_non...
def isPalindrome (input): input = [int(i) for i in str(input)] length = int(len(input)) if length % 2 == 0: part1 = (input[0: int(length / 2)]) part2 = (input[int(length / 2):]) part2 = list(reversed(part2)) else: part1 = (input[0: int(length // 2)]) part...
def is_palindrome(input): input = [int(i) for i in str(input)] length = int(len(input)) if length % 2 == 0: part1 = input[0:int(length / 2)] part2 = input[int(length / 2):] part2 = list(reversed(part2)) else: part1 = input[0:int(length // 2)] part2 = input[int(len...
source_urls = { "2014": [ "https://raw.githubusercontent.com/tech-conferences/conference-data/master/conferences/2014/javascript.json", "https://raw.githubusercontent.com/tech-conferences/conference-data/master/conferences/2014/ruby.json", "https://raw.githubusercontent.com/tech-conferences/...
source_urls = {'2014': ['https://raw.githubusercontent.com/tech-conferences/conference-data/master/conferences/2014/javascript.json', 'https://raw.githubusercontent.com/tech-conferences/conference-data/master/conferences/2014/ruby.json', 'https://raw.githubusercontent.com/tech-conferences/conference-data/master/confere...
""" day 8 of Advent of Code 2018 by Stefan Kruger """ class DataProvider: def __init__(self, data): self.cursor = 0 self.data = data @classmethod def read_file(cls, filename="data/input8.data"): with open(filename) as f: return cls([int(item) for item in f.read().split...
""" day 8 of Advent of Code 2018 by Stefan Kruger """ class Dataprovider: def __init__(self, data): self.cursor = 0 self.data = data @classmethod def read_file(cls, filename='data/input8.data'): with open(filename) as f: return cls([int(item) for item in f.read().split...
class Solution: def maxValue(self, events: List[List[int]], k: int) -> int: e = sorted(events) @lru_cache(None) def dp(i, k): if k == 0 or i == len(e): return 0 # binary search events to find the first index j s.t. e[j][0] > e[i][1] j = bisect.bisect(e, [e[i][1], math.inf, math...
class Solution: def max_value(self, events: List[List[int]], k: int) -> int: e = sorted(events) @lru_cache(None) def dp(i, k): if k == 0 or i == len(e): return 0 j = bisect.bisect(e, [e[i][1], math.inf, math.inf], i + 1) return max(dp(i +...
l,r = input().split() l,r = int(l), int(r) if l == 0 and r == 0: print("Not a moose") elif l == r: print("Even", l+r) elif l != r: mx = max(l,r) print("Odd", mx*2)
(l, r) = input().split() (l, r) = (int(l), int(r)) if l == 0 and r == 0: print('Not a moose') elif l == r: print('Even', l + r) elif l != r: mx = max(l, r) print('Odd', mx * 2)
bot_fav_color = "blue" # Creating a parent class to use for various games class Player: def __init__(self, name, fav_color): self.name = name self.fav_color = fav_color def __str__(self): if self.fav_color == "blue": return f"Hi {self.name}! My favorite color is...
bot_fav_color = 'blue' class Player: def __init__(self, name, fav_color): self.name = name self.fav_color = fav_color def __str__(self): if self.fav_color == 'blue': return f'Hi {self.name}! My favorite color is also blue!' return f'Hi {self.name}! {self.fav_color}...
# subtraction with two number with user input a = int(input("Enter The First Value:")) b = int(input("Enter The Seceond Value:")) if a>b: Subtraction = a - b # In capital letters print("subtraction OF:",Subtraction) else: subtraction = b - a # Small...
a = int(input('Enter The First Value:')) b = int(input('Enter The Seceond Value:')) if a > b: subtraction = a - b print('subtraction OF:', Subtraction) else: subtraction = b - a print('Substraction OF: -', subtraction)
# Copyright 2020 The Elekto Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
csrf_state = 'state' auth_state = 'authentication' github_authorize = 'https://github.com/login/oauth/authorize' github_access = 'https://github.com/login/oauth/access_token' github_profile = 'https://api.github.com/user' elec_stat_completed = 'completed' elec_stat_running = 'running' elec_stat_upcoming = 'upcoming' ca...
# # PySNMP MIB module SPAGENT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SPAGENT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:02:25 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, 0...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_size_constraint, constraints_union, single_value_constraint, value_range_constraint) ...
class Solution: """ @param num: Given the candidate numbers @param target: Given the target number @return: All the combinations that sum to target """ def combinationSum2(self, num, target): # write your code here self.results = [] if not num or len(num) == 0: ...
class Solution: """ @param num: Given the candidate numbers @param target: Given the target number @return: All the combinations that sum to target """ def combination_sum2(self, num, target): self.results = [] if not num or len(num) == 0: return self.results ...
class ShippingMethodType: PRICE_BASED = "price" WEIGHT_BASED = "weight" CHOICES = [ (PRICE_BASED, "Price based shipping"), (WEIGHT_BASED, "Weight based shipping"), ] class PostalCodeRuleInclusionType: INCLUDE = "include" EXCLUDE = "exclude" CHOICES = [ (INCLUDE, "...
class Shippingmethodtype: price_based = 'price' weight_based = 'weight' choices = [(PRICE_BASED, 'Price based shipping'), (WEIGHT_BASED, 'Weight based shipping')] class Postalcoderuleinclusiontype: include = 'include' exclude = 'exclude' choices = [(INCLUDE, 'Shipping method should include post...
# Create a variable called 'name' that holds a string name = "Homer Simpson" # Create a variable called 'country' that holds a string country = "United States" # Create a variable called 'age' that holds an integer age = 25 # Create a variable called 'hourly_wage' that holds an integer hourly_wage = 15 # Create a v...
name = 'Homer Simpson' country = 'United States' age = 25 hourly_wage = 15 weekly_hours = '40' daily_wage = hourly_wage * 8 weekly_wage = hourly_wage * int(weekly_hours) satisfied = True print(f'Hello, {name}!') print(f'You live in {country}.') print(f'You are {str(age)} years old.') print(f'You make {str(daily_wage)} ...
# Joshua Nelson Gomes (Joshua) # CIS 41A Spring 2020 # Unit C Take-Home Assignment # First Script - Working with List list1 = list() list1.extend([1,3,5]) list2 = [1, 2, 3, 4] list3 = list1 + list2 print (f'd) list3 is: {list3}') print (f'e) list3 contains a 3: {3 in list3}') print (f'f) list3 contains {list3.count...
list1 = list() list1.extend([1, 3, 5]) list2 = [1, 2, 3, 4] list3 = list1 + list2 print(f'd) list3 is: {list3}') print(f'e) list3 contains a 3: {3 in list3}') print(f'f) list3 contains {list3.count(3)} 3s') print(f'h) The index of the first 3 contained in list3 is {list3.index(3)}') print(f'h) first3 = {list3.pop(list3...
class Solution: def findMissingRanges(self, nums: List[int], lower: int, upper: int) -> List[str]: # need to consider low and upper element because res.append(str(nums[i]+1)) and we use range 2 (nums[i+1] - nums[i] == 2) # for example: [1], low = 0, upper = 100. nums = [lower-1] + nums + [u...
class Solution: def find_missing_ranges(self, nums: List[int], lower: int, upper: int) -> List[str]: nums = [lower - 1] + nums + [upper + 1] res = [] for i in range(len(nums) - 1): if nums[i + 1] - nums[i] == 2: res.append(str(nums[i] + 1)) elif nums[...
with open("input.txt") as f: lines = [line.strip() for line in f.readlines()] tiles = {} # (e, ne) => is_black # decomposes a movement direction on a hex grid to one or two movements in two axes (this allows for unique coords) def decompose(direction: str) -> list: if direction == "se": return ["e",...
with open('input.txt') as f: lines = [line.strip() for line in f.readlines()] tiles = {} def decompose(direction: str) -> list: if direction == 'se': return ['e', 'sw'] elif direction == 'nw': return ['w', 'ne'] else: return [direction] for line in lines: directions = [] ...
__name__ = "lbry" __version__ = "0.44.1" version = tuple(__version__.split('.'))
__name__ = 'lbry' __version__ = '0.44.1' version = tuple(__version__.split('.'))
class MSImageCollection(object): def __init__(self, images): self._images = images @property def images(self): # <list> return self._images
class Msimagecollection(object): def __init__(self, images): self._images = images @property def images(self): return self._images
class ResourceNames(): def __init__(self, log_group_name: str, log_stream_name: str): self.log_group_name = log_group_name self.log_stream_name = log_stream_name def get_log_group_name(self) -> str: return self.log_group_name def get_log_stream_name(self) -> str: ...
class Resourcenames: def __init__(self, log_group_name: str, log_stream_name: str): self.log_group_name = log_group_name self.log_stream_name = log_stream_name def get_log_group_name(self) -> str: return self.log_group_name def get_log_stream_name(self) -> str: return self...
n = int(input()) num1 = "" num2 = "" num3 = "" num4 = "" for a in range(1111, 9999 + 1): num1 = str(a)[0] num2 = str(a)[1] num3 = str(a)[2] num4 = str(a)[3] if int(num1) != 0 and int(num2) != 0 and int(num3) != 0 and int(num4) != 0: if n % int(num1) == 0 and n % int(num2) == 0 and n % int(nu...
n = int(input()) num1 = '' num2 = '' num3 = '' num4 = '' for a in range(1111, 9999 + 1): num1 = str(a)[0] num2 = str(a)[1] num3 = str(a)[2] num4 = str(a)[3] if int(num1) != 0 and int(num2) != 0 and (int(num3) != 0) and (int(num4) != 0): if n % int(num1) == 0 and n % int(num2) == 0 and (n % i...
IR_Sensor_1 = 6 #GPIO number IR_Sensor_2 = 13 #GPIO number IR_Sensor_3 = 19 #GPIO number IR_Sensor_4 = 26 #GPIO number IR_Sensor_5 = 12 #GPIO number IR_Sensor_6 = 16 #GPIO number IR_Sensor_7 = 20 #GPIO number IR_Sensor_8 = 21 #GPIO number I_Restart = 5 #GPIO number I_Pair = 11 #GPIO number IR_time = 500 # time in ms Re...
ir__sensor_1 = 6 ir__sensor_2 = 13 ir__sensor_3 = 19 ir__sensor_4 = 26 ir__sensor_5 = 12 ir__sensor_6 = 16 ir__sensor_7 = 20 ir__sensor_8 = 21 i__restart = 5 i__pair = 11 ir_time = 500 restart_time = 5000 pair_time = 200
class Solution(object): def moveZeroes(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ last_non_zero = 0 for cur in range(len(nums)): if nums[cur] != 0: nums[cur], nums[last_non_zero] = nums[last_non_zero]...
class Solution(object): def move_zeroes(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ last_non_zero = 0 for cur in range(len(nums)): if nums[cur] != 0: (nums[cur], nums[last_n...
__title__ = 'MeteorTears' __description__ = 'Even the most boring times in life are limited.' __url__ = 'https://github.com/xiaoxiaolulu/MeteorTears' __version__ = '1.0.1' __author__ = 'Null' __author_email__ = '546464268@qq.com' __license__ = 'MIT' __copyright__ = 'Copyright 2018 Null'
__title__ = 'MeteorTears' __description__ = 'Even the most boring times in life are limited.' __url__ = 'https://github.com/xiaoxiaolulu/MeteorTears' __version__ = '1.0.1' __author__ = 'Null' __author_email__ = '546464268@qq.com' __license__ = 'MIT' __copyright__ = 'Copyright 2018 Null'
"""Custom execeptions for Cartola FC Draft.""" class SchemeError(Exception): """Indicates that the Line-up does not follow the scheme."""
"""Custom execeptions for Cartola FC Draft.""" class Schemeerror(Exception): """Indicates that the Line-up does not follow the scheme."""
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def binaryTreePaths(self, root: Optional[TreeNode]) -> List[str]: result = [] path = [] ...
class Solution: def binary_tree_paths(self, root: Optional[TreeNode]) -> List[str]: result = [] path = [] def backtrack(root): if not root: return if not root.left and (not root.right): path.append(str(root.val)) resul...
# List of permitted AST toplevel statements. In IMPORTs (e.g. sgr import # and Splitfile IMPORT commands), we only allow read-only SELECTs. In Splitfile # SQL commands, we also allow users to use a bunch of writeable DML and DDL. IMPORT_SQL_PERMITTED_STATEMENTS = ["RawStmt", "SelectStmt"] SPLITFILE_SQL_PERMITTED_STATE...
import_sql_permitted_statements = ['RawStmt', 'SelectStmt'] splitfile_sql_permitted_statements = IMPORT_SQL_PERMITTED_STATEMENTS + ['InsertStmt', 'UpdateStmt', 'DeleteStmt', 'CreateStmt', 'CreateTableAsStmt', 'AlterTableStmt', 'DropStmt'] pg_catalog_tables = set('pg_statistic\npg_type\npg_foreign_server\npg_aggregate_f...
class MultiprocessingUtils(object): @staticmethod def get_array_split_indices(array_length, thread_count): array_length += 1 indices = range(0, array_length, array_length / thread_count)[:thread_count] indices.append(array_length) return indices @staticmethod def star...
class Multiprocessingutils(object): @staticmethod def get_array_split_indices(array_length, thread_count): array_length += 1 indices = range(0, array_length, array_length / thread_count)[:thread_count] indices.append(array_length) return indices @staticmethod def start_...
def smallestDifference(arrayOne, arrayTwo): arrayOne.sort() arrayTwo.sort() ans = [0, float('inf')] i = j = 0 while i < len(arrayOne) and j < len(arrayTwo): if abs(ans[0] - ans[1]) > abs(arrayOne[i] - arrayTwo[j]): ans[0], ans[1] = arrayOne[i], arrayTwo[j] if ans[...
def smallest_difference(arrayOne, arrayTwo): arrayOne.sort() arrayTwo.sort() ans = [0, float('inf')] i = j = 0 while i < len(arrayOne) and j < len(arrayTwo): if abs(ans[0] - ans[1]) > abs(arrayOne[i] - arrayTwo[j]): (ans[0], ans[1]) = (arrayOne[i], arrayTwo[j]) if ans...
""" Entradas litros-->float-->l Salidas litros_comprados-->float-->l_c Nota: 1 Galon= 3.785 Litro 1 litro = 50000 COP """ l=float(input("Ingrese la cantidad de litros comprados ")) l_c=(l/3.785)*(3.785*50000) print("El total a pagar es: "+str(l_c)+" COP")
""" Entradas litros-->float-->l Salidas litros_comprados-->float-->l_c Nota: 1 Galon= 3.785 Litro 1 litro = 50000 COP """ l = float(input('Ingrese la cantidad de litros comprados ')) l_c = l / 3.785 * (3.785 * 50000) print('El total a pagar es: ' + str(l_c) + ' COP')
CATEGORIES = ["Gents", "Ladies", "Giants", "Boys", "Girls", "Kids", "Children"] BRANDS = [ "", "PRIDE", "DEBONGO", "VKC DEBONGO", "KAPERS", "STILE", "L.PRIDE", "SMARTAK", ]
categories = ['Gents', 'Ladies', 'Giants', 'Boys', 'Girls', 'Kids', 'Children'] brands = ['', 'PRIDE', 'DEBONGO', 'VKC DEBONGO', 'KAPERS', 'STILE', 'L.PRIDE', 'SMARTAK']
murder_note = "You may call me heartless, a killer, a monster, a murderer, but I'm still NOTHING compared to the villian that Jay was. This whole contest was a sham, an elaborate plot to shame the contestants and feed Jay's massive, massive ego. SURE you think you know him! You've seen him smiling for the cameras, laug...
murder_note = "You may call me heartless, a killer, a monster, a murderer, but I'm still NOTHING compared to the villian that Jay was. This whole contest was a sham, an elaborate plot to shame the contestants and feed Jay's massive, massive ego. SURE you think you know him! You've seen him smiling for the cameras, laug...
class ColorTerminal: prRed = '\033[91m' prGreen = '\033[92m' prLightPurple = '\033[94m' prCyan = '\033[96m' endc = '\033[0m'
class Colorterminal: pr_red = '\x1b[91m' pr_green = '\x1b[92m' pr_light_purple = '\x1b[94m' pr_cyan = '\x1b[96m' endc = '\x1b[0m'
class Solution: def generate(self, numRows: 'int') -> 'List[List[int]]': if numRows<1: return [] rst = [] if numRows == 1: rst.append([1]) elif numRows == 2: rst.append([1]) rst.append([1,1]) else: rst.append([1]) ...
class Solution: def generate(self, numRows: 'int') -> 'List[List[int]]': if numRows < 1: return [] rst = [] if numRows == 1: rst.append([1]) elif numRows == 2: rst.append([1]) rst.append([1, 1]) else: rst.append([1]...
# -*- coding: utf-8 -*- #------------------------------------------------------------------------------ # file: $Id$ # auth: Philip J Grabner <phil@canary.md> # date: 2016/09/14 # copy: (C) Copyright 2016-EOT Canary Health, Inc., All Rights Reserved. #--------------------------------------------------------------------...
undefined = object() class Error(Exception): pass class Precompilerunavailable(Error): pass class Templatecollision(Error): pass
a = int(input()) b = int(input()) if a == b: print(0) elif a > b: print(1) else: print(2)
a = int(input()) b = int(input()) if a == b: print(0) elif a > b: print(1) else: print(2)
############################################################################ # Generic script applicable on any Operating Environments (Unix, Windows) # ScriptName : wls_deploy.py # Properties : weblogic.properties test.properties # Author : Kevin Yuan ######################################################...
connect('@WL_USR@', '@WL_PWD@', 't3://@WL_HOST@:@WL_PORT@') edit() start_edit() deploy(appName='@appName@', path='@testDir@/@earName@', targets='@TARGET_SERVER@') save() activate() exit()
class DroneTemplate: __attr__ = ('id', 'name', 'namespace', 'data') def __init__(self, data: dict): self._data = data @property def id(self): return self._data.get('id') @property def name(self): return self._data.get('name') @property def namespace(self): ...
class Dronetemplate: __attr__ = ('id', 'name', 'namespace', 'data') def __init__(self, data: dict): self._data = data @property def id(self): return self._data.get('id') @property def name(self): return self._data.get('name') @property def namespace(self): ...
class Error(Exception): """Base-class for all exceptions raised by this module.""" class ConfidentialsNotSuppliedError(Error): """An API key and an API sectret must be supplied.""" class BearerTokenNotFetchedError(Error): """Couldn't fetch the bearer token.""" class InvalidDownloadPathError(Error): ...
class Error(Exception): """Base-class for all exceptions raised by this module.""" class Confidentialsnotsuppliederror(Error): """An API key and an API sectret must be supplied.""" class Bearertokennotfetchederror(Error): """Couldn't fetch the bearer token.""" class Invaliddownloadpatherror(Error): "...
A = float(raw_input()) B = float(raw_input()) MEDIA = ((A*3.5)+(B*7.5))/11 print ("MEDIA = %.5f" %MEDIA)
a = float(raw_input()) b = float(raw_input()) media = (A * 3.5 + B * 7.5) / 11 print('MEDIA = %.5f' % MEDIA)
for _ in range(int(input())): n=int(input()) l=list(map(int,input().split())) if len(set(l))<n: print("YES") else: print("NO")
for _ in range(int(input())): n = int(input()) l = list(map(int, input().split())) if len(set(l)) < n: print('YES') else: print('NO')
def ParseXMLWithXPath(xmlString, xpath): return
def parse_xml_with_x_path(xmlString, xpath): return
# # PySNMP MIB module ZXR10-T128-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZXR10-T128-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:42:31 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_union, constraints_intersection, value_range_constraint, single_value_constraint) ...
print(""" You have succesfully created `{{ cookiecutter.repository_slug }}` with these cookiecutter parameters: {% for key, value in cookiecutter.items()|sort %} {{ "{0:24}".format(key + ":") }} {{ "{0!r}".format(value).strip("u") }} {%- endfor %} ----------------------------------------------------------------- N...
print('\nYou have succesfully created `{{ cookiecutter.repository_slug }}`\nwith these cookiecutter parameters:\n\n{% for key, value in cookiecutter.items()|sort %}\n {{ "{0:24}".format(key + ":") }} {{ "{0!r}".format(value).strip("u") }}\n{%- endfor %}\n\n--------------------------------------------------------------...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jan 22 18:06:36 2022 @author: victor """ alien = {'color': 'green', 'points': 5} print("The Alien's color is " + alien['color'])
""" Created on Sat Jan 22 18:06:36 2022 @author: victor """ alien = {'color': 'green', 'points': 5} print("The Alien's color is " + alien['color'])
class Solution(object): def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ index={} for i,num in enumerate(nums): if target - num in index: return [index[target - num] + 1,i+1] ...
class Solution(object): def two_sum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ index = {} for (i, num) in enumerate(nums): if target - num in index: return [index[target - num] + 1, i + 1...
class Solution: def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """
class Solution: def two_sum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """
class CDCAbstract: def __init__(self, username, pw, headless=False): self.username = username self.password = pw self.headless = headless # vars (practical) self.available_days_practical = [] self.available_days_in_view_practical = [] self.available_times_pr...
class Cdcabstract: def __init__(self, username, pw, headless=False): self.username = username self.password = pw self.headless = headless self.available_days_practical = [] self.available_days_in_view_practical = [] self.available_times_practical = [] self.av...
'''OrderState data structure.''' __copyright__ = "Copyright (c) 2008 Kevin J Bluck" __version__ = "$Id$" class OrderState(object): '''Data structure containing attributes to describe the status of an order. ''' def __init__(self, status="", init_margin="", maint_margin="", equity_with_loan="", ...
"""OrderState data structure.""" __copyright__ = 'Copyright (c) 2008 Kevin J Bluck' __version__ = '$Id$' class Orderstate(object): """Data structure containing attributes to describe the status of an order. """ def __init__(self, status='', init_margin='', maint_margin='', equity_with_loan='', comm...
class Token: def __init__(self, token, start_pos=-1, action="", change_seq=0): self._token = token self._start_pos = start_pos self._action = action self._change_seq = change_seq @property def start_pos(self): return self._start_pos @start_pos.setter def sta...
class Token: def __init__(self, token, start_pos=-1, action='', change_seq=0): self._token = token self._start_pos = start_pos self._action = action self._change_seq = change_seq @property def start_pos(self): return self._start_pos @start_pos.setter def st...
class Solution(object): def rotatedDigits(self, N): """ :type N: int :rtype: int """ res = 0 vs = set([2, 5, 6, 9]) ivs = set([3, 4, 7]) for n in range(2, N + 1): v, iv = False, False while n > 0: a = n % 10 ...
class Solution(object): def rotated_digits(self, N): """ :type N: int :rtype: int """ res = 0 vs = set([2, 5, 6, 9]) ivs = set([3, 4, 7]) for n in range(2, N + 1): (v, iv) = (False, False) while n > 0: a = n % 1...
#!/usr/bin/env python3 class Solution: def getRow(self, rowIndex): ret, numer, denom = [1], 1, 1 for i in range(0, rowIndex): numer *= (rowIndex-i) denom *= (1+i) ret.append(numer//denom) return ret sol = Solution() for i in range(10): print(sol.getR...
class Solution: def get_row(self, rowIndex): (ret, numer, denom) = ([1], 1, 1) for i in range(0, rowIndex): numer *= rowIndex - i denom *= 1 + i ret.append(numer // denom) return ret sol = solution() for i in range(10): print(sol.getRow(i))
counter = 0 arr = [] while counter != 3: ss = input("Shop stock: ") if "cam" in ss.lower(): counter += 1 arr.append(ss) else: pass arr.sort(reverse=True) print(f"Proposals: {arr[0]}, {arr[1]}, {arr[2]}")
counter = 0 arr = [] while counter != 3: ss = input('Shop stock: ') if 'cam' in ss.lower(): counter += 1 arr.append(ss) else: pass arr.sort(reverse=True) print(f'Proposals: {arr[0]}, {arr[1]}, {arr[2]}')
#!/usr/bin/env python class ListInstance: def __attrnames(self): result = '' for attr in sorted(self.__dict__): result += '\t%s=%s\n' % (attr, self.__dict__[attr]) return result def __str__(self): return '<Instance of %s, address %s:\n%s>' % ( self._...
class Listinstance: def __attrnames(self): result = '' for attr in sorted(self.__dict__): result += '\t%s=%s\n' % (attr, self.__dict__[attr]) return result def __str__(self): return '<Instance of %s, address %s:\n%s>' % (self.__class__.__name__, id(self), self.__att...
#from datetime import datetime #time=str(datetime.now()) #time=time[0:4]+time[5:7]+time[8:10]+time[11:13]+time[14:16]+time[17:19]+time[20:22] #print(time) print(float("01"))
print(float('01'))
#!/usr/bin/env python3 total = 0 n = int(input()) n = (n * (n % 2)) total = total + n n = int(input()) n = (n * (n % 2)) total = total + n n = int(input()) n = (n * (n % 2)) total = total + n n = int(input()) n = (n * (n % 2)) total = total + n n = int(input()) n = (n * (n % 2)) total = total + n n = int(input()...
total = 0 n = int(input()) n = n * (n % 2) total = total + n n = int(input()) n = n * (n % 2) total = total + n n = int(input()) n = n * (n % 2) total = total + n n = int(input()) n = n * (n % 2) total = total + n n = int(input()) n = n * (n % 2) total = total + n n = int(input()) n = n * (n % 2) total = total + n n = ...
class SinglePlayerArena(): """ An Arena class where any 2 agents can be pit against each other. """ def __init__(self, player1, game): """ Input: player 1: function that takes board as input, return action game: Game object """ self.player1 = playe...
class Singleplayerarena: """ An Arena class where any 2 agents can be pit against each other. """ def __init__(self, player1, game): """ Input: player 1: function that takes board as input, return action game: Game object """ self.player1 = player...
n = 4 arr = [] for _ in range(n): s = list(input()) arr.append(s) def check(arr, paint='#'): possible = False Y = len(arr) X = len(arr[0]) for y in range(1, Y): for x in range(1, X): if arr[y-1][x] == paint and arr[y][x-1] == paint and arr[y-1][x-1] == paint: ...
n = 4 arr = [] for _ in range(n): s = list(input()) arr.append(s) def check(arr, paint='#'): possible = False y = len(arr) x = len(arr[0]) for y in range(1, Y): for x in range(1, X): if arr[y - 1][x] == paint and arr[y][x - 1] == paint and (arr[y - 1][x - 1] == paint): ...
chars = [0]*26 str = input().strip() odds = 0 for i in range(0, len(str)): chars[ord(str[i])-97] += 1 for i in range(0, 26): if chars[i] % 2 == 1: odds += 1 if odds > 1: print("NO") else: print("YES")
chars = [0] * 26 str = input().strip() odds = 0 for i in range(0, len(str)): chars[ord(str[i]) - 97] += 1 for i in range(0, 26): if chars[i] % 2 == 1: odds += 1 if odds > 1: print('NO') else: print('YES')
""" Help text for Suplemon """ help_text = """ # Suplemon Help *Contents* 1. General description 2. User interface 3. Default keyboard shortcuts 4. Commands ## 1. General description Suplemon is designed to be an easy, intuitive and powerful text editor. It emulates some features from Sublime Text and the user inter...
""" Help text for Suplemon """ help_text = "\n# Suplemon Help\n\n*Contents*\n1. General description\n2. User interface\n3. Default keyboard shortcuts\n4. Commands\n\n## 1. General description\nSuplemon is designed to be an easy, intuitive and powerful text editor.\nIt emulates some features from Sublime Text and the us...
class ClientResponse(object): """Client response """
class Clientresponse(object): """Client response """
insert_route_sql = """ INSERT INTO tb_route ( INPUT_VALUE , OUTPUT_VALUE , FILTER_VALUE , INS_DATE , UPD_DATE ) VALUES ( {input_value} , {output_value} , {filter_value} , NOW() , NOW() ); """ selec...
insert_route_sql = '\n INSERT INTO tb_route (\n INPUT_VALUE\n , OUTPUT_VALUE\n , FILTER_VALUE\n , INS_DATE\n , UPD_DATE\n ) VALUES (\n {input_value}\n , {output_value}\n , {filter_value}\n , NOW()\n , NOW()\n );\n' select_route...
## DP 100% class Solution: def updateMatrix(self, matrix: List[List[int]]) -> List[List[int]]: m, n = len(matrix), len(matrix[0]) dp = [[1000]*n for _ in range(m)] for i in range(m): for j in range(n): if (matrix[i][j] == 0): dp[i][j] = 0 ...
class Solution: def update_matrix(self, matrix: List[List[int]]) -> List[List[int]]: (m, n) = (len(matrix), len(matrix[0])) dp = [[1000] * n for _ in range(m)] for i in range(m): for j in range(n): if matrix[i][j] == 0: dp[i][j] = 0 ...
src = Split(''' fota_test.c ''') component = aos_component('fota_test', src) component.add_comp_deps('middleware/uagent/uota')
src = split('\n fota_test.c\n') component = aos_component('fota_test', src) component.add_comp_deps('middleware/uagent/uota')
""" Sprawdz czy binarna reprezentacja liczby jest palindromem. """ def czy_palindrom_v1(liczba): odwrocona = 0 k = liczba while k > 0: odwrocona = (odwrocona << 1) | (k & 1) k >>= 1 return odwrocona == liczba if __name__ == "__main__": liczba = 0b11011 assert czy_palindr...
""" Sprawdz czy binarna reprezentacja liczby jest palindromem. """ def czy_palindrom_v1(liczba): odwrocona = 0 k = liczba while k > 0: odwrocona = odwrocona << 1 | k & 1 k >>= 1 return odwrocona == liczba if __name__ == '__main__': liczba = 27 assert czy_palindrom_v1(liczba) ...
{ "targets": [ { "target_name": "modsecurity", "sources": [ "modsecurity_wrap.cxx" ], "include_dirs": ['usr/local/modsecurity/include/modsecurity',], "libraries": ['/usr/local/modsecurity/lib/libmodsecurity.a', '/usr/local/modsecurity/lib/libmodsecurity.dylib', '/usr/local/mods...
{'targets': [{'target_name': 'modsecurity', 'sources': ['modsecurity_wrap.cxx'], 'include_dirs': ['usr/local/modsecurity/include/modsecurity'], 'libraries': ['/usr/local/modsecurity/lib/libmodsecurity.a', '/usr/local/modsecurity/lib/libmodsecurity.dylib', '/usr/local/modsecurity/lib/libmodsecurity.la', '/usr/local/mods...
""" Advent of code Day 1 challenge part 2 """ element_one_index = 0 element_two_index = 1 element_three_index = 2 not_exhausted = True first_element_ignore = True sum_list = [] inc_countup = 0 with open("input.txt") as file: element_list = [int(stained_element.strip()) for stained_element in file.readlines()] w...
""" Advent of code Day 1 challenge part 2 """ element_one_index = 0 element_two_index = 1 element_three_index = 2 not_exhausted = True first_element_ignore = True sum_list = [] inc_countup = 0 with open('input.txt') as file: element_list = [int(stained_element.strip()) for stained_element in file.readlines()] while...
def candy_crush(string): char_pointer = string[0] result_string = "" counter = 1 for c in string[1:]: if not c == char_pointer: result_string += char_pointer char_pointer = c else: counter += 1 if counter == 3: counter = 1 ...
def candy_crush(string): char_pointer = string[0] result_string = '' counter = 1 for c in string[1:]: if not c == char_pointer: result_string += char_pointer char_pointer = c else: counter += 1 if counter == 3: counter = 1 ...
# running use IDEL: tired of waiting x=8 ans = 0 while ans**3 < abs(x): ans = ans # replace the statement ans = ans + 1 by ans = ans # ans = ans + 1 if ans**3 != abs(x): print(x, 'is not a perfect cube') else: if x < 0: ans = -ans print('Cube root of', x,'is', ans)
x = 8 ans = 0 while ans ** 3 < abs(x): ans = ans if ans ** 3 != abs(x): print(x, 'is not a perfect cube') else: if x < 0: ans = -ans print('Cube root of', x, 'is', ans)
#!/usr/bin/env python3 class ZotlerError(Exception): pass class InvalidModeError(ZotlerError): pass
class Zotlererror(Exception): pass class Invalidmodeerror(ZotlerError): pass
""" Wallabag entry. """ class Entry: """ The entry class. """ entry_id = 0 title = "" content = "" url = "" read = False starred = False def __init__(self, item): self.entry_id = item['id'] title = item['title'] title = title.replace("\n", "") ...
""" Wallabag entry. """ class Entry: """ The entry class. """ entry_id = 0 title = '' content = '' url = '' read = False starred = False def __init__(self, item): self.entry_id = item['id'] title = item['title'] title = title.replace('\n', '') ti...
class StarwarsUniverse: # creates a member of the starwars universe def __init__(self, name, birth, gender): self._name = name self.birth = birth self.gender = gender def says(self, words): return f"{self.name} says {words}" class Robot(StarwarsUniverse): # creates a robot fro...
class Starwarsuniverse: def __init__(self, name, birth, gender): self._name = name self.birth = birth self.gender = gender def says(self, words): return f'{self.name} says {words}' class Robot(StarwarsUniverse): def __init__(self, name, birth, gender, classification, side...
class Magic: def __init__(self, username, password): self.username = username self.password = password def start(self): print(self.username) print(self.password) class StartMagic(Magic): def gg(self): return self.password while True: s = StartMagic(1,2) s.start() print(s.password)
class Magic: def __init__(self, username, password): self.username = username self.password = password def start(self): print(self.username) print(self.password) class Startmagic(Magic): def gg(self): return self.password while True: s = start_magic(1, 2) ...
def add_num(a,b): '''Return sum of two numbers''' s=a+b return s n1=input('enter first number:') n1=int(n1) n2=input('enter second number:') n2=int(n2) s = add_num(n1,n2) print ('sum is: ',s);
def add_num(a, b): """Return sum of two numbers""" s = a + b return s n1 = input('enter first number:') n1 = int(n1) n2 = input('enter second number:') n2 = int(n2) s = add_num(n1, n2) print('sum is: ', s)
""" 1. Clarification 2. Possible solutions - String 3. Coding 4. Tests """ # T=O(n), S=O(n) class Solution: def countAndSay(self, n: int) -> str: if n == 1: return '1' s = self.countAndSay(n - 1) i, j, ans = 0, 1, list() while j <= len(s): if j == len(s)...
""" 1. Clarification 2. Possible solutions - String 3. Coding 4. Tests """ class Solution: def count_and_say(self, n: int) -> str: if n == 1: return '1' s = self.countAndSay(n - 1) (i, j, ans) = (0, 1, list()) while j <= len(s): if j == len(s): ...
class Transaction: def __init__(self, trans_type, amount=0): self.trans_type = trans_type self.amount = amount def display(self): print('Super class display')
class Transaction: def __init__(self, trans_type, amount=0): self.trans_type = trans_type self.amount = amount def display(self): print('Super class display')