content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
#ex_086
m = [[],[],[]]
for j in range(3):
for i in range(3):
n = int(input(f'digite o valor para o bloco[{j},{i}]:'))
m[j].append(n)
for l in range(3):
print(m[l])
#ex_087
soma = soma3 = 0
for j in range(3):
for i in range(3):
if int(m[j][i])%2==0:
soma += int(m[j][i])
p... | m = [[], [], []]
for j in range(3):
for i in range(3):
n = int(input(f'digite o valor para o bloco[{j},{i}]:'))
m[j].append(n)
for l in range(3):
print(m[l])
soma = soma3 = 0
for j in range(3):
for i in range(3):
if int(m[j][i]) % 2 == 0:
soma += int(m[j][i])
print(f'letr... |
class AiManager:
def __init__(self, modstring):
self.modlines = modstring
self.fn = self.get_fn()
self.edits = self.get_edits()
def get_fn(self):
return self.modlines[0].split("# ")[1].strip()
def get_edits(self):
return [{"offset": int(e.split(" ")[0], 16)... | class Aimanager:
def __init__(self, modstring):
self.modlines = modstring
self.fn = self.get_fn()
self.edits = self.get_edits()
def get_fn(self):
return self.modlines[0].split('# ')[1].strip()
def get_edits(self):
return [{'offset': int(e.split(' ')[0], 16), 'value... |
# Given an array of integers that is already sorted in ascending order,
# find two numbers such that they add up to a specific target number.
#
# The function twoSum should return indices of the two numbers such
# that they add up to the target, where index1 must be less than index2.
#
# Note:
#
# Your returned answers... | class Solution:
def two_sum(self, numbers, target):
left = 0
right = len(numbers) - 1
while left < right:
total = numbers[left] + numbers[right]
if total == target:
return [left + 1, right + 1]
elif total > target:
right -=... |
companies = {}
command = input()
while not command == "End":
company, emp_id = command.split(" -> ")
if company not in companies:
companies[company] = [emp_id]
else:
if emp_id not in companies[company]:
companies[company].append(emp_id)
command = input()
for company, emp_id... | companies = {}
command = input()
while not command == 'End':
(company, emp_id) = command.split(' -> ')
if company not in companies:
companies[company] = [emp_id]
elif emp_id not in companies[company]:
companies[company].append(emp_id)
command = input()
for (company, emp_ids) in sorted(co... |
tup = ("apple", "banana", "cherry")
it = iter(tup)
print(next(it))
print(next(it))
print(next(it))
#using class
class numbers:
def __iter__(self):
self.a = 1
return self
def __next__(self):
x = self.a
self.a += 1
return x
myclass = numbers()
myiter = iter(myclass)
print(next(myiter))
print... | tup = ('apple', 'banana', 'cherry')
it = iter(tup)
print(next(it))
print(next(it))
print(next(it))
class Numbers:
def __iter__(self):
self.a = 1
return self
def __next__(self):
x = self.a
self.a += 1
return x
myclass = numbers()
myiter = iter(myclass)
print(next(myiter... |
# -*- coding: utf-8 -*-
def main():
a, b, k = map(int, input().split())
takahashi = a
aoki = b
for i in range(k):
if i % 2 == 0:
if takahashi % 2 == 1:
takahashi -= 1
takahashi -= takahashi // 2
aoki += takahashi
else... | def main():
(a, b, k) = map(int, input().split())
takahashi = a
aoki = b
for i in range(k):
if i % 2 == 0:
if takahashi % 2 == 1:
takahashi -= 1
takahashi -= takahashi // 2
aoki += takahashi
else:
if aoki % 2 == 1:
... |
w1 = [[ 0.21188451, -0.07536257, -1.50488397, 1.07709642, -1.00670164, 0.70171048,
0.46828757, 1.61520523, -0.61159711, 0.62985384],
[ 2.62728329, -2.12787044, -0.37743212, -0.03947755, -0.52624001, -1.86089361,
-0.83215303, 0.08603709, -2.79556013, -3.05423877],
[-2.74150917, 2.20029538, -0.66665525, -2.7... | w1 = [[0.21188451, -0.07536257, -1.50488397, 1.07709642, -1.00670164, 0.70171048, 0.46828757, 1.61520523, -0.61159711, 0.62985384], [2.62728329, -2.12787044, -0.37743212, -0.03947755, -0.52624001, -1.86089361, -0.83215303, 0.08603709, -2.79556013, -3.05423877], [-2.74150917, 2.20029538, -0.66665525, -2.73734087, -1.440... |
DEBUG = True
TABLE_NAME = "users"
PERMANENT_SESSION_LIFETIME = 1260
TIMEOUT_WARNING_MS = 900000
TIMEOUT_LOGOUT_MS = 1200000
KEEPALIVE_INTERVAL_MS = 60000
SITE_NAME = 'GREP Annotation Viewer' | debug = True
table_name = 'users'
permanent_session_lifetime = 1260
timeout_warning_ms = 900000
timeout_logout_ms = 1200000
keepalive_interval_ms = 60000
site_name = 'GREP Annotation Viewer' |
class preprocess:
words_0 = {}
words_1 = {}
cnt_0 = 0
cnt_1 = 0
content = []
def __init__(self,file1):
self.file1 = file1
def split_file_test_train(self,a,b):
f1 = open("train.txt", "w")
f2 = open("test.txt", "w")
lines = []
with open(self.file1.name) ... | class Preprocess:
words_0 = {}
words_1 = {}
cnt_0 = 0
cnt_1 = 0
content = []
def __init__(self, file1):
self.file1 = file1
def split_file_test_train(self, a, b):
f1 = open('train.txt', 'w')
f2 = open('test.txt', 'w')
lines = []
with open(self.file1.n... |
'''
This program will take multiple inputs from the user and when he enters done
as his last input it will return largest and smallest values of user's
respective inputs
'''
#we are using none as in the loop first value will replace them automatically
largest = None
smallest = None
while True:
num = input('Inp... | """
This program will take multiple inputs from the user and when he enters done
as his last input it will return largest and smallest values of user's
respective inputs
"""
largest = None
smallest = None
while True:
num = input('Input Number: ')
if num == 'done':
break
try:
fnum = float(... |
{
'variables' : {
'xmpmeta_dir': '<(DEPTH)/third_party/xmpmeta/internal/xmpmeta',
},
'target_defaults': {
'include_dirs' : [
'<(xmpmeta_dir)/external',
'<(xmpmeta_dir)/external/miniglog',
],
},
'targets': [
{
'target_name': 'xmpmeta_strings',
'dependencies': [
'... | {'variables': {'xmpmeta_dir': '<(DEPTH)/third_party/xmpmeta/internal/xmpmeta'}, 'target_defaults': {'include_dirs': ['<(xmpmeta_dir)/external', '<(xmpmeta_dir)/external/miniglog']}, 'targets': [{'target_name': 'xmpmeta_strings', 'dependencies': ['<(xmpmeta_dir)/external/miniglog/glog/glog.gyp:xmpmeta_glog'], 'type': 's... |
# These CPC codes are international classifiers for patents.
# This dict is imported by patenttools.lookup and is used to provide the "patent class".
cpc_codes = {
'B29L': 'INDEXING SCHEME ASSOCIATED WITH SUBCLASS B29C, RELATING TO PARTICULAR ARTICLES',
'D01D': 'MECHANICAL METHODS OR APPARATUS IN THE MANUFACTUR... | cpc_codes = {'B29L': 'INDEXING SCHEME ASSOCIATED WITH SUBCLASS B29C, RELATING TO PARTICULAR ARTICLES', 'D01D': 'MECHANICAL METHODS OR APPARATUS IN THE MANUFACTURE OF ARTIFICIAL FILAMENTS, THREADS, FIBRES, BRISTLES OR RIBBONS', 'A47F': 'SPECIAL FURNITURE, FITTINGS, OR ACCESSORIES FOR SHOPS, STOREHOUSES, BARS, RESTAURANT... |
class Antecedent():
def __init__(self, template, template_property, value):
self.template = template
self.template_property = template_property
self.value = value
class TestAntecedent():
def __init__(self, operation, *parametres):
self.parameters = []
self.oper... | class Antecedent:
def __init__(self, template, template_property, value):
self.template = template
self.template_property = template_property
self.value = value
class Testantecedent:
def __init__(self, operation, *parametres):
self.parameters = []
self.operation = oper... |
n = int(input())
for i in range(n):
nota01, nota02, nota03 = map(float, input().split())
total = ((nota01*2) + (nota02*3) + (nota03*5))/10
print('%.1f' % round(total, 1)) | n = int(input())
for i in range(n):
(nota01, nota02, nota03) = map(float, input().split())
total = (nota01 * 2 + nota02 * 3 + nota03 * 5) / 10
print('%.1f' % round(total, 1)) |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
# https://leetcode.com/problems/merge-k-sorted-lists
# Other solutions:
'''
https://leetcode.com/problems/merge-k-sorted-lists/discuss/1810642/C%2B%2B-oror-Priority-Queu... | """
https://leetcode.com/problems/merge-k-sorted-lists/discuss/1810642/C%2B%2B-oror-Priority-Queue-oror-23.-Merge-k-Sorted-Lists
1. Creates a priority queue, inserting all input linked lists, sorted based on node values: HOW??
1.1. Each node in the queue is <value, node-pointer>
1.2. How q.push({list->val,list});... |
CARD_SUITS = ("SPADES", "HEARTS", "DIAMONDS", "CLUBS")
PLAYERS_DEFAULT = 2
DECKS_AMOUNT = 1
RANDOM_NAMES = [
"Geralt of Rivia",
"Ciri of Cintra",
"Yennefer of Vengerberg",
"Triss Merigold",
"Dandelion",
"Mousesack",
"Gaunter O'Dimm",
"Keira Metz",
"Emhyr var Emreis",
"The Angry S... | card_suits = ('SPADES', 'HEARTS', 'DIAMONDS', 'CLUBS')
players_default = 2
decks_amount = 1
random_names = ['Geralt of Rivia', 'Ciri of Cintra', 'Yennefer of Vengerberg', 'Triss Merigold', 'Dandelion', 'Mousesack', "Gaunter O'Dimm", 'Keira Metz', 'Emhyr var Emreis', 'The Angry Shiba Inu']
default_turn_time_seconds = 1 |
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) |
#!/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') |
#!/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... |
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... |
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 |
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... |
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) |
#
# 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... |
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 |
# 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 |
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... |
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) |
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' |
#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,... |
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... |
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 |
#
# 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 = '((((()(()(((((((()))(((()((((()())(())()(((()((((((()((()(()(((()(()((())))()((()()())))))))))()((((((())((()))(((((()(((((((((()()))((()(())()((())((()(()))((()))()))()(((((()(((()()))()())((()((((())()())()((((())()(()(()(((()(())(()(())(((((((())()()(((())(()(()(()(())))(()((((())((()))(((()(()()(((((()()((... |
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... |
class Solution:
def dfs(self,row_cnt:int, col_cnt:int, i:int, j:int, solve_dict:dict):
if (i, j) in solve_dict:
return solve_dict[(i,j)]
right_cnt = 0
down_cnt = 0
#right
if i + 1 < row_cnt:
if (i + 1, j) in solve_dict:
right_cnt = sol... | class Solution:
def dfs(self, row_cnt: int, col_cnt: int, i: int, j: int, solve_dict: dict):
if (i, j) in solve_dict:
return solve_dict[i, j]
right_cnt = 0
down_cnt = 0
if i + 1 < row_cnt:
if (i + 1, j) in solve_dict:
right_cnt = solve_dict[i ... |
'''
Kept for python2.7 compatibility.
'''
__all__ = []
| """
Kept for python2.7 compatibility.
"""
__all__ = [] |
STATE_NOT_STARTED = "NOT_STARTED"
STATE_COIN_FLIPPED = "COIN_FLIPPED"
STATE_DRAFT_COMPLETE = "COMPLETE"
STATE_BANNING = "BANNING"
STATE_PICKING = "PICKING"
USER_READABLE_STATE_MAP = {
STATE_NOT_STARTED: "Not started",
STATE_BANNING: "{} Ban",
STATE_PICKING: "{} Pick",
STATE_DRAFT_COMPLETE: "Draft compl... | state_not_started = 'NOT_STARTED'
state_coin_flipped = 'COIN_FLIPPED'
state_draft_complete = 'COMPLETE'
state_banning = 'BANNING'
state_picking = 'PICKING'
user_readable_state_map = {STATE_NOT_STARTED: 'Not started', STATE_BANNING: '{} Ban', STATE_PICKING: '{} Pick', STATE_DRAFT_COMPLETE: 'Draft complete'}
next_state =... |
#!/usr/bin/env python3
try: # try the following code
print(a) # won't work since we have not defined a
except: # if there is ANY error
print('a is not defined!') # print this
try:
... | try:
print(a)
except:
print('a is not defined!')
try:
print(a)
except NameError:
print('a is still not defined!')
except:
print('Something else went wrong.')
print(a) |
n, k = map(int, input().split())
coin = sorted([int(input()) for _ in range(n)])
lst = [[0]*(k+1)]*n+[[1]*(k+1)]
lst[0] = [1 if j%coin[0]==0 else 0 for j in range(0,k+1)]
for i in range(0, len(coin)):
lst[i] = [sum([lst[i-1][j - (k * coin[i])] for k in range((j//coin[i])+1)]) for j in range(k+1)]
print(lst[n-1][k]) | (n, k) = map(int, input().split())
coin = sorted([int(input()) for _ in range(n)])
lst = [[0] * (k + 1)] * n + [[1] * (k + 1)]
lst[0] = [1 if j % coin[0] == 0 else 0 for j in range(0, k + 1)]
for i in range(0, len(coin)):
lst[i] = [sum([lst[i - 1][j - k * coin[i]] for k in range(j // coin[i] + 1)]) for j in range(k... |
class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
class_name = cls.__name__
if class_name not in cls._instances:
cls._instances[class_name] = super(Singleton, cls).__call__(*args, **kwargs)
return cls._instances[class_name]
| class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
class_name = cls.__name__
if class_name not in cls._instances:
cls._instances[class_name] = super(Singleton, cls).__call__(*args, **kwargs)
return cls._instances[class_name] |
{
"targets": [
{
"target_name": "samplerproxy",
"sources": [ "src/node_sampler_proxy.cpp" ],
"include_dirs": [
# Path to hopper root
],
"libraries": [
# Path to hopper framework library
# Path to hopper histogram library
],
"cflags" : [ "-std=c++11... | {'targets': [{'target_name': 'samplerproxy', 'sources': ['src/node_sampler_proxy.cpp'], 'include_dirs': [], 'libraries': [], 'cflags': ['-std=c++11', '-stdlib=libc++'], 'conditions': [['OS!="win"', {'cflags+': ['-std=c++11'], 'cflags_c+': ['-std=c++11'], 'cflags_cc+': ['-std=c++11']}], ['OS=="mac"', {'xcode_settings': ... |
class Solution:
def judgeCircle(self, moves: str) -> bool:
M = {
'U': (0, -1),
'D': (0, 1),
'R': (1, 0),
'L': (-1, 0)
}
x, y = 0, 0
for move in moves:
dx, dy = M[move]
x += dx
y += dy
retur... | class Solution:
def judge_circle(self, moves: str) -> bool:
m = {'U': (0, -1), 'D': (0, 1), 'R': (1, 0), 'L': (-1, 0)}
(x, y) = (0, 0)
for move in moves:
(dx, dy) = M[move]
x += dx
y += dy
return x == 0 and y == 0 |
class Animal(object):
def run(self):
print('Animal is running...')
class Dog(Animal):
def run(self):
print('Dog is running...')
class Cat(Animal):
pass
dog = Dog()
dog.run()
cat = Cat()
cat.run() | class Animal(object):
def run(self):
print('Animal is running...')
class Dog(Animal):
def run(self):
print('Dog is running...')
class Cat(Animal):
pass
dog = dog()
dog.run()
cat = cat()
cat.run() |
x=9
y=3
#Im only gonna comment here but i'll separate all the operater by new lines
#Same progression as the slides
print(x+y)
print(x-y)
print(x*y)
print(x/y)
print(x%y)
print(x**y)
x=9.919555555
print(x//y)
x=9
x+=3
print(x)
x=9
x-=3
print(x)
x*=3
print(x)
x/=3
print(x)
x ** 3
pri... | x = 9
y = 3
print(x + y)
print(x - y)
print(x * y)
print(x / y)
print(x % y)
print(x ** y)
x = 9.919555555
print(x // y)
x = 9
x += 3
print(x)
x = 9
x -= 3
print(x)
x *= 3
print(x)
x /= 3
print(x)
x ** 3
print(x)
x = 9
x = 3
print(x == y)
print(x != y)
print(x > y)
print(x < y)
print(x >= y)
print(x <= y) |
# Configuration
# Flask
DEBUG = True
UPLOAD_FOLDER = "/tmp/uploads"
MAX_CONTENT_LENGTH = 16 * 1024 * 1024 # 16MB
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
# Flask-SQLAlchemy
SQLALCHEMY_DATABASE_URI = "sqlite:////tmp/db.sqlite"
| debug = True
upload_folder = '/tmp/uploads'
max_content_length = 16 * 1024 * 1024
allowed_extensions = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
sqlalchemy_database_uri = 'sqlite:////tmp/db.sqlite' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.