content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Funcioanrio:
def __init__(self):
self._matricula = None
self._nome = None
self._cargo = None
@property
def matricula(self):
return self._matricula
@property
def nome(self):
return self._nome
@property
def cargo(self):
return self._car... | class Funcioanrio:
def __init__(self):
self._matricula = None
self._nome = None
self._cargo = None
@property
def matricula(self):
return self._matricula
@property
def nome(self):
return self._nome
@property
def cargo(self):
return self._car... |
#
# PySNMP MIB module A3COM0017-STACK-CONFIG (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM0017-STACK-CONFIG
# Produced by pysmi-0.3.4 at Wed May 1 11:08:38 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (super_stack_i_iconfig,) = mibBuilder.importSymbols('A3COM0004-GENERIC', 'superStackIIconfig')
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, sin... |
def inc(i):
return i + 1
def add(a, b):
return a + b
def sub(a, b):
return a - b
| def inc(i):
return i + 1
def add(a, b):
return a + b
def sub(a, b):
return a - b |
class SuperMetroidRooms:
addrToNumDoors = {
"0791F8" : 4,
"0792B3" : 2,
"0792FD" : 7,
"0793AA" : 1,
"0793D5" : 1,
"0793FE" : 6,
"079461" : 2,
"07948C" : 3,
"0794CC" : 3,
"0794FD" : 2,
"079552" : 2,
"07957D" : ... | class Supermetroidrooms:
addr_to_num_doors = {'0791F8': 4, '0792B3': 2, '0792FD': 7, '0793AA': 1, '0793D5': 1, '0793FE': 6, '079461': 2, '07948C': 3, '0794CC': 3, '0794FD': 2, '079552': 2, '07957D': 2, '0795A8': 2, '0795D4': 2, '0795FF': 2, '07962A': 3, '07965B': 2, '07968F': 2, '0796BA': 5, '07975C': 2, '0797B5': ... |
print('''
*******************************************************************************
| | | |
_________|________________.=""_;=.______________|_____________________|_______
| | ,-"_,="" `"=.| |
|_______________... | print('\n*******************************************************************************\n | | | |\n _________|________________.=""_;=.______________|_____________________|_______\n| | ,-"_,="" `"=.| |\n|____________... |
@auth.requires_membership("Administradores")
def index():
query = request.vars.query or "auth_user"
grid = SQLFORM.grid(db[query],user_signature=False,editable=True,deletable=True,create=True)
return locals() | @auth.requires_membership('Administradores')
def index():
query = request.vars.query or 'auth_user'
grid = SQLFORM.grid(db[query], user_signature=False, editable=True, deletable=True, create=True)
return locals() |
# Elections newsfeed. Seconday strings are not being used at this point
newsfeed_strings = [
{ # VOTED
'primary' : {'string' : _('You voted "%s" for %s'),
'params' : ['issue_vote', 'issue_title']},
'secondary' : {'string' : _('%s voted "%s" for %s'),
'params... | newsfeed_strings = [{'primary': {'string': _('You voted "%s" for %s'), 'params': ['issue_vote', 'issue_title']}, 'secondary': {'string': _('%s voted "%s" for %s'), 'params': ['displayname', 'issue_vote', 'issue_title']}}, {'primary': {'string': _('You hired %s'), 'params': ['target_name']}, 'secondary': {'string': _('%... |
# ## Complete Doji
# import threading
# import pandas as pd
# from queue import Queue
# import time
# import requests
# file = open("stock_pred.txt", "w")
# data = pd.read_csv("C:\\Users\\BEST BUY\\Desktop\\NASDAQ_20200331.csv")
# symbols = data.iloc[:100,0:1].values
# th = Queue(maxsize = 4000)
def doji(arg):
# p... | def doji(arg):
c = arg['close']
h = arg['high']
l = arg['low']
o = arg['open']
if c >= o:
if c - o <= 0.015 * ((c + o) / 2):
return 1
elif o - c <= 0.015 * ((c + o) / 2):
return 1
return 0 |
def definition():
"""UI breakdown of finance data"""
view = """
SELECT set_id, summary_code, account, account_description, sum(amount) as amount FROM v_mri_finance
GROUP BY set_id, summary_code, account, account_description
"""
return view
| def definition():
"""UI breakdown of finance data"""
view = '\n SELECT set_id, summary_code, account, account_description, sum(amount) as amount FROM v_mri_finance\n GROUP BY set_id, summary_code, account, account_description\n '
return view |
string = input("Enter a string: ")
reverse = reversed(string)
if list(string) == list(reverse):
print("It is a palindrome")
else:
print("It is not a palindrome") | string = input('Enter a string: ')
reverse = reversed(string)
if list(string) == list(reverse):
print('It is a palindrome')
else:
print('It is not a palindrome') |
INITIAL_RPC_IF_ID = RPC_IF_ID
class _RPC_IF_ID(INITIAL_RPC_IF_ID):
def __repr__(self):
return '<RPC_IF_ID "{0}" ({1}, {2})>'.format(self.Uuid.to_string(), self.VersMajor, self.VersMinor) | initial_rpc_if_id = RPC_IF_ID
class _Rpc_If_Id(INITIAL_RPC_IF_ID):
def __repr__(self):
return '<RPC_IF_ID "{0}" ({1}, {2})>'.format(self.Uuid.to_string(), self.VersMajor, self.VersMinor) |
# Generate the output like: A(5), B(3), C(1) with input like ABBAAACB
print('Write your string:')
value = input()
dic_str = {}
list_count = []
count = 0
for i in value:
dic_str.update({i: ''})
# print(dic_str)
for x in dic_str:
result = "{}({})"
print(result.format(x, value.count(x)))
# print(... | print('Write your string:')
value = input()
dic_str = {}
list_count = []
count = 0
for i in value:
dic_str.update({i: ''})
for x in dic_str:
result = '{}({})'
print(result.format(x, value.count(x))) |
#Support variables for suit checking and card scoring
class Common():
ROYAL_FLUSH_CARD:str = {"T": "10",
"J": "11",
"Q": "12",
"K": "13",
"A": "14"}
VALUE_CARD:str = {"2": "2",
... | class Common:
royal_flush_card: str = {'T': '10', 'J': '11', 'Q': '12', 'K': '13', 'A': '14'}
value_card: str = {'2': '2', '3': '3', '4': '4', '5': '5', '6': '6', '7': '7', '8': '8', '9': '9', 'T': '10', 'J': '11', 'Q': '12', 'K': '13', 'A': '14'}
value_card_inv: str = {'2': '2', '3': '3', '4': '4', '5': '5... |
class MiningRig:
def __init__(self, hashpower, user):
self.hashpower = hashpower
self.mining_block = None
self.user = user
self.user._miningrigs.append(self)
def __str__(self):
return "Mining Rig Hashpower " + str(self.hashpower) + " owned by " + str(self.user)
| class Miningrig:
def __init__(self, hashpower, user):
self.hashpower = hashpower
self.mining_block = None
self.user = user
self.user._miningrigs.append(self)
def __str__(self):
return 'Mining Rig Hashpower ' + str(self.hashpower) + ' owned by ' + str(self.user) |
N = int(input())
bfr = [[[0]*10 for i in range(3)] for j in range(4)]
for i in range(N):
b, f, r, v = [int(n) for n in input().split()]
bfr[b-1][f-1][r-1] += v
c = 0
for B in bfr:
for F in B:
print(' '.join([str(c) for c in F]).rjust(20))
# print('{:>20}'.format(' '.join([str(c) for c in F]))... | n = int(input())
bfr = [[[0] * 10 for i in range(3)] for j in range(4)]
for i in range(N):
(b, f, r, v) = [int(n) for n in input().split()]
bfr[b - 1][f - 1][r - 1] += v
c = 0
for b in bfr:
for f in B:
print(' '.join([str(c) for c in F]).rjust(20))
c += 1
if c < 4:
print('###########... |
def fibonacci(n):
if n < 0:
raise ValueError("n > 0")
print(fibonacci.hints)
print()
if n < len( fibonacci.hints ):
return fibonacci.hints[ n ]
else:
val = fibonacci(n-1) + fibonacci(n-2)
if len(fibonacci.hints) == n:
fibonacci.hints.append( val )
... | def fibonacci(n):
if n < 0:
raise value_error('n > 0')
print(fibonacci.hints)
print()
if n < len(fibonacci.hints):
return fibonacci.hints[n]
else:
val = fibonacci(n - 1) + fibonacci(n - 2)
if len(fibonacci.hints) == n:
fibonacci.hints.append(val)
r... |
# -*- coding: utf-8 -*-
"""
create on 2021-01-29 20:19
author @66492
"""
| """
create on 2021-01-29 20:19
author @66492
""" |
def abs(number):
return -number if number < 0 else number
# print(max([1, 2, 3]))
# print(min([1, 2, 3, -10, 0, 3]))
# print(sum([1, 2, 3, 4, -4, -6]))
# print(abs(-10))
# print(abs(10))
# print(list(map(bool, [1, 2, 4, 'hello', True, []])))
print(ord('\n'))
print(chr(ord('f')))
print('hello')
| def abs(number):
return -number if number < 0 else number
print(ord('\n'))
print(chr(ord('f')))
print('hello') |
def extract_command_from_request(request, fields):
command = {}
for field in fields:
if field in request.json:
command[field] = request.json[field]
return command
| def extract_command_from_request(request, fields):
command = {}
for field in fields:
if field in request.json:
command[field] = request.json[field]
return command |
# song.py
"""
Small class to represent a song for the queue.
"""
# Copyright (C) 2021 JulioLoayzaM
#
# You may use, distribute and modify this code under
# the terms of the MIT license.
#
# See the LICENSE file for more details.
class Song():
"""
A class to represent a song. Stores the title, the name of the down... | """
Small class to represent a song for the queue.
"""
class Song:
"""
A class to represent a song. Stores the title, the name of the downloaded file,
the URL and the thumbnail URL.
"""
def __init__(self, title: str, file: str, url: str, thumbnail: str):
self.title = title
self.file = file
... |
class BezierCurve(object,IDisposable):
"""
Represents a Bezier curve.
Note: as an exception,the bezier curve is not derived from Rhino.Geometry.Curve.
BezierCurve(controlPoints: IEnumerable[Point2d])
BezierCurve(controlPoints: IEnumerable[Point3d])
BezierCurve(controlPoints: IEnumerable[Poin... | class Beziercurve(object, IDisposable):
"""
Represents a Bezier curve.
Note: as an exception,the bezier curve is not derived from Rhino.Geometry.Curve.
BezierCurve(controlPoints: IEnumerable[Point2d])
BezierCurve(controlPoints: IEnumerable[Point3d])
BezierCurve(controlPoints: IEnumerable[Point4d])
"... |
#
# @lc app=leetcode id=581 lang=python3
#
# [581] Shortest Unsorted Continuous Subarray
#
# https://leetcode.com/problems/shortest-unsorted-continuous-subarray/description/
#
# algorithms
# Easy (30.58%)
# Likes: 1985
# Dislikes: 97
# Total Accepted: 94.1K
# Total Submissions: 307.2K
# Testcase Example: '[2,6,4... | class Solution:
def find_unsorted_subarray(self, nums: List[int]) -> int:
z = [x for (_, x) in sorted(zip(nums, range(len(nums))))]
d = 0
head = -1
for (i, v) in enumerate(z):
if i != v:
if head < 0:
head = i
else:
... |
#c
for row in range(7):
for col in range(7):
if (row==0 and col!=0) or (col==0 and row!=0 and row!=7 and row!=6)or (row==6 and col!=0):
print("*",end=" ")
else:
print(" ",end=" ")
print()
| for row in range(7):
for col in range(7):
if row == 0 and col != 0 or (col == 0 and row != 0 and (row != 7) and (row != 6)) or (row == 6 and col != 0):
print('*', end=' ')
else:
print(' ', end=' ')
print() |
configuration = {
'SLEEP_TIME': 600,
'ST_IP': 'IP',
'PHONES': {
'{NAME1}': {'uuid': '{UUID}', 'status': None, 'count': 0},
'{NAME2}': {'uuid': '{UUID}', 'status': None, 'count': 0}
}
}
| configuration = {'SLEEP_TIME': 600, 'ST_IP': 'IP', 'PHONES': {'{NAME1}': {'uuid': '{UUID}', 'status': None, 'count': 0}, '{NAME2}': {'uuid': '{UUID}', 'status': None, 'count': 0}}} |
#!/opt/local/bin/python
bp_file="5_input.txt"
def load_file(filename):
record_list=[]
bpfile=open(filename, "r")
for i in bpfile:
record_list.append(i)
return record_list
def find_row(bpass):
bitmap=""
for i in bpass[0:7]:
# print(i,)
if i == "B":
bitmap+="1"
elif i == "F":
bit... | bp_file = '5_input.txt'
def load_file(filename):
record_list = []
bpfile = open(filename, 'r')
for i in bpfile:
record_list.append(i)
return record_list
def find_row(bpass):
bitmap = ''
for i in bpass[0:7]:
if i == 'B':
bitmap += '1'
elif i == 'F':
... |
def kolit(s):
ile = 0
kolumny = ["" for k in range(len(s))]
i = 0
while len(s) > i:
for j in range(len(s[:i + 1])):
kolumny[j] += s[:i + 1][j]
s = s[i + 1:]
i += 1
for l in range(len(s)):
kolumny[l] += s[l]
for elem in kolumny:
if elem i... | def kolit(s):
ile = 0
kolumny = ['' for k in range(len(s))]
i = 0
while len(s) > i:
for j in range(len(s[:i + 1])):
kolumny[j] += s[:i + 1][j]
s = s[i + 1:]
i += 1
for l in range(len(s)):
kolumny[l] += s[l]
for elem in kolumny:
if elem is not '... |
#!/usr/bin/python
#Collatz Sequence practice
def collatz(number):
newnum = 0
if number == 1:
return 0
elif number %2 == 0:
newnum = number/2
print(int(newnum))
collatz(newnum)
elif number %2 ==1:
newnum = 3*number +1
print(int(newnum))
collatz(ne... | def collatz(number):
newnum = 0
if number == 1:
return 0
elif number % 2 == 0:
newnum = number / 2
print(int(newnum))
collatz(newnum)
elif number % 2 == 1:
newnum = 3 * number + 1
print(int(newnum))
collatz(newnum)
print('Please enter a number grea... |
# -*- coding: utf-8 -*-
"""Top-level package for mycataloguer."""
__author__ = """Natan Brosztein"""
__email__ = 'code@natanbro.com'
__version__ = '0.1.0'
| """Top-level package for mycataloguer."""
__author__ = 'Natan Brosztein'
__email__ = 'code@natanbro.com'
__version__ = '0.1.0' |
_base_ = [
'RepLKNet_upernet.py',
'../_base_/datasets/cityscapes_769x769.py', '../_base_/default_runtime.py',
'../_base_/schedules/schedule_80k.py'
]
# model settings
model = dict(
decode_head=dict(
num_classes=19,
align_corners=True),
auxiliary_head=dict(
num_classes=19,
... | _base_ = ['RepLKNet_upernet.py', '../_base_/datasets/cityscapes_769x769.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_80k.py']
model = dict(decode_head=dict(num_classes=19, align_corners=True), auxiliary_head=dict(num_classes=19, align_corners=True), train_cfg=dict(), test_cfg=dict(mode='whole'))
o... |
def main():
ps = pyscriber.Scriber()
x = 5
ps.p(x)
y = "hello"
ps.p(y)
a = [1, 2, 3]
ps.p(a)
b = {1: "a", 2: "b"}
ps.p(b)
if __name__=="__main__":
main()
| def main():
ps = pyscriber.Scriber()
x = 5
ps.p(x)
y = 'hello'
ps.p(y)
a = [1, 2, 3]
ps.p(a)
b = {1: 'a', 2: 'b'}
ps.p(b)
if __name__ == '__main__':
main() |
print('=' * 5, 'AULA_006b', '=' * 5)
n0 = float(input('digite um valor: '))
print(n0)
n1 = str(input('digite um valor: '))
print(type(n1))
n2 = input('digite algo: ')
print(n2.isnumeric())
| print('=' * 5, 'AULA_006b', '=' * 5)
n0 = float(input('digite um valor: '))
print(n0)
n1 = str(input('digite um valor: '))
print(type(n1))
n2 = input('digite algo: ')
print(n2.isnumeric()) |
class Solution(object):
def plusOne(self, digits):
"""
:type digits: List[int]
:rtype: List[int]
"""
s = []
carry = 1
for i in range(len(digits) - 1, -1, -1):
d = digits[i] + carry
if d == 10:
s.append(0)
... | class Solution(object):
def plus_one(self, digits):
"""
:type digits: List[int]
:rtype: List[int]
"""
s = []
carry = 1
for i in range(len(digits) - 1, -1, -1):
d = digits[i] + carry
if d == 10:
s.append(0)
... |
class Solution(object):
def minMoves(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
smallest = min(nums)
return sum([n - smallest for n in nums])
| class Solution(object):
def min_moves(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
smallest = min(nums)
return sum([n - smallest for n in nums]) |
#
# PySNMP MIB module BAY-STACK-UNICAST-STORM-CONTROL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BAY-STACK-UNICAST-STORM-CONTROL-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:36:23 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Usi... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, single_value_constraint, constraints_union, value_size_constraint) ... |
# -*- coding: utf-8 -*-
"""
Parent namespace for WePay modules.
Copyright (c) 2015-2016 [WePay](https://wepay.com).
<http://opensource.org/licenses/Apache2.0>
"""
| """
Parent namespace for WePay modules.
Copyright (c) 2015-2016 [WePay](https://wepay.com).
<http://opensource.org/licenses/Apache2.0>
""" |
########################################
# If statement checking boundary conditions
# Shiva K
########################################
deposit = input("What is the deposit amount?")
if int(deposit) > 100:
print("You get a free toast!")
print("Have a nice day!")
| deposit = input('What is the deposit amount?')
if int(deposit) > 100:
print('You get a free toast!')
print('Have a nice day!') |
__import__('cyborg.objects.driver_objects.driver_device')
__import__('cyborg.objects.driver_objects.driver_attribute')
__import__('cyborg.objects.driver_objects.driver_attach_handle')
__import__('cyborg.objects.driver_objects.driver_deployable')
__import__('cyborg.objects.driver_objects.driver_controlpath_id')
| __import__('cyborg.objects.driver_objects.driver_device')
__import__('cyborg.objects.driver_objects.driver_attribute')
__import__('cyborg.objects.driver_objects.driver_attach_handle')
__import__('cyborg.objects.driver_objects.driver_deployable')
__import__('cyborg.objects.driver_objects.driver_controlpath_id') |
class Solution:
def multiply(self, num1: str, num2: str) -> str:
a = int(num1)
b = int(num2)
return str(a * b)
| class Solution:
def multiply(self, num1: str, num2: str) -> str:
a = int(num1)
b = int(num2)
return str(a * b) |
height = float(input("enter your height in m: "))
weight = float(input("enter your weight in kg: "))
bmi = round(weight / (height ** 2))
if bmi < 18.5:
message = f'Your BMI is {bmi}, you are underweight.'
elif bmi >= 18.5 and bmi <= 25:
message = f'Your BMI is {bmi}, you have a normal weight.'
elif bmi > 25 a... | height = float(input('enter your height in m: '))
weight = float(input('enter your weight in kg: '))
bmi = round(weight / height ** 2)
if bmi < 18.5:
message = f'Your BMI is {bmi}, you are underweight.'
elif bmi >= 18.5 and bmi <= 25:
message = f'Your BMI is {bmi}, you have a normal weight.'
elif bmi > 25 and b... |
def f1():
print("Hello")
def f2():
pass
f1()
f2()
for i in range(100):
if i%10==0:
print(i)
else:pass
"""Hello
0
10
20
30
40
50
60
70
80
90""" | def f1():
print('Hello')
def f2():
pass
f1()
f2()
for i in range(100):
if i % 10 == 0:
print(i)
else:
pass
'Hello\n0\n10\n20\n30\n40\n50\n60\n70\n80\n90' |
def milliseconds_to_seconds(milliseconds:int) -> int:
return int((milliseconds/1000)%60)
def milliseconds_to_minutes(milliseconds:int) -> int:
return int((milliseconds/(1000*60))%60)
def seconds_to_milliseconds(seconds:float) -> int:
return int(round(seconds,2)*1000)
| def milliseconds_to_seconds(milliseconds: int) -> int:
return int(milliseconds / 1000 % 60)
def milliseconds_to_minutes(milliseconds: int) -> int:
return int(milliseconds / (1000 * 60) % 60)
def seconds_to_milliseconds(seconds: float) -> int:
return int(round(seconds, 2) * 1000) |
def test_len(sample):
"""The normalized_query_data property should return a list of the same length as raw_query_data"""
assert len(sample.normalized_query_data) == len(sample['raw_query_data'])
def test_none_values(sample):
"""The normalized_query_data property should return a list that does not contain... | def test_len(sample):
"""The normalized_query_data property should return a list of the same length as raw_query_data"""
assert len(sample.normalized_query_data) == len(sample['raw_query_data'])
def test_none_values(sample):
"""The normalized_query_data property should return a list that does not contain a... |
def lookup(data, name, add_field=False):
path = [i.strip() for i in name.split('.')]
found_value = None
# get lookup dictionary/data:
try:
lookup = _ttp_["parser_object"].lookups
for i in path:
lookup = lookup.get(i,{})
except KeyError:
return data, None
# per... | def lookup(data, name, add_field=False):
path = [i.strip() for i in name.split('.')]
found_value = None
try:
lookup = _ttp_['parser_object'].lookups
for i in path:
lookup = lookup.get(i, {})
except KeyError:
return (data, None)
try:
found_value = lookup[da... |
# Copyright 2016-2022 The FEAGI Authors. All Rights Reserved.
#
# 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 applic... | gui_baseline = {'ipu': {'i__inf', 'i__pro'}, 'opu': {'o__mot', 'o__ser'}, 'morphology': {'block_to_block': {'vectors': [[0, 0, 0]]}, 'decrease_filter_diagonal': {'vectors': [[0, 1, 1]]}, 'decrease_filter_diagonal2': {'vectors': [[0, 2, 1]]}, 'increase_filter_diagonal': {'vectors': [[0, 1, -1]]}, 'increase_filter_diagon... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2022.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... | """ Test datasets module """
def get_deprecated_msg_ref(function_name: str) -> str:
"""returns reference deprecated message"""
return f'The {function_name} function is deprecated as of version 0.4.0 and will be removed no sooner than 3 months after the release.' |
"""
Premium Question
https://leetcode.com/problems/closest-binary-search-tree-value-ii/
"""
__author__ = 'Daniel'
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def closestKValues(self, root, target, k):
... | """
Premium Question
https://leetcode.com/problems/closest-binary-search-tree-value-ii/
"""
__author__ = 'Daniel'
class Treenode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def closest_k_values(self, root, target, k):
... |
def echo():
print('MOCKNAME:MOCKREVNO')
def main():
echo()
| def echo():
print('MOCKNAME:MOCKREVNO')
def main():
echo() |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | linux_consumption = 0
linux_dedicated = 1
windows = 2
python = 'python'
node = 'node'
dotnet = 'dotnet'
java = 'java'
powershell = 'powershell'
service_endpoint_domain = 'dev.azure.com' |
class IPV4:
def __init__(self, ip="127.0.0.1"):
# Ip is to be stored as an array
# Check the data type of the IP input
if type(ip) == str:
self.Current_IP = self.Convert_STA(ip)
elif type(ip) == list:
self.Current_IP = type(ip)
# Verify The IPs validity
if not self.Verify_IP():
rai... | class Ipv4:
def __init__(self, ip='127.0.0.1'):
if type(ip) == str:
self.Current_IP = self.Convert_STA(ip)
elif type(ip) == list:
self.Current_IP = type(ip)
if not self.Verify_IP():
raise type_error('Ip must be a string or array with 4 places (separated b... |
# DomirScire
a=int(input())
b=int(input())
c=int(input())
print(pow(a,b))
print(pow(a,b,c))
| a = int(input())
b = int(input())
c = int(input())
print(pow(a, b))
print(pow(a, b, c)) |
class Solution:
def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]:
combinations = []
def dfs(nums, currSum, i):
if currSum == target:
combinations.append(nums)
elif currSum < target:
for j in range(i, len(... | class Solution:
def combination_sum(self, candidates: List[int], target: int) -> List[List[int]]:
combinations = []
def dfs(nums, currSum, i):
if currSum == target:
combinations.append(nums)
elif currSum < target:
for j in range(i, len(candid... |
__author__ = 'Chirag'
text = ""
file_name = input("Please provide a file name : ") # "fileWriteDemo1.txt"
try:
my_file = open(file_name, 'r')
except IOError:
print("cannot open ", file_name)
else:
lines = my_file.readlines() # list of individual lines
for line_num, line in enumerate(lines):
print(f"{line_nu... | __author__ = 'Chirag'
text = ''
file_name = input('Please provide a file name : ')
try:
my_file = open(file_name, 'r')
except IOError:
print('cannot open ', file_name)
else:
lines = my_file.readlines()
for (line_num, line) in enumerate(lines):
print(f'{line_num} : {line}')
finally:
my_file.c... |
class Selector:
def __init__(self, options):
self._index = 0
self._options = options
self._option_pad = 16
for option in options:
if len(option) + 7 > self._option_pad:
self._option_pad = len(option) + 7
def cursor_left(self):
self._index = (self._index - 1) % len(self._options)... | class Selector:
def __init__(self, options):
self._index = 0
self._options = options
self._option_pad = 16
for option in options:
if len(option) + 7 > self._option_pad:
self._option_pad = len(option) + 7
def cursor_left(self):
self._index = (... |
class EndpointException(Exception):
pass
| class Endpointexception(Exception):
pass |
__author__ = 'Chirag'
""" just like raise, assert is used to raise an
AssertionError when certain conditions are not met
usually it to 'assert' inputs are of a certain kind
and if they are not. An Exception is raised"""
def avg(grades):
assert not len(grades) == 0
return sum(grades)/len(grades)
print(avg([14, 17... | __author__ = 'Chirag'
" just like raise, assert is used to raise an\nAssertionError when certain conditions are not met\nusually it to 'assert' inputs are of a certain kind\nand if they are not. An Exception is raised"
def avg(grades):
assert not len(grades) == 0
return sum(grades) / len(grades)
print(avg([14,... |
def iswinner(board, piece: str) -> int:
"""
piece - string - Either an "X" or "O"
Checks if win conditions are met.
Could check only relevant squares but not as readable.
"""
# Checks each row, then each col, and then the diagonals
for line in [[x + 3 * y for x in range(3)] for y in range(3)... | def iswinner(board, piece: str) -> int:
"""
piece - string - Either an "X" or "O"
Checks if win conditions are met.
Could check only relevant squares but not as readable.
"""
for line in [[x + 3 * y for x in range(3)] for y in range(3)] + [[3 * x + y for x in range(3)] for y in range(3)] + [[3 *... |
stylesheet = """
QPushButton{
border :2px solid ;
border-radius: 10;
border-color : qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 #d60cf0, stop:1 #9a08ed);
color: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 #d60cf0, stop:1 #9a08ed);
font-size: 20px;
font-weight: bold;
}
QPushButton:pressed... | stylesheet = "\n\nQPushButton{\n border :2px solid ;\n border-radius: 10;\n border-color : qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 #d60cf0, stop:1 #9a08ed);\n color: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 #d60cf0, stop:1 #9a08ed); \n font-size: 20px;\n font-weight: bold;\n}\n\nQPushButto... |
name = input("Your name: ")
print ('hi',name)
print('Enter only numbers')
print('Enter a value')
y = input('y: ')
print('Thank you enter value 2')
x = input('x: ')
sum = int(x) + int(y)
print('Answer', sum)
print("thank you for using this bot")
print("produced by 1to5PC")
| name = input('Your name: ')
print('hi', name)
print('Enter only numbers')
print('Enter a value')
y = input('y: ')
print('Thank you enter value 2')
x = input('x: ')
sum = int(x) + int(y)
print('Answer', sum)
print('thank you for using this bot')
print('produced by 1to5PC') |
class Solution:
def numberOfPatterns(self, m, n):
"""
:type m: int
:type n: int
:rtype: int
"""
skip = [[0] * 10 for _ in range(10)]
skip[1][3] = skip[3][1] = 2
skip[1][7] = skip[7][1] = 4
skip[3][9] = skip[9][3] = 6
skip[7][9] = skip[9... | class Solution:
def number_of_patterns(self, m, n):
"""
:type m: int
:type n: int
:rtype: int
"""
skip = [[0] * 10 for _ in range(10)]
skip[1][3] = skip[3][1] = 2
skip[1][7] = skip[7][1] = 4
skip[3][9] = skip[9][3] = 6
skip[7][9] = ski... |
#put the radius number
r=float(input("Radius: "))
A=3.14*r*r
print(A)
| r = float(input('Radius: '))
a = 3.14 * r * r
print(A) |
"""
our task is to make a function that can take any non-negative integer as a argument and return it with its digits in descending order. Essentially, rearrange the digits to create the highest possible number.
Examples:
Input: 21445 Output: 54421
Input: 145263 Output: 654321
Input: 1254859723 Output: 9875543221
"... | """
our task is to make a function that can take any non-negative integer as a argument and return it with its digits in descending order. Essentially, rearrange the digits to create the highest possible number.
Examples:
Input: 21445 Output: 54421
Input: 145263 Output: 654321
Input: 1254859723 Output: 9875543221
"... |
class BadRequestError(Exception):
pass
class ServerError(Exception):
code = 500
message = "Server error."
def __init__(self):
super().__init__({"code": self.code, "message": self.message})
class EmailAlreadyExist(BadRequestError):
code = 422
message = "Email already exist."
def... | class Badrequesterror(Exception):
pass
class Servererror(Exception):
code = 500
message = 'Server error.'
def __init__(self):
super().__init__({'code': self.code, 'message': self.message})
class Emailalreadyexist(BadRequestError):
code = 422
message = 'Email already exist.'
def _... |
def str_to_int(input_str):
output_int = 0
if input_str[0] == '-':
start_idx = 1
is_negative = True
else:
start_idx = 0
is_negative = False
for i in range(start_idx, len(input_str)):
place = 10 ** (len(input_str) - (i + 1))
digit = ord(input_str[i]) - ord... | def str_to_int(input_str):
output_int = 0
if input_str[0] == '-':
start_idx = 1
is_negative = True
else:
start_idx = 0
is_negative = False
for i in range(start_idx, len(input_str)):
place = 10 ** (len(input_str) - (i + 1))
digit = ord(input_str[i]) - ord('... |
#
# PySNMP MIB module ALCATEL-IND1-NTP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALCATEL-IND1-NTP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:18:42 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... | (softent_ind1_ntp,) = mibBuilder.importSymbols('ALCATEL-IND1-BASE', 'softentIND1Ntp')
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_... |
for num in range(2,50):
for x in range(2,num):
if num % x == 0:
print(str(num)+ 'not prime')
break
else:
print(str(num) + 'prime')
| for num in range(2, 50):
for x in range(2, num):
if num % x == 0:
print(str(num) + 'not prime')
break
else:
print(str(num) + 'prime') |
expected_output = {
"tunnel": {
"150.0.5.1": {
"remote": {
"150.0.0.1": {
"src_port": 12346,
"dst_port": 12346,
"ipsec": {
"ipsec_decrypt_inbound": 0,
"ipsec_rx_auth_failu... | expected_output = {'tunnel': {'150.0.5.1': {'remote': {'150.0.0.1': {'src_port': 12346, 'dst_port': 12346, 'ipsec': {'ipsec_decrypt_inbound': 0, 'ipsec_rx_auth_failures': 0, 'ipsec_rx_failures': 0, 'ipsec_encrypt_outbound': 0, 'ipsec_tx_auth_failures': 0, 'ipsec_tx_failures': 0}}, '150.0.1.1': {'src_port': 12346, 'dst_... |
# Inner Functions
def parent(num):
def first_child():
return "First Child"
def second_child():
return "Second Child"
if num == 1:
# Return a reference to the inner function first_child
return first_child
else:
return second_child
first = parent(1)
second = pa... | def parent(num):
def first_child():
return 'First Child'
def second_child():
return 'Second Child'
if num == 1:
return first_child
else:
return second_child
first = parent(1)
second = parent(2) |
# Display the Properties content
print (P4DProps)
# Get single property
print (P4DProps.Value['date1'])
print (P4DProps.Value['date2'])
print (P4DProps.Value['date3'])
# Put single property
P4DProps.Value['date1'] = ["01.01.2017",""]
P4DProps.Value['date2'] = ["","31.12.2017"]
P4DProps.Value['date3'] = ["01.01.2017","... | print(P4DProps)
print(P4DProps.Value['date1'])
print(P4DProps.Value['date2'])
print(P4DProps.Value['date3'])
P4DProps.Value['date1'] = ['01.01.2017', '']
P4DProps.Value['date2'] = ['', '31.12.2017']
P4DProps.Value['date3'] = ['01.01.2017', '31.12.2017']
P4DProps.Value = P4DProps.Value |
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"id_final 21743\n"
]
}
],
"source": [
"from SimpleGraphics import *\n",
"from quantum_rules import *\n",
"from ... | {'cells': [{'cell_type': 'code', 'execution_count': 1, 'metadata': {}, 'outputs': [{'name': 'stdout', 'output_type': 'stream', 'text': ['id_final 21743\n']}], 'source': ['from SimpleGraphics import *\n', 'from quantum_rules import *\n', 'from random import randrange, shuffle\n', 'from time import time, sleep\n', 'from ... |
# -*- coding: utf-8 -*-
INPUT = (2959251, 4542595)
def calculate_loop_size(public_key):
"""
>>> calculate_loop_size(5764801)
8
>>> calculate_loop_size(17807724)
11
"""
subject_number = 7
value = 1
loop_size = 0
while value != public_key:
value *= subject_number
... | input = (2959251, 4542595)
def calculate_loop_size(public_key):
"""
>>> calculate_loop_size(5764801)
8
>>> calculate_loop_size(17807724)
11
"""
subject_number = 7
value = 1
loop_size = 0
while value != public_key:
value *= subject_number
value %= 20201227
... |
#ParentesisValido.py
def parentesisValido (cadena) :
# Comprueba los pares de parentesis validos que abren y cierran
# Devuelve el numero de parentesis sobrantes
stack =[]
for val in cadena:
if val == ")":
if len(stack) != 0 and stack[-1] == "(":
stack.pop... | def parentesis_valido(cadena):
stack = []
for val in cadena:
if val == ')':
if len(stack) != 0 and stack[-1] == '(':
stack.pop(-1)
else:
stack.append(val)
else:
stack.append(val)
return len(stack)
print(parentesis_valido('()... |
#__variables__
# Simple propositional conditions:
never_count = (
'LET', 'SPEC', 'TSW', 'VZ(fin',
'VNW(pers,pron,nomin', 'VNW(vb,pron,stan',
'VNW(pers,pron,stan', 'VNW(recip,pron,dial)',
'VNW(pers,pron,dial', 'VNW(recip,pron,obl',
'VNW(pers,pron,obl', 'VNW(pr',
'VNW(aanw,pron,stan', 'VNW(refl',
... | never_count = ('LET', 'SPEC', 'TSW', 'VZ(fin', 'VNW(pers,pron,nomin', 'VNW(vb,pron,stan', 'VNW(pers,pron,stan', 'VNW(recip,pron,dial)', 'VNW(pers,pron,dial', 'VNW(recip,pron,obl', 'VNW(pers,pron,obl', 'VNW(pr', 'VNW(aanw,pron,stan', 'VNW(refl', 'VNW(aanw,det,stan,nom', 'VNW(vrag', 'VNW(aanw,det,dat,nom', 'VNW(excl', 'L... |
class Solution:
def removeDuplicates(self, nums: [int]) -> int:
if(len(nums)<=2):return len(nums)
i=2
a=2
while(i<len(nums)):
if nums[i]!=nums[a-2]:
nums[a]=nums[i]
a=a+1
i=i+1
return a | class Solution:
def remove_duplicates(self, nums: [int]) -> int:
if len(nums) <= 2:
return len(nums)
i = 2
a = 2
while i < len(nums):
if nums[i] != nums[a - 2]:
nums[a] = nums[i]
a = a + 1
i = i + 1
return a |
# -*- coding:utf-8 -*-
class ChinaMacroItem(object):
def __init__(self, site_name, site_sort, content):
self.site_name = site_name
self.site_sort = site_sort
self.content = content
def __str__(self):
return f"sitename:{self.site_name},sitesort:{self.site_sort},content:{self.cont... | class Chinamacroitem(object):
def __init__(self, site_name, site_sort, content):
self.site_name = site_name
self.site_sort = site_sort
self.content = content
def __str__(self):
return f'sitename:{self.site_name},sitesort:{self.site_sort},content:{self.content}' |
# Base Classes
class SRWDiagnostic (Exception):
""" Base Diagnostic Class"""
code = 0
description = ""
details = ""
surrogate = 0
fatal = 1
def __str__(self):
return "%d [%s]: %s" % (self.code, self.description, self.details)
class GeneralDiagnostic (SRWDiagnostic):
pass
cl... | class Srwdiagnostic(Exception):
""" Base Diagnostic Class"""
code = 0
description = ''
details = ''
surrogate = 0
fatal = 1
def __str__(self):
return '%d [%s]: %s' % (self.code, self.description, self.details)
class Generaldiagnostic(SRWDiagnostic):
pass
class Cqldiagnostic(SR... |
givenString = str.lower(input("Enter a string:"))
vowels = ['a', 'e', 'i', 'o', 'u']
vowelcount = 0
for character in givenString:
if character in vowels:
vowelcount += 1
print("The given string has "+ str(vowelcount) + " vowels")
| given_string = str.lower(input('Enter a string:'))
vowels = ['a', 'e', 'i', 'o', 'u']
vowelcount = 0
for character in givenString:
if character in vowels:
vowelcount += 1
print('The given string has ' + str(vowelcount) + ' vowels') |
# Do not edit this file!
# VUID ranges reserved for branches
# Key is branch name, value is [ start, end, nextfree ]
vuidCounts = {
'branch-vuids': [ 4000, 4999, 4052 ],
'devel': [ 3000, 3999, 3570 ],
'master': [ 4000, 4999, 4052 ],
}
| vuid_counts = {'branch-vuids': [4000, 4999, 4052], 'devel': [3000, 3999, 3570], 'master': [4000, 4999, 4052]} |
state = {"verbose": False}
def main(verbose: bool = False):
"""
Manage container images
"""
if verbose:
state["verbose"] = True
| state = {'verbose': False}
def main(verbose: bool=False):
"""
Manage container images
"""
if verbose:
state['verbose'] = True |
# Python program to find the sum of natural numbers up to n where n is provided by user
# change this value for a different result
num = 160
# uncomment to take input from the user
#num = int(input("Enter a number: "))
if num < 0:
print("Enter a positive number")
else:
sum = 0
# use while loop t... | num = 160
if num < 0:
print('Enter a positive number')
else:
sum = 0
while num > 0:
sum += num
num -= 1
print('The sum is', sum) |
def subsequences(L,n):
return [L[i:i+n] for i in range(len(L)-n+1)]
def sumallsubsqn(L):
New = []
for n in range(1,len(L)+1):
N = (subsequences(L,n))
for i in N:
New.append(i)
C = []
for i in New:
C.append(sum(i))
return C
def... | def subsequences(L, n):
return [L[i:i + n] for i in range(len(L) - n + 1)]
def sumallsubsqn(L):
new = []
for n in range(1, len(L) + 1):
n = subsequences(L, n)
for i in N:
New.append(i)
c = []
for i in New:
C.append(sum(i))
return C
def indexsum(L, R, Ar):
... |
class Activity(dict):
fields = [
'start_index',
'distance',
"moving_time",
"elapsed_time",
"average_watts",
"min_watts",
"max_watts",
"average_watts_kg",
"max_watts_kg",
"intensity",
"w5s_variability",
"weighted_average_... | class Activity(dict):
fields = ['start_index', 'distance', 'moving_time', 'elapsed_time', 'average_watts', 'min_watts', 'max_watts', 'average_watts_kg', 'max_watts_kg', 'intensity', 'w5s_variability', 'weighted_average_watts', 'training_load', 'joules', 'decoupling', 'zone', 'zone_min_watts', 'zone_max_watts', 'ave... |
__author__ = 'daniel'
class TrialJob:
def __init__(self):
self.real_time = 1
self.core_affinity = 1
self.reps = 1
class EchoTrialJob(TrialJob):
def __init__(self):
TrialJob.__init__(self)
# in nanoseconds (for now :-/)
self.delay = 100
self.target_host... | __author__ = 'daniel'
class Trialjob:
def __init__(self):
self.real_time = 1
self.core_affinity = 1
self.reps = 1
class Echotrialjob(TrialJob):
def __init__(self):
TrialJob.__init__(self)
self.delay = 100
self.target_host = ''
self.target_port = ''
cl... |
class Publisher(object):
def publish(self, payload):
raise NotImplemented
def read(self, buffer):
raise NotImplemented
| class Publisher(object):
def publish(self, payload):
raise NotImplemented
def read(self, buffer):
raise NotImplemented |
# Source : https://leetcode.com/problems/serialize-and-deserialize-binary-tree/
# Author : henrytine
# Date : 2020-08-18
#####################################################################################################
#
# Serialization is the process of converting a data structure or object into a sequence of ... | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string.
:type root: TreeNode
:rtype: str
"""
res = []
self.helper(root, res)
return ' '.join(res)
def helper(self, node, res):
if node:
res.append(str(node.val))
... |
"""
A module providing a class for playing cards
This implementation is adapted from chapter 18 of the course text, _Think Python_,
by Allen B. Downey.
Authors: Walker White (wmw2), Steve Marschner (srm2), and Lillian Lee (ljl2)
Date: October 20, 2019
"""
class Card(object):
"""
A class to represent a st... | """
A module providing a class for playing cards
This implementation is adapted from chapter 18 of the course text, _Think Python_,
by Allen B. Downey.
Authors: Walker White (wmw2), Steve Marschner (srm2), and Lillian Lee (ljl2)
Date: October 20, 2019
"""
class Card(object):
"""
A class to represent a sta... |
age = int(input())
yleft= 90 -age
days = yleft*365
weeks = yleft*52
month= yleft*12
print(f"you have left {days} {weeks} {month}") | age = int(input())
yleft = 90 - age
days = yleft * 365
weeks = yleft * 52
month = yleft * 12
print(f'you have left {days} {weeks} {month}') |
def update_field(raw_message, flag, new_value, SOH="\x01"):
msg_fields = raw_message.split(SOH)
for i, field in enumerate(msg_fields):
if field.startswith(flag + "="):
msg_fields[i] = flag + "=" + str(new_value)
break
new_message = SOH.join(msg_fields)
return new_messag... | def update_field(raw_message, flag, new_value, SOH='\x01'):
msg_fields = raw_message.split(SOH)
for (i, field) in enumerate(msg_fields):
if field.startswith(flag + '='):
msg_fields[i] = flag + '=' + str(new_value)
break
new_message = SOH.join(msg_fields)
return new_messag... |
def listToString(alist2):
alist = [str(x) for x in alist2]
s = ''
for i in range(len(alist)):
if i != len(alist)-1:
s += alist[i] + ", "
else:
s += "and " + alist[i]
print(s)
| def list_to_string(alist2):
alist = [str(x) for x in alist2]
s = ''
for i in range(len(alist)):
if i != len(alist) - 1:
s += alist[i] + ', '
else:
s += 'and ' + alist[i]
print(s) |
soma = 0
for num in range(0, 10):
soma += num
print('Soma atual: ', soma)
print('Soma final: ', soma)
| soma = 0
for num in range(0, 10):
soma += num
print('Soma atual: ', soma)
print('Soma final: ', soma) |
# http://codingbat.com/prob/p148853
def extra_end(str):
return str[-2:] + str[-2:] + str[-2:]
| def extra_end(str):
return str[-2:] + str[-2:] + str[-2:] |
class TestLogin:
def test_login1(self):
assert 2
def test_login2(self):
assert 2
def test_login3(self):
assert 2
| class Testlogin:
def test_login1(self):
assert 2
def test_login2(self):
assert 2
def test_login3(self):
assert 2 |
# Create a class called Account. Upon initialization, it should receive an id (number), a name (string), and a balance
# (integer; optional; 0 by default). The class should also have 3 additional instance methods:
# - credit(amount) - adds the amount to the balance and returns the new balance
# - debit(amount) - if the... | class Account:
def __init__(self, id_: int, name: str, balance=0) -> None:
self.id = id_
self.name = name
self.balance = balance
def credit(self, amount: int) -> int:
self.balance += amount
return self.balance
def debit(self, amount: int) -> any:
if amount ... |
__version__ = "0.7"
__title__ = "foodme_eval"
__description__ = "Run evaluation from FooDMe"
__author__ = "Gregoire Denay"
__author_email__ = 'gregoire.denay@cvua-rrw.de'
__licence__ = 'BSD License' | __version__ = '0.7'
__title__ = 'foodme_eval'
__description__ = 'Run evaluation from FooDMe'
__author__ = 'Gregoire Denay'
__author_email__ = 'gregoire.denay@cvua-rrw.de'
__licence__ = 'BSD License' |
"""This problem was asked by Facebook.
Given a string consisting of parentheses, single digits, and positive and negative signs,
convert the string into a mathematical expression to obtain the answer.
Don't use eval or a similar built-in parser.
For example, given '-1 + (2 + 3)', you should return 4.
""" | """This problem was asked by Facebook.
Given a string consisting of parentheses, single digits, and positive and negative signs,
convert the string into a mathematical expression to obtain the answer.
Don't use eval or a similar built-in parser.
For example, given '-1 + (2 + 3)', you should return 4.
""" |
#
# @lc app=leetcode id=60 lang=python3
#
# [60] Permutation Sequence
#
# @lc code=start
class Solution:
def getPermutation(self, n: int, k: int) -> str:
fac = [1]
for i in range(1, n):
fac.append(fac[-1] * i) # a list [1, 1, 2, 6..., (n-1)!]
res = ''
nums = list(ran... | class Solution:
def get_permutation(self, n: int, k: int) -> str:
fac = [1]
for i in range(1, n):
fac.append(fac[-1] * i)
res = ''
nums = list(range(1, n + 1))
k = k - 1
while n > 0:
(q, r) = divmod(k, fac[n - 1])
res += str(nums[q... |
# pylint: disable=missing-function-docstring, missing-module-docstring, unused-variable
def fib_caller(x : int):
def fib(n : int) -> int:
if n < 2:
return n
i = fib(n-1)
j = fib(n-2)
return i + j
m = fib(x)
return m
| def fib_caller(x: int):
def fib(n: int) -> int:
if n < 2:
return n
i = fib(n - 1)
j = fib(n - 2)
return i + j
m = fib(x)
return m |
for _ in range(int(input())):
n,a,b=map(int,input().split())
l,r=1,n
ans=[]
if a+b>n-2 or abs(a-b)>1:
print(-1)
else:
if a==b:
h,v=0,0
ans.append(l)
l+=1
while h<a:
ans.append(r)
r-=1
ans.... | for _ in range(int(input())):
(n, a, b) = map(int, input().split())
(l, r) = (1, n)
ans = []
if a + b > n - 2 or abs(a - b) > 1:
print(-1)
elif a == b:
(h, v) = (0, 0)
ans.append(l)
l += 1
while h < a:
ans.append(r)
r -= 1
a... |
def separar(cadena):
resultado=[]
subcadena="|"
contador=0
for i in range (len(cadena)-len(subcadena)+1):
if cadena[i:i+len(subcadena)]==subcadena:
resultado.append(cadena)
contador=contador+1
return resultado
print(separar("uno|dos|tres"))
| def separar(cadena):
resultado = []
subcadena = '|'
contador = 0
for i in range(len(cadena) - len(subcadena) + 1):
if cadena[i:i + len(subcadena)] == subcadena:
resultado.append(cadena)
contador = contador + 1
return resultado
print(separar('uno|dos|tres')) |
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Jiao Lin
# California Institute of Technology
# (C) 2007 All Rights Reserved
#
# {LicenseText}
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | class Abstractsqe:
def identify(self, visitor):
raise NotImplementedError
pass
__id__ = '$Id$' |
# Open page, scroll in object, press in first newsletter, open page, go to first page
def test_openNewsletter(app):
app.page_operation.open_page("https://athletictrainers.inloop.com")
app.newsletter.scroll_to_newsletter()
app.newsletter.click_in_first_newsletter()
app.tab_operation.test_jump_to_page("ht... | def test_open_newsletter(app):
app.page_operation.open_page('https://athletictrainers.inloop.com')
app.newsletter.scroll_to_newsletter()
app.newsletter.click_in_first_newsletter()
app.tab_operation.test_jump_to_page('https://athletictrainers.inloop.com/en/news')
def test_open_all_newsletter(app):
a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.