content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# my_list=['honda','honda','bmw','mercedes','bugatti']
# print(my_list.index('honda'))
# print(my_list[0])
# print(my_list.count('honda'))
# my_list.sort()
# print(my_list)
# my_list.pop()
# print(my_list)
# my_list=['honda','honda','bmw','mercedes','bugatti']
# copy_my_list=my_list.copy()
# print(copy_my_list)
# l... | data = ['Wt', 'Ht', 342432423424324, 5.996, 5.77778, 'Insurance_History_2', 34243242342432124545312312534534534, 'Insurance_History_4', 'Insurance_History_5', 'Insurance_History_7', 234242049004328402384023849028402348203, 55, 66, 11, 'Medical_Keyword_3', 'Medical_Keyword_4', 'Medical_Keyword_5', 'Medical_Keyword_6', 3... |
class Lamp:
def __init__(self, color):
self.color=color
self.on=False
def state(self):
return "The lamp is off." if not self.on else "The lamp is on."
def toggle_switch(self):
self.on=not self.on | class Lamp:
def __init__(self, color):
self.color = color
self.on = False
def state(self):
return 'The lamp is off.' if not self.on else 'The lamp is on.'
def toggle_switch(self):
self.on = not self.on |
def test_add():
class Number:
def __add__(self, other):
return 4 + other
def __radd__(self, other):
return other + 4
a = Number()
assert 3 + a == 7
assert a + 3 == 7
def test_inheritance():
class Node(object):
def __init__(self, a, b, c):
... | def test_add():
class Number:
def __add__(self, other):
return 4 + other
def __radd__(self, other):
return other + 4
a = number()
assert 3 + a == 7
assert a + 3 == 7
def test_inheritance():
class Node(object):
def __init__(self, a, b, c):
... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def diameterOfBinaryTree(self, root: TreeNode) -> int:
_, res = self.max_depth(root)
return res
def max_depth(self, ... | class Solution:
def diameter_of_binary_tree(self, root: TreeNode) -> int:
(_, res) = self.max_depth(root)
return res
def max_depth(self, node: TreeNode) -> int:
if node is None:
return (-1, 0)
(left_depth, left_max) = self.max_depth(node.left)
(right_depth, ... |
response = sm.sendAskYesNo("Would you like to go back to Victoria Island?")
if response:
if sm.hasQuest(38030):
sm.setQRValue(38030, "clear", False)
sm.warp(100000000, 23)
sm.dispose()
sm.warp(104020000, 0)
| response = sm.sendAskYesNo('Would you like to go back to Victoria Island?')
if response:
if sm.hasQuest(38030):
sm.setQRValue(38030, 'clear', False)
sm.warp(100000000, 23)
sm.dispose()
sm.warp(104020000, 0) |
# Write your solutions for 1.5 here!
class superheros:
def __init__(self, name, superpower, strength):
self.name = name
self.superpower = superpower
self.strength = strength
def gaya(self):
print(self.name)
| class Superheros:
def __init__(self, name, superpower, strength):
self.name = name
self.superpower = superpower
self.strength = strength
def gaya(self):
print(self.name) |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def kthSmallest(self, root: Optional[TreeNode], k: int) -> int:
ordered_list = []
def inor... | class Solution:
def kth_smallest(self, root: Optional[TreeNode], k: int) -> int:
ordered_list = []
def inorder_traverse(node):
nonlocal ordered_list
if not node:
return
if len(ordered_list) >= k:
return
inorder_travers... |
TYPE_MAP = {
0: 'bit',
1: 'u32',
2: 's32',
3: 'float',
'bit': 0,
'u32': 1,
's32': 2,
'float': 3,
}
class HalType(object):
bit = 0
u32 = 1
s32 = 2
float = 3
@classmethod
def toString(self, typ):
return TYPE_MAP[typ]
| type_map = {0: 'bit', 1: 'u32', 2: 's32', 3: 'float', 'bit': 0, 'u32': 1, 's32': 2, 'float': 3}
class Haltype(object):
bit = 0
u32 = 1
s32 = 2
float = 3
@classmethod
def to_string(self, typ):
return TYPE_MAP[typ] |
# Welcome to the interactive tutorial for PBUnit! Please read the
# descriptions and follow the instructions for each example.
#
# Let's start with writing unit tests and using Projection Boxes:
#
# 1. Edit the unit test below to use your name and initials.
# 2. Click your mouse on each line of code in the function to ... | def initials(name):
parts = name.split(' ')
letters = ''
for part in parts:
letters += part[0]
return letters
def factorial(n):
if n <= 0:
return 1
result = 1
for factor in range(2, n + 1):
result *= factor
return result
def average(nums):
total = 0
for ... |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
MMS_WORKSPACE_API_VERSION = '2018-11-19'
MMS_ROUTE_API_VERSION = 'v1.0'
MMS_SYNC_TIMEOUT_SECONDS = 80
MMS_SERVICE_VALIDATE_OPERATION... | mms_workspace_api_version = '2018-11-19'
mms_route_api_version = 'v1.0'
mms_sync_timeout_seconds = 80
mms_service_validate_operation_timeout_seconds = 30
mms_service_exist_check_sync_timeout_seconds = 5
mms_resource_check_sync_timeout_seconds = 15
supported_runtimes = {'spark-py': 'SparkPython', 'python': 'Python', 'py... |
class LinkedListTreeTraversal:
def __init__(self, data):
self.tree = data
# bfsTraversal is a recursive version of bfs traversal
def bfsTraversal(self):
root = self.tree
queue = []
path = []
if self.tree == None:
return []
queue.append(root)
... | class Linkedlisttreetraversal:
def __init__(self, data):
self.tree = data
def bfs_traversal(self):
root = self.tree
queue = []
path = []
if self.tree == None:
return []
queue.append(root)
path = self.bfsTraversalUtil(queue, path)
retu... |
#
# 258. Add Digits
#
# Q: https://leetcode.com/problems/add-digits/
# A: https://leetcode.com/problems/add-digits/discuss/756944/Javascript-Python3-C%2B%2B-1-Liners
#
# using reduce() to accumulate the digits of x
class Solution:
def addDigits(self, x: int) -> int:
return x if x < 10 else self.addDigits(r... | class Solution:
def add_digits(self, x: int) -> int:
return x if x < 10 else self.addDigits(reduce(lambda a, b: a + b, map(lambda s: int(s), str(x))))
class Solution:
def add_digits(self, x: int) -> int:
return x if x < 10 else self.addDigits(sum(map(lambda c: int(c), str(x)))) |
#!/usr/bin/env python3
class Cavern:
def __init__(self, mapstring):
self.mapstring = mapstring
self.initialize(mapstring)
def initialize(self, mapstring, elf_attack = 3):
self.walls = set()
self.units = {}
self.elf_initial = 0
for y, line in enumerate(ma... | class Cavern:
def __init__(self, mapstring):
self.mapstring = mapstring
self.initialize(mapstring)
def initialize(self, mapstring, elf_attack=3):
self.walls = set()
self.units = {}
self.elf_initial = 0
for (y, line) in enumerate(mapstring.split('\n')):
... |
ROLE_METHODS = {
'google.iam.admin.v1.CreateRole', 'google.iam.admin.v1.DeleteRole',
'google.iam.admin.v1.UpdateRole'
}
def rule(event):
return (event['resource'].get('type') == 'iam_role' and
event['protoPayload'].get('methodName') in ROLE_METHODS)
def dedup(event):
return event['resour... | role_methods = {'google.iam.admin.v1.CreateRole', 'google.iam.admin.v1.DeleteRole', 'google.iam.admin.v1.UpdateRole'}
def rule(event):
return event['resource'].get('type') == 'iam_role' and event['protoPayload'].get('methodName') in ROLE_METHODS
def dedup(event):
return event['resource'].get('labels', {}).get... |
# -*- coding: utf-8 -*-
# Common constants for submit
SUBMIT_RESPONSE_ERROR = 'CERR'
SUBMIT_RESPONSE_OK = 'OK'
SUBMIT_RESPONSE_PROTOCOL_CORRUPTED = 'PROTCOR'
| submit_response_error = 'CERR'
submit_response_ok = 'OK'
submit_response_protocol_corrupted = 'PROTCOR' |
text = 'shakespeare.txt'
output = 'output_file.txt'
f = open(output, 'r')
o = open(text, 'w')
for line in f:
o.write(line)
f.close()
o.close() | text = 'shakespeare.txt'
output = 'output_file.txt'
f = open(output, 'r')
o = open(text, 'w')
for line in f:
o.write(line)
f.close()
o.close() |
{
"targets": [
{
"target_name": "scsSDKTelemetry",
"sources": [ "scsSDKTelemetry.cc" ],
"cflags": ["-fexceptions"],
"cflags_cc": ["-fexceptions"]
}
]
} | {'targets': [{'target_name': 'scsSDKTelemetry', 'sources': ['scsSDKTelemetry.cc'], 'cflags': ['-fexceptions'], 'cflags_cc': ['-fexceptions']}]} |
# Flags
quiet_mode = False
no_log = False
no_cleanup = False
all_containers = False
no_confirm = False
no_backup = False
# intern Flags
keep_maintenance_mode = False
def set_flags(flags=list):
global no_confirm
global all_containers
global quiet_mode
global no_log
global no_cleanup
global no_... | quiet_mode = False
no_log = False
no_cleanup = False
all_containers = False
no_confirm = False
no_backup = False
keep_maintenance_mode = False
def set_flags(flags=list):
global no_confirm
global all_containers
global quiet_mode
global no_log
global no_cleanup
global no_backup
no_confirm = '... |
class Solution:
def solve(self, n):
# Write your code here
l = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K'
, 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z'
]
s = ""
while n > 26:
j = n%26
... | class Solution:
def solve(self, n):
l = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
s = ''
while n > 26:
j = n % 26
n = n // 26
s += l[j - 1]
if n <= 26:
... |
class Base:
base_url = "https://localhost"
def __init__(self, *args, **kwargs):
pass
| class Base:
base_url = 'https://localhost'
def __init__(self, *args, **kwargs):
pass |
def reward_function(params):
distance_from_center = params['distance_from_center']
progress = params['progress']
on_track = params["all_wheels_on_track"]
'''
Example that penalizes slow driving. This create a non-linear reward function so it may take longer to learn.
'''
# Calculate 3 marks... | def reward_function(params):
distance_from_center = params['distance_from_center']
progress = params['progress']
on_track = params['all_wheels_on_track']
'\n Example that penalizes slow driving. This create a non-linear reward function so it may take longer to learn.\n '
marker_1 = 0.1 * param... |
test_list = [-2, 1, 3, -6]
print(f'before', test_list)
test_list.sort(key=abs)
print(f'before', test_list) | test_list = [-2, 1, 3, -6]
print(f'before', test_list)
test_list.sort(key=abs)
print(f'before', test_list) |
class Request:
def __init__(self, req_id: int, emp_id: int, req_amount: float, req_desc: str,
req_date: str, approved: bool, mgr_message: str, reviewed: bool):
self.req_id = req_id
self.emp_id = emp_id
self.req_amount = req_amount
self.req_desc = req_desc
sel... | class Request:
def __init__(self, req_id: int, emp_id: int, req_amount: float, req_desc: str, req_date: str, approved: bool, mgr_message: str, reviewed: bool):
self.req_id = req_id
self.emp_id = emp_id
self.req_amount = req_amount
self.req_desc = req_desc
self.req_date = req... |
def test_count_by_time_categorical(total_spent):
labels = range(2)
total_spent = total_spent.bin(2, labels=labels)
ax = total_spent.plot.count_by_time()
assert ax.get_title() == 'Label Count vs. Cutoff Times'
def test_count_by_time_continuous(total_spent):
ax = total_spent.plot.count_by_time()
... | def test_count_by_time_categorical(total_spent):
labels = range(2)
total_spent = total_spent.bin(2, labels=labels)
ax = total_spent.plot.count_by_time()
assert ax.get_title() == 'Label Count vs. Cutoff Times'
def test_count_by_time_continuous(total_spent):
ax = total_spent.plot.count_by_time()
... |
DATABASES_PATH="../tmp/storage"
CREDENTIALS_PATH_BUCKETS="../credentials/tynr/engine/bucketAccess.json"
CREDENTIALS_PATH_FIRESTORE = '../credentials/tynr/engine/firestoreServiceAccount.json'
INGESTION_COLLECTION = "tyns"
INGESTION_BATCH_LIMIT = 1000 | databases_path = '../tmp/storage'
credentials_path_buckets = '../credentials/tynr/engine/bucketAccess.json'
credentials_path_firestore = '../credentials/tynr/engine/firestoreServiceAccount.json'
ingestion_collection = 'tyns'
ingestion_batch_limit = 1000 |
__all__ = ['EXPERIMENTS']
EXPERIMENTS = ','.join([
'ig_android_sticker_search_explorations',
'android_ig_camera_ar_asset_manager_improvements_universe',
'ig_android_stories_seen_state_serialization',
'ig_stories_photo_time_duration_universe',
'ig_android_bitmap_cache_executor_size',
'ig_androi... | __all__ = ['EXPERIMENTS']
experiments = ','.join(['ig_android_sticker_search_explorations', 'android_ig_camera_ar_asset_manager_improvements_universe', 'ig_android_stories_seen_state_serialization', 'ig_stories_photo_time_duration_universe', 'ig_android_bitmap_cache_executor_size', 'ig_android_stories_music_search_type... |
"jq_eval rule"
load("@bazel_skylib//lib:collections.bzl", "collections")
load("@bazel_skylib//lib:shell.bzl", "shell")
_DOC = "Defines a jq eval execution."
_ATTRS = {
"srcs": attr.label_list(
doc = "Files to apply filter to.",
allow_files = True,
),
"filter": attr.string(
doc = "... | """jq_eval rule"""
load('@bazel_skylib//lib:collections.bzl', 'collections')
load('@bazel_skylib//lib:shell.bzl', 'shell')
_doc = 'Defines a jq eval execution.'
_attrs = {'srcs': attr.label_list(doc='Files to apply filter to.', allow_files=True), 'filter': attr.string(doc='Filter to evaluate'), 'filter_file': attr.labe... |
# encoding: utf-8
# Copyright 2008 California Institute of Technology. ALL RIGHTS
# RESERVED. U.S. Government Sponsorship acknowledged.
'''
Unit, functional, and other tests.
'''
| """
Unit, functional, and other tests.
""" |
#function to get a string made of its first three characters of a specified string.
# If the length of the string is less than 3 then return the original string.
def first_three(str):
return str[:3] if len(str) > 3 else str
print(first_three('ipy'))
print(first_three('python'))
print(first_three('py')) | def first_three(str):
return str[:3] if len(str) > 3 else str
print(first_three('ipy'))
print(first_three('python'))
print(first_three('py')) |
def factorial_digit_sum(num):
fact_total = 1
while num != 1:
fact_total *= num
num -= 1
fact_total_str = str(fact_total)
total_list = []
sum_total = 0
for i in fact_total_str:
total_list.append(i)
for i in total_list:
sum_total += int(i)
... | def factorial_digit_sum(num):
fact_total = 1
while num != 1:
fact_total *= num
num -= 1
fact_total_str = str(fact_total)
total_list = []
sum_total = 0
for i in fact_total_str:
total_list.append(i)
for i in total_list:
sum_total += int(i)
return sum_total
p... |
# This is an input class. Do not edit.
class LinkedList:
def __init__(self, value):
self.value = value
self.next = None
# O(n) time | O(n) space - where n is the number of nodes in the Linked List
def nodeSwap(head):
if head is None or head.next is None:
return head
... | class Linkedlist:
def __init__(self, value):
self.value = value
self.next = None
def node_swap(head):
if head is None or head.next is None:
return head
next_node = head.next
head.next = node_swap(head.next.next)
nextNode.next = head
return nextNode |
arrow_array = [
[[0,1,0],
[1,1,1],
[0,1,0],
[0,1,0],
[0,1,0]]
]
print(arrow_array[0][0][0]) | arrow_array = [[[0, 1, 0], [1, 1, 1], [0, 1, 0], [0, 1, 0], [0, 1, 0]]]
print(arrow_array[0][0][0]) |
'''
Vibrator
=======
The :class:`Vibrator` provides access to public methods to use vibrator of your
device.
.. note::
On Android your app needs the VIBRATE permission to
access the vibrator.
Simple Examples
---------------
To vibrate your device::
>>> from plyer import vibrator
>>> time=2
>>> ... | """
Vibrator
=======
The :class:`Vibrator` provides access to public methods to use vibrator of your
device.
.. note::
On Android your app needs the VIBRATE permission to
access the vibrator.
Simple Examples
---------------
To vibrate your device::
>>> from plyer import vibrator
>>> time=2
>>> ... |
#
# PySNMP MIB module ONEACCESS-SYS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ONEACCESS-SYS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:34:42 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, constraints_union, value_range_constraint, single_value_constraint) ... |
# all test parameters are declared here
delay = 5 #no of seconds to wait before deciding to exit
chrome_driver_path = '/home/apalya/browsers/chromedriver2.46'
website = 'http://www.sunnxt.com'
signin_text = 'Sign In'
profile_icon_xpath = '//span[@class="icomoon icon-icn_profile"]'
signin_link_xpath = '//ul[@class="sig... | delay = 5
chrome_driver_path = '/home/apalya/browsers/chromedriver2.46'
website = 'http://www.sunnxt.com'
signin_text = 'Sign In'
profile_icon_xpath = '//span[@class="icomoon icon-icn_profile"]'
signin_link_xpath = '//ul[@class="signinicon dropdown-menu dropdown-menu-right logg"]/li/a'
signin_modal_close_xpath = '//but... |
num_usernames = int(input())
usernames = set()
for _ in range(num_usernames):
username = input()
usernames.add(username)
[print(name) for name in usernames]
| num_usernames = int(input())
usernames = set()
for _ in range(num_usernames):
username = input()
usernames.add(username)
[print(name) for name in usernames] |
num = int(input())
words = []
for i in range(num):
words.append(input())
words.sort()
for word in words:
print(word) | num = int(input())
words = []
for i in range(num):
words.append(input())
words.sort()
for word in words:
print(word) |
# def make_table():
# colors_distance = {
# 'black': {'black': 0, 'brown': 0, 'beige': 0, 'gray': 0, 'white': 0, 'blue': 0,
# 'petrol': 0, 'turquoise': 0, 'green': 0,
# 'olive': 0, 'yellow': 0, 'orange': 0, 'red': 0, 'pink': 0, 'purple': 0},
# 'brown': {'black': 0... | colors_combinations = [('black', 'red', 'gray'), ('black', 'petrol', 'white'), ('brown', 'gray', 'olive'), ('brown', 'yellow', 'beige'), ('beige', 'green', 'white'), ('beige', 'orange', 'black'), ('gray', 'beige', 'white'), ('gray', 'petrol', 'white'), ('white', 'olive', 'yellow'), ('white', 'orange', 'green'), ('blue'... |
cpgf._import(None, "builtin.core");
KeyIsDown = [];
def makeMyEventReceiver(receiver) :
for i in range(irr.KEY_KEY_CODES_COUNT) :
KeyIsDown.append(False);
def OnEvent(me, event) :
if event.EventType == irr.EET_KEY_INPUT_EVENT :
KeyIsDown[event.KeyInput.Key + 1] = event.KeyInput.PressedDown;
ret... | cpgf._import(None, 'builtin.core')
key_is_down = []
def make_my_event_receiver(receiver):
for i in range(irr.KEY_KEY_CODES_COUNT):
KeyIsDown.append(False)
def on_event(me, event):
if event.EventType == irr.EET_KEY_INPUT_EVENT:
KeyIsDown[event.KeyInput.Key + 1] = event.KeyInput.Pres... |
class AttemptResults(list):
def __init__(self, tries):
return super(AttemptResults, self).extend(['ND'] * tries)
| class Attemptresults(list):
def __init__(self, tries):
return super(AttemptResults, self).extend(['ND'] * tries) |
lucky_numbers = [2, 4, 8, 1, 7, 15, 27, 25, 10]
friends = ["yacubu", "rolan", "anatol", "patrick", "jony", "bel"]
friends.extend(lucky_numbers)## take friend and value of lucky num in it
print(friends)
friends.append("toby")
friends.insert(1, "rolax")## add value at index value and all other value get push back
p... | lucky_numbers = [2, 4, 8, 1, 7, 15, 27, 25, 10]
friends = ['yacubu', 'rolan', 'anatol', 'patrick', 'jony', 'bel']
friends.extend(lucky_numbers)
print(friends)
friends.append('toby')
friends.insert(1, 'rolax')
print(friends)
friends.remove('bel')
print(friends)
print(friends.clear())
friends = ['yacubu', 'rolan', 'anato... |
# pylint: disable=missing-function-docstring, missing-module-docstring/
ai = (1,4,5)
ai[0] = 2
bi = ai[0]
ci = 2 * ai[0]
di = 2 * ai[0] + 3 * ai[1]
ei = 2 * ai[0] + bi * ai[1]
fi = ai
gi = (0,)*2
gi[:] = ai[1:]
ad = (1.,4.,5.)
ad[0] = 2.
bd = ad[0]
cd = 2. * ad[0]
dd = 2. * ad[0] + 3. * ad[1]
ed = 2. * ad[0] + bd * ad... | ai = (1, 4, 5)
ai[0] = 2
bi = ai[0]
ci = 2 * ai[0]
di = 2 * ai[0] + 3 * ai[1]
ei = 2 * ai[0] + bi * ai[1]
fi = ai
gi = (0,) * 2
gi[:] = ai[1:]
ad = (1.0, 4.0, 5.0)
ad[0] = 2.0
bd = ad[0]
cd = 2.0 * ad[0]
dd = 2.0 * ad[0] + 3.0 * ad[1]
ed = 2.0 * ad[0] + bd * ad[1]
fd = ad
gd = (0.0,) * 2
gd[:] = ad[1:] |
class IntegrationFeatureRegistry:
def __init__(self):
self.features = []
def register(self, integration_feature):
self.features.append(integration_feature)
self.features.sort(key=lambda f: f.order)
def run_pre_scan(self):
for integration in self.features:
if ... | class Integrationfeatureregistry:
def __init__(self):
self.features = []
def register(self, integration_feature):
self.features.append(integration_feature)
self.features.sort(key=lambda f: f.order)
def run_pre_scan(self):
for integration in self.features:
if in... |
names = ['Dani', 'Ale', 'E. Jose']
message = f'Hey {names[0]}, Thanks for your friendship'
print(message)
message = f'Hey {names[1]}, Thanks for your friendship'
print(message)
message = f'Hey {names[2]}, Thanks for your friendship'
print(message)
| names = ['Dani', 'Ale', 'E. Jose']
message = f'Hey {names[0]}, Thanks for your friendship'
print(message)
message = f'Hey {names[1]}, Thanks for your friendship'
print(message)
message = f'Hey {names[2]}, Thanks for your friendship'
print(message) |
infilename = input()
outfilename = input()
print(infilename,outfilename)
| infilename = input()
outfilename = input()
print(infilename, outfilename) |
class ShrinkwrapConstraint:
distance = None
project_axis = None
project_axis_space = None
project_limit = None
shrinkwrap_type = None
target = None
| class Shrinkwrapconstraint:
distance = None
project_axis = None
project_axis_space = None
project_limit = None
shrinkwrap_type = None
target = None |
# Let's say it's a wedding day, and two happy people are getting
# married.
# we have a dictionary first_family, which contains the names
# of the wife's family members. For example:
first_family = {"wife": "Janet", "wife's mother": "Katie", "wife's father": "George"}
# And a similar dictionary second_family for the... | first_family = {'wife': 'Janet', "wife's mother": 'Katie', "wife's father": 'George'}
second_family = {'husband': 'Leon', "husband's mother": 'Eva', "husband's father": 'Gaspard', "husband's sister": 'Isabelle'}
first_family = json.loads(input())
second_family = json.loads(input())
big_family = first_family
big_family.... |
class BaseBoa:
NUM_REGRESSION_MODELS_SUPPORTED = 5
reg_model_index = {0: 'dtree',
1: 'knn',
2: 'linreg',
3: 'adaboost',
4: 'rforest',
}
def __repr__(self):
return type(... | class Baseboa:
num_regression_models_supported = 5
reg_model_index = {0: 'dtree', 1: 'knn', 2: 'linreg', 3: 'adaboost', 4: 'rforest'}
def __repr__(self):
return type(self).__name__
def __len__(self):
return len(self.ladder)
def ladder(self):
return self.ladder
def opt... |
# Copyright (c) 2007 The Hewlett-Packard Development Company
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implemen... | microcode = "\n\n# All the memory versions need to use LOCK, regardless of if it was set\n\ndef macroop XCHG_R_R\n{\n # Use the xor trick instead of moves to reduce register pressure.\n # This probably doesn't make much of a difference, but it's easy.\n xor reg, reg, regm\n xor regm, regm, reg\n xor reg,... |
T = int(input())
for x in range(1, T + 1):
N = int(input())
names = [input() for index in range(N)]
y = 0
previous = names[0]
for name in names[1:]:
if name < previous:
y += 1
else:
previous = name
print(f"Case #{x}: {y}", flush = True)
| t = int(input())
for x in range(1, T + 1):
n = int(input())
names = [input() for index in range(N)]
y = 0
previous = names[0]
for name in names[1:]:
if name < previous:
y += 1
else:
previous = name
print(f'Case #{x}: {y}', flush=True) |
#Pizza
#Burger
#Fries - > Peri Peri mala
# > normal
order ="" #initialization
print("-----Crunch n Munch-------")
while order!="exit" :
order = input("Enter your order - ")
if order == "pizza" or order == "burger" :
print ("Your order is "+order+" Preparation in progress...")
... | order = ''
print('-----Crunch n Munch-------')
while order != 'exit':
order = input('Enter your order - ')
if order == 'pizza' or order == 'burger':
print('Your order is ' + order + ' Preparation in progress...')
continue
if order == 'fries':
with_periperi = input('fries with Peri P... |
# Spec: https://docs.python.org/2/library/types.html
print(None)
# TypeType
# print(True) # LOAD_NAME???
print(1)
# print(1L) # Long
print(1.1)
# ComplexType
print("abc")
# print(u"abc")
# Structural below
print((1, 2)) # Tuple can be any length, but fixed after declared
x = (1,2)
print(x[0]) # Tuple can be any length,... | print(None)
print(1)
print(1.1)
print('abc')
print((1, 2))
x = (1, 2)
print(x[0])
print([1, 2, 3])
print(int(1))
print(int(1.2))
print(float(1))
print(float(1.2))
assert type(1 - 2) is int
assert type(2 / 3) is float
x = 1
assert type(x) is int
assert type(x - 1) is int
a = bytes([1, 2, 3])
print(a)
b = bytes([1, 2, 3]... |
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for i in range(n):
xy = v[i] - c[i]
if xy > 0:
ans += xy
print(ans)
| n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for i in range(n):
xy = v[i] - c[i]
if xy > 0:
ans += xy
print(ans) |
# Hello World
# My first python git repo
if __name__ == "__main__":
print("Hello World") | if __name__ == '__main__':
print('Hello World') |
def bingo(array):
ctr = 0
for i in [2, 9, 14, 7, 15]:
if i in list(set(array)):
ctr += 1
if ctr == 5:
return "WIN"
else:
return "LOSE" | def bingo(array):
ctr = 0
for i in [2, 9, 14, 7, 15]:
if i in list(set(array)):
ctr += 1
if ctr == 5:
return 'WIN'
else:
return 'LOSE' |
#
# PySNMP MIB module CISCO-PSM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-PSM-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:39:07 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')
(constraints_intersection, value_range_constraint, value_size_constraint, constraints_union, single_value_constraint) ... |
# Given a year, determine whether it is a leap year. If it is a leap year,
# return the Boolean True, otherwise return False.
# Note that the code stub provided reads from STDIN and
# passes arguments to the is_leap function. It is only necessary to complete the is_leap function.
def is_leap(year):
leap = False
... | def is_leap(year):
leap = False
if year % 4 == 0:
leap = True
if year % 100 == 0:
leap = False
if year % 400 == 0:
leap = True
return leap |
def media(n1=int(input("introduce la nota ")),n2=int(input("introduce la nota ")),
n3=int(input("introduce la nota ")),n4=int(input("introduce la nota "))):
notaMedia=(n1+n2+n3+n4)/4
if notaMedia>15:
return print("Alumno con talento")
elif notaMedia>=12 and notaMedia<=15:
return print("C... | def media(n1=int(input('introduce la nota ')), n2=int(input('introduce la nota ')), n3=int(input('introduce la nota ')), n4=int(input('introduce la nota '))):
nota_media = (n1 + n2 + n3 + n4) / 4
if notaMedia > 15:
return print('Alumno con talento')
elif notaMedia >= 12 and notaMedia <= 15:
... |
check = 'Coderbunker whatever'
bool(check.find('Coderbunker'))
print(bool(check))
if check == 'Coderbunker whatever':
print('what')
| check = 'Coderbunker whatever'
bool(check.find('Coderbunker'))
print(bool(check))
if check == 'Coderbunker whatever':
print('what') |
add_pointer_input = {
"type": "object",
"additionalProperties": False,
"properties": {"pointer": {"type": "string"}, "weight": {"type": "integer"}, "key": {"type": "string"}},
"required": ["pointer", "weight"],
}
remove_pointer_input = {
"type": "object",
"additionalProperties": False,
"prop... | add_pointer_input = {'type': 'object', 'additionalProperties': False, 'properties': {'pointer': {'type': 'string'}, 'weight': {'type': 'integer'}, 'key': {'type': 'string'}}, 'required': ['pointer', 'weight']}
remove_pointer_input = {'type': 'object', 'additionalProperties': False, 'properties': {'pointer': {'type': 's... |
# Finding peak element 1D of array of int
def findPeakRec(arr,low,high,n):
mid = low + (low + high) / 2
mid = int(mid)
if ((mid == 0 or arr[mid - 1] <= arr[mid]) and
(mid == n - 1 or arr[mid + 1] <= arr[mid])):
return arr[mid]
elif arr[mid] < arr[mid-1]:
#find left
retur... | def find_peak_rec(arr, low, high, n):
mid = low + (low + high) / 2
mid = int(mid)
if (mid == 0 or arr[mid - 1] <= arr[mid]) and (mid == n - 1 or arr[mid + 1] <= arr[mid]):
return arr[mid]
elif arr[mid] < arr[mid - 1]:
return find_peak_rec(arr, low, mid - 1, n)
else:
return fi... |
def Length(L):
C = 0
for _ in L:
C+=1
return C
N = int(input('\nEnter number of elements in list to be entered: '))
L = []
for i in range(0,N):
L.append(input('Enter an element: '))
print('\nLength of list:',Length(L)) | def length(L):
c = 0
for _ in L:
c += 1
return C
n = int(input('\nEnter number of elements in list to be entered: '))
l = []
for i in range(0, N):
L.append(input('Enter an element: '))
print('\nLength of list:', length(L)) |
def f():
print("this is the f() function")
return 0
def fib(n):
if n < 2:
return n
return fib(n-1) + fib(n-2)
def fib_not_recursive(n):
x = 0
y = 1
if n == 0:
return x
elif n == 1:
return y
while n-2 >= 0:
x,y = y,x+y
n -= 1
return y
if __name__ == '__main__':
fib_generated_by_recurse = [fib(i)... | def f():
print('this is the f() function')
return 0
def fib(n):
if n < 2:
return n
return fib(n - 1) + fib(n - 2)
def fib_not_recursive(n):
x = 0
y = 1
if n == 0:
return x
elif n == 1:
return y
while n - 2 >= 0:
(x, y) = (y, x + y)
n -= 1
... |
class Node:
def __init__(self, val, left=None, right=None):
self.val = val
self.left = left
self.right = right
class BTreeData:
def __init__(self, n: Node, isTarget: bool):
self.n = n
self.isTarget = isTarget
class Solution:
def findSecondLargest(self, root: Node) -> Node:
return self._helper(root).n
... | class Node:
def __init__(self, val, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Btreedata:
def __init__(self, n: Node, isTarget: bool):
self.n = n
self.isTarget = isTarget
class Solution:
def find_second_largest(self, root: No... |
__all__ = ['ImgFormat']
class ImgFormat():
JPEG = 'jpeg'
PNG = 'png'
| __all__ = ['ImgFormat']
class Imgformat:
jpeg = 'jpeg'
png = 'png' |
#!usr/bin/env python3
# Use standard library functions to search strings for content
sample_str = "The quick brown fox jumps over the lazy dog"
# startsWith and endsWith functions
print(sample_str.startswith("The"))
print(sample_str.startswith("the"))
print(sample_str.endswith("dog"))
# the find function starts sea... | sample_str = 'The quick brown fox jumps over the lazy dog'
print(sample_str.startswith('The'))
print(sample_str.startswith('the'))
print(sample_str.endswith('dog'))
print(sample_str.find('the'))
print(sample_str.rfind('the'))
print('the' in sample_str)
new_str = sample_str.replace('lazy', 'tired')
print(new_str)
print(... |
self.description = "Install a package with an existing file matching a negated --overwrite pattern"
p = pmpkg("dummy")
p.files = ["foobar"]
self.addpkg(p)
self.filesystem = ["foobar*"]
self.args = "-U --overwrite=foobar --overwrite=!foo* %s" % p.filename()
self.addrule("!PACMAN_RETCODE=0")
self.addrule("!PKG_EXIST=... | self.description = 'Install a package with an existing file matching a negated --overwrite pattern'
p = pmpkg('dummy')
p.files = ['foobar']
self.addpkg(p)
self.filesystem = ['foobar*']
self.args = '-U --overwrite=foobar --overwrite=!foo* %s' % p.filename()
self.addrule('!PACMAN_RETCODE=0')
self.addrule('!PKG_EXIST=dumm... |
config_DMLPDTP2_linear = {
"lr": 0.0000001,
"target_stepsize": 0.0403226567555006,
"feedback_wd": 9.821494271391093e-05,
"lr_fb": 0.0022485520139920064,
"sigma": 0.06086642605203958,
"out_dir": "logs/STRegression/DMLPDTP2_linear",
"network_type": "DMLPDTP2",
"recurrent_input": False,
... | config_dmlpdtp2_linear = {'lr': 1e-07, 'target_stepsize': 0.0403226567555006, 'feedback_wd': 9.821494271391093e-05, 'lr_fb': 0.0022485520139920064, 'sigma': 0.06086642605203958, 'out_dir': 'logs/STRegression/DMLPDTP2_linear', 'network_type': 'DMLPDTP2', 'recurrent_input': False, 'hidden_fb_activation': 'linear', 'size_... |
'''
#list1 = ["Jiggu","JJ","gg","GG"]
tuple = ("Jiggu","JJ","gg","GG")
#for item in list1:
#print(item)
for item in tuple:
print(item)
'''
| """
#list1 = ["Jiggu","JJ","gg","GG"]
tuple = ("Jiggu","JJ","gg","GG")
#for item in list1:
#print(item)
for item in tuple:
print(item)
""" |
# program for check two strings are anagram or not
# https://www.geeksforgeeks.org/check-whether-two-strings-are-anagram-of-each-other/
# time complexity is O(n) and space is O(1)
def isAnagram(str1, str2):
if(len(str1) != len(str2)):
return False
count = 0
# sum up all the chars ascii va... | def is_anagram(str1, str2):
if len(str1) != len(str2):
return False
count = 0
for i in str1:
count += ord(i)
for i in str2:
count -= ord(i)
return count == 0
def is_anagram(str1, str2):
if len(str1) != len(str2):
return False
str1 = sorted(str1)
str2 = so... |
''' Provides one variable __version__.
Caution: All code in here will be executed by setup.py. '''
__version__ = '0.2.2'
| """ Provides one variable __version__.
Caution: All code in here will be executed by setup.py. """
__version__ = '0.2.2' |
class Pipe(object):
def __init__(self, function):
self.function = function
def __ror__(self, other):
return self.function(other)
def __call__(self, *args, **kwargs):
return Pipe(lambda x: self.function(x, *args, **kwargs)) | class Pipe(object):
def __init__(self, function):
self.function = function
def __ror__(self, other):
return self.function(other)
def __call__(self, *args, **kwargs):
return pipe(lambda x: self.function(x, *args, **kwargs)) |
def cprint(c):
r, i = c.real, c.imag
if r != 0:
if i > 0:
print('{:.2f} + {:.2f}i'.format(r, i))
elif i < 0:
print('{:.2f} - {:.2f}i'.format(r, abs(i)))
else:
print('{:.2f}'.format(r))
else:
if i != 0:
print('{:.2f}i'.format(i))... | def cprint(c):
(r, i) = (c.real, c.imag)
if r != 0:
if i > 0:
print('{:.2f} + {:.2f}i'.format(r, i))
elif i < 0:
print('{:.2f} - {:.2f}i'.format(r, abs(i)))
else:
print('{:.2f}'.format(r))
elif i != 0:
print('{:.2f}i'.format(i))
else:
... |
ei = 3
suu1 = int(ei)
suu2 = int(ei*ei)
suu3 = int(ei*ei*ei)
print(suu1 + suu2 + suu3)
| ei = 3
suu1 = int(ei)
suu2 = int(ei * ei)
suu3 = int(ei * ei * ei)
print(suu1 + suu2 + suu3) |
# Write your frequency_dictionary function here:
def frequency_dictionary(words):
freqs = {}
for word in words:
if word not in freqs:
freqs[word] = 0
freqs[word] += 1
return freqs
# Uncomment these function calls to test your function:
print(frequency_dictionary(["apple", "apple", "cat", 1]))
# sho... | def frequency_dictionary(words):
freqs = {}
for word in words:
if word not in freqs:
freqs[word] = 0
freqs[word] += 1
return freqs
print(frequency_dictionary(['apple', 'apple', 'cat', 1]))
print(frequency_dictionary([0, 0, 0, 0, 0])) |
a = {}
a["ad ad asd"] = 4
b = 4
if (b is a["ad ad asd"]):
print("jaka")
else:
print ("luka")
print (str([[0, 0, 0], [0, 0, 0], [0, 0, 0]])) | a = {}
a['ad ad asd'] = 4
b = 4
if b is a['ad ad asd']:
print('jaka')
else:
print('luka')
print(str([[0, 0, 0], [0, 0, 0], [0, 0, 0]])) |
def calc_percentage_at_k(test, pred, k):
# sort scores, ascending
pred, test = zip(*sorted(zip(pred, test)))
pred, test = list(pred), list(test)
pred.reverse()
test.reverse()
# calculates number of values to consider
n_percentage = round(len(pred) * k / 100)
# check if predicted is ... | def calc_percentage_at_k(test, pred, k):
(pred, test) = zip(*sorted(zip(pred, test)))
(pred, test) = (list(pred), list(test))
pred.reverse()
test.reverse()
n_percentage = round(len(pred) * k / 100)
(tp, fp) = (0, 0)
for i in range(n_percentage):
if test[i] == 1:
tp += 1
... |
print("Enter elements:")
arr=list(map(int,input().split()))
for i in range(1, len(arr)):
val=arr[i]
j=i-1
while j>=0 and val<arr[j]:
arr[j+1]=arr[j]
j-=1
arr[j+1]=val
print(arr)
| print('Enter elements:')
arr = list(map(int, input().split()))
for i in range(1, len(arr)):
val = arr[i]
j = i - 1
while j >= 0 and val < arr[j]:
arr[j + 1] = arr[j]
j -= 1
arr[j + 1] = val
print(arr) |
class Solution:
def maximumScore(self, nums: List[int], multipliers: List[int]) -> int:
n, m = len(nums), len(multipliers)
dp = [[0] * (m + 1) for _ in range(m + 1)]
for i in range(m - 1, -1, -1):
for left in range(i, -1, -1):
mult = multipliers[i]
... | class Solution:
def maximum_score(self, nums: List[int], multipliers: List[int]) -> int:
(n, m) = (len(nums), len(multipliers))
dp = [[0] * (m + 1) for _ in range(m + 1)]
for i in range(m - 1, -1, -1):
for left in range(i, -1, -1):
mult = multipliers[i]
... |
HOST = 'localhost'
PORT = 27017
# -- HTTP-SESSION Settings --
HTTP_SESSION_TOKEN_TIMEOUT = 0
HTTP_SESSION_TOKEN_SIZE = 24
# -- Existing Commands --
COMMANDS_UNKNOWN = ['login', 'me', 'asset', 'user', 'plugin']
COMMANDS_USER = ['login', 'user', 'me', 'asset', 'logout', 'plugin', 'document', 'following', 'followers', 'fo... | host = 'localhost'
port = 27017
http_session_token_timeout = 0
http_session_token_size = 24
commands_unknown = ['login', 'me', 'asset', 'user', 'plugin']
commands_user = ['login', 'user', 'me', 'asset', 'logout', 'plugin', 'document', 'following', 'followers', 'follow']
commands_admin = [''].append(COMMANDS_USER)
mace_... |
# Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param p, a tree node
# @param q, a tree node
# @return a boolean
def isSameTree(self, p, q):
if p ... | class Solution:
def is_same_tree(self, p, q):
if p == None or q == None:
return p == q
return p.val == q.val and self.isSameTree(p.left, q.left) and self.isSameTree(p.right, q.right) |
sentence = "What is the Airspeed Velocity of an Unladen Swallow?".split()
count = {word:len(word) for word in sentence}
print(count)
| sentence = 'What is the Airspeed Velocity of an Unladen Swallow?'.split()
count = {word: len(word) for word in sentence}
print(count) |
skaitli = [1, 5, 3, 9, 7, 11, 4]
skaitli2 = [5, 8, 12, 77, 44, 13]
print(skaitli)
print(skaitli[4])
sajauts_saraksts = ["Maris", 1, 2, 3, "Liepa", ["burkani", 12]]
print(sajauts_saraksts)
skaitli_kopa = skaitli + skaitli2
skaitli_kopa.sort()
print(skaitli_kopa) | skaitli = [1, 5, 3, 9, 7, 11, 4]
skaitli2 = [5, 8, 12, 77, 44, 13]
print(skaitli)
print(skaitli[4])
sajauts_saraksts = ['Maris', 1, 2, 3, 'Liepa', ['burkani', 12]]
print(sajauts_saraksts)
skaitli_kopa = skaitli + skaitli2
skaitli_kopa.sort()
print(skaitli_kopa) |
TIME_FORMAT = "%Y-%m-%d, %H:%M:%S"
FILE_TRAIN_DATA_STATS = "train_data_stats.txt"
FILE_EVAL_DATA_STATS = "eval_data_stats.txt"
FILE_PREV_EVAL_DATA_STATS = "prev_eval_data_stats.txt"
FILE_DATA_SCHEMA = "schema.txt"
FILE_EVAL_RESULT = "eval_result.txt"
VALIDATION_SUCCESS = "success"
VALIDATION_FAIL = "fail"
| time_format = '%Y-%m-%d, %H:%M:%S'
file_train_data_stats = 'train_data_stats.txt'
file_eval_data_stats = 'eval_data_stats.txt'
file_prev_eval_data_stats = 'prev_eval_data_stats.txt'
file_data_schema = 'schema.txt'
file_eval_result = 'eval_result.txt'
validation_success = 'success'
validation_fail = 'fail' |
class Color(object):
def __init__(self, r : float, g : float, b : float):
self.r = r
self.g = g
self.b = b
def tuple(self):
return (self.r, self.g, self.b)
class Gray(Color):
# intensity bet
def __init__(self, intensity : float):
self.r = self.g = self.b = intensity
self.intensity = int... | class Color(object):
def __init__(self, r: float, g: float, b: float):
self.r = r
self.g = g
self.b = b
def tuple(self):
return (self.r, self.g, self.b)
class Gray(Color):
def __init__(self, intensity: float):
self.r = self.g = self.b = intensity
self.inte... |
#
# PySNMP MIB module MPLS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MPLS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:04:41 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:1... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint, constraints_union) ... |
def RC(value, tolerance=5.0, power=None, package="0603",pkgcode="07"):
res = {"manufacturer": "Yageo"}
suffix = ['R', 'K', 'M']
digits = 3 if tolerance < 5 else 2
while value >= 1000:
value = value/1000.
suffix.pop(0)
suffix = suffix[0]
whole = str(int(value))
decimal = str(... | def rc(value, tolerance=5.0, power=None, package='0603', pkgcode='07'):
res = {'manufacturer': 'Yageo'}
suffix = ['R', 'K', 'M']
digits = 3 if tolerance < 5 else 2
while value >= 1000:
value = value / 1000.0
suffix.pop(0)
suffix = suffix[0]
whole = str(int(value))
decimal = s... |
class Animal(object):
def run(self):
print('Animal is running...')
def eat(self):
print('Animal is eating...')
class Dog(Animal):
def run(self):
print('Dog is running...')
class Cat(Animal):
def __init__(self):
self.name = 'Tom'
def __str__(self):
ret... | class Animal(object):
def run(self):
print('Animal is running...')
def eat(self):
print('Animal is eating...')
class Dog(Animal):
def run(self):
print('Dog is running...')
class Cat(Animal):
def __init__(self):
self.name = 'Tom'
def __str__(self):
retur... |
x = [15 ,12, 8, 8, 7, 7, 7, 6, 5, 3]
y = [10 ,25, 17, 11, 13, 17, 20, 13, 9, 15]
n = len(x)
xy = [x[i] * y[i] for i in range(n)]
x_square = [x[i] * x[i] for i in range(n)]
avg_x = sum(x) / n
avg_y = sum(y) / n
avg_xy = sum(xy) / n
avg_xsqr = sum(x_square) / n
m = ((avg_x * avg_y) - avg_xy) / (avg_x ** 2 - avg_xsqr)
c =... | x = [15, 12, 8, 8, 7, 7, 7, 6, 5, 3]
y = [10, 25, 17, 11, 13, 17, 20, 13, 9, 15]
n = len(x)
xy = [x[i] * y[i] for i in range(n)]
x_square = [x[i] * x[i] for i in range(n)]
avg_x = sum(x) / n
avg_y = sum(y) / n
avg_xy = sum(xy) / n
avg_xsqr = sum(x_square) / n
m = (avg_x * avg_y - avg_xy) / (avg_x ** 2 - avg_xsqr)
c = a... |
filename_prefix = 'Rebuttal-SawyerLift-ADR'
xlabel = 'Environment steps (3M)'
ylabel = "Average Discounted Rewards"
mopa_cutoff_step = 1000000
others_cutoff_step = 2000000
max_step = 3000000
max_y_axis_value = 110
legend = False
data_key = "train_ep/rew_discounted"
bc_y_value = 34.77
plot_labels = {
"Ours": [
... | filename_prefix = 'Rebuttal-SawyerLift-ADR'
xlabel = 'Environment steps (3M)'
ylabel = 'Average Discounted Rewards'
mopa_cutoff_step = 1000000
others_cutoff_step = 2000000
max_step = 3000000
max_y_axis_value = 110
legend = False
data_key = 'train_ep/rew_discounted'
bc_y_value = 34.77
plot_labels = {'Ours': ['Rebuttal_O... |
def say_hello():
print('Hello')
def say_goodbye():
print('Goodbye') | def say_hello():
print('Hello')
def say_goodbye():
print('Goodbye') |
_base_ = "./ss_v1_dibr_mlBCE_FreezeBN_woCenter_refinePM10_ape.py"
OUTPUT_DIR = "output/self6dpp/ssLM/ss_v1_dibr_mlBCE_FreezeBN_woCenter_refinePM10/glue"
DATASETS = dict(
TRAIN=("lm_real_glue_train",), TRAIN2=("lm_pbr_glue_train",), TRAIN2_RATIO=0.0, TEST=("lm_real_glue_test",)
)
MODEL = dict(
WEIGHTS="output/gd... | _base_ = './ss_v1_dibr_mlBCE_FreezeBN_woCenter_refinePM10_ape.py'
output_dir = 'output/self6dpp/ssLM/ss_v1_dibr_mlBCE_FreezeBN_woCenter_refinePM10/glue'
datasets = dict(TRAIN=('lm_real_glue_train',), TRAIN2=('lm_pbr_glue_train',), TRAIN2_RATIO=0.0, TEST=('lm_real_glue_test',))
model = dict(WEIGHTS='output/gdrn/lm_pbr/r... |
class DefaultConfigurations:
@staticmethod
def get():
return {}
| class Defaultconfigurations:
@staticmethod
def get():
return {} |
freeze('../../../../../../Micropython-Library-Development/lib/', 'uasyncio/asyn.py')
freeze('../../../../../../Micropython-Library-Development/lib/', 'uasyncio/core.py')
freeze('../../../../../../Micropython-Library-Development/lib/', 'uasyncio/__init__.py')
freeze('../../../../../../Micropython-Library-Development/lib... | freeze('../../../../../../Micropython-Library-Development/lib/', 'uasyncio/asyn.py')
freeze('../../../../../../Micropython-Library-Development/lib/', 'uasyncio/core.py')
freeze('../../../../../../Micropython-Library-Development/lib/', 'uasyncio/__init__.py')
freeze('../../../../../../Micropython-Library-Development/lib... |
name = "Bob"
greeting = "Hello, Bob"
print(greeting)
name = "Rolf"
print(greeting)
greeting = f"Hello, {name}"
print(greeting)
# --
name = "Anne"
print(
greeting
) # This still prints "Hello, Rolf" because `greeting` was calculated earlier.
print(
f"Hello, {name}"
) # This is correct, since it uses `nam... | name = 'Bob'
greeting = 'Hello, Bob'
print(greeting)
name = 'Rolf'
print(greeting)
greeting = f'Hello, {name}'
print(greeting)
name = 'Anne'
print(greeting)
print(f'Hello, {name}')
greeting = 'Hello, {}'
with_name = greeting.format('Rolf')
print(with_name)
longer_phrase = 'Hello, {}. Today is {}.'
formatted = longer_ph... |
class Player:
def __init__(self, player_id: int, nickname: str, websocket, is_vip: bool = False):
self.player_id = player_id
self.nickname = nickname
self.is_vip = is_vip
self.websocket = websocket
def __repr__(self):
return 'Player({}, {})'.format(self.player_id, self.n... | class Player:
def __init__(self, player_id: int, nickname: str, websocket, is_vip: bool=False):
self.player_id = player_id
self.nickname = nickname
self.is_vip = is_vip
self.websocket = websocket
def __repr__(self):
return 'Player({}, {})'.format(self.player_id, self.ni... |
Word = "Hello"
Letters = []
for w in Word:
print(w)
if w == "e":
print("Funny")
Letters.append(w)
print(Letters)
Numbers = [1,2,3,4,5]
for l in Numbers:
print(l)
Numbers1 = []
# for num in range(10):
for num in range(-1, 13, 3):
Numbers.append(num)
prin... | word = 'Hello'
letters = []
for w in Word:
print(w)
if w == 'e':
print('Funny')
Letters.append(w)
print(Letters)
numbers = [1, 2, 3, 4, 5]
for l in Numbers:
print(l)
numbers1 = []
for num in range(-1, 13, 3):
Numbers.append(num)
print(num)
counter = 1
while counter <= 10:
print(count... |
def ROTRIGHT(i: int, bits: int) -> int:
return i >> bits | i << 32 - bits
# Two Extreme Bits (8 bits)
def TEB(i: int) -> int:
return ((i & 0x80) >> 6) | (i & 1)
# Two Extreme Bits Reversed (8 bits)
def TEBR(i: int) -> int:
return (i & 0xFF) >> 7 | (i & 1) << 1
# Middles Extreme Bits (32 bits)
def MEB(... | def rotright(i: int, bits: int) -> int:
return i >> bits | i << 32 - bits
def teb(i: int) -> int:
return (i & 128) >> 6 | i & 1
def tebr(i: int) -> int:
return (i & 255) >> 7 | (i & 1) << 1
def meb(i: int) -> int:
return teb(i >> 24) << 6 | teb(i >> 16) << 4 | teb(i >> 8) << 2 | teb(i)
lookup_reverse... |
game = [[0, 0, 0, ' '], [0, 0, 0, ' '], [0, 0, 0, ' '], [0, 0, 0, ' '], [0, 0, 0, ' ']]
frame_counter = 0
# Ask score for frames
for frame in game:
if frame_counter < 4:
shot_number = 0
for shot in range(2):
game[frame_counter][shot_number] = int(input(f'Score for frame {frame_counter ... | game = [[0, 0, 0, ' '], [0, 0, 0, ' '], [0, 0, 0, ' '], [0, 0, 0, ' '], [0, 0, 0, ' ']]
frame_counter = 0
for frame in game:
if frame_counter < 4:
shot_number = 0
for shot in range(2):
game[frame_counter][shot_number] = int(input(f'Score for frame {frame_counter + 1}, shot {shot_number +... |
# Prime Numbers, Sieve of Eratosthenes
def prime_list(min_num, max_num):
sieve = [True] * (max_num + 1) # Sieve of Eratosthenes
m = int(max_num ** 0.5) # sqrt(n)
for i in range(2, m + 1):
if sieve[i] == True:
for j in range(i+i, max_num+1, i):
sieve[j] = False
siev... | def prime_list(min_num, max_num):
sieve = [True] * (max_num + 1)
m = int(max_num ** 0.5)
for i in range(2, m + 1):
if sieve[i] == True:
for j in range(i + i, max_num + 1, i):
sieve[j] = False
sieve[1] = False
return [i for i in range(min_num, max_num + 1) if sieve... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.