content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Solution(object):
def powerOfTwoBitManipulation(self, n):
"""
Time - O(1)
Space - O(1)
:type n: integer
:rtype: integer
"""
if n < 1:
return False
while n % 2 == 0:
n >>= 1
return n == 1
def powerOfTwoBitManip... | class Solution(object):
def power_of_two_bit_manipulation(self, n):
"""
Time - O(1)
Space - O(1)
:type n: integer
:rtype: integer
"""
if n < 1:
return False
while n % 2 == 0:
n >>= 1
return n == 1
def power_of_two_... |
if __name__ == '__main__':
# with open("input/12.test") as f:
with open("input/12.txt") as f:
lines = f.read().split("\n")
pots = lines[0].split(":")[1].strip()
rules = dict()
for line in lines[2:]:
[k, v] = line.split("=>")
k = k.strip()
v = v.strip()
rule... | if __name__ == '__main__':
with open('input/12.txt') as f:
lines = f.read().split('\n')
pots = lines[0].split(':')[1].strip()
rules = dict()
for line in lines[2:]:
[k, v] = line.split('=>')
k = k.strip()
v = v.strip()
rules[k] = v
print(rules)
ngen = 20
... |
expected_output = {
"ACL_TEST": {
"aces": {
"80": {
"actions": {"forwarding": "deny", "logging": "log-none"},
"matches": {
"l3": {
"ipv4": {
"source_network": {
... | expected_output = {'ACL_TEST': {'aces': {'80': {'actions': {'forwarding': 'deny', 'logging': 'log-none'}, 'matches': {'l3': {'ipv4': {'source_network': {'10.4.7.0 0.0.0.255': {'source_network': '10.4.7.0 0.0.0.255'}}, 'protocol': 'tcp', 'destination_network': {'host 192.168.16.1': {'destination_network': 'host 192.168.... |
# %%
#######################################
def dict_creation_demo():
print(
"We can convert a list of tuples into Dictionary Items: dict( [('key1','val1'), ('key2', 'val2')] "
)
was_tuple = dict([("key1", "val1"), ("key2", "val2")])
print(f"This was a list of Tuples: {was_tuple}\n")
print(... | def dict_creation_demo():
print("We can convert a list of tuples into Dictionary Items: dict( [('key1','val1'), ('key2', 'val2')] ")
was_tuple = dict([('key1', 'val1'), ('key2', 'val2')])
print(f'This was a list of Tuples: {was_tuple}\n')
print("We can convert a list of lists into Dictionary Items: dict... |
def gcd(a,b):
assert a>= a and b >= 0 and a + b > 0
while a > 0 and b > 0:
if a >= b:
a = a % b
else:
b = b % a
return max(a,b)
def egcd(a, b):
x,y, u,v = 0,1, 1,0
while a != 0:
q, r = b//a, b%a
m, n = x-u*q, y-v*q
b,a, x,y, u,v ... | def gcd(a, b):
assert a >= a and b >= 0 and (a + b > 0)
while a > 0 and b > 0:
if a >= b:
a = a % b
else:
b = b % a
return max(a, b)
def egcd(a, b):
(x, y, u, v) = (0, 1, 1, 0)
while a != 0:
(q, r) = (b // a, b % a)
(m, n) = (x - u * q, y - v ... |
asSignedInt = lambda s: -int(0x7fffffff&int(s)) if bool(0x80000000&int(s)) else int(0x7fffffff&int(s)) # TODO: swig'ged HIPS I/O unsigned int -> PyInt_AsLong vice PyLong_AsInt; OverflowError: long int too large to convert to int
ZERO_STATUS = 0x00000000
def SeparatePathFromPVDL(pathToPVDL,normalizeStrs=False):
# n... | as_signed_int = lambda s: -int(2147483647 & int(s)) if bool(2147483648 & int(s)) else int(2147483647 & int(s))
zero_status = 0
def separate_path_from_pvdl(pathToPVDL, normalizeStrs=False):
if pathToPVDL.find('\\') != -1:
dsep = '\\'
path_to_pvdl = pathToPVDL.replace('\\', '/')
else:
dse... |
df12.interaction(['A','B'], pairwise=False, max_factors=3, min_occurrence=1)
# A_B
# -------
# foo_one
# bar_one
# foo_two
# other
# foo_two
# other
# foo_one
# other
#
# [8 rows x 1 column] | df12.interaction(['A', 'B'], pairwise=False, max_factors=3, min_occurrence=1) |
# Created by Egor Kostan.
# GitHub: https://github.com/ikostan
# LinkedIn: https://www.linkedin.com/in/egor-kostan/
def encrypt_this(text: str) -> str:
"""
Encrypts each word in the message using the following rules:
* The first letter needs to be converted to its ASCII code.
* The second letter ... | def encrypt_this(text: str) -> str:
"""
Encrypts each word in the message using the following rules:
* The first letter needs to be converted to its ASCII code.
* The second letter needs to be switched with the last letter
Keepin' it simple: There are no special characters in input.
:param t... |
# Copyright 2021 The Cross-Media Measurement Authors
#
# 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 ... | """
Repository rules/macros for Protobuf.
"""
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
com_google_protobuf_version = '3.19.1'
_url_template = 'https://github.com/protocolbuffers/protobuf/releases/download/v%s/protobuf-all-%s.tar.gz'
def com_google_protobuf_repo():
http_archive(name='com... |
# import cv2
def text2binary(string):
"""
Converts text to binary string.
>>> text = 'Hello'
>>> binary_text = text2binary(text)
>>> print(binary_text)
'10010001100101110110011011001101111'
"""
# creates a list of binary representation of each character
# and joins the list to crea... | def text2binary(string):
"""
Converts text to binary string.
>>> text = 'Hello'
>>> binary_text = text2binary(text)
>>> print(binary_text)
'10010001100101110110011011001101111'
"""
output = ''.join(('{0:08b}'.format(ord(x), 'b') for x in string))
return output
def image_to_binary(da... |
def read(text_path):
texts = []
with open(text_path) as f:
for line in f.readlines():
texts.append(line.strip())
return texts
def corpus_perplexity(corpus_path, model):
texts = read(corpus_path)
N = sum(len(x.split()) for x in texts)
corpus_perp = 1
for text in texts:
... | def read(text_path):
texts = []
with open(text_path) as f:
for line in f.readlines():
texts.append(line.strip())
return texts
def corpus_perplexity(corpus_path, model):
texts = read(corpus_path)
n = sum((len(x.split()) for x in texts))
corpus_perp = 1
for text in texts:
... |
################################################
# result postprocessing utils
def divide_list_chunks(list, size_list):
assert(sum(size_list) >= len(list))
if sum(size_list) < len(list):
size_list.append(len(list) - sum(size_list))
for j in range(len(size_list)):
cur_id = sum(size_list[0:j... | def divide_list_chunks(list, size_list):
assert sum(size_list) >= len(list)
if sum(size_list) < len(list):
size_list.append(len(list) - sum(size_list))
for j in range(len(size_list)):
cur_id = sum(size_list[0:j])
yield list[cur_id:cur_id + size_list[j]]
def divide_nested_list_chunks... |
"""Constants for the Sure Petcare component."""
DOMAIN = "petcare"
DEFAULT_DEVICE_CLASS = "lock"
# sure petcare api
SURE_API_TIMEOUT = 60
# flap
BATTERY_ICON = "mdi:battery"
SURE_BATT_VOLTAGE_FULL = 1.6 # voltage
SURE_BATT_VOLTAGE_LOW = 1.25 # voltage
SURE_BATT_VOLTAGE_DIFF = SURE_BATT_VOLTAGE_FULL - SURE_BATT_VOL... | """Constants for the Sure Petcare component."""
domain = 'petcare'
default_device_class = 'lock'
sure_api_timeout = 60
battery_icon = 'mdi:battery'
sure_batt_voltage_full = 1.6
sure_batt_voltage_low = 1.25
sure_batt_voltage_diff = SURE_BATT_VOLTAGE_FULL - SURE_BATT_VOLTAGE_LOW |
class Board:
width = 3
height = 3
# Board Index
# 0 | 1 | 2
# 3 | 4 | 5
# 6 | 7 | 8
def __init__(self):
"""Instantiates a board object."""
# None is empty, 1 is player 1, 2 is player 2.
self._board = [None] * (self.width * self.height)
def _check_if_board_is_e... | class Board:
width = 3
height = 3
def __init__(self):
"""Instantiates a board object."""
self._board = [None] * (self.width * self.height)
def _check_if_board_is_empty(self):
if 0 in self._board:
return False
return True
def _check_indexes(self, l):
... |
class Hash:
def __init__(self):
self.m = 5 # cantidad de posiciones iniciales
self.min = 20 # porcentaje minimo a ocupar
self.max = 80 # porcentaje maximo a ocupar
self.n = 0
self.h = []
self.init()
def division(self, k):
return int(k % ... | class Hash:
def __init__(self):
self.m = 5
self.min = 20
self.max = 80
self.n = 0
self.h = []
self.init()
def division(self, k):
return int(k % self.m)
def linear(self, k):
return (k + 1) % self.m
def init(self):
self.n = 0
... |
with open("English dictionary.txt", "r") as input_file, open("English dictionary.out", "w") as output_file:
row_id = 2
for line in input_file:
line = line.strip()
output_file.write("%d,%s\n" % (row_id, line.split(",")[1]))
row_id += 1
| with open('English dictionary.txt', 'r') as input_file, open('English dictionary.out', 'w') as output_file:
row_id = 2
for line in input_file:
line = line.strip()
output_file.write('%d,%s\n' % (row_id, line.split(',')[1]))
row_id += 1 |
def test_cat1():
assert True
def test_cat2():
assert True
def test_cat3():
assert True
def test_cat4():
assert True
def test_cat5():
assert True
def test_cat6():
assert True
def test_cat7():
assert True
def test_cat8():
assert True
| def test_cat1():
assert True
def test_cat2():
assert True
def test_cat3():
assert True
def test_cat4():
assert True
def test_cat5():
assert True
def test_cat6():
assert True
def test_cat7():
assert True
def test_cat8():
assert True |
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
This module provides implementation for GlobalRoutePlannerDAO
"""
class GlobalRoutePlannerDAO(object):
"""
This class is the data access layer for fetching data
from the carla server i... | """
This module provides implementation for GlobalRoutePlannerDAO
"""
class Globalrouteplannerdao(object):
"""
This class is the data access layer for fetching data
from the carla server instance for GlobalRoutePlanner
"""
def __init__(self, wmap):
"""
Constructor
wmap ... |
# print("Hello")
# print("Hello")
# print("Hello")
# i = 1 # so caller iterator, or index if you will
# while i < 5: # while loops are for indeterminate time
# print("Hello No.", i)
# print(f"Hello Number {i}")
# i += 1 # i = i + 1 # we will have a infinite loop without i += 1, there is no i++
#
# print... | i = 5
while i < 10:
print(i)
i += 1
if i % 2 == 0:
print('Even number', i)
else:
print('Doing something with odd number', i)
print('We do something here') |
load("//ocaml:providers.bzl",
"OcamlNsResolverProvider",
"PpxNsArchiveProvider")
load(":options.bzl", "options", "options_ns_archive", "options_ns_opts")
load(":impl_ns_archive.bzl", "impl_ns_archive")
load("//ocaml/_transitions:ns_transitions.bzl", "nsarchive_in_transition")
OCAML_FILETYPES = [
".ml"... | load('//ocaml:providers.bzl', 'OcamlNsResolverProvider', 'PpxNsArchiveProvider')
load(':options.bzl', 'options', 'options_ns_archive', 'options_ns_opts')
load(':impl_ns_archive.bzl', 'impl_ns_archive')
load('//ocaml/_transitions:ns_transitions.bzl', 'nsarchive_in_transition')
ocaml_filetypes = ['.ml', '.mli', '.cmx', '... |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/xtark/ros_ws/devel/include;/home/xtark/ros_ws/src/third_packages/ar_track_alvar/ar_track_alvar/include".split(';') if "/home/xtark/ros_ws/devel/include;/home/xtark/ros_ws/src/third_packages/ar_tr... | catkin_package_prefix = ''
project_pkg_config_include_dirs = '/home/xtark/ros_ws/devel/include;/home/xtark/ros_ws/src/third_packages/ar_track_alvar/ar_track_alvar/include'.split(';') if '/home/xtark/ros_ws/devel/include;/home/xtark/ros_ws/src/third_packages/ar_track_alvar/ar_track_alvar/include' != '' else []
project_c... |
def maxfun(l, *arr):
maxn = 0
maxsum = 0
for k, i in enumerate(arr):
s = 0
for t in l:
s += i(t)
if s >= maxsum:
maxn = k
maxsum = s
return arr[maxn]
| def maxfun(l, *arr):
maxn = 0
maxsum = 0
for (k, i) in enumerate(arr):
s = 0
for t in l:
s += i(t)
if s >= maxsum:
maxn = k
maxsum = s
return arr[maxn] |
class EngineParams(object):
def __init__(self, **kwargs):
# Iterates over provided arguments and sets the provided arguments as class properties
for key, value in kwargs.items():
setattr(self, key, value)
| class Engineparams(object):
def __init__(self, **kwargs):
for (key, value) in kwargs.items():
setattr(self, key, value) |
colours = {}
# Regular
colours["Black"]="\033[0;30m"
colours["Red"]="\033[0;31m"
colours["Green"]="\033[0;32m"
colours["Yellow"]="\033[0;33m"
colours["Blue"]="\033[0;34m"
colours["Purple"]="\033[0;35m"
colours["Cyan"]="\033[0;36m"
colours["White"]="\033[0;37m"
#Bold
colours["BBlack"]="\033[1;30m"
colours["BRed"]="\033[... | colours = {}
colours['Black'] = '\x1b[0;30m'
colours['Red'] = '\x1b[0;31m'
colours['Green'] = '\x1b[0;32m'
colours['Yellow'] = '\x1b[0;33m'
colours['Blue'] = '\x1b[0;34m'
colours['Purple'] = '\x1b[0;35m'
colours['Cyan'] = '\x1b[0;36m'
colours['White'] = '\x1b[0;37m'
colours['BBlack'] = '\x1b[1;30m'
colours['BRed'] = '\... |
class A(object):
x:int = 1
def foo():
print(1)
print(A)
print(foo()) #ok
print(foo) #error | class A(object):
x: int = 1
def foo():
print(1)
print(A)
print(foo())
print(foo) |
# The path to the Webdriver (for Chrome/Chromium)
CHROMEDRIVER_PATH = 'C:\\WebDriver\\bin\\chromedriver.exe'
# Tell the browser to ignore invalid/insecure https connections
BROWSER_INSECURE_CERTS = True
# The URL pointing to the Franka Control Webinterface (Desk)
DESK_URL = 'robot.franka.de'
# Expect a login page wh... | chromedriver_path = 'C:\\WebDriver\\bin\\chromedriver.exe'
browser_insecure_certs = True
desk_url = 'robot.franka.de'
desk_login_required = True
plc_id = '127.0.0.1.1.1'
plc_start_flag = 'GVL.bStartBlockly'
plc_error_flag = 'GVL.bBlockleniumError'
plc_error_msg = 'GVL.sBlockleniumErrorMsg'
plc_desk_user = 'GVL.sDeskUse... |
def print_division(a,b):
try:
result = a / b
print(f"result: {result}")
except: # It catches ALL errors
print("error occurred")
print_division(10,5)
print_division(10,0)
print_division(10,2)
str_line = input("please enter two numbers to divide:")
a = int(str_line.split(" ")[0])
b = int(str_line.split(" "... | def print_division(a, b):
try:
result = a / b
print(f'result: {result}')
except:
print('error occurred')
print_division(10, 5)
print_division(10, 0)
print_division(10, 2)
str_line = input('please enter two numbers to divide:')
a = int(str_line.split(' ')[0])
b = int(str_line.split(' ')[1... |
class ConnectionError(Exception):
"""Failed to connect to the broker."""
pass
| class Connectionerror(Exception):
"""Failed to connect to the broker."""
pass |
t = int(input())
while t:
arr = []
S = input().split()
if(len(S)==1):
print(S[0].capitalize())
else:
for i in range(len(S)):
arr.append(S[i].capitalize())
for i in range(len(S)-1):
print(arr[i][0]+'.',end=' ')
print(S[len(S)-1].capitalize())
... | t = int(input())
while t:
arr = []
s = input().split()
if len(S) == 1:
print(S[0].capitalize())
else:
for i in range(len(S)):
arr.append(S[i].capitalize())
for i in range(len(S) - 1):
print(arr[i][0] + '.', end=' ')
print(S[len(S) - 1].capitalize()... |
# -*- coding: utf-8 -*-
"""
uniq is a Python API client library for Cisco's Application Policy Infrastructure Controller
Enterprise Module (APIC-EM) Northbound APIs.
*** Description ***
The APIC-EM Northbound Interface is the only API that you will need to control your network
programmatically. The API is function r... | """
uniq is a Python API client library for Cisco's Application Policy Infrastructure Controller
Enterprise Module (APIC-EM) Northbound APIs.
*** Description ***
The APIC-EM Northbound Interface is the only API that you will need to control your network
programmatically. The API is function rich and provides you with... |
class Image_SVG():
def Stmp(self):
return
| class Image_Svg:
def stmp(self):
return |
def crack(value,g,mod):
for i in range(mod):
if ((g**i) % mod == value):
return i
# print("X = ", crack(57, 13, 59))
# print("Y = ", crack(44,13,59))
# print("Alice computes", (44**20)%59)
# print("Bob computes", (57**47)%59)
def find_num(target):
for i in range(target):
for j in range(target):
... | def crack(value, g, mod):
for i in range(mod):
if g ** i % mod == value:
return i
def find_num(target):
for i in range(target):
for j in range(target):
if i * j == target:
print(i, j)
find_num(5561)
def lcm(x, y):
orig_x = x
orig_y = y
while ... |
__version__ = '1.0.3.5'
if __name__ == '__main__':
print(__version__)
# ******************************************************************************
# MIT License
#
# Copyright (c) 2020 Jianlin Shi
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated ... | __version__ = '1.0.3.5'
if __name__ == '__main__':
print(__version__) |
#tests if passed-in number is a prime number
def is_prime(num):
if num < 2:
return False
for i in range(2, num):
if num % i == 0:
return False
return True
#takes in a number and returns a list of prime numbers for zero to the number
def generate_prime_numbers(number):
primes = []
try:
isinstance(number,... | def is_prime(num):
if num < 2:
return False
for i in range(2, num):
if num % i == 0:
return False
return True
def generate_prime_numbers(number):
primes = []
try:
isinstance(number, int)
if number > 0:
for num in range(2, number + 1):
... |
# time O(nlogn)
# space O(1)
def minimumWaitingTime(queries):
queries.sort()
total = 0
prev_sum = 0
for i in queries[:-1]:
prev_sum += i
total += prev_sum
return total
# time O(nlogn)
# space O(1)
def minimumWaitingTime(queries):
queries.sort()
total = 0
f... | def minimum_waiting_time(queries):
queries.sort()
total = 0
prev_sum = 0
for i in queries[:-1]:
prev_sum += i
total += prev_sum
return total
def minimum_waiting_time(queries):
queries.sort()
total = 0
for (idx, wait_time) in enumerate(queries, start=1):
queries_l... |
for _ in range(int(input())):
n, m, k = map(int, input().split())
req = 0
req = 1*(m-1) + m*(n-1)
if req == k:
print("YES")
else:
print("NO") | for _ in range(int(input())):
(n, m, k) = map(int, input().split())
req = 0
req = 1 * (m - 1) + m * (n - 1)
if req == k:
print('YES')
else:
print('NO') |
#/*********************************************************\
# * File: 44ScriptOOP.py *
# *
# * Copyright (C) 2002-2013 The PixelLight Team (http://www.pixellight.org/)
# *
# * This file is part of PixelLight.
# *
# * Permission is hereby granted, free of charge, to any person obtain... | class Myscriptclass(object):
"""My script class"""
def __del__(this):
PL['System']['Console']['Print']('MyScriptClass::~MyScriptClass() - a=' + str(this.a) + '\n')
def __init__(this, a):
this.a = a
PL['System']['Console']['Print']('MyScriptClass::MyScriptClass(a) - a=' + str(this.a... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 23 14:39:19 2019
@author: aksha
"""
annual_salary = int(input('Enter your annual salary: '))
annual_salary1 = annual_salary
total_cost = 1000000
semi_annual_raise = 0.07
current_savings = 0.0
low = 0
high = 10000
guess = 5000
numberofsteps = 0
while abs(cur... | """
Created on Tue Jul 23 14:39:19 2019
@author: aksha
"""
annual_salary = int(input('Enter your annual salary: '))
annual_salary1 = annual_salary
total_cost = 1000000
semi_annual_raise = 0.07
current_savings = 0.0
low = 0
high = 10000
guess = 5000
numberofsteps = 0
while abs(current_savings - total_cost * 0.25) >= 10... |
orig = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
num = int(input())
for i in range(num):
alpha = list(orig)
key = input()
cipher = input()
tl = list(key)
letters = []
newAlpha = []
for l in tl:
if l not in letters:
letters.append(l)
alpha.remove(l)
length = len(letters... | orig = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
num = int(input())
for i in range(num):
alpha = list(orig)
key = input()
cipher = input()
tl = list(key)
letters = []
new_alpha = []
for l in tl:
if l not in letters:
letters.append(l)
alpha.remove(l)
length = len(letter... |
def get_inplane(inplanes, idx):
if isinstance(inplanes, list):
return inplanes[idx]
else:
return inplanes
| def get_inplane(inplanes, idx):
if isinstance(inplanes, list):
return inplanes[idx]
else:
return inplanes |
def linearsearch(_list, _v):
if len(_list) == 0:
return False
for i, item in enumerate(_list):
if item == _v:
return i
return False
| def linearsearch(_list, _v):
if len(_list) == 0:
return False
for (i, item) in enumerate(_list):
if item == _v:
return i
return False |
images = [
"https://demo.com/imgs/1.jpg",
"https://demo.com/imgs/2.jpg",
"https://demo.com/imgs/3.jpg",
]
| images = ['https://demo.com/imgs/1.jpg', 'https://demo.com/imgs/2.jpg', 'https://demo.com/imgs/3.jpg'] |
"""Constants for the Livebox component."""
DOMAIN = "livebox"
COORDINATOR = "coordinator"
UNSUB_LISTENER = "unsubscribe_listener"
LIVEBOX_ID = "id"
LIVEBOX_API = "api"
COMPONENTS = ["sensor", "binary_sensor", "device_tracker", "switch"]
TEMPLATE_SENSOR = "Orange Livebox"
DEFAULT_USERNAME = "admin"
DEFAULT_HOST = "192... | """Constants for the Livebox component."""
domain = 'livebox'
coordinator = 'coordinator'
unsub_listener = 'unsubscribe_listener'
livebox_id = 'id'
livebox_api = 'api'
components = ['sensor', 'binary_sensor', 'device_tracker', 'switch']
template_sensor = 'Orange Livebox'
default_username = 'admin'
default_host = '192.1... |
INITIAL_CAROUSEL_DATA = [
{
"title": "New Feature",
"description": "Explore",
"graphic": "/images/homepage/map-explorer.png",
"url": "/explore"
},
{
"title": "Data Visualization",
"description": "Yemen - WFP mVAM, Food Security Monitoring",
"graphic": ... | initial_carousel_data = [{'title': 'New Feature', 'description': 'Explore', 'graphic': '/images/homepage/map-explorer.png', 'url': '/explore'}, {'title': 'Data Visualization', 'description': 'Yemen - WFP mVAM, Food Security Monitoring', 'graphic': '/images/homepage/mVAM.png', 'url': '//data.humdata.org/visualization/wf... |
"optimize with in-place list operations"
class error(Exception): pass # when imported: local exception
class Stack:
def __init__(self, start=[]): # self is the instance object
self.stack = [] # start is any sequence: stack...
for x in start: s... | """optimize with in-place list operations"""
class Error(Exception):
pass
class Stack:
def __init__(self, start=[]):
self.stack = []
for x in start:
self.push(x)
def push(self, obj):
self.stack.append(obj)
def pop(self):
if not self.stack:
rai... |
'''
A Simple nested if
'''
# Can you eat chicken?
a = input("Are you veg or non veg?\n")
day = input("Which day is today?\n")
if(a == "nonveg"):
if(day == "sunday"):
print("You can eat chicken")
else:
print("It is not sunday! You cannot eat chicken..")
else:
print("you are vegitarian! you cannot eat ch... | """
A Simple nested if
"""
a = input('Are you veg or non veg?\n')
day = input('Which day is today?\n')
if a == 'nonveg':
if day == 'sunday':
print('You can eat chicken')
else:
print('It is not sunday! You cannot eat chicken..')
else:
print('you are vegitarian! you cannot eat chicken!') |
__author__ = "Rob MacKinnon <rome@villagertech.com>"
__package__ = "DOMObjects"
__name__ = "DOMObjects.flags"
__license__ = "MIT"
DEBUG = 0
FLAG_READ = 2**0
FLAG_WRITE = 2**1
FLAG_NAMESPACE = 2**2
FLAG_RESERVED_8 = 2**3
FLAG_RESERVED_16 = 2**4
FLAG_RESERVED_32 = 2**5
FLAG_RESERVED_64 = 2**6
FLAG_RESERVED_128 = 2**7
... | __author__ = 'Rob MacKinnon <rome@villagertech.com>'
__package__ = 'DOMObjects'
__name__ = 'DOMObjects.flags'
__license__ = 'MIT'
debug = 0
flag_read = 2 ** 0
flag_write = 2 ** 1
flag_namespace = 2 ** 2
flag_reserved_8 = 2 ** 3
flag_reserved_16 = 2 ** 4
flag_reserved_32 = 2 ** 5
flag_reserved_64 = 2 ** 6
flag_reserved_... |
languages = {}
banned = []
results = {}
data = input().split("-")
while "exam finished" not in data:
if "banned" in data:
banned.append(data[0])
data = input().split("-")
continue
name = data[0]
language = data[1]
points = int(data[2])
current_points = 0
if language i... | languages = {}
banned = []
results = {}
data = input().split('-')
while 'exam finished' not in data:
if 'banned' in data:
banned.append(data[0])
data = input().split('-')
continue
name = data[0]
language = data[1]
points = int(data[2])
current_points = 0
if language in la... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""test_pycmake
----------------------------------
Tests for `pycmake` module.
"""
| """test_pycmake
----------------------------------
Tests for `pycmake` module.
""" |
"""
This package contains implementation of the individual components of
the topic coherence pipeline.
"""
| """
This package contains implementation of the individual components of
the topic coherence pipeline.
""" |
# -*- coding: utf-8 -*-
{
'name': "se_openeducat_se_idr",
'summary': """
se_openeducat_se_idr
""",
'description': """
Openeducat SE IDR
""",
'author': "Alejandro",
'category': 'Uncategorized',
'version': '0.1',
'depends': ['base','openeducat_core','openeducat_... | {'name': 'se_openeducat_se_idr', 'summary': '\n se_openeducat_se_idr\n ', 'description': '\n Openeducat SE IDR\n ', 'author': 'Alejandro', 'category': 'Uncategorized', 'version': '0.1', 'depends': ['base', 'openeducat_core', 'openeducat_fees'], 'data': ['security/ir.model.access.csv', 'views/op_... |
'''
Generic functions for files
'''
class FileOps:
def open(self, name):
'''
Open the file and return a string
'''
with open(name, 'rb') as f:
return f.read()
| """
Generic functions for files
"""
class Fileops:
def open(self, name):
"""
Open the file and return a string
"""
with open(name, 'rb') as f:
return f.read() |
'''
Caesar Cypher, by Jackson Urquhart - 19 February 2022 @ 22:47
'''
in_str = str(input("\nEnter phrase: \n")) # Gets in_string from user
key = int(input("\nEnter key: \n")) # Gets key from user
keep_upper = str(input("\nMaintain case? y/n\n")) # Determines whether user wants to maintiain case values
def encrypt(in_... | """
Caesar Cypher, by Jackson Urquhart - 19 February 2022 @ 22:47
"""
in_str = str(input('\nEnter phrase: \n'))
key = int(input('\nEnter key: \n'))
keep_upper = str(input('\nMaintain case? y/n\n'))
def encrypt(in_str, key):
out_str = ''
for letter in in_str:
if 96 < ord(letter.lower()) < 123:
... |
#
# PySNMP MIB module ETHER-WIS (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ETHER-WIS
# Produced by pysmi-0.3.4 at Wed May 1 13:06:45 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:23... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, constraints_intersection, constraints_union, value_size_constraint) ... |
print("hello world")
#prin("how are you")
def fa():
return fb()
def fb():
return fc()
def fc():
return 1
def suma(a, b):
return a + b
| print('hello world')
def fa():
return fb()
def fb():
return fc()
def fc():
return 1
def suma(a, b):
return a + b |
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 6 17:02:15 2019
@author: Administrator
"""
class Solution:
def setZeroes(self, matrix: list) -> None:
"""
Do not return anything, modify matrix in-place instead.
"""
d = {}
d['R'] = []
d['C'] = []
for r, val in... | """
Created on Thu Jun 6 17:02:15 2019
@author: Administrator
"""
class Solution:
def set_zeroes(self, matrix: list) -> None:
"""
Do not return anything, modify matrix in-place instead.
"""
d = {}
d['R'] = []
d['C'] = []
for (r, val) in enumerate(matrix):
... |
#
# PySNMP MIB module Nortel-Magellan-Passport-BaseRoutingMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-BaseRoutingMIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:16:59 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwan... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, constraints_intersection, single_value_constraint, value_range_constraint) ... |
def denumerate(enum_list):
try:
nums = dict(enum_list)
maximum = max(nums) + 1
result = ''.join(nums[a] for a in xrange(maximum))
if result.isalnum() and len(result) == maximum:
return result
except (KeyError, TypeError, ValueError):
pass
return False
| def denumerate(enum_list):
try:
nums = dict(enum_list)
maximum = max(nums) + 1
result = ''.join((nums[a] for a in xrange(maximum)))
if result.isalnum() and len(result) == maximum:
return result
except (KeyError, TypeError, ValueError):
pass
return False |
lines = open('input.txt', 'r').readlines()
timestamp = int(lines[0].strip())
buses = lines[1].strip().split(',')
m, x = [], []
for i, bus in enumerate(buses):
if bus == 'x':
continue
bus = int(bus)
m.append(bus)
x.append((bus - i) % bus)
def extended_euclidean(a, b):
if a == 0:
return b, 0, 1
else:
g, y,... | lines = open('input.txt', 'r').readlines()
timestamp = int(lines[0].strip())
buses = lines[1].strip().split(',')
(m, x) = ([], [])
for (i, bus) in enumerate(buses):
if bus == 'x':
continue
bus = int(bus)
m.append(bus)
x.append((bus - i) % bus)
def extended_euclidean(a, b):
if a == 0:
... |
"""Dependency specific initialization."""
def deps(repo_mapping = {}):
pass
| """Dependency specific initialization."""
def deps(repo_mapping={}):
pass |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
def is_whitespaces_str(s):
return True if len(s.strip(" \t\n\r\f\v")) == 0 else False | def is_whitespaces_str(s):
return True if len(s.strip(' \t\n\r\x0c\x0b')) == 0 else False |
command = '/usr/bin/gunicorn'
pythonpath = '/usr/share/webapps/netbox'
bind = '127.0.0.1:8001'
workers = 3
user = 'netbox'
| command = '/usr/bin/gunicorn'
pythonpath = '/usr/share/webapps/netbox'
bind = '127.0.0.1:8001'
workers = 3
user = 'netbox' |
# Copyright (c) lobsterpy development team
# Distributed under the terms of a BSD 3-Clause "New" or "Revised" License
"""
This package provides the modules for analyzing Lobster files
"""
| """
This package provides the modules for analyzing Lobster files
""" |
# This one's a bit different, representing an unusual (and honestly,
# not recommended) strategy for tracking users that sign up for a service.
class User:
# An (intentionally shared) collection storing users who sign up for some hypothetical service.
# There's only one set of members, so it lives at the class... | class User:
members = {}
names = set()
def __init__(self, name):
if not self.names:
self.names.add(name)
else:
self.names = set(name)
if self.members == {}:
self.members = set()
def sign_up(self):
self.members.add(self.name)
sarah = u... |
def is_knight_removed(matrix: list, row: int, col: int):
if row not in range(rows) or col not in range(rows):
return False
return matrix[row][col] == "K"
def affected_knights(matrix: list, row: int, col: int):
result = 0
if is_knight_removed(matrix, row - 2, col + 1):
result += 1
i... | def is_knight_removed(matrix: list, row: int, col: int):
if row not in range(rows) or col not in range(rows):
return False
return matrix[row][col] == 'K'
def affected_knights(matrix: list, row: int, col: int):
result = 0
if is_knight_removed(matrix, row - 2, col + 1):
result += 1
if... |
# Fibonacci
"""
Using Recursion
"""
def fibonacci(n):
if n <= 1:
return n
return fibonacci(n-1) + fibonacci(n-2)
print(fibonacci(5))
"""
Using Dynamic Programming
"""
def fibonacci2(n):
# Taking 1st two fibonacci nubers as 0 and 1
FibArray = [0, 1]
while len(FibArray) < n + 1:
... | """
Using Recursion
"""
def fibonacci(n):
if n <= 1:
return n
return fibonacci(n - 1) + fibonacci(n - 2)
print(fibonacci(5))
'\nUsing Dynamic Programming\n'
def fibonacci2(n):
fib_array = [0, 1]
while len(FibArray) < n + 1:
FibArray.append(0)
if n <= 1:
return n
else:
... |
"""
Copyright (c) 2021 Cisco and/or its affiliates.
This software is licensed to you under the terms of the Cisco Sample
Code License, Version 1.1 (the "License"). You may obtain a copy of the
License at
https://developer.cisco.com/docs/licenses
All use of the material herein must be in accordance wit... | """
Copyright (c) 2021 Cisco and/or its affiliates.
This software is licensed to you under the terms of the Cisco Sample
Code License, Version 1.1 (the "License"). You may obtain a copy of the
License at
https://developer.cisco.com/docs/licenses
All use of the material herein must be in accordance wit... |
def dight(n):
sum=0
while n>0:
sum=sum+n%10
n=n//10
return sum
k=0
l=[]
for i in range(2,100):
for j in range(2,100):
t=i**j
d=dight(t)
if d==i:
k+=1
l.append(t)
l=sorted(l)
print(l[29]) | def dight(n):
sum = 0
while n > 0:
sum = sum + n % 10
n = n // 10
return sum
k = 0
l = []
for i in range(2, 100):
for j in range(2, 100):
t = i ** j
d = dight(t)
if d == i:
k += 1
l.append(t)
l = sorted(l)
print(l[29]) |
load("//cuda:providers.bzl", "CudaInfo")
def is_dynamic_input(src):
return src.extension in ["so", "dll", "dylib"]
def is_object_file(src):
return src.extension in ["obj", "o"]
def is_static_input(src):
return src.extension in ["a", "lib", "lo"]
def is_source_file(src):
return src.extens... | load('//cuda:providers.bzl', 'CudaInfo')
def is_dynamic_input(src):
return src.extension in ['so', 'dll', 'dylib']
def is_object_file(src):
return src.extension in ['obj', 'o']
def is_static_input(src):
return src.extension in ['a', 'lib', 'lo']
def is_source_file(src):
return src.extension in ['c',... |
def custMin(paramList):
n = len(paramList)-1
for pos in range(n):
if paramList[pos] < paramList[pos+1]:
paramList[pos], paramList[pos+1] = paramList[pos+1], paramList[pos]
return paramList[n]
print(custMin([5, 2, 9, 10, -2, 90]))
| def cust_min(paramList):
n = len(paramList) - 1
for pos in range(n):
if paramList[pos] < paramList[pos + 1]:
(paramList[pos], paramList[pos + 1]) = (paramList[pos + 1], paramList[pos])
return paramList[n]
print(cust_min([5, 2, 9, 10, -2, 90])) |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 Clione Software
# Copyright (c) 2010-2013 Cidadania S. Coop. Galega
#
# 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.or... | """
Module to store space related url names.
"""
space_add = 'create-space'
space_edit = 'edit-space'
space_delete = 'delete-space'
space_index = 'space-index'
space_feed = 'space-feed'
space_list = 'list-spaces'
goto_space = 'goto-space'
edit_roles = 'edit-roles'
search_user = 'search-user'
space_news = 'list-space-ne... |
# Copyright (c) 2018, WSO2 Inc. (http://wso2.com) All Rights Reserved.
#
# 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 ap... | integrator = 'bin/integrator'
analytics = 'wso2/analytics/wso2/worker/bin/carbon'
broker = 'wso2/broker/bin/wso2server'
bp = 'wso2/business-process/bin/wso2server'
micro_intg = 'wso2/micro-integrator/bin/wso2server'
datasource_paths = {'product-apim': {}, 'product-is': {}, 'product-ei': {'CORE': ['conf/datasources/mast... |
def get_digit(num):
root = num ** 0.5
if root % 1 == 0:
return
counting = []
b = (root // 1)
c = 1
while True:
d = (c / (root - b)) // 1
e = num - b ** 2
if e % c == 0:
c = e / c
else:
c = e
b = (c * d - b)
... | def get_digit(num):
root = num ** 0.5
if root % 1 == 0:
return
counting = []
b = root // 1
c = 1
while True:
d = c / (root - b) // 1
e = num - b ** 2
if e % c == 0:
c = e / c
else:
c = e
b = c * d - b
if [b, c] in co... |
"""
Generate a JSON file for pre-configuration
.. only:: development_administrator
Created on Jul. 6, 2020
@author: jgossage
"""
def genpre(file: str = 'preconfig.json'):
pass | """
Generate a JSON file for pre-configuration
.. only:: development_administrator
Created on Jul. 6, 2020
@author: jgossage
"""
def genpre(file: str='preconfig.json'):
pass |
# https://youtu.be/wNVCJj642n4?list=PLAB1DA9F452D9466C
def binary_search(items, target):
low = 0
high = len(items)
while (high - low) > 1:
middle = (low + high) // 2
if target < items[middle]:
high = middle
if target >= items[middle]:
low = mi... | def binary_search(items, target):
low = 0
high = len(items)
while high - low > 1:
middle = (low + high) // 2
if target < items[middle]:
high = middle
if target >= items[middle]:
low = middle
if items[low] == target:
return low
raise value_error... |
# https://www.hackerrank.com/challenges/count-luck/problem
def findMove(matrix,now,gone):
x,y = now
moves = list()
moves.append((x+1,y)) if(x!=len(matrix)-1 and matrix[x+1][y]!='X' ) else None
moves.append((x,y+1)) if(y!=len(matrix[0])-1 and matrix[x][y+1]!='X') else None
moves.append((x-1,y)) if(x... | def find_move(matrix, now, gone):
(x, y) = now
moves = list()
moves.append((x + 1, y)) if x != len(matrix) - 1 and matrix[x + 1][y] != 'X' else None
moves.append((x, y + 1)) if y != len(matrix[0]) - 1 and matrix[x][y + 1] != 'X' else None
moves.append((x - 1, y)) if x != 0 and matrix[x - 1][y] != 'X... |
"""
future: clean single-source support for Python 3 and 2
======================================================
The ``future`` module helps run Python 3.x-compatible code under Python 2
with minimal code cruft.
The goal is to allow you to write clean, modern, forward-compatible
Python 3 code today and to run it wit... | """
future: clean single-source support for Python 3 and 2
======================================================
The ``future`` module helps run Python 3.x-compatible code under Python 2
with minimal code cruft.
The goal is to allow you to write clean, modern, forward-compatible
Python 3 code today and to run it wit... |
#
# PySNMP MIB module CISCO-LWAPP-DOT11-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-LWAPP-DOT11-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:47:47 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, constraints_union, value_range_constraint, constraints_intersection) ... |
#!/usr/bin/env python3
__version__ = (0, 5, 2)
__version_info__ = ".".join(map(str, __version__))
APP_NAME = 'pseudo-interpreter'
APP_AUTHOR = 'bell345'
APP_VERSION = __version_info__
| __version__ = (0, 5, 2)
__version_info__ = '.'.join(map(str, __version__))
app_name = 'pseudo-interpreter'
app_author = 'bell345'
app_version = __version_info__ |
class DiagonalDisproportion:
def getDisproportion(self, matrix):
r = 0
for i, s in enumerate(matrix):
r += int(s[i]) - int(s[-i-1])
return r
| class Diagonaldisproportion:
def get_disproportion(self, matrix):
r = 0
for (i, s) in enumerate(matrix):
r += int(s[i]) - int(s[-i - 1])
return r |
for num in range(101):
div = 0
for x in range(1, num+1):
resto = num % x
if resto == 0:
div += 1
if div == 2:
print(num) | for num in range(101):
div = 0
for x in range(1, num + 1):
resto = num % x
if resto == 0:
div += 1
if div == 2:
print(num) |
#weight = 50
State.PS_veliki=_State(False,name='PS_veliki',shared=True)
State.PS_mali=_State(False,name='PS_mali',shared=True)
def run():
r.setpos(-1500+155+125+10,-1000+600+220,90) #bocno absrot90
r.conf_set('send_status_interval', 10)
State.color = 'ljubicasta'
# init servos
llift(0)
rlift(0)
rfliper(0)
lflip... | State.PS_veliki = __state(False, name='PS_veliki', shared=True)
State.PS_mali = __state(False, name='PS_mali', shared=True)
def run():
r.setpos(-1500 + 155 + 125 + 10, -1000 + 600 + 220, 90)
r.conf_set('send_status_interval', 10)
State.color = 'ljubicasta'
llift(0)
rlift(0)
rfliper(0)
lflip... |
def join_dictionaries(
dictionaries: list) -> dict:
joined_dictionary = \
dict()
for dictionary in dictionaries:
joined_dictionary.update(
dictionary)
return \
joined_dictionary | def join_dictionaries(dictionaries: list) -> dict:
joined_dictionary = dict()
for dictionary in dictionaries:
joined_dictionary.update(dictionary)
return joined_dictionary |
"""Version file."""
# __ __
# ______ _/ /_ / /
# /_ __/__ /_ __/_________ / /______,- ___ __ _____ __
# / / / _ \/ / / ___/ /_/_/ // / __ // _ '_ \/ ___/ _ \
# __/ /_/ / / / /_/ ___/ _ \/ _' / /_/ // // // / ___/ / / /
# /_____/_/ /_/\__/____/_/ /_/_/ \_\___... | """Version file."""
version = (1, 18, 9)
__version__ = '.'.join(map(str, VERSION)) |
APIAE_PARAMS = dict(
n_x=90, # dimension of x; observation
n_z=3, # dimension of z; latent space
n_u=1, # dimension of u; control
K=10, # the number of time steps
R=1, # the number of adaptations
L=32, # the number of trajectory sampled
dt=.1, # time interval
ur=.1, # update r... | apiae_params = dict(n_x=90, n_z=3, n_u=1, K=10, R=1, L=32, dt=0.1, ur=0.1, lr=0.001)
training_epochs = 3000
offset_std = 1e-05 |
class Computer:
def __init__(self):
self.__maxprice = 900
def sell(self):
print("Selling Price: {}".format(self.__maxprice))
def setMaxPrice(self, price):
self.__maxprice = price
c = Computer()
c.sell()
# change the price
c.__maxprice = 1000
c.sell()
# using setter function
c.se... | class Computer:
def __init__(self):
self.__maxprice = 900
def sell(self):
print('Selling Price: {}'.format(self.__maxprice))
def set_max_price(self, price):
self.__maxprice = price
c = computer()
c.sell()
c.__maxprice = 1000
c.sell()
c.setMaxPrice(1000)
c.sell() |
if __name__ == "__main__":
ant_map = """
------a------------------------------------
------------------o----------------------
-----------------o-----------------------
------------------------------------------
------------------------------------------
-------------------------------------... | if __name__ == '__main__':
ant_map = '\n ------a------------------------------------\n ------------------o----------------------\n -----------------o-----------------------\n ------------------------------------------\n ------------------------------------------\n ---------------------------------... |
COMPANY_PRESENTATION = "company_presentation"
LUNCH_PRESENTATION = "lunch_presentation"
ALTERNATIVE_PRESENTATION = "alternative_presentation"
COURSE = "course"
KID_EVENT = "kid_event"
PARTY = "party"
SOCIAL = "social"
OTHER = "other"
EVENT = "event"
EVENT_TYPES = (
(COMPANY_PRESENTATION, COMPANY_PRESENTATION),
... | company_presentation = 'company_presentation'
lunch_presentation = 'lunch_presentation'
alternative_presentation = 'alternative_presentation'
course = 'course'
kid_event = 'kid_event'
party = 'party'
social = 'social'
other = 'other'
event = 'event'
event_types = ((COMPANY_PRESENTATION, COMPANY_PRESENTATION), (LUNCH_PR... |
class FilteredElementIdIterator(object,IEnumerator[ElementId],IDisposable,IEnumerator):
""" An iterator to a set of element ids filtered by the settings of a FilteredElementCollector. """
def Dispose(self):
""" Dispose(self: FilteredElementIdIterator) """
pass
def GetCurrent(self):
"""
GetCurrent(self... | class Filteredelementiditerator(object, IEnumerator[ElementId], IDisposable, IEnumerator):
""" An iterator to a set of element ids filtered by the settings of a FilteredElementCollector. """
def dispose(self):
""" Dispose(self: FilteredElementIdIterator) """
pass
def get_current(self):
... |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 6 10:26:35 2020
@author: ruy
Automation of German Lloyd 2012 High Speed Craft strucutural rules calculation
"""
| """
Created on Thu Aug 6 10:26:35 2020
@author: ruy
Automation of German Lloyd 2012 High Speed Craft strucutural rules calculation
""" |
n,m = input().split(' ')
my_array = list(input().split(' '))
A = set(input().split(' '))
B = set(input().split(' '))
happiness = 0
for i in my_array:
happiness += (i in A) - (i in B)
print(happiness) | (n, m) = input().split(' ')
my_array = list(input().split(' '))
a = set(input().split(' '))
b = set(input().split(' '))
happiness = 0
for i in my_array:
happiness += (i in A) - (i in B)
print(happiness) |
buf = ""
buf += "\xdb\xdd\xd9\x74\x24\xf4\x58\xbf\x63\x6e\x69\x90\x33"
buf += "\xc9\xb1\x52\x83\xe8\xfc\x31\x78\x13\x03\x1b\x7d\x8b"
buf += "\x65\x27\x69\xc9\x86\xd7\x6a\xae\x0f\x32\x5b\xee\x74"
buf += "\x37\xcc\xde\xff\x15\xe1\x95\x52\x8d\x72\xdb\x7a\xa2"
buf += "\x33\x56\x5d\x8d\xc4\xcb\x9d\x8c\x46\x16\xf2\x6e\x76"
... | buf = ''
buf += 'ÛÝÙt$ôX¿cni\x903'
buf += 'ɱR\x83èü1x\x13\x03\x1b}\x8b'
buf += "e'iÉ\x86×j®\x0f2[ît"
buf += '7ÌÞÿ\x15á\x95R\x8drÛz¢'
buf += '3V]\x8dÄË\x9d\x8cF\x16ònv'
buf += 'Ù\x07o¿\x04å=hBXÑ\x1d\x1e'
buf += 'aZm\x8eá¿&±Àn<èÂ'
buf += '\x91\x91\x80J\x89ö\xad\x05"ÌZ\x94â'
buf += '\x1c¢;Ë\x90QE\x0c\x16\x8a0dd'
buf += "... |
print(" "*7 + "A")
print(" "*6 + "B B")
print(" "*5 + "C C")
print(" "*4 + "D" + " "*5 + "D")
print(" "*3 + "E" + " "*7 + "E")
print(" "*4 + "D" + " "*5 + "D")
print(" "*5 + "C C")
print(" "*6 + "B B")
print(" "*7 + "A")
| print(' ' * 7 + 'A')
print(' ' * 6 + 'B B')
print(' ' * 5 + 'C C')
print(' ' * 4 + 'D' + ' ' * 5 + 'D')
print(' ' * 3 + 'E' + ' ' * 7 + 'E')
print(' ' * 4 + 'D' + ' ' * 5 + 'D')
print(' ' * 5 + 'C C')
print(' ' * 6 + 'B B')
print(' ' * 7 + 'A') |
subscription_service = paymill_context.get_subscription_service()
subscription_with_offer_and_different_values = subscription_service.create_with_offer_id(
payment_id='pay_5e078197cde8a39e4908f8aa',
offer_id='offer_b33253c73ae0dae84ff4',
name='Example Subscription',
period_of_validity='2 YEAR',
star... | subscription_service = paymill_context.get_subscription_service()
subscription_with_offer_and_different_values = subscription_service.create_with_offer_id(payment_id='pay_5e078197cde8a39e4908f8aa', offer_id='offer_b33253c73ae0dae84ff4', name='Example Subscription', period_of_validity='2 YEAR', start_at=1400575533) |
class Monkey(object):
'''Store data of placed monkey'''
def __init__(self, position=None, name=None, mtype=None) -> None:
'''
:arg position: position, list
:arg name: name
:arg mtype: type of monkey (get from action.action)
'''
self.position = position
se... | class Monkey(object):
"""Store data of placed monkey"""
def __init__(self, position=None, name=None, mtype=None) -> None:
"""
:arg position: position, list
:arg name: name
:arg mtype: type of monkey (get from action.action)
"""
self.position = position
se... |
labelClassification = """
border-style: none;
font-weight: bold;
font-size: 40px;
color: white;
"""
mainWindowFrame = """
border: 2px solid rgb(40, 40, 40);
border-radius: 4px;
background-color: rgb(70,70,73);
background: qlineargradient(x1: 0, y1: 0, x2: 0, y... | label_classification = '\n border-style: none;\n font-weight: bold;\n font-size: 40px;\n color: white;\n'
main_window_frame = '\n border: 2px solid rgb(40, 40, 40);\n border-radius: 4px;\n background-color: rgb(70,70,73);\n background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,\... |
matched = [[0, 450], [1, 466], [2, 566], [3, 974], [4, 1000], [5, 1222], [6, 1298], [7, 1322], [8, 1340], [9, 1704],
[10, 1752], [11, 2022], [12, 2114], [13, 2332], [14, 2360], [15, 2380], [16, 2388], [17, 2596],
[18, 2662], [19, 2706], [20, 2842], [21, 2914], [22, 3132], [23, 3148], [24, 3158], [... | matched = [[0, 450], [1, 466], [2, 566], [3, 974], [4, 1000], [5, 1222], [6, 1298], [7, 1322], [8, 1340], [9, 1704], [10, 1752], [11, 2022], [12, 2114], [13, 2332], [14, 2360], [15, 2380], [16, 2388], [17, 2596], [18, 2662], [19, 2706], [20, 2842], [21, 2914], [22, 3132], [23, 3148], [24, 3158], [25, 3164], [26, 3244],... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def levelOrder(self, root):
"""
:type root: TreeNode
:rtype: List[List[int]]
"""
if root == None:... | class Solution:
def level_order(self, root):
"""
:type root: TreeNode
:rtype: List[List[int]]
"""
if root == None:
return []
l = [[]]
level = 0
stack = [(root, level)]
while len(stack) > 0:
(r, level) = stack[0]
... |
#!/usr/bin/env python
# Mainly for use in stubconnections/kubectl.yml
print('PID: 1')
| print('PID: 1') |
# START LAB EXERCISE 03
print('Lab Exercise 03 \n')
# PROBLEM 1 (5 Points)
inventors = None
# PROBLEM 2 (4 Points)
#SETUP
invention = 'Heating, ventilation, and air conditioning'
#END SETUP
# PROBLEM 3 (4 Points)
# SETUP
new_inventor = {'Alexander Miles': 'Automatic electric elevator doors'}
# END SETUP
# PRO... | print('Lab Exercise 03 \n')
inventors = None
invention = 'Heating, ventilation, and air conditioning'
new_inventor = {'Alexander Miles': 'Automatic electric elevator doors'}
gastroscope_inventor = 'Leonidas Berry'
tuple_gastroscope_inventor = None
medical_inventors = None |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.