content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
#!/usr/bin/env python # coding: utf-8 def write_tweet_tfile(file_to_populate, text): file_handler = open(file_to_populate,"a+") file_handler.writelines(text) file_handler.close() def strip_token(myword, chars_token): return myword.strip(chars_token)
def write_tweet_tfile(file_to_populate, text): file_handler = open(file_to_populate, 'a+') file_handler.writelines(text) file_handler.close() def strip_token(myword, chars_token): return myword.strip(chars_token)
class Person: def __init__(self, name, email): self.name = name self.email = email self.all_my_emails = [] def send_email(self, to_user, message): print(f"send from {self.name} with email {self.email}") print(f"sending to {to_user} message {message}") return Tr...
class Person: def __init__(self, name, email): self.name = name self.email = email self.all_my_emails = [] def send_email(self, to_user, message): print(f'send from {self.name} with email {self.email}') print(f'sending to {to_user} message {message}') return Tru...
################################### # SIMPLETICKET CONFIGURATION FILE # ################################### ############################################### # Flask Development Environment Configuration # ############################################### # This is not used when using the WSGI mod for apache. # interface...
interface_ip = '0.0.0.0' interface_port = '80' require_login = True language = 'en_EN' site_name = 'SimpleTicket Development Instance' secret_key = 'm-_2hz7kJL-oOHtwKkI5ew' create_admin_file = '_CREATE_ADMIN_ALLOWED' timeformat = '%H:%M:%S, %d.%m.%Y'
N = int(input()) while True: S = [[] for k in range(N)] S_len = [0 for k in range(N)] bigger_len = 0 for k in range(N): S[k] = input().split() S_len[k] = sum([len(w) for w in S[k]]) + len(S[k]) - 1 if S_len[k] > bigger_len: bigger_len = S_len[k] for k in range(N): print(' ' * (bigger_len - S_len[k])...
n = int(input()) while True: s = [[] for k in range(N)] s_len = [0 for k in range(N)] bigger_len = 0 for k in range(N): S[k] = input().split() S_len[k] = sum([len(w) for w in S[k]]) + len(S[k]) - 1 if S_len[k] > bigger_len: bigger_len = S_len[k] for k in range(N):...
def Final_Product(Check_list): Prod = 1 for ele in Check_list: Prod *= ele return Prod def Product_Matrix(Test_list): Semi_Result = Final_Product( [element for ele in Test_list for element in ele]) return Semi_Result Test_list = [[1, 4, 5], [7, 3], [4], [46, 7, 3]] ...
def final__product(Check_list): prod = 1 for ele in Check_list: prod *= ele return Prod def product__matrix(Test_list): semi__result = final__product([element for ele in Test_list for element in ele]) return Semi_Result test_list = [[1, 4, 5], [7, 3], [4], [46, 7, 3]] print(product__matrix(...
lines = "" while True: cur_inp = input() lines += cur_inp + "\n" if cur_inp == '0': break result = tuple(lines.split())
lines = '' while True: cur_inp = input() lines += cur_inp + '\n' if cur_inp == '0': break result = tuple(lines.split())
s = input() vowels = "AEIOU" kevin, stuart = 0, 0 for i in range(len(s)): if s[i] in vowels: kevin += len(s) - i else: stuart += len(s) - i if kevin > stuart: print("Kevin " + str(kevin)) elif stuart > kevin: print("Stuart " + str(stuart)) else: print("Draw")
s = input() vowels = 'AEIOU' (kevin, stuart) = (0, 0) for i in range(len(s)): if s[i] in vowels: kevin += len(s) - i else: stuart += len(s) - i if kevin > stuart: print('Kevin ' + str(kevin)) elif stuart > kevin: print('Stuart ' + str(stuart)) else: print('Draw')
x = 5 y = 10 z = 22 if x > y : print ('x is greater than y') elif x < z : print (' x is lesser than z')
x = 5 y = 10 z = 22 if x > y: print('x is greater than y') elif x < z: print(' x is lesser than z')
def fatorial(numero): f = 1 for c in range(1, numero +1): f *= c return f
def fatorial(numero): f = 1 for c in range(1, numero + 1): f *= c return f
#!/usr/bin/python3 __author__ = 'kilroy' # (c) 2014, WasHere Consulting, Inc. # Written for Infinite Skills # adding x here makes it in scope x = 0 for i in range(1,25): # x is in scope x = i + x # x is now out of scope print(x)
__author__ = 'kilroy' x = 0 for i in range(1, 25): x = i + x print(x)
play = ["Rock", "Paper", "Scissors"] computer = "Rock" print("") player = "Paper"
play = ['Rock', 'Paper', 'Scissors'] computer = 'Rock' print('') player = 'Paper'
# Solved manually after decompiling the input and analyzing it. # There is already a great explanation out there, so I won't bother # writing another one. Just have a look at the following well- # documented code: # https://github.com/dphilipson/advent-of-code-2021/blob/master/src/days/day24.rs print(91699394894995) p...
print(91699394894995) print(51147191161261)
_base_ = [ '../_base_/models/fcn_hr18.py', '../_base_/datasets/vaihingen.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_40k.py' ] evaluation = dict(interval=288, metric='mIoU', pre_eval=True, save_best='mIoU') log_config = dict( interval=50, hooks=[ dict(type='TextLoggerHook'...
_base_ = ['../_base_/models/fcn_hr18.py', '../_base_/datasets/vaihingen.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_40k.py'] evaluation = dict(interval=288, metric='mIoU', pre_eval=True, save_best='mIoU') log_config = dict(interval=50, hooks=[dict(type='TextLoggerHook', by_epoch=False), dict(type...
def is_bouncy(number): list_of_digits = [int(digit) for digit in str(number)] digits_len = len(list_of_digits) last_digit = list_of_digits[0] increasing_count = 0 decreasing_count = 0 for digit in list_of_digits: if digit >= last_digit: increasing_count += 1 if digit...
def is_bouncy(number): list_of_digits = [int(digit) for digit in str(number)] digits_len = len(list_of_digits) last_digit = list_of_digits[0] increasing_count = 0 decreasing_count = 0 for digit in list_of_digits: if digit >= last_digit: increasing_count += 1 if digit ...
class Solution: def searchMatrix(self, matrix: List[List[int]], target: int) -> bool: Y = len(matrix) if Y == 0: return False X = len(matrix[0]) if X == 0: return False lo, height = 0, Y*X-1 #binary while lo <= height: ...
class Solution: def search_matrix(self, matrix: List[List[int]], target: int) -> bool: y = len(matrix) if Y == 0: return False x = len(matrix[0]) if X == 0: return False (lo, height) = (0, Y * X - 1) while lo <= height: pos = (lo +...
# 496. Next Greater Element I # Runtime: 48 ms, faster than 71.69% of Python3 online submissions for Next Greater Element I. # Memory Usage: 14.7 MB, less than 14.37% of Python3 online submissions for Next Greater Element I. class Solution: # Brute Force def nextGreaterElement(self, nums1: list[int], nums2:...
class Solution: def next_greater_element(self, nums1: list[int], nums2: list[int]) -> list[int]: idx = {nums2[i]: i for i in range(len(nums2))} res = [] for n in nums1: found = False for i in range(idx[n] + 1, len(nums2)): if nums2[i] > n: ...
# Write a program to read through a file and print the contents of the file (line by line) all # in upper case. Executing the program will look as follows file_handle = open('/home/sunil/OpenSource/Learning/computer-science/intro-to-programming/python-for-everyone/8-files/mbox-short.txt') for line in file_handle: ...
file_handle = open('/home/sunil/OpenSource/Learning/computer-science/intro-to-programming/python-for-everyone/8-files/mbox-short.txt') for line in file_handle: print(line.upper(), end='')
EXTRACTED = '86 90 81 87 a3 49 99 43 97 97 41 92 49 7b 41 97 7b 44 92 7b 44 96 98 a5' flag = ''.join([chr(int(i,12)) for i in EXTRACTED.split()]) print(flag)
extracted = '86 90 81 87 a3 49 99 43 97 97 41 92 49 7b 41 97 7b 44 92 7b 44 96 98 a5' flag = ''.join([chr(int(i, 12)) for i in EXTRACTED.split()]) print(flag)
text = input().lower() searched_word = input().lower() counter = 0 for i in range(len(text)): if text[i:i + len(searched_word)] == searched_word: counter += 1 print(counter)
text = input().lower() searched_word = input().lower() counter = 0 for i in range(len(text)): if text[i:i + len(searched_word)] == searched_word: counter += 1 print(counter)
{'application':{'type':'Application', 'name':'Minimal', 'backgrounds': [ {'type':'Background', 'name':'bgMin', 'title':'Kunden Datenbank', 'size':(502, 467), 'components': [ {'type':'RadioGroup', 'name':'sortBy', 'position':(8, 67), 'size':(134, -...
{'application': {'type': 'Application', 'name': 'Minimal', 'backgrounds': [{'type': 'Background', 'name': 'bgMin', 'title': 'Kunden Datenbank', 'size': (502, 467), 'components': [{'type': 'RadioGroup', 'name': 'sortBy', 'position': (8, 67), 'size': (134, -1), 'items': ['Name', 'Firma'], 'label': 'Sortiere nach:', 'layo...
def foo(a=None): if a is not None: print('got a: ', a) print('foo /tmp/a/b/c, 1844') main = foo
def foo(a=None): if a is not None: print('got a: ', a) print('foo /tmp/a/b/c, 1844') main = foo
# Solution to Mega Contest 1 Problem: DJ WALE BABU string = input() while "WUBWUB" in string: string = string.replace("WUBWUB", "WUB") string = string.replace("WUB", " ") print(string.strip())
string = input() while 'WUBWUB' in string: string = string.replace('WUBWUB', 'WUB') string = string.replace('WUB', ' ') print(string.strip())
valid_location_qualifiers = [{'text': 'oval'}, {'text': 'town centre', 'penalty_following_locality': 10}, {'text': 'recreation reserve', 'penalty_following_locality': 10}, ...
valid_location_qualifiers = [{'text': 'oval'}, {'text': 'town centre', 'penalty_following_locality': 10}, {'text': 'recreation reserve', 'penalty_following_locality': 10}, {'text': 'estate'}, {'text': 's/centre'}, {'text': 'arcade'}, {'text': 'centre'}, {'text': 'pavilion'}, {'text': 'center'}, {'text': 'headquarters'}...
try: age = int(input('please enter age: ')) risk = 100/age print('you are {age} years old na dhave a risk profile of {risk}') except ValueError: print('age cannot be non numerical') except ZeroDivisionError: print('division by zero is invalid')
try: age = int(input('please enter age: ')) risk = 100 / age print('you are {age} years old na dhave a risk profile of {risk}') except ValueError: print('age cannot be non numerical') except ZeroDivisionError: print('division by zero is invalid')
# # PySNMP MIB module Wellfleet-5000-CHASSIS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-5000-CHASSIS-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:39:18 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version ...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, value_range_constraint, value_size_constraint, constraints_union) ...
# # PySNMP MIB module ENTERASYS-VRRP-EXT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ENTERASYS-VRRP-EXT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:50:36 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, single_value_constraint, value_size_constraint, constraints_intersection) ...
def counter(endCount): f = open("test.txt","w") # ***User Code Below*** # for __ in range(______): # Non User Code f.write(str(____)+"\n") # User Code print(_____) # ***End User Code*** # f.close
def counter(endCount): f = open('test.txt', 'w') for __ in range(______): f.write(str(____) + '\n') print(_____) f.close
def linear_sum(S, n): if n == 0: return 0 return linear_sum(S, n - 1) + S[n - 1] S = [1, 5, 8, 9, 4, 9, 3] print(linear_sum(S, len(S)))
def linear_sum(S, n): if n == 0: return 0 return linear_sum(S, n - 1) + S[n - 1] s = [1, 5, 8, 9, 4, 9, 3] print(linear_sum(S, len(S)))
#Debangshu Roy # XII - B # 40 #WAP to display only those sentences which that start with #"The" from the text file hello.txt #function to add data to the file def addData(br): F = open("hello.txt", 'a+') F.writelines(br) F.close() #function to display all the required data given in the question def...
def add_data(br): f = open('hello.txt', 'a+') F.writelines(br) F.close() def display_data(): f = open('hello.txt', 'r+') try: while F: y = F.readlines() for i in y: j = i.split() for h in j: if h == 'The': ...
count=0 a=[7,2,9,4,5,2,5,8,3,1,9] n=0 while(n<len(a)): i=n if a[i]<a[i+1] or a[i]<a[i+2]: if a[i+1]<a[i+2]: i=i+1 elif a[i]<a[i+2]: i=i+2 count +=1 print(max(count))
count = 0 a = [7, 2, 9, 4, 5, 2, 5, 8, 3, 1, 9] n = 0 while n < len(a): i = n if a[i] < a[i + 1] or a[i] < a[i + 2]: if a[i + 1] < a[i + 2]: i = i + 1 elif a[i] < a[i + 2]: i = i + 2 count += 1 print(max(count))
api_id = 3538476 api_hash = "b8889e6cb9db9df68b700da878321b90" bot_token = "5094027680:AAETKP-L61BSdlDcvNudimlVqlw3Z9Ax7yQ" redis_ip = "localhost" redis_port = 6379
api_id = 3538476 api_hash = 'b8889e6cb9db9df68b700da878321b90' bot_token = '5094027680:AAETKP-L61BSdlDcvNudimlVqlw3Z9Ax7yQ' redis_ip = 'localhost' redis_port = 6379
n = int(input()) s = input() d = {'4': '322', '6': '53', '8': '7222', '9': '7332'} ans = '' for i in s: if i=='1' or i=='0': continue a = i if i in d: a = d[i] ans += a ans = list(ans) ans = sorted(ans)[::-1] print(''.join(ans))
n = int(input()) s = input() d = {'4': '322', '6': '53', '8': '7222', '9': '7332'} ans = '' for i in s: if i == '1' or i == '0': continue a = i if i in d: a = d[i] ans += a ans = list(ans) ans = sorted(ans)[::-1] print(''.join(ans))
def get_int(val, default=None): assert default is None or type(default) is int try: return int(val) except ValueError: return default except TypeError: # When val is None, list, tuple, set, dict, etc. return default
def get_int(val, default=None): assert default is None or type(default) is int try: return int(val) except ValueError: return default except TypeError: return default
# Python - 3.6.0 Test.expect(square_sum([1, 2]), 'squareSum did not return a value') Test.assert_equals(square_sum([1, 2]), 5) Test.assert_equals(square_sum([0, 3, 4, 5]), 50)
Test.expect(square_sum([1, 2]), 'squareSum did not return a value') Test.assert_equals(square_sum([1, 2]), 5) Test.assert_equals(square_sum([0, 3, 4, 5]), 50)
if __name__ == '__main__': with open('group_members.txt', encoding='utf-8') as f: all_members = f.read().splitlines() with open('members_free_journal.txt', encoding='utf-8') as f: minus_members = f.read().splitlines() all_members_minus = [x for x in all_members if x not in minus_members] ...
if __name__ == '__main__': with open('group_members.txt', encoding='utf-8') as f: all_members = f.read().splitlines() with open('members_free_journal.txt', encoding='utf-8') as f: minus_members = f.read().splitlines() all_members_minus = [x for x in all_members if x not in minus_members] ...
def add_model_specific_args(parser, root_dir): parser.add_argument( "--train_data_file", default=None, type=str, required=True, help="The input training data file (a text file).", ) parser.add_argument( "--output_dir", type=str, required=True, ...
def add_model_specific_args(parser, root_dir): parser.add_argument('--train_data_file', default=None, type=str, required=True, help='The input training data file (a text file).') parser.add_argument('--output_dir', type=str, required=True, help='The output directory where the model predictions and checkpoints w...
class Graph(): def __init__(self): self.numnodes = 0 self.adjacentList = {} def addVertex(self, data): # lets us peek at the top of element without removing it from the stack if data not in self.adjacentList: self.adjacentList[data] = [] # add key [data] to the empty obje...
class Graph: def __init__(self): self.numnodes = 0 self.adjacentList = {} def add_vertex(self, data): if data not in self.adjacentList: self.adjacentList[data] = [] self.numnodes += 1 return def add_edge(self, node1, node2): if node2 not...
def f(a,b,cc): if cc == '+': return a+b if cc == '-': return a-b if cc == '*': return a*b n=int(input()) L=[] for i in range(n): a=input() L.append(a.split()) D = [[-987654321]*(n) for i in range(n)] D2 = [[987654321]*(n) for i in range(n)] for i in range(n): if i%2 ...
def f(a, b, cc): if cc == '+': return a + b if cc == '-': return a - b if cc == '*': return a * b n = int(input()) l = [] for i in range(n): a = input() L.append(a.split()) d = [[-987654321] * n for i in range(n)] d2 = [[987654321] * n for i in range(n)] for i in range(n): ...
''' Used to access the methods stored in the main module. ''' main_module = {} def _update(main_globals): ''' Gets the current state of the main module. ''' global main_module main_module = main_globals def get_instance(): ''' Gets the current instance of minecraft, or none if there is not an instan...
""" Used to access the methods stored in the main module. """ main_module = {} def _update(main_globals): """ Gets the current state of the main module. """ global main_module main_module = main_globals def get_instance(): """ Gets the current instance of minecraft, or none if there is not an instance...
class Model(): LR='logistic_regression' CNN='cnn' SVM='svm' GENDERWORD='gender_word' THRESHOLDCLASSIFIER='threshold_classifier' class Dataset(): BENEVOLENT='benevolent' HOSTILE='hostile' OTHER='other' CALLME='callme' SCALES='scales' class Domain(): BHO={'modified': ...
class Model: lr = 'logistic_regression' cnn = 'cnn' svm = 'svm' genderword = 'gender_word' thresholdclassifier = 'threshold_classifier' class Dataset: benevolent = 'benevolent' hostile = 'hostile' other = 'other' callme = 'callme' scales = 'scales' class Domain: bho = {'mod...
class Solution(object): def findDuplicate(self, nums): count={} for i in nums: if i not in count: count[i]=1 else: count[i]+=1 for i in range(0,len(nums)): if count[nums[i]]>1: return nums[i...
class Solution(object): def find_duplicate(self, nums): count = {} for i in nums: if i not in count: count[i] = 1 else: count[i] += 1 for i in range(0, len(nums)): if count[nums[i]] > 1: return nums[i] ...
class BytecodeBase: autoincrement = True # For jump num_args = 0 # for error checking def __init__(self): # Eventually might want to add subclassed bytecodes here # Though __subclasses__ works quite well pass def execute(self, machine): pass class Push(BytecodeBas...
class Bytecodebase: autoincrement = True num_args = 0 def __init__(self): pass def execute(self, machine): pass class Push(BytecodeBase): num_args = 1 def __init__(self, data): self.data = data def execute(self, machine): machine.push(self.data) class Po...
# https://leetcode.com/problems/reshape-the-matrix/ class Solution: def matrixReshape(self, nums: [[int]], r: int, c: int) -> [[int]]: if r * c != len(nums) * len(nums[0]): return nums # return self.solution1(nums, r, c) # return self.solution2(nums, r, c) ...
class Solution: def matrix_reshape(self, nums: [[int]], r: int, c: int) -> [[int]]: if r * c != len(nums) * len(nums[0]): return nums return self.solution4(nums, r, c) def solution1(self, nums, r, c): q = [] for row in nums: for item in row: ...
num = int(input("Digite um numero inteiro: ")) base_conversao = int(input("Digite o numero para conversao ( 1 = BINARIO | 2 = OCTAL | 3 = HEXADECIMAL ): ")) if base_conversao == 1: divisao_inteira = num resto_divisao = num binario = "" while divisao_inteira != 0: resto_divisao = divisao_intei...
num = int(input('Digite um numero inteiro: ')) base_conversao = int(input('Digite o numero para conversao ( 1 = BINARIO | 2 = OCTAL | 3 = HEXADECIMAL ): ')) if base_conversao == 1: divisao_inteira = num resto_divisao = num binario = '' while divisao_inteira != 0: resto_divisao = divisao_inteira ...
with open("infile.txt") as f1: with open("outfile.txt", "w") as f2: for line in f1: f2.write(line)
with open('infile.txt') as f1: with open('outfile.txt', 'w') as f2: for line in f1: f2.write(line)
''' Build a card from list input ''' class Card(): values = {'2':2, '3':3, '4':4, '5':5, '6':6, '7':7, '8':8,'9':9, '10':10, 'J':10, 'Q':10, 'K':10, 'A':11} def __init__(self,suit,rank): self.suit = suit self.rank = rank self.value = Card.values[rank] def __str__(self): return self.rank + '...
""" Build a card from list input """ class Card: values = {'2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, '10': 10, 'J': 10, 'Q': 10, 'K': 10, 'A': 11} def __init__(self, suit, rank): self.suit = suit self.rank = rank self.value = Card.values[rank] def __str__(sel...
class UF: def __init__(self, n: int): self.id = list(range(n)) def union(self, u: int, v: int) -> None: self.id[self.find(u)] = self.find(v) def find(self, u: int) -> int: if self.id[u] != u: self.id[u] = self.find(self.id[u]) return self.id[u] class Solution: def smallestStringWithSwa...
class Uf: def __init__(self, n: int): self.id = list(range(n)) def union(self, u: int, v: int) -> None: self.id[self.find(u)] = self.find(v) def find(self, u: int) -> int: if self.id[u] != u: self.id[u] = self.find(self.id[u]) return self.id[u] class Solution:...
# These are lists that acts as dbs for storing users, recipes and recipe categories users_db = [] recipe_db = [] recipe_category_db = [] # catching errors class UserNotFoundException(Exception): pass class NullUserError(Exception): pass class RecipeNotFoundError(Exception): pass # this is a class for...
users_db = [] recipe_db = [] recipe_category_db = [] class Usernotfoundexception(Exception): pass class Nullusererror(Exception): pass class Recipenotfounderror(Exception): pass class Users: def __init__(self): self.users = users_db def add_user(self, user): if user: ...
class Logger: def info(self, message: str) -> None: raise NotImplementedError() def success(self, message: str) -> None: raise NotImplementedError() def warning(self, message: str) -> None: raise NotImplementedError() def error(self, message: str) -> None: raise NotImp...
class Logger: def info(self, message: str) -> None: raise not_implemented_error() def success(self, message: str) -> None: raise not_implemented_error() def warning(self, message: str) -> None: raise not_implemented_error() def error(self, message: str) -> None: raise...
ODSS_FACTORY_CONTEXT = "__ODSS_FACTORY_CONTEXT__" HANDLER_PROVIDES = "odss.providers" HANDLER_REQUIRES = "odss.requires" HANDLER_VALIDATE = "odss.validate" HANDLER_BIND = "odss.bind" PROP_HANDLER_NAME = "odss.handler.id" METHOD_CALLBACK = "odss.method.callback" CALLBACK_VALIDATE = "odss.callback.validate" CALLBACK_...
odss_factory_context = '__ODSS_FACTORY_CONTEXT__' handler_provides = 'odss.providers' handler_requires = 'odss.requires' handler_validate = 'odss.validate' handler_bind = 'odss.bind' prop_handler_name = 'odss.handler.id' method_callback = 'odss.method.callback' callback_validate = 'odss.callback.validate' callback_inva...
class Voice: def __init__( self, channel_id, user_id, session_id, deaf, mute, self_deaf, self_mute, self_video, suppress ): self.channel_id = channel_id self.user_id = user_id self.session_id = session_id ...
class Voice: def __init__(self, channel_id, user_id, session_id, deaf, mute, self_deaf, self_mute, self_video, suppress): self.channel_id = channel_id self.user_id = user_id self.session_id = session_id self.deaf = deaf self.mute = mute self.self_deaf = self_deaf ...
class Version(object): def __init__(self, major, minor, tool): self.major = major self.minor = minor self.tool = tool @staticmethod def create(dic): return Version(int(dic["major"]),int(dic["minor"]),dic["tool"]) def is10(self): if self.major == 1 and self.minor...
class Version(object): def __init__(self, major, minor, tool): self.major = major self.minor = minor self.tool = tool @staticmethod def create(dic): return version(int(dic['major']), int(dic['minor']), dic['tool']) def is10(self): if self.major == 1 and self.mi...
#!/usr/bin/python3 # -*- coding: utf-8 -*- ##===-----------------------------------------------------------------------------*- Python -*-===## ## ## S E R I A L B O X ## ## This file is distributed under terms of BSD license. ## See LICENSE.txt for more information. ## ##===----------...
class Testlistener(object): def __init__(self): self.__count = 0 def increment_count(self): self.__count += 1 @property def count(self): return self.__count
set_name(0x80079AEC, "GetTpY__FUs", SN_NOWARN) set_name(0x80079B08, "GetTpX__FUs", SN_NOWARN) set_name(0x80079B14, "Remove96__Fv", SN_NOWARN) set_name(0x80079B4C, "AppMain", SN_NOWARN) set_name(0x80079BF4, "MAIN_RestartGameTask__Fv", SN_NOWARN) set_name(0x80079C20, "GameTask__FP4TASK", SN_NOWARN) set_name(0x80079CB8, "...
set_name(2147982060, 'GetTpY__FUs', SN_NOWARN) set_name(2147982088, 'GetTpX__FUs', SN_NOWARN) set_name(2147982100, 'Remove96__Fv', SN_NOWARN) set_name(2147982156, 'AppMain', SN_NOWARN) set_name(2147982324, 'MAIN_RestartGameTask__Fv', SN_NOWARN) set_name(2147982368, 'GameTask__FP4TASK', SN_NOWARN) set_name(2147982520, '...
class Dog: def __init__(self, name, age): self.name = name self.age = age def get_name(self): return self.name def set_name(self, name): self.name = name def bark(self): print(self.name, "is barking..") if __name__ == '__main__': dog = Dog("Tim") dog...
class Dog: def __init__(self, name, age): self.name = name self.age = age def get_name(self): return self.name def set_name(self, name): self.name = name def bark(self): print(self.name, 'is barking..') if __name__ == '__main__': dog = dog('Tim') dog.b...
home_page_location = "/" gdp_page_location = "/gdp" iris_page_location = "/iris" TIMEOUT = 60
home_page_location = '/' gdp_page_location = '/gdp' iris_page_location = '/iris' timeout = 60
__author__ = 'surya' def createProtein2Path(proteinList,file): prot2path={} for line in open(file): splits=line.strip().split("\t") reactomeId=splits[0].strip() proteins=splits[1:len(splits)] for each in proteins: if each in proteinList: if each not i...
__author__ = 'surya' def create_protein2_path(proteinList, file): prot2path = {} for line in open(file): splits = line.strip().split('\t') reactome_id = splits[0].strip() proteins = splits[1:len(splits)] for each in proteins: if each in proteinList: i...
# # PySNMP MIB module GNOME-PRODUCT-ZEBRA-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/GNOME-PRODUCT-ZEBRA-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:19:46 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, constraints_intersection, value_size_constraint, value_range_constraint) ...
##Config file for lifetime_spyrelet.py in spyre/spyre/spyrelet/ # Device List devices = { 'fungen':[ 'lantz.drivers.keysight.Keysight_33622A.Keysight_33622A', ['USB0::0x0957::0x5707::MY53801461::INSTR'], {} ], 'wm':[ 'lantz.drivers.bristol.bristol771.Bristol_771', [6...
devices = {'fungen': ['lantz.drivers.keysight.Keysight_33622A.Keysight_33622A', ['USB0::0x0957::0x5707::MY53801461::INSTR'], {}], 'wm': ['lantz.drivers.bristol.bristol771.Bristol_771', [6535], {}]} spyrelets = {'contour': ['spyre.spyrelets.contour_spyrelet.Contour', {'fungen': 'fungen', 'wm': 'wm'}, {}]}
#!/usr/bin/python # Published March 2015 # Author : Greg Fabre - http://www.iero.org # Based on Noah Blon's work : http://codepen.io/noahblon/details/lxukH # Public domain source code def getHome() : return '<g transform="matrix(6.070005,0,0,5.653153,292.99285,506.46284)"><path d="M 42,48 C 29.995672,48.017555 18.0...
def get_home(): return '<g transform="matrix(6.070005,0,0,5.653153,292.99285,506.46284)"><path d="M 42,48 C 29.995672,48.017555 18.003366,48 6,48 L 6,27 c 0,-0.552 0.447,-1 1,-1 0.553,0 1,0.448 1,1 l 0,19 c 32.142331,0.03306 13.954169,0 32,0 l 0,-18 c 0,-0.552 0.447,-1 1,-1 0.553,0 1,0.448 1,1 z"/><path d="m 47,27 ...
class ShortPath: def __init__(self): self.paths = [] self.distance = 0
class Shortpath: def __init__(self): self.paths = [] self.distance = 0
n = int(input()) l, r = 0, 0 for _ in range(n): x, y = map(int, input().split()) if x < 0: l += 1 else: r += 1 if l <= 1 or r <= 1: print('Yes') else: print('No')
n = int(input()) (l, r) = (0, 0) for _ in range(n): (x, y) = map(int, input().split()) if x < 0: l += 1 else: r += 1 if l <= 1 or r <= 1: print('Yes') else: print('No')
RS_ID = 0x12345678 RS_VERSION = 7 RBSP_ID = 0x35849298 RBSP_VERSION = 2 R_PAT_ID = 0x09784348 R_PAT_VERSION = 0 R_LM_ID = 0x30671804 R_LM_VERSION = 3 R_COL_ID = ...
rs_id = 305419896 rs_version = 7 rbsp_id = 897880728 rbsp_version = 2 r_pat_id = 158876488 r_pat_version = 0 r_lm_id = 812062724 r_lm_version = 3 r_col_id = 1347426191 r_col_version = 0 r_nav_id = 2290649231 r_nav_version = 2 rm_flag_additive = 1 rm_flag_useopacity = 2 rm_flag_twosided = 4 rm_flag_notwalkable = 8 rm_fl...
class SearchUI: '''SearchUI provides a means of easily assembling a search interface for either Elasticsearch or LunrJS powered search services''' def __init__(self, cfg): self.cfg = {} for key in cfg.keys(): self.cfg[key] = cfg.get(key, None) if not ('id' in self.cfg):...
class Searchui: """SearchUI provides a means of easily assembling a search interface for either Elasticsearch or LunrJS powered search services""" def __init__(self, cfg): self.cfg = {} for key in cfg.keys(): self.cfg[key] = cfg.get(key, None) if not 'id' in self.cfg: ...
a=float(input()) b=float(input()) intdiv=int(a/b) floatdiv=float(a/b) print(intdiv,floatdiv, sep='\n')
a = float(input()) b = float(input()) intdiv = int(a / b) floatdiv = float(a / b) print(intdiv, floatdiv, sep='\n')
s = list(input()) t = list(input()) n = len(s) answer = "No" for i in range(n): for j in range(n-1): s[n-1-j], s[n-2-j] = s[n-2-j], s[n-1-j] if s == t: answer = "Yes" print(answer)
s = list(input()) t = list(input()) n = len(s) answer = 'No' for i in range(n): for j in range(n - 1): (s[n - 1 - j], s[n - 2 - j]) = (s[n - 2 - j], s[n - 1 - j]) if s == t: answer = 'Yes' print(answer)
# use classifier and test_datagen from before # classifier is just a Sequential object x = test_datagen.flow_from_directory('dataset/image_folder', target_size = (64, 64), class_mode = 'binary') print("It is a %s!" % ("dog" if classifier.predict(...
x = test_datagen.flow_from_directory('dataset/image_folder', target_size=(64, 64), class_mode='binary') print('It is a %s!' % ('dog' if classifier.predict(x) else 'cat'))
# Posts number per page for pagination. POSTS_PER_PAGE = 10 # Time period in seconds for a page in cache. CACHED_TIME_INDEX = 3
posts_per_page = 10 cached_time_index = 3
_base_ = [ '../_base_/datasets/textvqa_dataset.py', '../_base_/models/m4c_config.py', '../_base_/schedules/schedule_textvqa.py', '../_base_/textvqa_default_runtime.py' ] # yapf:disable
_base_ = ['../_base_/datasets/textvqa_dataset.py', '../_base_/models/m4c_config.py', '../_base_/schedules/schedule_textvqa.py', '../_base_/textvqa_default_runtime.py']
TAIGA_USER = 'e1312060@urhen.com' TAIGA_PASSWORD = 'test_taiga_user' PROJECT_SLUG = 'test_taiga_user-fake-project-1' DONE_SLUG = 'Done'
taiga_user = 'e1312060@urhen.com' taiga_password = 'test_taiga_user' project_slug = 'test_taiga_user-fake-project-1' done_slug = 'Done'
class UserInputError( Exception): pass
class Userinputerror(Exception): pass
real_number = int(input()) numbers = [] names = [] def find_closer(): diferences = [] closers = [] global numbers global real_number for i in numbers: diference = real_number - i if diference < 0: diferences.append(-diference) else: diferences.append(...
real_number = int(input()) numbers = [] names = [] def find_closer(): diferences = [] closers = [] global numbers global real_number for i in numbers: diference = real_number - i if diference < 0: diferences.append(-diference) else: diferences.append(...
NODE_LEFT = "LEFT" NODE_RIGHT = "RIGHT" NODE_ROOT = "ROOT" class BinarySearchTree: def __init__(self, value): self.value = value self.left = None self.right = None self.parent = None self.type = None def insert(self, tree): current = self while 1: ...
node_left = 'LEFT' node_right = 'RIGHT' node_root = 'ROOT' class Binarysearchtree: def __init__(self, value): self.value = value self.left = None self.right = None self.parent = None self.type = None def insert(self, tree): current = self while 1: ...
class Circle: pi = 3.14 def __init__(self, diameter): print("Creating circle with diameter {d}".format(d=diameter)) # Add assignment for self.radius here: self.radius = diameter / 2 def circumference(self): return 2 * self.pi * self.radius medium_pizza = Circle(12) teaching_table = Circle(36...
class Circle: pi = 3.14 def __init__(self, diameter): print('Creating circle with diameter {d}'.format(d=diameter)) self.radius = diameter / 2 def circumference(self): return 2 * self.pi * self.radius medium_pizza = circle(12) teaching_table = circle(36) round_room = circle...
# anagram_palindrome # # Write a function which accepts an input word and returns true or false # if there exists an anagram of that input word that is a palindrome. # We are going to try solve this question with a time complexcity of: # O(n) => linear # palindrome : is a string that read the same from front to back...
def anagram_palindrome(word): return word == word[::-1] print(anagram_palindrome('noon')) print(anagram_palindrome('carrace')) print(anagram_palindrome('cutoo')) print(anagram_palindrome('a')) print(anagram_palindrome('aotoa')) print(anagram_palindrome('ddaaa'))
def to_bool(value): value = str(value) if value == "True" or value == "TRUE" or value == "true": return True else: return False
def to_bool(value): value = str(value) if value == 'True' or value == 'TRUE' or value == 'true': return True else: return False
nota_trabalhos = float(input()) nota_prova = float(input()) media = (nota_trabalhos + nota_prova) / 2 if media >= 6: print('aprovado') elif nota_trabalhos >= 2: print('talvez com a sub') else: print('reprovado')
nota_trabalhos = float(input()) nota_prova = float(input()) media = (nota_trabalhos + nota_prova) / 2 if media >= 6: print('aprovado') elif nota_trabalhos >= 2: print('talvez com a sub') else: print('reprovado')
def KthLSB(n, k): return (n>>(k-1))&1 if __name__ == '__main__': n = 10 k = 4 print(KthLSB(n, k))
def kth_lsb(n, k): return n >> k - 1 & 1 if __name__ == '__main__': n = 10 k = 4 print(kth_lsb(n, k))
# # PySNMP MIB module ERI-DNX-STM1-OC3-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ERI-DNX-STM1-OC3-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:51:49 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, value_range_constraint, single_value_constraint, value_size_constraint) ...
class User: user = [] ''' this class creates new instance of user data ''' def __init__(self, username, password): ''' init method to define objects Args: username: to ask user a username password: to either generate or ask user for a password ...
class User: user = [] '\n this class creates new instance of user data\n ' def __init__(self, username, password): """ init method to define objects Args: username: to ask user a username password: to either generate or ask user for a password ...
def gcd(a,b): if a==0: return b else: return gcd(b%a,a) c = gcd(100,35) # c = 5 print(c)
def gcd(a, b): if a == 0: return b else: return gcd(b % a, a) c = gcd(100, 35) print(c)
def debug(ctx,n): print("######### BEGIN DEBUG"+n+"################") print(ctx.getText()) print("######### END DEBUG ################") class ASTException(Exception): pass
def debug(ctx, n): print('######### BEGIN DEBUG' + n + '################') print(ctx.getText()) print('######### END DEBUG ################') class Astexception(Exception): pass
defines = { 'base00': '#F7B3DA', 'base01': '#f55050', 'base02': '#488214', 'base03': '#EEB422', 'base04': '#468dd4', 'base05': '#551a8b', 'base06': '#1b9e9e', 'base07': '#75616b', 'base08': '#9e8b95', 'base09': '#e06a26', 'base0A': '#f0dde6', 'base0B': '#b5a3ac', 'bas...
defines = {'base00': '#F7B3DA', 'base01': '#f55050', 'base02': '#488214', 'base03': '#EEB422', 'base04': '#468dd4', 'base05': '#551a8b', 'base06': '#1b9e9e', 'base07': '#75616b', 'base08': '#9e8b95', 'base09': '#e06a26', 'base0A': '#f0dde6', 'base0B': '#b5a3ac', 'base0C': '#8a7680', 'base0D': '#3b2c33', 'base0E': '#d46...
a,b = input("Enter A(x1, y1): ").split() c,d = input("Enter B(x2, y2): ").split() distance = pow((pow((int(c)-int(a)),2) + pow((int(d)-int(b)),2)), 0.5) print("Distance between points A and B: ",distance)
(a, b) = input('Enter A(x1, y1): ').split() (c, d) = input('Enter B(x2, y2): ').split() distance = pow(pow(int(c) - int(a), 2) + pow(int(d) - int(b), 2), 0.5) print('Distance between points A and B: ', distance)
class FileReader: def __init__(self): pass def read_text_file(self, path): file = open(path, 'r') return file.read()
class Filereader: def __init__(self): pass def read_text_file(self, path): file = open(path, 'r') return file.read()
# -*- coding:utf-8 -*- BIND_HOST='0.0.0.0' BIND_PORT=9999 USER_HOME = '%s/var/users' %BASE_DIR USER_ACCOUNT={ 'alex':{'password':'123456', 'quotation':1000000,#1GB 'expire':'2017-01-22' } }
bind_host = '0.0.0.0' bind_port = 9999 user_home = '%s/var/users' % BASE_DIR user_account = {'alex': {'password': '123456', 'quotation': 1000000, 'expire': '2017-01-22'}}
# Created by MechAviv # Map ID :: 620100029 # Spaceship : In Front of the Shuttle sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, True, False, False) sm.setStandAloneMode(True) sm.forcedInput(0) OBJECT_1 = sm.sendNpcController(9270083, 2415, -134) sm.showNpcSpecialActionByObjectId(O...
sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, True, False, False) sm.setStandAloneMode(True) sm.forcedInput(0) object_1 = sm.sendNpcController(9270083, 2415, -134) sm.showNpcSpecialActionByObjectId(OBJECT_1, 'summon', 0) sm.sendSessionValue('Ade', OBJECT_1) sm.forcedInput(1) sm.sen...
# # PySNMP MIB module WIRELESS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WIRELESS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:29:45 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,...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, constraints_intersection, constraints_union, value_range_constraint) ...
class Semester: def __init__(self, season:str, year:int, brother_id:int, amount:float): self.season = season self.year = year self.brother_id = brother_id self.amount = amount
class Semester: def __init__(self, season: str, year: int, brother_id: int, amount: float): self.season = season self.year = year self.brother_id = brother_id self.amount = amount
# -*- coding: utf-8 -*- def test_dataset_sizes(test_file): ds = test_file.dataset assert ds.sizes == {"ch": 2, "pixel": 1024, "Time": 50} def test_dataset_variables(test_file): ds = test_file.dataset for var in ["Count", "FilteredCount", "Rough_wavelength"]: assert var in ds def test_config(...
def test_dataset_sizes(test_file): ds = test_file.dataset assert ds.sizes == {'ch': 2, 'pixel': 1024, 'Time': 50} def test_dataset_variables(test_file): ds = test_file.dataset for var in ['Count', 'FilteredCount', 'Rough_wavelength']: assert var in ds def test_config(test_file): print(test...
def append_node_to_dict(node1, node2, dict_connections): if not node1 in dict_connections: dict_connections[node1] = [node2] else: node_connections = dict_connections[node1] if not node2 in node_connections: node_connections.append(node2) dict_connections[node1] =...
def append_node_to_dict(node1, node2, dict_connections): if not node1 in dict_connections: dict_connections[node1] = [node2] else: node_connections = dict_connections[node1] if not node2 in node_connections: node_connections.append(node2) dict_connections[node1] =...
class TrieNode: def __init__(self): self.children: Dict[str, TrieNode] = defaultdict(TrieNode) self.deleted = False class Solution: def deleteDuplicateFolder(self, paths: List[List[str]]) -> List[List[str]]: ans = [] root = TrieNode() subtreeToNodes: Dict[str, List[TrieNode]] = defaultdict(lis...
class Trienode: def __init__(self): self.children: Dict[str, TrieNode] = defaultdict(TrieNode) self.deleted = False class Solution: def delete_duplicate_folder(self, paths: List[List[str]]) -> List[List[str]]: ans = [] root = trie_node() subtree_to_nodes: Dict[str, Lis...
class Type1: def f1_1(): pass def test(t1): t1.f1_1() t2 = t1
class Type1: def f1_1(): pass def test(t1): t1.f1_1() t2 = t1
TABLE8 = [0] * 2 ** 8 for index in range(len(TABLE8)): TABLE8[index] = (index & 1) + TABLE8[index >> 1] class Solution: def hammingWeight(self, n: int) -> int: return TABLE8[n & 0xff] + TABLE8[(n >> 8) & 0xff] + TABLE8[(n >> 16) & 0xff] + TABLE8[n >> 24]
table8 = [0] * 2 ** 8 for index in range(len(TABLE8)): TABLE8[index] = (index & 1) + TABLE8[index >> 1] class Solution: def hamming_weight(self, n: int) -> int: return TABLE8[n & 255] + TABLE8[n >> 8 & 255] + TABLE8[n >> 16 & 255] + TABLE8[n >> 24]
class SensorReadError(Exception): pass class CommunicationErrorException(Exception): pass
class Sensorreaderror(Exception): pass class Communicationerrorexception(Exception): pass
# @time: 2022/1/10 5:31 PM # Author: pan # @File: study.py # @Software: PyCharm print("study py") name = "pan" age = 10 def study(): print("good good study, day day up!")
print('study py') name = 'pan' age = 10 def study(): print('good good study, day day up!')
class Response(object): def __init__(self, request=None): self.intent_name = request.intent_name if request else '' self.lang = request.lang if request else '' self.data = request.data if request else '' self._speech = '' self._text = '' @property def text(self): ...
class Response(object): def __init__(self, request=None): self.intent_name = request.intent_name if request else '' self.lang = request.lang if request else '' self.data = request.data if request else '' self._speech = '' self._text = '' @property def text(self): ...
''' math > ad-hoc difficulty: easy date: 09/Jun/2020 problem: how many bishops can be placed on a n x n chessboard without threatening each other? by: @brpapa ''' while (1): try: n = int(input()) ans = n + (n-2 if n > 2 else 0) print(ans) except EOFError: break
""" math > ad-hoc difficulty: easy date: 09/Jun/2020 problem: how many bishops can be placed on a n x n chessboard without threatening each other? by: @brpapa """ while 1: try: n = int(input()) ans = n + (n - 2 if n > 2 else 0) print(ans) except EOFError: break
ENCRYPTED_MESSAGE = 'MORA EVOCU ECCLESIA TUTIS AUT TIBI NISI OLIM OCIUS NOVEM' DECRYPTED_MESSAGE = 'MEETATNOON' CIPHER_OPTIONS = ['null','caesar','atbash'] cipher_used_in_this_example = CIPHER_OPTIONS[0] # replace with the index of the cipher used in this encryption
encrypted_message = 'MORA EVOCU ECCLESIA TUTIS AUT TIBI NISI OLIM OCIUS NOVEM' decrypted_message = 'MEETATNOON' cipher_options = ['null', 'caesar', 'atbash'] cipher_used_in_this_example = CIPHER_OPTIONS[0]
x1, x2, y1, y2 = 150, 193, -86, -136 def passes_through(vx, vy): nx, ny = 0, 0 points = [] while nx <= x2 and ny >= y2: nx, ny = nx + vx, ny + vy points += [[nx, ny]] if vx > 0: vx = vx - 1 vy = vy - 1 if x1 <= nx and nx <= x2 and y2 <= ny and ny <= y1:...
(x1, x2, y1, y2) = (150, 193, -86, -136) def passes_through(vx, vy): (nx, ny) = (0, 0) points = [] while nx <= x2 and ny >= y2: (nx, ny) = (nx + vx, ny + vy) points += [[nx, ny]] if vx > 0: vx = vx - 1 vy = vy - 1 if x1 <= nx and nx <= x2 and (y2 <= ny) a...