content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
IMAGE_PATH = "H:\Asu\mwdb\project-phase-0\CSE 515 Fall19 - Smaller Dataset\Phase-1\CSE 515 Fall19 - Smaller Dataset\Hand_0008110.jpg"
IMAGE_FOLDER = "H:\Asu\mwdb\project-phase-0\CSE 515 Fall19 - Smaller Dataset\images"
DATABASE_FOLDER = "H:\Asu\mwdb\project-phase-0\CSE 515 Fall19 - Smaller Dataset\Database\\"
METADA... | image_path = 'H:\\Asu\\mwdb\\project-phase-0\\CSE 515 Fall19 - Smaller Dataset\\Phase-1\\CSE 515 Fall19 - Smaller Dataset\\Hand_0008110.jpg'
image_folder = 'H:\\Asu\\mwdb\\project-phase-0\\CSE 515 Fall19 - Smaller Dataset\\images'
database_folder = 'H:\\Asu\\mwdb\\project-phase-0\\CSE 515 Fall19 - Smaller Dataset\\Data... |
def remove_duplicates(some_list):
return list(set(some_list))
def run():
random_list = [1,1,2,2,4]
print(remove_duplicates(random_list))
if __name__ == '__main__':
run() | def remove_duplicates(some_list):
return list(set(some_list))
def run():
random_list = [1, 1, 2, 2, 4]
print(remove_duplicates(random_list))
if __name__ == '__main__':
run() |
# -*- coding: utf-8 -*-
# Copyright (c) 2016, 2017, 2018, 2019 Sqreen. All rights reserved.
# Please refer to our terms for more information:
#
# https://www.sqreen.io/terms.html
#
__author__ = "Sqreen"
__copyright__ = "Copyright 2016, 2017, 2018, 2019, Sqreen"
__email__ = "contact@sqreen.io"
__license__ = "propri... | __author__ = 'Sqreen'
__copyright__ = 'Copyright 2016, 2017, 2018, 2019, Sqreen'
__email__ = 'contact@sqreen.io'
__license__ = 'proprietary'
__version__ = '0.4.1' |
# Copyright 2017 Michael Blondin, Alain Finkel, Christoph Haase, Serge Haddad
# 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 requir... | class Configuration:
def __init__(self):
pass
def __eq__(self, other):
raise not_implemented_error()
def __ne__(self, other):
raise not_implemented_error()
def __gt__(self, other):
raise not_implemented_error()
def __ge__(self, other):
raise not_implement... |
class Report(object):
def __init__(self):
self._packets_in_buffer = []
self._packet_wait_time = []
self._server_load = []
def update_state(self, packets_in_buffer, packet_wait_time, server_load):
self._packets_in_buffer.append(packets_in_buffer)
self._packet_wait_time.ap... | class Report(object):
def __init__(self):
self._packets_in_buffer = []
self._packet_wait_time = []
self._server_load = []
def update_state(self, packets_in_buffer, packet_wait_time, server_load):
self._packets_in_buffer.append(packets_in_buffer)
self._packet_wait_time.a... |
# coding=utf-8
if __name__ == "__main__":
print("developing...") | if __name__ == '__main__':
print('developing...') |
ITALY_CITIES = ['Roma', 'Milano']
GERMAN_CITIES = ['Berlin', 'Frankfurt']
US_CITIES = ['Boston', 'Los Angeles']
# Our restaurant is named differently in different
# in different parts of the world
def get_restaurant_name(city: str) -> str:
if city in ITALY_CITIES:
return "Trattoria Viafore"
if city i... | italy_cities = ['Roma', 'Milano']
german_cities = ['Berlin', 'Frankfurt']
us_cities = ['Boston', 'Los Angeles']
def get_restaurant_name(city: str) -> str:
if city in ITALY_CITIES:
return 'Trattoria Viafore'
if city in GERMAN_CITIES:
return "Pat's Kantine"
if city in US_CITIES:
retur... |
"""easyNeuron is the simplest way to design, build and test machine learnng models.
Submodules
----------
easyneuron.math - The math tools needed for the module
easyneuron.neighbours - KNearest and other neighbourb based ML models
easyneuron.types - The custom types for the module
""" | """easyNeuron is the simplest way to design, build and test machine learnng models.
Submodules
----------
easyneuron.math - The math tools needed for the module
easyneuron.neighbours - KNearest and other neighbourb based ML models
easyneuron.types - The custom types for the module
""" |
# Description: Imports needed for most uses of pymol in Jupyter. Combination of importPyMOL and importPythonDisplay.
# Source: placeHolder
"""
cmd.do('from pymol import cmd')
cmd.do('from IPython.display import Image')
cmd.do('from IPython.core.display import HTML')
cmd.do('PATH = "/Users/blaine/"')
"""
cmd.do('fro... | """
cmd.do('from pymol import cmd')
cmd.do('from IPython.display import Image')
cmd.do('from IPython.core.display import HTML')
cmd.do('PATH = "/Users/blaine/"')
"""
cmd.do('from pymol import cmd')
cmd.do('from IPython.display import Image')
cmd.do('from IPython.core.display import HTML')
cmd.do('PATH = "/Users/blaine/... |
training_data_hparams = {
'shuffle': False,
'num_epochs': 1,
'batch_size': 5,
'allow_smaller_final_batch': False,
'source_dataset': {
"files": ['data/iwslt14/train.de'],
'vocab_file': 'data/iwslt14/vocab.de',
'max_seq_length': 50
},
'target_dataset': {
'files'... | training_data_hparams = {'shuffle': False, 'num_epochs': 1, 'batch_size': 5, 'allow_smaller_final_batch': False, 'source_dataset': {'files': ['data/iwslt14/train.de'], 'vocab_file': 'data/iwslt14/vocab.de', 'max_seq_length': 50}, 'target_dataset': {'files': ['data/iwslt14/train.en'], 'vocab_file': 'data/iwslt14/vocab.e... |
def foo(x):
return x**2
def decorator(func):
def wrapper(*args, **kwargs):
print(func, args, kwargs)
return func(*args, **kwargs)
return wrapper
_decorated_funcs = defaultdict(lambda: [])
_applied_decorators = defaultdict(lambda: [])
def apply_decorator(func, decorator):
_decorated_fu... | def foo(x):
return x ** 2
def decorator(func):
def wrapper(*args, **kwargs):
print(func, args, kwargs)
return func(*args, **kwargs)
return wrapper
_decorated_funcs = defaultdict(lambda : [])
_applied_decorators = defaultdict(lambda : [])
def apply_decorator(func, decorator):
_decorate... |
# Created by MechAviv
# ID :: [910150001]
# Frozen Fairy Forest : Elluel
sm.showEffect("Effect/Direction5.img/effect/mercedesInIce/merBalloon/8", 2000, 0, -100, 0, -2, False, 0)
sm.sendDelay(2000)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(False, True, False, False)
sm.progressMessageFont(3, 20, 20, 0, "Pr... | sm.showEffect('Effect/Direction5.img/effect/mercedesInIce/merBalloon/8', 2000, 0, -100, 0, -2, False, 0)
sm.sendDelay(2000)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(False, True, False, False)
sm.progressMessageFont(3, 20, 20, 0, 'Press the Alt key to jump.') |
"""Constants for testing the Coinbase integration."""
GOOD_CURRENCY = "BTC"
GOOD_CURRENCY_2 = "USD"
GOOD_CURRENCY_3 = "EUR"
GOOD_EXCHNAGE_RATE = "BTC"
GOOD_EXCHNAGE_RATE_2 = "ATOM"
BAD_CURRENCY = "ETH"
BAD_EXCHANGE_RATE = "ETH"
MOCK_ACCOUNTS_RESPONSE = [
{
"balance": {"amount": "13.38", "currency": GOOD_C... | """Constants for testing the Coinbase integration."""
good_currency = 'BTC'
good_currency_2 = 'USD'
good_currency_3 = 'EUR'
good_exchnage_rate = 'BTC'
good_exchnage_rate_2 = 'ATOM'
bad_currency = 'ETH'
bad_exchange_rate = 'ETH'
mock_accounts_response = [{'balance': {'amount': '13.38', 'currency': GOOD_CURRENCY_3}, 'cur... |
#!/usr/bin/env python3
input = int(input())
def scores_after_n_receipes(n):
scores = [3, 7]
elfs_positions = [0, 1]
target_scores = n + 10
while len(scores) < target_scores:
new_receipe_score = 0
for i, pos in enumerate(elfs_positions):
new_receipe_score += scores[pos]
... | input = int(input())
def scores_after_n_receipes(n):
scores = [3, 7]
elfs_positions = [0, 1]
target_scores = n + 10
while len(scores) < target_scores:
new_receipe_score = 0
for (i, pos) in enumerate(elfs_positions):
new_receipe_score += scores[pos]
scores.extend(map(... |
# try:
# total = 1/0
# # this will not execute
# except Exception:
# total = 0
# print(total) # 0
# try:
# total = 1/0
# print("This will not show up.")
# except Exception:
# print("Exception was caught") # Exception was caught
# total = 0
# print(total) # 0
# num = input("What is a... | num = input('What is a number? ')
num = int(num)
print(num) |
class ErroresLexicos():
'''
Parametros:
- Descripcion:str
Descripcion
- linea y columna:numeric
linea y columna
- clase origen:str
Sirve para decir en que clase del patron interprete trono
'''
def __init__(self, des... | class Erroreslexicos:
"""
Parametros:
- Descripcion:str
Descripcion
- linea y columna:numeric
linea y columna
- clase origen:str
Sirve para decir en que clase del patron interprete trono
"""
def __init__(self, descr... |
#
# PySNMP MIB module CISCO-PORT-CHANNEL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-PORT-CHANNEL-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:09:40 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, constraints_intersection, single_value_constraint, constraints_union) ... |
if __name__ == '__main__':
na = int(input())
a = list(map(int,input().split()))
nb = int(input())
b = list(map(int, input().split()))
if len(a) == na and len(b) == nb:
set_a = set(a)
set_b = set(b)
symmetric_diff = list(set_a.symmetric_difference(set_b))
symmetric_d... | if __name__ == '__main__':
na = int(input())
a = list(map(int, input().split()))
nb = int(input())
b = list(map(int, input().split()))
if len(a) == na and len(b) == nb:
set_a = set(a)
set_b = set(b)
symmetric_diff = list(set_a.symmetric_difference(set_b))
symmetric_di... |
"""Configurations for the RC car"""
PICAMERA_RESOLUTION_WIDTH = 640
PICAMERA_RESOLUTION_HEIGHT = 480
PICAMERA_RESOLUTION = (PICAMERA_RESOLUTION_WIDTH, PICAMERA_RESOLUTION_HEIGHT)
PICAMERA_FRAMERATE = 60
PICAMERA_WARM_UP_TIME = 2
BACK_MOTOR_DATA_ONE = 17
BACK_MOTOR_DATA_TWO = 27
BACK_MOTOR_ENABLE_PIN = 22
FRONT_MOTOR_... | """Configurations for the RC car"""
picamera_resolution_width = 640
picamera_resolution_height = 480
picamera_resolution = (PICAMERA_RESOLUTION_WIDTH, PICAMERA_RESOLUTION_HEIGHT)
picamera_framerate = 60
picamera_warm_up_time = 2
back_motor_data_one = 17
back_motor_data_two = 27
back_motor_enable_pin = 22
front_motor_da... |
def tune(scale, acc_rate):
"""
tune: bool
Flag for tuning. Defaults to True.
tune_interval: int
The frequency of tuning. Defaults to 100 iterations.
Module from pymc3
Tunes the scaling parameter for the proposal distribution
according to the acceptance rate over the last tune_i... | def tune(scale, acc_rate):
"""
tune: bool
Flag for tuning. Defaults to True.
tune_interval: int
The frequency of tuning. Defaults to 100 iterations.
Module from pymc3
Tunes the scaling parameter for the proposal distribution
according to the acceptance rate over the last tune_i... |
__author__ = "Dylan Hamel"
__version__ = "0.1"
__email__ = "dylan.hamel@protonmail.com"
__status__ = "Prototype"
| __author__ = 'Dylan Hamel'
__version__ = '0.1'
__email__ = 'dylan.hamel@protonmail.com'
__status__ = 'Prototype' |
budget = float(input())
season = input()
budget_spent = 0
destination = ""
place = ""
if budget <= 100:
if season == "summer":
budget_spent = budget * 0.30
destination = "Bulgaria"
place = "Camp"
else:
budget_spent = budget * 0.70
destination = "Bulgaria"
place ... | budget = float(input())
season = input()
budget_spent = 0
destination = ''
place = ''
if budget <= 100:
if season == 'summer':
budget_spent = budget * 0.3
destination = 'Bulgaria'
place = 'Camp'
else:
budget_spent = budget * 0.7
destination = 'Bulgaria'
place = 'H... |
def ma_methode(x = 0, y = 0):
print(x,y)
a = 1
b = 2
ma_methode()
ma_methode(a)
ma_methode(a,b)
y = 10;
ma_methode(y)
ma_methode(y = 10) | def ma_methode(x=0, y=0):
print(x, y)
a = 1
b = 2
ma_methode()
ma_methode(a)
ma_methode(a, b)
y = 10
ma_methode(y)
ma_methode(y=10) |
class TestSettings(object):
ETCD_PREFIX = '/config/etcd_settings'
ETCD_ENV = 'test'
ETCD_HOST = 'etcd'
ETCD_PORT = 2379
ETCD_USERNAME = 'test'
ETCD_PASSWORD = 'test'
ETCD_DETAILS = dict(
host='etcd',
port=2379,
prefix='/config/etcd_settings',
username='test',... | class Testsettings(object):
etcd_prefix = '/config/etcd_settings'
etcd_env = 'test'
etcd_host = 'etcd'
etcd_port = 2379
etcd_username = 'test'
etcd_password = 'test'
etcd_details = dict(host='etcd', port=2379, prefix='/config/etcd_settings', username='test', password='test')
settings = test_... |
def length_of_longest_substring(s):
l, r, max_len = 0, 0, 0
while r < len(s):
substring = s[l:r + 1]
max_len = max(max_len, len(substring))
if r + 1 < len(s) and s[r + 1] in substring:
l += 1
else:
r += 1
return max_len
def length_of_longest_subst... | def length_of_longest_substring(s):
(l, r, max_len) = (0, 0, 0)
while r < len(s):
substring = s[l:r + 1]
max_len = max(max_len, len(substring))
if r + 1 < len(s) and s[r + 1] in substring:
l += 1
else:
r += 1
return max_len
def length_of_longest_subst... |
def aoc(data):
total = 0
min, max = data.split("-")
for x in [str(x) for x in range(int(min), int(max))]:
inc = True
double = False
for i, d in enumerate(x[1:]):
if d < x[i]:
inc = False
break
for i, d in enumerate(x):
... | def aoc(data):
total = 0
(min, max) = data.split('-')
for x in [str(x) for x in range(int(min), int(max))]:
inc = True
double = False
for (i, d) in enumerate(x[1:]):
if d < x[i]:
inc = False
break
for (i, d) in enumerate(x):
... |
def swap_case(s):
a=""
for i in range(len(s)):
if s[i].islower():
a=a+s[i].upper()
else:
a=a+s[i].lower()
return a
| def swap_case(s):
a = ''
for i in range(len(s)):
if s[i].islower():
a = a + s[i].upper()
else:
a = a + s[i].lower()
return a |
expected_output = {
"backbone_fast": False,
"bpdu_filter": False,
"bpdu_guard": False,
"bridge_assurance": True,
"configured_pathcost": {"method": "short"},
"etherchannel_misconfig_guard": True,
"extended_system_id": True,
"loop_guard": False,
"mode": {
"rapid_pvst": {
... | expected_output = {'backbone_fast': False, 'bpdu_filter': False, 'bpdu_guard': False, 'bridge_assurance': True, 'configured_pathcost': {'method': 'short'}, 'etherchannel_misconfig_guard': True, 'extended_system_id': True, 'loop_guard': False, 'mode': {'rapid_pvst': {'VLAN0001': {'blocking': 0, 'forwarding': 2, 'learnin... |
class ComboBoxData(RibbonItemData):
"""
This class contains information necessary to construct a combo box in the Ribbon.
ComboBoxData(name: str)
"""
@staticmethod
def __new__(self, name):
""" __new__(cls: type,name: str) """
pass
Image = property(lambda self: obje... | class Comboboxdata(RibbonItemData):
"""
This class contains information necessary to construct a combo box in the Ribbon.
ComboBoxData(name: str)
"""
@staticmethod
def __new__(self, name):
""" __new__(cls: type,name: str) """
pass
image = property(lambda self: object(), lambda se... |
f = open('pierwsze.txt', 'w')
for item in range(2,100+1):
for number in range(2,item):
if item % number == 0:
break
else:
f.write(str(item))
f.write(" ")
f.close() | f = open('pierwsze.txt', 'w')
for item in range(2, 100 + 1):
for number in range(2, item):
if item % number == 0:
break
else:
f.write(str(item))
f.write(' ')
f.close() |
def maximo (a, b, c):
if a>b and a>c:
return a
elif b>a and b>c:
return b
elif c>b and c>a:
return c
else:
return a
x = int(input("primeiro numero"))
y= int( input("Segundo numero"))
z = int( input("terceiro numero"))
w=maximo(x,y,z)
print(w) | def maximo(a, b, c):
if a > b and a > c:
return a
elif b > a and b > c:
return b
elif c > b and c > a:
return c
else:
return a
x = int(input('primeiro numero'))
y = int(input('Segundo numero'))
z = int(input('terceiro numero'))
w = maximo(x, y, z)
print(w) |
#Grace Kelly 07/03/2018
#Exercise 5
#Read iris data set
#Print out four numerical values
#Decimal places aligned
#Space between columns
with open("data/iris.csv") as f:
for line in f:
print(line.split(',') [:4])
| with open('data/iris.csv') as f:
for line in f:
print(line.split(',')[:4]) |
#
# PySNMP MIB module CISCOSB-rlIP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCOSB-rlIP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:24:17 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, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, value_size_constraint, value_range_constraint, single_value_constraint) ... |
class Solution:
def isPalindrome(self, x: int) -> bool:
if x < 0:
return False
digits = []
while x:
digits.append(x % 10)
x = int(x / 10)
return digits == list(reversed(digits))
| class Solution:
def is_palindrome(self, x: int) -> bool:
if x < 0:
return False
digits = []
while x:
digits.append(x % 10)
x = int(x / 10)
return digits == list(reversed(digits)) |
a = float(input())
b = float(input())
c = float(input())
d = float(input())
e = float(input())
f = float(input())
if a == 0 and b == 0 and c == 0 and d == 0 and e == 0 and f == 0:
print(5)
elif a * d == b * c and a * f != c * e:
print(0)
elif a == 0 and b == 0 and e != 0:
print(0)
elif c == 0 and d == 0 an... | a = float(input())
b = float(input())
c = float(input())
d = float(input())
e = float(input())
f = float(input())
if a == 0 and b == 0 and (c == 0) and (d == 0) and (e == 0) and (f == 0):
print(5)
elif a * d == b * c and a * f != c * e:
print(0)
elif a == 0 and b == 0 and (e != 0):
print(0)
elif c == 0 and ... |
"""
Copyright (c) 2021 Anshul Patel
This code is licensed under MIT license (see LICENSE.MD for details)
@author: cheapBuy
"""
| """
Copyright (c) 2021 Anshul Patel
This code is licensed under MIT license (see LICENSE.MD for details)
@author: cheapBuy
""" |
class Solution:
def sumOfDistancesInTree(self, n: int, edges: List[List[int]]) -> List[int]:
graph = collections.defaultdict(set)
for u, v in edges:
graph[u].add(v)
graph[v].add(u)
count = [1 for _ in range(n)]
ans = [0 for _ in range(n)]
def... | class Solution:
def sum_of_distances_in_tree(self, n: int, edges: List[List[int]]) -> List[int]:
graph = collections.defaultdict(set)
for (u, v) in edges:
graph[u].add(v)
graph[v].add(u)
count = [1 for _ in range(n)]
ans = [0 for _ in range(n)]
def p... |
#
# PySNMP MIB module RFC1215-MIB (http://pysnmp.sf.net)
#
( Integer, ObjectIdentifier, OctetString, ) = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
( NamedValues, ) = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
( ConstraintsUnion, SingleValueConstraint, ConstraintsInt... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, constraints_intersection, value_size_constraint, value_range_constraint) ... |
# Deleting tuples
my_tuple = ('p', 'r', 'o', 'g', 'r', 'a', 'm', 'i', 'z')
# can't delete items
# TypeError: 'tuple' object doesn't support item deletion
# del my_tuple[3]
# Must delete an entire tuple
del my_tuple
# NameError: name 'my_tuple' is not defined
print(my_tuple)
| my_tuple = ('p', 'r', 'o', 'g', 'r', 'a', 'm', 'i', 'z')
del my_tuple
print(my_tuple) |
class Solution:
def largestSumAfterKNegations(self, A: List[int], K: int) -> int:
heapq.heapify(A)
for _ in range(K):
val = heapq.heappop(A)
heapq.heappush(A, -val)
return sum(A) | class Solution:
def largest_sum_after_k_negations(self, A: List[int], K: int) -> int:
heapq.heapify(A)
for _ in range(K):
val = heapq.heappop(A)
heapq.heappush(A, -val)
return sum(A) |
# Category description for the widget registry
NAME = "SRW ESRF Extension"
DESCRIPTION = "Widgets for SRW"
BACKGROUND = "#969fde"
ICON = "icons/esrf2.png"
PRIORITY = 204
| name = 'SRW ESRF Extension'
description = 'Widgets for SRW'
background = '#969fde'
icon = 'icons/esrf2.png'
priority = 204 |
San_Francisco_polygon = [[37.837174338616975,-122.48725891113281],[37.83364941345965,-122.48485565185547],[37.83093781796035,-122.4814224243164],[37.82415839321614,-122.48004913330078],[37.8203616433087,-122.47970581054688],[37.81059767530207,-122.47798919677734],[37.806122091729485,-122.47627258300781],[37.79215110146... | san__francisco_polygon = [[37.837174338616975, -122.48725891113281], [37.83364941345965, -122.48485565185547], [37.83093781796035, -122.4814224243164], [37.82415839321614, -122.48004913330078], [37.8203616433087, -122.47970581054688], [37.81059767530207, -122.47798919677734], [37.806122091729485, -122.47627258300781], ... |
class EmptyQueueError(Exception):
pass
class DualStructureError(Exception):
pass
class ConservativeVolumeError(Exception):
pass
class PmsFluxFacesError(Exception):
pass
| class Emptyqueueerror(Exception):
pass
class Dualstructureerror(Exception):
pass
class Conservativevolumeerror(Exception):
pass
class Pmsfluxfaceserror(Exception):
pass |
dias = int(input('Digite os dias: ')) * 60 * 60 * 24
horas = int(input('Digite as horas: ')) * 60 * 60
minutos = int(input('Digite os minutos: ')) * 60
segundos = int(input('Digite os segundos: '))
print ('O total dias em segundos: %d' % dias)
print ('O total de horas em segundos: %d' % horas)
print ('O total d... | dias = int(input('Digite os dias: ')) * 60 * 60 * 24
horas = int(input('Digite as horas: ')) * 60 * 60
minutos = int(input('Digite os minutos: ')) * 60
segundos = int(input('Digite os segundos: '))
print('O total dias em segundos: %d' % dias)
print('O total de horas em segundos: %d' % horas)
print('O total de minutos e... |
def apply_formatting_options(func):
def wrapper(self, *args, **kwargs):
type_config_dict = getattr(self, 'type_config_dict')
supplied_key = args[0]
supplied_value = args[1]
anonymized_value = func(self, supplied_key, supplied_value)
if type_config_dict.get('upper'):
... | def apply_formatting_options(func):
def wrapper(self, *args, **kwargs):
type_config_dict = getattr(self, 'type_config_dict')
supplied_key = args[0]
supplied_value = args[1]
anonymized_value = func(self, supplied_key, supplied_value)
if type_config_dict.get('upper'):
... |
# nlantau, 2021-02-01
a1 = [-1,5,10,20,28,3]
a2 = [26,134,135,15,17]
sample_output = [28,26]
def smallestDifference_passed7outof10(a, b):
a.sort()
b.sort()
res = list()
for i in a:
t = max(a) + max(b)
for j in b:
if abs(j-i) < t:
t = abs(j-i)
... | a1 = [-1, 5, 10, 20, 28, 3]
a2 = [26, 134, 135, 15, 17]
sample_output = [28, 26]
def smallest_difference_passed7outof10(a, b):
a.sort()
b.sort()
res = list()
for i in a:
t = max(a) + max(b)
for j in b:
if abs(j - i) < t:
t = abs(j - i)
res.cle... |
# coding: utf-8
"""
av-website
~~~~~~~~
App deployable on GAE, configured and customised with Bootstrap, Flask.
Copyright (c) 2015 by Tiberiu CORBU.
License MIT, see LICENSE for more details.
"""
__version__ = '3.3.4'
| """
av-website
~~~~~~~~
App deployable on GAE, configured and customised with Bootstrap, Flask.
Copyright (c) 2015 by Tiberiu CORBU.
License MIT, see LICENSE for more details.
"""
__version__ = '3.3.4' |
if __name__ == "__main__":
result = 1
for i in range(100):
result *= i + 1
result = str(result)
res = 0
for i in result:
res += int(i)
print("100! = ", res, "\n")
| if __name__ == '__main__':
result = 1
for i in range(100):
result *= i + 1
result = str(result)
res = 0
for i in result:
res += int(i)
print('100! = ', res, '\n') |
name = 'therm_PRF.dat'
fin = open(name,'r')
fout = open(name+'_upper','w')
for line in fin:
fout.write(line.upper())
| name = 'therm_PRF.dat'
fin = open(name, 'r')
fout = open(name + '_upper', 'w')
for line in fin:
fout.write(line.upper()) |
mozilla = [
'Mozilla/5.0 (Windows; U; Windows NT 6.1; rv:2.2) Gecko/20110201',
'Mozilla/5.0 (Windows; U; Windows NT 6.1; it; rv:2.0b4) Gecko/20100818',
'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a3pre) Gecko/20070330',
'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.2a1pre) Gecko',
'Mozi... | mozilla = ['Mozilla/5.0 (Windows; U; Windows NT 6.1; rv:2.2) Gecko/20110201', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; it; rv:2.0b4) Gecko/20100818', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a3pre) Gecko/20070330', 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.2a1pre) Gecko', 'Mozilla/5.0 (Windows; U; ... |
class TicTacToe:
def __init__(self, n: int):
"""
Initialize your data structure here.
"""
self.col = [0] * n
self.row = [0] * n
self.n = n
self.diag, self.anti = 0, 0
def move(self, row: int, col: int, player: int) -> int:
... | class Tictactoe:
def __init__(self, n: int):
"""
Initialize your data structure here.
"""
self.col = [0] * n
self.row = [0] * n
self.n = n
(self.diag, self.anti) = (0, 0)
def move(self, row: int, col: int, player: int) -> int:
"""
Player ... |
""" Downloads clang and configures the crosstool using bazel's autoconf."""
load("@bazel_tools//tools/cpp:cc_configure.bzl", "cc_autoconf_impl")
load(":download_clang.bzl", "download_clang")
_TF_DOWNLOAD_CLANG = "TF_DOWNLOAD_CLANG"
_TF_NEED_CUDA = "TF_NEED_CUDA"
def _cc_clang_autoconf(repo_ctx):
if repo_ctx.os.e... | """ Downloads clang and configures the crosstool using bazel's autoconf."""
load('@bazel_tools//tools/cpp:cc_configure.bzl', 'cc_autoconf_impl')
load(':download_clang.bzl', 'download_clang')
_tf_download_clang = 'TF_DOWNLOAD_CLANG'
_tf_need_cuda = 'TF_NEED_CUDA'
def _cc_clang_autoconf(repo_ctx):
if repo_ctx.os.env... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Exceptions module
=============================
"""
class GPyPiException(Exception):
"""Core exception class, all exception inherit from this class."""
class GPyPiInvalidAtom(GPyPiException):
"""Raised when determining Portage Atom did not succeed."""
cla... | """
Exceptions module
=============================
"""
class Gpypiexception(Exception):
"""Core exception class, all exception inherit from this class."""
class Gpypiinvalidatom(GPyPiException):
"""Raised when determining Portage Atom did not succeed."""
class Gpypinosetupfile(GPyPiException):
"""Raised... |
A, B = map(int, input().split())
if 6*A < B or A > B:
print('No')
else:
print('Yes') | (a, b) = map(int, input().split())
if 6 * A < B or A > B:
print('No')
else:
print('Yes') |
#
# PySNMP MIB module RAD-SONET-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RAD-SONET-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:36:10 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_union, value_range_constraint, constraints_intersection, single_value_constraint) ... |
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 30 14:28:10 2020
@author: Abhishek Mukherjee
"""
class Solution:
def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
tempLst=[]
tempDict=dict()
tempDict=[dict() for i in range(len(strs))]
for i in range(len(strs)):... | """
Created on Sun Aug 30 14:28:10 2020
@author: Abhishek Mukherjee
"""
class Solution:
def group_anagrams(self, strs: List[str]) -> List[List[str]]:
temp_lst = []
temp_dict = dict()
temp_dict = [dict() for i in range(len(strs))]
for i in range(len(strs)):
for j in str... |
# -*- coding: utf-8 -*-
"""Top-level package for src."""
__author__ = """krishna bhogaonker"""
__email__ = 'cyclotomiq@gmail.com'
__version__ = '0.1.0'
| """Top-level package for src."""
__author__ = 'krishna bhogaonker'
__email__ = 'cyclotomiq@gmail.com'
__version__ = '0.1.0' |
class General():
'''
this class runs the experiments with given number of users of each category
'''
def __init__(self, p_manager, c_manager, environment):
self.person_manager = p_manager
self.context_manager = c_manager
self.environment = environment
self.rewards_log = ... | class General:
"""
this class runs the experiments with given number of users of each category
"""
def __init__(self, p_manager, c_manager, environment):
self.person_manager = p_manager
self.context_manager = c_manager
self.environment = environment
self.rewards_log = []... |
# usando generator, ele comsome menos memoria
generator = (i ** 2 for i in range(10) if i % 2 == 0)
#o next serve para extrair o valor do generator, importante o generator nbao e uma tupla
print(next(generator))
print(next(generator))
print(next(generator))
print(next(generator))
print(next(generator))
# print(next(ge... | generator = (i ** 2 for i in range(10) if i % 2 == 0)
print(next(generator))
print(next(generator))
print(next(generator))
print(next(generator))
print(next(generator)) |
def reverse_string(string):
reversed_list = []
string_as_list = list(string)
while string_as_list:
reversed_list.append(string_as_list.pop())
print(''.join(reversed_list))
reverse_string(input())
| def reverse_string(string):
reversed_list = []
string_as_list = list(string)
while string_as_list:
reversed_list.append(string_as_list.pop())
print(''.join(reversed_list))
reverse_string(input()) |
n, m = map(int, input().split())
for _ in range(n):
k, v = input().split()
| (n, m) = map(int, input().split())
for _ in range(n):
(k, v) = input().split() |
#entrada
e, f, c = str(input()).split()
e = int(e)
f = int(f)
c = int(c)
#processamento
totalGarrafasVazias = e + f
totalRefri = 0
while totalGarrafasVazias >= c:
aux = totalGarrafasVazias // c
totalRefri += aux
totalGarrafasVazias = aux + (totalGarrafasVazias % c)
#saida
print(totalRefri)
| (e, f, c) = str(input()).split()
e = int(e)
f = int(f)
c = int(c)
total_garrafas_vazias = e + f
total_refri = 0
while totalGarrafasVazias >= c:
aux = totalGarrafasVazias // c
total_refri += aux
total_garrafas_vazias = aux + totalGarrafasVazias % c
print(totalRefri) |
f1 = 10
print(f1)
if f1:
a1 = 1
a2 = 2
a3 = 3
a4 = 4
a5 = 5
a6 = 6
elif f1:
print(f1)
print(f1)
print(f1)
print(f1)
print(f1)
a1 = 1
a2 = 2
a3 = 3
a4 = 4
a5 = 5
elif f1:
print(f1)
print(f1)
print(f1)
print(f1)
print(f1)
print(f1)
... | f1 = 10
print(f1)
if f1:
a1 = 1
a2 = 2
a3 = 3
a4 = 4
a5 = 5
a6 = 6
elif f1:
print(f1)
print(f1)
print(f1)
print(f1)
print(f1)
a1 = 1
a2 = 2
a3 = 3
a4 = 4
a5 = 5
elif f1:
print(f1)
print(f1)
print(f1)
print(f1)
print(f1)
print(f1)
... |
def error_response(status:str, message:str):
"""
This function returns a dictionary of status and message
:param status: The status code of the response
:type status: str
:param message: The message you want to display to the end user
:type message: str
:return: A dictionary o... | def error_response(status: str, message: str):
"""
This function returns a dictionary of status and message
:param status: The status code of the response
:type status: str
:param message: The message you want to display to the end user
:type message: str
:return: A dictionary... |
class ZException(Exception):
'''
Exception when z0 is suboptimal.
'''
def __init__(self, text, z, *args):
super(ZException, self).__init__(text, z, *args)
self.text = text
self.z = z
| class Zexception(Exception):
"""
Exception when z0 is suboptimal.
"""
def __init__(self, text, z, *args):
super(ZException, self).__init__(text, z, *args)
self.text = text
self.z = z |
#
# PySNMP MIB module TUBS-PROC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TUBS-PROC-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:27:58 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, constraints_intersection, single_value_constraint, constraints_union) ... |
def operate(opcode, arg1, arg2):
if (opcode==1):
return arg1+arg2
elif (opcode==2):
return arg1*arg2
elif (opcode==3):
return arg1
elif (opcode==4):
return arg1 | def operate(opcode, arg1, arg2):
if opcode == 1:
return arg1 + arg2
elif opcode == 2:
return arg1 * arg2
elif opcode == 3:
return arg1
elif opcode == 4:
return arg1 |
class event(object):
def __init__(self):
self.__funcs = set()
def invoke(self, *args):
for f in self.__funcs:
f.__call__(*args)
def reg(self, func):
self.__funcs.add(func)
| class Event(object):
def __init__(self):
self.__funcs = set()
def invoke(self, *args):
for f in self.__funcs:
f.__call__(*args)
def reg(self, func):
self.__funcs.add(func) |
cycle_info={}
# populate some example cycle info
cycle_info['cycle']=1
cycle_info['time']=1.0
print(cycle_info)
| cycle_info = {}
cycle_info['cycle'] = 1
cycle_info['time'] = 1.0
print(cycle_info) |
"""
You are given a pointer to the root of a binary search tree and values to be inserted into the tree.
Insert the values into their appropriate position in the binary search tree and return the root of the updated binary tree.
You just have to complete the function
Input:
The value to be inserted is 6 on the tree be... | """
You are given a pointer to the root of a binary search tree and values to be inserted into the tree.
Insert the values into their appropriate position in the binary search tree and return the root of the updated binary tree.
You just have to complete the function
Input:
The value to be inserted is 6 on the tree be... |
#!/usr/bin/env python3
def minimumBribes(q):
bribes = 0
for i in range(len(q) - 1, -1, -1):
if q[i] - (i + 1) > 2:
print("Too chaotic")
return
for j in range(max(0, q[i] - 2), i):
if q[j] > q[i]:
bribes += 1
print(bribes)
if __name__ ==... | def minimum_bribes(q):
bribes = 0
for i in range(len(q) - 1, -1, -1):
if q[i] - (i + 1) > 2:
print('Too chaotic')
return
for j in range(max(0, q[i] - 2), i):
if q[j] > q[i]:
bribes += 1
print(bribes)
if __name__ == '__main__':
t = int(i... |
file = open('./input.txt', 'r')
string = file.read()
lines = string.split()
int_lines = list(map(lambda x: int(x), lines))
result = 0
last_value = 10000
for value in int_lines:
if last_value < value:
result += 1
last_value = value
print(result) | file = open('./input.txt', 'r')
string = file.read()
lines = string.split()
int_lines = list(map(lambda x: int(x), lines))
result = 0
last_value = 10000
for value in int_lines:
if last_value < value:
result += 1
last_value = value
print(result) |
words_splitted = input("Give me some words: ")
words = words_splitted.split(",")
counter = 0
for i in range(len(words)):
if words[i-1].isalpha() == True:
counter += 1
print(counter) | words_splitted = input('Give me some words: ')
words = words_splitted.split(',')
counter = 0
for i in range(len(words)):
if words[i - 1].isalpha() == True:
counter += 1
print(counter) |
def test_vcf(filename):
with open(filename, encoding='utf-8') as handle:
for index, line in enumerate(handle):
line = line.replace('\n', '')
# Already read meta and header in self.__init__
if line.startswith('#'):
continue
list_line = line.sp... | def test_vcf(filename):
with open(filename, encoding='utf-8') as handle:
for (index, line) in enumerate(handle):
line = line.replace('\n', '')
if line.startswith('#'):
continue
list_line = line.split('\t')
ref = list_line[3]
alt = l... |
def gra(up, rundy, limit):
boczne = {
1 : [3,4,2,5],
2 : [6,1,3,4],
3 : [6,1,2,5],
4 : [6,1,2,5],
5 : [6,1,3,4],
6 : [3,4,2,5]
}
punkty = [0 for k in range(len(rundy[0]))]
wynik = punkty[:]
for i in range(len(rundy)):
runda = rundy[i]... | def gra(up, rundy, limit):
boczne = {1: [3, 4, 2, 5], 2: [6, 1, 3, 4], 3: [6, 1, 2, 5], 4: [6, 1, 2, 5], 5: [6, 1, 3, 4], 6: [3, 4, 2, 5]}
punkty = [0 for k in range(len(rundy[0]))]
wynik = punkty[:]
for i in range(len(rundy)):
runda = rundy[i]
for j in range(len(runda)):
if ... |
def getRoadsPoints(sf, shapeval, show=False):
fields = sf.fields
if show:
print("Fields -> {0}".format(fields))
itype=None
iint=None
if shapeval.startswith("Airport"):
for i,val in enumerate(fields):
if val[0] == "FAA_AIRPOR":
itype = i-1
... | def get_roads_points(sf, shapeval, show=False):
fields = sf.fields
if show:
print('Fields -> {0}'.format(fields))
itype = None
iint = None
if shapeval.startswith('Airport'):
for (i, val) in enumerate(fields):
if val[0] == 'FAA_AIRPOR':
itype = i - 1
... |
# generated from genmsg/cmake/pkg-genmsg.context.in
messages_str = "/home/liudiyang1998/Git/ROS-Robotics-By-Example/Chapter_7_code/src/hector_slam/hector_mapping/msg/HectorDebugInfo.msg;/home/liudiyang1998/Git/ROS-Robotics-By-Example/Chapter_7_code/src/hector_slam/hector_mapping/msg/HectorIterData.msg"
services_str = ... | messages_str = '/home/liudiyang1998/Git/ROS-Robotics-By-Example/Chapter_7_code/src/hector_slam/hector_mapping/msg/HectorDebugInfo.msg;/home/liudiyang1998/Git/ROS-Robotics-By-Example/Chapter_7_code/src/hector_slam/hector_mapping/msg/HectorIterData.msg'
services_str = ''
pkg_name = 'hector_mapping'
dependencies_str = ''
... |
'''
URL: https://leetcode.com/problems/powx-n
Time complexity: O(logn)
Space complexity: O(logn)
'''
class Solution:
def myPow(self, x, n):
"""
:type x: float
:type n: int
:rtype: float
"""
res = self._aux_pow(x, abs(n))
if n < 0:
return 1 / res
... | """
URL: https://leetcode.com/problems/powx-n
Time complexity: O(logn)
Space complexity: O(logn)
"""
class Solution:
def my_pow(self, x, n):
"""
:type x: float
:type n: int
:rtype: float
"""
res = self._aux_pow(x, abs(n))
if n < 0:
return 1 / res... |
class GenericsException(Exception):
"""Base class for exceptions in generics package."""
class GenericsInterfaceFailed(GenericsException, TypeError):
"""When subject fails the interface of a generic function,
and that generic has no callable 'default' to fall back to."""
class GenericsNoDispatch(Generic... | class Genericsexception(Exception):
"""Base class for exceptions in generics package."""
class Genericsinterfacefailed(GenericsException, TypeError):
"""When subject fails the interface of a generic function,
and that generic has no callable 'default' to fall back to."""
class Genericsnodispatch(GenericsE... |
"""
__init__.py
Author: Rob Cakebread <cakebread at gmail>
License : BSD
"""
__docformat__ = 'restructuredtext'
__version__ = '0.4.3'
| """
__init__.py
Author: Rob Cakebread <cakebread at gmail>
License : BSD
"""
__docformat__ = 'restructuredtext'
__version__ = '0.4.3' |
"""
Test that linear solver convergence with correct rate of convergence
when applied to the problem with stable detonation.
"""
# class TestLinearStableConvergence:
# def test_linear_stable_convergence(self):
# pass
| """
Test that linear solver convergence with correct rate of convergence
when applied to the problem with stable detonation.
""" |
"""stack."""
class Stack(object):
def __init__(self, item):
self._data = [item]
def push(self, item):
self._data.append(item)
def pop(self):
if len(self._data) == 0:
raise ValueError('Your stack is empty')
return self._data.pop()
def getMin(self):
... | """stack."""
class Stack(object):
def __init__(self, item):
self._data = [item]
def push(self, item):
self._data.append(item)
def pop(self):
if len(self._data) == 0:
raise value_error('Your stack is empty')
return self._data.pop()
def get_min(self):
... |
# List of API keys
ALPACA_API_KEY = "PKV6PG76ZRMOXUSLQMC6"
ALPACA_SECRET_KEY = "YD22E2jiKZRfer69McRcQIJX0kxGpXy13I0oTIzN"
ALPACA_BASE_URL = "https://paper-api.alpaca.markets"
AMERITRADE_TOKEN = 'https://api.tdameritrade.com/v1/oauth2/token'
AMERITRADE_KEY = '6JWAH9JYWA5CSCOG5WC6PAPLYIASBTTV' | alpaca_api_key = 'PKV6PG76ZRMOXUSLQMC6'
alpaca_secret_key = 'YD22E2jiKZRfer69McRcQIJX0kxGpXy13I0oTIzN'
alpaca_base_url = 'https://paper-api.alpaca.markets'
ameritrade_token = 'https://api.tdameritrade.com/v1/oauth2/token'
ameritrade_key = '6JWAH9JYWA5CSCOG5WC6PAPLYIASBTTV' |
REGION = "your_region_name"
BUCKET = "your_bucket_name"
DATABASE = "your_database_name"
TABLE = "your_table_name"
INDEX_COLUMN_NAME = "date"
| region = 'your_region_name'
bucket = 'your_bucket_name'
database = 'your_database_name'
table = 'your_table_name'
index_column_name = 'date' |
class StatusLifecycle():
"""
This class represents a lifecycle of statuses.
"""
class InvalidLifecycleException(Exception):
"""
raised if a lifecycle is invalid
"""
pass
def __init__(self, *lifecycle_statuses):
"""
:param lifecycle_statuses: a set of ... | class Statuslifecycle:
"""
This class represents a lifecycle of statuses.
"""
class Invalidlifecycleexception(Exception):
"""
raised if a lifecycle is invalid
"""
pass
def __init__(self, *lifecycle_statuses):
"""
:param lifecycle_statuses: a set of u... |
class Math(object):
""" Provides constants and static methods for trigonometric,logarithmic,and other common mathematical functions. """
@staticmethod
def Abs(value):
"""
Abs(value: Single) -> Single
Returns the absolute value of a single-precision floating-point number.
value: A number ... | class Math(object):
""" Provides constants and static methods for trigonometric,logarithmic,and other common mathematical functions. """
@staticmethod
def abs(value):
"""
Abs(value: Single) -> Single
Returns the absolute value of a single-precision floating-point number.
value: A ... |
# Copyright 2018 The Bazel Authors. 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 applicable la... | """Partial implementation for placing the messages support stub file in the archive."""
load('@build_bazel_rules_apple//apple/internal:file_support.bzl', 'file_support')
load('@build_bazel_rules_apple//apple/internal:intermediates.bzl', 'intermediates')
load('@build_bazel_rules_apple//apple/internal:processor.bzl', 'pr... |
## Error to exception
# The intention is to return an error
# from
def withdraw(self, amount):
if amount > self.balance:
return -1
else:
self.balance -= amount
return 0
# to
def withdraw(self, amount):
if amount > self.balance:
raise BalanceException() # or Exception
self... | def withdraw(self, amount):
if amount > self.balance:
return -1
else:
self.balance -= amount
return 0
def withdraw(self, amount):
if amount > self.balance:
raise balance_exception()
self.balance -= amount
def get_value_for_period(periodNumber):
try:
return value... |
# -*- coding: utf-8 -*-
__version_info__ = '0.6.3'
__version__ = '0.6.3'
version = '0.6.3'
| __version_info__ = '0.6.3'
__version__ = '0.6.3'
version = '0.6.3' |
'''
Building your own digit recognition model
You've reached the final exercise of the course - you now know everything you need to build an accurate model to recognize handwritten digits!
We've already done the basic manipulation of the MNIST dataset shown in the video, so you have X and y loaded and ready to model ... | """
Building your own digit recognition model
You've reached the final exercise of the course - you now know everything you need to build an accurate model to recognize handwritten digits!
We've already done the basic manipulation of the MNIST dataset shown in the video, so you have X and y loaded and ready to model ... |
'''
Given a day of the week encoded as 0=Sun, 1=Mon, 2=Tue, ...6=Sat, and a
boolean indicating if we are on vacation, return a string of the form "7:00"
indicating when the alarm clock should ring. Weekdays, the alarm should be
"7:00" and on the weekend it should be "10:00". Unless we are on vacation --
then on weekday... | """
Given a day of the week encoded as 0=Sun, 1=Mon, 2=Tue, ...6=Sat, and a
boolean indicating if we are on vacation, return a string of the form "7:00"
indicating when the alarm clock should ring. Weekdays, the alarm should be
"7:00" and on the weekend it should be "10:00". Unless we are on vacation --
then on weekday... |
"""
Created on Jan 28 16:58 2020
@author: nishit
""" | """
Created on Jan 28 16:58 2020
@author: nishit
""" |
test = {
'name': 'remove',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
scm> (remove 3 nil)
()
""",
'hidden': False,
'locked': False
},
{
'code': r"""
scm> (remove 2 '(1 3 2))
(1 3)
... | test = {'name': 'remove', 'points': 1, 'suites': [{'cases': [{'code': '\n scm> (remove 3 nil)\n ()\n ', 'hidden': False, 'locked': False}, {'code': "\n scm> (remove 2 '(1 3 2))\n (1 3)\n ", 'hidden': False, 'locked': False}, {'code': "\n scm> (remove 1 '(1 ... |
#
# PySNMP MIB module ARISTA-QOS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ARISTA-QOS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:09:19 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... | (arista_mibs,) = mibBuilder.importSymbols('ARISTA-SMI-MIB', 'aristaMibs')
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constr... |
class Solution(object):
def findErrorNums(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
for i in range(len(nums)):
if nums[i] != i + 1:
cur = nums[i]
while True:
replace = nums[cur - 1]
... | class Solution(object):
def find_error_nums(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
for i in range(len(nums)):
if nums[i] != i + 1:
cur = nums[i]
while True:
replace = nums[cur - 1]
... |
# twonums_sum returns the index of the nums inside the list that can become n
def twonums_sum(n, lst):
d = {}
for i in range(len(lst)):
d[lst[i]] = i # create number-subscript pair
for i in range(len(lst)):
if n - lst[i] in d:
return i, d[n-lst[i]]
return -1
l... | def twonums_sum(n, lst):
d = {}
for i in range(len(lst)):
d[lst[i]] = i
for i in range(len(lst)):
if n - lst[i] in d:
return (i, d[n - lst[i]])
return -1
lst = [1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 18, 19, 20, 21, 29, 34, 54, 65]
n = int(input())
result = twonums_sum(n, l... |
class Solution:
def longestPalindrome(self, s: str) -> str:
if not s or len(s) <= 1:
return s
result = ''
max_len = 0
n = len(s)
dp = [[False] * n for _ in range(n)]
for i in range(n):
dp[i][i] = True
if 1 > max_len:
... | class Solution:
def longest_palindrome(self, s: str) -> str:
if not s or len(s) <= 1:
return s
result = ''
max_len = 0
n = len(s)
dp = [[False] * n for _ in range(n)]
for i in range(n):
dp[i][i] = True
if 1 > max_len:
... |
# coding=utf-8
"""
Track your life like a pro on Google Calendar via your terminal.
"""
__version__ = '0.2.2'
__author__ = 'adamchainz'
__license__ = 'MIT'
| """
Track your life like a pro on Google Calendar via your terminal.
"""
__version__ = '0.2.2'
__author__ = 'adamchainz'
__license__ = 'MIT' |
class Computer:
def __init__(self,prog):
if type(prog)==str:
prog = [int(x.strip()) for x in prog.split(",") if x.strip()]
self.memory = prog
def evaluate(self):
pc = 0
while pc<len(self.memory) and self.memory[pc]!=99:
if self.memory[pc]==1:
from_, to_, store = self.memory[pc+1:pc+4]
self.memor... | class Computer:
def __init__(self, prog):
if type(prog) == str:
prog = [int(x.strip()) for x in prog.split(',') if x.strip()]
self.memory = prog
def evaluate(self):
pc = 0
while pc < len(self.memory) and self.memory[pc] != 99:
if self.memory[pc] == 1:
... |
#
# PySNMP MIB module INTEL-ES480-VLAN-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/INTEL-ES480-VLAN-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:42:49 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... | (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) ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.