content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
LOCAL_STATE_PATH = "/state"
DEFAULT_INSTANCE_TYPE_TRAINING = "ml.m5.large"
DEFAULT_INSTANCE_TYPE_PROCESSING = "ml.t3.medium"
DEFAULT_INSTANCE_COUNT = 1
DEFAULT_VOLUME_SIZE = 30 # GB
DEFAULT_USE_SPOT = True
DEFAULT_MAX_RUN = 24 * 60
DEFAULT_MAX_WAIT = 0
DEFAULT_IAM_ROLE = "SageMakerIAMRole"
DEFAULT_IAM_BUCKET_POLICY_... | local_state_path = '/state'
default_instance_type_training = 'ml.m5.large'
default_instance_type_processing = 'ml.t3.medium'
default_instance_count = 1
default_volume_size = 30
default_use_spot = True
default_max_run = 24 * 60
default_max_wait = 0
default_iam_role = 'SageMakerIAMRole'
default_iam_bucket_policy_suffix =... |
def avg(values):
return sum(values) / len(values)
def input_to_list(count):
lines = []
for _ in range(count):
lines.append(input())
return lines
n = int(input())
students_grades_lines = input_to_list(n)
students_grades = {}
for line in students_grades_lines:
student, grade = line.spl... | def avg(values):
return sum(values) / len(values)
def input_to_list(count):
lines = []
for _ in range(count):
lines.append(input())
return lines
n = int(input())
students_grades_lines = input_to_list(n)
students_grades = {}
for line in students_grades_lines:
(student, grade) = line.split(' ... |
class Solution:
def numRescueBoats(self, people: List[int], limit: int) -> int:
weight = dict()
for x in people:
if x in weight:
weight[x] += 1
else:
weight[x] = 1
ans = 0
for x in people:
if weight[x] > 0:
... | class Solution:
def num_rescue_boats(self, people: List[int], limit: int) -> int:
weight = dict()
for x in people:
if x in weight:
weight[x] += 1
else:
weight[x] = 1
ans = 0
for x in people:
if weight[x] > 0:
... |
n=int(input())
l=[]
k=[]
e=[]
for i in range (n):
t=input()
l.append(t)
print(l)
for j in l:
if j not in k:
k.append(j)
print(k)
print(len(k))
for m in range(len(k)):
c=0
for d in l:
if( k[m]==d):
c=c+1
e.append(c)
print(e)
for i in e:
... | n = int(input())
l = []
k = []
e = []
for i in range(n):
t = input()
l.append(t)
print(l)
for j in l:
if j not in k:
k.append(j)
print(k)
print(len(k))
for m in range(len(k)):
c = 0
for d in l:
if k[m] == d:
c = c + 1
e.append(c)
print(e)
for i in e:
print(i, end=... |
class Shop:
_small_shop_capacity = 10
def __init__(self, name, shop_type, capacity):
self.name = name
self.type = shop_type
self.capacity = capacity
self.items_count = 0
self.items = {}
@classmethod
def small_shop(cls, name, shop_type):
return cls(name, ... | class Shop:
_small_shop_capacity = 10
def __init__(self, name, shop_type, capacity):
self.name = name
self.type = shop_type
self.capacity = capacity
self.items_count = 0
self.items = {}
@classmethod
def small_shop(cls, name, shop_type):
return cls(name, ... |
for row in range(5,0):
for col in range(1,row+1):
print(col,end=" ")
print()
| for row in range(5, 0):
for col in range(1, row + 1):
print(col, end=' ')
print() |
IDENTIFIED_COMMANDS = {
'NS STATUS %s': ['STATUS {username} (\d)', '3'],
'PRIVMSG NickServ ACC %s': ['{username} ACC (\d)', '3'],
}
IRC_AUTHS = {
# 'localhost': {'username': 'Botname', 'realname': 'Bot Real Name'},
}
IRC_GROUPCHATS = [
# 'groupchat@localhost',
]
IRC_PERMISSIONS = {
# 'nekmo@loca... | identified_commands = {'NS STATUS %s': ['STATUS {username} (\\d)', '3'], 'PRIVMSG NickServ ACC %s': ['{username} ACC (\\d)', '3']}
irc_auths = {}
irc_groupchats = []
irc_permissions = {} |
class Solution:
def decompressRLElist(self, nums: List[int]) -> List[int]:
result = []
for i in range(0, len(nums), 2):
freq, val = nums[i:i+2]
for n in range(freq):
result.append(val)
return result
| class Solution:
def decompress_rl_elist(self, nums: List[int]) -> List[int]:
result = []
for i in range(0, len(nums), 2):
(freq, val) = nums[i:i + 2]
for n in range(freq):
result.append(val)
return result |
filename = "myFile1.py"
with open(filename, "r") as f:
for line in f:
print(f)
| filename = 'myFile1.py'
with open(filename, 'r') as f:
for line in f:
print(f) |
m = 35.0 / 8.0
n = int(35/8)
print(m)
print(n)
| m = 35.0 / 8.0
n = int(35 / 8)
print(m)
print(n) |
class Dealer:
def __init__(self):
self.__hand = None
def select_action(self):
if self.hand_total() < 17:
return 1
else:
return 0
def give_card(self, card):
self.__hand.add_card(card)
def revealed_card(self):
cards = self.__hand.cards()
return cards[0]
def is_busted(... | class Dealer:
def __init__(self):
self.__hand = None
def select_action(self):
if self.hand_total() < 17:
return 1
else:
return 0
def give_card(self, card):
self.__hand.add_card(card)
def revealed_card(self):
cards = self.__hand.cards()
... |
# https://cses.fi/problemset/task/1083
d = [False for _ in range(int(input()))]
for i in input().split(' '):
d[int(i) - 1] = True
for i, b in enumerate(d):
if not b:
print(i + 1)
exit()
| d = [False for _ in range(int(input()))]
for i in input().split(' '):
d[int(i) - 1] = True
for (i, b) in enumerate(d):
if not b:
print(i + 1)
exit() |
{
"targets": [
{
"target_name": "lib/daemon",
"sources": [ "src/daemon.cc" ]
}
]
} | {'targets': [{'target_name': 'lib/daemon', 'sources': ['src/daemon.cc']}]} |
def main():
st = input("")
print(st[0])
print(end="")
main()
| def main():
st = input('')
print(st[0])
print(end='')
main() |
# This program demonstrates how to use the remove
# method to remove an item from a list.
def main():
# Create a list with some items.
food = ['Pizza', 'Burgers', 'Chips']
# Display the list.
print('Here are the items in the food list:')
print(food)
# Get the item to change.
i... | def main():
food = ['Pizza', 'Burgers', 'Chips']
print('Here are the items in the food list:')
print(food)
item = input('Which item should I remove? ')
try:
food.remove(item)
print('Here is the revised list:')
print(food)
except ValueError:
print('That item was no... |
def computepay(h, r):
print("In computepay")
if h>40:
pay = 40 * r + (h - 40) * 1.5 * r
else:
pay = h * r
return pay
hrs = input("Enter Hours:")
h = float(hrs)
rate = input("Enter Rate:")
r = float(rate)
pay = computepay(h,r)
print(pay)
| def computepay(h, r):
print('In computepay')
if h > 40:
pay = 40 * r + (h - 40) * 1.5 * r
else:
pay = h * r
return pay
hrs = input('Enter Hours:')
h = float(hrs)
rate = input('Enter Rate:')
r = float(rate)
pay = computepay(h, r)
print(pay) |
'''
MIT License
Name cs225sp20_env Python Package
URL https://github.com/Xiwei-Wang/cs225sp20_env
Version 1.0
Creation Date 26 April 2020
Copyright(c) 2020 Instructors, TAs and Some Students of UIUC CS 225 SP20 ZJUI Course
Instructorts: Prof. Dr. Klaus-Dieter Schewe
TAs: Tingou Liang, Run Zhang, Enyi Jiang, Xiang Li... | """
MIT License
Name cs225sp20_env Python Package
URL https://github.com/Xiwei-Wang/cs225sp20_env
Version 1.0
Creation Date 26 April 2020
Copyright(c) 2020 Instructors, TAs and Some Students of UIUC CS 225 SP20 ZJUI Course
Instructorts: Prof. Dr. Klaus-Dieter Schewe
TAs: Tingou Liang, Run Zhang, Enyi Jiang, Xiang Li... |
def merge(list0,list1):
result = []
while len(list1) and len(list0):
if list0[0]<list1[0]:
result.append(list0.pop(0))
else:
result.append(list1.pop(0))
result.extend(list0)
result.extend(list1)
return result
def mergesort(item):
if len(item)<=1:
... | def merge(list0, list1):
result = []
while len(list1) and len(list0):
if list0[0] < list1[0]:
result.append(list0.pop(0))
else:
result.append(list1.pop(0))
result.extend(list0)
result.extend(list1)
return result
def mergesort(item):
if len(item) <= 1:
... |
# Link - https://leetcode.com/problems/unique-morse-code-words/
'''
Runtime: 28 ms, faster than 95.58% of Python3 online submissions for Unique Morse Code Words.
Memory Usage: 13.6 MB, less than 99.77% of Python3 online submissions for Unique Morse Code Words.
'''
class Solution:
def uniqueMorseRepresentations(se... | """
Runtime: 28 ms, faster than 95.58% of Python3 online submissions for Unique Morse Code Words.
Memory Usage: 13.6 MB, less than 99.77% of Python3 online submissions for Unique Morse Code Words.
"""
class Solution:
def unique_morse_representations(self, words: List[str]) -> int:
morse = ['.-', '-...', '... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# services - Waqas Bhatti (wbhatti@astro.princeton.edu) - Oct 2017
# License: MIT. See the LICENSE file for more details.
'''This contains various modules to query online data services. These are not
exhaustive and are meant to support other astrobase modules.
- :py:mod:`... | """This contains various modules to query online data services. These are not
exhaustive and are meant to support other astrobase modules.
- :py:mod:`astrobase.services.dust`: interface to the 2MASS DUST
extinction/emission service.
- :py:mod:`astrobase.services.gaia`: interface to the GAIA TAP+ ADQL query
servic... |
vacation_cost = float(input())
available_money = float(input())
spending_counter = 0
days_passed = 0
saved = True
while available_money < vacation_cost:
#spend or save
action_type = input()
current_sum = float(input())
days_passed += 1
if action_type == 'spend':
spending_counter += 1
... | vacation_cost = float(input())
available_money = float(input())
spending_counter = 0
days_passed = 0
saved = True
while available_money < vacation_cost:
action_type = input()
current_sum = float(input())
days_passed += 1
if action_type == 'spend':
spending_counter += 1
available_money -=... |
NOT_FOUND = -1
class Search(object):
def __init__(self, sample):
self.sample = sample | not_found = -1
class Search(object):
def __init__(self, sample):
self.sample = sample |
__all__ = 'MissingContextVariable',
class MissingContextVariable(KeyError):
pass
| __all__ = ('MissingContextVariable',)
class Missingcontextvariable(KeyError):
pass |
# with-Statement
def setup():
size(400, 400)
background(255)
def draw():
fill(color(255, 153, 0))
ellipse(100, 100, 50, 50)
with pushStyle():
fill(color(255, 51, 51))
strokeWeight(5)
ellipse(200, 200, 50, 50)
ellipse(300, 300, 50, 50)
| def setup():
size(400, 400)
background(255)
def draw():
fill(color(255, 153, 0))
ellipse(100, 100, 50, 50)
with push_style():
fill(color(255, 51, 51))
stroke_weight(5)
ellipse(200, 200, 50, 50)
ellipse(300, 300, 50, 50) |
# Develop a program that calculates the sum between all the odd numbers
# that are multiples of three and are in the range of 1 to 500.
sum = 0
for i in range(1,501):
if (i % 2 != 0 ) and (i % 3 == 0):
sum += i
print(sum) | sum = 0
for i in range(1, 501):
if i % 2 != 0 and i % 3 == 0:
sum += i
print(sum) |
# https://www.codewars.com/kata/526571aae218b8ee490006f4/
'''
Instructions :
Write a function that takes an integer as input, and returns the number of bits that are equal to one in the binary representation of that number. You can guarantee that input is non-negative.
Example: The binary representation of 1234 is ... | """
Instructions :
Write a function that takes an integer as input, and returns the number of bits that are equal to one in the binary representation of that number. You can guarantee that input is non-negative.
Example: The binary representation of 1234 is 10011010010, so the function should return 5 in this case
... |
# this is a part of binary search tree class.
# The right, left and parent functions can be found in the binary search tree implementation.
def TreeSearch(T,p,k):
if k == p.key():
return p # successful search
elif k < p.key() and T.left(p) is not None:
return Tree... | def tree_search(T, p, k):
if k == p.key():
return p
elif k < p.key() and T.left(p) is not None:
return tree_search(T, T.left(p), k)
elif k > p.key() and T.right(p) is not None:
return tree_search(T, T.right(p), k)
return p |
def isNode(data):
if type(data) == Node:
return True
else:
return False
class Node:
def __init__(self, data=None) -> None:
self.data = data
self.previous = None
self.next = None
def __str__(self) -> str:
if self.previous == None and self.next == None:
... | def is_node(data):
if type(data) == Node:
return True
else:
return False
class Node:
def __init__(self, data=None) -> None:
self.data = data
self.previous = None
self.next = None
def __str__(self) -> str:
if self.previous == None and self.next == None:
... |
# weight = [3, 5, 7]
# n = len(weight)
# a = 6
#
# for i in range(n):
# print(weight)
# if weight[i] < a:
# weight.remove(weight[i])
#
# print(weight)
# arr8 = [4, 3, 4, 4, 4, 2]
#
# print('start')
# for i in range(len(arr8) - 1):
# print(arr8[:i+1], arr8[i+1:], " - ", i)
def solution(arr):
s... | def solution(arr):
size = 0
value = 0
for i in range(len(arr)):
if size == 0:
value = arr[i]
size += 1
elif value != arr[i] and size != 0:
size -= 1
else:
size += 1
leader = value
if arr.count(leader) <= len(arr) // 2:
r... |
def sort(elements):
while True:
swapped = False
for i in range(len(elements)-1):
if elements[i] > elements[i+1]:
# swap
temp = elements[i]
elements[i] = elements[i+1]
elements[i+1] = temp
swapped = True
... | def sort(elements):
while True:
swapped = False
for i in range(len(elements) - 1):
if elements[i] > elements[i + 1]:
temp = elements[i]
elements[i] = elements[i + 1]
elements[i + 1] = temp
swapped = True
if not swapp... |
PORT = 8000
URL = "http://localhost:{}".format(PORT)
SITE_LOCATION = 'test_site/index.html'
csv_log_single_site_init = [(False, False, True), (False, False, False)]
# TODO: Add logs and csv tests
# (True, False, True), (False, False, True), (True, True, True)]
variations = [{
'element': 'id',
'element_id':... | port = 8000
url = 'http://localhost:{}'.format(PORT)
site_location = 'test_site/index.html'
csv_log_single_site_init = [(False, False, True), (False, False, False)]
variations = [{'element': 'id', 'element_id': 'header', 'expected_amount': 1}, {'element': 'id', 'element_id': 'headerLeft', 'expected_amount': 1}, {'eleme... |
#
# PySNMP MIB module ELTEX-MES-HWENVIROMENT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELTEX-MES-HWENVIROMENT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:01:22 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version ... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, single_value_constraint, value_range_constraint, constraints_union) ... |
class Solution:
def levelOrder(self, root: 'Node') -> List[List[int]]:
if root==None:
return []
list_trans=[]
queue=[root]
while queue:
child=[]
nodes=[]
for node in queue:
child.append(node.val)
... | class Solution:
def level_order(self, root: 'Node') -> List[List[int]]:
if root == None:
return []
list_trans = []
queue = [root]
while queue:
child = []
nodes = []
for node in queue:
child.append(node.val)
... |
MAP_SIZE = 24
TILE_SIZE = 16
ENTITY_ID = 1
ARROW_SPEED = 9999
ENTITYMAP = {}
PLAYER_ENTITIES = []
TILEMAP = {}
GAMEINFO = {} # playerid, gameinstance
# REMOVE = [] | map_size = 24
tile_size = 16
entity_id = 1
arrow_speed = 9999
entitymap = {}
player_entities = []
tilemap = {}
gameinfo = {} |
obstacleSet = set([(10, 2, 4, 5), (3, 4), (4, 4), (5, 4)])
print((2, 4) in obstacleSet)
print(obstacleSet)
print(set([(1, 2), (3, 4)]))
| obstacle_set = set([(10, 2, 4, 5), (3, 4), (4, 4), (5, 4)])
print((2, 4) in obstacleSet)
print(obstacleSet)
print(set([(1, 2), (3, 4)])) |
def quickSort(array, head, tail):
# an implementation of quicksort algorithm
if head >= tail:
return
else:
pivot = partition(array, head, tail)
quickSort(array, head, pivot)
quickSort(array, pivot+1, tail)
def partition(array, h... | def quick_sort(array, head, tail):
if head >= tail:
return
else:
pivot = partition(array, head, tail)
quick_sort(array, head, pivot)
quick_sort(array, pivot + 1, tail)
def partition(array, head, tail):
pivot = array[head]
i = head + 1
for j in range(head + 1, tail):
... |
passports = []
x=0
vCount=0
keys = {"byr",
"iyr",
"eyr",
"hgt",
"hcl",
"ecl",
"pid"}
with open("Day4\\test2.txt", "r") as data:
passports = [i.replace('\n', ' ').split()
for i in data.read().split('\n\n')]
for i in passports:
print(i)
... | passports = []
x = 0
v_count = 0
keys = {'byr', 'iyr', 'eyr', 'hgt', 'hcl', 'ecl', 'pid'}
with open('Day4\\test2.txt', 'r') as data:
passports = [i.replace('\n', ' ').split() for i in data.read().split('\n\n')]
for i in passports:
print(i)
print(i[0:1])
print(keys) |
'''
Vanir OS exception hierarchy
'''
class VanirException(Exception):
'''Exception that can be shown to the user'''
class VanirVMNotFoundError(VanirException, KeyError):
'''Domain cannot be found in the system'''
def __init__(self, vmname):
super(VanirVMNotFoundError, self).__init__(
... | """
Vanir OS exception hierarchy
"""
class Vanirexception(Exception):
"""Exception that can be shown to the user"""
class Vanirvmnotfounderror(VanirException, KeyError):
"""Domain cannot be found in the system"""
def __init__(self, vmname):
super(VanirVMNotFoundError, self).__init__('No such doma... |
def entrada():
n,l = map(int,input().split())
return n,l
def perimetro(n,lado):
return n*lado
def main():
n,l=entrada()
print(perimetro(n,l))
main()
| def entrada():
(n, l) = map(int, input().split())
return (n, l)
def perimetro(n, lado):
return n * lado
def main():
(n, l) = entrada()
print(perimetro(n, l))
main() |
#
# PySNMP MIB module DES-1228p-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DES-1228P-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:23:55 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, single_value_constraint, value_range_constraint, constraints_union, value_size_constraint) ... |
BOT_PREFIX = '[bot] '
BOT_SUFFIX = '\n'
class BotReply:
def send_reply(self, dest, tg_socket):
raise NotImplementedError
| bot_prefix = '[bot] '
bot_suffix = '\n'
class Botreply:
def send_reply(self, dest, tg_socket):
raise NotImplementedError |
products = [
{
'id': 1,
'name': 'Apple',
'price': 200,
'quantity': 20
},
{
'id': 2,
'name': 'Milk',
'price': 20,
'quantity': 100
},
{
'id': 3,
'name': 'Rice',
'price': 500,
'quantity': 20
},
{
'id': 4,
'name': 'Pepsi',
... | products = [{'id': 1, 'name': 'Apple', 'price': 200, 'quantity': 20}, {'id': 2, 'name': 'Milk', 'price': 20, 'quantity': 100}, {'id': 3, 'name': 'Rice', 'price': 500, 'quantity': 20}, {'id': 4, 'name': 'Pepsi', 'price': 55, 'quantity': 20}]
print('-----------------------------------------------')
print('\t\tSuper Marke... |
class Node(object):
def __init__(self, data=None, next_node=None):
self.data = data
self.next = next_node
| class Node(object):
def __init__(self, data=None, next_node=None):
self.data = data
self.next = next_node |
def load(file = "data.txt"):
data = []
for line in open(file):
data.append(line)
return data
| def load(file='data.txt'):
data = []
for line in open(file):
data.append(line)
return data |
# 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:
if root is None:
return 0
diameter = 0
def ge... | class Solution:
def diameter_of_binary_tree(self, root: TreeNode) -> int:
if root is None:
return 0
diameter = 0
def get_tree_height(node):
nonlocal diameter
if node.left is None and node.right is None:
return 0
left_height = ... |
def prefix_prefix(w, m):
def naive_scan(i, j):
r = 0
while i + r <= m and j + r <= m and w[i + r] == w[j + r]:
r += 1
return r
PREF, s = [-1] * 2 + [0] * (m - 1), 1
for i in range(2, m + 1):
# niezmiennik: s jest takie, ze s + PREF[s] - 1 jest maksymalne i PREF[s] > 0
k = i - s + 1
s... | def prefix_prefix(w, m):
def naive_scan(i, j):
r = 0
while i + r <= m and j + r <= m and (w[i + r] == w[j + r]):
r += 1
return r
(pref, s) = ([-1] * 2 + [0] * (m - 1), 1)
for i in range(2, m + 1):
k = i - s + 1
s_max = s + PREF[s] - 1
if s_max < i... |
class lz78(object):
@staticmethod
def name():
return 'LZ78'
@staticmethod
def compress(data, *args, **kwargs):
'''LZ78 compression
'''
d, word = {0: ''}, 0
dyn_d = (
lambda d, key: d.get(key) or d.__setitem__(key, len(d)) or 0
)
ret... | class Lz78(object):
@staticmethod
def name():
return 'LZ78'
@staticmethod
def compress(data, *args, **kwargs):
"""LZ78 compression
"""
(d, word) = ({0: ''}, 0)
dyn_d = lambda d, key: d.get(key) or d.__setitem__(key, len(d)) or 0
return [token for char in... |
longname = {'S': 'Susceptible',
'E': 'Exposed',
'I': 'Infected (symptomatic)',
'A': 'Asymptomatically Infected',
'R': 'Recovered',
'H': 'Hospitalised',
'C': 'Critical',
'D': 'Deaths',
'O': 'Offsite',
'Q'... | longname = {'S': 'Susceptible', 'E': 'Exposed', 'I': 'Infected (symptomatic)', 'A': 'Asymptomatically Infected', 'R': 'Recovered', 'H': 'Hospitalised', 'C': 'Critical', 'D': 'Deaths', 'O': 'Offsite', 'Q': 'Quarantined', 'U': 'No ICU Care', 'CS': 'Change in Susceptible', 'CE': 'Change in Exposed', 'CI': 'Change in Infec... |
l = [0]*101
for i in range(1, 10):
for j in range(1, 10):
l[i*j] = 1
n = int(input())
if l[n] == 1:
print("Yes")
else:
print("No")
| l = [0] * 101
for i in range(1, 10):
for j in range(1, 10):
l[i * j] = 1
n = int(input())
if l[n] == 1:
print('Yes')
else:
print('No') |
class RomanNumerals:
def to_roman(val):
result = ''
symbols = ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I']
nums = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
nums_len = len(nums)
i = 0
while i < nums_len:
if nums[i]... | class Romannumerals:
def to_roman(val):
result = ''
symbols = ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I']
nums = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
nums_len = len(nums)
i = 0
while i < nums_len:
if nums[i] <... |
'''
Write an algorithm Sums-One-Two-Three(n) that takes an integer n and, in
time O(n), returns the number of possible ways to write n as a sum of 1, 2, and 3. For
example, Sums-One-Two-Three(4) must return 7 because there are 7 ways to write 4 as a
sum of ones, twos, and threes (1+1+1+1, 1+1+2, 1+2+1, 2+1+1, 2+2, 1+3,... | """
Write an algorithm Sums-One-Two-Three(n) that takes an integer n and, in
time O(n), returns the number of possible ways to write n as a sum of 1, 2, and 3. For
example, Sums-One-Two-Three(4) must return 7 because there are 7 ways to write 4 as a
sum of ones, twos, and threes (1+1+1+1, 1+1+2, 1+2+1, 2+1+1, 2+2, 1+3,... |
# Write your solution for 1.3 here!
a=0
i=1
while a < 10000:
a+=i
i+=1
print(i)
#####
a=0
i=2
while a<10000:
a+=i
i+=2
print(i) | a = 0
i = 1
while a < 10000:
a += i
i += 1
print(i)
a = 0
i = 2
while a < 10000:
a += i
i += 2
print(i) |
class account:
def check_password_length(self, password):
if len(password) > 8:
return True
else:
return False
if __name__ == '__main__':
accVerify = account()
print('The password length is ' + str(accVerify.check_password_length('offtoschool')))
| class Account:
def check_password_length(self, password):
if len(password) > 8:
return True
else:
return False
if __name__ == '__main__':
acc_verify = account()
print('The password length is ' + str(accVerify.check_password_length('offtoschool'))) |
class Node:
def __init__(self, init_data, pointer = None):
self.data = init_data
self.pointer = pointer
def get_data(self):
return self.data
def get_next(self):
return self.pointer
def set_data(self, data):
self.data = data
... | class Node:
def __init__(self, init_data, pointer=None):
self.data = init_data
self.pointer = pointer
def get_data(self):
return self.data
def get_next(self):
return self.pointer
def set_data(self, data):
self.data = data
def set_next(self, data):
... |
def tennis_set(s1, s2):
n1 = min(s1, s2)
n2 = max(s1, s2)
if n2 == 6:
return n1 < 5
return n2 == 7 and n1 >= 5 and n1 < n2
| def tennis_set(s1, s2):
n1 = min(s1, s2)
n2 = max(s1, s2)
if n2 == 6:
return n1 < 5
return n2 == 7 and n1 >= 5 and (n1 < n2) |
class people:
def __init__(self):
self.nick_name = ""
self.qq_number = ""
self.topic_name = ""
def display(self):
print("------------------------topic_name = %s------------------------" % self.topic_name)
print("nick_name = ", self.nick_name)
print("%-13s%s" % ("... | class People:
def __init__(self):
self.nick_name = ''
self.qq_number = ''
self.topic_name = ''
def display(self):
print('------------------------topic_name = %s------------------------' % self.topic_name)
print('nick_name = ', self.nick_name)
print('%-13s%s' % (... |
def get_object_or_none(model, *args, **kwargs):
try:
return model._default_manager.get(*args, **kwargs)
except model.DoesNotExist:
return None
def get_object_or_this(model, this, *args, **kwargs):
return get_object_or_none(model, *args, **kwargs) or this
| def get_object_or_none(model, *args, **kwargs):
try:
return model._default_manager.get(*args, **kwargs)
except model.DoesNotExist:
return None
def get_object_or_this(model, this, *args, **kwargs):
return get_object_or_none(model, *args, **kwargs) or this |
class Solution:
def merge(self, nums1, m, nums2, n):
i=m-1
j=n-1
tmp=m+n-1
while i>=0 and j>=0:
if nums1[i]<nums2[j]:
nums1[tmp]=nums2[j]
tmp-=1
j-=1
else:
nums1[tmp]=nums1[i]
tmp-... | class Solution:
def merge(self, nums1, m, nums2, n):
i = m - 1
j = n - 1
tmp = m + n - 1
while i >= 0 and j >= 0:
if nums1[i] < nums2[j]:
nums1[tmp] = nums2[j]
tmp -= 1
j -= 1
else:
nums1[tmp] = ... |
# -*- coding: utf-8 -*-
# {name: (aka, width, height, aspect ratio)}
HIGH_DEFINITION_MAP = {
"NHD": ("nHD", 640, 360, (16, 9)),
"QHD": ("qHD", 960, 540, (16, 9)),
"HD": ("HD", 1280, 720, (16, 9)),
"HD PLUS": ("HD+", 1600, 900, (16, 9)),
"FHD": ("FHD", 1920, 1080, (16, 9)),
"WQHD": ("WQHD", 2560... | high_definition_map = {'NHD': ('nHD', 640, 360, (16, 9)), 'QHD': ('qHD', 960, 540, (16, 9)), 'HD': ('HD', 1280, 720, (16, 9)), 'HD PLUS': ('HD+', 1600, 900, (16, 9)), 'FHD': ('FHD', 1920, 1080, (16, 9)), 'WQHD': ('WQHD', 2560, 1440, (16, 9)), 'QHD PLUS': ('QHD+', 3200, 1800, (16, 9)), 'UHD 4K': ('4K UHD', 3840, 2160, (... |
def remove_background(frame):
fgbg = cv2.createBackgroundSubtractorMOG2(history=20)
fgmask = fgbg.apply(frame)
kernel = np.ones((3, 3), np.uint8)
fgmask = cv2.erode(fgmask, kernel, iterations=1)
res = cv2.bitwise_and(frame, frame, mask=fgmask)
return res
# gamma transfer
def gamma_trans(img,gam... | def remove_background(frame):
fgbg = cv2.createBackgroundSubtractorMOG2(history=20)
fgmask = fgbg.apply(frame)
kernel = np.ones((3, 3), np.uint8)
fgmask = cv2.erode(fgmask, kernel, iterations=1)
res = cv2.bitwise_and(frame, frame, mask=fgmask)
return res
def gamma_trans(img, gamma):
gamma_t... |
#as a list:
l=[3,4]
l+=[5,6]
print(l)
#as a stack:
#top input
#lifo
l.append(10)
print(l)
l.pop()#pops the ele that is inserted at last
#as a queue
#fifo
l.insert(0,5)
l.pop()
| l = [3, 4]
l += [5, 6]
print(l)
l.append(10)
print(l)
l.pop()
l.insert(0, 5)
l.pop() |
#--------------------------------------------#
# My Solution #
#--------------------------------------------#
def checkio(words: str):
count = 0
for word in words.split():
if word.isalpha():
count += 1
else:
count = 0
if count == 3:
return True
return False
#-----------------------------... | def checkio(words: str):
count = 0
for word in words.split():
if word.isalpha():
count += 1
else:
count = 0
if count == 3:
return True
return False
a = checkio('Hello World hello')
b = checkio('He is 123 man')
c = checkio('1 2 3 4')
d = checkio('bl... |
class Player:
def __init__(self, type_):
self.hp = 200
self.type = type_
def combat_simulation(f):
map = []
players = []
for line in f.readlines():
row = []
for c in line.strip():
if c == '#':
row.append(False)
elif c == '.':
... | class Player:
def __init__(self, type_):
self.hp = 200
self.type = type_
def combat_simulation(f):
map = []
players = []
for line in f.readlines():
row = []
for c in line.strip():
if c == '#':
row.append(False)
elif c == '.':
... |
# created by RomaOkorosso at 21.03.2021
# config.py
db_url = "postgres://USER:PASSWORD@IP:PORT/DATABASE_NAME"
| db_url = 'postgres://USER:PASSWORD@IP:PORT/DATABASE_NAME' |
def tree_transplant(self, u, v):
if(u.pai == None):
self.raiz = v
elif(u.pai.left == u):
u.pai.left = v
else:
u.pai.right = v
if(v != None):
v.pai = u.pai | def tree_transplant(self, u, v):
if u.pai == None:
self.raiz = v
elif u.pai.left == u:
u.pai.left = v
else:
u.pai.right = v
if v != None:
v.pai = u.pai |
def longestWord(sentence):
wordArray = sentence.split(" ")
longest = ""
for word in wordArray:
if(len(word) >= len(longest)):
longest = word
return longest
print(longestWord("Hello World")) | def longest_word(sentence):
word_array = sentence.split(' ')
longest = ''
for word in wordArray:
if len(word) >= len(longest):
longest = word
return longest
print(longest_word('Hello World')) |
c = str(input())
if c[0] == c[1] == c[2]:
print("Won")
else:
print("Lost") | c = str(input())
if c[0] == c[1] == c[2]:
print('Won')
else:
print('Lost') |
class Node:
def __init__(self,data=None):
self.data=data
self.next=None
class LinkedList:
def __init__(self):
self.head=None
def showlist(self):
while self.head is not None:
print(self.head.data)
self.head=self.head.next
list=LinkedList()
list.head... | class Node:
def __init__(self, data=None):
self.data = data
self.next = None
class Linkedlist:
def __init__(self):
self.head = None
def showlist(self):
while self.head is not None:
print(self.head.data)
self.head = self.head.next
list = linked_list... |
### Left and Right product lists ###
class Solution1:
def productExceptSelf(self, nums: List[int]) -> List[int]:
l = 1
r = 1
length = len(nums)
ans = [1]*length
for i in range( 0, length ):
ans[i] *=l
ans[length -i-1] *= r
l *= num... | class Solution1:
def product_except_self(self, nums: List[int]) -> List[int]:
l = 1
r = 1
length = len(nums)
ans = [1] * length
for i in range(0, length):
ans[i] *= l
ans[length - i - 1] *= r
l *= nums[i]
r *= nums[length - i -... |
print("welcome to calculator \n")
a=int(input("enter first value"))
b=int(input("enter seconde value"))
print("which operation you want two perform \n add sub mul div")
c=input()
if c=="add":
d=a+b
print(d)
if c=="sub":
d=a-b
print(d)
if c=="mul":
d=a*b
print(d)
if c=="div":
d=a/b
print(... | print('welcome to calculator \n')
a = int(input('enter first value'))
b = int(input('enter seconde value'))
print('which operation you want two perform \n add sub mul div')
c = input()
if c == 'add':
d = a + b
print(d)
if c == 'sub':
d = a - b
print(d)
if c == 'mul':
d = a * b
print(d)
if c == '... |
#!/usr/bin/env python3
print('hello world')
print('hello', 'world')
## use "sep" parameter to change output
print('hello', 'world', sep = '_')
| print('hello world')
print('hello', 'world')
print('hello', 'world', sep='_') |
people=30
cars=40
trucks=15
if cars>people:
print("We should take the cars")
elif cars<people:
print("We should not take the cars")
else:
print("We can't decide")
if trucks>cars:
print("That's too many trucks")
elif trucks<cars:
print("Maybe we could take the trucks")
else:
print("We still can't... | people = 30
cars = 40
trucks = 15
if cars > people:
print('We should take the cars')
elif cars < people:
print('We should not take the cars')
else:
print("We can't decide")
if trucks > cars:
print("That's too many trucks")
elif trucks < cars:
print('Maybe we could take the trucks')
else:
print("... |
def armsinside():
i01.rightArm.rotate.attach()
i01.rightArm.rotate.moveTo(0)
sleep(7)
i01.rightArm.rotate.detach()
| def armsinside():
i01.rightArm.rotate.attach()
i01.rightArm.rotate.moveTo(0)
sleep(7)
i01.rightArm.rotate.detach() |
Byte = {
'LF': '\x0A',
'NULL': '\x00'
}
class Frame:
def __init__(self, command, headers, body):
self.command = command
self.headers = headers
self.body = '' if body is None else body
def __str__(self):
lines = [self.command]
skipContentLength = 'content-lengt... | byte = {'LF': '\n', 'NULL': '\x00'}
class Frame:
def __init__(self, command, headers, body):
self.command = command
self.headers = headers
self.body = '' if body is None else body
def __str__(self):
lines = [self.command]
skip_content_length = 'content-length' in self.... |
fin = open('input_24.txt')
def getdir(text):
while text:
direction = text[:2]
if direction in ['nw','ne','sw','se']:
text = text[2:]
yield direction
else:
text = text[1:]
yield direction[0]
ftiles = set() # (row,column)
# row, column
moves ... | fin = open('input_24.txt')
def getdir(text):
while text:
direction = text[:2]
if direction in ['nw', 'ne', 'sw', 'se']:
text = text[2:]
yield direction
else:
text = text[1:]
yield direction[0]
ftiles = set()
moves = {'nw': (-1, -1), 'w': (0, -... |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: quantra
class FlowType(object):
Interest = 0
PastInterest = 1
Notional = 2
| class Flowtype(object):
interest = 0
past_interest = 1
notional = 2 |
#!/usr/bin/env python3
list1 = ['cisco-nxos', 'arista_eos', 'cisco-ios']
print(list1)
print(list1[1])
list1.extend(['juniper'])
print(list1)
list1.append(['10.1.0.1','10.2.0.1','10.3.0.1'])
print(list1)
print("4th element in list1 is ".format(list1[4]))
print(list1[4][0])
| list1 = ['cisco-nxos', 'arista_eos', 'cisco-ios']
print(list1)
print(list1[1])
list1.extend(['juniper'])
print(list1)
list1.append(['10.1.0.1', '10.2.0.1', '10.3.0.1'])
print(list1)
print('4th element in list1 is '.format(list1[4]))
print(list1[4][0]) |
if __name__ == '__main__':
print("TESTOUTPUT")
| if __name__ == '__main__':
print('TESTOUTPUT') |
def insert_user_list():
keys = ['_id', 'name', 'is_zero_user', 'gender', 'location', 'business',
'education', 'motto', 'answer_num', 'collection_num',
'followed_column_num', 'followed_topic_num', 'followee_num',
'follower_num', 'post_num', 'question_num', 'thank_num',
... | def insert_user_list():
keys = ['_id', 'name', 'is_zero_user', 'gender', 'location', 'business', 'education', 'motto', 'answer_num', 'collection_num', 'followed_column_num', 'followed_topic_num', 'followee_num', 'follower_num', 'post_num', 'question_num', 'thank_num', 'upvote_num', 'photo_url', 'weibo_url']
out... |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: DeepSeaSceneLighting
class LightUnion(object):
NONE = 0
DirectionalLight = 1
PointLight = 2
SpotLight = 3
| class Lightunion(object):
none = 0
directional_light = 1
point_light = 2
spot_light = 3 |
def ciagCyfr(x):
lista = []
for i in range(x):
if i%2 == 0:
i = i+1
lista.append(i)
else:
i = (i+1)*(-1)
lista.append(i)
print(lista)
| def ciag_cyfr(x):
lista = []
for i in range(x):
if i % 2 == 0:
i = i + 1
lista.append(i)
else:
i = (i + 1) * -1
lista.append(i)
print(lista) |
def bubbleSort(l, n):
for i in range(n):
for j in range(n-1-i):
if l[j][0] > l[j+1][0]:
l[j], l[j+1] = l[j+1], l[j]
return l[:]
def selectionSort(l, n):
for i in range(n):
minj = i
for j in range(i+1, n):
if l[j][0] < l[minj][0]:
... | def bubble_sort(l, n):
for i in range(n):
for j in range(n - 1 - i):
if l[j][0] > l[j + 1][0]:
(l[j], l[j + 1]) = (l[j + 1], l[j])
return l[:]
def selection_sort(l, n):
for i in range(n):
minj = i
for j in range(i + 1, n):
if l[j][0] < l[minj]... |
# Version of the migration tool
VERSION = "0.6"
LOG_DIR="/var/log"
LOG_FILE_PATH="%s/filerobot-migrate.log" % LOG_DIR
UPLOADED_UUIDS_PATH="%s/filerobot-migrate-uploaded-uuids.log" % LOG_DIR
LOG_FAILED_PATH="%s/filerobot-migrate-failed" % LOG_DIR
LOG_RETRY_FAILED_PATH="%s/filerobot-migrate-retry-failed.log" % LOG_DIR
D... | version = '0.6'
log_dir = '/var/log'
log_file_path = '%s/filerobot-migrate.log' % LOG_DIR
uploaded_uuids_path = '%s/filerobot-migrate-uploaded-uuids.log' % LOG_DIR
log_failed_path = '%s/filerobot-migrate-failed' % LOG_DIR
log_retry_failed_path = '%s/filerobot-migrate-retry-failed.log' % LOG_DIR
default_input_file = 'in... |
md_icons = {
'md-3d-rotation':
u"\uf000",
'md-accessibility':
u"\uf001",
'md-account-balance':
u"\uf002",
'md-account-balance-wallet':
u"\uf003",
'md-account-box':
u"\uf004",
'md-account-child':
u"\uf005",
'md-account-circle':
u"\uf006",
'md-add-shopping-cart':
u"\uf007",
'md-alarm':
... | md_icons = {'md-3d-rotation': u'\uf000', 'md-accessibility': u'\uf001', 'md-account-balance': u'\uf002', 'md-account-balance-wallet': u'\uf003', 'md-account-box': u'\uf004', 'md-account-child': u'\uf005', 'md-account-circle': u'\uf006', 'md-add-shopping-cart': u'\uf007', 'md-alarm': u'\uf008', 'md-alarm-add': u'\uf009'... |
#
# PySNMP MIB module XYPLEX-IPX-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XYPLEX-IPX-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:40:03 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, single_value_constraint, constraints_union, constraints_intersection) ... |
'''
'''
def load(config):
data = []
with open(config['SimLex-999']['Dataset_File'], 'r') as stream:
# skip headers
stream.readline()
# load data
for line in stream:
(w1, w2, _, score, _) = [s.strip() for s in line.split('\t', 4)]
data.append((w1, w2, floa... | """
"""
def load(config):
data = []
with open(config['SimLex-999']['Dataset_File'], 'r') as stream:
stream.readline()
for line in stream:
(w1, w2, _, score, _) = [s.strip() for s in line.split('\t', 4)]
data.append((w1, w2, float(score)))
return data |
def poly_sum(xs, ys):
# return the list representing the sum of the polynomials represented by the
# lists xs and ys
zs = []
l = min(len(xs), len(ys))
for i in range(0, l):
zs.append(xs[i] + ys[i])
if len(xs) > len(ys):
for i in range(l, len(xs)):
zs.append(xs[i])
... | def poly_sum(xs, ys):
zs = []
l = min(len(xs), len(ys))
for i in range(0, l):
zs.append(xs[i] + ys[i])
if len(xs) > len(ys):
for i in range(l, len(xs)):
zs.append(xs[i])
else:
for i in range(l, len(ys)):
zs.append(ys[i])
return zs
def test(test_ca... |
class Stack:
def __init__(self, data=[]):
self.data = data
def __repr__(self) -> str:
return f"{self.data}"
def peek(self):
if self.data:
return self.data[-1]
else:
return None
def pop(self):
return self.data.pop()
def push(self, d)... | class Stack:
def __init__(self, data=[]):
self.data = data
def __repr__(self) -> str:
return f'{self.data}'
def peek(self):
if self.data:
return self.data[-1]
else:
return None
def pop(self):
return self.data.pop()
def push(self, d... |
_asmm_version = '1.3.2'
_xml_version = '1.0b'
_py_version = '3.5.1'
_eclipse_version = '4.6.3'
_qt_version = '5.9'
_report_version = '3.4.0'
| _asmm_version = '1.3.2'
_xml_version = '1.0b'
_py_version = '3.5.1'
_eclipse_version = '4.6.3'
_qt_version = '5.9'
_report_version = '3.4.0' |
a = int(input("a :"))
b = int(input("b :"))
c = int(input("c :"))
delta = (b**2) - (4*a*c)
print(delta)
| a = int(input('a :'))
b = int(input('b :'))
c = int(input('c :'))
delta = b ** 2 - 4 * a * c
print(delta) |
class Solution:
# Count Consecutive Groups (Top Voted), O(n) time and space
def countBinarySubstrings(self, s: str) -> int:
s = list(map(len, s.replace('01', '0 1').replace('10', '1 0').split()))
return sum(min(a, b) for a, b in zip(s, s[1:]))
# Linear Scan (Solution), O(n) time, O(1) space... | class Solution:
def count_binary_substrings(self, s: str) -> int:
s = list(map(len, s.replace('01', '0 1').replace('10', '1 0').split()))
return sum((min(a, b) for (a, b) in zip(s, s[1:])))
def count_binary_substrings(self, s: str) -> int:
(ans, prev, cur) = (0, 0, 1)
for i in ... |
#
class FmeRenderer(object):
RENDER_MODE_CONSOLE = 1
RENDER_MODE_GRAPH = 2
def __init__(self, render_mode=RENDER_MODE_CONSOLE):
self.name = 'apps.fme.FmeRender'
self.render_mode = render_mode
def render_obs(self, obs):
pass | class Fmerenderer(object):
render_mode_console = 1
render_mode_graph = 2
def __init__(self, render_mode=RENDER_MODE_CONSOLE):
self.name = 'apps.fme.FmeRender'
self.render_mode = render_mode
def render_obs(self, obs):
pass |
# Set options for certfile, ip, password, and toggle off
c.NotebookApp.certfile = '/tmp/mycert.pem'
c.NotebookApp.keyfile = '/tmp/mykey.key'
# Set ip to '*' to bind on all interfaces (ips) for the public server
c.NotebookApp.ip = '*'
# It is a good idea to set a known, fixed port for server access
c.NotebookApp.port ... | c.NotebookApp.certfile = '/tmp/mycert.pem'
c.NotebookApp.keyfile = '/tmp/mykey.key'
c.NotebookApp.ip = '*'
c.NotebookApp.port = 8888
c.NotebookApp.open_browser = False |
class Solution:
def canJump(self, nums: List[int]) -> bool:
maxlen = 0
i = 0
while i <= maxlen and i < len(nums):
maxlen = max(maxlen, i + nums[i])
i += 1
if maxlen >= len(nums) - 1:
return True
return False | class Solution:
def can_jump(self, nums: List[int]) -> bool:
maxlen = 0
i = 0
while i <= maxlen and i < len(nums):
maxlen = max(maxlen, i + nums[i])
i += 1
if maxlen >= len(nums) - 1:
return True
return False |
class MomentumGradientDescent(GradientDescent):
def __init__(self, params, lr=0.1, momentum=.9):
super(MomentumGradientDescent, self).__init__(params, lr)
self.momentum = momentum
self.velocities = [torch.zeros_like(param, requires_grad=False)
for param in params]... | class Momentumgradientdescent(GradientDescent):
def __init__(self, params, lr=0.1, momentum=0.9):
super(MomentumGradientDescent, self).__init__(params, lr)
self.momentum = momentum
self.velocities = [torch.zeros_like(param, requires_grad=False) for param in params]
def step(self):
... |
self.description = "Install a package with a missing dependency (nodeps)"
p = pmpkg("dummy")
p.files = ["bin/dummy",
"usr/man/man1/dummy.1"]
p.depends = ["dep1"]
self.addpkg(p)
self.args = "-Udd %s" % p.filename()
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_EXIST=dummy")
self.addrule("PKG_DEPENDS=d... | self.description = 'Install a package with a missing dependency (nodeps)'
p = pmpkg('dummy')
p.files = ['bin/dummy', 'usr/man/man1/dummy.1']
p.depends = ['dep1']
self.addpkg(p)
self.args = '-Udd %s' % p.filename()
self.addrule('PACMAN_RETCODE=0')
self.addrule('PKG_EXIST=dummy')
self.addrule('PKG_DEPENDS=dummy|dep1')
fo... |
# dictionary fundamentals
alien_0 = {'color': 'green', 'points': 5}
print(alien_0['color'])
print(alien_0['points'])
# assigning a dictionary value to a variable
new_points = alien_0['points']
print("You just earn " + str(new_points) + " points!")
# adding more values to a dictionary
# original dict
print(alien_0)... | alien_0 = {'color': 'green', 'points': 5}
print(alien_0['color'])
print(alien_0['points'])
new_points = alien_0['points']
print('You just earn ' + str(new_points) + ' points!')
print(alien_0)
alien_0['x_position'] = 0
alien_0['y_position'] = 25
print(alien_0)
alien_o = {}
alien_o['color'] = 'green'
alien_o['points'] = ... |
# Changes - 7/25/01 - RDS
# -Added 'label' item to Menu and MenuItem definitions.
# -StaticText.label => StaticText.text
#
{
'application':
{
'type':'Application',
'name':'SourceForgeTracker',
'menubar':
{
'type':'MenuBar',
'menus':
[
{'type'... | {'application': {'type': 'Application', 'name': 'SourceForgeTracker', 'menubar': {'type': 'MenuBar', 'menus': [{'type': 'Menu', 'name': 'menuFile', 'label': '&File', 'items': [{'type': 'MenuItem', 'name': 'menuFileExit', 'label': 'E&xit\tAlt+X', 'command': 'exit'}]}]}, 'backgrounds': [{'type': 'Background', 'name': 'bg... |
class NoFreeRobots(Exception):
pass
class UnavailableRobot(Exception):
pass
| class Nofreerobots(Exception):
pass
class Unavailablerobot(Exception):
pass |
expected_output = {
"slot": {
"1": {
"ip_version": {
"IPv4": {
"route_table": {
"default/base": {
"prefix": {
"1.1.1.1/32": {
"next_hop": {
... | expected_output = {'slot': {'1': {'ip_version': {'IPv4': {'route_table': {'default/base': {'prefix': {'1.1.1.1/32': {'next_hop': {'1.1.1.1': {'interface': 'loopback0', 'is_best': True}}}, '1.1.1.2/32': {'next_hop': {'1.1.1.2': {'interface': 'loopback1', 'is_best': False}}}, '2.2.2.2/32': {'next_hop': {'fe80::a111:2222:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.