content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Warrior:
attack = 5
health = 50
is_alive = True
class Knight(Warrior):
attack = 7
def fight(unit_1, unit_2):
print('fight')
flag = True
while unit_1.health > 0 and unit_2.health > 0:
if flag is True:
unit_2.health -= unit_1.attack
fla... | class Warrior:
attack = 5
health = 50
is_alive = True
class Knight(Warrior):
attack = 7
def fight(unit_1, unit_2):
print('fight')
flag = True
while unit_1.health > 0 and unit_2.health > 0:
if flag is True:
unit_2.health -= unit_1.attack
flag = False
... |
x = [[3,4],
[1,2]]
y = [[6,9],
[5,8]]
xy = [[0,0],
[0,0]]
n=2
for i in range(n):
for j in range(n):
xy[i][j] = x[i][j] * y[i][j]
print(xy) | x = [[3, 4], [1, 2]]
y = [[6, 9], [5, 8]]
xy = [[0, 0], [0, 0]]
n = 2
for i in range(n):
for j in range(n):
xy[i][j] = x[i][j] * y[i][j]
print(xy) |
def functions_in_class(theclass):
for funcname in dir(theclass):
if funcname.startswith('__'):
continue
yield getattr(theclass, funcname)
| def functions_in_class(theclass):
for funcname in dir(theclass):
if funcname.startswith('__'):
continue
yield getattr(theclass, funcname) |
# -*- coding: utf-8 -*-
"""Project metadata
Information describing the project.
"""
# The package name, which is also the "UNIX name" for the project.
package = 'copdai_core'
project = "COPDAI CORE"
project_no_spaces = project.replace(' ', '')
version = '0.1'
description = 'Collaborative Open Platform for Distributed... | """Project metadata
Information describing the project.
"""
package = 'copdai_core'
project = 'COPDAI CORE'
project_no_spaces = project.replace(' ', '')
version = '0.1'
description = 'Collaborative Open Platform for Distributed Artificial Intelligence core package'
authors = ['RABBAH Mahmoud Almostafa']
authors_string... |
"""
Your task is to implement
This function reads a sequence of words provided through command line terminated by the "stop" word
and prints them in reverse order.
Each word is separated by the "enter", see the main() below for how to read user input from command line
Note: this solution can be impr... | """
Your task is to implement
This function reads a sequence of words provided through command line terminated by the "stop" word
and prints them in reverse order.
Each word is separated by the "enter", see the main() below for how to read user input from command line
Note: this solution can be impr... |
#!/usr/bin/env python
class Config(object):
_cfg = {}
def safe_get(self, name):
self._cfg.get(name)
def append_config_values(self, opts):
pass
def __setattr__(self, name, value):
self._cfg[name] = value
def __getattr__(self, name):
return self._cfg.get(name)
... | class Config(object):
_cfg = {}
def safe_get(self, name):
self._cfg.get(name)
def append_config_values(self, opts):
pass
def __setattr__(self, name, value):
self._cfg[name] = value
def __getattr__(self, name):
return self._cfg.get(name)
def reset_all(self):
... |
# while loop is used to repeat a block of code until a condition is false
# this is useful for loops that don't know how many times they should run
# this while loop checks if you are hungry and if you are, it will print "Okay, here's a snack" until you are not hungry
hungry = input('Are you hungry? y/n ')
while hu... | hungry = input('Are you hungry? y/n ')
while hungry == 'y':
print("Okay here's a snack")
hungry = input('Are you still hungry? y/n ')
print('Okay, bye') |
# You are using Python
class Node() :
def __init__(self, value=None) :
self.data = value
self.next = None
class LinkedList() :
def __init__(self) :
self.head = None
self.tail = None
def insertElements(self, arr) :
"""
Recieves an array of inte... | class Node:
def __init__(self, value=None):
self.data = value
self.next = None
class Linkedlist:
def __init__(self):
self.head = None
self.tail = None
def insert_elements(self, arr):
"""
Recieves an array of integers and inserts them sequentially into the ... |
#!/usr/bin/env python3
# Copyright 2009-2017 BHG http://bw.org/
x = '47'
y = int(x) # constructor q transforma a string em int conversao
z = float(x)
a = abs(x)
b = divmod(x, 3)
c = complex()
d = x+34j
print(f'x is {type(x)}')
print(f'x is {x}')
print(f'y is {type(y)}')
print(f'y is {y}')
| x = '47'
y = int(x)
z = float(x)
a = abs(x)
b = divmod(x, 3)
c = complex()
d = x + 34j
print(f'x is {type(x)}')
print(f'x is {x}')
print(f'y is {type(y)}')
print(f'y is {y}') |
def find_unique(array1): # Return the only element not duplicated
missing = 0
for number in array1:
print(missing, ' - ', number)
missing ^= number
print(missing, ' - ', number)
return missing
if __name__ == "__main__":
array = [1, 9, 1, 9, 5, 6, 7, 8, 7, 8, 6]
second_array ... | def find_unique(array1):
missing = 0
for number in array1:
print(missing, ' - ', number)
missing ^= number
print(missing, ' - ', number)
return missing
if __name__ == '__main__':
array = [1, 9, 1, 9, 5, 6, 7, 8, 7, 8, 6]
second_array = [1, 1, 2, 4, 5, 6, 5, 4, 6]
print(f'find... |
def get_final_position(data):
depths,hori_pos = [0],0
aim = 0
for i,e in enumerate(data):
if i == 0:
if e[0] == 'forward':
hori_pos += int(e[1])
elif e[0] == 'down':
aim += int(e[1])
elif e[0] == 'up':
aim -= int(e[... | def get_final_position(data):
(depths, hori_pos) = ([0], 0)
aim = 0
for (i, e) in enumerate(data):
if i == 0:
if e[0] == 'forward':
hori_pos += int(e[1])
elif e[0] == 'down':
aim += int(e[1])
elif e[0] == 'up':
aim -... |
class Libro:
def __init__(self, titulo, autor, cantidad_de_paginas, genero, sinopsis):
self.titulo = titulo
self.autor = autor
self.cantidad_de_paginas = cantidad_de_paginas
self.genero = genero
self.sinopsis = sinopsis
| class Libro:
def __init__(self, titulo, autor, cantidad_de_paginas, genero, sinopsis):
self.titulo = titulo
self.autor = autor
self.cantidad_de_paginas = cantidad_de_paginas
self.genero = genero
self.sinopsis = sinopsis |
l, x = map(int, input().split())
people = 0
not_allowed = 0
for _ in range(x):
descri, p = input().split()
p = int(p)
if descri == "enter":
if people + p > l:
not_allowed += 1
else:
people += p
elif descri == "leave":
people -= p
print(not... | (l, x) = map(int, input().split())
people = 0
not_allowed = 0
for _ in range(x):
(descri, p) = input().split()
p = int(p)
if descri == 'enter':
if people + p > l:
not_allowed += 1
else:
people += p
elif descri == 'leave':
people -= p
print(not_allowed) |
month = int(input())
if month == 1:
month = 'January'
elif month == 2:
month = 'February'
elif month == 3:
month = 'March'
elif month == 4:
month = 'April'
elif month == 5:
month = 'May'
elif month == 6:
month = 'June'
elif month == 7:
month = 'July'
elif month == 8:
month = 'August'
el... | month = int(input())
if month == 1:
month = 'January'
elif month == 2:
month = 'February'
elif month == 3:
month = 'March'
elif month == 4:
month = 'April'
elif month == 5:
month = 'May'
elif month == 6:
month = 'June'
elif month == 7:
month = 'July'
elif month == 8:
month = 'August'
eli... |
# -*- coding: utf-8 -*-
class CommandError(Exception):
"""
Exception class indicating a problem while executing a console
scripts.
"""
pass
| class Commanderror(Exception):
"""
Exception class indicating a problem while executing a console
scripts.
"""
pass |
command_props = (
"command",
"invalidcommand",
"postcommand",
"tearoffcommand",
"validatecommand",
"xscrollcommand",
"yscrollcommand"
)
def handle(widget, config, **kwargs):
props = dict(kwargs.get("extra_config", {}))
builder = kwargs.get("builder")
# add the command name and ... | command_props = ('command', 'invalidcommand', 'postcommand', 'tearoffcommand', 'validatecommand', 'xscrollcommand', 'yscrollcommand')
def handle(widget, config, **kwargs):
props = dict(kwargs.get('extra_config', {}))
builder = kwargs.get('builder')
for prop in props:
builder._command_map.append((pr... |
points = dict()
points.update(dict.fromkeys(('AEIOULNRST'), 1))
points.update(dict.fromkeys(('DG'), 2))
points.update(dict.fromkeys(('BCMP'), 3))
points.update(dict.fromkeys(('FHVWY'), 4))
points.update(dict.fromkeys(('K'), 5))
points.update(dict.fromkeys(('JX'), 8))
points.update(dict.fromkeys(('QZ'), 10))
def score... | points = dict()
points.update(dict.fromkeys('AEIOULNRST', 1))
points.update(dict.fromkeys('DG', 2))
points.update(dict.fromkeys('BCMP', 3))
points.update(dict.fromkeys('FHVWY', 4))
points.update(dict.fromkeys('K', 5))
points.update(dict.fromkeys('JX', 8))
points.update(dict.fromkeys('QZ', 10))
def score(word):
ret... |
#!/usr/bin/env python3
#This program will write:
#Hello from Veronika Cabalova Joseph.
print("Hello from Veronika Cabalova Joseph.") | print('Hello from Veronika Cabalova Joseph.') |
d = {'k1':'v1', 'k2':'v2'}; print(d)
e = d.copy(); print(e)
d['k1'] = 'v111'
print(d, e)
| d = {'k1': 'v1', 'k2': 'v2'}
print(d)
e = d.copy()
print(e)
d['k1'] = 'v111'
print(d, e) |
'''
@author: Pranshu Aggarwal
@problem: https://hack.codingblocks.com/app/practice/1/853/problem
'''
def delhi_odd_even(n):
even, odd = 0, 0
while n != 0:
rem = n % 10
if rem % 2 == 0: even += rem
else: odd += rem
n = int(n / 10)
return (even % 4 == 0 or odd % 3 ... | """
@author: Pranshu Aggarwal
@problem: https://hack.codingblocks.com/app/practice/1/853/problem
"""
def delhi_odd_even(n):
(even, odd) = (0, 0)
while n != 0:
rem = n % 10
if rem % 2 == 0:
even += rem
else:
odd += rem
n = int(n / 10)
return even % 4... |
"""
Functions:
get_tag
make_upstream_probe
make_downstream_probe
make_probes
"""
BEAD2TAG = {
"LUA-1" : "CTTTAATCTCAATCAATACAAATC",
"LUA-2" : "CTTTATCAATACATACTACAATCA",
"LUA-3" : "TACACTTTATCAAATCTTACAATC",
"LUA-4" : "TACATTACCAATAATCTTCAAATC",
"LUA-5" : "CAATTCAAATCACAATAATCAATC",
"LUA-6" :... | """
Functions:
get_tag
make_upstream_probe
make_downstream_probe
make_probes
"""
bead2_tag = {'LUA-1': 'CTTTAATCTCAATCAATACAAATC', 'LUA-2': 'CTTTATCAATACATACTACAATCA', 'LUA-3': 'TACACTTTATCAAATCTTACAATC', 'LUA-4': 'TACATTACCAATAATCTTCAAATC', 'LUA-5': 'CAATTCAAATCACAATAATCAATC', 'LUA-6': 'TCAACAATCTTTTACAATCAAATC', 'L... |
def Introduction(example):
"""Make an entry into the dictionary. When this entry is called the dictionary will print
an explination of your puzzle. Make sure to include the call required to run your test."""
dictionary = {'example':'Text', 'first_test':'Simply import the test file with from tests import ... | def introduction(example):
"""Make an entry into the dictionary. When this entry is called the dictionary will print
an explination of your puzzle. Make sure to include the call required to run your test."""
dictionary = {'example': 'Text', 'first_test': 'Simply import the test file with from tests import f... |
s = input()
k = int(input())
def rec(k):
d= {}
start =0
res =''
for i in range(len(s)):
d[s[i]] = d.get(s[i],0)+1
while len(d)>k:
d[s[start]]-=1
if d[s[start]] ==0:
del d[s[start]]
start+=1
l = i - start+1
... | s = input()
k = int(input())
def rec(k):
d = {}
start = 0
res = ''
for i in range(len(s)):
d[s[i]] = d.get(s[i], 0) + 1
while len(d) > k:
d[s[start]] -= 1
if d[s[start]] == 0:
del d[s[start]]
start += 1
l = i - start + 1
... |
def create_position(db: Session, position_id: int, position = schemas.PositionCreate):
db_position = models.Person(name = position.name, age = position.age, gender = position.gender, condition = position.condition)
db.add(db_position)
db.commit()
db.refresh(db_position)
return db_position | def create_position(db: Session, position_id: int, position=schemas.PositionCreate):
db_position = models.Person(name=position.name, age=position.age, gender=position.gender, condition=position.condition)
db.add(db_position)
db.commit()
db.refresh(db_position)
return db_position |
"""
This is a comment.
"""
assert_app_dependency(app, 'Foo', '1.0') | """
This is a comment.
"""
assert_app_dependency(app, 'Foo', '1.0') |
file = open("day1/day1_input.txt", "r")
fuel = 0
for mass in file:
fuel += (int) (int(mass) / 3) - 2
print(fuel)
file.close()
| file = open('day1/day1_input.txt', 'r')
fuel = 0
for mass in file:
fuel += int(int(mass) / 3) - 2
print(fuel)
file.close() |
#### create a hierarchy of mammals ####
class Mammal:
def __init__ (self, name):
self.name = name
def speak (self):
print('Hi! I am', self.name)
class LandMammal (Mammal):
def __init__ (self, name):
super().__init__(name)
def walk (self):
print('Look at me, me is ... | class Mammal:
def __init__(self, name):
self.name = name
def speak(self):
print('Hi! I am', self.name)
class Landmammal(Mammal):
def __init__(self, name):
super().__init__(name)
def walk(self):
print('Look at me, me is walking')
class Aquamammal(Mammal):
def __... |
ANIME_FIELDS = (
'title { romaji english native }',
'description',
'averageScore',
'status',
'episodes',
'siteUrl',
'coverImage { large medium }',
'bannerImage',
'tags { name }'
'idMal',
'type',
'format',
'season',
'duration',
'chapters',
'volumes',
'... | anime_fields = ('title { romaji english native }', 'description', 'averageScore', 'status', 'episodes', 'siteUrl', 'coverImage { large medium }', 'bannerImage', 'tags { name }idMal', 'type', 'format', 'season', 'duration', 'chapters', 'volumes', 'isLicensed', 'source', 'updatedAt', 'genres', 'trending', 'isAdult', 'syn... |
""" Announce ET status changes. """
def consume(client, channel, frame):
who = frame.headers['who'] # "kdreyer@redhat.com"
# product = frame.headers['product'] # "RHEL-EXTRAS"
release = frame.headers['release'] # "Extras-RHEL-7.4"
errata_id = int(frame.headers['errata_id']) # 12345
errata_url ... | """ Announce ET status changes. """
def consume(client, channel, frame):
who = frame.headers['who']
release = frame.headers['release']
errata_id = int(frame.headers['errata_id'])
errata_url = 'https://errata.devel.redhat.com/advisory/%d' % errata_id
to_status = frame.headers['to']
mtmpl = '{who... |
AVATAR_AUTO_GENERATE_SIZES = 150
# Control the forms that django-allauth uses
ACCOUNT_FORMS = {
"login": "allauth.account.forms.LoginForm",
"add_email": "allauth.account.forms.AddEmailForm",
"change_password": "allauth.account.forms.ChangePasswordForm",
"set_password": "allauth.account.forms.SetPasswor... | avatar_auto_generate_sizes = 150
account_forms = {'login': 'allauth.account.forms.LoginForm', 'add_email': 'allauth.account.forms.AddEmailForm', 'change_password': 'allauth.account.forms.ChangePasswordForm', 'set_password': 'allauth.account.forms.SetPasswordForm', 'reset_password': 'allauth.account.forms.ResetPasswordF... |
#Automate script for scan IP with nmap
value = input('Enter the file name: ')
file = open (value,"r")
content = file.readlines()
for line in content:
IP = line.split()
print(IP)
| value = input('Enter the file name: ')
file = open(value, 'r')
content = file.readlines()
for line in content:
ip = line.split()
print(IP) |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" Created with Corsair vgit-latest
Control/status register map.
"""
class _RegData:
def __init__(self, rmap):
self._rmap = rmap
@property
def val(self):
"""Value of the register"""
rdata = self._rmap._if.read(self._rmap.DATA_ADDR)... | """ Created with Corsair vgit-latest
Control/status register map.
"""
class _Regdata:
def __init__(self, rmap):
self._rmap = rmap
@property
def val(self):
"""Value of the register"""
rdata = self._rmap._if.read(self._rmap.DATA_ADDR)
return rdata >> self._rmap.DATA_VAL_POS... |
class WorkOrdersApi():
"""
Class is the interface for talking to the work orders
api in lightspeed.
"""
endpoint = "Workorder.json"
def __init__(self, client):
self.client = client
def get_workorders(self, params={}, limit=100, offset=0):
params["limit"] = limit
pa... | class Workordersapi:
"""
Class is the interface for talking to the work orders
api in lightspeed.
"""
endpoint = 'Workorder.json'
def __init__(self, client):
self.client = client
def get_workorders(self, params={}, limit=100, offset=0):
params['limit'] = limit
param... |
#
# PySNMP MIB module BROCADE-SPX-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BROCADE-SPX-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:41:19 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, value_size_constraint, single_value_constraint, constraints_union) ... |
TEMPLATES = []
PLATFORMS = {}
MIDDLEWARES = []
| templates = []
platforms = {}
middlewares = [] |
class Pilha:
pilha = list()
def __init__(self, elemento=None):
if elemento:
self.inserir(elemento)
def inserir(self, elemento):
self.pilha.insert(0, elemento)
def remover(self):
elemento = self.pilha.pop(-1)
return elemento
def tamanho(self):
c... | class Pilha:
pilha = list()
def __init__(self, elemento=None):
if elemento:
self.inserir(elemento)
def inserir(self, elemento):
self.pilha.insert(0, elemento)
def remover(self):
elemento = self.pilha.pop(-1)
return elemento
def tamanho(self):
c... |
def resolve_refs(node, resolver):
if isinstance(node, list):
for v in node:
resolve_refs(v, resolver)
return
if not isinstance(node, dict):
return
ref_url = node.get('$ref', None)
if ref_url is not None:
node.clear()
_, fragment = resolver.resolve(ref_... | def resolve_refs(node, resolver):
if isinstance(node, list):
for v in node:
resolve_refs(v, resolver)
return
if not isinstance(node, dict):
return
ref_url = node.get('$ref', None)
if ref_url is not None:
node.clear()
(_, fragment) = resolver.resolve(re... |
def first_word(str):
"""
returns the first word in a given text.
"""
text=str.split()
return text[0]
if __name__ == '__main__':
print("Example:")
print(first_word("Hello world"))
| def first_word(str):
"""
returns the first word in a given text.
"""
text = str.split()
return text[0]
if __name__ == '__main__':
print('Example:')
print(first_word('Hello world')) |
print ("Decidere il tipo di triangolo")
a= float(input("inserisci lato 1: "))
b= float (input ("Inserisci lato 2: "))
c= float (input ("Inserisci lat 3: "))
print ("Lato 1: ", a)
print ("Lato 2: ", b)
print ("Lato 3: ", c)
if a==b and b==c:
print ("Triangolo equilatero")
elif a==b or b==c or a==c:
print ("T... | print('Decidere il tipo di triangolo')
a = float(input('inserisci lato 1: '))
b = float(input('Inserisci lato 2: '))
c = float(input('Inserisci lat 3: '))
print('Lato 1: ', a)
print('Lato 2: ', b)
print('Lato 3: ', c)
if a == b and b == c:
print('Triangolo equilatero')
elif a == b or b == c or a == c:
print('Tr... |
AchievementTitles = ('It\'s fun with friends',
'Mr Popular',
'Famous Toon',
'Trolley Time!',
'VP',
'VP',
'VP',
'VP')
AchievementDesc = ('You made a Friend!',
... | achievement_titles = ("It's fun with friends", 'Mr Popular', 'Famous Toon', 'Trolley Time!', 'VP', 'VP', 'VP', 'VP')
achievement_desc = ('You made a Friend!', 'You made 10 Friends!', 'You made 50 Friends!', 'You rode the Trolley!', 'You defeated the VP!', 'You defeated the VP with 1 laff!', 'You soloed the VP!', 'You s... |
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
c = []
for x in b:
if x in a and x not in c:
c.append(x)
print(c) | a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
c = []
for x in b:
if x in a and x not in c:
c.append(x)
print(c) |
class Owners:
def __init__(self, github, cloud_storage):
self.github = github
self.cloud_storage = cloud_storage
def list_all(self):
return self.cloud_storage.list_all_owners()
def sync(self):
all_users = self.github.fetch_users()
self.cloud_storage.store_owners_lis... | class Owners:
def __init__(self, github, cloud_storage):
self.github = github
self.cloud_storage = cloud_storage
def list_all(self):
return self.cloud_storage.list_all_owners()
def sync(self):
all_users = self.github.fetch_users()
self.cloud_storage.store_owners_li... |
def merge_sort(l):
if len(l) == 1:
return l
# left = merge_sort(l[:l // 2])
# right = merge_sort(l[l // 2:])
left = merge_sort(l[:len(l)//2])
right = merge_sort(l[len(l)//2:])
return merge(left, right)
def merge(left, right):
result = []
i = j = 0
while i <= len(left)-1 and... | def merge_sort(l):
if len(l) == 1:
return l
left = merge_sort(l[:len(l) // 2])
right = merge_sort(l[len(l) // 2:])
return merge(left, right)
def merge(left, right):
result = []
i = j = 0
while i <= len(left) - 1 and j <= len(right) - 1:
if left[i] < right[j]:
res... |
source = open('Second_train.txt','r')
state = 0
output = open('SecondData.txt','w')
for line in source:
if line[0] == '%':
state = 1
elif state == 1:
line = line.replace('<SEP>',',')
output.write(line)
state = 0
| source = open('Second_train.txt', 'r')
state = 0
output = open('SecondData.txt', 'w')
for line in source:
if line[0] == '%':
state = 1
elif state == 1:
line = line.replace('<SEP>', ',')
output.write(line)
state = 0 |
################################################################################
# Author: BigBangEpoch <bbepoch@163.com>
# Date : 2018-12-24
# Copyright (c) 2018-2019 BigBangEpoch All rights reserved.
################################################################################
def de_normalize(feat_data, norm_p... | def de_normalize(feat_data, norm_params, norm_type='mean_var'):
"""
de-normalize data with normalization parameters using norm_type defined method
:param feat_data: data to de-normalize
:param norm_params: a numpy array of shape (4, N), indicating min, max, mean and variance for N dimensions
:param ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
*****************************************
Author: zhlinh
Email: zhlinhng@gmail.com
Version: 0.0.1
Created Time: 2016-03-26
Last_modify: 2016-03-26
******************************************
'''
'''
Note: This is an extension of House Robber... | """
*****************************************
Author: zhlinh
Email: zhlinhng@gmail.com
Version: 0.0.1
Created Time: 2016-03-26
Last_modify: 2016-03-26
******************************************
"""
'\nNote: This is an extension of House Robber.\n\nAfter robbing those houses on that street,\... |
# Its job is to identify which forms are good prompts for the key form, so given a level and a form,
# we can pick a good prompt.
MATCHING_FORMS = {
("A1", "INDICATIVO_PASSATO_PROSSIMO"): ["'INDICATIVO_PRESENTE'"],
("A2", "INDICATIVO_PASSATO_PROSSIMO"): ["'INDICATIVO_PRESENTE'"],
("B1", "INDICATIVO_PASSATO... | matching_forms = {('A1', 'INDICATIVO_PASSATO_PROSSIMO'): ["'INDICATIVO_PRESENTE'"], ('A2', 'INDICATIVO_PASSATO_PROSSIMO'): ["'INDICATIVO_PRESENTE'"], ('B1', 'INDICATIVO_PASSATO_PROSSIMO'): ["'INDICATIVO_PRESENTE'"], ('B2', 'INDICATIVO_PASSATO_PROSSIMO'): ["'INDICATIVO_PRESENTE'"], ('A1', 'INDICATIVO_IMPERFETTO'): ["'IN... |
#!/usr/bin/env python
# @Time : 6/10/18 1:41 PM
# @Author : Huaizheng Zhang
# @Site : zhanghuaizheng.info
# @File : base.py
class BaseDetector(object):
'''
This class is a base class of object detection
'''
def __init__(self):
'''
Init object detector
:arg
:... | class Basedetector(object):
"""
This class is a base class of object detection
"""
def __init__(self):
"""
Init object detector
:arg
:return
"""
pass
def load_paprameters(self):
"""
To load pre-trained parameters
:return:
... |
class Player(object):
pass
class Game(object):
pass | class Player(object):
pass
class Game(object):
pass |
# coding=utf-8
"""
create on : 2019/04/19
project name : AtCoder
file name : 10_ABC086C
Problem : https://atcoder.jp/contests/abs/tasks/arc089_a
"""
def main():
n = int(input())
last_time = 0
last_x = last_y = 0
flag = True
for _ in range(n):
t, x, y = [int(txy) for txy in input().sp... | """
create on : 2019/04/19
project name : AtCoder
file name : 10_ABC086C
Problem : https://atcoder.jp/contests/abs/tasks/arc089_a
"""
def main():
n = int(input())
last_time = 0
last_x = last_y = 0
flag = True
for _ in range(n):
(t, x, y) = [int(txy) for txy in input().split(' ')]
... |
"""
Test `servifier` package.
Author: Nikolay Lysenko
"""
| """
Test `servifier` package.
Author: Nikolay Lysenko
""" |
def createLineSpeed():
x1 = []
y1 = []
x2 = []
y2 = []
print("Enter the beginning and ending of two line (0-1) (xb1,yb1,xe1,ye1,xb2,yb2,xe2,ye2)")
Bp = input("Enter line position :").split(",")
x1.append((Bp[0]))
y1.append((Bp[1]))
x1.append((Bp[2]))
y1.append((Bp[3]))
x2.append((Bp[4]))
y2.appe... | def create_line_speed():
x1 = []
y1 = []
x2 = []
y2 = []
print('Enter the beginning and ending of two line (0-1) (xb1,yb1,xe1,ye1,xb2,yb2,xe2,ye2)')
bp = input('Enter line position :').split(',')
x1.append(Bp[0])
y1.append(Bp[1])
x1.append(Bp[2])
y1.append(Bp[3])
x2.append(Bp... |
""" Daubechies 20 wavelet """
class Daubechies20:
"""
Properties
----------
asymmetric, orthogonal, bi-orthogonal
All values are from http://wavelets.pybytes.com/wavelet/db20/
"""
__name__ = "Daubechies Wavelet 20"
__motherWaveletLength__ = 40 # length of the mother wavelet
__tra... | """ Daubechies 20 wavelet """
class Daubechies20:
"""
Properties
----------
asymmetric, orthogonal, bi-orthogonal
All values are from http://wavelets.pybytes.com/wavelet/db20/
"""
__name__ = 'Daubechies Wavelet 20'
__mother_wavelet_length__ = 40
__transform_wavelet_length__ = 2
... |
# coding=utf-8
NETS = ['default']
POOL = 'default'
IMAGE = None
CPUMODEL = 'host-model'
NUMCPUS = 2
CPUHOTPLUG = False
MEMORY = 512
MEMORYHOTPLUG = False
DISKINTERFACE = 'virtio'
DISKTHIN = True
DISKSIZE = 10
DISKS = [{'size': DISKSIZE}]
GUESTID = 'guestrhel764'
VNC = False
CLOUDINIT = True
RESERVEIP = False
RESERVEDNS... | nets = ['default']
pool = 'default'
image = None
cpumodel = 'host-model'
numcpus = 2
cpuhotplug = False
memory = 512
memoryhotplug = False
diskinterface = 'virtio'
diskthin = True
disksize = 10
disks = [{'size': DISKSIZE}]
guestid = 'guestrhel764'
vnc = False
cloudinit = True
reserveip = False
reservedns = False
reserv... |
class BrokenDB(Exception):
def __init__(self, expected_hash: bytes, actual_hash: bytes, hash_algorithm: str):
self.expected_hash = expected_hash
self.actual_hash = actual_hash
self.hash_algorithm = hash_algorithm
class WrongMaster(Exception):
pass
| class Brokendb(Exception):
def __init__(self, expected_hash: bytes, actual_hash: bytes, hash_algorithm: str):
self.expected_hash = expected_hash
self.actual_hash = actual_hash
self.hash_algorithm = hash_algorithm
class Wrongmaster(Exception):
pass |
class BaseEnv(dataclass):
state: any
observation_spec: dict[str, Modality]
action_spec: dict[str, Modality]
last_observation: dict[str, NestedTensor]
last_action: dict[str, NestedTensor]
def step(self, obs, *args, **kwargs):
raise NotImplementedError('subclasses should implement this m... | class Baseenv(dataclass):
state: any
observation_spec: dict[str, Modality]
action_spec: dict[str, Modality]
last_observation: dict[str, NestedTensor]
last_action: dict[str, NestedTensor]
def step(self, obs, *args, **kwargs):
raise not_implemented_error('subclasses should implement this ... |
def warn_the_sheep(queue):
if queue[-1]=="wolf":
return 'Pls go away and stop eating my sheep'
else:
return "Oi! Sheep number "+str(len(queue)-queue.index("wolf")-1)+"! You are about to be eaten by a wolf!" | def warn_the_sheep(queue):
if queue[-1] == 'wolf':
return 'Pls go away and stop eating my sheep'
else:
return 'Oi! Sheep number ' + str(len(queue) - queue.index('wolf') - 1) + '! You are about to be eaten by a wolf!' |
'''input
1
1
1
5
3
1
2
2
'''
# -*- coding: utf-8 -*-
# AtCoder Beginner Contest
if __name__ == '__main__':
n = int(input())
print(n)
# See:
# https://www.slideshare.net/chokudai/abc021
for _ in range(n):
print(1)
| """input
1
1
1
5
3
1
2
2
"""
if __name__ == '__main__':
n = int(input())
print(n)
for _ in range(n):
print(1) |
class MinStack:
def __init__(self):
self.L = []
self.min_stack = []
def push(self, val: int) -> None:
self.L.append(val)
if not self.min_stack:
self.min_stack.append(val)
else:
if val <= self.min_stack[-1]:
self.min_stack.... | class Minstack:
def __init__(self):
self.L = []
self.min_stack = []
def push(self, val: int) -> None:
self.L.append(val)
if not self.min_stack:
self.min_stack.append(val)
elif val <= self.min_stack[-1]:
self.min_stack.append(val)
def pop(sel... |
print ('Qual a sua data de nascimento?')
dia = input ('Dia: ')
mes = input ('Mes: ')
ano = input ('Ano: ')
print ('Voce nasceu no dia ' + dia + ' de ' + mes + ' de ' + ano)
| print('Qual a sua data de nascimento?')
dia = input('Dia: ')
mes = input('Mes: ')
ano = input('Ano: ')
print('Voce nasceu no dia ' + dia + ' de ' + mes + ' de ' + ano) |
class KeplerIOError(Exception):
"""A base exception for any IO error that might occur."""
def __init__(self, message):
"""Initializes a new KeplerIOError"""
super().__init__(message)
class MAST_IDNotFound(KeplerIOError):
"""The searched ID could not be found on MAST."""
def __init_... | class Keplerioerror(Exception):
"""A base exception for any IO error that might occur."""
def __init__(self, message):
"""Initializes a new KeplerIOError"""
super().__init__(message)
class Mast_Idnotfound(KeplerIOError):
"""The searched ID could not be found on MAST."""
def __init__(s... |
class Solution:
def searchMatrix(self, matrix, target):
"""
:type matrix: List[List[int]]
:type target: int
:rtype: bool
"""
if not matrix:
return False
if not matrix[0]:
return False
left = up = 0
right = len(m... | class Solution:
def search_matrix(self, matrix, target):
"""
:type matrix: List[List[int]]
:type target: int
:rtype: bool
"""
if not matrix:
return False
if not matrix[0]:
return False
left = up = 0
right = len(matrix[0... |
def sum(a,b):
return a + b
def salario_descontado_imposto(salario,imposto=27.):
return salario - (salario * imposto * 0.01)
c = sum(1,3)
print(c)
salario_real = salario_descontado_imposto(5000)
print(salario_real)
| def sum(a, b):
return a + b
def salario_descontado_imposto(salario, imposto=27.0):
return salario - salario * imposto * 0.01
c = sum(1, 3)
print(c)
salario_real = salario_descontado_imposto(5000)
print(salario_real) |
x = 50
while 50 <= x <= 100:
print (x)
x = x + 1
| x = 50
while 50 <= x <= 100:
print(x)
x = x + 1 |
# Copyright (c) 2020 Geoffrey Huntley <ghuntley@ghuntley.com>. All rights reserved.
# SPDX-License-Identifier: Proprietary
# Sample Test passing with nose and pytest
def test_pass():
assert True, "dummy sample test"
| def test_pass():
assert True, 'dummy sample test' |
class InputReader:
"""Handles reading the input"""
def __init__(self, mode, filename):
self.filename = filename
self.mode = mode
def get_next_word(self) -> str:
"""
Returns one word at a time from the input document
:return: The next word
"""
# The ... | class Inputreader:
"""Handles reading the input"""
def __init__(self, mode, filename):
self.filename = filename
self.mode = mode
def get_next_word(self) -> str:
"""
Returns one word at a time from the input document
:return: The next word
"""
if self... |
"""
Create a function that reverses a string.
For example string 'Hi My name is Faisal' should be 'lasiaF si eman yM iH'
"""
# Function Definition
# First attempt to reverse a string.
def reverse_string(string_input):
split_string = list(string_input)
reversed_string = []
for i in reversed(range(len(spli... | """
Create a function that reverses a string.
For example string 'Hi My name is Faisal' should be 'lasiaF si eman yM iH'
"""
def reverse_string(string_input):
split_string = list(string_input)
reversed_string = []
for i in reversed(range(len(split_string))):
reversed_string.append(split_string[i])
... |
#The Course:PROG8420
#Assignment No:2
#Create date:2020/09/25
#Name: Fei Yun
location1=input('put the txt file with .py same folder and input file name: ')
def wordCount(location):
file=open(location,"r")
wordcount={}
#split word and lower all words
Text=file.read().lower().split()
#clean -,.\n special characater... | location1 = input('put the txt file with .py same folder and input file name: ')
def word_count(location):
file = open(location, 'r')
wordcount = {}
text = file.read().lower().split()
for char in '-.,\n':
text = [item.replace(char, '') for item in Text]
for word in Text:
if word not... |
players = ['charles', 'martina', 'michael', 'florence', 'eli']
print (players)
print (players[0:3])
print (players[1:4])
print (players[:4])
print (players[2:])
print ('\nHere are the first three players on my team:')
for player in players[:3]:
print (player.title())
| players = ['charles', 'martina', 'michael', 'florence', 'eli']
print(players)
print(players[0:3])
print(players[1:4])
print(players[:4])
print(players[2:])
print('\nHere are the first three players on my team:')
for player in players[:3]:
print(player.title()) |
# close func
def CloseFunc():
print("CloseFunc")
return False
# an option
def Option1():
print("Option1")
return True
# dictionary with all options_dict
# your key : ("option name", function to call for that option),
options_dict = {
0 : ("Close called", CloseFunc),
1 : ("Option1 function called", Option1),
}... | def close_func():
print('CloseFunc')
return False
def option1():
print('Option1')
return True
options_dict = {0: ('Close called', CloseFunc), 1: ('Option1 function called', Option1)}
def ask_for_option():
for key in options_dict.keys():
print('%s - %s' % (str(key), options_dict[key][0]))
... |
# Strings
# split -> returns a list based on the delimiter
# Sample String
string_01 = "The quick brown fox jumps over the lazy dog."
string_02 = "10/10/2019 01:02:35 CST|10.10.21.23|HTTP 200|Duration:5s|Timeout:30s"
# Using split
word_list = string_01.split()
# Type & Print
print(" Type ".center(44, "-"))
print(ty... | string_01 = 'The quick brown fox jumps over the lazy dog.'
string_02 = '10/10/2019 01:02:35 CST|10.10.21.23|HTTP 200|Duration:5s|Timeout:30s'
word_list = string_01.split()
print(' Type '.center(44, '-'))
print(type(word_list))
print(word_list)
word_count = len(word_list)
print(' list item count (i.e length)'.center(44,... |
magic_create_key = "TheQuickBrownFox"
class Board:
class Builder:
def __init__(self, board, player):
if len(board) == 0:
raise InvalidBoardException("Board is empty")
self.board = board
self.player = player
self.min_array_size = 5 # Min boar... | magic_create_key = 'TheQuickBrownFox'
class Board:
class Builder:
def __init__(self, board, player):
if len(board) == 0:
raise invalid_board_exception('Board is empty')
self.board = board
self.player = player
self.min_array_size = 5
... |
"""
Author: CaptCorpMURICA
Project: 100DaysPython
File: module1_day13_continueBreak.py
Creation Date: 6/2/2019, 8:55 AM
Description: Learn about continue/break operations in python.
"""
# Print only consonants from a given text.
motivation = "Over? Did you say 'over'? N... | """
Author: CaptCorpMURICA
Project: 100DaysPython
File: module1_day13_continueBreak.py
Creation Date: 6/2/2019, 8:55 AM
Description: Learn about continue/break operations in python.
"""
motivation = "Over? Did you say 'over'? Nothing is over until we decide it is! Was it... |
def find_unique_and_common(line_1, line_2):
print("\n".join(map(str, set(line_1) & set(line_2))))
line_1_count, line_2_count = map(int, input().split())
line_1 = [int(input()) for _ in range(line_1_count)]
line_2 = [int(input()) for _ in range(line_2_count)]
find_unique_and_common(line_1, line_2) | def find_unique_and_common(line_1, line_2):
print('\n'.join(map(str, set(line_1) & set(line_2))))
(line_1_count, line_2_count) = map(int, input().split())
line_1 = [int(input()) for _ in range(line_1_count)]
line_2 = [int(input()) for _ in range(line_2_count)]
find_unique_and_common(line_1, line_2) |
protos = {
0:"HOPOPT",
1:"ICMP",
2:"IGMP",
3:"GGP",
4:"IPv4",
5:"ST",
6:"TCP",
7:"CBT",
8:"EGP",
9:"IGP",
10:"BBN-RCC-MON",
11:"NVP-II",
12:"PUP",
13:"ARGUS",
14:"EMCON",... | protos = {0: 'HOPOPT', 1: 'ICMP', 2: 'IGMP', 3: 'GGP', 4: 'IPv4', 5: 'ST', 6: 'TCP', 7: 'CBT', 8: 'EGP', 9: 'IGP', 10: 'BBN-RCC-MON', 11: 'NVP-II', 12: 'PUP', 13: 'ARGUS', 14: 'EMCON', 15: 'XNET', 16: 'CHAOS', 17: 'UDP', 18: 'MUX', 19: 'DCN-MEAS', 20: 'HMP', 21: 'PRM', 22: 'XNS-IDP', 23: 'TRUNK-1', 24: 'TRUNK-2', 25: '... |
print("-"*30)
nome = input("Nome do Jogador: ").strip()
gols = input("NUmero de gols: ").strip()
def ficha(nome,gols):
if gols.isnumeric():
if nome == '':
return f'O jogador <desconhecido> fez {gols} gols(s) no campeaonato'
else:
return f'O jogador {nome} fez {gols} gol(s) no... | print('-' * 30)
nome = input('Nome do Jogador: ').strip()
gols = input('NUmero de gols: ').strip()
def ficha(nome, gols):
if gols.isnumeric():
if nome == '':
return f'O jogador <desconhecido> fez {gols} gols(s) no campeaonato'
else:
return f'O jogador {nome} fez {gols} gol(s... |
def change(fname, round):
with open ("renamed_{}".format(fname), "w+") as new:
with open(fname, "r") as old:
for file in old:
id = old.split("_")[0]
| def change(fname, round):
with open('renamed_{}'.format(fname), 'w+') as new:
with open(fname, 'r') as old:
for file in old:
id = old.split('_')[0] |
#Nilo soluction
arquivo = open('mobydick.txt', 'r')
texto = arquivo.readlines()[:]
tam = len(texto)
dicionario = dict()
lista = list()
clinha = 1
coluna = 1
for linha in texto:
linha = linha.strip().lower()
palavras = linha.split()
for p in palavras:
if p == '':
coluna += 1
i... | arquivo = open('mobydick.txt', 'r')
texto = arquivo.readlines()[:]
tam = len(texto)
dicionario = dict()
lista = list()
clinha = 1
coluna = 1
for linha in texto:
linha = linha.strip().lower()
palavras = linha.split()
for p in palavras:
if p == '':
coluna += 1
if p in dicionario:
... |
#Write a program that accepts as input a sequence of integers (one by
#one) and then incrementally builds, and displays, a Binary Search Tree
#(BST). There is no need to balance the BST.
class Node:
def __init__(self, number = None):
self.number = number
self.left = None
self.right = None
... | class Node:
def __init__(self, number=None):
self.number = number
self.left = None
self.right = None
def new_node(self, number):
if self.number is None:
self.number = number
elif number > self.number:
if self.right is None:
self.r... |
def catAndMouse(x, y, z):
if abs(x - z) == abs(y - z):
return "Mouse C"
if abs(x - z) > abs(y - z):
return "Cat B"
return "Cat A"
| def cat_and_mouse(x, y, z):
if abs(x - z) == abs(y - z):
return 'Mouse C'
if abs(x - z) > abs(y - z):
return 'Cat B'
return 'Cat A' |
def unboundedKnapsack(maxWeight, numberItems, value, weight):
totValue = [0]*(maxWeight+1)
for i in range(maxWeight + 1):
for j in range(numberItems):
if (weight[j] <= i):
totValue[i] = max(
totValue[i], totValue[i - weight[j]] + value[j])
# print(... | def unbounded_knapsack(maxWeight, numberItems, value, weight):
tot_value = [0] * (maxWeight + 1)
for i in range(maxWeight + 1):
for j in range(numberItems):
if weight[j] <= i:
totValue[i] = max(totValue[i], totValue[i - weight[j]] + value[j])
return totValue[maxWeight]
ma... |
class OtypeFeature(object):
def __init__(self, api, metaData, data):
self.api = api
self.meta = metaData
self.data = data[0]
self.maxSlot = data[1]
self.maxNode = data[2]
self.slotType = data[3]
self.all = None
def items(self):
slotType = s... | class Otypefeature(object):
def __init__(self, api, metaData, data):
self.api = api
self.meta = metaData
self.data = data[0]
self.maxSlot = data[1]
self.maxNode = data[2]
self.slotType = data[3]
self.all = None
def items(self):
slot_type = self.s... |
"""
2520 is the smallest number that can be divided by each of
the numbers from 1 to 10 without any remainder.
What is the smallest positive number that is evenly divisible
by all of the numbers from 1 to 20?
"""
def Euler005(n):
"""Solution of fifth Euler problem."""
found = True
number = 0
while ... | """
2520 is the smallest number that can be divided by each of
the numbers from 1 to 10 without any remainder.
What is the smallest positive number that is evenly divisible
by all of the numbers from 1 to 20?
"""
def euler005(n):
"""Solution of fifth Euler problem."""
found = True
number = 0
while fo... |
class NoDict(dict):
def __getitem__(self, item):
return None
class ParamDefault:
"""
This is the base class for Parameter Defaults.
Credit to khazhyk (github) for this idea.
"""
async def default(self, ctx):
raise NotImplementedError("Must be subclassed.")
class EmptyFlags(Pa... | class Nodict(dict):
def __getitem__(self, item):
return None
class Paramdefault:
"""
This is the base class for Parameter Defaults.
Credit to khazhyk (github) for this idea.
"""
async def default(self, ctx):
raise not_implemented_error('Must be subclassed.')
class Emptyflags(... |
l1 = [1] # 0 [<bool|int>]
l2 = [''] # 0 [<bool|str>]
l3 = l1 or l2
l3.append(True)
l3 # 0 [<bool|int|str>]
| l1 = [1]
l2 = ['']
l3 = l1 or l2
l3.append(True)
l3 |
class ModelAccessException(Exception):
"""Raise when user has no access to the model"""
class ModelNotExistException(Exception):
"""Raise when model is None"""
class AuthenticationFailedException(Exception):
"""Raise when authentication failed."""
| class Modelaccessexception(Exception):
"""Raise when user has no access to the model"""
class Modelnotexistexception(Exception):
"""Raise when model is None"""
class Authenticationfailedexception(Exception):
"""Raise when authentication failed.""" |
#
# PySNMP MIB module S412-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///home/tin/Dev/mibs.snmplabs.com/asn1/S412-MIB
# Produced by pysmi-0.3.4 at Fri Jan 31 21:33:01 2020
# On host bier platform Linux version 5.4.0-3-amd64 by user tin
# Using Python version 3.7.6 (default, Jan 19 2020, 22:34:52)
#
ObjectIden... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, value_size_constraint, constraints_intersection, single_value_constraint) ... |
ajedrez=[[0,1,0,1,0,1,0,1],[1,0,1,0,1,0,1,0],[0,1,0,1,0,1,0,1],[1,0,1,0,1,0,1,0],[0,1,0,1,0,1,0,1],[1,0,1,0,1,0,1,0],[0,1,0,1,0,1,0,1],[1,0,1,0,1,0,1,0]]
print(ajedrez[0][7])
c=0
for x in range(0,8):
for y in range(0,8):
if(ajedrez[x][y]==1):
c+=1
print(c) | ajedrez = [[0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0]]
print(ajedrez[0][7])
c = 0
for x in range(0, 8):
for y in range(0, 8):
if ajedrez[x][y] =... |
def avoidObstacles(inputArray):
'''
You are given an array of integers representing coordinates of obstacles
situated on a straight line.
Assume that you are jumping from the point with coordinate 0 to the right.
You are allowed only to make jumps of the same length represented by some integer... | def avoid_obstacles(inputArray):
"""
You are given an array of integers representing coordinates of obstacles
situated on a straight line.
Assume that you are jumping from the point with coordinate 0 to the right.
You are allowed only to make jumps of the same length represented by some intege... |
N = int(input())
S = str(input())
for i,c in enumerate(S):
if c == '1':
if i % 2 == 0:
print('Takahashi')
else:
print('Aoki')
break
| n = int(input())
s = str(input())
for (i, c) in enumerate(S):
if c == '1':
if i % 2 == 0:
print('Takahashi')
else:
print('Aoki')
break |
name = "EikoNet"
__version__ = "1.0"
__description__ = "EikoNet: A deep neural networking approach for seismic ray tracing"
__license__ = "GPL v3.0"
__author__ = "Jonathan Smith, Kamyar Azizzadenesheli, Zachary E. Ross"
__email__ = "jdsmith@caltech.edu" | name = 'EikoNet'
__version__ = '1.0'
__description__ = 'EikoNet: A deep neural networking approach for seismic ray tracing'
__license__ = 'GPL v3.0'
__author__ = 'Jonathan Smith, Kamyar Azizzadenesheli, Zachary E. Ross'
__email__ = 'jdsmith@caltech.edu' |
companies = {}
while True:
command = input()
if command == "End":
break
spl_command = command.split(" -> ")
name = spl_command[0]
id = spl_command[1]
if name not in companies:
companies[name] = []
companies[name].append(id)
else:
if id in companies[name]:
... | companies = {}
while True:
command = input()
if command == 'End':
break
spl_command = command.split(' -> ')
name = spl_command[0]
id = spl_command[1]
if name not in companies:
companies[name] = []
companies[name].append(id)
elif id in companies[name]:
continue... |
# set declaration
myfruits = {"Apple", "Banana", "Grapes", "Litchi", "Mango"}
mynums = {1, 2, 3, 4, 5}
# Set printing before removing
print("Before pop() method...")
print("fruits: ", myfruits)
print("numbers: ", mynums)
# Elements getting popped from the set
elerem = myfruits.pop()
print(elerem, "is removed from fru... | myfruits = {'Apple', 'Banana', 'Grapes', 'Litchi', 'Mango'}
mynums = {1, 2, 3, 4, 5}
print('Before pop() method...')
print('fruits: ', myfruits)
print('numbers: ', mynums)
elerem = myfruits.pop()
print(elerem, 'is removed from fruits')
elerem = myfruits.pop()
print(elerem, 'is removed from fruits')
elerem = myfruits.po... |
#
# PySNMP MIB module PDN-VLAN-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PDN-VLAN-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:39:52 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,... | (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_intersection, value_size_constraint, constraints_union) ... |
students = []
second_grades = []
for _ in range(int(input())):
name = input()
score = float(input())
student = []
student.append(name)
student.append(score)
students.append(student)
my_min = float('Inf')
for student in students:
if student[1] <= my_min:
my_min = student[1]
for stude... | students = []
second_grades = []
for _ in range(int(input())):
name = input()
score = float(input())
student = []
student.append(name)
student.append(score)
students.append(student)
my_min = float('Inf')
for student in students:
if student[1] <= my_min:
my_min = student[1]
for studen... |
# Write a function that takes an integer as an input and returns the sum of all numbers from the input down to 0.
def sum_to_zero(n):
# print base case
if n == 0:
return n
# if we are not at the base case - if n is not yet zero, then
print("This is a recursive function with input {0}".format(n)... | def sum_to_zero(n):
if n == 0:
return n
print('This is a recursive function with input {0}'.format(n))
return n + sum_to_zero(n - 1)
print(sum_to_zero(10)) |
input = "((((()(()(((((((()))(((()((((()())(())()(((()((((((()((()(()(((()(()((())))()((()()())))))))))()((((((())((()))(((((()(((((((((()()))((()(())()((())((()(()))((()))()))()(((((()(((()()))()())((()((((())()())()((((())()(()(()(((()(())(()(())(((((((())()()(((())(()(()(()(())))(()((((())((()))(((()(()()(((((()()((... | input = '((((()(()(((((((()))(((()((((()())(())()(((()((((((()((()(()(((()(()((())))()((()()())))))))))()((((((())((()))(((((()(((((((((()()))((()(())()((())((()(()))((()))()))()(((((()(((()()))()())((()((((())()())()((((())()(()(()(((()(())(()(())(((((((())()()(((())(()(()(()(())))(()((((())((()))(((()(()()(((((()()((... |
"""Top-level package for Takes."""
__author__ = """Chris Lawlor"""
__email__ = "chris@pymetrics.com"
__version__ = "0.2.0"
| """Top-level package for Takes."""
__author__ = 'Chris Lawlor'
__email__ = 'chris@pymetrics.com'
__version__ = '0.2.0' |
menu = ix.application.get_main_menu()
menu.add_command("Layout>")
menu.add_show_callback("Layout>", "./_show.py")
menu.add_command("Layout>Presets>")
menu.add_show_callback("Layout>", "./presets_show.py")
menu.add_command("Layout>Presets>separator")
menu.add_command("Layout>Presets>Store...", "./presets_store.py")
me... | menu = ix.application.get_main_menu()
menu.add_command('Layout>')
menu.add_show_callback('Layout>', './_show.py')
menu.add_command('Layout>Presets>')
menu.add_show_callback('Layout>', './presets_show.py')
menu.add_command('Layout>Presets>separator')
menu.add_command('Layout>Presets>Store...', './presets_store.py')
menu... |
#!/usr/bin/env python
FIRST_VALUE = 20151125
INPUT_COLUMN = 3083
INPUT_ROW = 2978
MAGIC_MULTIPLIER = 252533
MAGIC_MOD = 33554393
def sequence_number(row, column):
return sum(range(row + column - 1)) + column
def next_code(code):
return (code * MAGIC_MULTIPLIER) % MAGIC_MOD
if __name__ == '__main__':
cod... | first_value = 20151125
input_column = 3083
input_row = 2978
magic_multiplier = 252533
magic_mod = 33554393
def sequence_number(row, column):
return sum(range(row + column - 1)) + column
def next_code(code):
return code * MAGIC_MULTIPLIER % MAGIC_MOD
if __name__ == '__main__':
code_sequence_number = sequen... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.