content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
students = []
class Student:
school_name = "Springfied Elementary"
def __init__(self, name, student_id=332):
self.name = name
self.student_id = student_id
students.append(self)
def __str__(self):
return "Student " + self.name
def get_name_capitalize(self):
r... | students = []
class Student:
school_name = 'Springfied Elementary'
def __init__(self, name, student_id=332):
self.name = name
self.student_id = student_id
students.append(self)
def __str__(self):
return 'Student ' + self.name
def get_name_capitalize(self):
ret... |
data_A = [1,2,3,6,7,8,9]
data_B = [1,2,7,8]
count = 0
for number1 in data_A:
for number2 in data_B:
if number1 == number2:
print('{} is also appeared in {}'.format(number1,number2))
count += 1
else:
pass
print('There are only {} matching numbers between Data A and Data ... | data_a = [1, 2, 3, 6, 7, 8, 9]
data_b = [1, 2, 7, 8]
count = 0
for number1 in data_A:
for number2 in data_B:
if number1 == number2:
print('{} is also appeared in {}'.format(number1, number2))
count += 1
else:
pass
print('There are only {} matching numbers between Data A a... |
class Node:
def __init__(self, value):
self.value = value
self.l = None
self.r = None
class BinaryTree:
def __init__(self):
self.root = None
def draw(self):
'''Prints a preorder traversal of the tree'''
self._draw(self.root)
print()
def _draw(se... | class Node:
def __init__(self, value):
self.value = value
self.l = None
self.r = None
class Binarytree:
def __init__(self):
self.root = None
def draw(self):
"""Prints a preorder traversal of the tree"""
self._draw(self.root)
print()
def _draw(... |
# 1, 2, 3, 4, 5, 6, 7, 8, 9
# 0, 1, 1, -1, -1, 2, 2, -2, -2
# 0, 0, 1, 1, -1, -1, 2, 2, -2, -2
def seq(n):
a = (n - 1) // 2
b = (n + 1) // 4
if a % 2 == 0:
return -b
else:
return b
n = int(input())
x = seq(n + 1)
y = seq(n)
print(x, y)
| def seq(n):
a = (n - 1) // 2
b = (n + 1) // 4
if a % 2 == 0:
return -b
else:
return b
n = int(input())
x = seq(n + 1)
y = seq(n)
print(x, y) |
W = []
S = str(input(''))
for i in S:
if i not in W:
W.append(i)
if len(W) % 2 == 0:
print('CHAT WITH HER!')
else:
print('IGNORE HIM!') | w = []
s = str(input(''))
for i in S:
if i not in W:
W.append(i)
if len(W) % 2 == 0:
print('CHAT WITH HER!')
else:
print('IGNORE HIM!') |
worldLists = {
"desk": {
"sets": ["desk"],
"assume": ["des", "de"],
},
"laptop": {
"sets": ["laptop"],
"assume": ["lapto", "lapt", "lap", "la"],
},
"wall": {
"sets": ["wall"],
"assume": ["wal", "wa"]
},
"sign": {
"sets": [... | world_lists = {'desk': {'sets': ['desk'], 'assume': ['des', 'de']}, 'laptop': {'sets': ['laptop'], 'assume': ['lapto', 'lapt', 'lap', 'la']}, 'wall': {'sets': ['wall'], 'assume': ['wal', 'wa']}, 'sign': {'sets': ['sign'], 'assume': ['sig', 'si']}, 'door': {'sets': ['door'], 'assume': ['doo', 'do']}, 'chair': {'sets': [... |
# Prova Mundo 02
# Rascunhos da Prova do Mundo 2
#Nota: 90%
n = ' nilseia'.upper().strip()[0]
print(n)
for c in range(0, 10):
print(c) | n = ' nilseia'.upper().strip()[0]
print(n)
for c in range(0, 10):
print(c) |
dnas = [
['hY?9', 56, 25, 8.21, 47, 21, -2.56, {'ott_len': 43, 'ott_percent': 196, 'ott_bw': 124, 'tps_qty_index': 215}],
['st7M', 67, 43, 17.72, 55, 29, 5.52, {'ott_len': 49, 'ott_percent': 299, 'ott_bw': 84, 'tps_qty_index': 468}],
]
| dnas = [['hY?9', 56, 25, 8.21, 47, 21, -2.56, {'ott_len': 43, 'ott_percent': 196, 'ott_bw': 124, 'tps_qty_index': 215}], ['st7M', 67, 43, 17.72, 55, 29, 5.52, {'ott_len': 49, 'ott_percent': 299, 'ott_bw': 84, 'tps_qty_index': 468}]] |
# This program contains a tuple stores the months of the year and
# another tuple from it with just summer months
# and prints out the summer months ine at a time.
month = ("January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"Septem... | month = ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December')
summer = month[4:7]
for month in summer:
print(month) |
default_players = {
'hungergames': [
("Marvel", True),
("Glimmer", False),
("Cato", True),
("Clove", False),
("Foxface", False),
("Jason", True),
("Rue", False),
("Thresh", True),
("Peeta", True),
("Katniss", False)
],
... | default_players = {'hungergames': [('Marvel', True), ('Glimmer', False), ('Cato', True), ('Clove', False), ('Foxface', False), ('Jason', True), ('Rue', False), ('Thresh', True), ('Peeta', True), ('Katniss', False)], 'melee': [('Dr. Mario', True), ('Mario', True), ('Luigi', True), ('Bowser', True), ('Peach', False), ('Y... |
def main():
N, M = map(int,input().split())
for i in range(1,N,2):
print(("." + "|.."*int((i-1)/2) + "|" + "..|"*int((i-1)/2) + ".").center(M,'-'))
print("WELCOME".center(M,"-"))
for i in range(N-2,-1,-2):
print(("." + "|.."*int((i-1)/2) + "|" + "..|"*int((i-1)/2) + ".").center(M,'-')... | def main():
(n, m) = map(int, input().split())
for i in range(1, N, 2):
print(('.' + '|..' * int((i - 1) / 2) + '|' + '..|' * int((i - 1) / 2) + '.').center(M, '-'))
print('WELCOME'.center(M, '-'))
for i in range(N - 2, -1, -2):
print(('.' + '|..' * int((i - 1) / 2) + '|' + '..|' * int((... |
#!/usr/bin/env python3
tls_cnt = 0
ssl_cnt = 0
with open("input.txt",'r') as f:
for line in f:
bracket = 0
tls_flag = 0
ABAs = [[],[]]
for i in range(len(line)-2):
if line[i] == '[':
bracket = 1
elif line[i] == ']':
bracket = 0
else:
if line[i] == line[i+2] and line[i+1] not in "]":
... | tls_cnt = 0
ssl_cnt = 0
with open('input.txt', 'r') as f:
for line in f:
bracket = 0
tls_flag = 0
ab_as = [[], []]
for i in range(len(line) - 2):
if line[i] == '[':
bracket = 1
elif line[i] == ']':
bracket = 0
else:
... |
# Configuration file for the Sphinx documentation builder.
project = 'wwt_api_client'
author = 'Peter K. G. Williams'
copyright = '2019 ' + author
release = '0.1.0dev0'
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.mathjax',
'sphinx.ext.viewcode'... | project = 'wwt_api_client'
author = 'Peter K. G. Williams'
copyright = '2019 ' + author
release = '0.1.0dev0'
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.mathjax', 'sphinx.ext.viewcode', 'sphinx_automodapi.automodapi', 'sphinx_automodapi.smart_resolver', 'numpydoc']
m... |
class ConfigException(Exception):
pass
class AuthException(Exception):
pass
class AuthEngineFailedException(AuthException):
pass
class UnauthorizedAccountException(AuthException):
pass
class LockedUserException(UnauthorizedAccountException):
pass
class InvalidAuthEngineException(AuthExcept... | class Configexception(Exception):
pass
class Authexception(Exception):
pass
class Authenginefailedexception(AuthException):
pass
class Unauthorizedaccountexception(AuthException):
pass
class Lockeduserexception(UnauthorizedAccountException):
pass
class Invalidauthengineexception(AuthException):... |
class Metadata:
name: str
def __init__(self, name: str):
self.name = name
def to_dict(self) -> dict:
return {
'name': self.name,
}
class ConfigMap:
metadata: Metadata
data: dict
apiVersion: str = 'v1'
kind: str = 'ConfigMap'
def __init__(
... | class Metadata:
name: str
def __init__(self, name: str):
self.name = name
def to_dict(self) -> dict:
return {'name': self.name}
class Configmap:
metadata: Metadata
data: dict
api_version: str = 'v1'
kind: str = 'ConfigMap'
def __init__(self, metadata: Metadata, data: ... |
# Creating a class
# Method 1
# class teddy:
# quantity = 200
# print(teddy.quantity)
# Method 2
class teddy:
quantity = 200
quality = 90
obteddy = teddy()
print(obteddy.quality)
print(obteddy.quantity)
| class Teddy:
quantity = 200
quality = 90
obteddy = teddy()
print(obteddy.quality)
print(obteddy.quantity) |
num = 10
num = 20
num = 30
num = 40
num = 50
num = 66
num = 60
num = 70
| num = 10
num = 20
num = 30
num = 40
num = 50
num = 66
num = 60
num = 70 |
val = open('val.txt', encoding='UTF-8')
out = open('out.txt', encoding='UTF-8')
t = val.readline()
a = out.readline()
sum = 0
right = 0
while t and a:
error = []
t = t.strip()
a = a.strip()
for i in range(len(t)):
sum += 1
if t[i] == a[i]:
right += 1
else:
... | val = open('val.txt', encoding='UTF-8')
out = open('out.txt', encoding='UTF-8')
t = val.readline()
a = out.readline()
sum = 0
right = 0
while t and a:
error = []
t = t.strip()
a = a.strip()
for i in range(len(t)):
sum += 1
if t[i] == a[i]:
right += 1
else:
... |
URL_FANTOIR = (
"https://www.collectivites-locales.gouv.fr/competences/la-mise-disposition-gratuite-du-fichier-des-"
"voies-et-des-lieux-dits-fantoir"
)
URL_DOCUMENTATION = "https://docs.3liz.org/QgisCadastrePlugin/"
| url_fantoir = 'https://www.collectivites-locales.gouv.fr/competences/la-mise-disposition-gratuite-du-fichier-des-voies-et-des-lieux-dits-fantoir'
url_documentation = 'https://docs.3liz.org/QgisCadastrePlugin/' |
n = int(input('digite um numero: '))
if n%2 == 0:
print('PAR')
else:
print('IMPAR') | n = int(input('digite um numero: '))
if n % 2 == 0:
print('PAR')
else:
print('IMPAR') |
ir_licenses = {
'names': {
'P': 'Pro',
'A': 'Class A',
'B': 'Class B',
'C': 'Class C',
'D': 'Class D',
'R': 'Rookie'
},
'bg_colors': {
'P': '#000000',
'A': '#0153DB',
'B': '#00C702',
'C': '#FEEC04',
'D': '#FC8A27',
... | ir_licenses = {'names': {'P': 'Pro', 'A': 'Class A', 'B': 'Class B', 'C': 'Class C', 'D': 'Class D', 'R': 'Rookie'}, 'bg_colors': {'P': '#000000', 'A': '#0153DB', 'B': '#00C702', 'C': '#FEEC04', 'D': '#FC8A27', 'R': '#FC0706'}, 'colors': {'P': '#FFFFFF', 'A': '#FFFFFF', 'B': '#FFFFFF', 'C': '#000000', 'D': '#000000', '... |
pkg_dnf = {
'nfs-utils': {},
'libnfsidmap': {},
}
svc_systemd = {
'nfs-server': {
'needs': ['pkg_dnf:nfs-utils'],
},
'rpcbind': {
'needs': ['pkg_dnf:nfs-utils'],
},
'rpc-statd': {
'needs': ['pkg_dnf:nfs-utils'],
},
'nfs-idmapd': {
'needs': ['pkg_dnf:n... | pkg_dnf = {'nfs-utils': {}, 'libnfsidmap': {}}
svc_systemd = {'nfs-server': {'needs': ['pkg_dnf:nfs-utils']}, 'rpcbind': {'needs': ['pkg_dnf:nfs-utils']}, 'rpc-statd': {'needs': ['pkg_dnf:nfs-utils']}, 'nfs-idmapd': {'needs': ['pkg_dnf:nfs-utils']}}
files = {}
actions = {'nfs_export': {'command': 'exportfs -a', 'trigge... |
# FIXME need to figure generation of bytecode
class Scenario:
STAGES = [
{"name": "install", "path": "build/{version}/cast_to_short-{version}.cap",},
{
"name": "send",
"comment": "READMEM APDU",
"payload": "0xA0 0xB0 0x01 0x00 0x00",
"optional": False,... | class Scenario:
stages = [{'name': 'install', 'path': 'build/{version}/cast_to_short-{version}.cap'}, {'name': 'send', 'comment': 'READMEM APDU', 'payload': '0xA0 0xB0 0x01 0x00\t0x00', 'optional': False}] |
class Solution:
def calPoints(self, ops: List[str]) -> int:
arr = []
for op in ops:
#print(arr)
if op.isdigit() or op[0] == '-':
arr.append(int(op))
elif op == 'C' and arr:
arr.pop()
elif op == 'D' and arr:
... | class Solution:
def cal_points(self, ops: List[str]) -> int:
arr = []
for op in ops:
if op.isdigit() or op[0] == '-':
arr.append(int(op))
elif op == 'C' and arr:
arr.pop()
elif op == 'D' and arr:
arr.append(arr[-1] ... |
# 153. Find Minimum in Rotated Sorted Array
class Solution(object):
global find_min_helper
def find_min_helper(nums,left,right):
# base case: if left >= right, return the first element
if left >= right:
return nums[0]
# get middle element
mid = (left+right)/2
... | class Solution(object):
global find_min_helper
def find_min_helper(nums, left, right):
if left >= right:
return nums[0]
mid = (left + right) / 2
if mid < right and nums[mid] > nums[mid + 1]:
return nums[mid + 1]
if mid > left and nums[mid] < nums[mid - 1]... |
# Configuration file for ipython.
#------------------------------------------------------------------------------
# InteractiveShellApp(Configurable) configuration
#------------------------------------------------------------------------------
## lines of code to run at IPython startup.
c.InteractiveShellApp.exec_lin... | c.InteractiveShellApp.exec_lines = ['%load_ext autoreload', '%autoreload 2']
c.InteractiveShellApp.extensions = ['autoreload'] |
#!/usr/bin/env python3
size_of_grp = 5
inp_list = "1 2 3 6 5 4 4 2 5 3 6 1 6 5 3 2 4 1 2 5 1 4 3 6 8 4 3 1 5 6 2".split()
set_l = set(inp_list)
cap_room = ""
for element in set_l:
inp_list.remove(element)
if not element in inp_list:
cap_room = element
break
print(int(cap_room))
| size_of_grp = 5
inp_list = '1 2 3 6 5 4 4 2 5 3 6 1 6 5 3 2 4 1 2 5 1 4 3 6 8 4 3 1 5 6 2'.split()
set_l = set(inp_list)
cap_room = ''
for element in set_l:
inp_list.remove(element)
if not element in inp_list:
cap_room = element
break
print(int(cap_room)) |
class InferErr(Exception):
def __init__(self, e):
self.code = 1
self.message = "Inference Error"
super().__init__(self.message, str(e))
def MiB(val):
return val * 1 << 20
def GiB(val):
return val * 1 << 30
class HostDeviceMem(object):
def __init__(self, host... | class Infererr(Exception):
def __init__(self, e):
self.code = 1
self.message = 'Inference Error'
super().__init__(self.message, str(e))
def mi_b(val):
return val * 1 << 20
def gi_b(val):
return val * 1 << 30
class Hostdevicemem(object):
def __init__(self, host_mem, device_me... |
GPU_ID = 0
BATCH_SIZE = 64
VAL_BATCH_SIZE = 100
NUM_OUTPUT_UNITS = 3000 # This is the answer vocabulary size
MAX_WORDS_IN_QUESTION = 15
MAX_WORDS_IN_EXP = 36
MAX_ITERATIONS = 50000
PRINT_INTERVAL = 100
# what data to use for training
TRAIN_DATA_SPLITS = 'train'
# what data to use for the vocabulary
QUESTION_VOCAB_SP... | gpu_id = 0
batch_size = 64
val_batch_size = 100
num_output_units = 3000
max_words_in_question = 15
max_words_in_exp = 36
max_iterations = 50000
print_interval = 100
train_data_splits = 'train'
question_vocab_space = 'train'
answer_vocab_space = 'train'
exp_vocab_space = 'train'
vqa_pretrained = 'PATH_TO_PRETRAINED_VQA_... |
state_dict = {}
aug_dict = {}
oneof_dict = {}
def clear_dict(state):
skey = 'session'
if skey not in list(state_dict.keys()) or state != state_dict[skey]:
state_dict.clear()
state_dict.update({'session': state})
aug_dict.clear()
| state_dict = {}
aug_dict = {}
oneof_dict = {}
def clear_dict(state):
skey = 'session'
if skey not in list(state_dict.keys()) or state != state_dict[skey]:
state_dict.clear()
state_dict.update({'session': state})
aug_dict.clear() |
# Given an array, cyclically rotate the array clockwise by one.
def rotateCyclic(a):
start = 0
end = 1
while(end != len(a)):
temp = a[start]
a[start] = a[end]
a[end] = temp
end += 1
a = [1,2,3,4,5,6]
rotateCyclic(a)
print(a)
| def rotate_cyclic(a):
start = 0
end = 1
while end != len(a):
temp = a[start]
a[start] = a[end]
a[end] = temp
end += 1
a = [1, 2, 3, 4, 5, 6]
rotate_cyclic(a)
print(a) |
s = 'hello world'
y =[]
for i in s.split(' '):
x=i[0].upper() + i[1:]
y.append(x)
z= ' '.join(y)
print(z)
| s = 'hello world'
y = []
for i in s.split(' '):
x = i[0].upper() + i[1:]
y.append(x)
z = ' '.join(y)
print(z) |
def removeTheLoop(head):
##Your code here
if detectloop(head)==0:
return
one=head
two=head
while(one and two and two.next):
one=one.next
two=two.next.next
#print(one.data,two.data)
if one==two:
f=one
break
#print(f.data)
... | def remove_the_loop(head):
if detectloop(head) == 0:
return
one = head
two = head
while one and two and two.next:
one = one.next
two = two.next.next
if one == two:
f = one
break
temp = head
while temp != f:
if temp.next == f.next:
... |
#!usr/bin/env python3
def main():
print('Reading text files')
f = open('lines.txt') # open returns a file object, that's an iterator. by default it opens in read & text mode
for line in f:
print(line.rstrip()) # Return a copy of the string with trailing whitespace removed
print('\nWriting t... | def main():
print('Reading text files')
f = open('lines.txt')
for line in f:
print(line.rstrip())
print('\nWriting text files')
infile = open('lines.txt', 'rt')
outfile = open('lines-copy.txt', 'wt')
for line in infile:
print(line.rstrip(), file=outfile)
print('.', en... |
def mcd(a, b):
if a > b:
small = b
else:
small = a
for i in range(1, small+1):
if((a % i == 0) and (b % i == 0)):
mcd1 = i
return mcd1
a = int(input("intrduzca un numero:"))
b = int(input("intrduzca un segundo numero:"))
print ("The mcd is : ",end="... | def mcd(a, b):
if a > b:
small = b
else:
small = a
for i in range(1, small + 1):
if a % i == 0 and b % i == 0:
mcd1 = i
return mcd1
a = int(input('intrduzca un numero:'))
b = int(input('intrduzca un segundo numero:'))
print('The mcd is : ', end='')
print(mcd(a, b)) |
# Link: https://oj.leetcode.com/problems/longest-substring-without-repeating-characters/
class Solution:
# @return an integer
def lengthOfLongestSubstring(self, s):
d = {}
start = 0
maxlen = 0
for i, c in enumerate(s):
if c not in d.keys():
if (i - sta... | class Solution:
def length_of_longest_substring(self, s):
d = {}
start = 0
maxlen = 0
for (i, c) in enumerate(s):
if c not in d.keys():
if i - start + 1 > maxlen:
maxlen = i - start + 1
d[c] = i
else:
... |
class Number_Pad_To_Words():
let_to_num = {
'a': '2',
'b': '2',
'c': '2',
'd': '3',
'e': '3',
'f': '3',
'g': '4',
'h': '4',
'i': '4',
'j': '5',
'k': '5',
'l': '5',
'm': '6',
'n': '6',
'o': '6',
... | class Number_Pad_To_Words:
let_to_num = {'a': '2', 'b': '2', 'c': '2', 'd': '3', 'e': '3', 'f': '3', 'g': '4', 'h': '4', 'i': '4', 'j': '5', 'k': '5', 'l': '5', 'm': '6', 'n': '6', 'o': '6', 'p': '7', 'q': '7', 'r': '7', 's': '7', 't': '8', 'u': '8', 'v': '8', 'w': '9', 'x': '9', 'y': '9', 'z': '9'}
def __init... |
JOB_TYPES = [
('Delivery driver'),
('Web developer'),
('Lecturer'),
]
| job_types = ['Delivery driver', 'Web developer', 'Lecturer'] |
'''
mymod.py - counts the number of lines and chars in the file.
'''
def countLines(name):
'''
countLines(name) - counts the number of lines in the file "name".
Example: countLines("/home/test_user1/test_dir1/test.txt")
'''
file = open(name)
return len(file.readlines())
d... | """
mymod.py - counts the number of lines and chars in the file.
"""
def count_lines(name):
"""
countLines(name) - counts the number of lines in the file "name".
Example: countLines("/home/test_user1/test_dir1/test.txt")
"""
file = open(name)
return len(file.readlines())
d... |
#!/usr/bin/env python3
# Parse input
with open("14/input.txt", "r") as fd:
seq = list(fd.readline().rstrip())
fd.readline()
line = fd.readline().rstrip()
instr = dict()
while line:
i = tuple([x for x in line.split(" -> ")])
instr[i[0]] = i[1]
line = fd.readline().rstrip()
... | with open('14/input.txt', 'r') as fd:
seq = list(fd.readline().rstrip())
fd.readline()
line = fd.readline().rstrip()
instr = dict()
while line:
i = tuple([x for x in line.split(' -> ')])
instr[i[0]] = i[1]
line = fd.readline().rstrip()
counts = dict()
for (i, k) in zip(seq, s... |
x=5
while x < 10:
print(x)
x += 1
| x = 5
while x < 10:
print(x)
x += 1 |
src = Split('''
prov_app.c
''')
if aos_global_config.get("ERASE") == 1:
component.add_macros(CONFIG_ERASE_KEY);
component = aos_component('prov_app', src)
component.add_comp_deps('kernel/yloop', 'tools/cli', 'security/prov', 'security/prov/test')
component.add_global_macros('AOS_NO_WIFI')
| src = split('\n prov_app.c\n')
if aos_global_config.get('ERASE') == 1:
component.add_macros(CONFIG_ERASE_KEY)
component = aos_component('prov_app', src)
component.add_comp_deps('kernel/yloop', 'tools/cli', 'security/prov', 'security/prov/test')
component.add_global_macros('AOS_NO_WIFI') |
#!/usr/bin/env python3
# https://agc001.contest.atcoder.jp/tasks/agc001_a
n = int(input())
l = [int(x) for x in input().split()]
l.sort()
print(sum(l[::2]))
| n = int(input())
l = [int(x) for x in input().split()]
l.sort()
print(sum(l[::2])) |
N,*H = [int(x) for x in open(0).read().split()]
def solve(l, r):
if l>r:
return 0
min_=min(H[l:r+1])
for i in range(l,r+1):
H[i]-=min_
count=min_
i=l
while i<r:
while i<=r and H[i]==0: i+=1
s=i
while i<=r and H[i]>0: i+=1
count+=solve(s,i-1)
re... | (n, *h) = [int(x) for x in open(0).read().split()]
def solve(l, r):
if l > r:
return 0
min_ = min(H[l:r + 1])
for i in range(l, r + 1):
H[i] -= min_
count = min_
i = l
while i < r:
while i <= r and H[i] == 0:
i += 1
s = i
while i <= r and H[i]... |
# FizzBuzz
# Getting input from users for the max number to go to for FizzBuzz
ip = input("Enter the max number to go for FizzBuzz: \n")
# If user inputs a number this is executed
if (ip != ""):
for i in range(1, int(ip) + 1):
if (i % 3 == 0 and i%5 == 0):
print("FizzBuzz")
elif (i % 3... | ip = input('Enter the max number to go for FizzBuzz: \n')
if ip != '':
for i in range(1, int(ip) + 1):
if i % 3 == 0 and i % 5 == 0:
print('FizzBuzz')
elif i % 3 == 0:
print('Fizz')
elif i % 5 == 0:
print('Buzz')
else:
print(i)
else:
... |
town = input().lower()
sell_count = float(input())
if 0<=sell_count<=500:
if town == "sofia":
comission = sell_count*0.05
print(f'{comission:.2f}')
elif town=="varna":
comission = sell_count * 0.045
print(f'{comission:.2f}')
elif town == "plovdiv":
comission = sell_c... | town = input().lower()
sell_count = float(input())
if 0 <= sell_count <= 500:
if town == 'sofia':
comission = sell_count * 0.05
print(f'{comission:.2f}')
elif town == 'varna':
comission = sell_count * 0.045
print(f'{comission:.2f}')
elif town == 'plovdiv':
comission =... |
class Compass(object):
def __init__(self, spacedomains):
self.categories = tuple(spacedomains)
self.spacedomains = spacedomains
# check time compatibility between components
self._check_spacedomain_compatibilities(spacedomains)
def _check_spacedomain_compatibilities(self, spa... | class Compass(object):
def __init__(self, spacedomains):
self.categories = tuple(spacedomains)
self.spacedomains = spacedomains
self._check_spacedomain_compatibilities(spacedomains)
def _check_spacedomain_compatibilities(self, spacedomains):
for category in spacedomains:
... |
time1 = int(input())
time2 = int(input())
time3 = int(input())
sum = time1 + time2 + time3
minutes = int(sum / 60)
seconds = sum % 60
if seconds <= 9:
print('{0}:0{1}'.format(minutes, seconds))
else:
print('{0}:{1}'.format(minutes, seconds))
| time1 = int(input())
time2 = int(input())
time3 = int(input())
sum = time1 + time2 + time3
minutes = int(sum / 60)
seconds = sum % 60
if seconds <= 9:
print('{0}:0{1}'.format(minutes, seconds))
else:
print('{0}:{1}'.format(minutes, seconds)) |
#
# @lc app=leetcode id=908 lang=python3
#
# [908] Smallest Range I
#
# @lc code=start
class Solution:
def smallestRangeI(self, A: List[int], K: int) -> int:
mi, ma = min(A), max(A)
return 0 if ma - mi - 2*K <= 0 else ma - mi - 2*K
# @lc code=end
| class Solution:
def smallest_range_i(self, A: List[int], K: int) -> int:
(mi, ma) = (min(A), max(A))
return 0 if ma - mi - 2 * K <= 0 else ma - mi - 2 * K |
a = [[10,0],[10,0],[10,0],[10,0],[10,0],[10,0],[10,0],[10,0],[10,0],[10,0]]
step=30
def setup():
size(500,500)
smooth()
noStroke()
myInit()
def myInit():
for i in range(len(a)):
a[i]=[random(0,10)]
for j in range(len(a[i])):
a[i][j]=random(0,30)
def draw():
global ste... | a = [[10, 0], [10, 0], [10, 0], [10, 0], [10, 0], [10, 0], [10, 0], [10, 0], [10, 0], [10, 0]]
step = 30
def setup():
size(500, 500)
smooth()
no_stroke()
my_init()
def my_init():
for i in range(len(a)):
a[i] = [random(0, 10)]
for j in range(len(a[i])):
a[i][j] = random(... |
# porownania
print('----------')
print((1, 2, 3) < (1, 2, 4))
print([1, 2, 3] < [1, 2, 4])
print('ABC' < 'C' < 'Pascal' < 'Python')
print((1, 2, 3, 4) < (1, 2, 4))
print((1, 2) < (1, 2, -1))
print((1, 2, 3) == (1.0, 2.0, 3.0))
print((1, 2, ('aa', 'ab')) < (1, 2, ('abc', 'a'), 4))
print('--- inne ---')
print(list((1, ... | print('----------')
print((1, 2, 3) < (1, 2, 4))
print([1, 2, 3] < [1, 2, 4])
print('ABC' < 'C' < 'Pascal' < 'Python')
print((1, 2, 3, 4) < (1, 2, 4))
print((1, 2) < (1, 2, -1))
print((1, 2, 3) == (1.0, 2.0, 3.0))
print((1, 2, ('aa', 'ab')) < (1, 2, ('abc', 'a'), 4))
print('--- inne ---')
print(list((1, 2, 3)) < [1, 2,... |
################################### SERVER'S SIDE ###################################
#const
mask = 0xffffffff
#bitwise operations have the least priority
#Note 1: all variables are unsigned 32-bit quantities and wrap modulo 2**32 when calculating, except for
#ml, message length: 64-bit quantity, and
... | mask = 4294967295
key = b'SuPeR_sEcReT_kEy,_NoT_tO_bE_gUeSsEd_So_EaSiLy'
def big_endian_64_bit(num):
num = hex(num).replace('0x', '').rjust(16, '0')
return bytes([int(num[i:i + 2], 16) for i in range(0, len(num), 2)])
def leftrot(num):
return (num << 1 & mask) + (num >> 31)
def bytes2int(block):
retu... |
# DOCUMENTATION
# main
def main():
canadian = {"red", "white"}
british = {"red", "blue", "white"}
italian = {"red", "white", "green"}
if canadian.issubset(british):
print("canadian flag colours occur in british")
if not italian.issubset(british):
print("not all italian flag colors... | def main():
canadian = {'red', 'white'}
british = {'red', 'blue', 'white'}
italian = {'red', 'white', 'green'}
if canadian.issubset(british):
print('canadian flag colours occur in british')
if not italian.issubset(british):
print('not all italian flag colors occur in british')
fr... |
# @desc Predict the returned value
# @desc by Savonnah '23
def calc(num):
if num <= 10:
result = num * 2
else:
result = num * 10
return result
def main():
print(calc(1))
print(calc(41))
print(calc(-5))
print(calc(3))
print(calc(10))
if __name__ == '__main__':
main... | def calc(num):
if num <= 10:
result = num * 2
else:
result = num * 10
return result
def main():
print(calc(1))
print(calc(41))
print(calc(-5))
print(calc(3))
print(calc(10))
if __name__ == '__main__':
main() |
### PROBLEM 3
degF = 40.5
degC = (5/9) * (degF - 32)
print(degC)
#when degF is -40.0, degC is -40.0
##when degF is 40.5, degC is 4.72 | deg_f = 40.5
deg_c = 5 / 9 * (degF - 32)
print(degC) |
#
# @lc app=leetcode id=1290 lang=python3
#
# [1290] Convert Binary Number in a Linked List to Integer
#
# @lc code=start
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def getDecimalValue(self, ... | class Solution:
def get_decimal_value(self, head: ListNode) -> int:
decimal = 0
while head:
decimal <<= 1
decimal |= head.val
head = head.next
return decimal |
#!/usr/bin/python3
def palindrome(num):
if num == num[::-1]:
return True
return False
def addOne(num):
num = int(num) + 1
return str(num)
def isPalindrome(num):
num = str(num)
num = num.zfill(6)
value = palindrome(num[2:])
if value:
num = num.zfill(6)
value... | def palindrome(num):
if num == num[::-1]:
return True
return False
def add_one(num):
num = int(num) + 1
return str(num)
def is_palindrome(num):
num = str(num)
num = num.zfill(6)
value = palindrome(num[2:])
if value:
num = num.zfill(6)
value2 = palindrome(num[1:]... |
a = int(input())
b = int(a/5)
if (a%5 == 0):
print(b)
else:
print(b+1)
| a = int(input())
b = int(a / 5)
if a % 5 == 0:
print(b)
else:
print(b + 1) |
# Day8 of my 100DaysOfCode Challenge
# Program to open a file in append mode
file = open('Day8/new.txt', 'a')
file.write("This is a really great experience")
file.close()
| file = open('Day8/new.txt', 'a')
file.write('This is a really great experience')
file.close() |
#!/usr/bin/python
def max_in_list(list_of_numbers):
'''
Finds the largest number in a list
'''
biggest_num = 0
for i in list_of_numbers:
if i > biggest_num:
biggest_num = i
return(biggest_num)
| def max_in_list(list_of_numbers):
"""
Finds the largest number in a list
"""
biggest_num = 0
for i in list_of_numbers:
if i > biggest_num:
biggest_num = i
return biggest_num |
{
"targets":[
{
"target_name": "accessor",
"sources": ["accessor.cpp"]
}
]
} | {'targets': [{'target_name': 'accessor', 'sources': ['accessor.cpp']}]} |
# terrascript/data/Trois-Six/sendgrid.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:26:45 UTC)
__all__ = []
| __all__ = [] |
__author__ = 'arobres, jfernandez'
# PUPPET WRAPPER CONFIGURATION
PUPPET_MASTER_PROTOCOL = 'https'
PUPPET_WRAPPER_IP = 'puppet-master.dev-havana.fi-ware.org'
PUPPET_WRAPPER_PORT = 8443
PUPPET_MASTER_USERNAME = 'root'
PUPPET_MASTER_PWD = '**********'
PUPPET_WRAPPER_MONGODB_PORT = 27017
PUPPET_WRAPPER_MONGODB_DB_NAME = ... | __author__ = 'arobres, jfernandez'
puppet_master_protocol = 'https'
puppet_wrapper_ip = 'puppet-master.dev-havana.fi-ware.org'
puppet_wrapper_port = 8443
puppet_master_username = 'root'
puppet_master_pwd = '**********'
puppet_wrapper_mongodb_port = 27017
puppet_wrapper_mongodb_db_name = 'puppetWrapper'
puppet_wrapper_m... |
'''
A simple programme to print hex grid on terminal screen.
Tip: I have used `raw` strings.
Author: Sunil Dhaka
'''
GRID_WIDTH=20
GRID_HEIGHT=16
def main():
for _ in range(GRID_HEIGHT):
for _ in range(GRID_WIDTH):
print(r'/ \_',end='')
print()
for _ in range(GRID_WIDTH):
... | """
A simple programme to print hex grid on terminal screen.
Tip: I have used `raw` strings.
Author: Sunil Dhaka
"""
grid_width = 20
grid_height = 16
def main():
for _ in range(GRID_HEIGHT):
for _ in range(GRID_WIDTH):
print('/ \\_', end='')
print()
for _ in range(GRID_WIDTH):
... |
'''
Order the following functions by asymptotic growth rate.
4nlog n+2n 210 2log n
3n+100log n 4n 2n
n2 +10n n3 nlog n
'''
'''
2^10 O(1)
3n+100log(n) O(log(n))
4n O(n)
4nlog(n)+2n and O(nlog(n))
n^2+10n and O(n^2)
n^3 O(n^3... | """
Order the following functions by asymptotic growth rate.
4nlog n+2n 210 2log n
3n+100log n 4n 2n
n2 +10n n3 nlog n
"""
'\n2^10 O(1)\n3n+100log(n) O(log(n))\n4n O(n)\n4nlog(n)+2n and O(nlog(n))\nn^2+10n and O(n^2)\nn^3 O... |
# encoding = utf-8
class GreekGetter:
def get(self, msgid):
return msgid[::-1]
class EnglishGetter:
def get(self, msgid):
return msgid[:]
def get_localizer(language="English"):
languages = dict(English=EnglishGetter, Greek=GreekGetter)
return languages[language]()
# Create our localizers
e, g = get_l... | class Greekgetter:
def get(self, msgid):
return msgid[::-1]
class Englishgetter:
def get(self, msgid):
return msgid[:]
def get_localizer(language='English'):
languages = dict(English=EnglishGetter, Greek=GreekGetter)
return languages[language]()
(e, g) = (get_localizer('English'), ge... |
print("Enter the number of terms:")
n=int(input())
a=0
b=1
for i in range(n+1):
c=a+b
a=b
b=c
print(c,end=" ")
| print('Enter the number of terms:')
n = int(input())
a = 0
b = 1
for i in range(n + 1):
c = a + b
a = b
b = c
print(c, end=' ') |
class Foo:
def __init__(self):
self.tmp = False
def extract_method(self, condition1, condition2, condition3, condition4):
list = (1, 2, 3)
a = 6
b = False
if a in list or self.tmp:
if condition1:
print(condi... | class Foo:
def __init__(self):
self.tmp = False
def extract_method(self, condition1, condition2, condition3, condition4):
list = (1, 2, 3)
a = 6
b = False
if a in list or self.tmp:
if condition1:
print(condition1)
if b is not cond... |
# Escape Sequences
# \\
# \'
# \"
# \n
course_name = "Pyton Mastery \n with Mosh"
print(course_name)
| course_name = 'Pyton Mastery \n with Mosh'
print(course_name) |
class VolumeRaidLevels(object):
def read_get(self, name, idx_name, unity_client):
return unity_client.get_lun_raid_type(idx_name)
class VolumeRaidLevelsColumn(object):
def get_idx(self, name, idx, unity_client):
return unity_client.get_luns()
| class Volumeraidlevels(object):
def read_get(self, name, idx_name, unity_client):
return unity_client.get_lun_raid_type(idx_name)
class Volumeraidlevelscolumn(object):
def get_idx(self, name, idx, unity_client):
return unity_client.get_luns() |
NORTH = 0
EAST = 1
SOUTH = 2
WEST = 3
X_MOD = [0,1,0,-1]
Y_MOD = [1,0,-1,0]
num_states = 0
state_trans = []
infected_state = 0
class Node:
def __init__(self, state, x, y):
self.x = x
self.y = y
self.state = state
def updateDir(self, dir):
'''
Directions can be anyth... | north = 0
east = 1
south = 2
west = 3
x_mod = [0, 1, 0, -1]
y_mod = [1, 0, -1, 0]
num_states = 0
state_trans = []
infected_state = 0
class Node:
def __init__(self, state, x, y):
self.x = x
self.y = y
self.state = state
def update_dir(self, dir):
"""
Directions can be a... |
# uncompyle6 version 3.2.0
# Python bytecode 2.4 (62061)
# Decompiled from: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)]
# Embedded file name: pirates.makeapirate.MakeAPirateGlobals
BODYSHOP = 0
HEADSHOP = 1
MOUTHSHOP = 2
EYESSHOP = 3
NOSESHOP = 4
EARSHOP = 5
HAIRSHOP = 6
CLOTHE... | bodyshop = 0
headshop = 1
mouthshop = 2
eyesshop = 3
noseshop = 4
earshop = 5
hairshop = 6
clothesshop = 7
nameshop = 8
tattooshop = 9
jewelryshop = 10
avatar_pirate = 0
avatar_skeleton = 1
avatar_navy = 2
avatar_cast = 3
shop_names = ['BodyShop', 'HeadShop', 'MouthShop', 'EyesShop', 'NoseShop', 'EarShop', 'HairShop', ... |
def bubble_sort(nums: list[float]) -> list[float]:
is_sorted = True
for loop in range(len(nums) - 1):
for indx in range(len(nums) - loop - 1):
if nums[indx] > nums[indx + 1]:
is_sorted = False
nums[indx], nums[indx + 1] = nums[indx + 1], nums[indx]
i... | def bubble_sort(nums: list[float]) -> list[float]:
is_sorted = True
for loop in range(len(nums) - 1):
for indx in range(len(nums) - loop - 1):
if nums[indx] > nums[indx + 1]:
is_sorted = False
(nums[indx], nums[indx + 1]) = (nums[indx + 1], nums[indx])
... |
#
# PySNMP MIB module MPLS-LSR-STD-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MPLS-LSR-STD-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:43:25 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, single_value_constraint, value_size_constraint, constraints_union) ... |
n = int(input('How many sides the convex polygon have: '))
nd = (n * (n - 3)) / 2
print(f'The convex polygon have {nd} sides.')
| n = int(input('How many sides the convex polygon have: '))
nd = n * (n - 3) / 2
print(f'The convex polygon have {nd} sides.') |
# Minimal django settings to run tests
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = ()
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': './sqlite3.db',
}
}
SECRET_KEY = 'alksjdf93jqpijsdaklfjq;3lejqklejlakefjas'
TEMPLATE_LOADERS = (
'django.tem... | debug = True
template_debug = DEBUG
admins = ()
managers = ADMINS
databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': './sqlite3.db'}}
secret_key = 'alksjdf93jqpijsdaklfjq;3lejqklejlakefjas'
template_loaders = ('django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Lo... |
#!/usr/bin/env python
TOOL = "tool"
PRECISION = "precision"
RECALL = "recall"
AVG_PRECISION = "avg_precision"
STD_DEV_PRECISION = "std_dev_precision"
SEM_PRECISION = "sem_precision"
AVG_RECALL = "avg_recall"
STD_DEV_RECALL = "std_dev_recall"
SEM_RECALL = "sem_recall"
RI_BY_BP = "rand_index_by_bp"
RI_BY_SEQ = "rand_ind... | tool = 'tool'
precision = 'precision'
recall = 'recall'
avg_precision = 'avg_precision'
std_dev_precision = 'std_dev_precision'
sem_precision = 'sem_precision'
avg_recall = 'avg_recall'
std_dev_recall = 'std_dev_recall'
sem_recall = 'sem_recall'
ri_by_bp = 'rand_index_by_bp'
ri_by_seq = 'rand_index_by_seq'
ari_by_bp = ... |
# parameters used in experiment
# ==============================================================================
# optitrack communication ip (win10 is the server, the ubuntu receiving data is client)
# ==============================================================================
ip_win10 = '192.168.1.5'
ip_ubuntu_pc... | ip_win10 = '192.168.1.5'
ip_ubuntu_pc = '192.168.1.3'
lidar_port1 = '/dev/ttyUSB0'
lidar_port2 = '/dev/ttyUSB1'
lidar_port3 = '/dev/ttyUSB2'
lidar_port4 = '/dev/ttyUSB3'
lidar_por_ts = [LIDAR_PORT1, LIDAR_PORT2, LIDAR_PORT3]
car_to_lidar1_fo_v = dict(FoVs=[[0, 40], [320, 360]], rmax=1400)
car_to_lidar2_fo_v = dict(FoVs... |
Vocales = ("a","e","i","o","u", " ")
texto = input("Ingresar el texto: ")
texto_nuevo = 0
for letters in texto:
if letters not in Vocales:
texto_nuevo = texto_nuevo + 1
print("El numero de consonantes es: ", texto_nuevo) | vocales = ('a', 'e', 'i', 'o', 'u', ' ')
texto = input('Ingresar el texto: ')
texto_nuevo = 0
for letters in texto:
if letters not in Vocales:
texto_nuevo = texto_nuevo + 1
print('El numero de consonantes es: ', texto_nuevo) |
FILE_PATH = "data/cows.mp4"
MODEL_PATH = "model/mobilenet_v2_ssd_coco_frozen_graph.pb"
CONFIG_PATH = "model/mobilenet_v2_ssd_coco_config.pbtxt"
LABEL_PATH = "model/coco_class_labels.txt"
WINDOW_NAME = "detection"
MIN_CONF = 0.4
MAX_IOU = 0.5 | file_path = 'data/cows.mp4'
model_path = 'model/mobilenet_v2_ssd_coco_frozen_graph.pb'
config_path = 'model/mobilenet_v2_ssd_coco_config.pbtxt'
label_path = 'model/coco_class_labels.txt'
window_name = 'detection'
min_conf = 0.4
max_iou = 0.5 |
'''
data structures that used executive architecture
'''
class Command(object):
def __init__(self, Name, Payload):
self.Name = Name
self.Payload = Payload
class Gesture(object):
def __init__(self, ID, NAME, LastTimeSync,
IterableGesture, NumberOfGestureRepetitions,
... | """
data structures that used executive architecture
"""
class Command(object):
def __init__(self, Name, Payload):
self.Name = Name
self.Payload = Payload
class Gesture(object):
def __init__(self, ID, NAME, LastTimeSync, IterableGesture, NumberOfGestureRepetitions, NumberOfMotions, ListA... |
'''FreeProxy exceptions module'''
class FreeProxyException(Exception):
'''Exception class with message as a required parameter'''
def __init__(self, message) -> None:
self.message = message
super().__init__(self.message)
| """FreeProxy exceptions module"""
class Freeproxyexception(Exception):
"""Exception class with message as a required parameter"""
def __init__(self, message) -> None:
self.message = message
super().__init__(self.message) |
__all__ = ["SENTINEL1_COLLECTION_ID", "VV", "VH", "IW", "ASCENDING", "DESCENDING"]
SENTINEL1_COLLECTION_ID = "COPERNICUS/S1_GRD_FLOAT"
VV = "VV"
VH = "VH"
IW = "IW"
ASCENDING = "ASCENDING"
DESCENDING = "DESCENDING"
GEE_PROPERTIES = [
"system:id",
"sliceNumber",
"system:time_start",
"relativeOrbitNumber... | __all__ = ['SENTINEL1_COLLECTION_ID', 'VV', 'VH', 'IW', 'ASCENDING', 'DESCENDING']
sentinel1_collection_id = 'COPERNICUS/S1_GRD_FLOAT'
vv = 'VV'
vh = 'VH'
iw = 'IW'
ascending = 'ASCENDING'
descending = 'DESCENDING'
gee_properties = ['system:id', 'sliceNumber', 'system:time_start', 'relativeOrbitNumber_start', 'relative... |
start = 1
end = 100
for x in range(start,end):
if (x % 2 == 0):
continue
print(x) | start = 1
end = 100
for x in range(start, end):
if x % 2 == 0:
continue
print(x) |
class AggResult:
def __init__(self, agg_key, result=None, return_counts=True):
self.return_counts = return_counts
if result is None:
self.total = 0
self._hits = []
else:
self.total = result['hits']['total']['value']
self._hits = result['aggrega... | class Aggresult:
def __init__(self, agg_key, result=None, return_counts=True):
self.return_counts = return_counts
if result is None:
self.total = 0
self._hits = []
else:
self.total = result['hits']['total']['value']
self._hits = result['aggreg... |
class Solution:
def destCity(self, paths: List[List[str]]) -> str:
s = set()
for path in paths:
s.add(path[0])
s.add(path[1])
for path in paths:
s.remove(path[0])
return list(s).pop()
| class Solution:
def dest_city(self, paths: List[List[str]]) -> str:
s = set()
for path in paths:
s.add(path[0])
s.add(path[1])
for path in paths:
s.remove(path[0])
return list(s).pop() |
class Solution:
def checkString(self, s: str) -> bool:
flag = 0
for ch in s:
if flag == 0 and ch == 'b':
flag = 1
elif flag == 1 and ch == 'a':
return False
return True | class Solution:
def check_string(self, s: str) -> bool:
flag = 0
for ch in s:
if flag == 0 and ch == 'b':
flag = 1
elif flag == 1 and ch == 'a':
return False
return True |
class Node:
def __init__(self, data=None) -> None:
self.data = data
self.next = None
self.prev = None
class DoublyList:
def __init__(self) -> None:
self.front = None
self.back = None
self.size = 0
def add_back(self, data: int) -> None:
... | class Node:
def __init__(self, data=None) -> None:
self.data = data
self.next = None
self.prev = None
class Doublylist:
def __init__(self) -> None:
self.front = None
self.back = None
self.size = 0
def add_back(self, data: int) -> None:
node = node(... |
class AlmostPrimeNumbers:
def getNext(self, m):
sieve = [True]*(10**6+2)
for i in xrange(2, 10**6+2):
if sieve[i]:
for j in xrange(2*i, 10**6+2, i):
sieve[j] = False
def is_almost(n):
return not sieve[n] and not any(n%i == 0 for i i... | class Almostprimenumbers:
def get_next(self, m):
sieve = [True] * (10 ** 6 + 2)
for i in xrange(2, 10 ** 6 + 2):
if sieve[i]:
for j in xrange(2 * i, 10 ** 6 + 2, i):
sieve[j] = False
def is_almost(n):
return not sieve[n] and (not ... |
class LandingType(object):
# For choosing what the main landing page displays
KICKOFF = 1
BUILDSEASON = 2
COMPETITIONSEASON = 3
OFFSEASON = 4
INSIGHTS = 5
CHAMPS = 6
NAMES = {
KICKOFF: 'Kickoff',
BUILDSEASON: 'Build Season',
COMPETITIONSEASON: 'Competition Seas... | class Landingtype(object):
kickoff = 1
buildseason = 2
competitionseason = 3
offseason = 4
insights = 5
champs = 6
names = {KICKOFF: 'Kickoff', BUILDSEASON: 'Build Season', COMPETITIONSEASON: 'Competition Season', OFFSEASON: 'Offseason', INSIGHTS: 'Insights', CHAMPS: 'Championship'} |
#!/usr/bin/env python
polymer = input()
letters = [ord(c) for c in set(polymer.upper())]
polymer = [ord(c) for c in polymer]
def react(polymer, forbidden=set()):
stack = []
for unit in polymer:
if unit not in forbidden:
if stack and abs(unit - stack[-1]) == 32:
stack.po... | polymer = input()
letters = [ord(c) for c in set(polymer.upper())]
polymer = [ord(c) for c in polymer]
def react(polymer, forbidden=set()):
stack = []
for unit in polymer:
if unit not in forbidden:
if stack and abs(unit - stack[-1]) == 32:
stack.pop()
else:
... |
#!/usr/bin/env python3
class colors:
GREEN = '\033[92m'
YELLOW = '\033[93m'
BLUE = '\033[94m'
RED = '\033[91m'
BOLD = '\033[1m'
RESET = '\033[0m' | class Colors:
green = '\x1b[92m'
yellow = '\x1b[93m'
blue = '\x1b[94m'
red = '\x1b[91m'
bold = '\x1b[1m'
reset = '\x1b[0m' |
nombre_usuario = input("Introduce tu nombre de usuario: ")
print("El nombre es:", nombre_usuario)
print("El nombre es:", nombre_usuario.upper())
print("El nombre es:", nombre_usuario.lower())
print("El nombre es:", nombre_usuario.capitalize())
| nombre_usuario = input('Introduce tu nombre de usuario: ')
print('El nombre es:', nombre_usuario)
print('El nombre es:', nombre_usuario.upper())
print('El nombre es:', nombre_usuario.lower())
print('El nombre es:', nombre_usuario.capitalize()) |
class Node:
def __init__(self, value=None):
self.value = value
self.next = None
def __str__(self):
return str(self.value)
class LinkedList:
def __init__(self):
self.head = None
self.tail = None
def __iter__(self):
node = self.head
while node != N... | class Node:
def __init__(self, value=None):
self.value = value
self.next = None
def __str__(self):
return str(self.value)
class Linkedlist:
def __init__(self):
self.head = None
self.tail = None
def __iter__(self):
node = self.head
while node !... |
RELEVANT_COLUMNS = [
"HONG KONG",
"JAPAN",
"CANADA",
"FINLAND",
"DENMARK",
"ESTONIA",
"POLAND",
"CZECH REPUBLIC",
"SLOVENIA and BALKANs",
"ITALY",
"SPAIN",
"SWITZERLAND",
"BENELUX",
"UK",
"ISLAND",
"USA Wholesale",
"Germany/ Austria",
"Sweden/ Norw... | relevant_columns = ['HONG KONG', 'JAPAN', 'CANADA', 'FINLAND', 'DENMARK', 'ESTONIA', 'POLAND', 'CZECH REPUBLIC', 'SLOVENIA and BALKANs', 'ITALY', 'SPAIN', 'SWITZERLAND', 'BENELUX', 'UK', 'ISLAND', 'USA Wholesale', 'Germany/ Austria', 'Sweden/ Norway', 'Store', 'Marketplaces (AZ+ ZA)', 'Webshop (INK US, CAN, FIN)']
def... |
API = "api"
API_DEFAULT_DESCRIPTOR = "default"
API_ERROR_MESSAGES = "errorMessages"
API_QUERY_STRING = "query_string"
API_RESOURCE = "resource_name"
API_RETURN = "on_return"
COLUMN_FORMATING = "column_formating"
COLUMN_CLEANING = "column_cleaning"
COLUMN_EXPANDING = "column_expending"
DEFAULT_COLUMNS_TO_EXPAND = ["chan... | api = 'api'
api_default_descriptor = 'default'
api_error_messages = 'errorMessages'
api_query_string = 'query_string'
api_resource = 'resource_name'
api_return = 'on_return'
column_formating = 'column_formating'
column_cleaning = 'column_cleaning'
column_expanding = 'column_expending'
default_columns_to_expand = ['chan... |
region = 'us-west-2'
default_vpc = dict(
enable_dns_hostnames=True,
cidr_block='10.0.0.0/16',
tags={'Name': 'default'},
)
default_gateway = dict(vpc_id='${aws_vpc.default.id}')
internet_access_route = dict(
route_table_id='${aws_vpc.default.main_route_table_id}',
destination_cidr_block='0.0.0.0/0',
g... | region = 'us-west-2'
default_vpc = dict(enable_dns_hostnames=True, cidr_block='10.0.0.0/16', tags={'Name': 'default'})
default_gateway = dict(vpc_id='${aws_vpc.default.id}')
internet_access_route = dict(route_table_id='${aws_vpc.default.main_route_table_id}', destination_cidr_block='0.0.0.0/0', gateway_id='${aws_intern... |
class BlackjackWinner:
def winnings(self, bet, dealer, dealerBlackjack, player, blackjack):
if player > 21 or (player < dealer and dealer <= 21):
return -bet
if dealerBlackjack and blackjack:
return 0
if dealerBlackjack and not blackjack:
return -bet
... | class Blackjackwinner:
def winnings(self, bet, dealer, dealerBlackjack, player, blackjack):
if player > 21 or (player < dealer and dealer <= 21):
return -bet
if dealerBlackjack and blackjack:
return 0
if dealerBlackjack and (not blackjack):
return -bet
... |
# --------------------------------------
#! /usr/bin/python
# File: 977. Squared of a Sorted Array.py
# Author: Kimberly Gao
# My solution: (Run time: 132ms) (from website)
# Memory Usage: 15.6 MB
class Solution:
def _init_(self,name):
self.name = name
# Only for python. Using function sort()
# W... | class Solution:
def _init_(self, name):
self.name = name
def sorted_squares1(self, nums):
for i in range(nums):
nums[i] *= nums[i]
nums.sort()
return nums
def sorted_squares2(self, nums):
return sorted([v ** 2 for v in nums])
def sorted_squares3(se... |
class GameStatus:
OPEN = 'OPEN'
CLOSED = 'CLOSED'
READY = 'READY'
IN_PLAY = 'IN_PLAY'
ENDED = 'ENDED'
class Action:
MOVE_UP = 'MOVE_UP'
MOVE_LEFT = 'MOVE_LEFT'
MOVE_DOWN = 'MOVE_DOWN'
MOVE_RIGHT = 'MOVE_RIGHT'
ATTACK_UP = 'ATTACK_UP'
ATTACK_LEFT = 'ATTACK_LEFT'
ATTACK_D... | class Gamestatus:
open = 'OPEN'
closed = 'CLOSED'
ready = 'READY'
in_play = 'IN_PLAY'
ended = 'ENDED'
class Action:
move_up = 'MOVE_UP'
move_left = 'MOVE_LEFT'
move_down = 'MOVE_DOWN'
move_right = 'MOVE_RIGHT'
attack_up = 'ATTACK_UP'
attack_left = 'ATTACK_LEFT'
attack_do... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.