content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Vector(object):
def __init__(self, x,y):
self.x = x
self.y = y
super(Vector, self).__init__(self, x,y)
| class Vector(object):
def __init__(self, x, y):
self.x = x
self.y = y
super(Vector, self).__init__(self, x, y) |
# Lists
courses=['History','Math','Physics','Compsci']
courses_2=['Football','Basketball']
print("Slicing Examples")
print(len(courses))
print(courses)
print(courses[-1])
print(courses[0:3])
print(courses[::-1])
print("\nAdd")
courses.append('Art')
print(courses)
print("\nInsert at the beginning")
co... | courses = ['History', 'Math', 'Physics', 'Compsci']
courses_2 = ['Football', 'Basketball']
print('Slicing Examples')
print(len(courses))
print(courses)
print(courses[-1])
print(courses[0:3])
print(courses[::-1])
print('\nAdd')
courses.append('Art')
print(courses)
print('\nInsert at the beginning')
courses.insert(0, 'Sc... |
class DiscordParseException(Exception):
"""An exception that is thrown when parsing Discord's representation of a channel / role / user mention fails."""
def parse_discord_str(content_str: str, type_chars: str) -> int:
"""Parses Discord's representation of a channel / role / user mention into an ID."""
if ... | class Discordparseexception(Exception):
"""An exception that is thrown when parsing Discord's representation of a channel / role / user mention fails."""
def parse_discord_str(content_str: str, type_chars: str) -> int:
"""Parses Discord's representation of a channel / role / user mention into an ID."""
if ... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Created by Ross on 19-1-8
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def solve(ln: ListNode):
if not ln:
return
p = ln
while p:
print(p.val, end=' ')
p = p.next
print()
def test1():
... | class Listnode:
def __init__(self, x):
self.val = x
self.next = None
def solve(ln: ListNode):
if not ln:
return
p = ln
while p:
print(p.val, end=' ')
p = p.next
print()
def test1():
print('test1')
ln = None
solve(ln)
def test2():
print('tes... |
#!/bin/python3
# Calculates factorial
def fact(n):
f = 1
while n > 0:
f *= n
n -= 1
return f
# Calculates Poisson Distribution
def poissonDist(k, l):
return (l**k*(2.71828**(-l)))/fact(k)
if __name__ == '__main__':
x = float(input())
y = float(input())
print(... | def fact(n):
f = 1
while n > 0:
f *= n
n -= 1
return f
def poisson_dist(k, l):
return l ** k * 2.71828 ** (-l) / fact(k)
if __name__ == '__main__':
x = float(input())
y = float(input())
print(round(poisson_dist(y, x), 3)) |
"""
The validation module converts data to and from request format (or at least
calls the converters that do so) and also converts dotted numeric formats into
sequences (e.g. a.0 and a.1 onto a[0] and a[1]). It also includes some
validation exceptions.
"""
class FormishError(Exception):
"""
Base class for all ... | """
The validation module converts data to and from request format (or at least
calls the converters that do so) and also converts dotted numeric formats into
sequences (e.g. a.0 and a.1 onto a[0] and a[1]). It also includes some
validation exceptions.
"""
class Formisherror(Exception):
"""
Base class for all ... |
expected_output = {
'model': 'WS-C3650-48PD',
'os': 'iosxe',
'platform': 'cat3k_caa',
'version': '03.06.07E',
}
| expected_output = {'model': 'WS-C3650-48PD', 'os': 'iosxe', 'platform': 'cat3k_caa', 'version': '03.06.07E'} |
#
# PySNMP MIB module DKSF-54-1-X-X-1 (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DKSF-54-1-X-X-1
# Produced by pysmi-0.3.4 at Wed May 1 12:47:27 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint, constraints_union) ... |
#
# print("What's your name?")
# name = input("> ")
#
# print("Hi " + name)
a = 60
b = 7
c = 500
if a > b:
if a > c:
print(a)
else:
print(c)
else:
if b > c:
print(b)
else:
print(c) | a = 60
b = 7
c = 500
if a > b:
if a > c:
print(a)
else:
print(c)
elif b > c:
print(b)
else:
print(c) |
coset_init = lib.coset_init_ll
insert = lib.cs_insert_ll
remove = lib.cs_remove_ll
get_s = lib.cs_get_size_ll
clear = lib.cs_clear_ll
get_min = lib.cs_min_ll
get_max = lib.cs_min_ll
upper_bound = lib.cs_upper_bound_ll
rupper_bound = lib.cs_rupper_bound_ll
get_k = lib.cs_get_k_ll | coset_init = lib.coset_init_ll
insert = lib.cs_insert_ll
remove = lib.cs_remove_ll
get_s = lib.cs_get_size_ll
clear = lib.cs_clear_ll
get_min = lib.cs_min_ll
get_max = lib.cs_min_ll
upper_bound = lib.cs_upper_bound_ll
rupper_bound = lib.cs_rupper_bound_ll
get_k = lib.cs_get_k_ll |
"""Email templates"""
verification = \
"""
<html>
<head></head>
<body>
<p>Hi!,<br>
Thanks for using 360buys! Please confirm your email address by clicking
on the link below. We'll communicate with you from time to time via email
so it's important that we h... | """Email templates"""
verification = '\n <html>\n <head></head>\n <body>\n <p>Hi!,<br>\n Thanks for using 360buys! Please confirm your email address by clicking \n on the link below. We\'ll communicate with you from time to time via email\n so it\'s important that we h... |
"""
Profile ../profile-datasets-py/div83/062.py
file automaticaly created by prof_gen.py script
"""
self["ID"] = "../profile-datasets-py/div83/062.py"
self["Q"] = numpy.array([ 2.135165, 2.544134, 3.283269, 4.205042,
4.999855, 5.317752, 5.205453, 5.320982,
... | """
Profile ../profile-datasets-py/div83/062.py
file automaticaly created by prof_gen.py script
"""
self['ID'] = '../profile-datasets-py/div83/062.py'
self['Q'] = numpy.array([2.135165, 2.544134, 3.283269, 4.205042, 4.999855, 5.317752, 5.205453, 5.320982, 5.907775, 6.095293, 6.191692, 6.191842, 6.146692, 6.... |
# Copyright 2004-2008 Roman Yakovenko.
# 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)
"""
This file contains indexing suite v2 code
"""
file_name = "indexing_suite/container_traits.hpp"
code = """// C... | """
This file contains indexing suite v2 code
"""
file_name = 'indexing_suite/container_traits.hpp'
code = '// Copyright (c) 2003 Raoul M. Gough\n//\n// Use, modification and distribution is subject to the Boost Software\n// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy\n// at http://www.boost.or... |
a = int(input())
b = int(input())
if a > b:
print(1)
elif a < b:
print(2)
else:
print(0) | a = int(input())
b = int(input())
if a > b:
print(1)
elif a < b:
print(2)
else:
print(0) |
parrot = "Norwegian Blue"
for char in parrot:
print(char)
| parrot = 'Norwegian Blue'
for char in parrot:
print(char) |
# """
# This is the robot's control interface.
# You should not implement it, or speculate about its implementation
# """
#class Robot:
# def move(self):
# """
# Returns true if the cell in front is open and robot moves into the cell.
# Returns false if the cell in front is blocked and robot sta... | class Solution:
def clean_room(self, robot):
"""
:type robot: Robot
:rtype: None
"""
def clean_room(cell, d):
robot.clean()
visited.add(cell)
for i in range(4):
new_d = (d + i) % 4
new_cell = (cell[0] + mov... |
Z = [[0,0,0,0,0,0],
[0,0,0,1,0,0],
[0,1,0,1,0,0],
[0,0,1,1,0,0],
[0,0,0,0,0,0],
[0,0,0,0,0,0]]
def compute_neighbours(Z):
rows,cols = len(Z), len(Z[0])
N = [[0,]*(cols) for i in range(rows)]
for x in range(1,cols-1):
for y in range(1,rows-1):
N[y][x] = Z[y-1][... | z = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0], [0, 1, 0, 1, 0, 0], [0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]
def compute_neighbours(Z):
(rows, cols) = (len(Z), len(Z[0]))
n = [[0] * cols for i in range(rows)]
for x in range(1, cols - 1):
for y in range(1, rows - 1):
N[y]... |
"""comics_download
By IaninaK susie@example.com
Downloads multiple comics from xkcd.com"""
__version__ = '0.1.0'
| """comics_download
By IaninaK susie@example.com
Downloads multiple comics from xkcd.com"""
__version__ = '0.1.0' |
def foo():
pass
def bar(*args, kwonly_arg: str = None):
pass
| def foo():
pass
def bar(*args, kwonly_arg: str=None):
pass |
# DATA UNIT CLASS
class _Unit:
def __init__(self, name, con_2_si, con_unit, si_unit):
self._name = name
self._con_2_si = con_2_si
self._con_unit = con_unit
self._si_unit = si_unit
def get_name(self):
return self._name
def get_con_2_si(self):
return self._con... | class _Unit:
def __init__(self, name, con_2_si, con_unit, si_unit):
self._name = name
self._con_2_si = con_2_si
self._con_unit = con_unit
self._si_unit = si_unit
def get_name(self):
return self._name
def get_con_2_si(self):
return self._con_2_si
def ge... |
def missing_number(nums):
arr = [0 for _ in range(len(nums))]
for i in range(len(nums)):
if nums[i] < len(nums):
arr[nums[i]] = -1
for i in range(len(nums)):
if arr[i] != -1:
return i
return len(nums) | def missing_number(nums):
arr = [0 for _ in range(len(nums))]
for i in range(len(nums)):
if nums[i] < len(nums):
arr[nums[i]] = -1
for i in range(len(nums)):
if arr[i] != -1:
return i
return len(nums) |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache... | """ system_constants.py: defines constants for generic purposes and system config"""
kb = 1024
mb = 1024 * KB
gb = 1024 * MB
ms_to_sec = 0.001
sec_to_ns = 1000000000
ns_to_ms = 1e-06
ram_for_stmgr = 1 * GB
default_ram_for_instance = 1 * GB
default_disk_padding_per_container = 12 * GB
heron_logging_directory = 'heron.lo... |
__title__ = "mathy_envs"
__version__ = "0.11.0"
__summary__ = "Learning environments for solving math problems step-by-step"
__uri__ = "https://mathy.ai"
__author__ = "Justin DuJardin"
__email__ = "justin@dujardinconsulting.com"
__license__ = "All rights reserved"
| __title__ = 'mathy_envs'
__version__ = '0.11.0'
__summary__ = 'Learning environments for solving math problems step-by-step'
__uri__ = 'https://mathy.ai'
__author__ = 'Justin DuJardin'
__email__ = 'justin@dujardinconsulting.com'
__license__ = 'All rights reserved' |
class HostInitiators(object):
def read_get(self, name, idx_name, unity_client):
return unity_client.get_host_initiators(idx_name)
class HostInitiatorsColumn(object):
def get_idx(self, name, idx, unity_client):
return unity_client.get_hosts()
| class Hostinitiators(object):
def read_get(self, name, idx_name, unity_client):
return unity_client.get_host_initiators(idx_name)
class Hostinitiatorscolumn(object):
def get_idx(self, name, idx, unity_client):
return unity_client.get_hosts() |
def check_password_hash(hash,password):
if hash == password:
return True
else:
return False
def get_cards_summary_model():
data = dict()
data["used_on_amazon"] = 0
data['used_on_google'] = 0
data['total_used'] = 0
data['expired'] = 0
data['total'] = 0
data['in_progre... | def check_password_hash(hash, password):
if hash == password:
return True
else:
return False
def get_cards_summary_model():
data = dict()
data['used_on_amazon'] = 0
data['used_on_google'] = 0
data['total_used'] = 0
data['expired'] = 0
data['total'] = 0
data['in_progr... |
KABUM_PAGES = {
"https://www.kabum.com.br/hardware/placas-mae?page_number=1&page_size=100&facet_filters=eyJwcmljZSI6eyJtaW4iOjM2NS45OCwibWF4IjoxMTE3NS4yOX19&sort=price": "placa-mae",
"https://www.kabum.com.br/hardware/processadores?page_number=1&page_size=100&facet_filters=eyJwcmljZSI6eyJtaW4iOjM1MC42OSwibWF4I... | kabum_pages = {'https://www.kabum.com.br/hardware/placas-mae?page_number=1&page_size=100&facet_filters=eyJwcmljZSI6eyJtaW4iOjM2NS45OCwibWF4IjoxMTE3NS4yOX19&sort=price': 'placa-mae', 'https://www.kabum.com.br/hardware/processadores?page_number=1&page_size=100&facet_filters=eyJwcmljZSI6eyJtaW4iOjM1MC42OSwibWF4IjoxMTk4OS4... |
"""Misc utility functions"""
def is_netcdf_asset(asset, strict):
"""
Determine if an asset is netcdf4-python compatible. netcdf4-python currently supports
HDF5, NetCDF3, and NetCDF4. Determination is currently done through MIME if strict
mode is enabled. If strict mode is not enabled, determination is... | """Misc utility functions"""
def is_netcdf_asset(asset, strict):
"""
Determine if an asset is netcdf4-python compatible. netcdf4-python currently supports
HDF5, NetCDF3, and NetCDF4. Determination is currently done through MIME if strict
mode is enabled. If strict mode is not enabled, determination is ... |
#!/usr/bin/env python
'''
you can use this command to run specific Python code:
..code-block:: python
py.test example1.py
'''
def f(x):
return x + 1
def test_f():
assert f(0) == 1
| """
you can use this command to run specific Python code:
..code-block:: python
py.test example1.py
"""
def f(x):
return x + 1
def test_f():
assert f(0) == 1 |
# -*- coding: utf-8 -*-
'''
Module takes a series of showimes and first filters them and then prompts the user to select times.
Currently the only filter is automatically applied and filters sceances during work hours.
Currently the program is not intelligent enough to optimize times or ensure that sceances do not ove... | """
Module takes a series of showimes and first filters them and then prompts the user to select times.
Currently the only filter is automatically applied and filters sceances during work hours.
Currently the program is not intelligent enough to optimize times or ensure that sceances do not overlap.
"""
date_index = 1... |
"""Whole-slide image file reader for TensorFlow.
The histomics_stream.ds.init module supports transformations at the beginning of a
tensorflow.data.Dataset workflow. This module defines objects that can be supplied to the
tensorflow.data.Dataset.from_tensor_slices() method.
"""
class Header:
"""A class used to... | """Whole-slide image file reader for TensorFlow.
The histomics_stream.ds.init module supports transformations at the beginning of a
tensorflow.data.Dataset workflow. This module defines objects that can be supplied to the
tensorflow.data.Dataset.from_tensor_slices() method.
"""
class Header:
"""A class used to ... |
with open("lfw-gender-0.80.txt") as lfwgender, \
open("manual-gender.txt") as manual, \
open("lfw-gender-final.txt", "w") as final:
nextline = lfwgender.readline()
while nextline:
firstname, gender = nextline.split()
if gender != "?":
final.write(nextline)
else... | with open('lfw-gender-0.80.txt') as lfwgender, open('manual-gender.txt') as manual, open('lfw-gender-final.txt', 'w') as final:
nextline = lfwgender.readline()
while nextline:
(firstname, gender) = nextline.split()
if gender != '?':
final.write(nextline)
else:
man... |
N, M = [int(n) for n in input().split()]
L, R = (1, N)
for i in range(M):
l, r = [int(n) for n in input().split()]
L, R = (max(l, L), min(r, R))
print(max(0, R-L+1))
| (n, m) = [int(n) for n in input().split()]
(l, r) = (1, N)
for i in range(M):
(l, r) = [int(n) for n in input().split()]
(l, r) = (max(l, L), min(r, R))
print(max(0, R - L + 1)) |
"""Fake Motor Speed Control for use in CI environments w/o real hardware"""
class MotorSpeedControl(object):
def __init__(self):
self._fail_safe = False
self.foundChip = True
pass
def Init(self):
pass
def SetCommsFailsafe(self, state):
self._fail_safe = state
... | """Fake Motor Speed Control for use in CI environments w/o real hardware"""
class Motorspeedcontrol(object):
def __init__(self):
self._fail_safe = False
self.foundChip = True
pass
def init(self):
pass
def set_comms_failsafe(self, state):
self._fail_safe = state
... |
n = int(input())
integer_list = map(int, input().split())
integer_list = tuple(integer_list)
print(hash(integer_list))
| n = int(input())
integer_list = map(int, input().split())
integer_list = tuple(integer_list)
print(hash(integer_list)) |
# This file is used to store password secrets which are not to be committed
# to git. The key has to match one of the sources in the ocd_backend/sources
# directory. If there a secret is required but not supplied in this file, the
# program will fail. A secret like gegevensmagazijn will also match postfixes
# like gege... | secrets = {'<ID>': ('<USERNAME>', '<PASSWORD>')} |
VERBOSITY = 1
SAMPLE_RATE = 16000
DURATION_MS = 1000
FEATURES_COUNT = 64
DESIRED_SAMPLES = int(SAMPLE_RATE * DURATION_MS / 1000)
DROPOUT_RATE = 0.5
TESING_PERCENTAGE = 15
VALIDATION_PERCENTAGE = 15
VALIDATION_FREQUENCY = 10
SAVE_PERIOD = 10
EPOCHS = 100
BATCH_SIZE = 512
DATASET_URL = 'http://download.tensorflow.org/d... | verbosity = 1
sample_rate = 16000
duration_ms = 1000
features_count = 64
desired_samples = int(SAMPLE_RATE * DURATION_MS / 1000)
dropout_rate = 0.5
tesing_percentage = 15
validation_percentage = 15
validation_frequency = 10
save_period = 10
epochs = 100
batch_size = 512
dataset_url = 'http://download.tensorflow.org/dat... |
# https://www.hackerrank.com/challenges/common-child/problem
def longestCommonSubsequence(s1, s2):
remove_element = set(s1) - set(s2)
new_s1 = ""
for element in s1:
if element not in remove_element:
new_s1 += element
s1 = new_s1
memory = [[0] * (len(s2) + 1) for _ in range((le... | def longest_common_subsequence(s1, s2):
remove_element = set(s1) - set(s2)
new_s1 = ''
for element in s1:
if element not in remove_element:
new_s1 += element
s1 = new_s1
memory = [[0] * (len(s2) + 1) for _ in range(len(s1) + 1)]
for (index1, value1) in enumerate(s1, 1):
... |
# License: MIT
"""
https://github.com/automl/fanova
"""
__version__ = "2.0.20.dev"
| """
https://github.com/automl/fanova
"""
__version__ = '2.0.20.dev' |
class Defines(object):
PROTOCOL_ID = b'BitTorrent protocol'
RM_CLIENT_ID = b'RM'
RM_CLIENT_VERSION = b'0100'
| class Defines(object):
protocol_id = b'BitTorrent protocol'
rm_client_id = b'RM'
rm_client_version = b'0100' |
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# lists are used to store a list of things; similar to arrays in java \n",
"# note the use of square brackets and\n",
"\n",
"a = [3, 10, -1]"
]
},
{
"cell_type": "code",
"... | {'cells': [{'cell_type': 'code', 'execution_count': 1, 'metadata': {}, 'outputs': [], 'source': ['# lists are used to store a list of things; similar to arrays in java \n', '# note the use of square brackets and\n', '\n', 'a = [3, 10, -1]']}, {'cell_type': 'code', 'execution_count': 2, 'metadata': {}, 'outputs': [{'nam... |
def find_opposites(seq):
check=set()
res=set()
for i in seq:
if -i in check:
res.add(abs(i))
check.add(i)
return sorted(res) | def find_opposites(seq):
check = set()
res = set()
for i in seq:
if -i in check:
res.add(abs(i))
check.add(i)
return sorted(res) |
"""
(Effective) core (aka one-electron) Hamiltonian
"""
core_wavefunction = {}
# core hamiltonian
core_wavefunction["h_core_a"] = {
"type": "array",
"description": "Alpha-spin core (one-electron) Hamiltonian in the AO basis.",
"items": {"type": "number"},
"shape": {"nao", "nao"}
}
core_wavefunction[... | """
(Effective) core (aka one-electron) Hamiltonian
"""
core_wavefunction = {}
core_wavefunction['h_core_a'] = {'type': 'array', 'description': 'Alpha-spin core (one-electron) Hamiltonian in the AO basis.', 'items': {'type': 'number'}, 'shape': {'nao', 'nao'}}
core_wavefunction['h_core_b'] = {'type': 'array', 'descript... |
# Copyright (c) 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Generates new baselines for Blink layout tests that need rebaselining.
Intended to be called periodically. Syncs to the Blink repo and runs
'webkit-p... | """Generates new baselines for Blink layout tests that need rebaselining.
Intended to be called periodically. Syncs to the Blink repo and runs
'webkit-patch auto-rebaseline', which processes entries in
LayoutTests/TestExpectations that are marked with 'NeedsRebaseline'.
Slaves running this recipe will require SVN acc... |
_base_ = './kd_resnet18_resnet50_cifar100_equal.py'
# model settings
model = dict(
adaptive=True,
adaptation = dict(out_channels=[256, 512, 1024, 2048], in_channels=[64, 128, 256, 512]),
distill_losses=[
dict(type='NST', mode='feature', loss_weight=1.0),
dict(type='Logits', mode='logits', lo... | _base_ = './kd_resnet18_resnet50_cifar100_equal.py'
model = dict(adaptive=True, adaptation=dict(out_channels=[256, 512, 1024, 2048], in_channels=[64, 128, 256, 512]), distill_losses=[dict(type='NST', mode='feature', loss_weight=1.0), dict(type='Logits', mode='logits', loss_weight=1.0)]) |
# configs
COMBINE_FACE_WEIGHT = 10
COMBINE_FEATURE_WEIGHT = 10
FEATURE_DETECT_MAX_CORNERS = 50
FEATURE_DETECT_QUALITY_LEVEL = 0.1
FEATURE_DETECT_MIN_DISTANCE = 10
FACE_DETECT_REJECT_LEVELS = 1.3
FACE_DETECT_LEVEL_WEIGHTS = 5
HAARCASCADE_PROFILEFACE = 'haarcascade_profileface.xml'
HAARCASCADE_FRONTALFACE = 'haarcascade... | combine_face_weight = 10
combine_feature_weight = 10
feature_detect_max_corners = 50
feature_detect_quality_level = 0.1
feature_detect_min_distance = 10
face_detect_reject_levels = 1.3
face_detect_level_weights = 5
haarcascade_profileface = 'haarcascade_profileface.xml'
haarcascade_frontalface = 'haarcascade_frontalfac... |
n, m = [int(i) for i in input().split()]
a = [["*" if (i + j) % 2 != 0 else "." for j in range(m)]
for i in range(n)]
for row in a:
print(' '.join(row))
| (n, m) = [int(i) for i in input().split()]
a = [['*' if (i + j) % 2 != 0 else '.' for j in range(m)] for i in range(n)]
for row in a:
print(' '.join(row)) |
# Copyright (c) 2011 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved
#
# 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 ... | class Schema(object):
"""
Represents a DynamoDB schema.
:ivar hash_key_name: The name of the hash key of the schema.
:ivar hash_key_type: The DynamoDB type specification for the
hash key of the schema.
:ivar range_key_name: The name of the range key of the schema
or None if no range... |
###############################################################################
__author__ = "ICHEC"
__copyright__ = 'Copyright 2020, QNLP'
__credits__ = ['{credit_list}']
__license__ = '{license}'
__version__ = '{mayor}.{minor}.{rel}'
__maintainer__ = '{maintainer}'
__email__ = 'lee.oriordan@ichec.ie'
__status__ = 'al... | __author__ = 'ICHEC'
__copyright__ = 'Copyright 2020, QNLP'
__credits__ = ['{credit_list}']
__license__ = '{license}'
__version__ = '{mayor}.{minor}.{rel}'
__maintainer__ = '{maintainer}'
__email__ = 'lee.oriordan@ichec.ie'
__status__ = 'alpha'
'\nBase class for pregroup types\n'
class Pregrouptype:
def __init__(... |
#! python3
print("Task 6.1")
persons = {
'first_name': 'john',
'last_name' : 'dog',
'age' : '40',
'city' : 'chicago',
}
print('All information about person:')
print(persons['first_name'])
print(persons['last_name'])
print(persons['age'])
print(persons['city'])
print("Task 6.2")
persons = {
'... | print('Task 6.1')
persons = {'first_name': 'john', 'last_name': 'dog', 'age': '40', 'city': 'chicago'}
print('All information about person:')
print(persons['first_name'])
print(persons['last_name'])
print(persons['age'])
print(persons['city'])
print('Task 6.2')
persons = {'john': '5', 'caty': '6', 'bob': '40', 'lance':... |
def counting():
y = 1
while y<500:
yield y #This is a great way to iterate through one number at a time. It will go forever if needed.
y += 1
for y in counting():
print(y) | def counting():
y = 1
while y < 500:
yield y
y += 1
for y in counting():
print(y) |
"""
pycraigslist.tests.test_unit
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A suite of modules to unit test the pycraigslist module.
"""
| """
pycraigslist.tests.test_unit
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A suite of modules to unit test the pycraigslist module.
""" |
def update_weights(weights, error, l_rate, vector):
"""Takes in a given weight, error, learning rate, and vector element
Retuns updated weight
"""
return [weight + (elem * l_rate * error) for elem, weight in zip(vector, weights)]
if __name__ == '__main__':
print(update_weights((.1, .1, .2), -6, .1, (.5, .5, .5)))... | def update_weights(weights, error, l_rate, vector):
"""Takes in a given weight, error, learning rate, and vector element
Retuns updated weight
"""
return [weight + elem * l_rate * error for (elem, weight) in zip(vector, weights)]
if __name__ == '__main__':
print(update_weights((0.1, 0.1, 0.2), -6, 0.1, (0... |
class StringCalculator:
def __init__(self):
self.string = ''
self.list_of_numbers = []
self.delimiter = ','
def add(self, string_of_numbers):
self.validate_input(string_of_numbers)
self.process_delimiter()
self.generate_list_of_numbers()
retur... | class Stringcalculator:
def __init__(self):
self.string = ''
self.list_of_numbers = []
self.delimiter = ','
def add(self, string_of_numbers):
self.validate_input(string_of_numbers)
self.process_delimiter()
self.generate_list_of_numbers()
return sum(self.... |
class Airplane:
def __init__(self, x=0, y=0, gravity=2, jump=50):
self.x = x
self.y = y
self.defaultX = x
self.defaultY = y
self.gravity = gravity
self.jump = jump
self.width = 60
self.height = 35
def init(self):
self.x = self.defaultX
... | class Airplane:
def __init__(self, x=0, y=0, gravity=2, jump=50):
self.x = x
self.y = y
self.defaultX = x
self.defaultY = y
self.gravity = gravity
self.jump = jump
self.width = 60
self.height = 35
def init(self):
self.x = self.defaultX
... |
#!/usr/bin/env python3
def readint():
return int(input())
def readints():
return map(int, input().split())
def readline():
return str(input())
T = readint()
for case in range(T):
N = readint()
if N == 0:
result = "INSOMNIA"
else:
k = 0
s = set()
while len(s) <... | def readint():
return int(input())
def readints():
return map(int, input().split())
def readline():
return str(input())
t = readint()
for case in range(T):
n = readint()
if N == 0:
result = 'INSOMNIA'
else:
k = 0
s = set()
while len(s) < 10:
s.update... |
# Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.
# Note:
# The solution set must not contain duplicate triplets.
# Example:
# Given array nums = [-1, 0, 1, 2, -1, -4],
# A solution set is:
# [
# [-1... | class Solution:
def three_sum(self, nums: List[int]) -> List[List[int]]:
nums.sort()
triplets = []
for i in range(len(nums) - 2):
if i > 0 and nums[i] == nums[i - 1]:
continue
left_idx = i + 1
right_idx = len(nums) - 1
while le... |
# Each new term in the Fibonacci sequence is generated by adding the
# previous two terms. By starting with 1 and 2, the first 10 terms will
# be: # 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
# By considering the terms in the Fibonacci sequence whose values do not
# exceed four million, find the sum of the even-valued term... | def sum_even_fibonacci_terms(limit):
"""Returns the sum of even fibonacci numbers below a given limit.
"""
second_to_last_term = 1
last_term = 1
sum = 0
while last_term < limit:
new_term = last_term + second_to_last_term
second_to_last_term = last_term
last_term = new_ter... |
"""Module with different tools to facilitate data operations in ESTAMPES
This module provides different simple tools, by submodules to facilitate
common operations like conversions, transformations...
The tools are gathered by submodules based on their intended use:
`atom`
Atom-specific tools.
`comp`
Related... | """Module with different tools to facilitate data operations in ESTAMPES
This module provides different simple tools, by submodules to facilitate
common operations like conversions, transformations...
The tools are gathered by submodules based on their intended use:
`atom`
Atom-specific tools.
`comp`
Related... |
class Solution:
def fourSumCount(self, nums1: List[int], nums2: List[int], nums3: List[int], nums4: List[int]) -> int:
pass
#######################################################################################################################
"""
num1 => [1,2]
num2 => [-2,-1]
num3 => [-1,2]... | class Solution:
def four_sum_count(self, nums1: List[int], nums2: List[int], nums3: List[int], nums4: List[int]) -> int:
pass
'\n\n num1 => [1,2]\n num2 => [-2,-1]\n num3 => [-1,2]\n num4 => [0,2]\n\n 1\n\n' |
dias = int(input('Por quantos dias o carro ficou alugado? '))
km = float(input('Quantos quilometros o carro percorreu? '))
preco = (dias * 60) + (km * 0.15)
print ('O valor a ser pago eh de R${:.2f}!'.format(preco))
| dias = int(input('Por quantos dias o carro ficou alugado? '))
km = float(input('Quantos quilometros o carro percorreu? '))
preco = dias * 60 + km * 0.15
print('O valor a ser pago eh de R${:.2f}!'.format(preco)) |
# fisrt we get the number of people from the user
people = input("enter number of guests \n")
# we use the try methord to prevent the program from crashing if the user puts a string
try:
people = int(people)
if(people > 0 and people <= 50):
price = 4000
elif(people >50 and people <= 100):
pr... | people = input('enter number of guests \n')
try:
people = int(people)
if people > 0 and people <= 50:
price = 4000
elif people > 50 and people <= 100:
price = 10000
elif people > 100 and people <= 200:
price = 15000
elif people > 200:
price = 20000
print('${}'.for... |
# coding: utf-8
class Person:
number_of_people = 0 # Specific to the class
GRAVITY = 9.8 # we define constants in the generic class
def __init__(self, name):
self.name = name
Person.add_person()
# Decorator
@classmethod
def number_of_people_(cls):
return cls.nu... | class Person:
number_of_people = 0
gravity = 9.8
def __init__(self, name):
self.name = name
Person.add_person()
@classmethod
def number_of_people_(cls):
return cls.number_of_people
@classmethod
def add_person(cls):
cls.number_of_people += 1
p1 = person('Tim... |
seq=input()
def SortList(sequence):
k=0; list1=[]
while k<len(sequence):
num=""
if sequence[k]!=" ":
for j in range(k,len(sequence)):
if sequence[k]!=" ":
num+=sequence[k]
k+=1
else:
... | seq = input()
def sort_list(sequence):
k = 0
list1 = []
while k < len(sequence):
num = ''
if sequence[k] != ' ':
for j in range(k, len(sequence)):
if sequence[k] != ' ':
num += sequence[k]
k += 1
else:
... |
n = int(input())
for i in range(n):
for j in range(i):
print(' ', end="")
for j in range((n - i) * 2 - 1):
print('*', end="")
print()
for i in range (n - 1):
for j in range(n - i - 2):
print(' ', end="")
for j in range((i + 1) * 2 + 1):
print('*', end="")
print()
| n = int(input())
for i in range(n):
for j in range(i):
print(' ', end='')
for j in range((n - i) * 2 - 1):
print('*', end='')
print()
for i in range(n - 1):
for j in range(n - i - 2):
print(' ', end='')
for j in range((i + 1) * 2 + 1):
print('*', end='')
print() |
class Config:
STATE_SHAPE = [84, 84, 3]
SPEED = 20 # cm/step
GOAL_DIRECTION_REWARD = 1
CRASH_REWARD = -10
SIM_DIR = '/home/mate/ucv-pkg-outdoor-8-lite/LinuxNoEditor/outdoor_lite/Binaries/Linux/'
SIM_NAME = 'outdoor_lite'
RANDOM_SPAWN_LOCATIONS = True
MAP_X_MIN = -4000
MAP_X_MAX = ... | class Config:
state_shape = [84, 84, 3]
speed = 20
goal_direction_reward = 1
crash_reward = -10
sim_dir = '/home/mate/ucv-pkg-outdoor-8-lite/LinuxNoEditor/outdoor_lite/Binaries/Linux/'
sim_name = 'outdoor_lite'
random_spawn_locations = True
map_x_min = -4000
map_x_max = 4000
map_... |
"""
PASSENGERS
"""
numPassengers = 22784
passenger_arriving = (
(7, 5, 3, 9, 2, 1, 2, 2, 4, 0, 1, 0, 0, 7, 6, 3, 5, 4, 1, 3, 2, 3, 2, 1, 0, 0), # 0
(6, 11, 5, 8, 5, 3, 0, 2, 0, 0, 2, 0, 0, 6, 9, 8, 4, 3, 4, 2, 0, 2, 3, 0, 3, 0), # 1
(4, 8, 4, 5, 8, 5, 4, 1, 2, 3, 1, 0, 0, 7, 10, 6, 2, 9, 4, 1, 0, 4, 3, 0, 1, 0)... | """
PASSENGERS
"""
num_passengers = 22784
passenger_arriving = ((7, 5, 3, 9, 2, 1, 2, 2, 4, 0, 1, 0, 0, 7, 6, 3, 5, 4, 1, 3, 2, 3, 2, 1, 0, 0), (6, 11, 5, 8, 5, 3, 0, 2, 0, 0, 2, 0, 0, 6, 9, 8, 4, 3, 4, 2, 0, 2, 3, 0, 3, 0), (4, 8, 4, 5, 8, 5, 4, 1, 2, 3, 1, 0, 0, 7, 10, 6, 2, 9, 4, 1, 0, 4, 3, 0, 1, 0), (7, 7, 2, 7, 5... |
class Rectangle:
def __init__(self, width, height):
self.width = width
self.height = height
def __str__(self):
return "Rectangle(width=" + str(self.width) + \
", height=" + str(self.height) + ")"
def set_width(self, width):
self.width = width
def set_hei... | class Rectangle:
def __init__(self, width, height):
self.width = width
self.height = height
def __str__(self):
return 'Rectangle(width=' + str(self.width) + ', height=' + str(self.height) + ')'
def set_width(self, width):
self.width = width
def set_height(self, height... |
frogs = input().split(' ')
while True:
token = input().split(' ')
length = len(frogs) - 1
command = token[0]
if command == 'Join':
name = token[1]
frogs.append(name)
elif command == 'Jump':
name = token[1]
index = int(token[2])
if length >= index:
... | frogs = input().split(' ')
while True:
token = input().split(' ')
length = len(frogs) - 1
command = token[0]
if command == 'Join':
name = token[1]
frogs.append(name)
elif command == 'Jump':
name = token[1]
index = int(token[2])
if length >= index:
... |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '... | databases = {'default': {'ENGINE': 'django.db.backends.', 'NAME': '', 'USER': '', 'PASSWORD': '', 'HOST': '', 'PORT': ''}}
mediasync = {'BACKEND': 'mediasync.backends.s3', 'AWS_KEY': '', 'AWS_SECRET': '', 'AWS_BUCKET': '', 'JOINED': {'style/production.css': ('yui/reset-fonts-grids.css', 'yui/yahoo-min.js', 'yui/dom-min... |
# 02. Count substring occurrences
text, key = input(), input()
counter = 0
for index in range(0, len(text) - len(key) + 1):
if key.lower() == text[index:index + len(key)].lower():
counter += 1
print(counter) | (text, key) = (input(), input())
counter = 0
for index in range(0, len(text) - len(key) + 1):
if key.lower() == text[index:index + len(key)].lower():
counter += 1
print(counter) |
# def func(a):
# return a + 5
func = lambda a: a+5
square = lambda s: s*s
sum = lambda x,y,z: x+y+z
x = 10
print (func(x))
print (square(x))
print (sum(x,4,5)) | func = lambda a: a + 5
square = lambda s: s * s
sum = lambda x, y, z: x + y + z
x = 10
print(func(x))
print(square(x))
print(sum(x, 4, 5)) |
# Numeric Pattern 6
"""
1 3 5 7 9
11 13 15 17 19
21 23 25 27 29
31 33 35 37 39
41 43 45 47 49
"""
i = 0
nums = list(range(1, 50, 2))
for _ in range(5):
j = i + 5
row = " ".join(map(str, nums[i:j]))
print(row)
i = j
| """
1 3 5 7 9
11 13 15 17 19
21 23 25 27 29
31 33 35 37 39
41 43 45 47 49
"""
i = 0
nums = list(range(1, 50, 2))
for _ in range(5):
j = i + 5
row = ' '.join(map(str, nums[i:j]))
print(row)
i = j |
class ServiceTypes():
MachineLearning = "ml"
Vision = "vision"
ChatBot = "bot"
Speech = "speech"
LangIntent = "intent"
LangEntity = "entity"
| class Servicetypes:
machine_learning = 'ml'
vision = 'vision'
chat_bot = 'bot'
speech = 'speech'
lang_intent = 'intent'
lang_entity = 'entity' |
class Solution(object):
def maxSubArray(self, nums):
idx, sumVal = 0, 0
ans = -float('INF')
while idx < len(nums):
sumVal += nums[idx]
ans = max(ans, sumVal)
if sumVal < 0:
sumVal = 0
idx += 1
return ans
| class Solution(object):
def max_sub_array(self, nums):
(idx, sum_val) = (0, 0)
ans = -float('INF')
while idx < len(nums):
sum_val += nums[idx]
ans = max(ans, sumVal)
if sumVal < 0:
sum_val = 0
idx += 1
return ans |
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 20 09:42:33 2019
@author: aksha
"""
#printing examples
#print("Hello World")
#
#print("The Lion King")
#print ("was released in 1996")
#print("by Disney.")
#
#print("4*8 is", 4*8)
#print("2**2**2 is", 2**2**2)
#print("1+2+3+4+5 is", 1+2+3+4+5)
#input a... | """
Created on Sat Jul 20 09:42:33 2019
@author: aksha
""" |
class Document:
def __init__(self, docID, docTitle, docContent, docAll):
self.docID = docID
self.docTitle = docTitle
self.docContent = docContent
self.docAll = docAll
def get_docID(self):
return self.docID
def get_docTitle(self):
return self.docTitle
def get_docContent(self):
return self.docConten... | class Document:
def __init__(self, docID, docTitle, docContent, docAll):
self.docID = docID
self.docTitle = docTitle
self.docContent = docContent
self.docAll = docAll
def get_doc_id(self):
return self.docID
def get_doc_title(self):
return self.docTitle
... |
class Solution:
def findTilt(self, root: TreeNode) -> int:
def traverse(node, res):
if not node:
return 0
left_sum = traverse(node.left, res)
right_sum = traverse(node.right, res)
res[0] += abs(left_sum-right_sum)
... | class Solution:
def find_tilt(self, root: TreeNode) -> int:
def traverse(node, res):
if not node:
return 0
left_sum = traverse(node.left, res)
right_sum = traverse(node.right, res)
res[0] += abs(left_sum - right_sum)
return left_s... |
x = 9
y = 3 #integers
#arithmetic operators
print(x+y) #addition
print(x-y) #subtraction
print(x*y) #multiplication
print(x/y) #division
print(x%y) #modulus
print(x**y) #exponentiation
x = 9.1918123
print(x//y) #floor division
# Assignment operators
x = 9 #sets x to equal 9
x += 3 # x = x +3
print(x)
x = 9
x -=... | x = 9
y = 3
print(x + y)
print(x - y)
print(x * y)
print(x / y)
print(x % y)
print(x ** y)
x = 9.1918123
print(x // y)
x = 9
x += 3
print(x)
x = 9
x -= 3
print(x)
x *= 3
print(x)
x /= 3
print(x)
x **= 3
print(x)
x = 9
y = 3
print(x == y)
print(x != y)
print(x > y)
print(x < y)
print(x >= y)
print(x <= y) |
class Terminal(object):
check = u'\u2714'
error = u'\u2715'
broken = u'\u2718'
arrow = u'\u21D2'
broken_arrow = u'\u21CF'
under_arrow = u'\u21AA'
class tcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '... | class Terminal(object):
check = u'✔'
error = u'✕'
broken = u'✘'
arrow = u'⇒'
broken_arrow = u'⇏'
under_arrow = u'↪'
class Tcolors:
header = '\x1b[95m'
okblue = '\x1b[94m'
okgreen = '\x1b[92m'
warning = '\x1b[93m'
fail = '\x1b[91m'
endc = '\x1b[0m'
bold = '\x1b[1m'
... |
expected_output = {
"instance": {
"master": {
"areas": {
"0.0.0.1": {
"interfaces": {
"ge-0/0/2.0": {
"state": "BDR",
"dr_id": "10.16.2.2",
"bdr_id": "1... | expected_output = {'instance': {'master': {'areas': {'0.0.0.1': {'interfaces': {'ge-0/0/2.0': {'state': 'BDR', 'dr_id': '10.16.2.2', 'bdr_id': '10.64.4.4', 'nbrs_count': 5}}}}}}} |
"""
LINK: https://leetcode.com/problems/sqrtx/
Given a non-negative integer x, compute and return the square root of x.
Since the return type is an integer, the decimal digits are truncated, and only the integer part of the result is returned.
Example 1:
Input: x = 4
Output: 2
Example 2:
Input: x = 8
Output: 2
Exp... | """
LINK: https://leetcode.com/problems/sqrtx/
Given a non-negative integer x, compute and return the square root of x.
Since the return type is an integer, the decimal digits are truncated, and only the integer part of the result is returned.
Example 1:
Input: x = 4
Output: 2
Example 2:
Input: x = 8
Output: 2
Exp... |
full_dataset = [
{'name': 'Peach', 'items': ['green shell', 'banana', 'green shell',], 'finish': 3},
{'name': 'Peach', 'items': ['green shell', 'banana', 'green shell',], 'finish': 1},
{'name': 'Bowser', 'items': ['green shell',], 'finish': 1},
{'name': None, 'items': ['green shell',], 'finish': 2},
... | full_dataset = [{'name': 'Peach', 'items': ['green shell', 'banana', 'green shell'], 'finish': 3}, {'name': 'Peach', 'items': ['green shell', 'banana', 'green shell'], 'finish': 1}, {'name': 'Bowser', 'items': ['green shell'], 'finish': 1}, {'name': None, 'items': ['green shell'], 'finish': 2}, {'name': 'Bowser', 'item... |
"""
Using nested loops to iterate over
all the items in a matrix list
"""
#Defining a matrix list
matrix = [
[1,2,3],
[4,5,6],
[7,8,9]
]
#This loop will iterate over all the items inside the matrix list
for row in matrix:
for index in row:
print(index)
| """
Using nested loops to iterate over
all the items in a matrix list
"""
matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
for row in matrix:
for index in row:
print(index) |
def Contract_scalar_1x5(\
t0_6,t1_6,t2_6,\
t0_5,t1_5,t2_5,\
t0_4,t1_4,t2_4,\
t0_3,t1_3,t2_3,\
t0_2,t1_2,t2_2,\
t0_1,t1_1,t2_1,\
t0_0,t1_0,t2_0,\
o1_5,\
o1_4,\
o1_3,\
o1_2,\
o1_1\
):
##############################
# ./input/input_Lx1Ly5.dat
################... | def contract_scalar_1x5(t0_6, t1_6, t2_6, t0_5, t1_5, t2_5, t0_4, t1_4, t2_4, t0_3, t1_3, t2_3, t0_2, t1_2, t2_2, t0_1, t1_1, t2_1, t0_0, t1_0, t2_0, o1_5, o1_4, o1_3, o1_2, o1_1):
return np.tensordot(o1_2, np.tensordot(t1_2.conj(), np.tensordot(np.tensordot(t0_2, np.tensordot(t0_1, np.tensordot(t1_1.conj(), np.ten... |
def read_matrix_lines():
return [int(x) for x in input().split(", ")]
def create_matrix(size):
result = [read_matrix_lines() for _ in range(size)]
return result
def get_first_diagonal(matrix, size):
return [matrix[i][i]for i in range(size)]
def get_second_diagonal(matrix, size):
result = []
f... | def read_matrix_lines():
return [int(x) for x in input().split(', ')]
def create_matrix(size):
result = [read_matrix_lines() for _ in range(size)]
return result
def get_first_diagonal(matrix, size):
return [matrix[i][i] for i in range(size)]
def get_second_diagonal(matrix, size):
result = []
... |
"""
Summary
-------
The summary is a brief intro. You can put raw HTML into this field.
"""
summary = '<p> A seasoned Software professional with over 7 years of rich experience in Artificial Intelligence, Machine Learning and Robotics Automation. Responsible for Continous Improvement and Business Digital Trasnformation... | """
Summary
-------
The summary is a brief intro. You can put raw HTML into this field.
"""
summary = '<p> A seasoned Software professional with over 7 years of rich experience in Artificial Intelligence, Machine Learning and Robotics Automation. Responsible for Continous Improvement and Business Digital Trasnformation... |
#!/usr/bin/python
def param_gui(self):
param_gui = [
self.K1, self.P1, self.e1, self.om1, self.ma1, self.incl1, self.Omega1,
self.K2, self.P2, self.e2, self.om2, self.ma2, self.incl2, self.Omega2,
self.K3, self.P3, self.e3, self.om3, self.ma3, self.incl3, self.Omega3,
... | def param_gui(self):
param_gui = [self.K1, self.P1, self.e1, self.om1, self.ma1, self.incl1, self.Omega1, self.K2, self.P2, self.e2, self.om2, self.ma2, self.incl2, self.Omega2, self.K3, self.P3, self.e3, self.om3, self.ma3, self.incl3, self.Omega3, self.K4, self.P4, self.e4, self.om4, self.ma4, self.incl4, self.Om... |
class HaltListener:
def stream_read_halted(self, chunk: int, _time: int) -> None:
pass
def stream_read_resumed(self, chunk: int, _time: int):
pass
| class Haltlistener:
def stream_read_halted(self, chunk: int, _time: int) -> None:
pass
def stream_read_resumed(self, chunk: int, _time: int):
pass |
class Solution:
def solve(self, words):
bitmasks = []
for j,word in enumerate(words):
bitmask = [0]*26
distincts = 0
for char in word:
i = ord(char) - ord('a')
if bitmask[i] == 0: distincts += 1
bitmask[i] = 1
... | class Solution:
def solve(self, words):
bitmasks = []
for (j, word) in enumerate(words):
bitmask = [0] * 26
distincts = 0
for char in word:
i = ord(char) - ord('a')
if bitmask[i] == 0:
distincts += 1
... |
# print(range(5))
# a = range(1,10,5)
# for x in a:
# print(x)
# num =1
# rem = num%2
# if rem==0:
# print('The number is even')
# else:
# print('The number is odd')
# print("I am not inside if statement")
# num = -2
# if num>0:
# print("Number is positive")
# if (num % 2) == 0:
# prin... | var = 100
if var == 100:
print('This is 100') |
def entrada_notas():
notas = input().split(' ')
nota1 = float(notas[0])
nota2 = float(notas[1])
nota3 = float(notas[2])
nota4 = float(notas[3])
return nota1, nota2, nota3, nota4
def media(n1, n2, n3, n4):
med = (2 * n1 + 3 * n2 + 4 * n3 + n4)/10
print(f'Media: {med:.1f}')
if med >=... | def entrada_notas():
notas = input().split(' ')
nota1 = float(notas[0])
nota2 = float(notas[1])
nota3 = float(notas[2])
nota4 = float(notas[3])
return (nota1, nota2, nota3, nota4)
def media(n1, n2, n3, n4):
med = (2 * n1 + 3 * n2 + 4 * n3 + n4) / 10
print(f'Media: {med:.1f}')
if med... |
"""
Design a Data Structure SpecialStack that supports all the stack operations
like push(), pop(), isEmpty(), isFull() and an additional operation getMin()
which should return minimum element from the SpecialStack. All these operations
of SpecialStack must be O(1). To implement SpecialStack, you should only use
standa... | """
Design a Data Structure SpecialStack that supports all the stack operations
like push(), pop(), isEmpty(), isFull() and an additional operation getMin()
which should return minimum element from the SpecialStack. All these operations
of SpecialStack must be O(1). To implement SpecialStack, you should only use
standa... |
"""Lambda Expressions
@see: https://docs.python.org/3/tutorial/controlflow.html#lambda-expressions
Small anonymous functions can be created with the lambda keyword. Lambda functions can be used
wherever function objects are required. They are syntactically restricted to a single expression.
Semantically, they are jus... | """Lambda Expressions
@see: https://docs.python.org/3/tutorial/controlflow.html#lambda-expressions
Small anonymous functions can be created with the lambda keyword. Lambda functions can be used
wherever function objects are required. They are syntactically restricted to a single expression.
Semantically, they are jus... |
#! /usr/bin/env python
'''
(This question is super complicated and artificial.)
(Refer Sumita Arora: Strings Q5)
'''
A = int(input("Enter the integer: "))
S = input("Enter the string: ")
# extract digits
D = int(''.join( e for e in S if e.isdigit() ))
R = A + D
print("{} + {} = {}".format(A, D, R))
| """
(This question is super complicated and artificial.)
(Refer Sumita Arora: Strings Q5)
"""
a = int(input('Enter the integer: '))
s = input('Enter the string: ')
d = int(''.join((e for e in S if e.isdigit())))
r = A + D
print('{} + {} = {}'.format(A, D, R)) |
#!/usr/bin/env python
population = input("Please enter population value: ")
print("You have entered: ", population)
| population = input('Please enter population value: ')
print('You have entered: ', population) |
class HttpServerHTMLGenerator:
"""
Generates the HTML for the debug_http_server.
"""
def __init__(self):
pass
@staticmethod
def generate_main_table(url_records):
ret_html = '<html><head><meta charset="utf-8"/></head><table border=\'1\'>{0}</table></html>'
main_table = "<... | class Httpserverhtmlgenerator:
"""
Generates the HTML for the debug_http_server.
"""
def __init__(self):
pass
@staticmethod
def generate_main_table(url_records):
ret_html = '<html><head><meta charset="utf-8"/></head><table border=\'1\'>{0}</table></html>'
main_table = '... |
op_str = 'acc +7'
def parse_operation(operation_str):
op_list = operation_str.strip().split()
operation = op_list[0]
op_sign = op_list[1][0]
steps = op_list[1][1:]
return {'operation': operation, 'sign': op_sign, 'steps': int(steps), 'visited': False}
#print(parse_operation(op_str))
#operations_... | op_str = 'acc +7'
def parse_operation(operation_str):
op_list = operation_str.strip().split()
operation = op_list[0]
op_sign = op_list[1][0]
steps = op_list[1][1:]
return {'operation': operation, 'sign': op_sign, 'steps': int(steps), 'visited': False}
operations_file = open('data/operations.txt')
o... |
SOC_IRAM_LOW = 0x40020000
SOC_IRAM_HIGH = 0x40070000
SOC_DRAM_LOW = 0x3ffb0000
SOC_DRAM_HIGH = 0x40000000
SOC_RTC_DRAM_LOW = 0x3ff9e000
SOC_RTC_DRAM_HIGH = 0x3ffa0000
SOC_RTC_DATA_LOW = 0x50000000
SOC_RTC_DATA_HIGH = 0x50002000
| soc_iram_low = 1073872896
soc_iram_high = 1074200576
soc_dram_low = 1073414144
soc_dram_high = 1073741824
soc_rtc_dram_low = 1073340416
soc_rtc_dram_high = 1073348608
soc_rtc_data_low = 1342177280
soc_rtc_data_high = 1342185472 |
"""
problem: 1018 - Banknotes
url: https://www.urionlinejudge.com.br/judge/en/problems/view/1018
"""
valor = int(input())
notas = [100,50,20,10,5,2,1]
resto = valor
print(valor)
for n in notas:
qtd = resto // n
resto = resto % n
print('{:d} nota(s) de R$ {:d},00'.format(qtd, n))
| """
problem: 1018 - Banknotes
url: https://www.urionlinejudge.com.br/judge/en/problems/view/1018
"""
valor = int(input())
notas = [100, 50, 20, 10, 5, 2, 1]
resto = valor
print(valor)
for n in notas:
qtd = resto // n
resto = resto % n
print('{:d} nota(s) de R$ {:d},00'.format(qtd, n)) |
ies = []
ies.append({ "ie_type" : "Node ID", "ie_value" : "Node ID", "presence" : "M", "instance" : "0", "comment" : "This IE shall contain the unique identifier of the sending Node."})
ies.append({ "ie_type" : "Cause", "ie_value" : "Cause", "presence" : "M", "instance" : "0", "comment" : "This IE shall indicate the ac... | ies = []
ies.append({'ie_type': 'Node ID', 'ie_value': 'Node ID', 'presence': 'M', 'instance': '0', 'comment': 'This IE shall contain the unique identifier of the sending Node.'})
ies.append({'ie_type': 'Cause', 'ie_value': 'Cause', 'presence': 'M', 'instance': '0', 'comment': 'This IE shall indicate the acceptance or ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.