content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, Inc.
#
# 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 ... | created = 'created'
updated = 'updated'
deleted = 'deleted'
promoted = 'promoted'
viewed = 'viewed'
stats = 'stats'
cloned = 'cloned'
resumed = 'resumed'
started = 'started'
restarted = 'restarted'
copied = 'copied'
succeeded = 'succeeded'
failed = 'failed'
done = 'done'
stopped = 'stopped'
approved = 'approved'
invali... |
'''
09 - Facetting multiple regressions
lmplot() allows us to facet the data across multiple rows and columns.
In the previous plot, the multiple lines were difficult to read in one
plot. We can try creating multiple plots by Region to see if that is a
more useful visualization.
Instructions
- Use lmplot() to look ... | """
09 - Facetting multiple regressions
lmplot() allows us to facet the data across multiple rows and columns.
In the previous plot, the multiple lines were difficult to read in one
plot. We can try creating multiple plots by Region to see if that is a
more useful visualization.
Instructions
- Use lmplot() to look ... |
def get_context_vars():
return {"entity_type": "user", "date": "2018-10-20", "batch_size": "daily"}
def get_metadata():
return {
"extractor": {"params": {"input_path": "user/p_year=2018/p_month=10/p_day=20"}, "name": "JSONExtractor"},
"transformers": [
{"params": {"exploded_elem_na... | def get_context_vars():
return {'entity_type': 'user', 'date': '2018-10-20', 'batch_size': 'daily'}
def get_metadata():
return {'extractor': {'params': {'input_path': 'user/p_year=2018/p_month=10/p_day=20'}, 'name': 'JSONExtractor'}, 'transformers': [{'params': {'exploded_elem_name': 'friends_element', 'path_t... |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
VERSION = "11.1.1" # type: str
SDK_MONIKER = "search-documents/{}".format(VERSION) # type: str
| version = '11.1.1'
sdk_moniker = 'search-documents/{}'.format(VERSION) |
class Solution:
def lastStoneWeight(self, stones: List[int]) -> int:
stones.sort()
while len(stones) > 1:
first = stones.pop()
second = stones.pop()
if first == second:
continue
else:
diff = first - sec... | class Solution:
def last_stone_weight(self, stones: List[int]) -> int:
stones.sort()
while len(stones) > 1:
first = stones.pop()
second = stones.pop()
if first == second:
continue
else:
diff = first - second
... |
B = [['m', 'm', '_', '_', '_'],
['m', 'm', '_', '_', '_'],
['_', '_', 'm', '_', '_']]
M = len(B); N = len(B[0])
answer = []
for row in range(M):
new_row = []
for column in range(N):
if B[row][column]=='m':
new_row.append('m')
else:
mine_number=0
... | b = [['m', 'm', '_', '_', '_'], ['m', 'm', '_', '_', '_'], ['_', '_', 'm', '_', '_']]
m = len(B)
n = len(B[0])
answer = []
for row in range(M):
new_row = []
for column in range(N):
if B[row][column] == 'm':
new_row.append('m')
else:
mine_number = 0
if row > 0 ... |
# DUNDER METHODS IS METHODS WITH __example___
class Number:
def __init__(self, num):
self.num = num
def __add__(self, num2):
print("lets add")
return self.num + num2.num
def __mul__(self, num2):
print("lets multiply")
return self.num * num2.num
def __str__... | class Number:
def __init__(self, num):
self.num = num
def __add__(self, num2):
print('lets add')
return self.num + num2.num
def __mul__(self, num2):
print('lets multiply')
return self.num * num2.num
def __str__(self):
return f'Decimal Number: {self.num... |
def dfs(i):
if visited[i]:
return
visited[i] = 1
for nbr in graph[i]:
dfs(nbr)
n,e = map(int,input().split())
graph = dict()
visited = [0 for i in range(n+1)]
for i in range(1,n+1):
graph[i] = []
for i in range(e):
u,v = map(int,input().split())
graph[u].append(v)
graph[... | def dfs(i):
if visited[i]:
return
visited[i] = 1
for nbr in graph[i]:
dfs(nbr)
(n, e) = map(int, input().split())
graph = dict()
visited = [0 for i in range(n + 1)]
for i in range(1, n + 1):
graph[i] = []
for i in range(e):
(u, v) = map(int, input().split())
graph[u].append(v)
... |
class Repeater:
def __init__(self, value):
self.value = value
def __iter__(self):
return RepeaterIterator(self)
class RepeaterIterator:
def __init__(self, source):
self.source = source
def __next__(self):
return self.source.value
| class Repeater:
def __init__(self, value):
self.value = value
def __iter__(self):
return repeater_iterator(self)
class Repeateriterator:
def __init__(self, source):
self.source = source
def __next__(self):
return self.source.value |
#### Init
service_domain = data.get('service_domain')
service = data.get('service')
service_data_increase = data.get('service_data_increase')
service_data_decrease = data.get('service_data_decrease')
# fan speed data
speed = data.get('fan_speed')
speed_count = data.get('fan_speed_count')
fan_speed_entity = hass... | service_domain = data.get('service_domain')
service = data.get('service')
service_data_increase = data.get('service_data_increase')
service_data_decrease = data.get('service_data_decrease')
speed = data.get('fan_speed')
speed_count = data.get('fan_speed_count')
fan_speed_entity = hass.states.get(data.get('fan_speed_ent... |
word = input()
while word != "Stop":
print(word)
word = input() | word = input()
while word != 'Stop':
print(word)
word = input() |
# -*- coding: utf-8 -*-
'''
File name: code\number_mind\sol_185.py
Author: Vaidic Joshi
Date created: Oct 20, 2018
Python Version: 3.x
'''
# Solution to Project Euler Problem #185 :: Number Mind
#
# For more information see:
# https://projecteuler.net/problem=185
# Problem Statement
'''
The game Nu... | """
File name: code
umber_mind\\sol_185.py
Author: Vaidic Joshi
Date created: Oct 20, 2018
Python Version: 3.x
"""
"\nThe game Number Mind is a variant of the well known game Master Mind.\nInstead of coloured pegs, you have to guess a secret sequence of digits. After each guess you're only told in how m... |
# Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# generates fennel_rev0
revs = [0]
inas = [
('ina3221', '0x40:0', 'ppvar_sys', 7.7, 0.020, 'rem', True), # R91200
('ina3221', '0x40:1', ... | revs = [0]
inas = [('ina3221', '0x40:0', 'ppvar_sys', 7.7, 0.02, 'rem', True), ('ina3221', '0x40:1', 'vbat', 7.7, 0.02, 'rem', True), ('ina3221', '0x40:2', 'pp1800_h1', 1.8, 0.05, 'rem', True), ('ina3221', '0x41:0', 'ppvar_bl', 7.7, 0.1, 'rem', True), ('ina3221', '0x41:1', 'pp1800_ec', 1.8, 0.05, 'rem', True), ('ina322... |
tx_zips = []
with open('../data/texas-zip-codes.csv', 'r') as fin:
reader = fin.readlines()
i = 0
for row in reader:
newrow = row.split(',')
state = newrow[4].strip('"')
if state == 'TX':
tx_zips.append(newrow[0].strip('"'))
i += 1
with open('tx-zips.txt', 'w... | tx_zips = []
with open('../data/texas-zip-codes.csv', 'r') as fin:
reader = fin.readlines()
i = 0
for row in reader:
newrow = row.split(',')
state = newrow[4].strip('"')
if state == 'TX':
tx_zips.append(newrow[0].strip('"'))
i += 1
with open('tx-zips.txt', 'w') as... |
# Hello World program in Python
print("Python Dictionaries\n")
print("In Python dictionaries are written with curly brackets, and they have keys and values.\n")
# Create and print a dictionary:
thisdict = {
"name": "Alex",
"roll_number": "234566",
"passing_year": 1964
}
print(thisdict)
# You can access t... | print('Python Dictionaries\n')
print('In Python dictionaries are written with curly brackets, and they have keys and values.\n')
thisdict = {'name': 'Alex', 'roll_number': '234566', 'passing_year': 1964}
print(thisdict)
x = thisdict['roll_number']
print(x)
x = thisdict.get('roll_number')
print(x)
thisdict['passing_year... |
def convert_token(token):
cursor = 0
converted_token = ''
while cursor < len(token):
if cursor > 0 and token[cursor].isupper() and token[cursor - 1] != '_':
converted_token += '_' + token[cursor].lower()
elif cursor > 0 and token[cursor - 1].isupper() and converted_token[-1].islo... | def convert_token(token):
cursor = 0
converted_token = ''
while cursor < len(token):
if cursor > 0 and token[cursor].isupper() and (token[cursor - 1] != '_'):
converted_token += '_' + token[cursor].lower()
elif cursor > 0 and token[cursor - 1].isupper() and converted_token[-1].is... |
__author__ = 'fengyuyao'
class Template(object):
def __init__(self, source):
pass
def render(self, **kwargs):
pass
| __author__ = 'fengyuyao'
class Template(object):
def __init__(self, source):
pass
def render(self, **kwargs):
pass |
#
# PySNMP MIB module CNTAU-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CNTAU-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:09:32 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... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, single_value_constraint, value_range_constraint, value_size_constraint) ... |
class Location:
__name: str = None
def __init__(self, name: str) -> None:
if type(name) != str:
raise TypeError('name of Location must be a string')
elif len(name) <= 0:
raise ValueError("name of Location must be non-empty")
self.__name = name
@property
... | class Location:
__name: str = None
def __init__(self, name: str) -> None:
if type(name) != str:
raise type_error('name of Location must be a string')
elif len(name) <= 0:
raise value_error('name of Location must be non-empty')
self.__name = name
@property
... |
asset_permissions = {}
asset_permissions["charge_market_fee"] = 0x01
asset_permissions["white_list"] = 0x02
asset_permissions["override_authority"] = 0x04
asset_permissions["transfer_restricted"] = 0x08
asset_permissions["disable_force_settle"] = 0x10
asset_permissions["global_settle"] = 0x20
asset_permissions["disable... | asset_permissions = {}
asset_permissions['charge_market_fee'] = 1
asset_permissions['white_list'] = 2
asset_permissions['override_authority'] = 4
asset_permissions['transfer_restricted'] = 8
asset_permissions['disable_force_settle'] = 16
asset_permissions['global_settle'] = 32
asset_permissions['disable_confidential'] ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
url = 'http://practiapinta.me/tepinta'
sender = 'practiatepinta@practia.global'
password = ''
smtp = 'owa.pragmaconsultores.net'
body = ''
| url = 'http://practiapinta.me/tepinta'
sender = 'practiatepinta@practia.global'
password = ''
smtp = 'owa.pragmaconsultores.net'
body = '' |
def main():
with open('input.txt') as file:
data = file.read().strip().split('\n')
n = int(data[0])
symbols = data[1]
number = int(data[2])
cleaned_sumbols = ''
for symbol in symbols:
if symbol != ' ':
cleaned_sumbols += symbol
outp... | def main():
with open('input.txt') as file:
data = file.read().strip().split('\n')
n = int(data[0])
symbols = data[1]
number = int(data[2])
cleaned_sumbols = ''
for symbol in symbols:
if symbol != ' ':
cleaned_sumbols += symbol
outp... |
# File: windowsdefenderatp_consts.py
# Copyright (c) 2019 Splunk Inc.
#
# Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
#
DEFENDERATP_PHANTOM_BASE_URL = '{phantom_base_url}rest'
DEFENDERATP_PHANTOM_SYS_INFO_URL = '/system_info'
DEFENDERATP_PHANTOM_ASSET_INFO_URL = '/asset/{asset_id}'
DEFE... | defenderatp_phantom_base_url = '{phantom_base_url}rest'
defenderatp_phantom_sys_info_url = '/system_info'
defenderatp_phantom_asset_info_url = '/asset/{asset_id}'
defenderatp_login_base_url = 'https://login.microsoftonline.com'
defenderatp_server_token_url = '/{tenant_id}/oauth2/token'
defenderatp_authorize_url = '/{te... |
count=0
total=0
print('before', count,total)
for numbers in [9,41,12,3,74,15]:
count=count+1
total=total+numbers
print (count,total,numbers)
print('After', count, total, total/count)
| count = 0
total = 0
print('before', count, total)
for numbers in [9, 41, 12, 3, 74, 15]:
count = count + 1
total = total + numbers
print(count, total, numbers)
print('After', count, total, total / count) |
def karatsuba_multiplication(x, y):
x_digits = len(str(x))
y_digits = len(str(y))
# Base case for the recursion.
if (x_digits == 1 or y_digits == 1):
return x * y
# Figure out where to split.
n2 = max(x_digits, y_digits) / 2
factor = int(10 ** n2)
# Break up the number into p... | def karatsuba_multiplication(x, y):
x_digits = len(str(x))
y_digits = len(str(y))
if x_digits == 1 or y_digits == 1:
return x * y
n2 = max(x_digits, y_digits) / 2
factor = int(10 ** n2)
a = x // factor
b = x % factor
c = y // factor
d = y % factor
z2 = karatsuba_multiplic... |
#!/usr/bin/env python
active = {
'url': 'https://<SUBDOMAIN>.carbonblack.io/api/v1/process',
'key': '<API KEY>'
}
# ======================================================================
# Place API key and URL in 'active' to use with the cmdline-search.py
# ===================================================... | active = {'url': 'https://<SUBDOMAIN>.carbonblack.io/api/v1/process', 'key': '<API KEY>'}
env1 = {'url': 'https://<SUBDOMAIN>.carbonblack.io/api/v1/process', 'key': '<API KEY>'}
env2 = {'url': 'https://<SUBDOMAIN>.carbonblack.io/api/v1/process', 'key': '<API KEY>'}
etc = {'url': 'https://<SUBDOMAIN>.carbonblack.io/api/... |
ctr = 1
while ctr != -1 :
try:
ctr = int(input('Enter a number ( -1 to exit) : '))
except ValueError:
print("That was not a number")
else:
#Only executed when no exception happens
print("No exception happened")
finally:
print("finally executed") | ctr = 1
while ctr != -1:
try:
ctr = int(input('Enter a number ( -1 to exit) : '))
except ValueError:
print('That was not a number')
else:
print('No exception happened')
finally:
print('finally executed') |
#
# PySNMP MIB module CISCO-ATM-IF-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ATM-IF-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:33:08 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, single_value_constraint, value_size_constraint, value_range_constraint) ... |
DEBUG = False
LANGUAGES = (("en", "English"),)
LANGUAGE_CODE = "en"
USE_TZ = False
USE_I18N = True
SECRET_KEY = "fake-key"
PASSWORD_EXPIRE_SECONDS = 10 * 60 # 10 minutes
PASSWORD_EXPIRE_WARN_SECONDS = 5 * 60 # 5 minutes
INSTALLED_APPS = [
"django.contrib.auth",
"django.contrib.contenttypes",
"django.con... | debug = False
languages = (('en', 'English'),)
language_code = 'en'
use_tz = False
use_i18_n = True
secret_key = 'fake-key'
password_expire_seconds = 10 * 60
password_expire_warn_seconds = 5 * 60
installed_apps = ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', '... |
def test_image_name(add_product_with_image, find_product_image):
print(type(find_product_image))
print(find_product_image)
assert 'macbook_pro' in find_product_image
| def test_image_name(add_product_with_image, find_product_image):
print(type(find_product_image))
print(find_product_image)
assert 'macbook_pro' in find_product_image |
# yahoo.py
# Trevor Pottinger
# Fri Oct 18 22:57:23 PDT 2019
class Yahoo(object):
@classmethod
async def gen_s_and_p_history() -> None:
url = 'https://finance.yahoo.com/quote/%5EGSPC/history?period1=1413529200&period2=1571295600&interval=1d&filter=history&frequency=1d'
| class Yahoo(object):
@classmethod
async def gen_s_and_p_history() -> None:
url = 'https://finance.yahoo.com/quote/%5EGSPC/history?period1=1413529200&period2=1571295600&interval=1d&filter=history&frequency=1d' |
# https://leetcode.com/problems/decode-string/
# Given an encoded string, return it's decoded string.
#
# The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note that k is guaranteed to be a positive integer.
#
# You may assume that the input ... | class Solution(object):
def rle_decoding(self, strs):
(res_list, cnt_list, res_str, cnt, i) = ([], [], '', 0, 0)
while i < len(strs):
if strs[i].isdigit():
cnt = cnt * 10 + int(strs[i])
i += 1
continue
else:
j =... |
# OOBE Stages
OOBE_ASK_PHONE_TYPE = 0
OOBE_DOWNLOAD_MESSAGE = 1
OOBE_WAITING_ON_PHONE_TO_ENTER_CODE = 2
OOBE_WAITING_ON_PHONE_TO_ACCEPT_PAIRING = 3
OOBE_PAIRING_SUCCESS = 4
OOBE_CHECKING_FOR_UPDATE = 5
OOBE_STARTING_UPDATE = 6
OOBE_UPDATE_COMPLETE = 7
OOBE_WAITING_ON_PHONE_TO_COMPLETE_OOBE = 8
OOBE_PRESS_ACTION_BUTTON ... | oobe_ask_phone_type = 0
oobe_download_message = 1
oobe_waiting_on_phone_to_enter_code = 2
oobe_waiting_on_phone_to_accept_pairing = 3
oobe_pairing_success = 4
oobe_checking_for_update = 5
oobe_starting_update = 6
oobe_update_complete = 7
oobe_waiting_on_phone_to_complete_oobe = 8
oobe_press_action_button = 9
oobe_error... |
'''
- Leetcode problem: 22
- Difficulty: Medium
- Brief problem description:
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
For example, given n = 3, a solution set is:
[
"((()))",
"(()())",
"(())()",
"()(())",
"()()()"
]
- Solution Summary:
... | """
- Leetcode problem: 22
- Difficulty: Medium
- Brief problem description:
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
For example, given n = 3, a solution set is:
[
"((()))",
"(()())",
"(())()",
"()(())",
"()()()"
]
- Solution Summary:
... |
class Solution:
def isPerfectSquare(self, num: int) -> bool:
left, right = 0, num
while left <= right:
mid = left + (right - left) // 2
if mid * mid == num:
return True
elif mid * mid > num:
right = mid - 1
else:
... | class Solution:
def is_perfect_square(self, num: int) -> bool:
(left, right) = (0, num)
while left <= right:
mid = left + (right - left) // 2
if mid * mid == num:
return True
elif mid * mid > num:
right = mid - 1
else:
... |
# 1-2_find_num.py
def solution(input_str):
# - # - # - # - # - # - # - # - # - # - # - # - # - # - #
# Write your code here.
answer = ""
for i in range(10):
if str(i) in input_str:
pass
else:
answer = str(i)
break
return answer
# - # - # - # - # - # - # - # - # - # - # - # - # - # - #
input_str1 ... | def solution(input_str):
answer = ''
for i in range(10):
if str(i) in input_str:
pass
else:
answer = str(i)
break
return answer
input_str1 = '012345678'
input_str2 = '483750219'
input_str3 = '242810485760109726496'
print(solution(input_str1) + ', ' + solut... |
class Person:
def __init__(self, name, race):
self.name = name
self.race = race
self.stamina = 100
self.agility = 100
self.strenght = 100
self.health = 100
self.intellegence = 100
self.level = 1
self.armor = 20
self.speed = 20
... | class Person:
def __init__(self, name, race):
self.name = name
self.race = race
self.stamina = 100
self.agility = 100
self.strenght = 100
self.health = 100
self.intellegence = 100
self.level = 1
self.armor = 20
self.speed = 20
... |
def parse_instruction(line):
instruction, step = line.split()
return (instruction, int(step))
def parse_program(lines):
return [parse_instruction(line) for line in lines]
def gen_alt_programs(program):
for i in range(len(program)):
ins, step = program[i]
if ins == "jmp":
... | def parse_instruction(line):
(instruction, step) = line.split()
return (instruction, int(step))
def parse_program(lines):
return [parse_instruction(line) for line in lines]
def gen_alt_programs(program):
for i in range(len(program)):
(ins, step) = program[i]
if ins == 'jmp':
... |
class converter:
def convertParagraph(self,st):
st = st.replace("two dollars","$2")
st = st.replace("C M","CM")
st = st.replace("Triple A","AAA")
st = st.replace("United State of America","USA")
return st | class Converter:
def convert_paragraph(self, st):
st = st.replace('two dollars', '$2')
st = st.replace('C M', 'CM')
st = st.replace('Triple A', 'AAA')
st = st.replace('United State of America', 'USA')
return st |
class Solution:
def minSwap(self, A: List[int], B: List[int]) -> int:
n = len(A)
# swap[i]: minimum swap times to make A[:i], B[:i] increasing, with swap on A[i] and B[i]
# notSwap[i]: minimum swap times to make A[:i], B[:i] increasing, without swap on A[i] and B[i]
swap = [n] * n
... | class Solution:
def min_swap(self, A: List[int], B: List[int]) -> int:
n = len(A)
swap = [n] * n
not_swap = [n] * n
swap[0] = 1
notSwap[0] = 0
for i in range(1, n):
if A[i] > A[i - 1] and B[i] > B[i - 1]:
notSwap[i] = notSwap[i - 1]
... |
__version_info__ = __version__ = version = VERSION = '0.1.0'
def get_version():
return version
| __version_info__ = __version__ = version = version = '0.1.0'
def get_version():
return version |
# Challenge 39 Easy
# https://www.reddit.com/r/dailyprogrammer/comments/s6bas/4122012_challenge_39_easy/
# Takes parameter n
# Prints number on each line, except
# if n % 3, print Fizz, n % 5 Buzz, both, FizzBuzz
def nprint(n):
for i in range(1, n+1):
if i % 3 == 0 and i % 5 == 0:
prin... | def nprint(n):
for i in range(1, n + 1):
if i % 3 == 0 and i % 5 == 0:
print('FizzBuzz')
elif i % 3 == 0:
print('Fizz')
elif i % 5 == 0:
print('Buzz')
else:
print(i) |
class PlayViewTickFeature:
def playv_tick(game):
if game.tile_at_player == None:
# skip graphics game.tick
return
if type(game.tile_at_player) == tuple:
if game.tile_at_player[1] == 'a':
# The player has encountered a cliff
game.ti... | class Playviewtickfeature:
def playv_tick(game):
if game.tile_at_player == None:
return
if type(game.tile_at_player) == tuple:
if game.tile_at_player[1] == 'a':
game.tile_at_player = game.tile_at_player[0]
game.focus_camera(game.player)
... |
# coding: utf-8
class Config(object):
def __init__(self):
pass
def initialize(self):
pass
def exit(self):
pass
| class Config(object):
def __init__(self):
pass
def initialize(self):
pass
def exit(self):
pass |
config = {
# +
# This is where you specify your dataset:
# whether it's CVS or MongoDB, the connect parameters, etc.
#
# To experiment with this, replace the CSV file with any dataset that you
# wish to analyze. Or point this to a MongoDB collection.
#
# This particular dataset contains... | config = {'data': {'type': 'CSV', 'collection': 'FY11Leads.csv', 'dbname': None, 'query': {}, 'host': 'localhost', 'port': 27017, 'username': None, 'password': None, 'noid': True}, 'collection': {'label_outputs': ['Recruitment Failure', 'Recruitment Success'], 'cat_features': ['GENDER', 'RACE', 'STATE'], 'cont_features... |
__author__ = 'Arseniy'
class Project:
def __init__(self, name="", description=""):
self.name = name
self.description = description
def __repr__(self):
return "%s; %s" % (self.name, self.description)
def __eq__(self, other):
return self.name == other.name
def name(se... | __author__ = 'Arseniy'
class Project:
def __init__(self, name='', description=''):
self.name = name
self.description = description
def __repr__(self):
return '%s; %s' % (self.name, self.description)
def __eq__(self, other):
return self.name == other.name
def name(sel... |
class credentials:
'''
Class that generates new instances of credentials
'''
credentials_list = []
def __init__(self, user_name, password):
self.user_name = user_name
self.password = password
'''
__init__method that helps define properties for our objects.
... | class Credentials:
"""
Class that generates new instances of credentials
"""
credentials_list = []
def __init__(self, user_name, password):
self.user_name = user_name
self.password = password
'\n __init__method that helps define properties for our objects.\n ... |
# Python implementation of puzzle 5
# Probably should add string ops to Lavender STL
def main(str):
seq = list(map(lambda x: int(x), str.split()))
count = 0
pos = 0
while pos >= 0 and pos < len(seq):
tmp = pos
pos += seq[pos]
seq[tmp] += 1
count += 1
return count
... | def main(str):
seq = list(map(lambda x: int(x), str.split()))
count = 0
pos = 0
while pos >= 0 and pos < len(seq):
tmp = pos
pos += seq[pos]
seq[tmp] += 1
count += 1
return count
def main2(str):
seq = list(map(lambda x: int(x), str.split()))
count = 0
pos... |
text = type(type)
print(text)
| text = type(type)
print(text) |
#C1 = int(input())
#N1 = int(input())
#V1 = float(input())
#C2 = int(input())
#N2 = int(input())
#V2 = float(input())
#soma1 = N1 * V1
#soma2 = N2 * V2
#resultado = soma1 + soma2
#print('VALOR A PAGAR: R$ %.2f' % resultado)
linha = input().split()
C1 = int(linha[0])
N1 = int(linha[1])
V1 = float(linha[2])
linha2 ... | linha = input().split()
c1 = int(linha[0])
n1 = int(linha[1])
v1 = float(linha[2])
linha2 = input().split()
c2 = int(linha2[0])
n2 = int(linha2[1])
v2 = float(linha2[2])
resultado = N1 * V1 + N2 * V2
print('VALOR A PAGAR: R$ %.2f' % resultado) |
class AccessingNonExistingUserError(Exception):
def __init__(self, uid):
self.message = (f"User with ID {uid} can not be accessed as this user",
" does not exist or is not registered")
super().__init__(self.message)
| class Accessingnonexistingusererror(Exception):
def __init__(self, uid):
self.message = (f'User with ID {uid} can not be accessed as this user', ' does not exist or is not registered')
super().__init__(self.message) |
# Copyright (c) 2019 AT&T Intellectual Property. 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 ... | global_injected_appmgr_ip_addr = '127.0.0.1'
global_injected_appmgr_user = 'test'
global_injected_appmgr_password = 'test'
global_injected_e2_mgr_ip_addr = '127.0.0.1'
global_injected_e2_mgr_user = 'test'
global_injected_e2_mgr_password = 'test'
global_injected_properties = {'GLOBAL_INJECTED_APPMGR_IP_ADDR': '127.0.0.1... |
expected_output = {
1: {
"groupname": "2c",
"sec_model": "v1",
"contextname": "none",
"storage_type": "volatile",
"readview": "none",
"writeview": "none",
"notifyview": "*tv.FFFF58bf.eaFF58bf.eaFFFFFF.F",
"row_status": {"status": "active"},
},
... | expected_output = {1: {'groupname': '2c', 'sec_model': 'v1', 'contextname': 'none', 'storage_type': 'volatile', 'readview': 'none', 'writeview': 'none', 'notifyview': '*tv.FFFF58bf.eaFF58bf.eaFFFFFF.F', 'row_status': {'status': 'active'}}, 2: {'groupname': '2c', 'sec_model': 'v2c', 'contextname': 'none', 'storage_type'... |
def day06a(input_path):
responses = [line.strip() for line in open(input_path)]
group_response = set()
total = 0
for response in responses:
if not response:
total += len(group_response)
group_response = set()
else:
group_response |= set(response)
... | def day06a(input_path):
responses = [line.strip() for line in open(input_path)]
group_response = set()
total = 0
for response in responses:
if not response:
total += len(group_response)
group_response = set()
else:
group_response |= set(response)
t... |
def exponentiation(a, n):
'''log(n) time exponentiation'''
if n == 0:
return 1
elif n % 2: # odd
return a*exponentiation(a, n-1)
else: # even
return exponentiation(a*a, n/2)
def test_one(a, n, res_exp):
an = exponentiation(a, n)
print("exponentiation(%d, %d) = %d" % (... | def exponentiation(a, n):
"""log(n) time exponentiation"""
if n == 0:
return 1
elif n % 2:
return a * exponentiation(a, n - 1)
else:
return exponentiation(a * a, n / 2)
def test_one(a, n, res_exp):
an = exponentiation(a, n)
print('exponentiation(%d, %d) = %d' % (a, n, an... |
USER_AGENTS = [
(
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko)'
' Chrome/39.0.2171.95 Safari/537.36'
),
(
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)'
' Chrome/42.0.2311.135 Safari/537.36 Edge/12... | user_agents = ['Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246'] |
def main():
print("Hello World!")
test()
pozdrav()
def test():
print("This is a test")
def pozdrav():
print("Hello")
if __name__ == '__main__':
main()
| def main():
print('Hello World!')
test()
pozdrav()
def test():
print('This is a test')
def pozdrav():
print('Hello')
if __name__ == '__main__':
main() |
class Empty:
def __init__(self, *args, **kwargs):
pass
def __repr__(self):
return "Empty"
def __str__(self):
return "Empty" | class Empty:
def __init__(self, *args, **kwargs):
pass
def __repr__(self):
return 'Empty'
def __str__(self):
return 'Empty' |
# -*- coding: utf-8 -*-
class drone:
def __init__(self, location, maximum_load):
self.location = location
self.maximum_load = maximum_load
productsOnBoard = list()
self.state = 0
self.alarm = 0
self.isBusy = False
def Load(self, warehouse, product):
if... | class Drone:
def __init__(self, location, maximum_load):
self.location = location
self.maximum_load = maximum_load
products_on_board = list()
self.state = 0
self.alarm = 0
self.isBusy = False
def load(self, warehouse, product):
if warehouse.take(product)... |
# date: 09/07/2020
# Description:
# Given a string, we want to remove 2 adjacent characters that are the same,
# and repeat the process with the new string until we can no longer perform the operation.
def remove_adjacent_dup(s):
finished = False
index = 0
while not finished:
if s[index+1]=... | def remove_adjacent_dup(s):
finished = False
index = 0
while not finished:
if s[index + 1] == s[index]:
s = s.replace(s[index + 1], '')
index = 0
else:
index += 1
if index + 1 > len(s) - 1:
finished = True
return s
print(remove_adja... |
wtf = list(range(1000))
for i in range(len(wtf)):
wtf[i] = 2
print(wtf) | wtf = list(range(1000))
for i in range(len(wtf)):
wtf[i] = 2
print(wtf) |
#!/usr/bin/env python3
########################################################################
# #
# Program purpose: Program to check the priority of the four #
# operators (+, -, *, /) #
# ... | __operators__ = '+-/*'
__parenthesis__ = '()'
__priority__ = {'+': 0, '-': 0, '*': 1, '/': 1}
def test_higher_priority(operatorA, operatorB):
return __priority__[operatorA] >= __priority__[operatorB]
if __name__ == '__main__':
print(test_higher_priority('*', '-'))
print(test_higher_priority('+', '-'))
... |
par = []
impar = []
cont = 0
im = 0
p = 0
while cont < 15:
num = int(input())
if num % 2 == 0:
par.append(num)
p += 1
else:
impar.append(num)
im += 1
if p > 4:
for i in range(5):
print(f'par[{i}] = {par[i]}')
par = []
p = 0
if im > ... | par = []
impar = []
cont = 0
im = 0
p = 0
while cont < 15:
num = int(input())
if num % 2 == 0:
par.append(num)
p += 1
else:
impar.append(num)
im += 1
if p > 4:
for i in range(5):
print(f'par[{i}] = {par[i]}')
par = []
p = 0
if im > ... |
#==================================================================================================
# python_scripts/set_state.py
# modified from - https://community.home-assistant.io/t/how-to-manually-set-state-value-of-sensor/43975/37
#===============================================================================... | input_entity = data.get('entity_id')
if inputEntity is None:
logger.warning('===== entity_id is required if you want to set something.')
else:
input_state_object = hass.states.get(inputEntity)
if inputStateObject is None and (not data.get('allow_create')):
logger.warning('===== unknown entity_id: %s... |
string1 = "Devops"
string2 = "Project"
joined_string = string1 +' '+ string2 ## Add space between two strings
print(joined_string)
| string1 = 'Devops'
string2 = 'Project'
joined_string = string1 + ' ' + string2
print(joined_string) |
num = 2 ** 1000
num = list(str(num))
total = 0
for i in num:
total += int(i)
print(total)
| num = 2 ** 1000
num = list(str(num))
total = 0
for i in num:
total += int(i)
print(total) |
#desafio 25: procurando uma string dentro de outra // verifica se o nome tem SILVA
nome = str(input('Digite seu nome completo: ')).strip().upper()
print('^'*30)
print(f'\33[34mSeu nome tem Silva? {"SILVA" in nome}\33[m')
print('^'*30)
| nome = str(input('Digite seu nome completo: ')).strip().upper()
print('^' * 30)
print(f"\x1b[34mSeu nome tem Silva? {'SILVA' in nome}\x1b[m")
print('^' * 30) |
# part one
lines = open('input.txt', 'r').readlines()
gammaRate = ""
for pos in range(len(lines[0].strip())):
oneCount = len([p for p in lines if p[pos] == "1"])
gammaRate += "1" if 2 * oneCount > len(lines) else "0"
print(int(gammaRate, 2) * int(gammaRate.replace("1", "#").replace("0", "1").replace("#", "0"),... | lines = open('input.txt', 'r').readlines()
gamma_rate = ''
for pos in range(len(lines[0].strip())):
one_count = len([p for p in lines if p[pos] == '1'])
gamma_rate += '1' if 2 * oneCount > len(lines) else '0'
print(int(gammaRate, 2) * int(gammaRate.replace('1', '#').replace('0', '1').replace('#', '0'), 2))
oxyg... |
def network():
model = tf.keras.Sequential()
model.add(kl.InputLayer(input_shape=(224, 224, 3)))
# First conv block
model.add(kl.Conv2D(filters=96, kernel_size=7, padding='same', strides=2))
model.add(tf.keras.layers.ReLU())
model.add(kl.MaxPooling2D(pool_size=(3, 3)))
# Second conv block
... | def network():
model = tf.keras.Sequential()
model.add(kl.InputLayer(input_shape=(224, 224, 3)))
model.add(kl.Conv2D(filters=96, kernel_size=7, padding='same', strides=2))
model.add(tf.keras.layers.ReLU())
model.add(kl.MaxPooling2D(pool_size=(3, 3)))
model.add(kl.Conv2D(filters=256, kernel_size=... |
src = []
component = aos_component('osal', src)
component.add_global_includes('mico/include', 'include')
component.add_comp_deps("middleware/alink/cloud")
if aos_global_config.arch == 'ARM968E-S':
component.add_cflags('-marm')
@pre_config('osal')
def osal_pre(comp):
osal = aos_global_config.get('osal', 'rhin... | src = []
component = aos_component('osal', src)
component.add_global_includes('mico/include', 'include')
component.add_comp_deps('middleware/alink/cloud')
if aos_global_config.arch == 'ARM968E-S':
component.add_cflags('-marm')
@pre_config('osal')
def osal_pre(comp):
osal = aos_global_config.get('osal', 'rhino'... |
#
# PySNMP MIB module TRAPEZE-NETWORKS-BASIC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TRAPEZE-NETWORKS-BASIC-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:27:11 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version ... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection, constraints_union) ... |
# date: 01/07/2020
# Description:
# A Perfect Number is a positive integer
# that is equal to the sum of all its
# positive divisors except itself.
class Solution(object):
def checkPerfectNumber(self, num):
if num <= 0:
return False,[]
divisors = []
for i in range(1,... | class Solution(object):
def check_perfect_number(self, num):
if num <= 0:
return (False, [])
divisors = []
for i in range(1, num):
if num % i == 0:
divisors.append(i)
total = 0
for i in divisors:
total += i
if total... |
# GCD
def gcd(a, b):
while(b != 0):
t = a
a = b
b = t % b
return a
def main():
print(gcd(60, 96))
print(gcd(20, 8))
if __name__ == "__main__":
main() | def gcd(a, b):
while b != 0:
t = a
a = b
b = t % b
return a
def main():
print(gcd(60, 96))
print(gcd(20, 8))
if __name__ == '__main__':
main() |
n=input()
r=0
for i in range(1, 2**9+1):
r+=(int(bin(i)[2:]) <= int(n))
print(r)
| n = input()
r = 0
for i in range(1, 2 ** 9 + 1):
r += int(bin(i)[2:]) <= int(n)
print(r) |
def run(coro):
try:
coro.send(None)
except StopIteration as e:
return e.value
async def coro():
print('coro')
class AContextManager():
async def __aenter__(self):
print('Entering')
await coro()
return self
async def __aexit__(self, ty, val, tb):
pri... | def run(coro):
try:
coro.send(None)
except StopIteration as e:
return e.value
async def coro():
print('coro')
class Acontextmanager:
async def __aenter__(self):
print('Entering')
await coro()
return self
async def __aexit__(self, ty, val, tb):
prin... |
#!/usr/bin/env python
with open("my_new_file.txt", "a") as f:
f.write('something else\n')
| with open('my_new_file.txt', 'a') as f:
f.write('something else\n') |
# Copyright Rein Halbersma 2018-2021.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# http://forum.stratego.com/topic/357378-strategy-question-findingavoiding-bombs-at-the-end-of-games/?p=432... | print('TODO: implement first move statistics') |
class TreeNode:
def __init__(self, data, left=None, right=None):
self.data = data
self.left = left
self.right = right
def __str__(self):
fmt = 'TreeNode(data={}, left={}, right={})'
return fmt.format(self.data, self.left, self.right)
class BinarySearchTree:
def _... | class Treenode:
def __init__(self, data, left=None, right=None):
self.data = data
self.left = left
self.right = right
def __str__(self):
fmt = 'TreeNode(data={}, left={}, right={})'
return fmt.format(self.data, self.left, self.right)
class Binarysearchtree:
def __... |
##CONFIG##
##Leave it for blank if you don't want to include data from that source
#Ether addresses that you'd like to watch. Input them as a list if there're more than one address.
#E.g.: addresses = ['0xad2a6d5890c06083c340d723053b4040a28580ef', '0x214d0bb2b260b22b1498977200c1a32bdb75131b']
addresses = []
#Get thi... | addresses = []
bittrex_apikey = ''
bittrex_apisecret = b''
poloniex_apikey = ''
poloniex_apisecret = b''
bitfinex_apikey = ''
bitfinex_apisecret = b''
bigone_apikey = ''
other_bl = {} |
potential_list = [[1,1],[1,0],[-1,0],[0,-1],[-3,1]]
print(potential_list)
for item1,item2 in potential_list:
if item2 <= 0:
potential_list.remove([item1,item2])
for item1,item2 in potential_list:
if item1 <= 0:
potential_list.remove([item1,item2])
print(potential_list) | potential_list = [[1, 1], [1, 0], [-1, 0], [0, -1], [-3, 1]]
print(potential_list)
for (item1, item2) in potential_list:
if item2 <= 0:
potential_list.remove([item1, item2])
for (item1, item2) in potential_list:
if item1 <= 0:
potential_list.remove([item1, item2])
print(potential_list) |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: __init__.py
# -------------------
# Divine Oasis
# Text Based RPG Game
# By wsngamerz
# -------------------
__author__ = "wsngamerz"
__version__ = "0.0.1 ALPHA 1"
| __author__ = 'wsngamerz'
__version__ = '0.0.1 ALPHA 1' |
print(1,2,3)
| print(1, 2, 3) |
geo, par, val,override = IN
setPreviously = False
try:
tags = geo.Tags
if tags.LookupTag(par) is None or override:
tags.AddTag(par, val)
except ValueError:
setPreviously = True
OUT = IN[0], setPreviously | (geo, par, val, override) = IN
set_previously = False
try:
tags = geo.Tags
if tags.LookupTag(par) is None or override:
tags.AddTag(par, val)
except ValueError:
set_previously = True
out = (IN[0], setPreviously) |
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
# def bstFromPreorder(self, preorder):
# if not preorder:
# return None
# preorder.sort()
# root = self.generator(1, preorder)
# return root... | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def bst_from_preorder(self, preorder):
if not preorder:
return None
inorder = sorted(preorder)
def generator(preorder, inorder):
if n... |
def sum_mul(n, m):
sumu = 0
if n > 0 and m > 0:
for i in range(n, m):
if (i % n == 0):
sumu += i
else:
return 'INVALID'
return sumu | def sum_mul(n, m):
sumu = 0
if n > 0 and m > 0:
for i in range(n, m):
if i % n == 0:
sumu += i
else:
return 'INVALID'
return sumu |
string = 'some text'
print(string)
print(id(string))
print('Run fuction, then print string and it\'s id again without using the function')
def changeString():
string = 'changed'
print(string)
print(id(string))
changeString()
print(string)
print(id(string))
print('(Redeclaring function)')
print('Run fuctio... | string = 'some text'
print(string)
print(id(string))
print("Run fuction, then print string and it's id again without using the function")
def change_string():
string = 'changed'
print(string)
print(id(string))
change_string()
print(string)
print(id(string))
print('(Redeclaring function)')
print("Run fuctio... |
for letter in 'Python':
if letter == 'h':
pass
print("This is Pass Block")
print("Current letter", letter)
print("Good Job") | for letter in 'Python':
if letter == 'h':
pass
print('This is Pass Block')
print('Current letter', letter)
print('Good Job') |
### building a more advance calculator with python
num1 = float(input("Enter first number: "))
op = input("Enter operator: ")
num2 = float(input("Enter second number: "))
if op == "+":
print(num1 + num2)
elif op == "-":
print(num1 - num2)
elif op == "*":
print(num1 * num2)
elif op == "/":
... | num1 = float(input('Enter first number: '))
op = input('Enter operator: ')
num2 = float(input('Enter second number: '))
if op == '+':
print(num1 + num2)
elif op == '-':
print(num1 - num2)
elif op == '*':
print(num1 * num2)
elif op == '/':
print(num1 / num2)
else:
print('invalid operation') |
print("FINDING ROOTS OF A QUADRATIC EQUATION\n\n")
print("Any general quadratic equation will be of the form 'ax^2+bx+c=0', \ntherefore state values...")
a=int(input("\tcoefficient of x^2, a= "))
b=int(input("\tcoefficient of x, b= "))
c=int(input("\tconstant, c= "))
x=(b**2)-4*a*c
if(x==0):
print("\nThe roo... | print('FINDING ROOTS OF A QUADRATIC EQUATION\n\n')
print("Any general quadratic equation will be of the form 'ax^2+bx+c=0', \ntherefore state values...")
a = int(input('\tcoefficient of x^2, a= '))
b = int(input('\tcoefficient of x, b= '))
c = int(input('\tconstant, c= '))
x = b ** 2 - 4 * a * c
if x == 0:
print('\... |
dysk = set()
with open(
r"D:\_MACIEK_\python_proby\skany_fabianki\lista_P.txt", "r"
) as listadysk:
for line in listadysk:
dysk.add(line)
with open(
r"D:\_MACIEK_\python_proby\skany_fabianki\lista_dysk.txt", "r"
) as listaP:
for line in listaP:
if line not in dysk:
with ope... | dysk = set()
with open('D:\\_MACIEK_\\python_proby\\skany_fabianki\\lista_P.txt', 'r') as listadysk:
for line in listadysk:
dysk.add(line)
with open('D:\\_MACIEK_\\python_proby\\skany_fabianki\\lista_dysk.txt', 'r') as lista_p:
for line in listaP:
if line not in dysk:
with open('D:\\... |
# initial configurations
PORT=33000
HOST="0.0.0.0"
| port = 33000
host = '0.0.0.0' |
#
# PySNMP MIB module NAI-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NAI-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:22:50 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:15)... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, constraints_union, constraints_intersection, value_range_constraint) ... |
# Checking if a binary tree is a perfect binary tree in Python
class newNode:
def __init__(self, k):
self.key = k
self.right = self.left = None
# Calculate the depth
def calculateDepth(node):
d = 0
while node is not None:
d += 1
node = node.left
return ... | class Newnode:
def __init__(self, k):
self.key = k
self.right = self.left = None
def calculate_depth(node):
d = 0
while node is not None:
d += 1
node = node.left
return d
def is_perfect(root, d, level=0):
if root is None:
return True
if root.left is Non... |
# print("Please choose your option from the list below:")
# print("1:\tLearn Python")
# print("2:\tLearn Java")
# print("3:\tGo swimming")
# print("4:\tHave dinner")
# print("5:\tGo to bed")
# print("0:\tExit")
choice = "-"
while choice != "0":
# while True:
# choice = input()
# if choice == "0":
# bre... | choice = '-'
while choice != '0':
if choice in '12345':
print('You chose {}'.format(choice))
else:
print('Please choose your option from the list below:')
print('1:\tLearn Python')
print('2:\tLearn Java')
print('3:\tGo swimming')
print('4:\tHave dinner')
p... |
k = int(input())
chess = 'W'
empty = '.'
neighbour = [[0, -1], [0, 1], [1, 0], [-1, 0],[1,-1],[1,1],[-1,-1],[-1,1]]
def dfs(r, c, area, visited):
mianji = 1
visited[r][c] = 1
stack = []
stack.append([r, c])
while len(stack) != 0:
x, y = stack.pop()
for dx, dy in neighbour:
... | k = int(input())
chess = 'W'
empty = '.'
neighbour = [[0, -1], [0, 1], [1, 0], [-1, 0], [1, -1], [1, 1], [-1, -1], [-1, 1]]
def dfs(r, c, area, visited):
mianji = 1
visited[r][c] = 1
stack = []
stack.append([r, c])
while len(stack) != 0:
(x, y) = stack.pop()
for (dx, dy) in neighbou... |
r_result_json = {
'result': [{
'dst_is_ip':
'false',
'src_is_ip':
'true',
'dst_list':
'seclist:/Compute-587626604/mayurnath.gokare@oracle.com/paas/SOA/gc3ntagrogr605/lb/ora_otd_infraadmin',
'name':
'/Compute-587626604/mayurnath.gokare@o... | r_result_json = {'result': [{'dst_is_ip': 'false', 'src_is_ip': 'true', 'dst_list': 'seclist:/Compute-587626604/mayurnath.gokare@oracle.com/paas/SOA/gc3ntagrogr605/lb/ora_otd_infraadmin', 'name': '/Compute-587626604/mayurnath.gokare@oracle.com/paas/SOA/gc3ntagrogr605/lb/sys_infra2otd_admin_ssh', 'src_list': 'seciplist:... |
# SPDX-License-Identifier: MIT
# Copyright (c) 2020 Akumatic
#
#https://adventofcode.com/2020/day/13
def readFile() -> tuple:
with open(f"{__file__.rstrip('code.py')}input.txt", "r") as f:
timestamp = int(f.readline().strip())
values = f.readline().strip().split(",")
bus_ids = [{"value": in... | def read_file() -> tuple:
with open(f"{__file__.rstrip('code.py')}input.txt", 'r') as f:
timestamp = int(f.readline().strip())
values = f.readline().strip().split(',')
bus_ids = [{'value': int(values[i]), 'index': i} for i in range(len(values)) if values[i] != 'x']
return (timestamp,... |
class File:
def __init__(self, code: str, name: str, ast):
self.lines = code.splitlines()
self.name = name
self.ast = ast
def line(self, number):
return self.lines[number]
| class File:
def __init__(self, code: str, name: str, ast):
self.lines = code.splitlines()
self.name = name
self.ast = ast
def line(self, number):
return self.lines[number] |
class LogicStringUtil:
@staticmethod
def getBytes(string):
return string.encode()
@staticmethod
def getByteLength(string):
return len(string)
| class Logicstringutil:
@staticmethod
def get_bytes(string):
return string.encode()
@staticmethod
def get_byte_length(string):
return len(string) |
# MIT License
#
# Copyright (c) 2017 Changsung
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pu... | class Basestrategy:
""" class for strategy.
write an algorithm in this class"""
__signals = {}
def __init__(self):
pass
def add_signals(self, key, signal):
self.__signals[key] = signal
signal.setStrategy(self)
def get_signal(self, key):
return self.__signals[key... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.