content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
ACTION_GOAL = "goal"
ACTION_RED_CARD = "red-card"
ACTION_YELLOW_RED_CARD = "yellow-red-card"
actions = {ACTION_GOAL: "GOAL",
ACTION_RED_CARD: "RED CARD",
ACTION_YELLOW_RED_CARD: "RED CARD"}
class PlayerAction(object):
def __init__(self, player, action):
if not type(player) == dict... | action_goal = 'goal'
action_red_card = 'red-card'
action_yellow_red_card = 'yellow-red-card'
actions = {ACTION_GOAL: 'GOAL', ACTION_RED_CARD: 'RED CARD', ACTION_YELLOW_RED_CARD: 'RED CARD'}
class Playeraction(object):
def __init__(self, player, action):
if not type(player) == dict:
player = di... |
def main():
# Open file for output
outfile = open("Presidents.txt", "w")
# Write data to the file
outfile.write("Bill Clinton\n")
outfile.write("George Bush\n")
outfile.write("Barack Obama")
outfile.close() # Close the output file
main() # Call the main function
| def main():
outfile = open('Presidents.txt', 'w')
outfile.write('Bill Clinton\n')
outfile.write('George Bush\n')
outfile.write('Barack Obama')
outfile.close()
main() |
def fb_python_library(name, **kwargs):
native.python_library(
name = name,
**kwargs
)
| def fb_python_library(name, **kwargs):
native.python_library(name=name, **kwargs) |
#program to display your details like name, age, address in three different lines.
name = 'Chibuzor darlington'
age = '19yrs'
address = 'imsu junction'
print(f'Name:{name}')
print(f'Age:{age}')
print(f'Address:{address}')
def personal_details():
name, age = "Chibuzor Darlington", '19yrs'
address = "imsu junctio... | name = 'Chibuzor darlington'
age = '19yrs'
address = 'imsu junction'
print(f'Name:{name}')
print(f'Age:{age}')
print(f'Address:{address}')
def personal_details():
(name, age) = ('Chibuzor Darlington', '19yrs')
address = 'imsu junction'
print('Name: {}\nAge: {}\nAddress: {}'.format(name, age, address))
pers... |
cache = {}
def get_page(url):
if cache.get(url):
return cache[url]
else:
data = get_data_from_server(url)
cache[url] = data
return data
| cache = {}
def get_page(url):
if cache.get(url):
return cache[url]
else:
data = get_data_from_server(url)
cache[url] = data
return data |
##write a program that will print the song "99 bottles of beer on the wall".
##for extra credit, do not allow the program to print each loop on a new line.
bottles = 99
while bottles > 0:
if bottles == 1:
print(str(bottles) + " bottles of beer on the wall, " + str(bottles) + " bottle of beer.", end="... | bottles = 99
while bottles > 0:
if bottles == 1:
print(str(bottles) + ' bottles of beer on the wall, ' + str(bottles) + ' bottle of beer.', end=' ')
else:
print(str(bottles) + ' bottles of beer on the wall, ' + str(bottles) + ' bottles of beer.', end=' ')
bottles -= 1
if bottles == 1:
... |
class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
class Tree:
def __init__(self):
self.head = None
def bft(self):
if self.head == None:
return
print("Bredth First Traversal")
ptr = self.head
... | class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
class Tree:
def __init__(self):
self.head = None
def bft(self):
if self.head == None:
return
print('Bredth First Traversal')
ptr = self.head
... |
# Each frame has a name, and various associated roles. These roles have facet(s?) which take on values which are themselves sets of one or more frames.
class Frame:
# relations: a dictionary, key is role, value is other frames
def __init__(self, name, isstate=False, iscenter=False):
self.name = name
... | class Frame:
def __init__(self, name, isstate=False, iscenter=False):
self.name = name
self.isstate = isstate
self.iscenter = iscenter
self.roles = {}
class Role:
def __init__(self):
self.facetvalue = []
self.facetrelation = [] |
class Contact:
def __init__(self, firstname, middlename, address, mobile, email):
self.firstname = firstname
self.middlename = middlename
self.address = address
self.mobile = mobile
self.email = email | class Contact:
def __init__(self, firstname, middlename, address, mobile, email):
self.firstname = firstname
self.middlename = middlename
self.address = address
self.mobile = mobile
self.email = email |
# Copyright 2021 Edoardo Riggio
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | def minimal_contiguous_sum(A):
if len(A) < 1:
return None
dp = A[0]
m_sum = A[0]
for i in range(len(A) - 1):
dp = min(dp + A[i + 1], A[i + 1])
m_sum = min(dp, m_sum)
return m_sum
array = [-1, 2, -2, -4, 1, -2, 5, -2, -3, 1, 2, -1]
print(minimal_contiguous_sum(array)) |
class Path(object):
@staticmethod
def db_dir(database):
if database == 'ucf101':
# folder that contains class labels
# root_dir = '/data/dataset/ucf101/UCF-101/'
root_dir = '/data/dataset/ucf101/UCF-5/'
# Save preprocess data into output_dir
ou... | class Path(object):
@staticmethod
def db_dir(database):
if database == 'ucf101':
root_dir = '/data/dataset/ucf101/UCF-5/'
output_dir = '/data/dataset/VAR/UCF-5/'
bbox_output_dir = '/data/dataset/UCF-101-result/UCF-5-20/'
return (root_dir, output_dir, bbox... |
HEALTH_CHECKS_ERROR_CODE = 503
HEALTH_CHECKS = {
'db': 'django_healthchecks.contrib.check_database',
}
| health_checks_error_code = 503
health_checks = {'db': 'django_healthchecks.contrib.check_database'} |
DEFAULT_STEMMER = 'snowball'
DEFAULT_TOKENIZER = 'word'
DEFAULT_TAGGER = 'pos'
TRAINERS = ['news', 'editorial', 'reviews', 'religion',
'learned', 'science_fiction', 'romance', 'humor']
DEFAULT_TRAIN = 'news' | default_stemmer = 'snowball'
default_tokenizer = 'word'
default_tagger = 'pos'
trainers = ['news', 'editorial', 'reviews', 'religion', 'learned', 'science_fiction', 'romance', 'humor']
default_train = 'news' |
def check(kwds, name):
if kwds:
msg = ', '.join('"%s"' % s for s in sorted(kwds))
s = '' if len(kwds) == 1 else 's'
raise ValueError('Unknown attribute%s for %s: %s' % (s, name, msg))
def set_reserved(value, section, name=None, data=None, **kwds):
check(kwds, '%s %s' % (section, value.... | def check(kwds, name):
if kwds:
msg = ', '.join(('"%s"' % s for s in sorted(kwds)))
s = '' if len(kwds) == 1 else 's'
raise value_error('Unknown attribute%s for %s: %s' % (s, name, msg))
def set_reserved(value, section, name=None, data=None, **kwds):
check(kwds, '%s %s' % (section, valu... |
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | load('//tools/bzl:java.bzl', 'java_library2')
def gwt_module(gwt_xml=None, resources=[], srcs=[], **kwargs):
if gwt_xml:
resources += [gwt_xml]
java_library2(srcs=srcs, resources=resources, **kwargs) |
'''
changes to both lists
that means, they point to same object
once and then thrice
'''
'''
a = [1,2,3]
b = ([a]*3)
print(a)
print(b)
# same effect
# a[0]=11
b[0][0] = 9
print(a)
print(b)
#'''
'''
a = [1,2,3]
b = (a,)
print(a)
print(b)
#'''
| """
changes to both lists
that means, they point to same object
once and then thrice
"""
'\na = [1,2,3]\nb = ([a]*3)\nprint(a)\nprint(b)\n\n# same effect\n# a[0]=11\nb[0][0] = 9\nprint(a)\nprint(b)\n#'
'\na = [1,2,3]\nb = (a,)\nprint(a)\nprint(b) \n#' |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
class BotAssert(object):
@staticmethod
def activity_not_null(activity):
if not activity:
raise TypeError()
@staticmethod
def context_not_null(context):
if not context:
... | class Botassert(object):
@staticmethod
def activity_not_null(activity):
if not activity:
raise type_error()
@staticmethod
def context_not_null(context):
if not context:
raise type_error()
@staticmethod
def conversation_reference_not_null(reference):
... |
CHIP8_STANDARD_FONT = [
0xF0, 0x90, 0x90, 0x90, 0xF0,
0x20, 0x60, 0x20, 0x20, 0x70,
0xF0, 0x10, 0xF0, 0x80, 0xF0,
0xF0, 0x10, 0xF0, 0x10, 0xF0,
0x90, 0x90, 0xF0, 0x10, 0x10,
0xF0, 0x80, 0xF0, 0x10, 0xF0,
0xF0, 0x80, 0xF0, 0x90, 0xF0,
0xF0, 0x10, 0x20, 0x40, 0x40,
0xF0, 0x90, 0xF0, 0x... | chip8_standard_font = [240, 144, 144, 144, 240, 32, 96, 32, 32, 112, 240, 16, 240, 128, 240, 240, 16, 240, 16, 240, 144, 144, 240, 16, 16, 240, 128, 240, 16, 240, 240, 128, 240, 144, 240, 240, 16, 32, 64, 64, 240, 144, 240, 144, 240, 240, 144, 240, 16, 240, 240, 144, 240, 144, 144, 224, 144, 224, 144, 224, 240, 128, 12... |
with open('pi_digits.txt') as file_object:
contnts = file_object.read()
print(contnts.rstrip())
| with open('pi_digits.txt') as file_object:
contnts = file_object.read()
print(contnts.rstrip()) |
f=open('T.txt')
fw=open('foursquare.embedding.update.2SameAnchor.1.foldtrain.twodirectionContext.number.100_dim.10000000','w')
for i in f:
ii=i.split()
strt=ii[0]+'_foursquare'+' '
for iii in ii[1:]:
strt=strt+iii+'|'
fw.write(strt+'\n')
| f = open('T.txt')
fw = open('foursquare.embedding.update.2SameAnchor.1.foldtrain.twodirectionContext.number.100_dim.10000000', 'w')
for i in f:
ii = i.split()
strt = ii[0] + '_foursquare' + ' '
for iii in ii[1:]:
strt = strt + iii + '|'
fw.write(strt + '\n') |
a = int(input("Enter a number1: "))
b = int(input("Enter a number2: "))
temp = b
b = a
a = temp
print("Value of number1: ", a , " Value of number2: ",b) | a = int(input('Enter a number1: '))
b = int(input('Enter a number2: '))
temp = b
b = a
a = temp
print('Value of number1: ', a, ' Value of number2: ', b) |
# Created by MechAviv
# Kinesis Introduction
# Map ID :: 331003200
# Subway :: Subway Car #3
GIRL = 1531067
sm.removeNpc(GIRL)
sm.warpInstanceIn(331003300, 0) | girl = 1531067
sm.removeNpc(GIRL)
sm.warpInstanceIn(331003300, 0) |
model_parallel_size = 1
pipe_parallel_size = 0
distributed_backend = "nccl"
DDP_impl = "local" # local / torch
local_rank = None
lazy_mpu_init = False
use_cpu_initialization = False
| model_parallel_size = 1
pipe_parallel_size = 0
distributed_backend = 'nccl'
ddp_impl = 'local'
local_rank = None
lazy_mpu_init = False
use_cpu_initialization = False |
#Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Mumbling
#Problem level: 7 kyu
def accum(s):
li = []
for i in range(len(s)):
li.append(s[i].upper() + s[i].lower()*i)
return '-'.join(li)
| def accum(s):
li = []
for i in range(len(s)):
li.append(s[i].upper() + s[i].lower() * i)
return '-'.join(li) |
# 0. Paste the code in the Jupyter QtConsole
# 1. Execute: bfs_tree( root )
# 2. Execute: dfs_tree( root )
root = {'value': 1, 'depth': 1}
def successors(node):
if node['value'] == 5:
return []
elif node['value'] == 4:
return [{'value': 5, 'depth': node['depth']+1}]
else:
return... | root = {'value': 1, 'depth': 1}
def successors(node):
if node['value'] == 5:
return []
elif node['value'] == 4:
return [{'value': 5, 'depth': node['depth'] + 1}]
else:
return [{'value': node['value'] + 1, 'depth': node['depth'] + 1}, {'value': node['value'] + 2, 'depth': node['depth... |
AUTHOR = 'Zachary Priddy. (me@zpriddy.com)'
TITLE = 'Event Automation'
METADATA = {
'title': TITLE,
'author': AUTHOR,
'commands': ['execute'],
'interface': {
'trigger_types': {
'index_1': {
'context': 'and / or'
},
'index_3': {
'context': 'and / or'
},
... | author = 'Zachary Priddy. (me@zpriddy.com)'
title = 'Event Automation'
metadata = {'title': TITLE, 'author': AUTHOR, 'commands': ['execute'], 'interface': {'trigger_types': {'index_1': {'context': 'and / or'}, 'index_3': {'context': 'and / or'}, 'index_2': {'context': 'and / or'}}, 'trigger_devices': {'index_1': {'cont... |
#Y
for row in range(11):
for col in range(11):
if (row==col) or (row==0 and col==10)or (row==1 and col==9)or (row==2 and col==8)or (row==3 and col==7)or (row==4 and col==6):
print("*",end=" ")
else:
print(" ",end=" ")
print()
| for row in range(11):
for col in range(11):
if row == col or (row == 0 and col == 10) or (row == 1 and col == 9) or (row == 2 and col == 8) or (row == 3 and col == 7) or (row == 4 and col == 6):
print('*', end=' ')
else:
print(' ', end=' ')
print() |
def can_send(user, case):
return user.is_superuser or user == case.created_by
def nl2br(text):
return text.replace("\n", "\n<br>")
| def can_send(user, case):
return user.is_superuser or user == case.created_by
def nl2br(text):
return text.replace('\n', '\n<br>') |
class Solution:
def removeKdigits(self, num: str, k: int) -> str:
stack, i = [], 0
while i < len(num):
if not stack:
if num[i] != "0":
stack.append(num[i])
elif stack[-1] <= num[i]:
stack.append(num[i])
else:
... | class Solution:
def remove_kdigits(self, num: str, k: int) -> str:
(stack, i) = ([], 0)
while i < len(num):
if not stack:
if num[i] != '0':
stack.append(num[i])
elif stack[-1] <= num[i]:
stack.append(num[i])
els... |
# Create a function named stringcases that takes a string and
# returns a tuple of four versions of the string:
# uppercased, lowercased, titlecased (where every word's first letter
# is capitalized), and a reversed version of the string.
# Handy functions:
# .upper() - uppercases a string
# .lower() - lowercases a... | def stringcases(aString):
a_upper = aString.upper()
a_lower = aString.lower()
a_title = aString.title()
a_rev = aString[::-1]
return (aUpper, aLower, aTitle, aRev)
my_string = "This is my tuple of my string's variants"
tup = stringcases(myString)
print(tup[0])
print(tup[1])
print(tup[2])
print(tup[3... |
# Leo colorizer control file for eiffel mode.
# This file is in the public domain.
# Properties for eiffel mode.
properties = {
"lineComment": "--",
}
# Attributes dict for eiffel_main ruleset.
eiffel_main_attributes_dict = {
"default": "null",
"digit_re": "",
"escape": "\\",
"highlig... | properties = {'lineComment': '--'}
eiffel_main_attributes_dict = {'default': 'null', 'digit_re': '', 'escape': '\\', 'highlight_digits': 'true', 'ignore_case': 'true', 'no_word_sep': ''}
attributes_dict_dict = {'eiffel_main': eiffel_main_attributes_dict}
eiffel_main_keywords_dict = {'alias': 'keyword1', 'all': 'keyword... |
#!/usr/local/bin/python
# Code Fights Array Change Problem
def arrayChange(inputArray):
count = 0
for i in range(1, len(inputArray)):
diff = inputArray[i] - inputArray[i - 1]
if diff <= 0:
inputArray[i] += abs(diff) + 1
count += abs(diff) + 1
return count
def main... | def array_change(inputArray):
count = 0
for i in range(1, len(inputArray)):
diff = inputArray[i] - inputArray[i - 1]
if diff <= 0:
inputArray[i] += abs(diff) + 1
count += abs(diff) + 1
return count
def main():
tests = [[[1, 1, 1], 3]]
for t in tests:
... |
class LanguageSpecification:
def __init__(self):
pass
@staticmethod
def java_keywords():
keywords = ['abstract', 'assert', 'boolean', 'break', 'byte', 'case', 'catch', 'char', 'class', 'const']
keywords += ['continue', 'default', 'do', 'double', 'else', 'enum', 'extends', 'final'... | class Languagespecification:
def __init__(self):
pass
@staticmethod
def java_keywords():
keywords = ['abstract', 'assert', 'boolean', 'break', 'byte', 'case', 'catch', 'char', 'class', 'const']
keywords += ['continue', 'default', 'do', 'double', 'else', 'enum', 'extends', 'final', ... |
class MODAK_sql:
CREATE_INFRA_TABLE = "create external table \
infrastructure(infra_id int, \
name string, \
num_nodes int, \
is_active boolean, \
... | class Modak_Sql:
create_infra_table = "create external table infrastructure(infra_id int, name string, num_nodes int, is_active boolean, descri... |
class Store:
def callStore(nestedList, store, inpCounter):
counter=[0]
i=nestedList
inList=[["("],["("]]
quit=False
while not quit:
repeat=True
while repeat:
repeat=False
i=nestedList
number=0
... | class Store:
def call_store(nestedList, store, inpCounter):
counter = [0]
i = nestedList
in_list = [['('], ['(']]
quit = False
while not quit:
repeat = True
while repeat:
repeat = False
i = nestedList
nu... |
SOCIAL_AUTH_TWITTER_KEY = 'LXgJdyaJRF0PeGlKakqg1HRF9'
SOCIAL_AUTH_TWITTER_SECRET = 'rjGbkkELyUhGt3GiEUUIW2A2S2yFtyB2GXmf23nDrgcqoQPZ5R'
SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/'
| social_auth_twitter_key = 'LXgJdyaJRF0PeGlKakqg1HRF9'
social_auth_twitter_secret = 'rjGbkkELyUhGt3GiEUUIW2A2S2yFtyB2GXmf23nDrgcqoQPZ5R'
social_auth_login_redirect_url = '/' |
class MyClassName:
__private = 123
non_private = __private * 2
mine = MyClassName()
mine.non_private
246
mine.__private
mine._MyClassName__private
123
| class Myclassname:
__private = 123
non_private = __private * 2
mine = my_class_name()
mine.non_private
246
mine.__private
mine._MyClassName__private
123 |
# Eoin Lees
# Ascii Table
for i in range(0, 256):
print(f"{i:3} {i:08b} {chr(i)}") | for i in range(0, 256):
print(f'{i:3} {i:08b} {chr(i)}') |
class Signal:
def __init__(self):
pass
def generate(self, df):
pass
| class Signal:
def __init__(self):
pass
def generate(self, df):
pass |
# https://www.codingame.com/training/easy/brick-in-the-wall
def solution():
max_row_bricks = int(input())
num_bricks = int(input())
bricks = map(int, input().split())
work = 0
row, row_bricks = 1, 0
for brick in sorted(bricks, reverse=True):
work += ((row - 1) * 6.5 / 100) * 10 * bric... | def solution():
max_row_bricks = int(input())
num_bricks = int(input())
bricks = map(int, input().split())
work = 0
(row, row_bricks) = (1, 0)
for brick in sorted(bricks, reverse=True):
work += (row - 1) * 6.5 / 100 * 10 * brick
row_bricks += 1
if row_bricks == max_row_br... |
#!/usr/bin/env python
str="../data/example-data-english.csv"
file = open(str, "r")
fileout = open(str+"B", "w")
for line in file:
array=line.split(",")
for i in range(len(array)-5):
#print (line.split(",")[i])
fileout.write(line.split(",")[i]+", ");
fileout.write(line.split(",")[i+1]+"\n... | str = '../data/example-data-english.csv'
file = open(str, 'r')
fileout = open(str + 'B', 'w')
for line in file:
array = line.split(',')
for i in range(len(array) - 5):
fileout.write(line.split(',')[i] + ', ')
fileout.write(line.split(',')[i + 1] + '\n ')
fileout.close()
file.close() |
# vim: set et ts=4 sw=4 fileencoding=utf-8:
'''
tests
=====
'''
| """
tests
=====
""" |
num_list = []
num = input('Please enter a number: ')
while num != 'done' and num != 'DONE':
try:
num_list.append(int(num))
num = input('Please enter a number: ')
except:
num = input("Not a number. Please enter a number Or 'done' to finish: ")
try:
print('Maximum number: ', max(num... | num_list = []
num = input('Please enter a number: ')
while num != 'done' and num != 'DONE':
try:
num_list.append(int(num))
num = input('Please enter a number: ')
except:
num = input("Not a number. Please enter a number Or 'done' to finish: ")
try:
print('Maximum number: ', max(num_li... |
summary_response = {
'data': {
'battery': {
'state': 'ONLINE',
'val': 2.0
},
'grid': {
'state': 'ONLINE',
'val': 40.0,
'something_else': 'not_included'
},
'house': {
'state': 'ONLINE',
'val': ... | summary_response = {'data': {'battery': {'state': 'ONLINE', 'val': 2.0}, 'grid': {'state': 'ONLINE', 'val': 40.0, 'something_else': 'not_included'}, 'house': {'state': 'ONLINE', 'val': 25.0}, 'solar': {'state': 'ONLINE', 'val': 30.0, 'other_key': 'blah'}, 'key5': {'this_isnt': 'included'}}}
expected = {'battery': {'sta... |
def merge(left, right):
result = []
i, j = 0, 0
while len(left) and j < len(right):
if left[i] <= right[j]:
result.append(left[i])
i += 1
else:
result.append(right[j])
j += 1
result += left[i:]
result += right[j:]
return result
... | def merge(left, right):
result = []
(i, j) = (0, 0)
while len(left) and j < len(right):
if left[i] <= right[j]:
result.append(left[i])
i += 1
else:
result.append(right[j])
j += 1
result += left[i:]
result += right[j:]
return result
... |
class OperationABC:
pass
class BaseTable(OperationABC):
def __init__(self, table, db):
self.table = table
self.database = db
class Selection(OperationABC):
def __init__(self, pred):
self.predicate = pred
| class Operationabc:
pass
class Basetable(OperationABC):
def __init__(self, table, db):
self.table = table
self.database = db
class Selection(OperationABC):
def __init__(self, pred):
self.predicate = pred |
# Question 6
num = float(input("Enter a number: "))
print("difference:", num-17)
if num > 17:
print("double of absolute value of difference:", abs(num - 17) * 2)
| num = float(input('Enter a number: '))
print('difference:', num - 17)
if num > 17:
print('double of absolute value of difference:', abs(num - 17) * 2) |
class Notification(object):
def __init__(self, token, chat_id, logger):
super(Notification, self).__init__()
self.token = token
self.chat_id = chat_id
self.logger = logger
self.chat_id_list = chat_id.split()
def notify(self, user, message):
pass
def broadcas... | class Notification(object):
def __init__(self, token, chat_id, logger):
super(Notification, self).__init__()
self.token = token
self.chat_id = chat_id
self.logger = logger
self.chat_id_list = chat_id.split()
def notify(self, user, message):
pass
def broadca... |
class Board():
def __init__(self, height, width, food, hazards, snakes):
self.height = height
self.width = width
self.food = food
self.hazards = hazards
self.snakes = snakes
| class Board:
def __init__(self, height, width, food, hazards, snakes):
self.height = height
self.width = width
self.food = food
self.hazards = hazards
self.snakes = snakes |
# print(3 + 5)
# print(7 - 4)
# print(3 * 2)
# print(6 / 3)
# print(2 ** 3)
# PEDMAS LR
# ()
# **
# * /
# + -
print(3 * 3 + 3 / 3 - 3)
# Adding brackets around the addition increases priority
print(3 * (3 + 3) / 3 - 3) | print(3 * 3 + 3 / 3 - 3)
print(3 * (3 + 3) / 3 - 3) |
# write a function that takes a list of lists
# Each list has 5 numbers
# reverse each list in the big list but maintain the order of the lists
# e.g given [[1, 2, 3], [4, 5, 6], [7, 8]] return [[3, 2, 1], [6, 5, 4], [8, 7]]
# for more info on this quiz, go to this url: http://www.programmr.com/reverse-lists
def reve... | def reverse_lists(arr_y):
rev_lst = []
for i in arr_y:
i.reverse()
rev_lst.append(i)
return rev_lst
print(reverse_lists([[1, 2, 3], [4, 5, 6], [7, 8]])) |
head = '''<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://code.jquery.com/mob... | head = '<!DOCTYPE html>\n<html>\n<head>\n<meta name="viewport" content="width=device-width, initial-scale=1">\n<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">\n<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>\n<script src="https://code.jquery.com/mobil... |
class Solution:
def getNoZeroIntegers(self, n: int) -> List[int]:
while True:
a = random.randint(1, n - 1)
b = n - a
if '0' not in str(a) and '0' not in str(b):
return [a, b]
| class Solution:
def get_no_zero_integers(self, n: int) -> List[int]:
while True:
a = random.randint(1, n - 1)
b = n - a
if '0' not in str(a) and '0' not in str(b):
return [a, b] |
print("Welcome to MiOS")
yesValues = ["y", "yes", "true", "t"]
on = True
loggedIn = False
def yn(val):
return val.lower() in yesValues
while on:
account = input("Do you have an account? (y/n): ")
if yn(account):
print("Please login: ")
user = input("Enter your username: ")
userpassFi... | print('Welcome to MiOS')
yes_values = ['y', 'yes', 'true', 't']
on = True
logged_in = False
def yn(val):
return val.lower() in yesValues
while on:
account = input('Do you have an account? (y/n): ')
if yn(account):
print('Please login: ')
user = input('Enter your username: ')
userpas... |
def createPageFile(title: str, description: str, rating: float):
pagestr = "{{-start-}}\n ${description}\n ====Rating===\n ${rating}\n{{-stop-}}"
f = open("%s" % (title), "w+")
pagestr = pagestr.replace("${description}", description)
pagestr = pagestr.replace("${rating}", str(rating))
f.write(pages... | def create_page_file(title: str, description: str, rating: float):
pagestr = '{{-start-}}\n ${description}\n ====Rating===\n ${rating}\n{{-stop-}}'
f = open('%s' % title, 'w+')
pagestr = pagestr.replace('${description}', description)
pagestr = pagestr.replace('${rating}', str(rating))
f.write(pagest... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ==================================================
# @Time : 2019-05-30 19:44
# @Author : ryuchen
# @File : constants.py
# @Desc :
# ==================================================
CUCKOO_GUEST_PORT = 8000
CUCKOO_GUEST_INIT = 0x001
CUCKOO_GUEST_RUNNING = 0x002
CUCKOO_G... | cuckoo_guest_port = 8000
cuckoo_guest_init = 1
cuckoo_guest_running = 2
cuckoo_guest_completed = 3
cuckoo_guest_failed = 4
github_url = 'https://github.com/cuckoosandbox/cuckoo'
issues_page_url = 'https://github.com/cuckoosandbox/cuckoo/issues'
docs_url = 'https://cuckoo.sh/docs'
def faq(entry):
return '%s/faq/ind... |
class Config(object):
DEBUG = False
TESTING = False
UPLOAD_FOLDER = 'store'
class DevConfig(Config):
DEBUG = True
class TestConfig(Config):
TESTING = True
DEBUG = False
UPLOAD_FOLDER = 'test_store'
| class Config(object):
debug = False
testing = False
upload_folder = 'store'
class Devconfig(Config):
debug = True
class Testconfig(Config):
testing = True
debug = False
upload_folder = 'test_store' |
# clean code
def is_even(num):
return num % 2 == 0
print(is_even(51))
# *args **args
def super_func(*args):
return sum(args)
print(super_func(1,2,3,4,5)) #15
def another_super_func(**kwargs):
print(kwargs)
total = 0
for items in kwargs.values():
total += items
return total
print(another_super_f... | def is_even(num):
return num % 2 == 0
print(is_even(51))
def super_func(*args):
return sum(args)
print(super_func(1, 2, 3, 4, 5))
def another_super_func(**kwargs):
print(kwargs)
total = 0
for items in kwargs.values():
total += items
return total
print(another_super_func(num1=5, num2=10... |
class Fabric:
def __init__(self, width, height):
self._width = width
self._height = height
self._area = []
for row in range(0, height):
self._area.append([])
for column in range(0, width):
self._area[row].append(0)
def claim(self, piece):
... | class Fabric:
def __init__(self, width, height):
self._width = width
self._height = height
self._area = []
for row in range(0, height):
self._area.append([])
for column in range(0, width):
self._area[row].append(0)
def claim(self, piece):... |
DAY = 11
def part1(data):
data = [ord(c) for c in data]
while not is_valid(data):
for j in range(len(data)-1, -1,-1):
data[j] = data[j]+1
if data[j] > ord("z"):
data[j] = ord("a")
else:
break
return "".join(chr(c) for c in data)
... | day = 11
def part1(data):
data = [ord(c) for c in data]
while not is_valid(data):
for j in range(len(data) - 1, -1, -1):
data[j] = data[j] + 1
if data[j] > ord('z'):
data[j] = ord('a')
else:
break
return ''.join((chr(c) for c in da... |
# colorsystem.py is the full list of colors that can be used to easily create themes.
class Gray:
B0 = '#000000'
B10 = '#19232D'
B20 = '#293544'
B30 = '#37414F'
B40 = '#455364'
B50 = '#54687A'
B60 = '#60798B'
B70 = '#788D9C'
B80 = '#9DA9B5'
B90 = '#ACB1B6'
B100 = '#B9BDC1'
... | class Gray:
b0 = '#000000'
b10 = '#19232D'
b20 = '#293544'
b30 = '#37414F'
b40 = '#455364'
b50 = '#54687A'
b60 = '#60798B'
b70 = '#788D9C'
b80 = '#9DA9B5'
b90 = '#ACB1B6'
b100 = '#B9BDC1'
b110 = '#C9CDD0'
b120 = '#CED1D4'
b130 = '#E0E1E3'
b140 = '#FAFAFA'
... |
# encoding: utf-8
##################################################
# This script shows an example of variable assignment. It explores the different options for storing vales into
# variables
##################################################
#
##################################################
# Author: Diego Pajari... | x = 99
y = 63
z = x * y
print('The value assigned is:')
print(z)
z = x * y - x + y
print('The value assigned is:')
print(z)
z = x - y
print('The value assigned now is:')
print(z)
x = z
y = 'Now I store text'
print('The value in -x- now is:')
print(x)
print('The value in -y- now is:')
print(y)
print('The value in -x- no... |
data = []
with open("input.txt", "r") as file:
for line in file.readlines():
line = line.replace("\n", "")
data.append(line)
def countTrees(data, step_right, step_down):
check_index = step_right
count = 0
for i in range(step_down, len(data), step_down):
if data[i][check_index %... | data = []
with open('input.txt', 'r') as file:
for line in file.readlines():
line = line.replace('\n', '')
data.append(line)
def count_trees(data, step_right, step_down):
check_index = step_right
count = 0
for i in range(step_down, len(data), step_down):
if data[i][check_index %... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"source": "01_noisyimagenette.ipynb",
"df": "01_noisyimagenette.ipynb",
"get_inverse_transform": "01_noisyimagenette.ipynb",
"lbl_dict": "01_noisyimagenette.ipynb",
"lbl_di... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'source': '01_noisyimagenette.ipynb', 'df': '01_noisyimagenette.ipynb', 'get_inverse_transform': '01_noisyimagenette.ipynb', 'lbl_dict': '01_noisyimagenette.ipynb', 'lbl_dict_inv': '01_noisyimagenette.ipynb', 'get_dls': '01_noisyimagenette.ipynb', '... |
# Program to sort the array according to count of set bits in binary representation :)
def count_1(var):
count = 0
while var:
count += var % 2
var = var // 2
return count
arr = list(map(int, input("Enter the elements of array *With spaces b/w number* :").split()))
arr_new = [(arr[i], i) ... | def count_1(var):
count = 0
while var:
count += var % 2
var = var // 2
return count
arr = list(map(int, input('Enter the elements of array *With spaces b/w number* :').split()))
arr_new = [(arr[i], i) for i in range(len(arr))]
sort_list = sorted(arr_new, key=lambda x: count_1(x[0]), reverse=... |
# max(iterable, *[, key, default])
list1 = [1, 2, 3, 2, 1, 2, 4, 3]
max_item = max(list1)
max_item = max(list1, key=lambda x: list1.count(x), default=1)
print('max_item: ', max_item)
# max_item: 2
print('default: ', max((), default=111))
# default: 111
lstobj = [
{'name': 'xiaoming', 'age': 18, 'gender': '... | list1 = [1, 2, 3, 2, 1, 2, 4, 3]
max_item = max(list1)
max_item = max(list1, key=lambda x: list1.count(x), default=1)
print('max_item: ', max_item)
print('default: ', max((), default=111))
lstobj = [{'name': 'xiaoming', 'age': 18, 'gender': 'male'}, {'name': 'xiaohong', 'age': 20, 'gender': 'female'}]
print('max age: '... |
data = input()
elements = data.split(' ')
products = {}
for index in range(0, len(elements), 2):
key = elements[index]
quantity = int(elements[index + 1])
products[key] = quantity
searched_products = input().split(' ')
for item in searched_products:
if item in products.keys():
... | data = input()
elements = data.split(' ')
products = {}
for index in range(0, len(elements), 2):
key = elements[index]
quantity = int(elements[index + 1])
products[key] = quantity
searched_products = input().split(' ')
for item in searched_products:
if item in products.keys():
quantity = product... |
#!/usr/bin/env python3
# Day 30: Check If a String Is a Valid Sequence from Root to Leaves Path in a
# Binary Tree
#
# Given a binary tree where each path going from the root to any leaf form a
# valid sequence, check if a given string is a valid sequence in such binary
# tree.
# We get the given string from the conc... | class Treenode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def is_valid_sequence(self, root: TreeNode, arr: [int]) -> bool:
if root is None:
return False
if root.val != arr[0]:
... |
data = (
'yeoss', # 0x00
'yeong', # 0x01
'yeoj', # 0x02
'yeoc', # 0x03
'yeok', # 0x04
'yeot', # 0x05
'yeop', # 0x06
'yeoh', # 0x07
'ye', # 0x08
'yeg', # 0x09
'yegg', # 0x0a
'yegs', # 0x0b
'yen', # 0x0c
'yenj', # 0x0d
'yenh', # 0x0e
'yed', # 0x0f
'yel', # 0x10
'yelg', ... | data = ('yeoss', 'yeong', 'yeoj', 'yeoc', 'yeok', 'yeot', 'yeop', 'yeoh', 'ye', 'yeg', 'yegg', 'yegs', 'yen', 'yenj', 'yenh', 'yed', 'yel', 'yelg', 'yelm', 'yelb', 'yels', 'yelt', 'yelp', 'yelh', 'yem', 'yeb', 'yebs', 'yes', 'yess', 'yeng', 'yej', 'yec', 'yek', 'yet', 'yep', 'yeh', 'o', 'og', 'ogg', 'ogs', 'on', 'onj',... |
def test():
# if an assertion fails, the message will be displayed
# --> must have the correct arithmetic mean
assert numbers_one_mean == 4.0, "Are you calculating the arithmetic mean?"
# --> must have the first function call
assert "mean(numbers_one)" in __solution__, "Did you call the mean functio... | def test():
assert numbers_one_mean == 4.0, 'Are you calculating the arithmetic mean?'
assert 'mean(numbers_one)' in __solution__, 'Did you call the mean function with numbers_one as input?'
assert 'inspect(numbers_one' in __solution__, 'Did you call the inspect function with numbers_one as input?'
asse... |
class EndLine (Exception):
pass
| class Endline(Exception):
pass |
# 7_lineNumbers.py
# A program that rewrites a file with line numbers
# Date: 10/6/2020
# Name: Ben Goldstone
def main():
readFileName = input("What is the name of the input file? ")
writeFileName = input("What do you want the name of your output file to be? ")
readFile = open(readFileName, "r")
writeFi... | def main():
read_file_name = input('What is the name of the input file? ')
write_file_name = input('What do you want the name of your output file to be? ')
read_file = open(readFileName, 'r')
write_file = open(writeFileName, 'w')
line_number = 1
for line in readFile:
writeFile.write(f'{l... |
height = int(input())
for i in range(1,height+1):
for j in range(0,i+1):
print(end=" ")
for j in range(i,(2*height)-i+1):
print(j,end=" ")
print()
for i in range(1,height):
for j in range(0,height-i+1):
print(end=" ")
for j in range(height-i,height+i+1):
prin... | height = int(input())
for i in range(1, height + 1):
for j in range(0, i + 1):
print(end=' ')
for j in range(i, 2 * height - i + 1):
print(j, end=' ')
print()
for i in range(1, height):
for j in range(0, height - i + 1):
print(end=' ')
for j in range(height - i, height + i ... |
class Solution:
def solve(self, nums):
if len(nums) <= 1:
return len(nums)
sign = lambda x: (x>0)-(x<0)
d = sign(nums[1]-nums[0])
streak = 1 if d == 0 else 2
ans = streak
for i in range(1,len(nums)-1):
if nums[i+1]-nums[i] == 0:
... | class Solution:
def solve(self, nums):
if len(nums) <= 1:
return len(nums)
sign = lambda x: (x > 0) - (x < 0)
d = sign(nums[1] - nums[0])
streak = 1 if d == 0 else 2
ans = streak
for i in range(1, len(nums) - 1):
if nums[i + 1] - nums[i] == 0:... |
def getFirst(pair):
return pair[0]
with open("../inputs/day4.txt","r") as f:
data=f.read()
# [1518-05-29 00:00] Guard #1151 begins shift
data=data.split("\n")
data.pop()
processedData=[]
for el in data:
piece=el.split("]")
piece[0]=piece[0].replace("[","")
piece[0]=piece[0].replace(... | def get_first(pair):
return pair[0]
with open('../inputs/day4.txt', 'r') as f:
data = f.read()
data = data.split('\n')
data.pop()
processed_data = []
for el in data:
piece = el.split(']')
piece[0] = piece[0].replace('[', '')
piece[0] = piece[0].replace('-', '')
piece[0] = piece[0].replace(':', '... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | project = 'Kcli'
copyright = '2020, karmab'
author = 'karmab'
release = '99.0'
master_doc = 'index'
extensions = ['sphinx_rtd_theme', 'sphinx.ext.napoleon']
templates_path = ['_templates']
exclude_patterns = []
html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static'] |
def parsinator(x):
s=dict()
for i in range(0,len(x)):
for j in range(0,len(x[i])):
if x[i][j]=='#':
s[j,i,0,0]=True
return (s,0,0,0,0,len(x)-1,len(x[i])-1,0,0)
banana = [(a,b,c,d) for a in [-1,0,1] for b in [-1,0,1] for c in [-1,0,1] for d in [-1,0,1] if (a,b,c,d... | def parsinator(x):
s = dict()
for i in range(0, len(x)):
for j in range(0, len(x[i])):
if x[i][j] == '#':
s[j, i, 0, 0] = True
return (s, 0, 0, 0, 0, len(x) - 1, len(x[i]) - 1, 0, 0)
banana = [(a, b, c, d) for a in [-1, 0, 1] for b in [-1, 0, 1] for c in [-1, 0, 1] for d ... |
grafo3 = [{
"a": [
{
"aresta": "ac",
"incidencia": 1
},
{
"aresta": "ad",
"incidencia": 1
},
{
"aresta": "af",
"incidencia": 1
},
{
"aresta": "bd",
"incidencia": 0
},
{
"aresta": "be",
"incidencia": 0
},
{
"aresta": "cf",
"incidencia": 0
},
{
... | grafo3 = [{'a': [{'aresta': 'ac', 'incidencia': 1}, {'aresta': 'ad', 'incidencia': 1}, {'aresta': 'af', 'incidencia': 1}, {'aresta': 'bd', 'incidencia': 0}, {'aresta': 'be', 'incidencia': 0}, {'aresta': 'cf', 'incidencia': 0}, {'aresta': 'de', 'incidencia': 0}, {'aresta': 'df', 'incidencia': 0}]}, {'b': [{'aresta': 'ac... |
#!/bin/python
def insertNewElement(ar, pos):
e = ar[pos]
idx = pos - 1
while idx >=0 and ar[idx] > e:
ar[idx+1] = ar[idx]
idx -= 1
ar[idx+1] = e
def insertionSort(ar):
if len(ar) <= 1:
return
for pos in range(1, len(ar)):
insertNewElement(ar, pos)
print('... | def insert_new_element(ar, pos):
e = ar[pos]
idx = pos - 1
while idx >= 0 and ar[idx] > e:
ar[idx + 1] = ar[idx]
idx -= 1
ar[idx + 1] = e
def insertion_sort(ar):
if len(ar) <= 1:
return
for pos in range(1, len(ar)):
insert_new_element(ar, pos)
print(' '.j... |
Sys_User_Name = "EthanWayne"
Sys_Password = "123456"
User_Name = input("Please enter your name: ")
User_Password = input("Please enter your password: ")
if User_Name != Sys_User_Name and User_Password == Sys_Password:
print("Wrong user name...")
elif User_Name == Sys_User_Name and User_Password != Sys_Password:... | sys__user__name = 'EthanWayne'
sys__password = '123456'
user__name = input('Please enter your name: ')
user__password = input('Please enter your password: ')
if User_Name != Sys_User_Name and User_Password == Sys_Password:
print('Wrong user name...')
elif User_Name == Sys_User_Name and User_Password != Sys_Password... |
#
# PySNMP MIB module IP-MIB (http://pysnmp.sf.net)
# ASN.1 source http://mibs.snmplabs.com:80/asn1/IP-MIB
# Produced by pysmi-0.0.7 at Sun Feb 14 00:17:37 2016
# On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose
# Using Python version 3.5.0 (default, Jan 5 2016, 17:11:52)
#
( OctetString, I... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint, constraints_union) ... |
fin = open("input_18.txt")
digits = '1234567890'
def end_of_operand(text):
if text[0] == '(':
plevel = 1
for i, char in enumerate(text[1:], 1):
if char == '(':
plevel += 1
elif char == ')':
plevel += -1
if plevel == 0:
... | fin = open('input_18.txt')
digits = '1234567890'
def end_of_operand(text):
if text[0] == '(':
plevel = 1
for (i, char) in enumerate(text[1:], 1):
if char == '(':
plevel += 1
elif char == ')':
plevel += -1
if plevel == 0:
... |
class DeleteDeniedException(Exception):
pass
class FileBrowser(object):
pass
| class Deletedeniedexception(Exception):
pass
class Filebrowser(object):
pass |
'''
Fox and Snake
String Output
'''
n, m = list(map(int, input().split(' ')))
for i in range(n):
if i % 2 == 0:
print('#'*m)
elif (i+1) % 4 == 0:
print('#'+'.'*(m-1))
else:
print('.'*(m-1)+'#')
| """
Fox and Snake
String Output
"""
(n, m) = list(map(int, input().split(' ')))
for i in range(n):
if i % 2 == 0:
print('#' * m)
elif (i + 1) % 4 == 0:
print('#' + '.' * (m - 1))
else:
print('.' * (m - 1) + '#') |
#
# PySNMP MIB module Unisphere-Data-ATM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-ATM-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:23:09 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, constraints_union, value_range_constraint, value_size_constraint) ... |
filepath = "List of alternative rock artists - Wikipedia.html"
classifiedAs = "alternative rock"
file = open(filepath)
outputLines = []
for line in file:
if "</a></li>" in line:
outputLine = line.split("</a></li>")[0].split(">").pop() + " - " + classifiedAs
outputLines.append(outputLine)
... | filepath = 'List of alternative rock artists - Wikipedia.html'
classified_as = 'alternative rock'
file = open(filepath)
output_lines = []
for line in file:
if '</a></li>' in line:
output_line = line.split('</a></li>')[0].split('>').pop() + ' - ' + classifiedAs
outputLines.append(outputLine)
file.clo... |
N = int(input())
result = 0
for i in range(1, N + 1, 2):
t = 0
for j in range(1, i + 1):
if i % j == 0:
t += 1
if t == 8:
result += 1
print(result)
| n = int(input())
result = 0
for i in range(1, N + 1, 2):
t = 0
for j in range(1, i + 1):
if i % j == 0:
t += 1
if t == 8:
result += 1
print(result) |
# -*- coding: utf-8 -*-
class Optimizer(object):
def __init__(self, parameters, lr=0.01):
self.parameters = parameters
self.lr = lr
def step(self):
raise NotImplementedError
def zero_grad(self):
for param in self.parameters:
param.zero_grad()
| class Optimizer(object):
def __init__(self, parameters, lr=0.01):
self.parameters = parameters
self.lr = lr
def step(self):
raise NotImplementedError
def zero_grad(self):
for param in self.parameters:
param.zero_grad() |
a = rtdpy.Ncstr(tau=1, n=2, dt=.001, time_end=10)
b = rtdpy.Pfr(tau=3, dt=.001, time_end=10)
c = rtdpy.Elist([a, b])
plt.plot(c.time, c.exitage)
plt.xlabel('Time')
plt.ylabel('Exit Age Function')
plt.title('Combined RTD Model') | a = rtdpy.Ncstr(tau=1, n=2, dt=0.001, time_end=10)
b = rtdpy.Pfr(tau=3, dt=0.001, time_end=10)
c = rtdpy.Elist([a, b])
plt.plot(c.time, c.exitage)
plt.xlabel('Time')
plt.ylabel('Exit Age Function')
plt.title('Combined RTD Model') |
#!/usr/bin/env python
#
# (c) Copyright Rosetta Commons Member Institutions.
# (c) This file is part of the Rosetta software suite and is made available under license.
# (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
# (c) For more information, see http://www.rosettacommons.or... | class Definitions:
def __init__(self):
self.restypes = ('All', 'Charged', 'Positive', 'Negative', 'Non-Polar', 'Polar-Uncharged', 'Polar', 'Aromatic', 'Hydroxyl', 'Conserved', 'etc')
self.restype_info = dict()
self.resinfo = dict()
self.set_mutation_info()
self.set_residue_i... |
tipos_de_classes = {
(1, 'Economica'),
(2, 'Executiva'),
(3, 'Primeira classe')
} | tipos_de_classes = {(1, 'Economica'), (2, 'Executiva'), (3, 'Primeira classe')} |
#
# PySNMP MIB module JUNIPER-JS-IF-EXT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/JUNIPER-JS-IF-EXT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:59:34 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, value_size_constraint, constraints_intersection, single_value_constraint) ... |
while True:
n = int(input())
if n == 0:
break
arr = []
for i in range(n):
word = input()
arr.append(word)
flag = 0
for i in range(len(arr)):
for j in range(i+1, len(arr)):
if arr[j].startswith(arr[i]):
flag = 1
if flag ... | while True:
n = int(input())
if n == 0:
break
arr = []
for i in range(n):
word = input()
arr.append(word)
flag = 0
for i in range(len(arr)):
for j in range(i + 1, len(arr)):
if arr[j].startswith(arr[i]):
flag = 1
if flag == 1:
... |
#
# PySNMP MIB module HP-MEMPROC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-MEMPROC-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:23:36 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... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, constraints_union, constraints_intersection, value_size_constraint) ... |
a = 0 # FIRST, set the initial value of the variable a to 0(zero).
while a < 10: # While the value of the variable a is less than 10 do the following:
a = a + 1 # Increase the value of the variable a by 1, as in: a = a + 1!
print(a) # Print to screen what the present value of the variable a... | a = 0
while a < 10:
a = a + 1
print(a) |
'''Fdb Genie Ops Object Outputs for IOSXE.'''
class FdbOutput(object):
ShowMacAddressTable = {
"mac_table": {
"vlans": {
'100': {
"mac_addresses": {
"ecbd.1d09.5689": {
"drop": {
... | """Fdb Genie Ops Object Outputs for IOSXE."""
class Fdboutput(object):
show_mac_address_table = {'mac_table': {'vlans': {'100': {'mac_addresses': {'ecbd.1d09.5689': {'drop': {'drop': True, 'entry_type': 'dynamic'}, 'mac_address': 'ecbd.1d09.5689'}, '3820.5672.fc03': {'interfaces': {'Port-channel12': {'interface': ... |
config = {
'SECRET_CAPTCHA_KEY': 'CHANGEME - 40 or 50 character long key here',
'METHOD': 'pbkdf2:sha256:100',
'CAPTCHA_LENGTH': 5,
'CAPTCHA_DIGITS': False
}
| config = {'SECRET_CAPTCHA_KEY': 'CHANGEME - 40 or 50 character long key here', 'METHOD': 'pbkdf2:sha256:100', 'CAPTCHA_LENGTH': 5, 'CAPTCHA_DIGITS': False} |
class Navio:
def __init__(self, nome, tamanho, direcao):
self.nome = nome
self.tamanho = tamanho
self.direcao = direcao | class Navio:
def __init__(self, nome, tamanho, direcao):
self.nome = nome
self.tamanho = tamanho
self.direcao = direcao |
description = 'GE detector setup PV values'
group = 'configdata'
EIGHT_PACKS = [
# ('ep01', 'GE-DD590C-EP'), # replaced 2015/10/29
('ep01', 'GE-DD6D8C-EP'),
('ep02', 'GE-DD5FB3-EP'),
('ep03', 'GE-DDA871-EP'),
('ep04', 'GE-DD7D29-EP'),
('ep05', 'GE-DDBA8F-EP'),
('ep06', 'GE-DD5913-EP'),
... | description = 'GE detector setup PV values'
group = 'configdata'
eight_packs = [('ep01', 'GE-DD6D8C-EP'), ('ep02', 'GE-DD5FB3-EP'), ('ep03', 'GE-DDA871-EP'), ('ep04', 'GE-DD7D29-EP'), ('ep05', 'GE-DDBA8F-EP'), ('ep06', 'GE-DD5913-EP'), ('ep07', 'GE-DDC7CA-EP'), ('ep08', 'GE-DD6DEF-EP'), ('ep09', 'GE-DD5FB6-EP'), ('ep10... |
# Write a program to print the pattern
'''
* *
* *
*
* *
* *
'''
n = int(input("Size: "))
s1 = 0
s2 = 2 * n - 3
i = 0
while (i < n):
if (i < n-1):
extra = "*"
else :
extra = ""
print(" " * s1 + "*" + " " * s2 + extra)
s1 += 1
s2 -= 2
i += 1
s1 -= 2
s2 += 4
i = 0
whi... | """
* *
* *
*
* *
* *
"""
n = int(input('Size: '))
s1 = 0
s2 = 2 * n - 3
i = 0
while i < n:
if i < n - 1:
extra = '*'
else:
extra = ''
print(' ' * s1 + '*' + ' ' * s2 + extra)
s1 += 1
s2 -= 2
i += 1
s1 -= 2
s2 += 4
i = 0
while i < n - 1:
print(' ' * s1 + '*' + ' ' * ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.