content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def rook_cells_under_attack(p, width=8, height=8):
cells = []
for i in range(height):
cells.append((p[0], i))
for i in range(width):
cells.append((i, p[1]))
return cells
# TODO: add width and height parameters
def bishop_cells_under_attack(p, width=8, height=8):
cells = []
for ... | def rook_cells_under_attack(p, width=8, height=8):
cells = []
for i in range(height):
cells.append((p[0], i))
for i in range(width):
cells.append((i, p[1]))
return cells
def bishop_cells_under_attack(p, width=8, height=8):
cells = []
for k in range(max(width, height)):
i... |
nome = str(input("Digite seu nome completo: ")).strip()
nome = nome.lower()
#verifica = nome.find('silva') > 0
print("Seu nome tem Silva? ")
#print("{}".format(verifica))
print("{}".format("silva" in nome))
| nome = str(input('Digite seu nome completo: ')).strip()
nome = nome.lower()
print('Seu nome tem Silva? ')
print('{}'.format('silva' in nome)) |
# Solution
# O(n*l) time / O(c) space
# n - number of words
# l - length of the longest word
# c - number of unique characters across all words
def minimumCharactersForWords(words):
maximumCharacterFrequencies = {}
for word in words:
characterFrequencies = countCharacterFrequencies(word)
updateMax... | def minimum_characters_for_words(words):
maximum_character_frequencies = {}
for word in words:
character_frequencies = count_character_frequencies(word)
update_maximum_frequencies(characterFrequencies, maximumCharacterFrequencies)
return make_array_from_character_frequencies(maximumCharacter... |
a = map(int, input().split())
b = map(int, input().split())
c = map(int, input().split())
d = map(int, input().split())
e = map(int, input().split())
_a, _b, _c, _d, _e = sum(a), sum(b), sum(c), sum(d), sum(e)
m = max(_a, _b, _c, _d, _e)
if m == _a:
print(1, _a)
elif m == _b:
print(2, _b)
elif m == _c:
pr... | a = map(int, input().split())
b = map(int, input().split())
c = map(int, input().split())
d = map(int, input().split())
e = map(int, input().split())
(_a, _b, _c, _d, _e) = (sum(a), sum(b), sum(c), sum(d), sum(e))
m = max(_a, _b, _c, _d, _e)
if m == _a:
print(1, _a)
elif m == _b:
print(2, _b)
elif m == _c:
... |
L=[23,45,88,23,56,78,96]
Temp=L[0]
L[0]=L[-1]
L[-1]=Temp
print(L)
| l = [23, 45, 88, 23, 56, 78, 96]
temp = L[0]
L[0] = L[-1]
L[-1] = Temp
print(L) |
# Time: O(n)
# Space: O(1)
class Solution(object):
# @param {integer} s
# @param {integer[]} nums
# @return {integer}
def minSubArrayLen(self, s, nums):
start = 0
sum = 0
min_size = float("inf")
for i in xrange(len(nums)):
sum += nums[i]
... | class Solution(object):
def min_sub_array_len(self, s, nums):
start = 0
sum = 0
min_size = float('inf')
for i in xrange(len(nums)):
sum += nums[i]
while sum >= s:
min_size = min(min_size, i - start + 1)
sum -= nums[start]
... |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'test.db',
'TEST_NAME': 'test1.db',
}
}
ROOT_URLCONF='testapp.urls'
SITE_ID = 1
SECRET_KEY = "not very secret in tests"
ALLOWED_HOSTS = (
'testserver',
'*'
)
INSTALLED_APPS = (
"rest_framework",
... | databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'test.db', 'TEST_NAME': 'test1.db'}}
root_urlconf = 'testapp.urls'
site_id = 1
secret_key = 'not very secret in tests'
allowed_hosts = ('testserver', '*')
installed_apps = ('rest_framework', 'testapp')
middleware_classes = ('django.middleware.comm... |
#Write a Python program that reads your height in cms and converts your height to feet and inches.
heightCM = float(input('Enter the height in CM: '))
totalInch = heightCM * 0.393701
heightInch = (totalInch % 12)
heightFeet = (totalInch - heightInch)*0.0833333
print('The height is : ',heightFeet,' feet AND 163',... | height_cm = float(input('Enter the height in CM: '))
total_inch = heightCM * 0.393701
height_inch = totalInch % 12
height_feet = (totalInch - heightInch) * 0.0833333
print('The height is : ', heightFeet, ' feet AND 163', heightInch, ' inch') |
#!/usr/bin/env python3.7
rules = {}
with open('input.txt') as fd:
for line in fd:
words = line[:-1].split()
this_bag = words[0]+ " " + words[1]
rules[this_bag] = []
b = line[:-1].split('contain')
bags = b[1].split(',')
for bag in bags:
words = bag.split()... | rules = {}
with open('input.txt') as fd:
for line in fd:
words = line[:-1].split()
this_bag = words[0] + ' ' + words[1]
rules[this_bag] = []
b = line[:-1].split('contain')
bags = b[1].split(',')
for bag in bags:
words = bag.split()
count = 0
... |
ordered_params = ['vmax', 'km', 'k_synt_s', 'k_deg_s', 'k_deg_p']
n_vars = 2
def model(y, t, yout, p):
#---------------------------------------------------------#
#Parameters#
#---------------------------------------------------------#
vmax = p[0]
km = p[1]
k_synt_s = p[2]
k_deg_s = p[3]
... | ordered_params = ['vmax', 'km', 'k_synt_s', 'k_deg_s', 'k_deg_p']
n_vars = 2
def model(y, t, yout, p):
vmax = p[0]
km = p[1]
k_synt_s = p[2]
k_deg_s = p[3]
k_deg_p = p[4]
_s = y[0]
_p = y[1]
yout[0] = (-_s * vmax + (_s + km) * (-_s * k_deg_s + k_synt_s)) / (_s + km)
yout[1] = (-_p *... |
def max_num_in_list( list ):
max = list[ 0 ]
for a in list:
if a > max:
max = a
return max
ls=[]
n=int(input("Enter number of elements:"))
for i in range(1,n+1):
b=int(input("Enter element:"))
ls.append(b)
print("Max number in the list is:",max_num_in_list(ls))
| def max_num_in_list(list):
max = list[0]
for a in list:
if a > max:
max = a
return max
ls = []
n = int(input('Enter number of elements:'))
for i in range(1, n + 1):
b = int(input('Enter element:'))
ls.append(b)
print('Max number in the list is:', max_num_in_list(ls)) |
iter_num = 0
def fib(num):
global iter_num
iter_num += 1
print("Iteration number {0}. num = {1}".format(iter_num, num))
# Base class for fibonnaci series
if num==0 or num==1:
return 1
# Recursive call
else:
return fib(num-1)+fib(num-2)
if __name__ == '__main__':
num =... | iter_num = 0
def fib(num):
global iter_num
iter_num += 1
print('Iteration number {0}. num = {1}'.format(iter_num, num))
if num == 0 or num == 1:
return 1
else:
return fib(num - 1) + fib(num - 2)
if __name__ == '__main__':
num = int(input('Enter a number: '))
ans = fib(num)
... |
def getNext(instr):
count=0
curch=instr[0]
outstr=[]
for ch in instr:
if ch != curch:
outstr.append(str(count)+curch)
curch=ch
count=1
else:
count+=1
outstr.append(str(count)+curch)
return ''.join(outstr)
a=['1']
for i in range(31)... | def get_next(instr):
count = 0
curch = instr[0]
outstr = []
for ch in instr:
if ch != curch:
outstr.append(str(count) + curch)
curch = ch
count = 1
else:
count += 1
outstr.append(str(count) + curch)
return ''.join(outstr)
a = ['1']
... |
# coding=utf-8
__author__ = 'Gareth Coles'
class BaseAlgorithm(object):
def hash(self, value, salt):
pass
def check(self, hash, value, salt):
return hash == self.hash(value, salt)
def gen_salt(self):
pass
| __author__ = 'Gareth Coles'
class Basealgorithm(object):
def hash(self, value, salt):
pass
def check(self, hash, value, salt):
return hash == self.hash(value, salt)
def gen_salt(self):
pass |
description = ''
pages = ['header',
'my_account']
def setup(data):
pass
def test(data):
navigate('http://store.demoqa.com/')
click(header.my_account)
verify_is_not_selected(my_account.remember_me)
capture('Remember me is not selected')
def teardown(data):
pass
| description = ''
pages = ['header', 'my_account']
def setup(data):
pass
def test(data):
navigate('http://store.demoqa.com/')
click(header.my_account)
verify_is_not_selected(my_account.remember_me)
capture('Remember me is not selected')
def teardown(data):
pass |
# Vamos a convertir un numero entero en una lista de sus digitos
numero = int(input('Dime tu numero\n'))
digitos =[]
while numero !=0:
digitos.insert(0,numero%10)
numero //= 10
print('Los digitos de su numero son',digitos)
| numero = int(input('Dime tu numero\n'))
digitos = []
while numero != 0:
digitos.insert(0, numero % 10)
numero //= 10
print('Los digitos de su numero son', digitos) |
def main():
input = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1... | def main():
input = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1... |
n=int(input().strip())
b=input().strip()
step=0
for i in range(0,n-2):
if(b[i]+b[i+1]+b[i+2]=='010'):
step+=1
print(step)
| n = int(input().strip())
b = input().strip()
step = 0
for i in range(0, n - 2):
if b[i] + b[i + 1] + b[i + 2] == '010':
step += 1
print(step) |
SHOWNAMES = [
"ap1/product-id",
"ap1/adc0",
"ap1/adc1",
"ap1/adc2",
"ap1/din0",
"ap1/din1",
"ap1/din2",
"ap1/din3",
"ap1/led1",
"ap1/led2",
"ap1/device-id",
"ap1/vendor-id",
"ap1/dout0",
"ap1/dout1",
"ap1/dout2",
"ap1/dout3",
"ap1/reset",
"ap1/dout... | shownames = ['ap1/product-id', 'ap1/adc0', 'ap1/adc1', 'ap1/adc2', 'ap1/din0', 'ap1/din1', 'ap1/din2', 'ap1/din3', 'ap1/led1', 'ap1/led2', 'ap1/device-id', 'ap1/vendor-id', 'ap1/dout0', 'ap1/dout1', 'ap1/dout2', 'ap1/dout3', 'ap1/reset', 'ap1/dout-enable', 'ap1/hw-version', 'capability/adc', 'capability/din', 'capabili... |
def merge(left, right, sorted_lst):
i, j, k = 0, 0, 0
while i < len(left) and j < len(right):
if left[i] <= right[j]:
sorted_lst[k] = left[i]
i += 1
else:
sorted_lst[k] = right[j]
j += 1
k += 1
while i < len(left):
sorted_lst... | def merge(left, right, sorted_lst):
(i, j, k) = (0, 0, 0)
while i < len(left) and j < len(right):
if left[i] <= right[j]:
sorted_lst[k] = left[i]
i += 1
else:
sorted_lst[k] = right[j]
j += 1
k += 1
while i < len(left):
sorted_ls... |
# vestlus:admin:actions
def make_read(model, request, queryset):
queryset.update(read=True)
make_read.short_description = "Mark as read"
def make_unread(model, request, queryset):
queryset.update(read=False)
make_unread.short_description = "Mark as unread"
def make_private(model, request, queryset):
... | def make_read(model, request, queryset):
queryset.update(read=True)
make_read.short_description = 'Mark as read'
def make_unread(model, request, queryset):
queryset.update(read=False)
make_unread.short_description = 'Mark as unread'
def make_private(model, request, queryset):
queryset.update(is_private=Tr... |
class FeedMiddleware(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
if self.is_atom_feed(environ['PATH_INFO']):
def _start_response(status, headers, exc_info=None):
return start_response(status, self.set_charset(headers... | class Feedmiddleware(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
if self.is_atom_feed(environ['PATH_INFO']):
def _start_response(status, headers, exc_info=None):
return start_response(status, self.set_charset(header... |
var = 0
print("Hello!")
while var < 10:
print(10 - var, end="\n")
var += 2 | var = 0
print('Hello!')
while var < 10:
print(10 - var, end='\n')
var += 2 |
def main():
# input
ABCs = [*map(int, input().split())]
# compute
# output
print(2 * sum([ABCs[i-1]*ABCs[i] for i in range(3)]))
if __name__ == '__main__':
main()
| def main():
ab_cs = [*map(int, input().split())]
print(2 * sum([ABCs[i - 1] * ABCs[i] for i in range(3)]))
if __name__ == '__main__':
main() |
#Q.1 Convert tuples to list.
tup=(5,4,2,'a',16,'ram') #this is a tuples.
l=[] #this is empty list.
lenght=len(tup)
for i in (tup):
l.append(i)
print("list converted form tuples is :",l)
| tup = (5, 4, 2, 'a', 16, 'ram')
l = []
lenght = len(tup)
for i in tup:
l.append(i)
print('list converted form tuples is :', l) |
#A particularly hard problem to solve
class Solution:
def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
#Suppose we have two arrays that are sorted
#l1 = [1,2,3]
#l2 = [4,5,6]
#L1 + L2 = [1,2,3,4,5,6]
#The median 3.5.
#Notice that the ind... | class Solution:
def find_median_sorted_arrays(self, nums1: List[int], nums2: List[int]) -> float:
x = len(nums1)
y = len(nums2)
if y < x:
return self.findMedianSortedArrays(nums2, nums1)
start = 0
end = x
while start <= end:
pivotx = int((star... |
epsilon = 0.001
def sqr_root(low,high,n,const_value):
mid = (low+high)/2.0
mid_2 = mid
for _i in range(n-1):
mid_2*=mid
dif = mid_2 - const_value
if abs(dif) <= epsilon:
return mid
elif mid_2 > const_value:
return sqr_root(low,mid,n,const_value)
elif mid_2 < const_value:
return sqr... | epsilon = 0.001
def sqr_root(low, high, n, const_value):
mid = (low + high) / 2.0
mid_2 = mid
for _i in range(n - 1):
mid_2 *= mid
dif = mid_2 - const_value
if abs(dif) <= epsilon:
return mid
elif mid_2 > const_value:
return sqr_root(low, mid, n, const_value)
elif mi... |
#! /usr/bin/python3
# seesway.py -- This script counts from -10 to 10 and then back from 10 to -10
# Author -- Prince Oppong Boamah<regioths@gmail.com>
# Date -- 27th August 2015
for i in range(-10, 11): print(i)
for i in range(9, -1, -1): print(i)
for i in range(-10, 0): print(i)
| for i in range(-10, 11):
print(i)
for i in range(9, -1, -1):
print(i)
for i in range(-10, 0):
print(i) |
#WAP to input marks of 5 subject and find average and assign grade
sub1=int(input("Enter marks of the first subject: "))
sub2=int(input("Enter marks of the second subject: "))
sub3=int(input("Enter marks of the third subject: "))
sub4=int(input("Enter marks of the fourth subject: "))
sub5=int(input("Enter marks of the ... | sub1 = int(input('Enter marks of the first subject: '))
sub2 = int(input('Enter marks of the second subject: '))
sub3 = int(input('Enter marks of the third subject: '))
sub4 = int(input('Enter marks of the fourth subject: '))
sub5 = int(input('Enter marks of the fifth subject: '))
total = sub1 + sub2 + sub3 + sub4 + su... |
class Solution:
def thirdMax(self, nums: List[int]) -> int:
maxs = [-float('inf'),-float('inf'),-float('inf')]
m = 0
for i in range(len(nums)):
if nums[i] not in maxs:
if m < 3 :
maxs[m] = nums[i]
m += 1
... | class Solution:
def third_max(self, nums: List[int]) -> int:
maxs = [-float('inf'), -float('inf'), -float('inf')]
m = 0
for i in range(len(nums)):
if nums[i] not in maxs:
if m < 3:
maxs[m] = nums[i]
m += 1
... |
VERSION = '0.2'
TYPE = 'type'
LIBRML = 'libRML'
ITEM = 'item'
ID = 'id'
ACTIONS = 'actions'
RESTRICTIONS = 'restrictions'
PERMISSION = 'permission'
TENANT = 'tenant'
MENTION = 'mention'
SHARE = 'sharealike'
USAGEGUIDE = 'usageguide'
TEMPLATE = 'template'
#XML
XRESTRICTION = 'restriction'
XACTION = 'action'
XPART = '... | version = '0.2'
type = 'type'
librml = 'libRML'
item = 'item'
id = 'id'
actions = 'actions'
restrictions = 'restrictions'
permission = 'permission'
tenant = 'tenant'
mention = 'mention'
share = 'sharealike'
usageguide = 'usageguide'
template = 'template'
xrestriction = 'restriction'
xaction = 'action'
xpart = 'part'
xg... |
def factorial(n):
if(n == 0):
return 1
else:
return n*factorial(n-1)
if __name__ == "__main__":
number = int(input("Enter number:"))
print(f'Factorial of {number} is {factorial(number)}')
| def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n - 1)
if __name__ == '__main__':
number = int(input('Enter number:'))
print(f'Factorial of {number} is {factorial(number)}') |
A = True
B = False
C = A and B
D = A or B
if C == True:
print("A and B is True.")
else:
print("A and B is False.")
if D == True:
print("A or B is True.")
else:
print("A or B is False.")
| a = True
b = False
c = A and B
d = A or B
if C == True:
print('A and B is True.')
else:
print('A and B is False.')
if D == True:
print('A or B is True.')
else:
print('A or B is False.') |
class Tile():
def __init__(self,bomb=False):
self.bomb = False
self.revealed = False
self.nearBombs = 0
def isBomb(self):
return self.bomb
def isRevealed(self):
return self.revealed
def setBomb(self):
self.bomb=True
def setNearBombs(self,... | class Tile:
def __init__(self, bomb=False):
self.bomb = False
self.revealed = False
self.nearBombs = 0
def is_bomb(self):
return self.bomb
def is_revealed(self):
return self.revealed
def set_bomb(self):
self.bomb = True
def set_near_bombs(self, ne... |
### CONFIGS ###
dataset = 'cora'
model = 'VGAE'
input_dim = 10
hidden1_dim = 32
hidden2_dim = 16
use_feature = True
num_epoch = 2000
learning_rate = 0.01 | dataset = 'cora'
model = 'VGAE'
input_dim = 10
hidden1_dim = 32
hidden2_dim = 16
use_feature = True
num_epoch = 2000
learning_rate = 0.01 |
# clut.py.
#
# clut.py Teletext colour lookup table
# Maintains colour lookups
#
# Copyright (c) 2020 Peter Kwan
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includi... | class Clut:
def __init__(self):
print('Clut loaded')
self.clut0 = [0] * 8
self.clut1 = [0] * 8
self.clut2 = [0] * 8
self.clut3 = [0] * 8
self.reset()
def remap_colour_table(self, colourIndex, remap, foreground):
if type(colourIndex) != int:
p... |
# record all kinds of type
# pm type
LINKEDIN_TYPE = 1
PM_LANG_ITEM_TYPE = 0
PM_CITY_ITEM_TYPE = 1
PM_SERVICE_ITEM_TYPE = 2
REALTOR_MESSAGE_TYPE = 3
#quiz type
PM_QUIZ_TYPE = 0
#pm inspection report note type
PM_INSPECTION_REPORT_TYPE = 3
PM_EXPENSE_TYPE = 4
#user progress bar
USER_PROGRESS_BAR_TYPE = 0
HOME_PROGRES... | linkedin_type = 1
pm_lang_item_type = 0
pm_city_item_type = 1
pm_service_item_type = 2
realtor_message_type = 3
pm_quiz_type = 0
pm_inspection_report_type = 3
pm_expense_type = 4
user_progress_bar_type = 0
home_progress_bar_type = 1
pm_income_type = 0
pic_avatar_type = 0
pic_url_type = 1
file_s3_type = 0
status_log_use... |
if request.isInit:
lastVal = 0
else:
if lastVal == 0:
lastVal = 1
else:
lastVal = (lastVal << 1) & 0xFFFFFFFF
request.value = lastVal
| if request.isInit:
last_val = 0
else:
if lastVal == 0:
last_val = 1
else:
last_val = lastVal << 1 & 4294967295
request.value = lastVal |
# Copyright 2009, UCAR/Unidata
# Enumerate the kinds of Sax Events received by the SaxEventHandler
STARTDOCUMENT = 1
ENDDOCUMENT = 2
STARTELEMENT = 3
ENDELEMENT = 4
ATTRIBUTE = 5
CHARACTERS = 6
# Define printable output
_MAP = {
STARTDOCUMENT: "STARTDOCUMENT",
ENDDOCUMENT: "ENDDOCUMENT",
STARTELEMENT: "STARTELEMENT"... | startdocument = 1
enddocument = 2
startelement = 3
endelement = 4
attribute = 5
characters = 6
_map = {STARTDOCUMENT: 'STARTDOCUMENT', ENDDOCUMENT: 'ENDDOCUMENT', STARTELEMENT: 'STARTELEMENT', ENDELEMENT: 'ENDELEMENT', ATTRIBUTE: 'ATTRIBUTE', CHARACTERS: 'CHARACTERS'}
def tostring(t):
return _MAP[t] |
def select_k_items(stream, n, k):
reservoir = []
for i in range(k):
reservoir.append(stream[i])
if __name__ == '__main__':
stream = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
n = len(stream)
k = 5
select_k_items(stream, n, k) | def select_k_items(stream, n, k):
reservoir = []
for i in range(k):
reservoir.append(stream[i])
if __name__ == '__main__':
stream = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
n = len(stream)
k = 5
select_k_items(stream, n, k) |
class Solution:
def majorityElement(self, nums: list[int]) -> list[int]:
candidate1, candidate2 = 0, 0
count1, count2 = 0, 0
for num in nums:
if candidate1 == num:
count1 += 1
continue
if candidate2 == num:
count2 += 1... | class Solution:
def majority_element(self, nums: list[int]) -> list[int]:
(candidate1, candidate2) = (0, 0)
(count1, count2) = (0, 0)
for num in nums:
if candidate1 == num:
count1 += 1
continue
if candidate2 == num:
cou... |
memo=[0, 1]
def fib_digits(n):
if len(memo)==2:
for i in range(2, 100001):
memo.append(memo[i-1]+memo[i-2])
num=str(memo[n])
res=[]
for i in range(0,10):
check=num.count(str(i))
if check:
res.append((check, i))
return sorted(res, reverse=True) | memo = [0, 1]
def fib_digits(n):
if len(memo) == 2:
for i in range(2, 100001):
memo.append(memo[i - 1] + memo[i - 2])
num = str(memo[n])
res = []
for i in range(0, 10):
check = num.count(str(i))
if check:
res.append((check, i))
return sorted(res, reve... |
# Question 1: Write a program that asks the user to enter a string. The program should then print the following:
# a) The total number of characters in the string
# b) The string repeated 10 times
# c) The first character of the string
# d) The first three characters of the string
# e) The last three ... | string = input('enter a string')
print(len(string))
print(string * 10)
print(string[0])
print(string[0:3])
print(string[-3:])
print(string[::-1])
if len(string) >= 7:
print(string[7])
else:
print('the string is shorter than 7 charecters')
print(string[1:-1])
print(string.upper())
print(string.replace('a', 'e'))... |
_base_ = [
'../swin/cascade_mask_rcnn_swin_small_patch4_window7_mstrain_480-800_giou_4conv1f_adamw_3x_coco.py'
]
model = dict(
backbone=dict(
type='CBSwinTransformer',
),
neck=dict(
type='CBFPN',
),
test_cfg = dict(
rcnn=dict(
score_thr=0.001,
nms... | _base_ = ['../swin/cascade_mask_rcnn_swin_small_patch4_window7_mstrain_480-800_giou_4conv1f_adamw_3x_coco.py']
model = dict(backbone=dict(type='CBSwinTransformer'), neck=dict(type='CBFPN'), test_cfg=dict(rcnn=dict(score_thr=0.001, nms=dict(type='soft_nms'))))
img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[58.... |
def test_index(man):
errors = []
G = man.writeTest()
G.addIndex("Person", "name")
G.addVertex("1", "Person", {"name": "marko", "age": "29"})
G.addVertex("2", "Person", {"name": "vadas", "age": "27"})
G.addVertex("3", "Software", {"name": "lop", "lang": "java"})
G.addVertex("4", "Person"... | def test_index(man):
errors = []
g = man.writeTest()
G.addIndex('Person', 'name')
G.addVertex('1', 'Person', {'name': 'marko', 'age': '29'})
G.addVertex('2', 'Person', {'name': 'vadas', 'age': '27'})
G.addVertex('3', 'Software', {'name': 'lop', 'lang': 'java'})
G.addVertex('4', 'Person', {'n... |
DEFAULT_CHUNK_SIZE = 1000
def chunked_iterator(qs, size=DEFAULT_CHUNK_SIZE):
qs = qs._clone()
qs.query.clear_ordering(force_empty=True)
qs.query.add_ordering('pk')
last_pk = None
empty = False
while not empty:
sub_qs = qs
if last_pk:
sub_qs = sub_qs.filter(pk__gt=la... | default_chunk_size = 1000
def chunked_iterator(qs, size=DEFAULT_CHUNK_SIZE):
qs = qs._clone()
qs.query.clear_ordering(force_empty=True)
qs.query.add_ordering('pk')
last_pk = None
empty = False
while not empty:
sub_qs = qs
if last_pk:
sub_qs = sub_qs.filter(pk__gt=las... |
indent = 3
key = "foo"
print('\n%s%*s' % (indent, len(key)+3, 'Hello')) # ok: variable length
print("%.*f" % (indent, 1.2345))
def myprint(x, *args):
print("%.3f %.4f %10.3f %1.*f" % (x, x, x, 3, x))
myprint(3)
| indent = 3
key = 'foo'
print('\n%s%*s' % (indent, len(key) + 3, 'Hello'))
print('%.*f' % (indent, 1.2345))
def myprint(x, *args):
print('%.3f %.4f %10.3f %1.*f' % (x, x, x, 3, x))
myprint(3) |
PAGES_FOLDER = 'pages'
PUBLIC_FOLDER = 'public'
STATIC_FOLDER = 'static'
TEMPLATE_NAME = 'template.mustache'
| pages_folder = 'pages'
public_folder = 'public'
static_folder = 'static'
template_name = 'template.mustache' |
teisuu = 1
suuji_kous = 3
aru = 2
zenn = 0
for ai in range(suuji_kous):
zenn += teisuu*aru**ai
print(zenn)
| teisuu = 1
suuji_kous = 3
aru = 2
zenn = 0
for ai in range(suuji_kous):
zenn += teisuu * aru ** ai
print(zenn) |
# elasticmodels/tests/test_settings.py
# author: andrew young
# email: ayoung@thewulf.org
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:",
}
}
ROOT_URLCONF = ["elasticmodels.urls"]
INSTALLED_APPS = ["elasticmodels"]
| databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}}
root_urlconf = ['elasticmodels.urls']
installed_apps = ['elasticmodels'] |
# Python - 2.7.6
Test.describe('Basic Tests')
data = [2]
Test.assert_equals(print_array(data), '2')
data = [2, 4, 5, 2]
Test.assert_equals(print_array(data), '2,4,5,2')
data = [2, 4, 5, 2]
Test.assert_equals(print_array(data), '2,4,5,2')
data = [2.0, 4.2, 5.1, 2.2]
Test.assert_equals(print_array(data), '2.0,4.2,5.1... | Test.describe('Basic Tests')
data = [2]
Test.assert_equals(print_array(data), '2')
data = [2, 4, 5, 2]
Test.assert_equals(print_array(data), '2,4,5,2')
data = [2, 4, 5, 2]
Test.assert_equals(print_array(data), '2,4,5,2')
data = [2.0, 4.2, 5.1, 2.2]
Test.assert_equals(print_array(data), '2.0,4.2,5.1,2.2')
data = ['2', '... |
def result(score):
min = max = score[0]
min_count = max_count = 0
for i in score[1:]:
if i > max:
max_count += 1
max = i
if i < min:
min_count += 1
min = i
return max_count, min_count
n = input()
score = list(map(int, input().split()))
p... | def result(score):
min = max = score[0]
min_count = max_count = 0
for i in score[1:]:
if i > max:
max_count += 1
max = i
if i < min:
min_count += 1
min = i
return (max_count, min_count)
n = input()
score = list(map(int, input().split()))
pr... |
DEFAULT_PRAGMAS = (
"akamai-x-get-request-id",
"akamai-x-get-cache-key",
"akamai-x-get-true-cache-key",
"akamai-x-get-extracted-values",
"akamai-x-cache-on",
"akamai-x-cache-remote-on",
"akamai-x-check-cacheable",
"akamai-x-get-ssl-client-session-id",
"akamai-x-serial-no",
)
| default_pragmas = ('akamai-x-get-request-id', 'akamai-x-get-cache-key', 'akamai-x-get-true-cache-key', 'akamai-x-get-extracted-values', 'akamai-x-cache-on', 'akamai-x-cache-remote-on', 'akamai-x-check-cacheable', 'akamai-x-get-ssl-client-session-id', 'akamai-x-serial-no') |
n1 = int(input("digite o valor em metros "))
n2 = int(input("digite o valor em metros "))
n3 = int(input("digite o valor em metros "))
r= (n1**2)+(n2**2)+(n3**2)
print(r) | n1 = int(input('digite o valor em metros '))
n2 = int(input('digite o valor em metros '))
n3 = int(input('digite o valor em metros '))
r = n1 ** 2 + n2 ** 2 + n3 ** 2
print(r) |
__author__ = 'ipetrash'
if __name__ == '__main__':
def getprint(str="hello world!"):
print(str)
def decor(func):
def wrapper(*args, **kwargs):
print("1 begin: " + func.__name__)
print("Args={} kwargs={}".format(args, kwargs))
f = func(*args, **kwargs)
... | __author__ = 'ipetrash'
if __name__ == '__main__':
def getprint(str='hello world!'):
print(str)
def decor(func):
def wrapper(*args, **kwargs):
print('1 begin: ' + func.__name__)
print('Args={} kwargs={}'.format(args, kwargs))
f = func(*args, **kwargs)
... |
'''
https://youtu.be/-xRKazHGtjU
Smarter Approach: https://youtu.be/J7S3CHFBZJA
Dynamic Programming: https://youtu.be/VQeFcG9pjJU
'''
| """
https://youtu.be/-xRKazHGtjU
Smarter Approach: https://youtu.be/J7S3CHFBZJA
Dynamic Programming: https://youtu.be/VQeFcG9pjJU
""" |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def Insertion_sort(_list):
list_length = len(_list)
i = 1
while i < list_length:
key = _list[i]
j = i - 1
while j >= 0 and _list[j] > key:
_list[j+1] = _list[j]
j -= 1
_list[j+1] = key
i += 1
... | def insertion_sort(_list):
list_length = len(_list)
i = 1
while i < list_length:
key = _list[i]
j = i - 1
while j >= 0 and _list[j] > key:
_list[j + 1] = _list[j]
j -= 1
_list[j + 1] = key
i += 1
return _list |
duzina = 5
sirina = 2
povrsina = duzina * sirina
print('Povrsina je ', povrsina)
print('Obim je ', 2 * (duzina + sirina))
| duzina = 5
sirina = 2
povrsina = duzina * sirina
print('Povrsina je ', povrsina)
print('Obim je ', 2 * (duzina + sirina)) |
class Contact:
def __init__(self, fname=None, sname=None, lname=None, address=None, email=None, tel=None):
self.fname = fname
self.sname = sname
self.lname = lname
self.address = address
self.email = email
self.tel = tel | class Contact:
def __init__(self, fname=None, sname=None, lname=None, address=None, email=None, tel=None):
self.fname = fname
self.sname = sname
self.lname = lname
self.address = address
self.email = email
self.tel = tel |
def response(number):
if number % 4 == 0:
return "Multiple of four"
elif number % 2 == 0:
return "Even"
else:
return "Odd"
def divisible(num, check):
if check % num == 0:
return "Yes, it's evenly divisible"
return "No, it's not evenly divisible"
if __name__ == "__... | def response(number):
if number % 4 == 0:
return 'Multiple of four'
elif number % 2 == 0:
return 'Even'
else:
return 'Odd'
def divisible(num, check):
if check % num == 0:
return "Yes, it's evenly divisible"
return "No, it's not evenly divisible"
if __name__ == '__mai... |
class PipelineError(Exception):
pass
class PipelineParallelError(Exception):
pass
| class Pipelineerror(Exception):
pass
class Pipelineparallelerror(Exception):
pass |
# print statement, function definition
name = "Anurag"
age = 30
print(name, age, "python", 2020)
print(name, age, "python", 2020, sep=", ", end=" $$ ")
| name = 'Anurag'
age = 30
print(name, age, 'python', 2020)
print(name, age, 'python', 2020, sep=', ', end=' $$ ') |
def isPermutation(string_1, string_2):
string_1 = list(string_1)
string_2 = list(string_2)
for i in range(0, len(string_1)):
for j in range(0, len(string_2)):
if string_1[i] == string_2[j]:
del string_2[j]
break
if len(string_2) == 0:
retu... | def is_permutation(string_1, string_2):
string_1 = list(string_1)
string_2 = list(string_2)
for i in range(0, len(string_1)):
for j in range(0, len(string_2)):
if string_1[i] == string_2[j]:
del string_2[j]
break
if len(string_2) == 0:
return T... |
class _SCon:
esc : str = '\u001B'
bra : str = '['
eb : str = esc + bra
bRed : str = eb + '41m'
white : str = eb + '37m'
bold : str = eb + '1m'
right : str = 'C'
left : str = 'D'
down : str = 'B'
up : str = 'A'
reset : str = eb + '0m'
cy... | class _Scon:
esc: str = '\x1b'
bra: str = '['
eb: str = esc + bra
b_red: str = eb + '41m'
white: str = eb + '37m'
bold: str = eb + '1m'
right: str = 'C'
left: str = 'D'
down: str = 'B'
up: str = 'A'
reset: str = eb + '0m'
cyan: str = eb + '36m'
del_char: str = eb + 'X... |
# tree structure in decoder side
# divide sub-node by brackets "()"
class Tree():
def __init__(self):
self.parent = None
self.num_children = 0
self.children = []
def __str__(self, level = 0):
ret = ""
for child in self.children:
if isinstance(child,type(... | class Tree:
def __init__(self):
self.parent = None
self.num_children = 0
self.children = []
def __str__(self, level=0):
ret = ''
for child in self.children:
if isinstance(child, type(self)):
ret += child.__str__(level + 1)
else:
... |
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
N = len(A)
l_sum = A[0]
r_sum = sum(A) - l_sum
diff = abs(l_sum - r_sum)
for i in range(1, N -1):
l_sum += A[i]
r_sum -= A[i]
c_diff = abs(l_sum - r_sum)
if di... | def solution(A):
n = len(A)
l_sum = A[0]
r_sum = sum(A) - l_sum
diff = abs(l_sum - r_sum)
for i in range(1, N - 1):
l_sum += A[i]
r_sum -= A[i]
c_diff = abs(l_sum - r_sum)
if diff > c_diff:
diff = c_diff
return diff |
#!/usr/bin/python3
def uppercase(str):
for c in str:
if (ord(c) >= ord('a')) and (ord(c) <= ord('z')):
c = chr(ord(c)-ord('a')+ord('A'))
print("{}".format(c), end='')
print()
| def uppercase(str):
for c in str:
if ord(c) >= ord('a') and ord(c) <= ord('z'):
c = chr(ord(c) - ord('a') + ord('A'))
print('{}'.format(c), end='')
print() |
def calcula_diferenca(A: int, B: int, C: int, D: int):
if (not isinstance(A, int) or
not isinstance(B, int) or
not isinstance(C, int) or
not isinstance(D, int)):
raise(TypeError)
D = A * B - C * D
return f'DIFERENCA = {D}' | def calcula_diferenca(A: int, B: int, C: int, D: int):
if not isinstance(A, int) or not isinstance(B, int) or (not isinstance(C, int)) or (not isinstance(D, int)):
raise TypeError
d = A * B - C * D
return f'DIFERENCA = {D}' |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
###################################################
#........../\./\...___......|\.|..../...\.........#
#........./..|..\/\.|.|_|._.|.\|....|.c.|.........#
#......../....../--\|.|.|.|i|..|....\.../.........#
# Mathtin (c) #
#############... | __author__ = 'Mathtin'
class Invalidconfigexception(Exception):
def __init__(self, msg: str, var_name: str):
super().__init__(f'{msg}, check {var_name} value')
class Notcoroutineexception(TypeError):
def __init__(self, func):
super().__init__(f'{str(func)} is not a coroutine function')
clas... |
#Question link
#https://practice.geeksforgeeks.org/problems/smallest-subarray-with-sum-greater-than-x/0
def window(arr,n, k):
left=0
right=0
ans=n
sum1=0
while left<n and right<n+1:
if sum1>k:
if left==right:
ans=1
break
... | def window(arr, n, k):
left = 0
right = 0
ans = n
sum1 = 0
while left < n and right < n + 1:
if sum1 > k:
if left == right:
ans = 1
break
ans = min(ans, right - left)
sum1 -= arr[left]
left += 1
elif righ... |
s = input()
# s = ' name1'
list_stop = [' ', '@', '$', '%']
list_num = '0123456789'
# flag_true = 0
flag_false = 0
for i in list_num:
if s[0] == i:
flag_false += 1
break
for j in s:
for k in list_stop:
if j == k:
flag_false += 1
break
else:
# f... | s = input()
list_stop = [' ', '@', '$', '%']
list_num = '0123456789'
flag_false = 0
for i in list_num:
if s[0] == i:
flag_false += 1
break
for j in s:
for k in list_stop:
if j == k:
flag_false += 1
break
else:
break
if flag_false >= 1:
prin... |
#
# @lc app=leetcode id=1232 lang=python3
#
# [1232] Check If It Is a Straight Line
#
# @lc code=start
class Solution:
def checkStraightLine(self, coordinates):
if len(coordinates) <= 2:
return True
x1, x2, y1, y2 = coordinates[0][0], coordinates[1][0], coordinates[0][1], coordinates[1]... | class Solution:
def check_straight_line(self, coordinates):
if len(coordinates) <= 2:
return True
(x1, x2, y1, y2) = (coordinates[0][0], coordinates[1][0], coordinates[0][1], coordinates[1][1])
if x1 == x2:
k = 0
else:
k = (y1 - y2) / (x1 - x2)
... |
class YggException(Exception): pass
class LoginFailed(Exception): pass
class TooManyFailedLogins(Exception): pass
| class Yggexception(Exception):
pass
class Loginfailed(Exception):
pass
class Toomanyfailedlogins(Exception):
pass |
class TriggerBase:
def __init__(self, q, events):
self.q = q
self.events = events
def trigger(self, name):
self.q.put(
{'req': 'trigger_animation', 'data': name, 'sender': 'Trigger'})
| class Triggerbase:
def __init__(self, q, events):
self.q = q
self.events = events
def trigger(self, name):
self.q.put({'req': 'trigger_animation', 'data': name, 'sender': 'Trigger'}) |
favcolor = {
"Jacob": "Magenta",
"Jason": "Red",
"Anais": "Purple"
}
for name, color in favcolor.items():
print("%s's favorite color is %s" %(name, color))
| favcolor = {'Jacob': 'Magenta', 'Jason': 'Red', 'Anais': 'Purple'}
for (name, color) in favcolor.items():
print("%s's favorite color is %s" % (name, color)) |
'''
5. Write a Python program to check whether a specified value is contained in a group of values.
Test Data :
3 -> [1, 5, 8, 3] : True
-1 -> [1, 5, 8, 3] : False
'''
def check_value(group_data, n):
for x in group_data:
if n == x:
return True
else:
return False
print(check_value([1,... | """
5. Write a Python program to check whether a specified value is contained in a group of values.
Test Data :
3 -> [1, 5, 8, 3] : True
-1 -> [1, 5, 8, 3] : False
"""
def check_value(group_data, n):
for x in group_data:
if n == x:
return True
else:
return False
print(check_value([1... |
# Program corresponding to flowchart in this site https://automatetheboringstuff.com/2e/images/000039.jpg
print('Is raining? (Y)es or (N)o')
answer = input()
if answer == 'N':
print('Go outside.')
elif answer == 'Y':
print('Have umbrella? (Y)es or (N)o')
answer2 = input()
if answer2 == 'Y':
print('Go out... | print('Is raining? (Y)es or (N)o')
answer = input()
if answer == 'N':
print('Go outside.')
elif answer == 'Y':
print('Have umbrella? (Y)es or (N)o')
answer2 = input()
if answer2 == 'Y':
print('Go outside.')
elif answer2 == 'N':
print('Wait a while.')
print('Is raining? (Y)es ... |
first_name = input()
second_name = input()
delimeter = input()
print(f"{first_name}{delimeter}{second_name}")
| first_name = input()
second_name = input()
delimeter = input()
print(f'{first_name}{delimeter}{second_name}') |
#
# PySNMP MIB module CISCO-ITP-RT-CAPABILITY (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ITP-RT-CAPABILITY
# Produced by pysmi-0.3.4 at Wed May 1 12:03:41 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint) ... |
# -*- coding: utf-8 -*-
qntCaso = int(input())
for caso in range(qntCaso):
listStrTamanhoStr = list()
listStr = list(map(str, input().split()))
for indiceStr in range(len(listStr)): listStrTamanhoStr.append([listStr[indiceStr], len(listStr[indiceStr])])
strSequenciaOrdenadaTamanho = ""
for ch... | qnt_caso = int(input())
for caso in range(qntCaso):
list_str_tamanho_str = list()
list_str = list(map(str, input().split()))
for indice_str in range(len(listStr)):
listStrTamanhoStr.append([listStr[indiceStr], len(listStr[indiceStr])])
str_sequencia_ordenada_tamanho = ''
for (chave, valor) i... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Chirstoph Reimers'
__email__ = 'creimers@byteyard.de'
__version__ = '0.1.0.b6'
| __author__ = 'Chirstoph Reimers'
__email__ = 'creimers@byteyard.de'
__version__ = '0.1.0.b6' |
#square pattern
'''
Print the following pattern for the given N number of rows.
Pattern for N = 4
4444
4444
4444
4444
'''
rows=int(input())
for i in range(rows):
for j in range(rows):
print(rows,end="")
print()
| """
Print the following pattern for the given N number of rows.
Pattern for N = 4
4444
4444
4444
4444
"""
rows = int(input())
for i in range(rows):
for j in range(rows):
print(rows, end='')
print() |
expected_output = {
"vrf": {
"default": {
"address_family": {
"ipv4": {
"instance": {
"10000": {
"summary_traffic_statistics": {
"ospf_packets_received_sent": {
... | expected_output = {'vrf': {'default': {'address_family': {'ipv4': {'instance': {'10000': {'summary_traffic_statistics': {'ospf_packets_received_sent': {'type': {'rx_invalid': {'packets': 0, 'bytes': 0}, 'rx_hello': {'packets': 0, 'bytes': 0}, 'rx_db_des': {'packets': 0, 'bytes': 0}, 'rx_ls_req': {'packets': 0, 'bytes':... |
# Write your solutions for 1.5 here!
class superheroes:
def __int__(self, name, superpower, strength):
self.name=name
self.superpower=superpower
self.strength=strength
def print_me(self):
print(self.name +str( self.strength))
superhero = superheroes("tamara","fly", 10)
superhero.print_me()
| class Superheroes:
def __int__(self, name, superpower, strength):
self.name = name
self.superpower = superpower
self.strength = strength
def print_me(self):
print(self.name + str(self.strength))
superhero = superheroes('tamara', 'fly', 10)
superhero.print_me() |
N = int(input())
A, B, C = input(), input(), input()
ans = 0
for i in range(N):
abc = A[i], B[i], C[i]
ans += len(set(abc)) - 1
print(ans)
| n = int(input())
(a, b, c) = (input(), input(), input())
ans = 0
for i in range(N):
abc = (A[i], B[i], C[i])
ans += len(set(abc)) - 1
print(ans) |
contador = 0
print("2 elevado a " + str(contador) + " es igual a: " + str(2 ** contador))
contador = 1
print("2 elevado a " + str(contador) + " es igual a: " + str(2 ** contador))
contador = 2
print("2 elevado a " + str(contador) + " es igual a: " + str(2 ** contador))
contador = 3
print("2 elevado a " + str(contado... | contador = 0
print('2 elevado a ' + str(contador) + ' es igual a: ' + str(2 ** contador))
contador = 1
print('2 elevado a ' + str(contador) + ' es igual a: ' + str(2 ** contador))
contador = 2
print('2 elevado a ' + str(contador) + ' es igual a: ' + str(2 ** contador))
contador = 3
print('2 elevado a ' + str(contador) ... |
class Number:
def __init__(self):
self.num = 0
def setNum(self, x):
self.num = x
# na= Number()
# na.setNum(3)
# print(hasattr(na, 'id'))
a = ABCDEFGHIJKLMNOPQRSTUVWXYZ
b = BLUESKYACDFGHIJMNOPQRTVWXZ
class Point:
def __init__(self, x=0, y=0):
self.x = x
... | class Number:
def __init__(self):
self.num = 0
def set_num(self, x):
self.num = x
a = ABCDEFGHIJKLMNOPQRSTUVWXYZ
b = BLUESKYACDFGHIJMNOPQRTVWXZ
class Point:
def __init__(self, x=0, y=0):
self.x = x
self.y = y
def __str__(self):
return (self.x, self.y)
de... |
n = int(input())
ans = 0
for i in range(n):
a, b = map(int, input().split())
ans += (a + b) * (b - a + 1) // 2
print(ans) | n = int(input())
ans = 0
for i in range(n):
(a, b) = map(int, input().split())
ans += (a + b) * (b - a + 1) // 2
print(ans) |
def is_leap(year):
leap = False
# Write your logic here
if (year%400) == 0:
leap = True
elif (year%100) == 0:
leap = False
elif (year%4) == 0:
leap = True
return leap | def is_leap(year):
leap = False
if year % 400 == 0:
leap = True
elif year % 100 == 0:
leap = False
elif year % 4 == 0:
leap = True
return leap |
__version__ = '2.0.0'
print("*"*35)
print(f'SpotifyToVKStatus. Version: {__version__}')
print("*"*35)
| __version__ = '2.0.0'
print('*' * 35)
print(f'SpotifyToVKStatus. Version: {__version__}')
print('*' * 35) |
file_name = input('Enter file name: ')
if file_name == 'na na boo boo':
print("NA NA BOO BOO TO YOU - You have been punk'd!")
exit()
else:
try:
file = open(file_name)
except:
print('File cannot be opened')
exit()
count = 0
numbers = 0
average = 0
for line in file:
if line.startswith('X-DSPAM-Confidence'):
... | file_name = input('Enter file name: ')
if file_name == 'na na boo boo':
print("NA NA BOO BOO TO YOU - You have been punk'd!")
exit()
else:
try:
file = open(file_name)
except:
print('File cannot be opened')
exit()
count = 0
numbers = 0
average = 0
for line in file:
if line.sta... |
#
# @lc app=leetcode id=46 lang=python3
#
# [46] Permutations
#
# @lc code=start
class Solution:
def permute(self, nums: List[int]) -> List[List[int]]:
results = []
prev_elements = []
def dfs(elements):
if len(elements) == 0:
results.append(prev_elements[:])
... | class Solution:
def permute(self, nums: List[int]) -> List[List[int]]:
results = []
prev_elements = []
def dfs(elements):
if len(elements) == 0:
results.append(prev_elements[:])
for e in elements:
next_elements = elements[:]
... |
def user(*args):
blank=[]
for num in args:
blank+=1
return arg
user() | def user(*args):
blank = []
for num in args:
blank += 1
return arg
user() |
class basedriver (object):
def __init__(self, ctx, model):
self._ctx = ctx
self._model = model
def check_update(self, current):
if current is None:
return True
if current.version is None:
return True
if current.version != self._model.version:
... | class Basedriver(object):
def __init__(self, ctx, model):
self._ctx = ctx
self._model = model
def check_update(self, current):
if current is None:
return True
if current.version is None:
return True
if current.version != self._model.version:
... |
def get(key):
return None
def set(key, value):
pass
| def get(key):
return None
def set(key, value):
pass |
# Problem Statement: https://leetcode.com/problems/longest-increasing-subsequence/
class Solution:
def lengthOfLIS(self, nums: List[int]) -> int:
arr = nums
if not arr:
return 0
lens = [1 for num in arr]
seqs = [None for num in arr]
for i, num in enumerate(arr):... | class Solution:
def length_of_lis(self, nums: List[int]) -> int:
arr = nums
if not arr:
return 0
lens = [1 for num in arr]
seqs = [None for num in arr]
for (i, num) in enumerate(arr):
curr_num = num
for j in range(0, i):
ot... |
print('load # extractor diagram V1 essential')
# Essential version for the final summary automation in the main notebook.
#It contains only the winning prefilter and feature extraction from the development process.
class extdia_v1_essential(extractor_diagram):
def ini_diagram(self): # custom
... | print('load # extractor diagram V1 essential')
class Extdia_V1_Essential(extractor_diagram):
def ini_diagram(self):
self.name = 'EDiaV1'
if self.fHP:
self.name += 'HP'
if self.augment > -1:
self.name += 'aug' + str(self.augment)
if self.DeviceType == 1:
... |
n = int(input())
sticks = list(map(int, input().split()))
uniq = sorted(set(sticks))
for i in uniq:
print(len([x for x in sticks if x >= i])) | n = int(input())
sticks = list(map(int, input().split()))
uniq = sorted(set(sticks))
for i in uniq:
print(len([x for x in sticks if x >= i])) |
x = 1
y = 10
if(x == 1):
print("x equals 1")
if(y != 1):
print("y doesn't equal 1")
if(x < y):
print("x is less than y")
elif(x > y):
print("x is greater than y")
else:
print("x equals y")
if (x == 1 and y == 10):
print("Both values true")
if(x < 10):
if (y > 5):
print("x is less th... | x = 1
y = 10
if x == 1:
print('x equals 1')
if y != 1:
print("y doesn't equal 1")
if x < y:
print('x is less than y')
elif x > y:
print('x is greater than y')
else:
print('x equals y')
if x == 1 and y == 10:
print('Both values true')
if x < 10:
if y > 5:
print('x is less than 10, y i... |
class BackgroundClip(
Property,
):
BorderBox = "border-box"
PaddingBox = "padding-box"
ContentBox = "content-box"
| class Backgroundclip(Property):
border_box = 'border-box'
padding_box = 'padding-box'
content_box = 'content-box' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.