content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
#Copyright 2018 Infosys Ltd. #Use of this source code is governed by Apache 2.0 license that can be found in the LICENSE file or at #http://www.apache.org/licenses/LICENSE-2.0 . ####DATABASE QUERY STATUS CODES#### CON000 = 'CON000' # Successfull database connection CON001 = 'CON001' # Failed to connect to databa...
con000 = 'CON000' con001 = 'CON001' exe000 = 'EXE000' exe001 = 'EXE001'
#a = int(input()) #b = int(input()) entrada = input() a, b = entrada.split(" ") a = int(a) b = int(b) if(a > b): if(a%b == 0): print ("Sao Multiplos") else: print("Nao sao Multiplos") else: if(b%a == 0): print("Sao Multiplos") else: print("Nao sao Multiplos")
entrada = input() (a, b) = entrada.split(' ') a = int(a) b = int(b) if a > b: if a % b == 0: print('Sao Multiplos') else: print('Nao sao Multiplos') elif b % a == 0: print('Sao Multiplos') else: print('Nao sao Multiplos')
class Solution: def orangesRotting(self, grid: List[List[int]]) -> int: d=0 while True: c=False old=[] for i in range(len(grid)): s=[] for j in range(len(grid[0])): s.append(grid[i][j]) old.append...
class Solution: def oranges_rotting(self, grid: List[List[int]]) -> int: d = 0 while True: c = False old = [] for i in range(len(grid)): s = [] for j in range(len(grid[0])): s.append(grid[i][j]) ...
class Solution: def binaryGap(self, n: int) -> int: a = str(bin(n)) a = a[2:] dis = [] c = 0 for i in range(len(a)): if a[i] == "1": dis.append(c) c = 0 c +=1 return max(dis) ...
class Solution: def binary_gap(self, n: int) -> int: a = str(bin(n)) a = a[2:] dis = [] c = 0 for i in range(len(a)): if a[i] == '1': dis.append(c) c = 0 c += 1 return max(dis)
# coding: utf-8 # In[1]: #num01_SwethaMJ.py sum_ = 0 for i in range(1,1000): if i%3==0 or i%5==0: sum_ += i print(sum_)
sum_ = 0 for i in range(1, 1000): if i % 3 == 0 or i % 5 == 0: sum_ += i print(sum_)
# M6 #2 str = 'inet addr:127.0.0.1 Mask:255.0.0.0' index = str.find(':') if index > 0: # clip off the front str1 = str[index+1:] i = str1.find(' ') addr = str1[:i].rstrip() # addr is the inet address print('Address: ', addr)
str = 'inet addr:127.0.0.1 Mask:255.0.0.0' index = str.find(':') if index > 0: str1 = str[index + 1:] i = str1.find(' ') addr = str1[:i].rstrip() print('Address: ', addr)
# (C) Datadog, Inc. 2010-2016 # All rights reserved # Licensed under Simplified BSD License (see LICENSE) class Singleton(type): _instances = {} def __call__(cls, *args, **kwargs): if cls not in cls._instances: cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs) ...
class Singleton(type): _instances = {} def __call__(cls, *args, **kwargs): if cls not in cls._instances: cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs) return cls._instances[cls]
class Solution: def romanToInt(self, s: str) -> int: dic = {"I":1,"V":5,"X":10,"L":50,"C":100,"D":500,"M":1000} res = 0 while s: letter = s[0] if len(s)==1: res+=dic[letter] return res if dic[letter]>=d...
class Solution: def roman_to_int(self, s: str) -> int: dic = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} res = 0 while s: letter = s[0] if len(s) == 1: res += dic[letter] return res if dic[letter] >= d...
class blank (object): def __init__ (self): object.__init__ (self) deployment_settings = blank () # Web2py Settings deployment_settings.web2py = blank () deployment_settings.web2py.port = 8000 # Database settings deployment_settings.database = blank () deployment_settings.database.db_type = "sqlite" deplo...
class Blank(object): def __init__(self): object.__init__(self) deployment_settings = blank() deployment_settings.web2py = blank() deployment_settings.web2py.port = 8000 deployment_settings.database = blank() deployment_settings.database.db_type = 'sqlite' deployment_settings.database.host = 'localhost' dep...
def insertion_sort(to_sort): i=0 while i <= len(to_sort)-1: hole = i; item = to_sort[i] while hole > 0 and to_sort[hole-1] > item: to_sort[hole] = to_sort[hole-1] hole-=1 to_sort[hole] = item i+=1 return to_sort
def insertion_sort(to_sort): i = 0 while i <= len(to_sort) - 1: hole = i item = to_sort[i] while hole > 0 and to_sort[hole - 1] > item: to_sort[hole] = to_sort[hole - 1] hole -= 1 to_sort[hole] = item i += 1 return to_sort
load_modules = { 'hw_USBtin': {'port':'auto', 'speed':500}, # IO hardware module # Module for sniff and replay 'mod_stat': {"bus":'mod_stat','debug':2},'mod_stat~2': {"bus":'mod_stat'}, 'mod_firewall': {}, 'mod_fuzz1':{'debug':2}, 'gen_replay': {'debug': 1}# Stats }...
load_modules = {'hw_USBtin': {'port': 'auto', 'speed': 500}, 'mod_stat': {'bus': 'mod_stat', 'debug': 2}, 'mod_stat~2': {'bus': 'mod_stat'}, 'mod_firewall': {}, 'mod_fuzz1': {'debug': 2}, 'gen_replay': {'debug': 1}} actions = [{'hw_USBtin': {'action': 'read', 'pipe': 1}}, {'mod_stat': {'pipe': 1}}, {'mod_firewall': {'w...
def dragon_lives_for(sequence): dragon_size = 50 sheep = 0 squeezed_for = 0 days = 0 while True: sheep += sequence.pop(0) if dragon_size <= sheep: sheep -= dragon_size dragon_size += 1 squeezed_for = 0 else: sheep = 0 ...
def dragon_lives_for(sequence): dragon_size = 50 sheep = 0 squeezed_for = 0 days = 0 while True: sheep += sequence.pop(0) if dragon_size <= sheep: sheep -= dragon_size dragon_size += 1 squeezed_for = 0 else: sheep = 0 ...
load("//tools/bzl:maven_jar.bzl", "maven_jar") def external_plugin_deps(): AUTO_VALUE_VERSION = "1.7.4" maven_jar( name = "auto-value", artifact = "com.google.auto.value:auto-value:" + AUTO_VALUE_VERSION, sha1 = "6b126cb218af768339e4d6e95a9b0ae41f74e73d", ) maven_jar( ...
load('//tools/bzl:maven_jar.bzl', 'maven_jar') def external_plugin_deps(): auto_value_version = '1.7.4' maven_jar(name='auto-value', artifact='com.google.auto.value:auto-value:' + AUTO_VALUE_VERSION, sha1='6b126cb218af768339e4d6e95a9b0ae41f74e73d') maven_jar(name='auto-value-annotations', artifact='com.goo...
# -*- coding: utf-8 -*- class AzureShellCache: __inst = None __cache = {} @staticmethod def Instance(): if AzureShellCache.__inst == None: AzureShellCache() return AzureShellCache.__inst def __init__(self): if AzureShellCache.__inst != None: raise ...
class Azureshellcache: __inst = None __cache = {} @staticmethod def instance(): if AzureShellCache.__inst == None: azure_shell_cache() return AzureShellCache.__inst def __init__(self): if AzureShellCache.__inst != None: raise exception('This must not...
solutions = [] maxAllowed = 10**1000 value = 1 base = 1 while value * value <= maxAllowed: while value < base * 10: solutions.append(value) value += base base = value solutions.append(value) while True: num = int(input()) if num == 0: break # Binary search ...
solutions = [] max_allowed = 10 ** 1000 value = 1 base = 1 while value * value <= maxAllowed: while value < base * 10: solutions.append(value) value += base base = value solutions.append(value) while True: num = int(input()) if num == 0: break start = 0 end = len(solution...
# template_parsetab.py # This file is automatically generated. Do not edit. # pylint: disable=W,C,R _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'template_validateALL ARROW ARROWPARENS ARROW_PRE ASSIGN ASSIGNBAND ASSIGNBOR ASSIGNBXOR ASSIGNDIVIDE ASSIGNLLSHIFT ASSIGNLSHIFT ASSIGNMINUS ASSIGNMOD ASSIGNPLU...
_tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'template_validateALL ARROW ARROWPARENS ARROW_PRE ASSIGN ASSIGNBAND ASSIGNBOR ASSIGNBXOR ASSIGNDIVIDE ASSIGNLLSHIFT ASSIGNLSHIFT ASSIGNMINUS ASSIGNMOD ASSIGNPLUS ASSIGNRRSHIFT ASSIGNRSHIFT ASSIGNTIMES AWAIT BACKSLASH BAND BITINV BNEGATE BOR BREAK BXOR BYTE CASE C...
def f(): print('f executed from module 1') if __name__ == '__main__': print('We are in module 1')
def f(): print('f executed from module 1') if __name__ == '__main__': print('We are in module 1')
n=int(input("Enter a number : ")) r=int(input("Enter range of table : ")) print("Multiplication Table of",n,"is") for i in range(0,r): i=i+1 print(n,"X",i,"=",n*i) print("Loop completed")
n = int(input('Enter a number : ')) r = int(input('Enter range of table : ')) print('Multiplication Table of', n, 'is') for i in range(0, r): i = i + 1 print(n, 'X', i, '=', n * i) print('Loop completed')
PRACTICE = False N_DAYS = 80 with open("test.txt" if PRACTICE else "input.txt", "r") as f: content = f.read().strip() state = list(map(int, content.split(","))) def next_day(state): new_state = [] num_new = 0 for fish in state: if fish == 0: new_state.append(6) num_new...
practice = False n_days = 80 with open('test.txt' if PRACTICE else 'input.txt', 'r') as f: content = f.read().strip() state = list(map(int, content.split(','))) def next_day(state): new_state = [] num_new = 0 for fish in state: if fish == 0: new_state.append(6) num_new +...
# This program says hello print("Hello World!") # Ask the user to input their name and assign it to the name variable print("What is your name? ") myName = input() # Print out greet followed by name print("It is good to meet you, " + myName) # Print out the length of the name print("The length of your name " + str(le...
print('Hello World!') print('What is your name? ') my_name = input() print('It is good to meet you, ' + myName) print('The length of your name ' + str(len(myName))) print('What is your age?') my_age = input() print('You will be ' + str(int(myAge) + 1) + 'in a year. ')
N = int(input()) x, y = 0, 0 for _ in range(N): T, S = input().split() T = int(T) x += min(int(12 * T / 1000), len(S)) y += max(len(S) - int(12 * T / 1000), 0) print(x, y)
n = int(input()) (x, y) = (0, 0) for _ in range(N): (t, s) = input().split() t = int(T) x += min(int(12 * T / 1000), len(S)) y += max(len(S) - int(12 * T / 1000), 0) print(x, y)
# -*- coding: utf-8 -*- # tomolab # Michele Scipioni # Harvard University, Martinos Center for Biomedical Imaging # University of Pisa LIGHT_BLUE = "rgb(200,228,246)" BLUE = "rgb(47,128,246)" LIGHT_RED = "rgb(246,228,200)" RED = "rgb(246,128,47)" LIGHT_GRAY = "rgb(246,246,246)" GRAY = "rgb(200,200,200)" GREEN = "rgb(0...
light_blue = 'rgb(200,228,246)' blue = 'rgb(47,128,246)' light_red = 'rgb(246,228,200)' red = 'rgb(246,128,47)' light_gray = 'rgb(246,246,246)' gray = 'rgb(200,200,200)' green = 'rgb(0,100,0)'
__all__ = [ 'manager', \ 'node', \ 'feature', \ 'python_utils' ]
__all__ = ['manager', 'node', 'feature', 'python_utils']
TEST_LAT=-12 TEST_LONG=60 TEST_LOCATION_HIERARCHY_FOR_GEO_CODE=['madagascar'] class DummyLocationTree(object): def get_location_hierarchy_for_geocode(self, lat, long ): return TEST_LOCATION_HIERARCHY_FOR_GEO_CODE def get_centroid(self, location_name, level): if location_name=="jalgaon" and lev...
test_lat = -12 test_long = 60 test_location_hierarchy_for_geo_code = ['madagascar'] class Dummylocationtree(object): def get_location_hierarchy_for_geocode(self, lat, long): return TEST_LOCATION_HIERARCHY_FOR_GEO_CODE def get_centroid(self, location_name, level): if location_name == 'jalgaon'...
# # PySNMP MIB module HUAWEI-PGI-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-PGI-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:35:58 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, value_size_constraint, constraints_union, value_range_constraint) ...
class Solution: def frequencySort(self, s: str) -> str: freq = {} for ch in s: if(ch in freq): freq[ch] += 1 else: freq[ch] = 1 out = "" for k,v in sorted(freq.items(), key=lambda x: x[1], reverse=True): ou...
class Solution: def frequency_sort(self, s: str) -> str: freq = {} for ch in s: if ch in freq: freq[ch] += 1 else: freq[ch] = 1 out = '' for (k, v) in sorted(freq.items(), key=lambda x: x[1], reverse=True): out += k...
psys_game_rain = 0 psys_game_snow = 1 psys_game_blood = 2 psys_game_blood_2 = 3 psys_game_hoof_dust = 4 psys_game_hoof_dust_mud = 5 psys_game_water_splash_1 = 6 psys_game_water_splash_2 = 7 psys_game_water_splash_3 = 8 psys_torch_fire = 9 psys_fire_glow_1 = 10 psys_fire_glow_fixed = 11 psys_torch_smoke = 12 psys_flue_s...
psys_game_rain = 0 psys_game_snow = 1 psys_game_blood = 2 psys_game_blood_2 = 3 psys_game_hoof_dust = 4 psys_game_hoof_dust_mud = 5 psys_game_water_splash_1 = 6 psys_game_water_splash_2 = 7 psys_game_water_splash_3 = 8 psys_torch_fire = 9 psys_fire_glow_1 = 10 psys_fire_glow_fixed = 11 psys_torch_smoke = 12 psys_flue_s...
def isEven(num): num1 = num / 2 num2 = num // 2 if num1 == num2: return True else: return False # pi = (4/1) - (4/3) + (4/5) - (4/7) + (4/9) - (4/11) + (4/13) - (4/15) pi = 0.0 for index, i in enumerate(range(1, 100), start=1): thing = (4/((2 * index) - 1)) if isEven(index): ...
def is_even(num): num1 = num / 2 num2 = num // 2 if num1 == num2: return True else: return False pi = 0.0 for (index, i) in enumerate(range(1, 100), start=1): thing = 4 / (2 * index - 1) if is_even(index): pi -= thing else: pi += thing print(pi)
DOMAIN = { '20191016_1571241600': {'datasource': {'source': '20191016_1571241600'}}, '20191210_1575997200': {'datasource': {'source': '20191210_1575997200'}}, '20190724_1563969600': {'datasource': {'source': '20190724_1563969600'}}, '20191128_1574982000': {'datasource': {'source': '20191128_...
domain = {'20191016_1571241600': {'datasource': {'source': '20191016_1571241600'}}, '20191210_1575997200': {'datasource': {'source': '20191210_1575997200'}}, '20190724_1563969600': {'datasource': {'source': '20190724_1563969600'}}, '20191128_1574982000': {'datasource': {'source': '20191128_1574982000'}}, '20191029_1572...
# pylint: skip-file class Hostgroup(object): ''' hostgroup methods''' @staticmethod def get_host_group_id_by_name(zapi, hg_name): '''Get hostgroup id by name''' content = zapi.get_content('hostgroup', 'get', {'filter': {'...
class Hostgroup(object): """ hostgroup methods""" @staticmethod def get_host_group_id_by_name(zapi, hg_name): """Get hostgroup id by name""" content = zapi.get_content('hostgroup', 'get', {'filter': {'name': hg_name}}) return content['result'][0]['groupid'] @staticmethod de...
# Python - Object Oriented Programming # Raise can be different for different employees or instances. # But total number of employees will not be different for any instance. # so lets create a class variable names num_of employees. class Employee: num_of_emps = 0 raise_amt = 1.04 def __init__(self, firstN...
class Employee: num_of_emps = 0 raise_amt = 1.04 def __init__(self, firstName, lastName, pay): self.firstName = firstName self.lastName = lastName self.pay = pay self.email = f'{firstName}.{lastName}@Company.com' Employee.num_of_emps += 1 def fullname(self): ...
# Split string at line boundaries file_split = file.splitlines() # Print file_split print(file_split) # Complete for-loop to split by commas for substring in file_split: substring_split = substring.split(",") print(substring_split)
file_split = file.splitlines() print(file_split) for substring in file_split: substring_split = substring.split(',') print(substring_split)
#!/usr/bin/python # coding=utf-8 class Project(object): __allowed_properties = [ 'name', 'git_url', 'absolute_path' ] def __new__(cls, project_settings): # Check if project settings are a go for setting attributes if not sorted(project_settings.keys()) == sorted(c...
class Project(object): __allowed_properties = ['name', 'git_url', 'absolute_path'] def __new__(cls, project_settings): if not sorted(project_settings.keys()) == sorted(cls.__allowed_properties): return None for allowed_property in cls.__allowed_properties: setattr(cls, a...
class Building: def __init__(s,x,y,a,b,h=10): s.x,s.y,s.a,s.b,s.h=x,y,a,b,h __repr__ = lambda s: "Building({}, {}, {}, {}, {})".format(s.x,s.y,s.a,s.b,s.h) area,volume = lambda s: s.a*s.b,lambda s: s.a*s.b*s.h corners = lambda s: {"south-west":(s.x,s.y),"north-east":(s.x+s.b,s.y+s.a), ...
class Building: def __init__(s, x, y, a, b, h=10): (s.x, s.y, s.a, s.b, s.h) = (x, y, a, b, h) __repr__ = lambda s: 'Building({}, {}, {}, {}, {})'.format(s.x, s.y, s.a, s.b, s.h) (area, volume) = (lambda s: s.a * s.b, lambda s: s.a * s.b * s.h) corners = lambda s: {'south-west': (s.x, s.y), 'no...
##for i in range(0,5): ## for j in range(5,i,-1): ## ## print(j,end='') ## ## ## print() for i in range(5,0,-1): for j in range(1,i+1): print(i,end='') print()
for i in range(5, 0, -1): for j in range(1, i + 1): print(i, end='') print()
class User: def __init__(self, user_name, email=None): self.name = user_name self.email = email self.expense_dict = {} def add_entry(self, user, amount): print(f"Now updating Entry {user.name} for {self.name}'s dict.") if self.expense_dict.get(user, None) is not None: print(f"Previous entry was {self.ex...
class User: def __init__(self, user_name, email=None): self.name = user_name self.email = email self.expense_dict = {} def add_entry(self, user, amount): print(f"Now updating Entry {user.name} for {self.name}'s dict.") if self.expense_dict.get(user, None) is not None: ...
_base_ = [ '../_base_/models/oscar/oscar_nlvr2_config.py', '../_base_/datasets/oscar/oscar_nlvr2_dataset.py', '../_base_/default_runtime.py', ] # cover the parrmeter in above files model = dict(params=dict(model_name_or_path='/home/datasets/mix_data/model/vinvl/vqa/large/checkpoint-2000000', )) lr_config...
_base_ = ['../_base_/models/oscar/oscar_nlvr2_config.py', '../_base_/datasets/oscar/oscar_nlvr2_dataset.py', '../_base_/default_runtime.py'] model = dict(params=dict(model_name_or_path='/home/datasets/mix_data/model/vinvl/vqa/large/checkpoint-2000000')) lr_config = dict(num_warmup_steps=5000, num_training_steps=36000) ...
mcl = [[-5.592134638754766e-05, 1e6], [-6.441295571105171e-05, 1e6], [-2.7292256647813406e-05, 1e6], [-5.738494934280777e-05, 1e6], [-3.920474118683737e-05, 1e6]] accval, accruns = 0, 0 for mcrun in mcl: accval += mcrun[0]*mcrun[1] accruns += mcrun[1] print(accruns, ': ', accva...
mcl = [[-5.592134638754766e-05, 1000000.0], [-6.441295571105171e-05, 1000000.0], [-2.7292256647813406e-05, 1000000.0], [-5.738494934280777e-05, 1000000.0], [-3.920474118683737e-05, 1000000.0]] (accval, accruns) = (0, 0) for mcrun in mcl: accval += mcrun[0] * mcrun[1] accruns += mcrun[1] print(accruns, ': ',...
greet=' hello bob ' greet.strip() print(greet) #right strip greet=' hello bob ' greet.rstrip() print(greet) #left strip greet=' hello bob ' greet.lstrip() print(greet)
greet = ' hello bob ' greet.strip() print(greet) greet = ' hello bob ' greet.rstrip() print(greet) greet = ' hello bob ' greet.lstrip() print(greet)
# # PySNMP MIB module CPQSANAPP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CPQSANAPP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:12:09 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, constraints_union, constraints_intersection, single_value_constraint) ...
class Factorial: def __init__(self): self.fact = [1] def __call__(self,n): if n < len(self.fact): return 1 else: fact_number = n * self(n-1) self.fact.append(fact_number) return self.fact[n] factorial_of_n = Factorial() n = int(input("n = ")) print(factorial_of_n(n))
class Factorial: def __init__(self): self.fact = [1] def __call__(self, n): if n < len(self.fact): return 1 else: fact_number = n * self(n - 1) self.fact.append(fact_number) return self.fact[n] factorial_of_n = factorial() n = int(input('n = ...
def permutation(text, anchor, p): if anchor == len(text): p.add("".join(text)) return for i in range(anchor, len(text)): text[anchor], text[i] = text[i], text[anchor] permutation(text, anchor + 1, p) text[anchor], text[i] = text[i], text[anchor] if __name__ == "__main__": text = "abc" p = ...
def permutation(text, anchor, p): if anchor == len(text): p.add(''.join(text)) return for i in range(anchor, len(text)): (text[anchor], text[i]) = (text[i], text[anchor]) permutation(text, anchor + 1, p) (text[anchor], text[i]) = (text[i], text[anchor]) if __name__ == '__...
_config = { "class": "class" } def config(): return _config
_config = {'class': 'class'} def config(): return _config
######################## GLOBAL VARIABLES ######################### BINANCE = True # Variable to indicate which exchange to use: True for BINANCE, False for FTX SHITCOIN = 'ftm' MULTI_TF = True TF_LIST = ['4h','1h','15m','5m','1m'] TF = '1h' LEVELS_PER_TF = 3 # Number of levels per Time Frame to include in the list of ...
binance = True shitcoin = 'ftm' multi_tf = True tf_list = ['4h', '1h', '15m', '5m', '1m'] tf = '1h' levels_per_tf = 3 days_back = 90 trade_on = False max_bal_per_coin = 10 lvrg = 20 tpgrid_min_dist = 0.2 tpgrid_max_dist = 0.8 tp_orders = 6 dca_factor_mult = 1.75 assymmetric_tp = False min_level_distance = 0.8
# https://codeforces.com/problemset/problem/266/A n = int(input()) s = input() ans = 0 for i in range(n - 1): if s[i] == s[i + 1]: ans += 1 print(ans)
n = int(input()) s = input() ans = 0 for i in range(n - 1): if s[i] == s[i + 1]: ans += 1 print(ans)
def generate_list(): output_list = [x ** 2 for x in list(range(1, 21))] print(output_list) generate_list()
def generate_list(): output_list = [x ** 2 for x in list(range(1, 21))] print(output_list) generate_list()
def assert_modal_view_shown(running_app, klass=None): assert running_app.root_window.children if klass: klass_found = False children = running_app.root_window.children for child in children: klass_found |= isinstance(child, klass) assert klass_found, "%s modal view no...
def assert_modal_view_shown(running_app, klass=None): assert running_app.root_window.children if klass: klass_found = False children = running_app.root_window.children for child in children: klass_found |= isinstance(child, klass) assert klass_found, '%s modal view no...
# Alexa skill APPLICATION_ID: str = "amzn1.ask.skill.dd677950-cade-4805-b1f1-ce2e3a3569f0" RESPONSE_VERSION: str = "1.0" # Bible API BIBLE_TRANSLATION = "GNBDC" # Can't use NIV - it's still in copyright BIBLE_API_URL = f"https://bibles.org/v2/eng-{BIBLE_TRANSLATION}/passages.js" # Bible Passages BIBLE_PASSAGES_CSV_U...
application_id: str = 'amzn1.ask.skill.dd677950-cade-4805-b1f1-ce2e3a3569f0' response_version: str = '1.0' bible_translation = 'GNBDC' bible_api_url = f'https://bibles.org/v2/eng-{BIBLE_TRANSLATION}/passages.js' bible_passages_csv_url = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vQqiE5BF-VtKfaV9NtpwYqgT3Ijw5pRmfb...
def sum_array(arr): if arr == None: return 0 if len(arr) == 0 or 1: return 0 else: x = max(arr) y = min(arr) arr.remove(x) arr.remove(y) return(sum(arr)) print(sum_array([1,2,3,4,4]))
def sum_array(arr): if arr == None: return 0 if len(arr) == 0 or 1: return 0 else: x = max(arr) y = min(arr) arr.remove(x) arr.remove(y) return sum(arr) print(sum_array([1, 2, 3, 4, 4]))
# ------------------------------------------------------------------------------ # Access to the CodeHawk Binary Analyzer Analysis Results # Author: Henny Sipma # ------------------------------------------------------------------------------ # The MIT License (MIT) # # Copyright (c) 2016-2020 Kestrel Technology LLC # #...
class Mipsregisterbase(object): def __init__(self, bd, index, tags, args): self.bd = bd self.index = index self.tags = tags self.args = args def is_mips_register(self): return False def is_mips_stack_pointer(self): return False def is_mips_argument_reg...
def print_bigger_number(first, second): if first > second: print(first) else: print(second)
def print_bigger_number(first, second): if first > second: print(first) else: print(second)
def palindrome(number): return number == number[::-1] if __name__ == '__main__': init = int(input()) number = init + 1 while not palindrome(str(number)): number += 1 print(number - init)
def palindrome(number): return number == number[::-1] if __name__ == '__main__': init = int(input()) number = init + 1 while not palindrome(str(number)): number += 1 print(number - init)
# bad practice: I/O inside the function def say_hello(): name = input('enter a name: ') print('hello ' + name) # say_hello() # best practice: No I/O in the function def say_hello2(name): msg = 'hello ' + name msg += '\nPleased to meet you' return msg print(say_hello2('Ahmed')) name1 = input('e...
def say_hello(): name = input('enter a name: ') print('hello ' + name) def say_hello2(name): msg = 'hello ' + name msg += '\nPleased to meet you' return msg print(say_hello2('Ahmed')) name1 = input('enter a name: ') result = say_hello2(name1) result += '\nWelcome to python II' print(result)
def main(): # Declare nucleotide variables [Adenine, Cytosine, Guanine, Thymine] A = 0; C = 0; G = 0; T = 0; # Manage input file input = open(r"C:\Users\lawht\Desktop\Github\ROSALIND\Bioinformatics Stronghold\(1) Counting DNA Nucleotides\Counting DNA Nucleotides\rosalind_dna.txt","r"); ...
def main(): a = 0 c = 0 g = 0 t = 0 input = open('C:\\Users\\lawht\\Desktop\\Github\\ROSALIND\\Bioinformatics Stronghold\\(1) Counting DNA Nucleotides\\Counting DNA Nucleotides\\rosalind_dna.txt', 'r') dna_string = input.readline() count_nucleotides(DNA_string, A, C, G, T) input.close() ...
def get_template_filter(): return example_filter2 def example_filter2(string): return "Example2: " + string
def get_template_filter(): return example_filter2 def example_filter2(string): return 'Example2: ' + string
### Migratory Birds - Solution def migratoryBirds(type_nums): count = [0] * len(type_nums) for i in type_nums: count[i] += 1 min_id = count.index(max(count)) print(min_id) birds = int(input()) type_nums = tuple(map(int, input().split()[:birds])) migratoryBirds(type_nums)
def migratory_birds(type_nums): count = [0] * len(type_nums) for i in type_nums: count[i] += 1 min_id = count.index(max(count)) print(min_id) birds = int(input()) type_nums = tuple(map(int, input().split()[:birds])) migratory_birds(type_nums)
def transpose(matrix): return map(list, zip(*matrix)) M = [[1,2,3], [4,5,6]] print(transpose(M))
def transpose(matrix): return map(list, zip(*matrix)) m = [[1, 2, 3], [4, 5, 6]] print(transpose(M))
class Node: def __init__(self, data, parent): self.data = data self.parent = parent self.right_node = None self.left_node = None class BinarySearchTree: def __init__(self): self.root = None def remove(self, data): if self.root: ...
class Node: def __init__(self, data, parent): self.data = data self.parent = parent self.right_node = None self.left_node = None class Binarysearchtree: def __init__(self): self.root = None def remove(self, data): if self.root: self.remove_node...
# Copyright (c) 2016 Google Inc. (under http://www.apache.org/licenses/LICENSE-2.0) # Test trailing comma after last arg def h1(a:a1,) -> r1: pass def h2(a:a2,b:b2,) -> r2: pass def h3(a:a3) -> r3: pass def h4(a:a4) -> r4: pass
def h1(a: a1) -> r1: pass def h2(a: a2, b: b2) -> r2: pass def h3(a: a3) -> r3: pass def h4(a: a4) -> r4: pass
# Space: O(n) # Time: O(n) class Solution: def coinChange(self, coins, amount): dp = [amount + 1] * (amount + 1) dp[0] = 0 for i in coins: for j in range(len(dp)): if j - i >= 0: dp[j] = min(dp[j], dp[j - i] + 1) return dp[amount] if...
class Solution: def coin_change(self, coins, amount): dp = [amount + 1] * (amount + 1) dp[0] = 0 for i in coins: for j in range(len(dp)): if j - i >= 0: dp[j] = min(dp[j], dp[j - i] + 1) return dp[amount] if dp[amount] != amount + 1 el...
class coordinate: def __init__(self, x, y): self.x = x self.y = y def distance(self, other_coordinate): x_diff = (self.x - other_coordinate.x)**2 y_diff = (self.y - other_coordinate.y)**2 return (x_diff + y_diff)**0.5 if __name__ == "__main__": ...
class Coordinate: def __init__(self, x, y): self.x = x self.y = y def distance(self, other_coordinate): x_diff = (self.x - other_coordinate.x) ** 2 y_diff = (self.y - other_coordinate.y) ** 2 return (x_diff + y_diff) ** 0.5 if __name__ == '__main__': coord_1 = coord...
# Time: O(n); Space: O(n) def fib(n): memo = {} if n == 0 or n == 1: return n if n not in memo: memo[n] = fib(n - 1) + fib(n - 2) return memo[n] # Test cases: print(fib(4))
def fib(n): memo = {} if n == 0 or n == 1: return n if n not in memo: memo[n] = fib(n - 1) + fib(n - 2) return memo[n] print(fib(4))
def get_size(nbytes, suffix="B"): factor = 1024 for unit in ["", "K", "M", "G", "T", "P"]: if nbytes < factor: return f"{nbytes:.2f}{unit}{suffix}" nbytes /= factor # This shouldn't happen on real systems, but you can never be sure (2020, btw) return f"{nbytes:.2f}{unit}{suff...
def get_size(nbytes, suffix='B'): factor = 1024 for unit in ['', 'K', 'M', 'G', 'T', 'P']: if nbytes < factor: return f'{nbytes:.2f}{unit}{suffix}' nbytes /= factor return f'{nbytes:.2f}{unit}{suffix}'
class Enricher: def __init__(self, connection=None): self._connection = connection async def enrich(self, post_ids): return await self._connection.find_many(post_ids)
class Enricher: def __init__(self, connection=None): self._connection = connection async def enrich(self, post_ids): return await self._connection.find_many(post_ids)
def cycle(sequence): dict={} for i,j in enumerate(sequence): if dict.get(j, -1)<0: dict[j]=i else: return [dict[j], i] if not dict[j] else [dict[j], i-1] return []
def cycle(sequence): dict = {} for (i, j) in enumerate(sequence): if dict.get(j, -1) < 0: dict[j] = i else: return [dict[j], i] if not dict[j] else [dict[j], i - 1] return []
A = int(input()) n = 1 while n ** 3 < A: n += 1 print('YES' if n ** 3 == A else 'NO')
a = int(input()) n = 1 while n ** 3 < A: n += 1 print('YES' if n ** 3 == A else 'NO')
tupla =( 'APRENDER', 'PROGRAMAR', 'LINGUAGEM', 'PYTHON', 'CURSO', 'GRATIS', 'ESTUDAR', 'PRATICAR', 'TRABALHAR', 'MERCADO', 'PROGRAMADOR', 'FUTURO' ) for palavra in tupla: print('Na palavra {} temos'.format(palavra), end=' ') for letra in palavra: if letra in 'AEIOU': print('{}'.form...
tupla = ('APRENDER', 'PROGRAMAR', 'LINGUAGEM', 'PYTHON', 'CURSO', 'GRATIS', 'ESTUDAR', 'PRATICAR', 'TRABALHAR', 'MERCADO', 'PROGRAMADOR', 'FUTURO') for palavra in tupla: print('Na palavra {} temos'.format(palavra), end=' ') for letra in palavra: if letra in 'AEIOU': print('{}'.format(letra),...
# Implement a macro folly_library() that the BUILD file can load. load("@rules_cc//cc:defs.bzl", "cc_library") # Ref: https://github.com/google/glog/blob/v0.5.0/bazel/glog.bzl def expand_template_impl(ctx): ctx.actions.expand_template( template = ctx.file.template, output = ctx.outputs.out, ...
load('@rules_cc//cc:defs.bzl', 'cc_library') def expand_template_impl(ctx): ctx.actions.expand_template(template=ctx.file.template, output=ctx.outputs.out, substitutions=ctx.attr.substitutions) expand_template = rule(implementation=expand_template_impl, attrs={'template': attr.label(mandatory=True, allow_single_fi...
# Created by MechAviv # Chinese Text Damage Skin (30 Day) | (2436741) if sm.addDamageSkin(2436741): sm.chat("'Chinese Text Damage Skin (30 Day)' Damage Skin has been added to your account's damage skin collection.") sm.consumeItem()
if sm.addDamageSkin(2436741): sm.chat("'Chinese Text Damage Skin (30 Day)' Damage Skin has been added to your account's damage skin collection.") sm.consumeItem()
def rumble(rate, intensity, duration): __end_regular_rumble() _["viewport"].rumble(rate, intensity, duration) def regular_rumble(rate, intensity, duration, interval): __end_regular_rumble() def _rumble(): _["viewport"].rumble(rate, intensity, duration) _["regular_rumble"] = _rumble D...
def rumble(rate, intensity, duration): __end_regular_rumble() _['viewport'].rumble(rate, intensity, duration) def regular_rumble(rate, intensity, duration, interval): __end_regular_rumble() def _rumble(): _['viewport'].rumble(rate, intensity, duration) _['regular_rumble'] = _rumble Dri...
def fuc() -> None: return None def fua() -> bool: return True def fub() -> bool: return False def fud() -> int: return -1 def fue() -> str: return ""
def fuc() -> None: return None def fua() -> bool: return True def fub() -> bool: return False def fud() -> int: return -1 def fue() -> str: return ''
del_items(0x80121A34) SetType(0x80121A34, "void PreGameOnlyTestRoutine__Fv()") del_items(0x80123AF8) SetType(0x80123AF8, "void DRLG_PlaceDoor__Fii(int x, int y)") del_items(0x80123FCC) SetType(0x80123FCC, "void DRLG_L1Shadows__Fv()") del_items(0x801243E4) SetType(0x801243E4, "int DRLG_PlaceMiniSet__FPCUciiiiiii(unsigne...
del_items(2148670004) set_type(2148670004, 'void PreGameOnlyTestRoutine__Fv()') del_items(2148678392) set_type(2148678392, 'void DRLG_PlaceDoor__Fii(int x, int y)') del_items(2148679628) set_type(2148679628, 'void DRLG_L1Shadows__Fv()') del_items(2148680676) set_type(2148680676, 'int DRLG_PlaceMiniSet__FPCUciiiiiii(uns...
# _*_ coding: utf-8 _*_ # # Package: base __all__ = ["firebase"]
__all__ = ['firebase']
############################################################################### # Copyright (c) 2017-2020 Koren Lev (Cisco Systems), # # Yaron Yogev (Cisco Systems), Ilia Abashin (Cisco Systems) and others # # # ...
host = {'config': {'metadata_proxy_socket': '/opt/stack/data/neutron/metadata_proxy', 'nova_metadata_ip': '192.168.20.14', 'log_agent_heartbeats': False}, 'environment': 'Devstack-VPP-2', 'host': 'ubuntu0', 'host_type': ['Controller', 'Compute', 'Network'], 'id': 'ubuntu0', 'id_path': '/Devstack-VPP-2/Devstack-VPP-2-re...
@fields({"dollars": Int, "cents": Int}) class Cash: dollars = 0 cents = 0 def add_dollars(self, dollars): self.dollars += dollars def get_cash()->Cash: c = Cash() c.add_dollars(3.14159) return c get_cash()
@fields({'dollars': Int, 'cents': Int}) class Cash: dollars = 0 cents = 0 def add_dollars(self, dollars): self.dollars += dollars def get_cash() -> Cash: c = cash() c.add_dollars(3.14159) return c get_cash()
n = int(input()) k = int(input()) x = int(input()) y = int(input()) if n > k: print(x * k + (n - k) * y) else: print(x * n)
n = int(input()) k = int(input()) x = int(input()) y = int(input()) if n > k: print(x * k + (n - k) * y) else: print(x * n)
class Player(object): def __init__(self, player_id, region_id): self.player_id = player_id self.region_id = region_id self.inventory = [] def tick(self): for item in inventory: item.tick()
class Player(object): def __init__(self, player_id, region_id): self.player_id = player_id self.region_id = region_id self.inventory = [] def tick(self): for item in inventory: item.tick()
motorcycles = ['honda', 'yamaha', 'suzuki'] print(motorcycles) motorcycles[0] = 'ducati' print(motorcycles)
motorcycles = ['honda', 'yamaha', 'suzuki'] print(motorcycles) motorcycles[0] = 'ducati' print(motorcycles)
def headers(token): return { 'Authorization': f'Bearer {token}', 'content-type': 'application/json'} flight_data = { "name": "American airline"} user_data = { 'email': 'myadminss@example.com', 'username': 'myadminss', 'is_staff': True, "password":"education", }
def headers(token): return {'Authorization': f'Bearer {token}', 'content-type': 'application/json'} flight_data = {'name': 'American airline'} user_data = {'email': 'myadminss@example.com', 'username': 'myadminss', 'is_staff': True, 'password': 'education'}
# It's a BST! class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def lowestCommonAncestor(self, root, p, q): s, b = sorted([p.val, q.val]) while not s <= root.val <= b: root = root.left if s <= root.val el...
class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def lowest_common_ancestor(self, root, p, q): (s, b) = sorted([p.val, q.val]) while not s <= root.val <= b: root = root.left if s <= root.val else root.ri...
''' This problem was asked by Google. Given k sorted singly linked lists, write a function to merge all the lists into one sorted singly linked list. It has already been solved in: https://github.com/loghmanb/daily-coding-problem/blob/master/google_merge_k_sorted_list.py '''
""" This problem was asked by Google. Given k sorted singly linked lists, write a function to merge all the lists into one sorted singly linked list. It has already been solved in: https://github.com/loghmanb/daily-coding-problem/blob/master/google_merge_k_sorted_list.py """
# Your task is to add up letters to one letter. # The function will be given a variable amount of arguments, each one being a letter to add. # https://www.codewars.com/kata/5d50e3914861a500121e1958 # https://www.codewars.com/kata/5d50e3914861a500121e1958/solutions/python def add_letters(*letters): char_num = 0 ...
def add_letters(*letters): char_num = 0 for character in letters: char_num = char_num + ord(character) - 96 if char_num == 0 or char_num % 26 == 0: return 'z' else: return chr(char_num % 26 + 96) print(add_letters('z')) def add_letters_clever(*letters): return chr((sum((ord(...
class City: def __init__(self, name): self.name = name self.routes = {} def add_route(self, city, price_info): self.routes[city] = price_info atlanta = City("Atlanta") boston = City("Boston") chicago = City("Chicago") denver = City("Denver") el_paso = City("El Paso") atlanta.add_rout...
class City: def __init__(self, name): self.name = name self.routes = {} def add_route(self, city, price_info): self.routes[city] = price_info atlanta = city('Atlanta') boston = city('Boston') chicago = city('Chicago') denver = city('Denver') el_paso = city('El Paso') atlanta.add_route(...
def replacePi(s): if(len(s) <= 2): return s if(s[0] == "p" and s[1] == "i"): print("3.14",end='') replacePi(s[2:]) else : print(s[0],end="") replacePi(s[1:]) s = input() replacePi(s)
def replace_pi(s): if len(s) <= 2: return s if s[0] == 'p' and s[1] == 'i': print('3.14', end='') replace_pi(s[2:]) else: print(s[0], end='') replace_pi(s[1:]) s = input() replace_pi(s)
def format_sentence(sent): sent_text = sent["sent_text"] sent_start, _ = sent["sent_span"] fmt_text = str(sent_text) for mention_text, mention_start, mention_end in sorted(sent["mentions"], key=lambda x: x[1], reverse=True): mention_start, mention_end = mention_start - sent_start, mention_end - ...
def format_sentence(sent): sent_text = sent['sent_text'] (sent_start, _) = sent['sent_span'] fmt_text = str(sent_text) for (mention_text, mention_start, mention_end) in sorted(sent['mentions'], key=lambda x: x[1], reverse=True): (mention_start, mention_end) = (mention_start - sent_start, mention...
# assign table and gis_input file required column names mid_col = 'model_id' gid_col = 'gauge_id' asgn_mid_col = 'assigned_model_id' asgn_gid_col = 'assigned_gauge_id' down_mid_col = 'downstream_model_id' reason_col = 'reason' area_col = 'drain_area' order_col = 'stream_order' # name of some of the files produced by t...
mid_col = 'model_id' gid_col = 'gauge_id' asgn_mid_col = 'assigned_model_id' asgn_gid_col = 'assigned_gauge_id' down_mid_col = 'downstream_model_id' reason_col = 'reason' area_col = 'drain_area' order_col = 'stream_order' cluster_count_file = 'best-fit-cluster-count.json' cal_nc_name = 'calibrated_simulated_flow.nc' si...
# # PySNMP MIB module SNMPv2-TC-v1 (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SNMPv2-TC-v1 # Produced by pysmi-0.3.4 at Wed May 1 11:31:22 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,...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint, constraints_union) ...
n = int(input()) people = [] for i in range(n): a, b = input().split() people.append((int(a), b, i)) people.sort(key=lambda x:(x[0], x[2])) for p in people: print(p[0], p[1])
n = int(input()) people = [] for i in range(n): (a, b) = input().split() people.append((int(a), b, i)) people.sort(key=lambda x: (x[0], x[2])) for p in people: print(p[0], p[1])
#https://leetcode.com/problems/last-substring-in-lexicographical-order/discuss/369191/JavaScript-with-Explanation-no-substring-comparison-fast-O(n)-time-O(1)-space.-(Credit-to-nate17) def lastSubstring(input): start = end = 0 skip = 1 while (skip+end) < len(input): if input[start+end] == inpu...
def last_substring(input): start = end = 0 skip = 1 while skip + end < len(input): if input[start + end] == input[skip + end]: end += 1 elif input[start + end] < input[skip + end]: start = max(start + end + 1, skip) skip = start + 1 end = 0 ...
# ============================================================================= # Python examples - if else # ============================================================================= seq = [1,2,3] if len(seq) == 0: print("sequence is empty") elif len(seq) == 1: print("sequence contains one element") else...
seq = [1, 2, 3] if len(seq) == 0: print('sequence is empty') elif len(seq) == 1: print('sequence contains one element') else: print('sequence contains several elements') a = 5 b = 3 x = 10 if a > b else 1 y = a > b and 10 or 1 print(x) print(y)
class StatcordException(Exception): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) class RequestFailure(StatcordException): def __init__(self, status: int, response: str): super().__init__("{}: {}".format(status, response))
class Statcordexception(Exception): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) class Requestfailure(StatcordException): def __init__(self, status: int, response: str): super().__init__('{}: {}'.format(status, response))
def get_paths(root, format='jpg', paths_count=None): path_i = 0 paths = [] for path in root.glob(f'**/*.{format}'): if path_i == paths_count: break paths.append(path) path_i += 1 return paths def get_train_val_paths(root, format='jpg', val_size=0.2, paths_count=...
def get_paths(root, format='jpg', paths_count=None): path_i = 0 paths = [] for path in root.glob(f'**/*.{format}'): if path_i == paths_count: break paths.append(path) path_i += 1 return paths def get_train_val_paths(root, format='jpg', val_size=0.2, paths_count=None)...
example_dict = { 65: "integer", "1": "fake integer", 3.14: "float", "3.14": "fake float", 0.345: "float 2", ".345": "fake float 2", 123.0: "float 3", "123.": " fake float 3", "false_": False, "true_": True, False: False, True: True, -3.0: "float negative", "-3.1":...
example_dict = {65: 'integer', '1': 'fake integer', 3.14: 'float', '3.14': 'fake float', 0.345: 'float 2', '.345': 'fake float 2', 123.0: 'float 3', '123.': ' fake float 3', 'false_': False, 'true_': True, False: False, True: True, -3.0: 'float negative', '-3.1': 'fake float negative', 'negative': -45, 'float_negative'...
# Things like files are called resources. They are gicen by the operating system and # have to be disposed of after being done with. # We have to close files for instance fd = open("with.py", "r") print(fd.readline()) fd.close() # In order to do this a bit more automatic you can use with with open("with.py", "r") a...
fd = open('with.py', 'r') print(fd.readline()) fd.close() with open('with.py', 'r') as f: print(f.readline())
_base_ = [ '../_base_/models/faster_rcnn_r50_fpn.py', '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_180k.py', '../_base_/default_runtime.py' ] evaluation = dict(interval=20000, metric='bbox') checkpoint_config = dict(by_epoch=False, interval=20000) work_dir = 'work_dirs/coco/faster_...
_base_ = ['../_base_/models/faster_rcnn_r50_fpn.py', '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_180k.py', '../_base_/default_runtime.py'] evaluation = dict(interval=20000, metric='bbox') checkpoint_config = dict(by_epoch=False, interval=20000) work_dir = 'work_dirs/coco/faster_rcnn/faster_rcn...
class Interactions: current_os = -1 logger = None def __init__(self, current_os, logger, comfun): self.current_os = current_os self.logger = logger self.comfun = comfun def print_info(self): self.logger.raw("This is interaction with 3dsmax") # common interactions ...
class Interactions: current_os = -1 logger = None def __init__(self, current_os, logger, comfun): self.current_os = current_os self.logger = logger self.comfun = comfun def print_info(self): self.logger.raw('This is interaction with 3dsmax') def schema_item_double_...
string1 = "he's " string2 = "probably " string3 = "going to " string4 = "get fired " string5 = "today " print(string1 + string2 + string3 + string4 + string5) print("he's " "probably " "going to " "get fired " "today") print (string1 * 5) print ("he's " * 5) print ("hello " * 5 + "4") print("hello " * (5 + 4)) ...
string1 = "he's " string2 = 'probably ' string3 = 'going to ' string4 = 'get fired ' string5 = 'today ' print(string1 + string2 + string3 + string4 + string5) print("he's probably going to get fired today") print(string1 * 5) print("he's " * 5) print('hello ' * 5 + '4') print('hello ' * (5 + 4)) today = 'wednesday' pri...
def subarraySort(array): min_ascending_anomaly_number = float('inf') max_descending_anomaly_number = float('-inf') i, j = 1, len(array) - 2 while i < len(array) and j > - 1: if array[i] < array[i - 1]: min_ascending_anomaly_number = min(array[i], min_ascending_anomaly_number) ...
def subarray_sort(array): min_ascending_anomaly_number = float('inf') max_descending_anomaly_number = float('-inf') (i, j) = (1, len(array) - 2) while i < len(array) and j > -1: if array[i] < array[i - 1]: min_ascending_anomaly_number = min(array[i], min_ascending_anomaly_number) ...
# python3 def last_digit_of_the_sum_of_fibonacci_numbers_naive(n): assert 0 <= n <= 10 ** 18 if n <= 1: return n fibonacci_numbers = [0] * (n + 1) fibonacci_numbers[0] = 0 fibonacci_numbers[1] = 1 for i in range(2, n + 1): fibonacci_numbers[i] = fibonacci_numbers[i - 2] + fib...
def last_digit_of_the_sum_of_fibonacci_numbers_naive(n): assert 0 <= n <= 10 ** 18 if n <= 1: return n fibonacci_numbers = [0] * (n + 1) fibonacci_numbers[0] = 0 fibonacci_numbers[1] = 1 for i in range(2, n + 1): fibonacci_numbers[i] = fibonacci_numbers[i - 2] + fibonacci_numbers...
# File: Bridge.py # Description: Assignment 09 | Bridge # Student Name: Matthew Maxwell # Student UT EID: mrm5632 # Course Name: CS 313E # Unique Number: 50205 # Date Created: 09-30-2019 # Date Last Modified: 10-01-2019 # read file in, return data set of test cases def readFile(): myFile = open("...
def read_file(): my_file = open('bridge.txt', 'r') lines = [line.strip() for line in myFile] num_cases = int(lines[0]) lines = lines[2:] data_set = [] for i in range(numCases): data_item = [] for j in range(int(lines[0])): dataItem.append(int(lines[j + 1])) li...