content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class ParseQuery(object): def __init__(self, ): super(ParseQuery, self).__init__() def parse_query(self, query): temp_query = query.split("=") return temp_query class ParsePayload(object): def __init__(self, ): super(ParsePayload, self).__init__() ...
class Parsequery(object): def __init__(self): super(ParseQuery, self).__init__() def parse_query(self, query): temp_query = query.split('=') return temp_query class Parsepayload(object): def __init__(self): super(ParsePayload, self).__init__() def parse_payload(self,...
""" Base utilities to build API operation managers and objects on top of. """ class Manager(object): """Manager for API service. Managers interact with a particular type of API (projects, users, reposiries,etc.) and provide CRUD operations for them. """ def __init__(self, api): self.api ...
""" Base utilities to build API operation managers and objects on top of. """ class Manager(object): """Manager for API service. Managers interact with a particular type of API (projects, users, reposiries,etc.) and provide CRUD operations for them. """ def __init__(self, api): self.api =...
def findDecision(obj): #obj[0]: Passanger, obj[1]: Time, obj[2]: Coupon, obj[3]: Education, obj[4]: Occupation, obj[5]: Bar, obj[6]: Coffeehouse, obj[7]: Restaurant20to50, obj[8]: Direction_same, obj[9]: Distance # {"feature": "Coupon", "instances": 8147, "metric_value": 0.4734, "depth": 1} if obj[2]>1: # {"feature...
def find_decision(obj): if obj[2] > 1: if obj[6] <= 1.0: if obj[9] <= 2: if obj[0] <= 1: if obj[7] <= 2.0: if obj[5] <= 3.0: if obj[1] <= 1: if obj[8] > 0: ...
class Table: def __init__(self, dealer, players): self.dealer = dealer self.players = players # self.participants = players + dealer def __repr__(self): return f'Table(dealer={self.dealer}, players={self.players})' def render(self): return f'{"".join(hand.render() f...
class Table: def __init__(self, dealer, players): self.dealer = dealer self.players = players def __repr__(self): return f'Table(dealer={self.dealer}, players={self.players})' def render(self): return f"{''.join((hand.render() for hand in self.players))}"
print ('Welcome to the Guess Game') secret_word = "giraffe" guess = "" guess_count = 0 guess_limit = 3 out_of_guesses = False while guess != secret_word and not (out_of_guesses): if guess_count < guess_limit: guess = input("Enter guess: ") guess_count += 1 else: out_of_guesses= True i...
print('Welcome to the Guess Game') secret_word = 'giraffe' guess = '' guess_count = 0 guess_limit = 3 out_of_guesses = False while guess != secret_word and (not out_of_guesses): if guess_count < guess_limit: guess = input('Enter guess: ') guess_count += 1 else: out_of_guesses = True if o...
def isSymmetrical(str): length = len(str) mid = length // 2 if length % 2: mid = length // 2+1 return isSymmetrical(str[:mid-1] + str[mid:]) return str[mid:] == str[:mid] def isPalindrome(str): length = len(str) for i in range(length//2): if str[i] != str[length-1-i]: ...
def is_symmetrical(str): length = len(str) mid = length // 2 if length % 2: mid = length // 2 + 1 return is_symmetrical(str[:mid - 1] + str[mid:]) return str[mid:] == str[:mid] def is_palindrome(str): length = len(str) for i in range(length // 2): if str[i] != str[length...
req = """ alembic==1.4.2 astroid==2.3.3 bandit==1.6.2 click==7.1.1 colorama==0.4.3 Flask==1.1.2 Flask-Env==2.0.0 Flask-JWT-Extended==3.24.1 flask-marshmallow==0.11.0 Flask-Migrate==2.5.3 Flask-SQLAlchemy==2.4.1 gitdb==4.0.5 GitPython==3.1.3 isort==4.3.21 itsdangerous==1.1.0 Jinja2==2.11.1 lazy-object-proxy==1.4.3 Mako=...
req = '\nalembic==1.4.2\nastroid==2.3.3\nbandit==1.6.2\nclick==7.1.1\ncolorama==0.4.3\nFlask==1.1.2\nFlask-Env==2.0.0\nFlask-JWT-Extended==3.24.1\nflask-marshmallow==0.11.0\nFlask-Migrate==2.5.3\nFlask-SQLAlchemy==2.4.1\ngitdb==4.0.5\nGitPython==3.1.3\nisort==4.3.21\nitsdangerous==1.1.0\nJinja2==2.11.1\nlazy-object-pro...
DJIA = pd.read_csv('data/DJIA.csv', parse_dates=['DATE'], na_values='.') # Since the dataset uses '.' to signal NA valeus, pandas represented that column as a # string instead of a float DJIA.set_index('DATE', inplace=True) ax = DJIA.plot(legend=False) ax.set_ylabel('DJIA') ax.set_xlabel('Date')
djia = pd.read_csv('data/DJIA.csv', parse_dates=['DATE'], na_values='.') DJIA.set_index('DATE', inplace=True) ax = DJIA.plot(legend=False) ax.set_ylabel('DJIA') ax.set_xlabel('Date')
"""Collection of utils for Statement Results of queries.""" def execution_time(result): """Return the execution time of a query.""" avail = result.summary().result_available_after cons = result.summary().result_consumed_after return avail + cons def total_db_hits(result): """Return th...
"""Collection of utils for Statement Results of queries.""" def execution_time(result): """Return the execution time of a query.""" avail = result.summary().result_available_after cons = result.summary().result_consumed_after return avail + cons def total_db_hits(result): """Return the # of db hit...
class Solution: def majorityElement(self, nums: List[int]) -> int: nums.sort() ans = nums[len(nums)//2] return ans
class Solution: def majority_element(self, nums: List[int]) -> int: nums.sort() ans = nums[len(nums) // 2] return ans
def sw_def(read, sequence): read_len = len(read) seq_len = len(sequence) dimension = (read_len + 1) * (seq_len + 1) dp_table = [0] * dimension gap_score = -2 match_score = 1 max_score = 0 max_score_coordinates = [] for i in range(read_len): i += 1 # because the dp ta...
def sw_def(read, sequence): read_len = len(read) seq_len = len(sequence) dimension = (read_len + 1) * (seq_len + 1) dp_table = [0] * dimension gap_score = -2 match_score = 1 max_score = 0 max_score_coordinates = [] for i in range(read_len): i += 1 row = i * (seq_len +...
def my_filter(predicate, sequence): for elt in sequence: if predicate(elt): yield elt even_numbers = my_filter(lambda x: x % 2 == 0, range(1, 11)) print(even_numbers) print(next(even_numbers)) print(list(even_numbers))
def my_filter(predicate, sequence): for elt in sequence: if predicate(elt): yield elt even_numbers = my_filter(lambda x: x % 2 == 0, range(1, 11)) print(even_numbers) print(next(even_numbers)) print(list(even_numbers))
'''def findSum(x): for i in range(x): x = x + i return x print(str(findSum(20)))'''
"""def findSum(x): for i in range(x): x = x + i return x print(str(findSum(20)))"""
#deklarasi funcion paramenter def hello(nama): print(f"heloo {nama}") #panggil hello("gamar")
def hello(nama): print(f'heloo {nama}') hello('gamar')
class Compatibility: def __init__(self, clauses): self.clauses = clauses def check(self): return all(self.evaluate()) def evaluate(self): return [c() for c in self.clauses]
class Compatibility: def __init__(self, clauses): self.clauses = clauses def check(self): return all(self.evaluate()) def evaluate(self): return [c() for c in self.clauses]
class BaseBlock: def __init__(self, value, position, branch=False, mass=None): self.value = value self.position = position self.branch = branch self.mass = mass self.extra = None def __str__(self): return self.value def __repr__(self): return self.v...
class Baseblock: def __init__(self, value, position, branch=False, mass=None): self.value = value self.position = position self.branch = branch self.mass = mass self.extra = None def __str__(self): return self.value def __repr__(self): return self.v...
# awsflow package filename template PKG_WHEEL_FNAME = "awsflow-{version}-py3-none-any.whl" # AWS role used for Lambda functions AWS_LAMBDA_ROLE = None # SSH keyfile downloaded from AWS to ssh into the master node AWS_SSH_KEY_PATHNAME = '~/.ssh/yourkeypair.pem' # default AWS region AWS_DEFAULT_REGION = 'eu-central-1'...
pkg_wheel_fname = 'awsflow-{version}-py3-none-any.whl' aws_lambda_role = None aws_ssh_key_pathname = '~/.ssh/yourkeypair.pem' aws_default_region = 'eu-central-1' aws_s3_bucket = 'yours3bucket' aws_s3_prefix = 'awsflow/pkg' aws_s3_base = 's3://{bucket}/{prefix}'.format(bucket=AWS_S3_BUCKET, prefix=AWS_S3_PREFIX) aws_s3_...
def add_time(start, duration, day_of_the_week = None): new_time = '' ## IDEA ONE # split start time into hours, minutes, AM/PM # convert 60 mins to 1 hour, 24 hours to 1 day # add duration hours and minutes to start time # 11:59 AM/PM -> 12:00 PM/AM ## IDEA TWO # for start time: convert every AM/PM to total minu...
def add_time(start, duration, day_of_the_week=None): new_time = '' start_minutes = convert_ampm(start) duration_minutes = convert_hm(duration) total_end_minutes = start_minutes + duration_minutes minutes_per_hour = 60 minutes_per_day = 24 * minutes_per_hour days_past = total_end_minutes // m...
# Open terminal > python3 classEg5.py # Start typing below commands and see the output # Base class class Person: actions = [] # def __init__(self): # self.actions = [] # Cannot be accessed from Derived class instance def addActions(self, action): self.actions.append(action) # Derived class class S...
class Person: actions = [] def add_actions(self, action): self.actions.append(action) class Student(Person): def __init__(self): self.name = 'Ashwin' def get_name(self): return 'My name is ' + self.name s1 = student() print(s1.getName()) s1.addActions('Eating') s1.addActions(...
class A: vc = 123 def __init__(self): self.vc = 321 a1 = A() a2 = A() print(a1.vc) print(a2.vc) print(A.vc)
class A: vc = 123 def __init__(self): self.vc = 321 a1 = a() a2 = a() print(a1.vc) print(a2.vc) print(A.vc)
def reverse(l): if len(l) == 0: return [] return reverse(l[1:]) + [ l[0]] assert reverse([1,2,3]) == [ 3,2,1] assert reverse(["a", "b"]) == [ "b", "a"] assert reverse(list(range(1,101))) == list(range(100,0,-1))
def reverse(l): if len(l) == 0: return [] return reverse(l[1:]) + [l[0]] assert reverse([1, 2, 3]) == [3, 2, 1] assert reverse(['a', 'b']) == ['b', 'a'] assert reverse(list(range(1, 101))) == list(range(100, 0, -1))
# Special methods in Python: Use __iadd__ to increment in-place; use __add__ to increment and create a new instance. # Author: Zhuo Lu # Test suite 1 print("\nTest suite 1\n") _i = i = 0 # Test int _t = t = (1, 2) # Test tuple _l = l = [1, 2] # Test list i += 1 t += (3,) l += [3] print(_i, i, _i is i) # Output...
print('\nTest suite 1\n') _i = i = 0 _t = t = (1, 2) _l = l = [1, 2] i += 1 t += (3,) l += [3] print(_i, i, _i is i) print(_t, t, _t is t) print(_l, l, _l is l) print('\nTest suite 2\n') class Foo: i = 0 t = (1, 2) l = [1, 2] def inc(self): self.i += 1 self.t += (3,) self.l += ...
# Copyright (c) 2016 Rackspace, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
get_request_count = {'type': 'object', 'properties': {'domain': {'type': 'string', 'format': 'uri'}, 'requestCount': {'type': 'object', 'properties': {'India': {'type': 'array', 'items': {'type': 'array'}}, 'EMEA': {'type': 'array', 'items': {'type': 'array'}}, 'APAC': {'type': 'array', 'items': {'type': 'array'}}, 'No...
class NurbsSurface(Surface,IDisposable,ISerializable,IEpsilonComparable[NurbsSurface]): """ Represents a Non Uniform Rational B-Splines (NURBS) surface. NurbsSurface(other: NurbsSurface) """ def ConstructConstObject(self,*args): """ ConstructConstObject(self: CommonObject,parentObject: object,sub...
class Nurbssurface(Surface, IDisposable, ISerializable, IEpsilonComparable[NurbsSurface]): """ Represents a Non Uniform Rational B-Splines (NURBS) surface. NurbsSurface(other: NurbsSurface) """ def construct_const_object(self, *args): """ ConstructConstObject(self: CommonObject,parentObject: o...
ll = [12, 'exo', '12321', 'exo', 213, 34, 33] # ll.reverse() # print(ll) # # print(ll.count('exo')) print(ll) print(ll.pop()) print(ll) print(ll.pop(2)) print(ll)
ll = [12, 'exo', '12321', 'exo', 213, 34, 33] print(ll) print(ll.pop()) print(ll) print(ll.pop(2)) print(ll)
class Solution: def minEatingSpeed(self, piles: List[int], h: int) -> int: def isok(k): count = 0 for p in piles: count += (p - 1) // k + 1 return count <= h l = 1 r = max(piles) while l < r: mid = (l + r)//2 ...
class Solution: def min_eating_speed(self, piles: List[int], h: int) -> int: def isok(k): count = 0 for p in piles: count += (p - 1) // k + 1 return count <= h l = 1 r = max(piles) while l < r: mid = (l + r) // 2 ...
### Test Runner command # testinfra -v test_redis.py def test_redis_is_installed(Package): redis = Package("redis-server") assert redis.is_installed def test_config_file(File): config_file = File('/etc/redis/redis.conf') assert config_file.contains('bind 127.0.0.1') # todo make it a regex assert...
def test_redis_is_installed(Package): redis = package('redis-server') assert redis.is_installed def test_config_file(File): config_file = file('/etc/redis/redis.conf') assert config_file.contains('bind 127.0.0.1') assert config_file.is_file def test_service_running(Service): service = service(...
# Photoset ID photoset_id = u'72157713956740191' # Camera tags camera_tags = { 'CanonEOSREBELT5i' : '\"DSLR\" \"APS-C\" \"Canon EOS Rebel T5i\"' , 'CanonEOSDIGITALREBELXTi': '\"DSLR\" \"APS-C\" \"Canon EOS Digital Rebel XTi\"', 'SamsungNXmini' : '\"CSC\" \"1-inch\" \"Samsung NX mini\"...
photoset_id = u'72157713956740191' camera_tags = {'CanonEOSREBELT5i': '"DSLR" "APS-C" "Canon EOS Rebel T5i"', 'CanonEOSDIGITALREBELXTi': '"DSLR" "APS-C" "Canon EOS Digital Rebel XTi"', 'SamsungNXmini': '"CSC" "1-inch" "Samsung NX mini"', '': ''} lens_tags = {'EF-S18-55mmf/3.5-5.6II': '"Canon EF-S 18-55mm f/3.5-5.6 II"'...
THEME_STYLESHEETS = [ 'light', 'dark', ] THEME_CHOICES = tuple([(x, x) for x in THEME_STYLESHEETS]) def stylesheet_url(syntax_highlighting_style, default=THEME_STYLESHEETS[0]): for stylesheet in THEME_STYLESHEETS: if syntax_highlighting_style == stylesheet: return 'css/%s.css' % style...
theme_stylesheets = ['light', 'dark'] theme_choices = tuple([(x, x) for x in THEME_STYLESHEETS]) def stylesheet_url(syntax_highlighting_style, default=THEME_STYLESHEETS[0]): for stylesheet in THEME_STYLESHEETS: if syntax_highlighting_style == stylesheet: return 'css/%s.css' % stylesheet ret...
def diag_diff(arr): len_col = len(arr) sum_diag1 = sum_diag2 = 0 for row in enumerate(arr): for col in enumerate(arr): sum_diag1 += arr[row[0]][row[0]] sum_diag2 += arr[row[0]][len_col - col[0] - 1] return sum_diag1 - sum_diag2
def diag_diff(arr): len_col = len(arr) sum_diag1 = sum_diag2 = 0 for row in enumerate(arr): for col in enumerate(arr): sum_diag1 += arr[row[0]][row[0]] sum_diag2 += arr[row[0]][len_col - col[0] - 1] return sum_diag1 - sum_diag2
file1 = open('reportRepair_input.txt', 'r') lines_read = file1.readlines() def calculate_answer(lines): for i in range(len(lines)): number = int(lines[i]) if number >= 2020: continue for j in range(i, len(lines)): second_number = int(lines[j]) if number ...
file1 = open('reportRepair_input.txt', 'r') lines_read = file1.readlines() def calculate_answer(lines): for i in range(len(lines)): number = int(lines[i]) if number >= 2020: continue for j in range(i, len(lines)): second_number = int(lines[j]) if number +...
# -*- coding: utf-8 -*- class ScrapeError(Exception): """scraping Failed"""
class Scrapeerror(Exception): """scraping Failed"""
class Ship: def __init__(self, shipType): self.name = shipType self.sunk = False if shipType == "Aircraft Carrier": self.size = 5 self.char = 'a' elif shipType == "Battleship": self.size = 4 self.char = 'b' elif shipType == "Destroyer": self.size = 3 self.char =...
class Ship: def __init__(self, shipType): self.name = shipType self.sunk = False if shipType == 'Aircraft Carrier': self.size = 5 self.char = 'a' elif shipType == 'Battleship': self.size = 4 self.char = 'b' elif shipType == 'De...
class CifsLugImportOpStatus(basestring): """ Status of the import operation of CIFS local users and groups Possible values: <ul> <li> "unknown" , <li> "success" , <li> "success_with_warnings" , <li> "failed" , <li> "in_progress" ...
class Cifslugimportopstatus(basestring): """ Status of the import operation of CIFS local users and groups Possible values: <ul> <li> "unknown" , <li> "success" , <li> "success_with_warnings" , <li> "failed" , <li> "in_progress" ...
class A: def f(self): ''' Function descr, argument types, return type ... ''' print('Hello world') return 'Hello world'
class A: def f(self): """ Function descr, argument types, return type ... """ print('Hello world') return 'Hello world'
def add(element): return def get(index): return
def add(element): return def get(index): return
class AssetNotFound(Exception): pass class CircularDependencyError(Exception): pass
class Assetnotfound(Exception): pass class Circulardependencyerror(Exception): pass
# pakage # __init__.py __all__ = []
__all__ = []
def for_Trepezium(): """ Pattern for : Trepezium using for loop""" for i in range(7): for j in range(20): if i==6 or i+j==6 or j-i==13 or i==0 and j in range(6,13): print('*',end=' ') else: print(' ',end=' ') print() def while_Trepezium(): """ Pattern for : Trepezium using while loop""" ...
def for__trepezium(): """ Pattern for : Trepezium using for loop""" for i in range(7): for j in range(20): if i == 6 or i + j == 6 or j - i == 13 or (i == 0 and j in range(6, 13)): print('*', end=' ') else: print(' ', end=' ') print() def ...
# Define a product function that accepts a list of numbers. # The function should return the product of the numbers. # The list will always have at least one value # # EXAMPLES # product([1, 2, 3]) => 6 # product([4, 5, 6, 7]) => 840 # product([10]) => 10 def product(lists): total = 1 for list in...
def product(lists): total = 1 for list in lists: total *= list return total print(product([1, 2, 3])) print(product([4, 5, 6, 7])) print(product([10]))
# Problem: https://projecteuler.net/problem=230 """ . Quite similar to problem 220. . Build a "Fibonacci tree" such that, . Let T(k) indicate the tree representing the k^th Fibonacci word. . T(1) and T(2) are leaf nodes. . The left node of T(k) is T(k-2), and the right node of T(k) is T...
""" . Quite similar to problem 220. . Build a "Fibonacci tree" such that, . Let T(k) indicate the tree representing the k^th Fibonacci word. . T(1) and T(2) are leaf nodes. . The left node of T(k) is T(k-2), and the right node of T(k) is T(k-1). . Keep the length of T(k) in T(k)....
for i in range (2,14): j=i*5-4 suma=0 print(j) suma=0 for i in range(1,13): t=5*i+1 suma=suma+t print(suma)
for i in range(2, 14): j = i * 5 - 4 suma = 0 print(j) suma = 0 for i in range(1, 13): t = 5 * i + 1 suma = suma + t print(suma)
# Time: O(n) # Soace: O(1) # Given a non-empty string s, you may delete at most one character. # Judge whether you can make it a palindrome. # # Example 1: # Input: "aba" # Output: True # Example 2: # Input: "abca" # Output: True # Explanation: You could delete the character 'c'. # Note: # The string will only contain...
class Solution(object): def is_palindrome(self, s): """ :type s: str :rtype: bool """ is_valid = lambda x: x == x[::-1] string = ''.join([x for x in s.lower() if x.isalnum()]) return is_valid(string) class Solution(object): def is_palindrome(self, s): ...
# Variables yes = ["Y", "y", "Yes", "yes"] no = ["N", "n", "No", "no"] # Starting Greeting print("Hello! How are you?") greeting = input(">>> ") print("Thats Good!") # Space print("") # Name print("What is your name?") name = input(">>> ") print("So your name is " + name + "?") choice = input(">>>") if choice in ye...
yes = ['Y', 'y', 'Yes', 'yes'] no = ['N', 'n', 'No', 'no'] print('Hello! How are you?') greeting = input('>>> ') print('Thats Good!') print('') print('What is your name?') name = input('>>> ') print('So your name is ' + name + '?') choice = input('>>>') if choice in yes: print('') print('Ok, I got it right') el...
# -*- coding: utf-8 -*- """ Declaration of constants. """ # ML constants DEFAULT_BATCH_SIZE = 256 MAX_BATCH_SIZE = 2**20 DEFAULT_GRADIENT_UPDATES_PER_PASS_COUNT = 8 PATIENCE = 10 # patience for early stopping # GPU GPU_MEMORY_LIMIT_MB = 4096 # Logging INFO_LOGGING_FILE_NAME = "info.log" DEBUG_LOGGING_FILE_NAME = "d...
""" Declaration of constants. """ default_batch_size = 256 max_batch_size = 2 ** 20 default_gradient_updates_per_pass_count = 8 patience = 10 gpu_memory_limit_mb = 4096 info_logging_file_name = 'info.log' debug_logging_file_name = 'debug.log'
_config = None def get_hide_prefix() -> str: return get_config_property("style", "hidePrefix") def is_sort_attributes() -> bool: return get_config_property("style", "sort") def is_rewrite_booktitle() -> bool: return get_config_property("style", "rewriteBooktitle", "rewrite") def get_attribute_names(...
_config = None def get_hide_prefix() -> str: return get_config_property('style', 'hidePrefix') def is_sort_attributes() -> bool: return get_config_property('style', 'sort') def is_rewrite_booktitle() -> bool: return get_config_property('style', 'rewriteBooktitle', 'rewrite') def get_attribute_names(hidd...
set_name(0x8007D77C, "GetTpY__FUs", SN_NOWARN) set_name(0x8007D798, "GetTpX__FUs", SN_NOWARN) set_name(0x8007D7A4, "Remove96__Fv", SN_NOWARN) set_name(0x8007D7DC, "AppMain", SN_NOWARN) set_name(0x8007D884, "MAIN_RestartGameTask__Fv", SN_NOWARN) set_name(0x8007D8B0, "GameTask__FP4TASK", SN_NOWARN) set_name(0x8007D948, "...
set_name(2147997564, 'GetTpY__FUs', SN_NOWARN) set_name(2147997592, 'GetTpX__FUs', SN_NOWARN) set_name(2147997604, 'Remove96__Fv', SN_NOWARN) set_name(2147997660, 'AppMain', SN_NOWARN) set_name(2147997828, 'MAIN_RestartGameTask__Fv', SN_NOWARN) set_name(2147997872, 'GameTask__FP4TASK', SN_NOWARN) set_name(2147998024, '...
r, c, zr, zc = [int(x) for x in input().split(" ")] result = [] for i in range(r): chars = list(input()) if len(chars) == c: for i in range(len(chars)): chars[i] = chars[i] * zc for i in range(zr): result.append(chars) for x in result: s = "" for y in x: ...
(r, c, zr, zc) = [int(x) for x in input().split(' ')] result = [] for i in range(r): chars = list(input()) if len(chars) == c: for i in range(len(chars)): chars[i] = chars[i] * zc for i in range(zr): result.append(chars) for x in result: s = '' for y in x: ...
# -*- coding: utf-8 -*- """Top-level package for ErnosCube.""" __author__ = """Andrew Franklin""" __email__ = "andfranklin3@gmail.com" __version__ = "0.1.0"
"""Top-level package for ErnosCube.""" __author__ = 'Andrew Franklin' __email__ = 'andfranklin3@gmail.com' __version__ = '0.1.0'
a, b, c = [int(x) for x in input().split()] a = a if a != 0 else 24 b = b if b != 0 else 24 c = c if c != 0 else 24 s = a + b + c print(s - 24 if s >= 24 else s)
(a, b, c) = [int(x) for x in input().split()] a = a if a != 0 else 24 b = b if b != 0 else 24 c = c if c != 0 else 24 s = a + b + c print(s - 24 if s >= 24 else s)
jI = 1 k = 0 q = 0 jF = 0 summ = 0 while jI < 4000000: if (jI/2) == int(jI/2): summ = summ + jI q = k k = jI jF = k + q jI = jF print("The sum of the even terms is:") print(summ)
j_i = 1 k = 0 q = 0 j_f = 0 summ = 0 while jI < 4000000: if jI / 2 == int(jI / 2): summ = summ + jI q = k k = jI j_f = k + q j_i = jF print('The sum of the even terms is:') print(summ)
def age_assignment(*args, **kwargs, ): # names_age = {} # for name in args: # first_letter = name[0] # names_age[name] = kwargs[first_letter] # # return names_age return {x: kwargs[x[0]] for x in args} print(age_assignment("Peter", "George", G=26, P=19)) print(age_assignment("Amy"...
def age_assignment(*args, **kwargs): return {x: kwargs[x[0]] for x in args} print(age_assignment('Peter', 'George', G=26, P=19)) print(age_assignment('Amy', 'Bill', 'Willy', W=36, A=22, B=61))
class ClassName: def instance_method(self): return self @staticmethod def static_method(): return 'nothing...' @classmethod def class_method(cls): return cls print(ClassName().instance_method()) print(ClassName().static_method()) print(ClassName().class_method()) print(C...
class Classname: def instance_method(self): return self @staticmethod def static_method(): return 'nothing...' @classmethod def class_method(cls): return cls print(class_name().instance_method()) print(class_name().static_method()) print(class_name().class_method()) print(...
# coding=utf-8 """ parse2csv.release ~~~~~~~~~~~~~~~~~ Module containing package release information. :copyright: (c) 2018 by Ali Ghaffaari. :license: MIT, see LICENSE for more details. """ # CONSTANTS ################################################################### # Development statuses: DS...
""" parse2csv.release ~~~~~~~~~~~~~~~~~ Module containing package release information. :copyright: (c) 2018 by Ali Ghaffaari. :license: MIT, see LICENSE for more details. """ ds_planning = 1 ds_prealpha = 2 ds_alpha = 3 ds_beta = 4 ds_stable = 5 ds_mature = 6 ds_inactive = 7 ds_string = {DS_PLANNI...
tab = False if tab: print('chocolate') print('tabs are cool')
tab = False if tab: print('chocolate') print('tabs are cool')
swap = lambda x, y : (y,x) x = int(input("Enter first number: ")) y = int(input("Enter second number: ")) x, y = swap(x, y) print("First number:", x) print("Second number:", y)
swap = lambda x, y: (y, x) x = int(input('Enter first number: ')) y = int(input('Enter second number: ')) (x, y) = swap(x, y) print('First number:', x) print('Second number:', y)
#entrada n = int(input()) #processamento n = str(n) msg = 'NO es de Mala Suerte' for i in range(0, len(n)): if n[i] == '1' and i != len(n) - 1: if n[i + 1] == '3': msg = 'es de Mala Suerte' break #saida print(n, msg)
n = int(input()) n = str(n) msg = 'NO es de Mala Suerte' for i in range(0, len(n)): if n[i] == '1' and i != len(n) - 1: if n[i + 1] == '3': msg = 'es de Mala Suerte' break print(n, msg)
class DrawingPatternPoint: def __init__(self, x_change: int, y_change: int, is_obligatory: bool = True): self.x_change = x_change self.y_change = y_change self.is_obligatory = is_obligatory def copy(self): return DrawingPatternPoint(self.x_change, self.y_change, self.is_obligato...
class Drawingpatternpoint: def __init__(self, x_change: int, y_change: int, is_obligatory: bool=True): self.x_change = x_change self.y_change = y_change self.is_obligatory = is_obligatory def copy(self): return drawing_pattern_point(self.x_change, self.y_change, self.is_obligat...
class TaskProblem(): def __init__(self, tasks, messages, processors, links): self.processors = processors self.links = links self.tasks = tasks self.messages = messages def __str__(self): res = describe('Tasks', self.tasks) res += describe('Messages', self.messag...
class Taskproblem: def __init__(self, tasks, messages, processors, links): self.processors = processors self.links = links self.tasks = tasks self.messages = messages def __str__(self): res = describe('Tasks', self.tasks) res += describe('Messages', self.message...
#output orcidFile='output/orcid.tsv' pubmedFile='output/pubmed.tsv' tfidfFile='output/orcid-tf-idf.txt' orcidToOrcid='output/orcid-to-orcid-tf-idf.tsv' #data demoPubmedFile='data/pubmed.tsv' demoOrcidFile='data/orcid.tsv' demoTfidfFile='data/orcid-tf-idf.txt' demoPurePeopleFile='data/pure_people.txt' demoPureOrcidFile...
orcid_file = 'output/orcid.tsv' pubmed_file = 'output/pubmed.tsv' tfidf_file = 'output/orcid-tf-idf.txt' orcid_to_orcid = 'output/orcid-to-orcid-tf-idf.tsv' demo_pubmed_file = 'data/pubmed.tsv' demo_orcid_file = 'data/orcid.tsv' demo_tfidf_file = 'data/orcid-tf-idf.txt' demo_pure_people_file = 'data/pure_people.txt' de...
X=int(input()) if X<=10**4: Divs=[] for a in range(1,X+1): if X%a==0: Divs.append(a) resp="" for a in Divs: resp+=str(a)+" " print(resp[0:len(resp)-1])
x = int(input()) if X <= 10 ** 4: divs = [] for a in range(1, X + 1): if X % a == 0: Divs.append(a) resp = '' for a in Divs: resp += str(a) + ' ' print(resp[0:len(resp) - 1])
def could_be_yaml(filename): return bool('.yml' in filename or '.yaml' in filename) def could_be_playbook(data): for phrase in ('hosts', 'include', 'import_playbook'): if phrase in data: return True return False def could_be_role(data): if not isinstance(data, list): re...
def could_be_yaml(filename): return bool('.yml' in filename or '.yaml' in filename) def could_be_playbook(data): for phrase in ('hosts', 'include', 'import_playbook'): if phrase in data: return True return False def could_be_role(data): if not isinstance(data, list): return...
""" contains all exceptions raised for package """ NoFileOrDir = ValueError('Must specify a file or directory') NotAvscFileError = ValueError() MissingFileError = OSError() NoFilesError = OSError BadReferenceError = ValueError( 'field to be referenced missing namespace or name keys' )
""" contains all exceptions raised for package """ no_file_or_dir = value_error('Must specify a file or directory') not_avsc_file_error = value_error() missing_file_error = os_error() no_files_error = OSError bad_reference_error = value_error('field to be referenced missing namespace or name keys')
class Solution: def calculate(self, s: str) -> int: prevOperator = "+" num = 0 result = 0 temp = 0 for char in s+"+": if char.isdigit(): num = num * 10 + int(char) elif char in "+-*/": currOperator = ch...
class Solution: def calculate(self, s: str) -> int: prev_operator = '+' num = 0 result = 0 temp = 0 for char in s + '+': if char.isdigit(): num = num * 10 + int(char) elif char in '+-*/': curr_operator = char ...
#!/usr/bin/python3 # -*- coding: utf8 -*- class CommandGUI: """ Manage command events """ def quit_gui(self, *args): """ Destroy window and close app """ self.window.destroy() self.window.template = None def fullscreen(self, *args): """ Ch...
class Commandgui: """ Manage command events """ def quit_gui(self, *args): """ Destroy window and close app """ self.window.destroy() self.window.template = None def fullscreen(self, *args): """ Change between full screen """ ...
name_for_user_id = { 321: "Alice", 560: "Bob", 875: "Dilbert" } def gretting(userid): return f"Hi {name_for_user_id.get(userid, 'there')}!" print(gretting(321)) print(greetting(872132))
name_for_user_id = {321: 'Alice', 560: 'Bob', 875: 'Dilbert'} def gretting(userid): return f"Hi {name_for_user_id.get(userid, 'there')}!" print(gretting(321)) print(greetting(872132))
image_size = 224 n_channels = 3 patch_size = 14 n_classes = 10 d_model = 128 d_ffn = 768 n_blocks = 30 configs = { "Ti": { "image_size": image_size, "n_channels": n_channels, "patch_size": patch_size, "d_model": d_model, "d_ffn": d_ffn, "n_blocks": n_blocks, ...
image_size = 224 n_channels = 3 patch_size = 14 n_classes = 10 d_model = 128 d_ffn = 768 n_blocks = 30 configs = {'Ti': {'image_size': image_size, 'n_channels': n_channels, 'patch_size': patch_size, 'd_model': d_model, 'd_ffn': d_ffn, 'n_blocks': n_blocks, 'n_classes': n_classes}, 'S': {'image_size': image_size, 'n_cha...
strings_one = input().split(', ') text = input() new_strings = [word for word in strings_one if word in text] print(new_strings)
strings_one = input().split(', ') text = input() new_strings = [word for word in strings_one if word in text] print(new_strings)
# # @lc app=leetcode id=29 lang=python3 # # [29] Divide Two Integers # class Solution: def divide(self, dividend: int, divisor: int) -> int: sign = (dividend<0) is (divisor <0) dividend, divisor = abs(dividend), abs(divisor) res= 0 while dividend >= divisor: tmp, i = div...
class Solution: def divide(self, dividend: int, divisor: int) -> int: sign = (dividend < 0) is (divisor < 0) (dividend, divisor) = (abs(dividend), abs(divisor)) res = 0 while dividend >= divisor: (tmp, i) = (divisor, 1) while dividend >= tmp: ...
# the short name of the plugin, as used by the logger PLUGIN_NAME = 'link_checker' # mkdocs site build output directory MKDOCS_SITE_DIRECTORY = 'site' # list of links to exclude from validation EXCLUDED_LINKS = [ 'https://www.mkdocs.org', 'https://squidfunk.github.io/mkdocs-material/' ] # the base url of the...
plugin_name = 'link_checker' mkdocs_site_directory = 'site' excluded_links = ['https://www.mkdocs.org', 'https://squidfunk.github.io/mkdocs-material/'] old_site_prefix = 'https://github.com/Netflix/atlas/wiki' new_site_prefix = 'https://netflix.github.io/atlas-docs/'
# https://www.hackerrank.com/challenges/pairs/problem def pairs(k, arr): dic = {} count = 0 for i,a in enumerate(arr): if a-k in dic: count +=1 if a+k in dic: count += 1 dic[a] = i return count
def pairs(k, arr): dic = {} count = 0 for (i, a) in enumerate(arr): if a - k in dic: count += 1 if a + k in dic: count += 1 dic[a] = i return count
############################# # 8. String to Integer (atoi) ############################# class Solution: def myAtoi(self, str): """ :type str: str :rtype: int """ if not str: return 0 i = 0 while i<len(str) and str[i]==" ": i += 1 ...
class Solution: def my_atoi(self, str): """ :type str: str :rtype: int """ if not str: return 0 i = 0 while i < len(str) and str[i] == ' ': i += 1 str = str[i:] if not str: return 0 if str[0] == '-':...
""" Global Config and Constants """ __all__ = ['is_exportable', 'is_scriptable', 'set_exportable', 'set_scriptable'] # Set to True if exporting a model with Same padding via ONNX _EXPORTABLE = False # Set to True if wanting to use torch.jit.script on a model _SCRIPTABLE = True def is_exportable(): return _EXPO...
""" Global Config and Constants """ __all__ = ['is_exportable', 'is_scriptable', 'set_exportable', 'set_scriptable'] _exportable = False _scriptable = True def is_exportable(): return _EXPORTABLE def set_exportable(value): global _EXPORTABLE _exportable = value def is_scriptable(): return _SCRIPTABLE...
def temperature1(): rhs_Tw = '(1 / tau_w) * ((Tc - Tw) + eta * (Tp - Tw))' rhs_Tp = '(1 / tau_ps) * (Tw - Tp)' odes = {'Tw': rhs_Tw, 'Tp': rhs_Tp} return odes def temperature2(): rhs_Tw = '(1 / tau_w) * ((Tc - Tw) + eta * (Tp - Tw))' rhs_Tp = '0' rhs_Qp = 'hp * Ap * (Tw - Tmelt)' od...
def temperature1(): rhs__tw = '(1 / tau_w) * ((Tc - Tw) + eta * (Tp - Tw))' rhs__tp = '(1 / tau_ps) * (Tw - Tp)' odes = {'Tw': rhs_Tw, 'Tp': rhs_Tp} return odes def temperature2(): rhs__tw = '(1 / tau_w) * ((Tc - Tw) + eta * (Tp - Tw))' rhs__tp = '0' rhs__qp = 'hp * Ap * (Tw - Tmelt)' o...
n = int(input()) for i in range(n): line = input().split() j = 0 pos = 0 for j in range(len(line)-1): if j != 0 and j != len(line)-1: if int(line[j]) + 1 != int(line[j+1]) and pos == 0: pos = j+1 print(pos)
n = int(input()) for i in range(n): line = input().split() j = 0 pos = 0 for j in range(len(line) - 1): if j != 0 and j != len(line) - 1: if int(line[j]) + 1 != int(line[j + 1]) and pos == 0: pos = j + 1 print(pos)
def simple_number(n): if n > 2: i = 2 lim = n ** 0.5 while i <= lim: if n % i == 0: return False break i += 1 else: return True else: return True def list_of_divs(n): i = 1 new_list = [] lim = n / 2 while ...
def simple_number(n): if n > 2: i = 2 lim = n ** 0.5 while i <= lim: if n % i == 0: return False break i += 1 else: return True else: return True def list_of_divs(n): i = 1 new_list = [] lim ...
# https://www.interviewbit.com/problems/repeat-and-missing-number-array/ # Repeat and Missing Number Array # Input:[3 1 2 5 3] Output:[3, 4] A = 3, B = 4 class Solution: # @param A : tuple of integers # @return a list of integers def repeatedNumber(self, arr): repeated =0 missing =0 ...
class Solution: def repeated_number(self, arr): repeated = 0 missing = 0 aux = [-1] * len(arr) for item in arr: if aux[item - 1] == 1: repeated = item break else: aux[item - 1] = 1 n = len(arr) m...
# Tons of built-in Functions # useful resource to see built-in functions are ... ### # https://www.w3schools.com/python/default.asp # https://docs.python.org/3/library/functions.html # ### ### # abs(-1515) - absolute value # bool() - # input() - # len() # range() - # str() - # int() - # ### i ...
i = [3, 6, 3, 7]
a = int(input()) b = int(input()) c = int(input()) print('A = {}, B = {}, C = {}'.format(a, b, c)) print('A = {:>10}, B = {:>10}, C = {:>10}'.format(a, b, c)) print('A = {:010}, B = {:010}, C = {:010}'.format(a, b, c)) print('A = {:<10}, B = {:<10}, C = {:<10}'.format(a, b, c))
a = int(input()) b = int(input()) c = int(input()) print('A = {}, B = {}, C = {}'.format(a, b, c)) print('A = {:>10}, B = {:>10}, C = {:>10}'.format(a, b, c)) print('A = {:010}, B = {:010}, C = {:010}'.format(a, b, c)) print('A = {:<10}, B = {:<10}, C = {:<10}'.format(a, b, c))
class IExecutor(): def exec(self, query, args=[]): pass def find_one(self, query, args=[]): pass def find_list(self, query, args=[]): pass
class Iexecutor: def exec(self, query, args=[]): pass def find_one(self, query, args=[]): pass def find_list(self, query, args=[]): pass
def find_min_coins(v, arr): res = [] i = 0 arr.sort(reverse=True) while i < len(arr) and v > 0 : if arr[i] <= v : x = v//arr[i] temp = [arr[i]]*x res = res + temp v = v%arr[i] i+=1 return res
def find_min_coins(v, arr): res = [] i = 0 arr.sort(reverse=True) while i < len(arr) and v > 0: if arr[i] <= v: x = v // arr[i] temp = [arr[i]] * x res = res + temp v = v % arr[i] i += 1 return res
class dotWeldGeometry_t(object): """ dotWeldGeometry_t(weldId: Identifier,position: int,maxPolygonPointsPerRequest: int) """ def CopyAndInitialize(self): """ CopyAndInitialize(self: dotWeldGeometry_t) -> dotWeldGeometry_t """ pass @staticmethod def __new__(self, weldId, positio...
class Dotweldgeometry_T(object): """ dotWeldGeometry_t(weldId: Identifier,position: int,maxPolygonPointsPerRequest: int) """ def copy_and_initialize(self): """ CopyAndInitialize(self: dotWeldGeometry_t) -> dotWeldGeometry_t """ pass @staticmethod def __new__(self, weldId, position, max...
# Bind a literal string object to a name: a = "foo" # Bind an empty list to another name: b = [] # Classes are "factories" for creating new objects: invoke class name as a function: class Foo(object): pass c = Foo() # Again, but with optional initialization: class Bar(object): def __init__(self, initializer = N...
a = 'foo' b = [] class Foo(object): pass c = foo() class Bar(object): def __init__(self, initializer=None): if initializer is not None: self.value = initializer d = bar(10) print(d.value) if a is b: pass if id(a) == id(b): pass def a(fmt, *args): if fmt is None: fmt =...
"""Function returns the opposite of an input number.""" def opposite(n): """Return opposite of number.""" return n * -1
"""Function returns the opposite of an input number.""" def opposite(n): """Return opposite of number.""" return n * -1
{ "targets": [ { "target_name": "process", "sources": ["src/process.cpp"], "include_dirs": ["<!(node -e \"require('nan')\")"] }, { "target_name": "file", "sources": ["src/file.cpp"], "include_dirs": ["<!(node -e \"require('nan')\")"] }, { "target_name": "s...
{'targets': [{'target_name': 'process', 'sources': ['src/process.cpp'], 'include_dirs': ['<!(node -e "require(\'nan\')")']}, {'target_name': 'file', 'sources': ['src/file.cpp'], 'include_dirs': ['<!(node -e "require(\'nan\')")']}, {'target_name': 'screen', 'sources': ['src/screen.cpp'], 'include_dirs': ['<!(node -e "re...
# Given an unsorted array of integers, find the length of longest continuous increasing subsequence (subarray). # Example 1: # Input: [1,3,5,4,7] # Output: 3 # Explanation: The longest continuous increasing subsequence is [1,3,5], its length is 3. # Even though [1,3,5,7] is also an increasing subsequence, it's not a c...
class Solution: def find_length_of_lcis(self, nums: List[int]) -> int: a = 0 j = 1 m = 0 n = len(nums) if n == 0: return 0 if n == 1: return 1 for i in range(n - 1): if nums[i] < nums[i + 1]: j += 1 ...
n=int(input()) l1=list(map(int,input().split())) ans=0 for i in l1: ans=ans+float(i/100) s2=float((ans/n)*100) print(s2)
n = int(input()) l1 = list(map(int, input().split())) ans = 0 for i in l1: ans = ans + float(i / 100) s2 = float(ans / n * 100) print(s2)
# Time complexity: O(nlogn) def find_max_crossing_subarray(A, low, mid, high): sum, left_sum = 0, -1000000000000 for i in range(mid, low - 1, -1): sum += A[i] if sum > left_sum: left_sum = sum max_left = i sum, right_sum = 0, -1000000000000 for i in range(mid + 1,...
def find_max_crossing_subarray(A, low, mid, high): (sum, left_sum) = (0, -1000000000000) for i in range(mid, low - 1, -1): sum += A[i] if sum > left_sum: left_sum = sum max_left = i (sum, right_sum) = (0, -1000000000000) for i in range(mid + 1, high + 1): ...
""" TACCJM Exceptions """ __author__ = "Carlos del-Castillo-Negrete" __copyright__ = "Carlos del-Castillo-Negrete" __license__ = "MIT" class TJMCommandError(Exception): """ Custom exception to wrap around executions of any commands sent to TACC resource. This exception gets thrown first by the _execute_...
""" TACCJM Exceptions """ __author__ = 'Carlos del-Castillo-Negrete' __copyright__ = 'Carlos del-Castillo-Negrete' __license__ = 'MIT' class Tjmcommanderror(Exception): """ Custom exception to wrap around executions of any commands sent to TACC resource. This exception gets thrown first by the _execute_co...
# https://leetcode.com/problems/house-robber-ii/ class Solution: def rob(self, nums: List[int]) -> int: return max(nums[0], self.helper(nums[1:]), self.helper(nums[:-1])) def helper(self, nums): rob1, rob2 = 0, 0 for n in nums: newRob = max(rob1 + n, rob2)...
class Solution: def rob(self, nums: List[int]) -> int: return max(nums[0], self.helper(nums[1:]), self.helper(nums[:-1])) def helper(self, nums): (rob1, rob2) = (0, 0) for n in nums: new_rob = max(rob1 + n, rob2) (rob1, rob2) = (rob2, newRob) return rob2
x = (5, 6) def f(): return (7, 8) f()
x = (5, 6) def f(): return (7, 8) f()
class QueryResponse: key = "" num_args = 0 arg_types = [] f = None description = "" def __init__(self, key, num_args, arg_types, f): self.key = key self.num_args = num_args self.arg_types = arg_types self.f = f # TODO: validate arg_types
class Queryresponse: key = '' num_args = 0 arg_types = [] f = None description = '' def __init__(self, key, num_args, arg_types, f): self.key = key self.num_args = num_args self.arg_types = arg_types self.f = f
# Modify the checkAnswer method of the Question class so that it does not take into # account different spaces or upper/lowercase characters. For example, the response # "GUIDO van Rossum" should match an answer of "Guido van Rossum" . class Question: def __init__(self): self._text = "" self._answ...
class Question: def __init__(self): self._text = '' self._answer = '' def set_text(self, questionText): self._text = questionText def set_answer(self, correctResponse): self._answer = correctResponse def check_answer(self, response): return response.lower() ==...
# Float or double : 34.567839023, 12.345, 8923.1234857, 3456.091 ''' In Python there is only one built in datatype that handle single point precision - float. Python3.x has single floating number precision of (17-18) equivalent of C#9's double (16-17 symbols) ''' float_numbers = [34.567839023,12.345,8923.1234857, 34...
""" In Python there is only one built in datatype that handle single point precision - float. Python3.x has single floating number precision of (17-18) equivalent of C#9's double (16-17 symbols) """ float_numbers = [34.567839023, 12.345, 8923.1234857, 3456.091] float_number_01 = 34.567839023 print(type(float_numbers))...
# # PySNMP MIB module Juniper-File-Transfer-CONF (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-File-Transfer-CONF # Produced by pysmi-0.3.4 at Wed May 1 14:02:46 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version ...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constraint, constraints_intersection, constraints_union, single_value_constraint) ...
#author: Luca Rospocher class Object1: def __init__(self): self.field1 = 0 self.field2 = "" pass class Object2: def __init__(self): self.field1 = 0 self.field2 = False self.field3 = [] self.field4 = [] pass list1 = [] list2 = [] def main...
class Object1: def __init__(self): self.field1 = 0 self.field2 = '' pass class Object2: def __init__(self): self.field1 = 0 self.field2 = False self.field3 = [] self.field4 = [] pass list1 = [] list2 = [] def main(): print('reading file...'...
n=int(input()) x=1 ans=0 while(x<=n): ans+=n//x x*=3 print(ans)
n = int(input()) x = 1 ans = 0 while x <= n: ans += n // x x *= 3 print(ans)
class Node: def __init__(self, key, val): self.key = key self.val = val self.next = None self.prev = None def __str__(self): # For debugging return f"(key={self.key}, val={self.val})" class LinkedList: def __init__(self): # Note: sent...
class Node: def __init__(self, key, val): self.key = key self.val = val self.next = None self.prev = None def __str__(self): return f'(key={self.key}, val={self.val})' class Linkedlist: def __init__(self): self.sentinel = node(None, None) self.sent...
#Question: #Take User age as input and check if they are more than 18 or not. If they are more #than 18 years old allow them to drive else stop them. #Your answer should look like : #You are 18 years old so you can drive,Have a good Journey #or, You can't drive #Answer: age = int(input("Enter your age: "))...
age = int(input('Enter your age: ')) if age == 18: print('You are 18 years old so you can drive,Have a good Journey') elif age > 18: print('You are more than 18 years old so you can drive,Have a good Journey') else: print("You can't drive")
''' Speed: 99.48% Memory: 81.78% Time Complexity: O(N*M) where N = len(s1) and M = len(s2) ''' class Solution: def minDistance(self, s1: str, s2: str) -> int: @lru_cache(None) def editdistance(i,j,s1=s1,s2=s2): if not i: return j ...
""" Speed: 99.48% Memory: 81.78% Time Complexity: O(N*M) where N = len(s1) and M = len(s2) """ class Solution: def min_distance(self, s1: str, s2: str) -> int: @lru_cache(None) def editdistance(i, j, s1=s1, s2=s2): if not i: return j ...