content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Programa:
def __init__(self, nome, ano):
self._nome = nome.title()
self.ano = ano
self._likes = 0
@property
def likes(self):
return self._likes
def dar_like(self):
self._likes += 1
@property
def nome(self):
return self._nome
... | class Programa:
def __init__(self, nome, ano):
self._nome = nome.title()
self.ano = ano
self._likes = 0
@property
def likes(self):
return self._likes
def dar_like(self):
self._likes += 1
@property
def nome(self):
return self._nome
@nome.se... |
# -*- coding: utf-8 -*-
{
'name': 'Customer Rating',
'version': '1.0',
'category': 'Productivity',
'description': """
This module allows a customer to give rating.
""",
'depends': [
'mail',
],
'data': [
'views/rating_view.xml',
'views/rating_template.xml',
'se... | {'name': 'Customer Rating', 'version': '1.0', 'category': 'Productivity', 'description': '\nThis module allows a customer to give rating.\n', 'depends': ['mail'], 'data': ['views/rating_view.xml', 'views/rating_template.xml', 'security/ir.model.access.csv'], 'installable': True, 'auto_install': False} |
class Solution:
def merge(self, intervals: List[List[int]]) -> List[List[int]]:
# Check edge case
if not intervals:
return []
# Sort the list to make it ascending with respect to the sub-list's first element and then in second element
intervals = sorted(interv... | class Solution:
def merge(self, intervals: List[List[int]]) -> List[List[int]]:
if not intervals:
return []
intervals = sorted(intervals, key=lambda x: (x[0], x[1]))
res = [intervals[0]]
for i in range(1, len(intervals)):
if intervals[i][0] <= res[-1][1]:
... |
__source__ = 'https://leetcode.com/problems/next-greater-element-iii/description/'
# Time: O(n)
# Space: O(n)
#
# Description: same as 556. Next Greater Element III
# //xinzyang@tesla.com
# // Next closest bigger number with the same digits
# // You have to create a function that takes a positive integer number and re... | __source__ = 'https://leetcode.com/problems/next-greater-element-iii/description/'
result = '\nIFang Lee ran 238 lines of Java (finished in 11.59s):\n\ngetRealNextBiggerInteger():\n12-> 21 true\n513 -> 531 true\n1342-> 1423 true\n534976-> 536479 true\n9999-> -1 true\n11-> -1 true\n0-> -1 true\n2147483647-> -1 true\n\n... |
def es_vocal(letra):
"""
Decide si una letra es vocal
>>> es_vocal('A')
True
>>> es_vocal('ae')
False
>>> es_vocal('Z')
False
>>> es_vocal('o')
True
:param letra:
:return:
"""
return len(letra) == 1 and letra in 'aeiouAEIOU'
def contar_vocales(texto):
"""
... | def es_vocal(letra):
"""
Decide si una letra es vocal
>>> es_vocal('A')
True
>>> es_vocal('ae')
False
>>> es_vocal('Z')
False
>>> es_vocal('o')
True
:param letra:
:return:
"""
return len(letra) == 1 and letra in 'aeiouAEIOU'
def contar_vocales(texto):
"""
... |
# Portal & Effect for Evan Intro | Dream World: Dream Forest Entrance (900010000)
# Author: Tiger
# "You who are seeking a Pact..."
sm.showEffect("Map/Effect.img/evan/dragonTalk01", 3000)
| sm.showEffect('Map/Effect.img/evan/dragonTalk01', 3000) |
#implement STACK/LIFO using LIST
stack=[]
while True:
choice=int(input("1 push, 2 pop, 3 peek, 4 display, 5 exit "))
if choice == 1:
ele=int(input("enter element to push "))
stack.append(ele)
elif choice == 2:
if len(stack)>0:
pele=stack.pop()
print("poped elemnt ",pele)
else:
print("sta... | stack = []
while True:
choice = int(input('1 push, 2 pop, 3 peek, 4 display, 5 exit '))
if choice == 1:
ele = int(input('enter element to push '))
stack.append(ele)
elif choice == 2:
if len(stack) > 0:
pele = stack.pop()
print('poped elemnt ', pele)
el... |
#!/bin/python3
nombre = 3
nombres_premiers = [1, 2]
print(2)
try:
while True:
diviseurs = []
for diviseur in nombres_premiers:
division = nombre / diviseur
if division == int(division):
diviseurs.append(diviseur)
if len(diviseurs) == 1:
pri... | nombre = 3
nombres_premiers = [1, 2]
print(2)
try:
while True:
diviseurs = []
for diviseur in nombres_premiers:
division = nombre / diviseur
if division == int(division):
diviseurs.append(diviseur)
if len(diviseurs) == 1:
print(nombre)
... |
DIGS = {1: 'F1D', 2: 'F2D', 3: 'F3D', 22: 'SD', -2: 'L2D'}
SEC_ORDER_DIGS = {key: f'{val}_sec' for key, val in DIGS.items()}
REV_DIGS = {'F1D': 1, 'F2D': 2, 'F3D': 3, 'SD': 22, 'L2D': -2}
LEN_TEST = {1: 9, 2: 90, 3: 900, 22: 10, -2: 100}
TEST_NAMES = {'F1D': 'First Digit Test', 'F2D': 'First Two Digits Test',
... | digs = {1: 'F1D', 2: 'F2D', 3: 'F3D', 22: 'SD', -2: 'L2D'}
sec_order_digs = {key: f'{val}_sec' for (key, val) in DIGS.items()}
rev_digs = {'F1D': 1, 'F2D': 2, 'F3D': 3, 'SD': 22, 'L2D': -2}
len_test = {1: 9, 2: 90, 3: 900, 22: 10, -2: 100}
test_names = {'F1D': 'First Digit Test', 'F2D': 'First Two Digits Test', 'F3D': ... |
# model settings
model = dict(
type='NPID',
neg_num=65536,
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(3,), # no conv-1, x-1: stage-x
norm_cfg=dict(type='SyncBN'),
style='pytorch'),
neck=dict(
type='LinearNeck',
in_c... | model = dict(type='NPID', neg_num=65536, backbone=dict(type='ResNet', depth=50, num_stages=4, out_indices=(3,), norm_cfg=dict(type='SyncBN'), style='pytorch'), neck=dict(type='LinearNeck', in_channels=2048, out_channels=128, with_avg_pool=True), head=dict(type='ContrastiveHead', temperature=0.07), memory_bank=dict(type... |
#!/usr/bin/env python3
# coding:utf-8
def estimate_area_from_stock(stock) :
return 10000000000;
| def estimate_area_from_stock(stock):
return 10000000000 |
# CFG-RATE (0x06,0x08) packet (without header 0xB5,0x62)
# payload length - 6 (little endian format), update rate 200ms, cycles - 1, reference - UTC (0)
packet = []
packet = input('What is the payload? ')
CK_A,CK_B = 0, 0
for i in range(len(packet)):
CK_A = CK_A + packet[i]
CK_B = CK_B + CK_A
# ensure unsigned ... | packet = []
packet = input('What is the payload? ')
(ck_a, ck_b) = (0, 0)
for i in range(len(packet)):
ck_a = CK_A + packet[i]
ck_b = CK_B + CK_A
ck_a = CK_A & 255
ck_b = CK_B & 255
print('UBX packet checksum:', '0x%02X,0x%02X' % (CK_A, CK_B)) |
class Course:
def __init__(self, **kw):
self.name = kw.pop('name')
#def full_name(self):
# return self.first_name + " " + self.last_name | class Course:
def __init__(self, **kw):
self.name = kw.pop('name') |
'''Extracts the data from the json content. Outputs results in a dataframe'''
def get_play_df(content):
events = {}
event_num = 0
home = content['gameData']['teams']['home']['id']
away = content['gameData']['teams']['away']['id']
for i in range(len(content['liveData']['plays']['allPlays'])... | """Extracts the data from the json content. Outputs results in a dataframe"""
def get_play_df(content):
events = {}
event_num = 0
home = content['gameData']['teams']['home']['id']
away = content['gameData']['teams']['away']['id']
for i in range(len(content['liveData']['plays']['allPlays'])):
... |
"""
*
* Author: Juarez Paulino(coderemite)
* Email: juarez.paulino@gmail.com
*
"""
n=int(input())
a,b=map(int,input().split())
c,d=map(int,input().split())
e,f=map(int,input().split())
m=n-a-c-e
x=max(0,min(m,b-a));m-=x
y=max(0,min(m,d-c));m-=y
z=max(0,min(m,f-e));m-=z
print(a+x,c+y,e+z)
| """
*
* Author: Juarez Paulino(coderemite)
* Email: juarez.paulino@gmail.com
*
"""
n = int(input())
(a, b) = map(int, input().split())
(c, d) = map(int, input().split())
(e, f) = map(int, input().split())
m = n - a - c - e
x = max(0, min(m, b - a))
m -= x
y = max(0, min(m, d - c))
m -= y
z = max(0, min(m, f - e))... |
"""
models/__init__.py
-------------------------------------------------------------------
"""
def init_app(app):
"""
:param app:
:return:
"""
pass
| """
models/__init__.py
-------------------------------------------------------------------
"""
def init_app(app):
"""
:param app:
:return:
"""
pass |
"""
Discussion:
As we increase the input firing rate, more synapses move to the extreme values,
either go to zero or to maximal conductance. Using 15Hz, the distribution of the
weights at the end of the simulation is more like a bell-shaped, skewed, with more
synapses to be potentiated. However, increasing the fir... | """
Discussion:
As we increase the input firing rate, more synapses move to the extreme values,
either go to zero or to maximal conductance. Using 15Hz, the distribution of the
weights at the end of the simulation is more like a bell-shaped, skewed, with more
synapses to be potentiated. However, increasing the firi... |
#!/usr/bin/env python
#-*- coding:utf8 -*-
# @Author: lisnb
# @Date: 2016-04-27T11:05:16+08:00
# @Email: lisnb.h@hotmail.com
# @Last modified by: lisnb
# @Last modified time: 2016-06-18T22:20:18+08:00
class UnknownError(Exception):
pass
class ImproperlyConfigured(Exception):
"""Wiesler is somehow imprope... | class Unknownerror(Exception):
pass
class Improperlyconfigured(Exception):
"""Wiesler is somehow improperly configured"""
pass
class Importfailed(ImportError):
"""Import module failed"""
pass
class Importappconfigfailed(ImportFailed):
"""Can't import config of app when initialize an App insta... |
def raio_simplificado(lista_composta):
for elemento in lista_composta:
yield from elemento
lista_composta = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]
| def raio_simplificado(lista_composta):
for elemento in lista_composta:
yield from elemento
lista_composta = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] |
#trying something new
uridine_mods_paths = {'U_to_DDusA' : {'upstream_rxns' : ['U'],
'enzymes' : {20:['DusA_mono'],
'20A':['DusA_mono'],
17:['DusA_mono'],
... | uridine_mods_paths = {'U_to_DDusA': {'upstream_rxns': ['U'], 'enzymes': {20: ['DusA_mono'], '20A': ['DusA_mono'], 17: ['DusA_mono'], 16: ['DusA_mono']}}, 'U_to_DDusgen': {'upstream_rxns': ['U'], 'enzymes': {20: ['generic_Dus'], '20A': ['generic_Dus'], 17: ['generic_Dus'], 16: ['generic_Dus']}}, 'U_to_Um': {'upstream_rx... |
def run():
# Range can receive a first value that defines start value of range: range(1, 1000)
for i in range(1000):
print('Value ' + str(i))
if __name__ == '__main__':
run()
| def run():
for i in range(1000):
print('Value ' + str(i))
if __name__ == '__main__':
run() |
def biggerIsGreater(w):
w = list(w)
x = len(w)-1
while x > 0 and w[x-1] >= w[x]:
x -= 1
if x <= 0:
return 'no answer'
j = len(w) - 1
while w[j] <= w[x - 1]:
j -= 1
w[x-1], w[j] = w[j], w[x-1]
w[x:] = w[len(w)-1:x-1:-1]
return ''.join(w) | def bigger_is_greater(w):
w = list(w)
x = len(w) - 1
while x > 0 and w[x - 1] >= w[x]:
x -= 1
if x <= 0:
return 'no answer'
j = len(w) - 1
while w[j] <= w[x - 1]:
j -= 1
(w[x - 1], w[j]) = (w[j], w[x - 1])
w[x:] = w[len(w) - 1:x - 1:-1]
return ''.join(w) |
# Add support for multiple event queues
def upgrader(cpt):
cpt.set('Globals', 'numMainEventQueues', '1')
legacy_version = 12
| def upgrader(cpt):
cpt.set('Globals', 'numMainEventQueues', '1')
legacy_version = 12 |
class Solution(object):
def moveZeroes(self, nums):
totalZeros = 0
for i in range(len(nums)):
if nums[i] == 0 :
totalZeros += 1
continue
nums[i - totalZeros] = nums[i]
if(totalZeros) : nums[i] = 0
| class Solution(object):
def move_zeroes(self, nums):
total_zeros = 0
for i in range(len(nums)):
if nums[i] == 0:
total_zeros += 1
continue
nums[i - totalZeros] = nums[i]
if totalZeros:
nums[i] = 0 |
# This file is created by generate_build_files.py. Do not edit manually.
ssl_headers = [
"src/include/openssl/dtls1.h",
"src/include/openssl/srtp.h",
"src/include/openssl/ssl.h",
"src/include/openssl/ssl3.h",
"src/include/openssl/tls1.h",
]
fips_fragments = [
"src/crypto/fipsmodule/aes/aes.c",... | ssl_headers = ['src/include/openssl/dtls1.h', 'src/include/openssl/srtp.h', 'src/include/openssl/ssl.h', 'src/include/openssl/ssl3.h', 'src/include/openssl/tls1.h']
fips_fragments = ['src/crypto/fipsmodule/aes/aes.c', 'src/crypto/fipsmodule/aes/aes_nohw.c', 'src/crypto/fipsmodule/aes/key_wrap.c', 'src/crypto/fipsmodule... |
def possible_combination(string):
n = len(string)
count = [0] * (n + 1);
count[0] = 1;
count[1] = 1;
for i in range(2, n + 1):
count[i] = 0;
if (string[i - 1] > '0'):
count[i] = count[i - 1];
if (string[i - 2] == '1' or (string[i - 2] == '2' and ... | def possible_combination(string):
n = len(string)
count = [0] * (n + 1)
count[0] = 1
count[1] = 1
for i in range(2, n + 1):
count[i] = 0
if string[i - 1] > '0':
count[i] = count[i - 1]
if string[i - 2] == '1' or (string[i - 2] == '2' and string[i - 1] < '7'):
... |
'''
Description:
Given a binary tree, flatten it to a linked list in-place.
For example, given the following tree:
1
/ \
2 5
/ \ \
3 4 6
The flattened tree should look like:
1
\
2
\
3
\
4
\
5
\
6
'''
# Definition for a binary tree node.
cla... | """
Description:
Given a binary tree, flatten it to a linked list in-place.
For example, given the following tree:
1
/ 2 5
/ \\ 3 4 6
The flattened tree should look like:
1
2
3
4
5
6
"""
class Treenode:
def __init__(self, x):
s... |
"""Constants for the Template Platform Components."""
CONF_AVAILABILITY_TEMPLATE = "availability_template"
DOMAIN = "template"
PLATFORM_STORAGE_KEY = "template_platforms"
PLATFORMS = [
"alarm_control_panel",
"binary_sensor",
"cover",
"fan",
"light",
"lock",
"sensor",
"switch",
"v... | """Constants for the Template Platform Components."""
conf_availability_template = 'availability_template'
domain = 'template'
platform_storage_key = 'template_platforms'
platforms = ['alarm_control_panel', 'binary_sensor', 'cover', 'fan', 'light', 'lock', 'sensor', 'switch', 'vacuum', 'weather'] |
###############################################################################
# Copyright (c) 2019, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory
# Written by the Merlin dev team, listed in the CONTRIBUTORS file.
# <merlin@llnl.gov>
#
# LLNL-CODE-797170
# All righ... | description = {'description': {}}
batch = {'batch': {'type': 'local', 'dry_run': False, 'shell': '/bin/bash'}}
env = {'env': {'variables': {}}}
study_step_run = {'task_queue': 'merlin', 'shell': '/bin/bash', 'max_retries': 30}
parameter = {'global.parameters': {}}
merlin = {'merlin': {'resources': {'task_server': 'cele... |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 20 20:20:20 2020
@authors: Amal Htait and Leif Azzopardi
For license information, see LICENSE.TXT
"""
class SentimentIntensityAggregator:
"""
Apply an aggregation to a list of similarity scores.
"""
def __init__(self):
pass
def agg_score(sel... | """
Created on Tue Oct 20 20:20:20 2020
@authors: Amal Htait and Leif Azzopardi
For license information, see LICENSE.TXT
"""
class Sentimentintensityaggregator:
"""
Apply an aggregation to a list of similarity scores.
"""
def __init__(self):
pass
def agg_score(self, pos_dists, neg_dists):... |
# Metadata Create Tests
def test0_metadata_create():
return
# Metadata Getters Tests
def test0_metadata_name():
return
def test0_metadata_ename():
return
def test0_metadata_season():
return
def test0_metadata_episode():
return
def test0_metadata_quality():
return
def test0_metadata_ex... | def test0_metadata_create():
return
def test0_metadata_name():
return
def test0_metadata_ename():
return
def test0_metadata_season():
return
def test0_metadata_episode():
return
def test0_metadata_quality():
return
def test0_metadata_extension():
return
def test0_metadata_year():
... |
# coding: utf-8
# Author: zhao-zh10
# The function localize takes the following arguments:
#
# colors:
# 2D list, each entry either 'R' (for red cell) or 'G' (for green cell). The environment is cyclic.
#
# measurements:
# list of measurements taken by the robot, each entry either 'R' or 'G'
#
# motions:... | def localize(colors, measurements, motions, sensor_right, p_move):
pinit = 1.0 / float(len(colors)) / float(len(colors[0]))
p = [[pinit for col in range(len(colors[0]))] for row in range(len(colors))]
assert len(motions) == len(measurements)
for i in range(len(motions)):
p = move(p, motions[i], ... |
def foo():
print("In utility.py ==> foo()")
if __name__=='__main__':
foo()
| def foo():
print('In utility.py ==> foo()')
if __name__ == '__main__':
foo() |
count=0
def permute(s,l,pos,n):
if pos>=n:
global count
count+=1
print(l)
for k in l:
print(s[k],end="")
print()
return
for i in range(n):
if i not in l[:pos]:
l[pos] = i
permute(s,l,pos+1,n)
s="shivank"
n=len(s)
l=[]... | count = 0
def permute(s, l, pos, n):
if pos >= n:
global count
count += 1
print(l)
for k in l:
print(s[k], end='')
print()
return
for i in range(n):
if i not in l[:pos]:
l[pos] = i
permute(s, l, pos + 1, n)
s = 'shivank... |
# https://leetcode.com/problems/divide-two-integers/
#
class Solution:
def divide(self, dividend: int, divisor: int) -> int:
if dividend == divisor:
return 1
isPositive = (dividend > 0 and divisor > 0) or (dividend < 0 and divisor < 0)
dividend = dividend if d... | class Solution:
def divide(self, dividend: int, divisor: int) -> int:
if dividend == divisor:
return 1
is_positive = dividend > 0 and divisor > 0 or (dividend < 0 and divisor < 0)
dividend = dividend if dividend > 0 else -dividend
divisor = divisor if divisor > 0 else -d... |
class DataClassFile():
def functionName1(self, parameter1):
""" One Function (takes a parameter) with one test function
(with single line comments) where outdated documentation
exists.
************************************************************
####UnitTest Specific... | class Dataclassfile:
def function_name1(self, parameter1):
""" One Function (takes a parameter) with one test function
(with single line comments) where outdated documentation
exists.
************************************************************
####UnitTest Specific... |
#!/usr/bin/env python3
def linearSearch(lst,item):
isFound = False
for x in range(0,len(lst)):
if item == lst[x]:
isFound = True
return "Item found at index " + str(x)
elif (x == len(lst)-1) and (isFound == False):
return "Item not found"
if __name__ == '__main_... | def linear_search(lst, item):
is_found = False
for x in range(0, len(lst)):
if item == lst[x]:
is_found = True
return 'Item found at index ' + str(x)
elif x == len(lst) - 1 and isFound == False:
return 'Item not found'
if __name__ == '__main__':
num_lst = ... |
line = input()
if line == 's3cr3t!P@ssw0rd':
print("Welcome")
else:
print("Wrong password!")
| line = input()
if line == 's3cr3t!P@ssw0rd':
print('Welcome')
else:
print('Wrong password!') |
#%%
def generate_range(min: int, max: int, step: int) -> None:
for i in range(min, max + 1, step):
print(i)
generate_range(2, 10, 2)
# %%
# %%
def generate_range(min: int, max: int, step: int) -> None:
i = min
while i <= max:
print(i)
i = i + step
generate_range(2, 10, 2)
| def generate_range(min: int, max: int, step: int) -> None:
for i in range(min, max + 1, step):
print(i)
generate_range(2, 10, 2)
def generate_range(min: int, max: int, step: int) -> None:
i = min
while i <= max:
print(i)
i = i + step
generate_range(2, 10, 2) |
begin_unit
comment|'# Copyright 2015 Red Hat Inc'
nl|'\n'
comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl|'\n'
comment|'# not use this file except in compliance with the License. You may obtain'
nl|'\n'
comment|'# a copy of the License at'
nl|'\n'
comment|'#'
nl|'\n'
comm... | begin_unit
comment | '# Copyright 2015 Red Hat Inc'
nl | '\n'
comment | '# Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl | '\n'
comment | '# not use this file except in compliance with the License. You may obtain'
nl | '\n'
comment | '# a copy of the License at'
nl | '\n'
comment ... |
while True:
entrada = input()
if entrada == '0':
break
entrada = input()
joao = entrada.count('1')
maria = entrada.count('0')
print(f'Mary won {maria} times and John won {joao} times')
| while True:
entrada = input()
if entrada == '0':
break
entrada = input()
joao = entrada.count('1')
maria = entrada.count('0')
print(f'Mary won {maria} times and John won {joao} times') |
# Age avergage with floating points
# Var declarations
# Code
age1 = 10.0
age2 = 11.0
age3 = 13.0
age4 = 9.0
age5 = 12.0
result = (age1+age2+age3+age4+age5)/5.0
# Result
print(result)
| age1 = 10.0
age2 = 11.0
age3 = 13.0
age4 = 9.0
age5 = 12.0
result = (age1 + age2 + age3 + age4 + age5) / 5.0
print(result) |
class Word:
def __init__(self, cells):
if not cells:
raise ValueError("word cannot contain 0 cells")
self.cell = cells[0]
self.rest = Word(cells[1:]) if cells[1:] else None
def _clear(self):
self.cell |= 0
if self.rest:
self.rest.clear()
def ... | class Word:
def __init__(self, cells):
if not cells:
raise value_error('word cannot contain 0 cells')
self.cell = cells[0]
self.rest = word(cells[1:]) if cells[1:] else None
def _clear(self):
self.cell |= 0
if self.rest:
self.rest.clear()
de... |
'''6. Write a Python program to add 'ing' at the end of a given string (length should be at least 3). If the given string already
ends with 'ing' then add 'ly' instead. If the string length of the given string is less than 3, leave it unchanged.
Sample String : 'abc'
Expected Result : 'abcing'
Sample Strin... | """6. Write a Python program to add 'ing' at the end of a given string (length should be at least 3). If the given string already
ends with 'ing' then add 'ly' instead. If the string length of the given string is less than 3, leave it unchanged.
Sample String : 'abc'
Expected Result : 'abcing'
Sample Strin... |
# basic tuple functionality
x = (1, 2, 3 * 4)
print(x)
try:
x[0] = 4
except TypeError:
print("TypeError")
print(x)
try:
x.append(5)
except AttributeError:
print("AttributeError")
print(x[1:])
print(x[:-1])
print(x[2:3])
print(x + (10, 100, 10000))
| x = (1, 2, 3 * 4)
print(x)
try:
x[0] = 4
except TypeError:
print('TypeError')
print(x)
try:
x.append(5)
except AttributeError:
print('AttributeError')
print(x[1:])
print(x[:-1])
print(x[2:3])
print(x + (10, 100, 10000)) |
# from util.stack import Stack
"""
Given a array of number find the next greater no in the right of each element
Example- Input 12 15 22 09 07 02 18 23 27
Output 15 22 23 18 18 18 23 27 -1
"""
'''prints element and NGE pair for all elements of arr[] '''
def find_next_greater_ele_in_array(array)... | """
Given a array of number find the next greater no in the right of each element
Example- Input 12 15 22 09 07 02 18 23 27
Output 15 22 23 18 18 18 23 27 -1
"""
'prints element and NGE pair for all elements of arr[] '
def find_next_greater_ele_in_array(array):
"""
complexity O(n2)
:p... |
N = int(input())
list = []
for _ in range(N):
command = input().rstrip().split()
if "insert" in command:
i = int(command[1])
e = int(command[2])
list.insert(i, e)
elif "print" in command:
print(list)
elif "remove" in command:
i = int(command[1])
list.remo... | n = int(input())
list = []
for _ in range(N):
command = input().rstrip().split()
if 'insert' in command:
i = int(command[1])
e = int(command[2])
list.insert(i, e)
elif 'print' in command:
print(list)
elif 'remove' in command:
i = int(command[1])
list.remov... |
# Store all kinds of lookup table.
# # generate rsPoly lookup table.
# from qrcode import base
# def create_bytes(rs_blocks):
# for r in range(len(rs_blocks)):
# dcCount = rs_blocks[r].data_count
# ecCount = rs_blocks[r].total_count - dcCount
# rsPoly = base.Polynomial([1], 0)
# ... | rs_poly_lut = {7: [1, 127, 122, 154, 164, 11, 68, 117], 10: [1, 216, 194, 159, 111, 199, 94, 95, 113, 157, 193], 13: [1, 137, 73, 227, 17, 177, 17, 52, 13, 46, 43, 83, 132, 120], 15: [1, 29, 196, 111, 163, 112, 74, 10, 105, 105, 139, 132, 151, 32, 134, 26], 16: [1, 59, 13, 104, 189, 68, 209, 30, 8, 163, 65, 41, 229, 98... |
#!/bin/python3
# coding: utf-8
print ('input name: ')
name = input()
print ('input passwd: ')
passwd = input()
if name == 'A':
print('A')
if passwd == 'BB':
print('BB')
else:
print('Other!')
| print('input name: ')
name = input()
print('input passwd: ')
passwd = input()
if name == 'A':
print('A')
if passwd == 'BB':
print('BB')
else:
print('Other!') |
# Created by MechAviv
# Map ID :: 940001050
# Hidden Street : East Pantheon
sm.curNodeEventEnd(True)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(True, True, False, False)
OBJECT_1 = sm.sendNpcController(3000107, -2000, 20)
sm.showNpcSpecialActionByObjectId(OBJECT_1, "summon", 0)
sm.setSpeakerID(3000107)
sm.re... | sm.curNodeEventEnd(True)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(True, True, False, False)
object_1 = sm.sendNpcController(3000107, -2000, 20)
sm.showNpcSpecialActionByObjectId(OBJECT_1, 'summon', 0)
sm.setSpeakerID(3000107)
sm.removeEscapeButton()
sm.flipDialoguePlayerAsSpeaker()
sm.setSpeakerType(3)
sm.s... |
subreddit = "quackers987" #CHANGE THIS
#Multiple subreddits can be specified by joining them with pluses, for example AskReddit+NoStupidQuestions.
fileLog = "imageRemoveLog.txt"
neededModPermissions = ['posts', 'flair']
removeSubmission = False
logFullInfo = False
checkResolution = True
minHeight = 800
minWidth = 800... | subreddit = 'quackers987'
file_log = 'imageRemoveLog.txt'
needed_mod_permissions = ['posts', 'flair']
remove_submission = False
log_full_info = False
check_resolution = True
min_height = 800
min_width = 800
low_res_reply = f'Your submission has been removed as it was deemed to be low resolution (less than {minWidth} x ... |
# In Islandora 8 maps to Repository Item Content Type -> field_resource_type field
# The field_resource_type field is a pointer to the Resource Types taxonomy
#
class Genre:
def __init__(self):
self.drupal_fieldname = 'field_genre'
self.islandora_taxonomy = ['tags','genre']
self.mods_xpa... | class Genre:
def __init__(self):
self.drupal_fieldname = 'field_genre'
self.islandora_taxonomy = ['tags', 'genre']
self.mods_xpath = 'mods/genre'
self.dc_designator = 'type'
self.genre = ''
def set_genre(self, genre):
if isinstance(genre, str) and genre != '':
... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup -----------------------------------------------------------------------... | project = 'nRF Asset Tracker'
copyright = '2019-2021, Nordic Semiconductor ASA | nordicsemi.no'
author = 'Nordic Semiconductor ASA | nordicsemi.no'
extensions = ['sphinx_rtd_theme']
templates_path = ['_templates']
html_static_path = ['_static']
html_css_files = ['common.css']
exclude_patterns = ['_build', 'Thumbs.db', ... |
# Problem: Missing Number
# Difficulty: Easy
# Category: Array
# Leetcode 268:https://leetcode.com/problems/missing-number/#/description
# Description:
"""
Given an sorted array containing n distinct numbers taken from 0, 1, 2, ..., n,
find the one that is missing from the array.
For example,
Given nums = [0, 1, 3] re... | """
Given an sorted array containing n distinct numbers taken from 0, 1, 2, ..., n,
find the one that is missing from the array.
For example,
Given nums = [0, 1, 3] return 2.
Note:
Your algorithm should run in linear runtime complexity.
Could you implement it using only constant extra space complexity?
"""
class Sol... |
while True:
num = int(input("Enter an even number: "))
if num % 2 == 0:
break
print("Thanks for following directions.")
| while True:
num = int(input('Enter an even number: '))
if num % 2 == 0:
break
print('Thanks for following directions.') |
#Tuple is a collection of ordered items. A tuple is immutable in nature.
#Refer https://docs.python.org/3/library/stdtypes.html?#tuples for more information
person= ("Susan","Christopher","Bill","Susan")
print(person)
print(person[1])
x= person.count("Susan")
print("Occurrence of 'Susan' in tuple is:" + str(x))
l=['a... | person = ('Susan', 'Christopher', 'Bill', 'Susan')
print(person)
print(person[1])
x = person.count('Susan')
print("Occurrence of 'Susan' in tuple is:" + str(x))
l = ['apple', 'oranges']
print(tuple(l)) |
def get_sdm_query(query,lambda_t=0.8,lambda_o=0.1,lambda_u=0.1):
words = query.split()
if len(words)==1:
return f"#combine( {query} )"
terms = " ".join(words)
ordered = "".join([" #1({}) ".format(" ".join(bigram)) for bigram in zip(words,words[1:])])
unordered = "".jo... | def get_sdm_query(query, lambda_t=0.8, lambda_o=0.1, lambda_u=0.1):
words = query.split()
if len(words) == 1:
return f'#combine( {query} )'
terms = ' '.join(words)
ordered = ''.join([' #1({}) '.format(' '.join(bigram)) for bigram in zip(words, words[1:])])
unordered = ''.join([' #uw8({}) '.f... |
"""Define common constants"""
JOB_COMMAND_START = "start"
JOB_COMMAND_CANCEL = "cancel"
JOB_COMMAND_RESTART = "restart"
JOB_COMMAND_PAUSE = "pause"
JOB_COMMAND_PAUSE_PAUSE = "pause"
JOB_COMMAND_PAUSE_RESUME = "resume"
JOB_COMMAND_PAUSE_TOGGLE = "toggle"
JOB_STATE_OPERATIONAL="Operational"
JOB_STATE_PRINTING="Printing... | """Define common constants"""
job_command_start = 'start'
job_command_cancel = 'cancel'
job_command_restart = 'restart'
job_command_pause = 'pause'
job_command_pause_pause = 'pause'
job_command_pause_resume = 'resume'
job_command_pause_toggle = 'toggle'
job_state_operational = 'Operational'
job_state_printing = 'Printi... |
def encode_structure_fold(fold, tree):
def encode_node(node):
if node.is_leaf():
return fold.add('boxEncoder', node.box)
elif node.is_adj():
left = encode_node(node.left)
right = encode_node(node.right)
return fold.add('adjEncoder', left, right)
... | def encode_structure_fold(fold, tree):
def encode_node(node):
if node.is_leaf():
return fold.add('boxEncoder', node.box)
elif node.is_adj():
left = encode_node(node.left)
right = encode_node(node.right)
return fold.add('adjEncoder', left, right)
... |
# -*- coding: utf-8 -*-
class TrieNode:
def __init__(self):
self.children = {}
self.leaf = False
class Trie:
def __init__(self):
self.root = TrieNode()
def insert(self, word):
current = self.root
for char in word:
if char not in current.children:
... | class Trienode:
def __init__(self):
self.children = {}
self.leaf = False
class Trie:
def __init__(self):
self.root = trie_node()
def insert(self, word):
current = self.root
for char in word:
if char not in current.children:
current.chil... |
class PID:
"""PID controller."""
def __init__(self, Kp, Ti, Td, Imax):
self.Kp = Kp
self.Ti = Ti
self.Td = Td
self.Imax = Imax
self.clear()
def clear(self):
self.Cp = 0.0
self.Ci = 0.0
self.Cd = 0.0
self.previous_error = 0.0
def ... | class Pid:
"""PID controller."""
def __init__(self, Kp, Ti, Td, Imax):
self.Kp = Kp
self.Ti = Ti
self.Td = Td
self.Imax = Imax
self.clear()
def clear(self):
self.Cp = 0.0
self.Ci = 0.0
self.Cd = 0.0
self.previous_error = 0.0
def ... |
class DecimalPointFloatConverter:
"""
Custom Django converter for URLs.
Parses floats with a decimal point (not with a comma!)
Allows for integers too, parses values in this or similar form:
- 100.0
- 100
Will NOT work for these forms:
- 100.000.000
- 100,0
"""
regex = "[0... | class Decimalpointfloatconverter:
"""
Custom Django converter for URLs.
Parses floats with a decimal point (not with a comma!)
Allows for integers too, parses values in this or similar form:
- 100.0
- 100
Will NOT work for these forms:
- 100.000.000
- 100,0
"""
regex = '[0-... |
# dataset settings
dataset_type = 'CUB'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='Resize', size=510),
dict(type='RandomCrop', size=384),
dict(type='RandomFlip', flip_prob=0.5, direction... | dataset_type = 'CUB'
img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [dict(type='LoadImageFromFile'), dict(type='Resize', size=510), dict(type='RandomCrop', size=384), dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'), dict(type='Normalize', **... |
# -*- coding: utf-8 -*-
class Config:
class MongoDB:
database = "crawlib2_test"
| class Config:
class Mongodb:
database = 'crawlib2_test' |
months = "JanFebMarAprMayJunJulAugSepOctNovDec"
n = int(input("Enter month Number: "))
if (n > 0 and n < 13):
mE = (3 * n)
mA = mE - 3
print(months[mA:mE])
else:
print("falsche Zahl")
| months = 'JanFebMarAprMayJunJulAugSepOctNovDec'
n = int(input('Enter month Number: '))
if n > 0 and n < 13:
m_e = 3 * n
m_a = mE - 3
print(months[mA:mE])
else:
print('falsche Zahl') |
"""
>>> getg()
5
>>> setg(42)
>>> getg()
42
"""
g = 5
def setg(a):
global g
g = a
def getg():
return g
class Test(object):
"""
>>> global_in_class
9
>>> Test.global_in_class
Traceback (most recent call last):
AttributeError: type object 'Test' has no attrib... | """
>>> getg()
5
>>> setg(42)
>>> getg()
42
"""
g = 5
def setg(a):
global g
g = a
def getg():
return g
class Test(object):
"""
>>> global_in_class
9
>>> Test.global_in_class
Traceback (most recent call last):
AttributeError: type object 'Test' has no attribute ... |
#!python
with open('pessoas.csv') as arquivo:
with open('pessoas.txt', 'w') as saida:
for registro in arquivo:
pessoa = registro.strip().split(',')
print('Nome:{}, Idade:{}'.format(*pessoa), file=saida)
if saida.closed:
print('Saida OK')
if arquivo.closed:
print('saida ok'... | with open('pessoas.csv') as arquivo:
with open('pessoas.txt', 'w') as saida:
for registro in arquivo:
pessoa = registro.strip().split(',')
print('Nome:{}, Idade:{}'.format(*pessoa), file=saida)
if saida.closed:
print('Saida OK')
if arquivo.closed:
print('saida ok') |
class ConfigError(Exception):
def __init__(self, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
class MercuryUnsupportedService(Exception):
def __init__(self, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
class MercuryConnectException(Exception):
def __init__(s... | class Configerror(Exception):
def __init__(self, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
class Mercuryunsupportedservice(Exception):
def __init__(self, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
class Mercuryconnectexception(Exception):
def __init__(... |
#######################################
graph={}
graph["start"]["a"]=6
graph["start"]["b"]=2
graph["a"]={}
graph["a"]["fin"]=1
graph["b"]={}
graph["b"]["a"]=3
graph["b"]["fin"]=5
graph["fin"]={}
#######################################
infinity = float("inf")
costs={}
costs["a"]=6
costs["b"]=2
costs["fin"]=infinity... | graph = {}
graph['start']['a'] = 6
graph['start']['b'] = 2
graph['a'] = {}
graph['a']['fin'] = 1
graph['b'] = {}
graph['b']['a'] = 3
graph['b']['fin'] = 5
graph['fin'] = {}
infinity = float('inf')
costs = {}
costs['a'] = 6
costs['b'] = 2
costs['fin'] = infinity
parents = {}
parents['a'] = 'start'
parents['b'] = 'start'... |
## using the return statement in python
## execute fct and give the respond back
def cube(num): ## expectin one num
return num*num*num ## allows to return value to the caller
print(cube(3)) ## return none
result = cube(4)
print(result)
| def cube(num):
return num * num * num
print(cube(3))
result = cube(4)
print(result) |
def flatten(x):
"""Flatten a two-dimensional list into one-dimension.
Todo:
* Support flattening n-dimension list into one-dimension.
Args:
x (list of list of any): A two-dimension list.
Returns:
list of any: An one-dimension list.
"""
return [a for i in x for a in i... | def flatten(x):
"""Flatten a two-dimensional list into one-dimension.
Todo:
* Support flattening n-dimension list into one-dimension.
Args:
x (list of list of any): A two-dimension list.
Returns:
list of any: An one-dimension list.
"""
return [a for i in x for a in i]... |
# Used when we want to process an array of requests through a chain of handlers. Respective handler processes the request depending on the value, and send the request to the successor handler if not handled at that handler.
class Handler:
def __init__(self, successor):
self.successor = successor
def ... | class Handler:
def __init__(self, successor):
self.successor = successor
def handle(self, request):
handled = self._handle(request)
if not handled:
print('-- Refering to successor,', request)
self.successor.handle(request)
def _handle(self, request):
... |
def brac_balance(expr):
stack = []
for char in expr:
if char in ["(", "{", "["]:
stack.append(char)
else:
if not stack:
return False
current_char = stack.pop()
if current_char == '(':
if char != ")":
return False
if current_char == '{':
if char != "}":
return False
if curre... | def brac_balance(expr):
stack = []
for char in expr:
if char in ['(', '{', '[']:
stack.append(char)
else:
if not stack:
return False
current_char = stack.pop()
if current_char == '(':
if char != ')':
... |
# Stack implementation
'''
Stack using python list. Use append to push an item
onto the stack and pop to remove an item
'''
my_stack = list()
my_stack.append(4)
my_stack.append(7)
my_stack.append(12)
my_stack.append(19)
print(my_stack)
print(my_stack.pop()) # 19
print(my_stack.pop()) # 12
print(my_stack) # [4,7]
| """
Stack using python list. Use append to push an item
onto the stack and pop to remove an item
"""
my_stack = list()
my_stack.append(4)
my_stack.append(7)
my_stack.append(12)
my_stack.append(19)
print(my_stack)
print(my_stack.pop())
print(my_stack.pop())
print(my_stack) |
class LED_80_64:
keySize = 64
T0 = [0x00BB00DD00AA0055, 0x00BA00D100AE0057, 0x00BC00DF00A5005B, 0x00B500D900A7005A, 0x00B100DC00A40052,
0x00B000D000A00050, 0x00B700D200AF005E, 0x00B900D600A20051, 0x00B600DE00AB005C, 0x00BF00D800A9005D,
0x00BD00D300A10059, 0x00B300D700AC0056, 0x00B800DA00... | class Led_80_64:
key_size = 64
t0 = [52636769843806293, 52355243327750231, 52918253410123867, 50947902803476570, 49822015781339218, 49540489264758864, 51510822692651102, 52073789825089617, 51229399255285852, 53762648275746909, 53199676846964825, 50384944260448342, 51792332028510291, 53481156119429215, 501034864... |
#!python
class BinaryMinHeap(object):
"""BinaryMinHeap: a partially ordered collection with efficient methods to
insert new items in partial order and to access and remove its minimum item.
Items are stored in a dynamic array that implicitly represents a complete
binary tree with root node at index 0 ... | class Binaryminheap(object):
"""BinaryMinHeap: a partially ordered collection with efficient methods to
insert new items in partial order and to access and remove its minimum item.
Items are stored in a dynamic array that implicitly represents a complete
binary tree with root node at index 0 and last le... |
def moveZeroes(nums):
"""
Move all zeros to the end of the given array (nums) with keeping the order of other elements.
Do not return anything, modify nums in-place instead.
"""
# counter = 0
# for i in range(len(nums) - 1):
# if nums[counter] == 0:
# nums.pop(counter)
#... | def move_zeroes(nums):
"""
Move all zeros to the end of the given array (nums) with keeping the order of other elements.
Do not return anything, modify nums in-place instead.
"""
'O(n) solution'
last_zero = 0
for i in range(len(nums)):
if nums[i] != 0:
(nums[i], nums[las... |
# https://leetcode.com/problems/jump-game/
class Solution:
def canJump(self, nums: list[int]) -> bool:
last = 0
for index in range(len(nums)):
if index > last:
return False
last = max(last, index + nums[index])
if last >= len(nums) - 1:
... | class Solution:
def can_jump(self, nums: list[int]) -> bool:
last = 0
for index in range(len(nums)):
if index > last:
return False
last = max(last, index + nums[index])
if last >= len(nums) - 1:
return True
return True
nums... |
def calculate(mass):
if mass < 6:
return 0
return int(mass/3-2) + calculate(int(mass/3-2))
with open("1.txt", "r") as infile:
print("First part solution: ", sum([int(int(x)/3)-2 for x in infile.readlines()]))
print("Second part solution: ", sum([calculate(int(x)) for x in infile.readlines()]))
| def calculate(mass):
if mass < 6:
return 0
return int(mass / 3 - 2) + calculate(int(mass / 3 - 2))
with open('1.txt', 'r') as infile:
print('First part solution: ', sum([int(int(x) / 3) - 2 for x in infile.readlines()]))
print('Second part solution: ', sum([calculate(int(x)) for x in infile.read... |
# -*- coding: utf-8 -*-
"""
meraki
This file was automatically generated for meraki by APIMATIC v2.0 ( https://apimatic.io ).
"""
class Type2Enum(object):
"""Implementation of the 'Type2' enum.
Type of the L7 Rule. Must be 'application', 'applicationCategory', 'host',
'port' or 'ip... | """
meraki
This file was automatically generated for meraki by APIMATIC v2.0 ( https://apimatic.io ).
"""
class Type2Enum(object):
"""Implementation of the 'Type2' enum.
Type of the L7 Rule. Must be 'application', 'applicationCategory', 'host',
'port' or 'ipRange'
Attributes:
APPLICA... |
class Dimension:
def __init__(self, x1, y1, x2, y2):
self.x1 = x1
self.y1 = y1
self.x2 = x2
self.y2 = y2
@property
def width(self):
return self.x2 - self.x1
@property
def height(self):
return self.y2 - self.y1
@property
def aspect_ratio(self... | class Dimension:
def __init__(self, x1, y1, x2, y2):
self.x1 = x1
self.y1 = y1
self.x2 = x2
self.y2 = y2
@property
def width(self):
return self.x2 - self.x1
@property
def height(self):
return self.y2 - self.y1
@property
def aspect_ratio(sel... |
with open("../documentation/resource-doc.txt", "r") as DOC_FILE:
__doc__ = DOC_FILE.read()
def repositionItemInList(__index, __item, __list):
__list.remove(__item)
__list.insert(__index, __item)
return __list
def removeItems(__item_list, __list):
for item in __item_list:
try:
... | with open('../documentation/resource-doc.txt', 'r') as doc_file:
__doc__ = DOC_FILE.read()
def reposition_item_in_list(__index, __item, __list):
__list.remove(__item)
__list.insert(__index, __item)
return __list
def remove_items(__item_list, __list):
for item in __item_list:
try:
... |
# SPDX-License-Identifier: Apache-2.0
"""
Constants used with this package.
For more details about this api, please refer to the documentation at
https://github.com/G-Two/subarulink
"""
COUNTRY_USA = "USA"
COUNTRY_CAN = "CAN"
MOBILE_API_SERVER = {
COUNTRY_USA: "mobileapi.prod.subarucs.com",
COUNTRY_CAN: "mo... | """
Constants used with this package.
For more details about this api, please refer to the documentation at
https://github.com/G-Two/subarulink
"""
country_usa = 'USA'
country_can = 'CAN'
mobile_api_server = {COUNTRY_USA: 'mobileapi.prod.subarucs.com', COUNTRY_CAN: 'mobileapi.ca.prod.subarucs.com'}
mobile_api_version ... |
# An example with subplots, so an array of axes is returned.
axes = df.plot.line(subplots=True)
type(axes)
# <class 'numpy.ndarray'>
| axes = df.plot.line(subplots=True)
type(axes) |
class problem(object):
"""docstring for problem"""
def __init__(self, arg):
super(problem, self).__init__()
self.arg = arg
| class Problem(object):
"""docstring for problem"""
def __init__(self, arg):
super(problem, self).__init__()
self.arg = arg |
class Statistics():
def __init__(self):
self.time_cfg_constr = 0 #ok
self.time_verify = 0 #ok
self.time_smt = 0 #ok
self.time_smt_pure = 0
self.time_interp = 0 #ok
self.time_interp_pure = 0 #ok
self.time_to_lia = 0 #ok
self.time_from_lia = 0 #ok
... | class Statistics:
def __init__(self):
self.time_cfg_constr = 0
self.time_verify = 0
self.time_smt = 0
self.time_smt_pure = 0
self.time_interp = 0
self.time_interp_pure = 0
self.time_to_lia = 0
self.time_from_lia = 0
self.time_process_lia = 0
... |
class Gen:
def __init__(self, type, sequence, data_object):
self.type = type
self.sequence = sequence
self.data_object = data_object
class GenType:
CDNA = 'cdna'
DNA = 'dna'
CDS = 'cds'
class DnaType:
dna = '.dna.'
dna_sm = '.dna_sm.'
dna_rm = '.dna_rm.'
| class Gen:
def __init__(self, type, sequence, data_object):
self.type = type
self.sequence = sequence
self.data_object = data_object
class Gentype:
cdna = 'cdna'
dna = 'dna'
cds = 'cds'
class Dnatype:
dna = '.dna.'
dna_sm = '.dna_sm.'
dna_rm = '.dna_rm.' |
def for_G():
"""printing capital 'G' using for loop"""
for row in range(6):
for col in range(5):
if col==0 and row not in(0,5) or row==0 and col in(1,2,3) or row==5 and col not in(0,4) or row==3 and col!=1 or col==4 and row in(1,4):
print("*",end=" ")
else:
... | def for_g():
"""printing capital 'G' using for loop"""
for row in range(6):
for col in range(5):
if col == 0 and row not in (0, 5) or (row == 0 and col in (1, 2, 3)) or (row == 5 and col not in (0, 4)) or (row == 3 and col != 1) or (col == 4 and row in (1, 4)):
print('*', end... |
_css_basic = """
.card {
font-family: arial;
font-size: 20px;
text-align: center;
color: black;
background-color: white;
}
"""
_css_cloze = """
.card {
font-family: arial;
font-size: 20px;
text-align: center;
color: black;
background-color: white;
}
.cloze {
font-weight: bold;
color: blue;
}
.nightMode .c... | _css_basic = '\n.card {\n font-family: arial;\n font-size: 20px;\n text-align: center;\n color: black;\n background-color: white;\n}\n'
_css_cloze = '\n.card {\n font-family: arial;\n font-size: 20px;\n text-align: center;\n color: black;\n background-color: white;\n}\n\n.cloze {\n font-weight: bold;\n color: blue;\n}\... |
# Insert line numbers
in_file = open('Resources/02. Line Numbers/Input.txt', 'r').read().split('\n')
result = [str(number + 1) + '. ' + item for number, item in enumerate(in_file)][:-1]
print(*result, sep = '\n')
out_str = '\n'.join(result)
open('output/02.txt', 'w').write(out_str)
| in_file = open('Resources/02. Line Numbers/Input.txt', 'r').read().split('\n')
result = [str(number + 1) + '. ' + item for (number, item) in enumerate(in_file)][:-1]
print(*result, sep='\n')
out_str = '\n'.join(result)
open('output/02.txt', 'w').write(out_str) |
fib = lambda n: n if n <= 2 else fib(n - 1) + fib(n - 2)
'''
print(fib(10)) #89
'''
| fib = lambda n: n if n <= 2 else fib(n - 1) + fib(n - 2)
'\nprint(fib(10)) #89 \n' |
# https://leetcode.com/problems/rotate-array/
class Solution:
def rotate(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: void Do not return anything, modify nums in-place instead.
"""
def reverse(s, e):
while s < e:
nums[s]... | class Solution:
def rotate(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: void Do not return anything, modify nums in-place instead.
"""
def reverse(s, e):
while s < e:
(nums[s], nums[e]) = (nums[e], nums[s])
... |
"""
PASSENGERS
"""
numPassengers = 3191
passenger_arriving = (
(5, 8, 7, 5, 1, 0, 3, 5, 8, 3, 0, 0), # 0
(2, 8, 13, 5, 0, 0, 12, 10, 6, 1, 0, 0), # 1
(1, 10, 5, 4, 2, 0, 13, 13, 5, 2, 3, 0), # 2
(5, 11, 16, 2, 3, 0, 8, 0, 6, 3, 4, 0), # 3
(5, 8, 6, 2, 1, 0, 7, 10, 6, 5, 1, 0), # 4
(1, 10, 8, 5, 1, 0, 3, 1... | """
PASSENGERS
"""
num_passengers = 3191
passenger_arriving = ((5, 8, 7, 5, 1, 0, 3, 5, 8, 3, 0, 0), (2, 8, 13, 5, 0, 0, 12, 10, 6, 1, 0, 0), (1, 10, 5, 4, 2, 0, 13, 13, 5, 2, 3, 0), (5, 11, 16, 2, 3, 0, 8, 0, 6, 3, 4, 0), (5, 8, 6, 2, 1, 0, 7, 10, 6, 5, 1, 0), (1, 10, 8, 5, 1, 0, 3, 10, 4, 2, 2, 0), (6, 8, 4, 5, 2, 0,... |
"""
Copyright 2020 Skyscanner Ltd
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software dis... | """
Copyright 2020 Skyscanner Ltd
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software dis... |
"""
Given two strings s and t, determine if they are isomorphic.
Two strings are isomorphic if the characters in s can be replaced to get t.
All occurrences of a character must be replaced with another character while preserving the order of characters. No two
characters may map to the same character but a character ... | """
Given two strings s and t, determine if they are isomorphic.
Two strings are isomorphic if the characters in s can be replaced to get t.
All occurrences of a character must be replaced with another character while preserving the order of characters. No two
characters may map to the same character but a character ... |
# Searvice Check Config
#### Global
DOMAIN = 'TEAM'
### HTTP
HTTP_PAGES = [
{ 'url':'', 'expected':'index.html', 'tolerance': 0.05 },
]
### HTTPS
HTTPS_PAGES = [
{ 'url':'', 'expected':'index.html', 'tolerance': 0.05 },
]
### DNS
DNS_QUERIES = [
{ 'type':'A', 'query':'team.local', 'expected':'216.239.32... | domain = 'TEAM'
http_pages = [{'url': '', 'expected': 'index.html', 'tolerance': 0.05}]
https_pages = [{'url': '', 'expected': 'index.html', 'tolerance': 0.05}]
dns_queries = [{'type': 'A', 'query': 'team.local', 'expected': '216.239.32.10'}]
ftp_files = [{'path': '/testfile.txt', 'checksum': '12345ABCDEF'}]
smb_files ... |
class FakeTwilioMessage(object):
status = 'sent'
def __init__(self, price, num_segments=1):
self.price = price
self.num_segments = str(num_segments)
def fetch(self):
return self
class FakeMessageFactory(object):
backend_message_id_to_num_segments = {}
backend_message_id_t... | class Faketwiliomessage(object):
status = 'sent'
def __init__(self, price, num_segments=1):
self.price = price
self.num_segments = str(num_segments)
def fetch(self):
return self
class Fakemessagefactory(object):
backend_message_id_to_num_segments = {}
backend_message_id_to... |
class ValueNotRequired(Exception):
pass
class RaggedListError(Exception):
pass
| class Valuenotrequired(Exception):
pass
class Raggedlisterror(Exception):
pass |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"AttStats": "att_stats.ipynb",
"Attribute": "attribute.ipynb",
"Data": "data.ipynb",
"DataScrambler": "data_scrambler.ipynb",
"configuration": "data_scrambler.ipynb",
... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'AttStats': 'att_stats.ipynb', 'Attribute': 'attribute.ipynb', 'Data': 'data.ipynb', 'DataScrambler': 'data_scrambler.ipynb', 'configuration': 'data_scrambler.ipynb', 'EntropyEvaluator': 'entropy_evaluator.ipynb', 'Instance': 'instance.ipynb', 'Pars... |
# -*- coding: utf-8 -*-
"""
__title__ = ''
__author__ = xiongliff
__mtime__ = '2019/7/20'
""" | """
__title__ = ''
__author__ = xiongliff
__mtime__ = '2019/7/20'
""" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.