content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# Created by MechAviv
# ID :: [4000022]
# Maple Road : Adventurer Training Center 1
sm.showFieldEffect("maplemap/enter/1010100", 0) | sm.showFieldEffect('maplemap/enter/1010100', 0) |
# simplify_fraction.py
def validate_input_simplify(fraction):
if type(fraction) is not tuple:
raise Exception('Argument can only be of type "tuple".')
if len(fraction) != 2:
raise Exception('Tuple can only contain 2 elements.')
if type(fraction[0]) != int or type(fraction[1]) != int:
raise Exception('Tuple ca... | def validate_input_simplify(fraction):
if type(fraction) is not tuple:
raise exception('Argument can only be of type "tuple".')
if len(fraction) != 2:
raise exception('Tuple can only contain 2 elements.')
if type(fraction[0]) != int or type(fraction[1]) != int:
raise exception('Tuple... |
items3 = ["Mic", "Phone", 323.12, 3123.123, "Justin", "Bag", "Cliff Bars", 134]
def my_sum_and_count(my_num_list):
total = 0
count = 0
for i in my_num_list:
if isinstance(i, float) or isinstance(i, int):
total += i
count += 1
return total, count
def my_avg(my_num_lis... | items3 = ['Mic', 'Phone', 323.12, 3123.123, 'Justin', 'Bag', 'Cliff Bars', 134]
def my_sum_and_count(my_num_list):
total = 0
count = 0
for i in my_num_list:
if isinstance(i, float) or isinstance(i, int):
total += i
count += 1
return (total, count)
def my_avg(my_num_list... |
# coding: utf-8
PI = [58, 50, 42, 34, 26, 18, 10, 2,
60, 52, 44, 36, 28, 20, 12, 4,
62, 54, 46, 38, 30, 22, 14, 6,
64, 56, 48, 40, 32, 24, 16, 8,
57, 49, 41, 33, 25, 17, 9, 1,
59, 51, 43, 35, 27, 19, 11, 3,
61, 53, 45, 37, 29, 21, 13, 5,
63, 55, 47, 39, 31, 23, 15, 7]... | pi = [58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8, 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3, 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7]
cp_1 = [57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2... |
# Instructions: The following code example would print the data type of x, what data type would that be?
x = 20.5
print(type(x))
'''
Solution:
float
The inexact numbers are float type. Read more here: https://www.w3schools.com/python/python_datatypes.asp
''' | x = 20.5
print(type(x))
'\nSolution: \nfloat\nThe inexact numbers are float type. Read more here: https://www.w3schools.com/python/python_datatypes.asp\n' |
def print_sth(s):
print('print from module2: {}'.format(s))
if __name__ == "__main__":
s = 'test in main'
print_sth(s) | def print_sth(s):
print('print from module2: {}'.format(s))
if __name__ == '__main__':
s = 'test in main'
print_sth(s) |
#
# PySNMP MIB module FC-MGMT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FC-MGMT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:05:00 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 0... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection) ... |
EXPOSED_CRED_POLICY = 'AWSExposedCredentialPolicy_DO_NOT_REMOVE'
def rule(event):
request_params = event.get('requestParameters', {})
if request_params:
return (event['eventName'] == 'PutUserPolicy' and
request_params.get('policyName') == EXPOSED_CRED_POLICY)
return False
def ded... | exposed_cred_policy = 'AWSExposedCredentialPolicy_DO_NOT_REMOVE'
def rule(event):
request_params = event.get('requestParameters', {})
if request_params:
return event['eventName'] == 'PutUserPolicy' and request_params.get('policyName') == EXPOSED_CRED_POLICY
return False
def dedup(event):
retur... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def levelOrderBottom(self, root: Optional[TreeNode]) -> List[List[int]]:
result = []
depth =... | class Solution:
def level_order_bottom(self, root: Optional[TreeNode]) -> List[List[int]]:
result = []
depth = -1
def backtrack(root, curr):
nonlocal depth
if not root:
return
if curr > depth:
result.append([])
... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param {TreeNode} root
# @return {string[]}
def binaryTreePaths(self, root):
if not root:
return []
... | class Solution:
def binary_tree_paths(self, root):
if not root:
return []
if not root.left and (not root.right):
return [str(root.val)]
return map(lambda x: str(root.val) + '->' + x, self.binaryTreePaths(root.left)) + map(lambda x: str(root.val) + '->' + x, self.bina... |
def inc(x):
return x + 1
def dec(x):
return x - 1
def floor(par):
x = 0
y = 1
for i in par:
x = inc(x) if i == "(" else dec(x)
if x == -1:
return y
y += 1
return x
print(floor(
"((((()(()(((((((()))(((()((((()())(())()(((()((((((()((()(()(((()(()((()... | def inc(x):
return x + 1
def dec(x):
return x - 1
def floor(par):
x = 0
y = 1
for i in par:
x = inc(x) if i == '(' else dec(x)
if x == -1:
return y
y += 1
return x
print(floor('((((()(()(((((((()))(((()((((()())(())()(((()((((((()((()(()(((()(()((())))()((()... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def get_input(path):
with open(path) as infile:
return [line.rstrip('\n') for line in infile]
| def get_input(path):
with open(path) as infile:
return [line.rstrip('\n') for line in infile] |
#
# PySNMP MIB module JUNIPER-SMI (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/JUNIPER-SMI
# Produced by pysmi-0.3.4 at Wed May 1 11:37:53 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 0... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, constraints_union, constraints_intersection, single_value_constraint) ... |
# Hexadecimal
print(hex(12))
print(hex(512))
# Binary
print(bin(128))
print(bin(512))
# Exponential
print(pow(2, 4))
print(pow(2, 4, 3))
# Absolute value
print(abs(2))
# Round
print(round(3.6)) # Round up
print(round(3.4)) # Round down
print(round(3.4, 2)) # Round down
| print(hex(12))
print(hex(512))
print(bin(128))
print(bin(512))
print(pow(2, 4))
print(pow(2, 4, 3))
print(abs(2))
print(round(3.6))
print(round(3.4))
print(round(3.4, 2)) |
def nonConstructibleChange(coins):
if len(coins) == 0:
return 1
coins.sort()
change = 0
for coin in coins:
if coin > change + 1:
return change + 1
change += coin
return change + 1 | def non_constructible_change(coins):
if len(coins) == 0:
return 1
coins.sort()
change = 0
for coin in coins:
if coin > change + 1:
return change + 1
change += coin
return change + 1 |
for i in range(int(input())):
n = int(input())
a = []
for j in range(n):
l,r = [int(k) for k in input().split()]
a.append((l,0))
a.append((r,1))
a.sort()
c = 0
f = 0
m = 1e5
for j in a:
if(j[1]):
f=1
c-=1
else:
i... | for i in range(int(input())):
n = int(input())
a = []
for j in range(n):
(l, r) = [int(k) for k in input().split()]
a.append((l, 0))
a.append((r, 1))
a.sort()
c = 0
f = 0
m = 100000.0
for j in a:
if j[1]:
f = 1
c -= 1
else:
... |
class MyData:
def __del__(self):
print('test __del__ OK')
data = MyData()
| class Mydata:
def __del__(self):
print('test __del__ OK')
data = my_data() |
map_sokoban = {
"x" : 5,
"y" : 5
}
player = {
"x" : 0,
"y" : 4
}
boxes = [
{"x" : 1, "y" : 1},
{"x" : 2, "y" : 2},
{"x" : 3, "y" : 3}
]
destinations = [
{"x" : 2, "y" : 1},
{"x" : 3, "y" : 2},
{"x" : 4, "y" : 3}
]
while True:
for y in range(map_sokoban["y"]):
for x... | map_sokoban = {'x': 5, 'y': 5}
player = {'x': 0, 'y': 4}
boxes = [{'x': 1, 'y': 1}, {'x': 2, 'y': 2}, {'x': 3, 'y': 3}]
destinations = [{'x': 2, 'y': 1}, {'x': 3, 'y': 2}, {'x': 4, 'y': 3}]
while True:
for y in range(map_sokoban['y']):
for x in range(map_sokoban['x']):
box_is_here = False
... |
class Queue:
def __init__(self):
self.queue = []
def enqueue(self, item):
self.queue.insert(0, item)
def dequeue(self):
return self.queue.pop()
def size(self):
return len(self.queue)
def is_empty(self):
return self.queue == [] | class Queue:
def __init__(self):
self.queue = []
def enqueue(self, item):
self.queue.insert(0, item)
def dequeue(self):
return self.queue.pop()
def size(self):
return len(self.queue)
def is_empty(self):
return self.queue == [] |
class Solution:
def addToArrayForm(self, A, K):
for i in range(len(A))[::-1]:
A[i], K = (A[i] + K) % 10, (A[i] + K) // 10
return [int(i) for i in str(K)] + A if K else A | class Solution:
def add_to_array_form(self, A, K):
for i in range(len(A))[::-1]:
(A[i], k) = ((A[i] + K) % 10, (A[i] + K) // 10)
return [int(i) for i in str(K)] + A if K else A |
# use a func to create the matrix
def create_matrix(rows):
result = []
for _ in range(rows):
result.append(list(int(el) for el in input().split()))
return result
#read input
rows, columns = [int(el) for el in input().split()]
matrix = create_matrix(rows)
max_sum_square = -9999999999999
#create fo... | def create_matrix(rows):
result = []
for _ in range(rows):
result.append(list((int(el) for el in input().split())))
return result
(rows, columns) = [int(el) for el in input().split()]
matrix = create_matrix(rows)
max_sum_square = -9999999999999
for r in range(rows - 2):
for c in range(columns - ... |
def gnome_sort(a):
i, j, size = 1, 2, len(a)
while i < size:
if a[i-1] <= a[i]:
i, j = j, j+1
else:
a[i-1], a[i] = a[i], a[i-1]
i -= 1
if i == 0:
i, j = j, j+1
return a
| def gnome_sort(a):
(i, j, size) = (1, 2, len(a))
while i < size:
if a[i - 1] <= a[i]:
(i, j) = (j, j + 1)
else:
(a[i - 1], a[i]) = (a[i], a[i - 1])
i -= 1
if i == 0:
(i, j) = (j, j + 1)
return a |
# iteracyjne obliczanie silni
def silnia(n):
s = 1
for i in range(2,n+1):
s = s*i
return s
silnia(20)
| def silnia(n):
s = 1
for i in range(2, n + 1):
s = s * i
return s
silnia(20) |
def is_primel_4(n):
if n == 2:
return True # 2 is prime
if n % 2 == 0:
print(n, "is divisible by 2")
return False # all even numbers except 2 are not prime
if n < 2:
return False # numbers less then 2 are not prime
prime = True
m = n // 2 + 1
for x in range(3, ... | def is_primel_4(n):
if n == 2:
return True
if n % 2 == 0:
print(n, 'is divisible by 2')
return False
if n < 2:
return False
prime = True
m = n // 2 + 1
for x in range(3, m, 2):
if n % x == 0:
print(n, 'is divisible by', x)
prime = F... |
#
# PySNMP MIB module NETSCREEN-RESOURCE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NETSCREEN-RESOURCE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:20:16 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, constraints_union, single_value_constraint, value_range_constraint) ... |
class OrderDetail(object):
def __init__(self, pro_id, pro_count, storage_detail, half_storage_detail):
self.pro_id = pro_id
self.pro_count = pro_count
self.storage_count = storage_detail.get(pro_id=self.pro_id).pro_count
self.half_storage_count = half_storage_detail.get(half_id=self... | class Orderdetail(object):
def __init__(self, pro_id, pro_count, storage_detail, half_storage_detail):
self.pro_id = pro_id
self.pro_count = pro_count
self.storage_count = storage_detail.get(pro_id=self.pro_id).pro_count
self.half_storage_count = half_storage_detail.get(half_id=self... |
x = [1,2,3,1]
print(type(x))
print(dir(x))
print('count:',x.count(1)) # 2, number of times the input occurs
print('index:',x.index(1)) # returns location of input (first occurance)
print(x,' : x')
try:
x[0] = 1.2 # lists are mutable
except(TypeError) as e:
print(e)
print(x,' : x[0]= 1.2')
x.append(7)
print(x,' ... | x = [1, 2, 3, 1]
print(type(x))
print(dir(x))
print('count:', x.count(1))
print('index:', x.index(1))
print(x, ' : x')
try:
x[0] = 1.2
except TypeError as e:
print(e)
print(x, ' : x[0]= 1.2')
x.append(7)
print(x, ' : x.append(7) - on end')
x.extend([2, 3])
print(x, ' : x.extend([2,3]) - on end')
x.insert(3, 10)... |
def solveQuestion(inputPath):
fileP = open(inputPath, 'r')
fileLines = fileP.readlines()
fileP.close()
instructions = {}
toChangeInstructions = []
counter = 0
for valueLine in fileLines:
[instruction, value] = valueLine.strip('\n').split(' ')
instructions[counter] =... | def solve_question(inputPath):
file_p = open(inputPath, 'r')
file_lines = fileP.readlines()
fileP.close()
instructions = {}
to_change_instructions = []
counter = 0
for value_line in fileLines:
[instruction, value] = valueLine.strip('\n').split(' ')
instructions[counter] = [in... |
ERROR_API_VERSION_NOT_FOUND = ("API version found in neither request path (/api/v#) nor 'Accept' "
'header (version=#)')
ERROR_API_VERSION_UNSUPPORTED = 'Unsupported API version'
ERROR_EMPTY_REQUEST_BODY = 'Empty request body - valid JSON required'
ERROR_ONLY_JSON_REQUESTS = 'WandAPI on... | error_api_version_not_found = "API version found in neither request path (/api/v#) nor 'Accept' header (version=#)"
error_api_version_unsupported = 'Unsupported API version'
error_empty_request_body = 'Empty request body - valid JSON required'
error_only_json_requests = 'WandAPI only supports JSON encoded requests'
err... |
# Code generated by font_to_py.py.
# Font: Ubuntu-R.ttf
# Cmd: font_to_py.py /usr/share/fonts/truetype/ubuntu/Ubuntu-R.ttf 16 -x ubuntu16.py
version = '0.33'
def height():
return 16
def baseline():
return 13
def max_width():
return 15
def hmap():
return True
def reverse():
return False
def mon... | version = '0.33'
def height():
return 16
def baseline():
return 13
def max_width():
return 15
def hmap():
return True
def reverse():
return False
def monospaced():
return False
def min_ch():
return 32
def max_ch():
return 126
_font = b'\x06\x00\x00\x008D\x04\x04\x18 \x00\x00 \x... |
MERCADO_ABERTO = 1
MERCADO_FECHADO = 2
CAMPEONATO = 'campeonato'
TURNO = 'turno'
MES = 'mes'
RODADA = 'rodada'
PATRIMONIO = 'patrimonio'
| mercado_aberto = 1
mercado_fechado = 2
campeonato = 'campeonato'
turno = 'turno'
mes = 'mes'
rodada = 'rodada'
patrimonio = 'patrimonio' |
firstname = input("Enter first person name:")
secondname = input("Enter second person name:")
name = firstname + secondname
name = name.replace(" ","")
#print(name)
list = []
for x in name:
count = name.count(x)
if count > 0:
list.append(count)
name = name.replace(x,"").strip()
#print(list)
d... | firstname = input('Enter first person name:')
secondname = input('Enter second person name:')
name = firstname + secondname
name = name.replace(' ', '')
list = []
for x in name:
count = name.count(x)
if count > 0:
list.append(count)
name = name.replace(x, '').strip()
def addnums(list):
newl... |
DEPOSIT = "deposit"
DEPOSIT_STABLE = "deposit_stable"
MINT = "mint"
SEND = "send"
| deposit = 'deposit'
deposit_stable = 'deposit_stable'
mint = 'mint'
send = 'send' |
data = (
'ke', # 0x00
'keg', # 0x01
'kegg', # 0x02
'kegs', # 0x03
'ken', # 0x04
'kenj', # 0x05
'kenh', # 0x06
'ked', # 0x07
'kel', # 0x08
'kelg', # 0x09
'kelm', # 0x0a
'kelb', # 0x0b
'kels', # 0x0c
'kelt', # 0x0d
'kelp', # 0x0e
'kelh', # 0x0f
'kem', # 0x10
'keb', # ... | data = ('ke', 'keg', 'kegg', 'kegs', 'ken', 'kenj', 'kenh', 'ked', 'kel', 'kelg', 'kelm', 'kelb', 'kels', 'kelt', 'kelp', 'kelh', 'kem', 'keb', 'kebs', 'kes', 'kess', 'keng', 'kej', 'kec', 'kek', 'ket', 'kep', 'keh', 'kyeo', 'kyeog', 'kyeogg', 'kyeogs', 'kyeon', 'kyeonj', 'kyeonh', 'kyeod', 'kyeol', 'kyeolg', 'kyeolm',... |
Scale.default = Scale.chromatic
Root.default = 0
Clock.bpm = 80
print(Scale.names())
print(SynthDefs)
print(Samples)
print(FxList)
print(Attributes)
print(PatternMethods)
print(Clock.playing)
var.ch = var([7,0,5,0,3],[4,4,4,4,8])
~p1 >> play('x..t', room=1)
~p2 >> play('f', dur=PDur(3,16)*2, room=1)
~p3 >> play('<V>... | Scale.default = Scale.chromatic
Root.default = 0
Clock.bpm = 80
print(Scale.names())
print(SynthDefs)
print(Samples)
print(FxList)
print(Attributes)
print(PatternMethods)
print(Clock.playing)
var.ch = var([7, 0, 5, 0, 3], [4, 4, 4, 4, 8])
~p1 >> play('x..t', room=1)
~p2 >> play('f', dur=p_dur(3, 16) * 2, room=1)
~p3 >>... |
#
# PySNMP MIB module CPQHSV-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CPQHSV-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:27: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 2019, 09:... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, constraints_union, constraints_intersection, value_size_constraint) ... |
# Python Program To Create Emp Class
# And Make All The Members Of The Emp Class Available To Another Class ie. Myclass
'''
Function Name : This Class Contain Employee Details.
Function Date : 17 Sep 2020
Function Author : Prasad Dangare
Input : String,Integer
Output : String,... | """
Function Name : This Class Contain Employee Details.
Function Date : 17 Sep 2020
Function Author : Prasad Dangare
Input : String,Integer
Output : String,Integer
"""
class Emp:
def __init__(self, id, name, salary):
self.id = id
self.name = name
self.sala... |
pi = 3.1456
def funcao1(a, b):
return a + b
| pi = 3.1456
def funcao1(a, b):
return a + b |
# 2. Sum Matrix Columns
# Write a program that reads a matrix from the console and prints the sum for each column on separate lines.
# On the first line, you will get matrix sizes in format "{rows}, {columns}".
# On the next rows, you will get elements for each column separated with a single space.
# rows, cols = [int... | (rows, cols) = [int(el) for el in input().split(', ')]
matrix = []
for row in range(rows):
matrix.append([int(el) for el in input().split()])
for col in range(cols):
sum_col = 0
for row in range(rows):
sum_col += matrix[row][col]
print(sum_col) |
##Patterns: E0100
class Test():
##Err: E0100
def __init__(self):
for i in (1, 2, 3):
yield i * i | class Test:
def __init__(self):
for i in (1, 2, 3):
yield (i * i) |
class ChromaprintNotFoundException(Exception):
pass
class FingerprintGenerationError(Exception):
pass
class WebServiceError(Exception):
pass
class FileNotIdentifiedException(Exception):
pass
| class Chromaprintnotfoundexception(Exception):
pass
class Fingerprintgenerationerror(Exception):
pass
class Webserviceerror(Exception):
pass
class Filenotidentifiedexception(Exception):
pass |
class Sample():
# class object attribute
# same for any instant of a class
species = 'mammal'
def __init__(self, my_breed, name, spots):
# attributes
# we take in the argument
# Assign it using self.attribute_name
self.breed = my_breed
self.name = name
#... | class Sample:
species = 'mammal'
def __init__(self, my_breed, name, spots):
self.breed = my_breed
self.name = name
self.spots = spots
def bark(self, number):
print('Woof! My name is {} and number is {}'.format(self.name, number))
my_dog = sample(my_breed='Lab', name='Sammy'... |
# 23049 - WH 4th job advancement
BELLE = 2159111
GELIMERS_KEY_CARD = 4032743
SECRET_PLAZA = 310010000
sm.setSpeakerID(BELLE)
sm.sendNext("Did you destroy the Black Wings' new weapon? Nice work. I'm proud to have you in the Resistance.")
if sm.sendAskYesNo("But it's too early to celebrate. #p2154009# will show up with... | belle = 2159111
gelimers_key_card = 4032743
secret_plaza = 310010000
sm.setSpeakerID(BELLE)
sm.sendNext("Did you destroy the Black Wings' new weapon? Nice work. I'm proud to have you in the Resistance.")
if sm.sendAskYesNo("But it's too early to celebrate. #p2154009# will show up with his goons when he hears the news. ... |
# ----------------------------------------------------------------------------
# CLASSES: nightly
#
# Test Case: bov.py
#
# Tests: mesh - 3D rectilinear, multiple domain
# plots - Pseudocolor, Subset, Label, Contour
# operators - Slice
#
# Programmer: Brad Whitlock
# Date: ... | def save_test_image(name):
backup = get_save_window_attributes()
swa = save_window_attributes()
swa.width = 500
swa.height = 500
swa.screenCapture = 0
test(name, swa)
set_save_window_attributes(backup)
def test_bov_divide(prefix, db, doSubset):
open_database(db)
if doSubset:
... |
def record(data, source, target="_use_source_"):
if source in data:
# get source var value:
source_var_value = data[source]
# get target var name:
if target == "_use_source_":
target = source
# record variable:
_ttp_["vars"].update({target: source_var_valu... | def record(data, source, target='_use_source_'):
if source in data:
source_var_value = data[source]
if target == '_use_source_':
target = source
_ttp_['vars'].update({target: source_var_value})
_ttp_['global_vars'].update({target: source_var_value})
return (data, None... |
def print_formatted(number):
align = len(bin(number)[2:])
for num in range(1, number + 1):
n_dec = str(num)
n_oct = oct(num)[2:]
n_hex = hex(num)[2:].upper()
n_bin = bin(num)[2:]
print(n_dec.rjust(align), n_oct.rjust(align), n_hex.rjust(align), n_bin.rjust(align)) | def print_formatted(number):
align = len(bin(number)[2:])
for num in range(1, number + 1):
n_dec = str(num)
n_oct = oct(num)[2:]
n_hex = hex(num)[2:].upper()
n_bin = bin(num)[2:]
print(n_dec.rjust(align), n_oct.rjust(align), n_hex.rjust(align), n_bin.rjust(align)) |
#T# the following code shows how to do an algebraic determination that a quadrilateral is a parallelogram
#T# create the points of the quadrilateral
A = (0, 0)
B = (5, 0)
C = (8, 2.4)
D = (3, 2.4)
#T# calculate the slopes of the four sides
m_AB = (B[1] - A[1])/(B[0] - A[0]) # 0.0
m_BC = (C[1] - B[1])/(C[0] - B[0]) # ... | a = (0, 0)
b = (5, 0)
c = (8, 2.4)
d = (3, 2.4)
m_ab = (B[1] - A[1]) / (B[0] - A[0])
m_bc = (C[1] - B[1]) / (C[0] - B[0])
m_cd = (D[1] - C[1]) / (D[0] - C[0])
m_da = (A[1] - D[1]) / (A[0] - D[0])
bool_ab_cd = m_AB == m_CD
bool_bc_da = m_BC == m_DA |
EXPECTED_CREATE_REQUEST = {
'ServiceDeskPlus(val.ID===obj.ID)': {
'Request': {
'Subject': 'Create request test',
'Mode': {
'name': 'E-Mail',
'id': '123640000000006665'
},
'IsRead': False,
'CancellationRequested': Fal... | expected_create_request = {'ServiceDeskPlus(val.ID===obj.ID)': {'Request': {'Subject': 'Create request test', 'Mode': {'name': 'E-Mail', 'id': '123640000000006665'}, 'IsRead': False, 'CancellationRequested': False, 'IsTrashed': False, 'Id': '123456789', 'Group': {'site': None, 'deleted': False, 'name': 'Network', 'id':... |
# Declaracion de constantes.
PESO_HOT_WHEELS_REMOLQUE_TIBURON = 300
PESO_FUNKO_FELPA = 390
PRECIO_BARRA_PAN = 8.90
DESCUENTO_PAN_VIEJO = 0.20
| peso_hot_wheels_remolque_tiburon = 300
peso_funko_felpa = 390
precio_barra_pan = 8.9
descuento_pan_viejo = 0.2 |
# Copyright 2010-2018, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and ... | {'variables': {'relative_dir': 'renderer', 'gen_out_dir': '<(SHARED_INTERMEDIATE_DIR)/<(relative_dir)', 'conditions': [['branding=="GoogleJapaneseInput"', {'renderer_product_name_win': 'GoogleIMEJaRenderer'}, {'renderer_product_name_win': 'mozc_renderer'}]]}, 'targets': [{'target_name': 'table_layout', 'type': 'static_... |
class EventHook(object):
def __init__(self):
self.__handlers = []
def __iadd__(self, handler):
self.__handlers.append(handler)
return self
def __isub__(self, handler):
self.__handlers.remove(handler)
return self
def fire(self, *args, **keywargs):
for h... | class Eventhook(object):
def __init__(self):
self.__handlers = []
def __iadd__(self, handler):
self.__handlers.append(handler)
return self
def __isub__(self, handler):
self.__handlers.remove(handler)
return self
def fire(self, *args, **keywargs):
for h... |
# lec10prob2.py
# In lecture, we saw a version of linear search that used the fact that a set
# of elements is sorted in increasing order. Here is the code from lecture:
def search(L, e):
for i in range(len(L)):
if L[i] == e:
return True
if L[i] > e:
return False
return... | def search(L, e):
for i in range(len(L)):
if L[i] == e:
return True
if L[i] > e:
return False
return False
def search1(L, e):
for i in L:
if i == e:
return True
if i > e:
return False
return False
print(search([2, 5, 7, 10,... |
TEMPLATES_LOADED = "app.templates.loaded"
EXAMS_LOADED = "app.exams.loaded"
TEMPLATE_DIALOG_PATH_KEY = "template.dialog.path"
REPORT_DIALOG_PATH_KEY = "report.dialog.path"
EXAM_DIALOG_PATH_KEY = "exam.dialog.path"
PROCEED_TEMPLATE_DIALOG_PATH_KEY = "exam.proceed.dialog.path"
TEMPLATE_IMAGE_ZOOM = "template.image.zoom"
... | templates_loaded = 'app.templates.loaded'
exams_loaded = 'app.exams.loaded'
template_dialog_path_key = 'template.dialog.path'
report_dialog_path_key = 'report.dialog.path'
exam_dialog_path_key = 'exam.dialog.path'
proceed_template_dialog_path_key = 'exam.proceed.dialog.path'
template_image_zoom = 'template.image.zoom'
... |
#!/usr/bin/env python
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwa... | class Notfound(Exception):
pass
class Launchnodepoolexception(Exception):
statsd_key = 'error.nodepool'
class Launchstatusexception(Exception):
statsd_key = 'error.status'
class Launchnetworkexception(Exception):
statsd_key = 'error.network'
class Launchkeyscanexception(Exception):
statsd_key = ... |
resultados = str(input())
apuesta = str(input())
aciertos = 0
mirar = 0
hola = apuesta[3]
for x in resultados:
if x == apuesta[mirar]:
aciertos += 1
mirar += 1
print(aciertos)
| resultados = str(input())
apuesta = str(input())
aciertos = 0
mirar = 0
hola = apuesta[3]
for x in resultados:
if x == apuesta[mirar]:
aciertos += 1
mirar += 1
print(aciertos) |
l = open('input.txt').read().splitlines()
draw = list(map(int, l[0].split(',')))
boards = []
for i in range((len(l) - 1) // 6):
b = []
for j in range(5):
b.append(list(map(int, l[i * 6 + j + 2].split())))
boards.append(b)
# transform to sets
board_sets = []
for b in boards:
cur_sets = [set(r) f... | l = open('input.txt').read().splitlines()
draw = list(map(int, l[0].split(',')))
boards = []
for i in range((len(l) - 1) // 6):
b = []
for j in range(5):
b.append(list(map(int, l[i * 6 + j + 2].split())))
boards.append(b)
board_sets = []
for b in boards:
cur_sets = [set(r) for r in b]
cur_se... |
alien_0 = {'color': 'green', 'points':5}
print(alien_0['color'])
print(alien_0['points'])
print(alien_0)
alien_0['x_position'] = 0
alien_0['y_position'] = 25
print(alien_0)
alien_0 = {}
alien_0['color'] = 'green'
alien_0['points'] =5
print(alien_0)
alien_0 = {'color':'green'}
print(f"The alien is {alien_0['color']}."... | alien_0 = {'color': 'green', 'points': 5}
print(alien_0['color'])
print(alien_0['points'])
print(alien_0)
alien_0['x_position'] = 0
alien_0['y_position'] = 25
print(alien_0)
alien_0 = {}
alien_0['color'] = 'green'
alien_0['points'] = 5
print(alien_0)
alien_0 = {'color': 'green'}
print(f"The alien is {alien_0['color']}.... |
error_msg = {
"usedemail": "Email has already been used",
"email_format": "Please input a valid email.",
"no_email": "Please provide an email",
"usedname": "Username has already been taken",
"shortname": "Username must have at least three characters",
"no_letter": "Username should have a letter.... | error_msg = {'usedemail': 'Email has already been used', 'email_format': 'Please input a valid email.', 'no_email': 'Please provide an email', 'usedname': 'Username has already been taken', 'shortname': 'Username must have at least three characters', 'no_letter': 'Username should have a letter.', 'special_character': '... |
# Python Program to find Area of a Triangle
a = float(input('Please Enter the First side of a Triangle: '))
b = float(input('Please Enter the Second side of a Triangle: '))
c = float(input('Please Enter the Third side of a Triangle: '))
# calculate the Perimeter
Perimeter = a + b + c
# calculate the semi-perimeter
s... | a = float(input('Please Enter the First side of a Triangle: '))
b = float(input('Please Enter the Second side of a Triangle: '))
c = float(input('Please Enter the Third side of a Triangle: '))
perimeter = a + b + c
s = (a + b + c) / 2
area = (s * (s - a) * (s - b) * (s - c)) ** 0.5
print('\n The Perimeter of Traiangle ... |
#Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
#This program is free software; you can redistribute it and/or modify it under the terms of the BSD 0-Clause License.
#This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of ... | class Sensor:
def __init__(self, black_level, saturation, ccm, camera_name):
self.black_level = black_level
self.saturation = saturation
self.ccm = ccm
self.camera_name = camera_name
def to_dict(self):
return {'camera_name': self.camera_name, 'black_level': self.black_l... |
# Copyright (c) Project Jupyter.
# Distributed under the terms of the Modified BSD License.
__version__ = '0.7.16'
| __version__ = '0.7.16' |
#
# PySNMP MIB module CISCO-FABRICPATH-TOPOLOGY-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-FABRICPATH-TOPOLOGY-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:57:56 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ve... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, constraints_union, value_range_constraint, single_value_constraint) ... |
def mdc(m,n):
if n==0: return m
return mdc(n,m%n)
for k in range(int(input())):
A = input().split()
op = A[3]
A[0] = int(A[0])
A[1] = int(A[2])
A[2] = int(A[4])
A[3] = int(A[6])
res = [[],[]]
if op == '+':
res[0] = A[0]*A[3]+A[2]*A[1]
res[1] = A[1]*A[3]
elif ... | def mdc(m, n):
if n == 0:
return m
return mdc(n, m % n)
for k in range(int(input())):
a = input().split()
op = A[3]
A[0] = int(A[0])
A[1] = int(A[2])
A[2] = int(A[4])
A[3] = int(A[6])
res = [[], []]
if op == '+':
res[0] = A[0] * A[3] + A[2] * A[1]
res[1] =... |
''' Jonatan Paschoal 11/05/2020 - Crie um programa que receba nome de uma pessoa e verifique se ela te silva'''
print('---------------'*3)
nome = input('Digite o seu nome: ')
#------------------------------------------------------------
x = nome.lower()
y = 'silva' in x
#----------------------------------------------... | """ Jonatan Paschoal 11/05/2020 - Crie um programa que receba nome de uma pessoa e verifique se ela te silva"""
print('---------------' * 3)
nome = input('Digite o seu nome: ')
x = nome.lower()
y = 'silva' in x
print('Para o nome Silva, temos {}. '.format(y))
print('---------------' * 3) |
description = 'Julabo F25 for the Huginn-sans.'
pv_root = 'SES-HGNSANS-01:WTctrl-JUL25HL-001:'
devices = dict(
T_julabo=device(
'nicos.devices.epics.pva.EpicsAnalogMoveable',
description='The temperature',
readpv='{}TEMP'.format(pv_root),
writepv='{}TEMP:SP1'.format(pv_root),
... | description = 'Julabo F25 for the Huginn-sans.'
pv_root = 'SES-HGNSANS-01:WTctrl-JUL25HL-001:'
devices = dict(T_julabo=device('nicos.devices.epics.pva.EpicsAnalogMoveable', description='The temperature', readpv='{}TEMP'.format(pv_root), writepv='{}TEMP:SP1'.format(pv_root), targetpv='{}TEMP:SP1:RBV'.format(pv_root), ep... |
class Solution:
def checkRecord(self, n: int) -> int:
if n == 0: return 0
if n == 1: return 3
if n == 2: return 8
MAX = 1000000007
dp = [1, 2, 4]
i = 3
while i < n:
dp.append((dp[i - 1] + dp[i - 2] + dp[i - 3]) % MAX)
i += 1
... | class Solution:
def check_record(self, n: int) -> int:
if n == 0:
return 0
if n == 1:
return 3
if n == 2:
return 8
max = 1000000007
dp = [1, 2, 4]
i = 3
while i < n:
dp.append((dp[i - 1] + dp[i - 2] + dp[i - 3])... |
class House:
def __init__(self, price):
self._price = price
@property
def price(self):
return self._price
@price.setter
def price(self, new_price):
if new_price > 0 and isinstance(new_price, float):
self._price = new_price
else:
print("Pleas... | class House:
def __init__(self, price):
self._price = price
@property
def price(self):
return self._price
@price.setter
def price(self, new_price):
if new_price > 0 and isinstance(new_price, float):
self._price = new_price
else:
print('Pleas... |
class FE_SCRIPTS:
_fesname = ""
_miniDesc = ""
_totalDesc = ""
_Opt = {}
_author = ""
def __init__(self, fesname,miniDesc,totalDesc,Opt,author):
self._fesname = fesname
self._miniDesc = miniDesc
self._totalDesc = totalDesc
self._Opt = Opt
self._... | class Fe_Scripts:
_fesname = ''
_mini_desc = ''
_total_desc = ''
__opt = {}
_author = ''
def __init__(self, fesname, miniDesc, totalDesc, Opt, author):
self._fesname = fesname
self._miniDesc = miniDesc
self._totalDesc = totalDesc
self._Opt = Opt
self._aut... |
#
# PySNMP MIB module MERU-CONFIG-QOS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MERU-CONFIG-QOS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:01:10 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection, constraints_union) ... |
argent = int(input())
prixLivre = int(input())
print(argent // prixLivre)
| argent = int(input())
prix_livre = int(input())
print(argent // prixLivre) |
class Solution:
def maxWidthOfVerticalArea(self, points):
xs = sorted([x for x, y in points])
ans = 0
for i in range(len(xs) - 1):
ans = max(ans, xs[i+1] - xs[i])
return ans | class Solution:
def max_width_of_vertical_area(self, points):
xs = sorted([x for (x, y) in points])
ans = 0
for i in range(len(xs) - 1):
ans = max(ans, xs[i + 1] - xs[i])
return ans |
def meu_maximo(a=0, b=0, c=0, d=0, e=0):
return max((a, b, c, d, e))
def meu_maximo_infinito(**kwargs):
return max(kwargs.values())
dicionario = {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5}
print(meu_maximo(**dicionario))
print(meu_maximo_infinito(**dicionario)) | def meu_maximo(a=0, b=0, c=0, d=0, e=0):
return max((a, b, c, d, e))
def meu_maximo_infinito(**kwargs):
return max(kwargs.values())
dicionario = {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5}
print(meu_maximo(**dicionario))
print(meu_maximo_infinito(**dicionario)) |
while True:
try:
n = int(input())
v = []
for i in range(n):
v.append(float(input()))
print(sorted(v)[0])
except EOFError: break
| while True:
try:
n = int(input())
v = []
for i in range(n):
v.append(float(input()))
print(sorted(v)[0])
except EOFError:
break |
BOARD = 1
OUT = 1
IN = 1
HIGH = 1
LOW = 1
def setmode(*args, **kwargs):
print('moch gpio setmode')
def setup(*args, **kwargs):
print('moch gpio setup')
def output(*args, **kwargs):
print('moch gpio output')
def cleanup():
print('moch gpio clean up')
def setwarnings(*args, **kwargs):
print('set... | board = 1
out = 1
in = 1
high = 1
low = 1
def setmode(*args, **kwargs):
print('moch gpio setmode')
def setup(*args, **kwargs):
print('moch gpio setup')
def output(*args, **kwargs):
print('moch gpio output')
def cleanup():
print('moch gpio clean up')
def setwarnings(*args, **kwargs):
print('set ... |
class Shirt:
PRICE = 500
def __init__(self, quantity):
self._total_cost = quantity * Shirt.PRICE
print("Total cost:", self._total_cost)
if __name__ == "__main__":
shirt = Shirt(5); | class Shirt:
price = 500
def __init__(self, quantity):
self._total_cost = quantity * Shirt.PRICE
print('Total cost:', self._total_cost)
if __name__ == '__main__':
shirt = shirt(5) |
__all__ = ["adjust_energy",
"check_imputed_energies",
"csv2hdf5",
"mergetelescopes.py",
"merge_wrapper",
"normalisation",
"process_star",
"process_superstar",
"root2csv",
"newmultidirs.py",
"remove_events",
... | __all__ = ['adjust_energy', 'check_imputed_energies', 'csv2hdf5', 'mergetelescopes.py', 'merge_wrapper', 'normalisation', 'process_star', 'process_superstar', 'root2csv', 'newmultidirs.py', 'remove_events', 'process', 'melibea'] |
def lint_output(tool_xml, lint_ctx):
outputs = tool_xml.findall("./outputs/data")
if not outputs:
lint_ctx.warn("Tool contains no outputs, most tools should produce outputs.")
return
num_outputs = 0
for output in outputs:
num_outputs += 1
output_attrib = output.attrib
... | def lint_output(tool_xml, lint_ctx):
outputs = tool_xml.findall('./outputs/data')
if not outputs:
lint_ctx.warn('Tool contains no outputs, most tools should produce outputs.')
return
num_outputs = 0
for output in outputs:
num_outputs += 1
output_attrib = output.attrib
... |
BASE_URL = "https://www.codewars.com/"
USERNAME = "_behelit"
HEADERS = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
"AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/76.0.3809.100 "
"Safari/537.36",
}
DATA = {
"utf8": "",
"user[remember_me]": "true",
}
| base_url = 'https://www.codewars.com/'
username = '_behelit'
headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36'}
data = {'utf8': '', 'user[remember_me]': 'true'} |
class DataObject:
header = ''
def __init__(self, name):
self.name = name
if self.name == None:
self.name = ''
self.print_str = ' ' * 20
self.calories = 0
self.cal_carbs = 0
self.cal_fat = 0
self.cal_protein = 0
self.carbs = 0
... | class Dataobject:
header = ''
def __init__(self, name):
self.name = name
if self.name == None:
self.name = ''
self.print_str = ' ' * 20
self.calories = 0
self.cal_carbs = 0
self.cal_fat = 0
self.cal_protein = 0
self.carbs = 0
s... |
def is_valid(i):
# check if the number at index i is valid, i.e. the sum of two numbers in the previous 25 numbers
test_range = xmas_data[i - preamble:i]
test_value = xmas_data[i]
for a in test_range:
if (b := test_value - a) in test_range and a != b:
return True
return False
... | def is_valid(i):
test_range = xmas_data[i - preamble:i]
test_value = xmas_data[i]
for a in test_range:
if (b := (test_value - a)) in test_range and a != b:
return True
return False
f_name = 'input.txt'
with open(f_name, 'r') as f:
xmas_data = [int(x.strip('\n')) for x in f.readli... |
class ClassB(object):
def kw_1(self):
pass
| class Classb(object):
def kw_1(self):
pass |
def qt(a):
res = 0
n = len(a)
ldial, rdial = {}, {}
threat = []
for i in range(n):
j = a[i]
threat.append(0)
if i + j in ldial:
threat[i] += 1
pre = ldial[i + j][-1]
threat[pre] += 1
if threat[pre] == 4:
return 4... | def qt(a):
res = 0
n = len(a)
(ldial, rdial) = ({}, {})
threat = []
for i in range(n):
j = a[i]
threat.append(0)
if i + j in ldial:
threat[i] += 1
pre = ldial[i + j][-1]
threat[pre] += 1
if threat[pre] == 4:
retu... |
# https://leetcode.com/problems/maximum-population-year
def maximum_population(logs):
population_by_year = {}
for [birth, death] in logs:
for year in range(birth, death):
if year in population_by_year:
population_by_year[year] += 1
else:
popu... | def maximum_population(logs):
population_by_year = {}
for [birth, death] in logs:
for year in range(birth, death):
if year in population_by_year:
population_by_year[year] += 1
else:
population_by_year[year] = 1
earliest_year = 0
max_populat... |
n=5
for i in range (n):
for j in range (i,n-1):
print(' ', end='')
for k in range (i+1):
print('* ', end='')
for l in range (i+1, n):
print(' ', end=' ')
for m in range (i+1):
print('* ', end='')
print()
| n = 5
for i in range(n):
for j in range(i, n - 1):
print(' ', end='')
for k in range(i + 1):
print('* ', end='')
for l in range(i + 1, n):
print(' ', end=' ')
for m in range(i + 1):
print('* ', end='')
print() |
# Basic config for stuff that can be easily changed, but which is git-managed.
# See also apikeys_sample.py for the configs which are _not_ git-managed.
#server_domain = "http://www.infiniteglitch.net"
server_domain = "http://50.116.55.59"
http_port = 8888 # Port for the main web site, in debug mode
renderer_port = 88... | server_domain = 'http://50.116.55.59'
http_port = 8888
renderer_port = 8889
max_track_length = 400
min_track_length = 90 |
# Definition for singly-linked list.
class ListNode:
def __init__(self, val):
self.val = val
self.next = None # the pointer
node1 = ListNode(2)
node2 = ListNode(5)
node3 = ListNode(7)
node1.next = node2 # 2->5
node2.next = node3 # 5->7
# the entire linked list : 2->5->7
while node1:
pr... | class Listnode:
def __init__(self, val):
self.val = val
self.next = None
node1 = list_node(2)
node2 = list_node(5)
node3 = list_node(7)
node1.next = node2
node2.next = node3
while node1:
print(node1.val)
node1 = node1.next |
#To Calculate Surface area of a cylinder
#Formula = (2*3.14*r*h)+( 2*3.14*r*r)
r=float(input('Enter the radius of the Cylinder: '))
h=float(input('Enter the height of the Cylinder: '))
SA= (2*3.14*r*h) + ( 2*3.14*r*r)
print('The Surface Area is:', SA,'sq. m') | r = float(input('Enter the radius of the Cylinder: '))
h = float(input('Enter the height of the Cylinder: '))
sa = 2 * 3.14 * r * h + 2 * 3.14 * r * r
print('The Surface Area is:', SA, 'sq. m') |
# see credits.txt
aliceblue = "#F0F8FF"
antiquewhite = "#FAEBD7"
aqua = "#00FFFF"
aquamarine = "#7FFFD4"
azure = "#F0FFFF"
beige = "#F5F5DC"
bisque = "#FFE4C4"
blanchedalmond = "#FFEBCD"
blue = "#0000FF"
blueviolet = "#8A2BE2"
brown = "#A52A2A"
burlywood = "#DEB887"
cadetblue = "#5F9EA0"
chocolate = "#D2691E"
coral = ... | aliceblue = '#F0F8FF'
antiquewhite = '#FAEBD7'
aqua = '#00FFFF'
aquamarine = '#7FFFD4'
azure = '#F0FFFF'
beige = '#F5F5DC'
bisque = '#FFE4C4'
blanchedalmond = '#FFEBCD'
blue = '#0000FF'
blueviolet = '#8A2BE2'
brown = '#A52A2A'
burlywood = '#DEB887'
cadetblue = '#5F9EA0'
chocolate = '#D2691E'
coral = '#FF7F50'
cornflowe... |
courses = {}
line = input()
while line != "end":
course_info = line.split(" : ")
type_course = course_info[0]
student_name = course_info[1]
courses.setdefault(type_course, []).append(student_name)
line = input()
sorted_courses = dict(sorted(courses.items(), key=lambda x: (-len(x[1]))))
for curr... | courses = {}
line = input()
while line != 'end':
course_info = line.split(' : ')
type_course = course_info[0]
student_name = course_info[1]
courses.setdefault(type_course, []).append(student_name)
line = input()
sorted_courses = dict(sorted(courses.items(), key=lambda x: -len(x[1])))
for current_cou... |
def saveThePrisoner(n, m, s):
if (m+s-1)%n==0:
print(n)
else:
print((m+s-1)%n)
if __name__ == '__main__':
t = int(input())
for t_itr in range(t):
nms = input().split()
n = int(nms[0])
m = int(nms[1])
s = int(nms[2])
saveThePrisoner(n, m, s)
... | def save_the_prisoner(n, m, s):
if (m + s - 1) % n == 0:
print(n)
else:
print((m + s - 1) % n)
if __name__ == '__main__':
t = int(input())
for t_itr in range(t):
nms = input().split()
n = int(nms[0])
m = int(nms[1])
s = int(nms[2])
save_the_prisone... |
del_items(0x8009F828)
SetType(0x8009F828, "void VID_OpenModule__Fv()")
del_items(0x8009F8E8)
SetType(0x8009F8E8, "void InitScreens__Fv()")
del_items(0x8009F9D8)
SetType(0x8009F9D8, "void MEM_SetupMem__Fv()")
del_items(0x8009FA04)
SetType(0x8009FA04, "void SetupWorkRam__Fv()")
del_items(0x8009FA94)
SetType(0x8009FA94, "... | del_items(2148137000)
set_type(2148137000, 'void VID_OpenModule__Fv()')
del_items(2148137192)
set_type(2148137192, 'void InitScreens__Fv()')
del_items(2148137432)
set_type(2148137432, 'void MEM_SetupMem__Fv()')
del_items(2148137476)
set_type(2148137476, 'void SetupWorkRam__Fv()')
del_items(2148137620)
set_type(21481376... |
xa = {1, 2, 31, 41, 5}
pp = {1, 2, 3, 4, 5, 6}
pp = xa.clear() # Complementary to Intersection
print("XA:\n", xa, "\nPP:\n", pp)
| xa = {1, 2, 31, 41, 5}
pp = {1, 2, 3, 4, 5, 6}
pp = xa.clear()
print('XA:\n', xa, '\nPP:\n', pp) |
HOST = '0.0.0.0'
PORT = '8160'
#opencv supported formats
IMAGE_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'jpe', 'jp2', 'bmp', 'dip', 'pbm', 'pgm', 'ppm', 'sr', 'ras', 'tiff', 'tif', 'exr']) | host = '0.0.0.0'
port = '8160'
image_extensions = set(['png', 'jpg', 'jpeg', 'jpe', 'jp2', 'bmp', 'dip', 'pbm', 'pgm', 'ppm', 'sr', 'ras', 'tiff', 'tif', 'exr']) |
def unique_num(arr):
new = []
for val in arr:
if val not in new:
new.append(val)
return new
print(unique_num([2, 3, 3, 2, 1, 4, 5]))
| def unique_num(arr):
new = []
for val in arr:
if val not in new:
new.append(val)
return new
print(unique_num([2, 3, 3, 2, 1, 4, 5])) |
# coding=utf-8
class message(object):
'''Wrapper class for the messages sent in the blockchain.
It has a header of type 'message_header' and a payload of type 'message_payload'
The content type matches the message 'type' attribute'''
def __init__(self, header, payload):
self.check_types(header,... | class Message(object):
"""Wrapper class for the messages sent in the blockchain.
It has a header of type 'message_header' and a payload of type 'message_payload'
The content type matches the message 'type' attribute"""
def __init__(self, header, payload):
self.check_types(header, payload)
... |
class Vehicle:
def __init__(self, type, model, price):
self.type = type
self.model = model
self.price = price
self.owner = None
def buy(self, money: int, name: str):
if self.price > money:
return "Sorry, not enough money"
elif self.owner:
... | class Vehicle:
def __init__(self, type, model, price):
self.type = type
self.model = model
self.price = price
self.owner = None
def buy(self, money: int, name: str):
if self.price > money:
return 'Sorry, not enough money'
elif self.owner:
... |
def count_list(lists):
count = 0
for num in lists:
if num == 4:
count += 1
return count
new_list = [34, 4, 56, 4, 22]
print (count_list(new_list))
| def count_list(lists):
count = 0
for num in lists:
if num == 4:
count += 1
return count
new_list = [34, 4, 56, 4, 22]
print(count_list(new_list)) |
# -*- coding: utf-8 -*-
while True:
res = 0
d = {}
n = int(input())
if n == 0:
break
v = list(map(int, input().split()))
for num in v:
if str(num) not in d.keys():
d[str(num)] = 1
else:
d[str(num)] += 1
for k in d:
if d[... | while True:
res = 0
d = {}
n = int(input())
if n == 0:
break
v = list(map(int, input().split()))
for num in v:
if str(num) not in d.keys():
d[str(num)] = 1
else:
d[str(num)] += 1
for k in d:
if d[k] % 2 != 0:
res = int(k)
... |
# Author: Bhavith C
# Python Programming
print("Hello World!")
| print('Hello World!') |
class AttachmentSchema:
media_url: str
filename: str
dimensions: dict
class Attachment:
def __init__(self, attachment: AttachmentSchema, client):
self.media_url = attachment.get("media_url")
self.filename = attachment.get("filename")
self.dimensions = attachment.get("... | class Attachmentschema:
media_url: str
filename: str
dimensions: dict
class Attachment:
def __init__(self, attachment: AttachmentSchema, client):
self.media_url = attachment.get('media_url')
self.filename = attachment.get('filename')
self.dimensions = attachment.get('dimensions... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.