content stringlengths 7 1.05M |
|---|
def findDecision(obj): #obj[0]: Coupon, obj[1]: Education, obj[2]: Occupation, obj[3]: Distance
# {"feature": "Coupon", "instances": 51, "metric_value": 0.9975, "depth": 1}
if obj[0]>1:
# {"feature": "Education", "instances": 37, "metric_value": 0.9353, "depth": 2}
if obj[1]>0:
# {"feature": "Occupation", "ins... |
# -*- coding: utf-8 -*-
"""
Auth* related model.
This is where the models used by the authentication stack are defined.
It's perfectly fine to re-use this definition in the redrugs application,
though.
"""
|
#! /Users/michael/anaconda3/bin/python
# @Date: 2018-09-01 09:00:44
# 评分算法实现
# 基础天梯分数
R0 = 1400
def rating(Ra, Rb):
"""
Ra: 赢的一方玩家 a 的分数
Rb: 输的一方玩家 b 的分数
"""
# K值,用于控制分数改变的幅度,数字越大幅度越大
K = 16
Sa = 1
Sb = 0
Ea = 1 / (1 + 10**((Ra - Rb)/400))
Eb = 1 / (1 + 10**((Rb - Ra)/400))... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2020, Brian Scholer <@briantist>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
DOCUMENTATION = r'''
---
module: win_psrepository_copy
short_description: Copies registered PSRepositories to other user profiles
ver... |
# -*- coding: utf-8 -*-
__version__ = '4.4.0'
__description__ = """Sequoia Python Client SDK"""
__url__ = "https://github.com/pikselpalette/sequoia-python-client-sdk"
__author__ = 'Piksel'
|
print('Olá mundo!')
# A função print recebe um argumento, ou mais.
print('Tudo', 'otimo', '?')
# Argumentos nomeados
print('Cleberton', 'Francisco', sep='-') # separador sera -
print('Esta', 'Tudo', 'bem?', end='... \n') # adiciona algo no final da string
print('826', '231', '070', sep='.', end='-') # Formatan... |
class MockupSpineLog(object):
def debug(self, message, *args):
pass
class MockupSpine(object):
def __init__(self):
self.queryHandlers = {}
self.commandHandlers = {}
self.eventHandlers = {}
self.events={}
self.log = MockupSpineLog()
def register_query_handler... |
class BaseError(Exception):
"""Base error class"""
pass
class UtilError(BaseError):
"""Base util error class"""
pass
class CCMAPIError(UtilError):
"""Raised when a ccm_api returned status is not `ok`"""
pass |
def interchange(array,k):
low,high,n = 0, len(array)-1,len(array)
x = min(k,n-k)
for i in range(x):
array[low],array[high] = array[high],array[low]
low +=1
high -= 1
def rotateArray(array,k):
for i in range(k):
temp = array[0]
for j in range(len(array)-1):
... |
class TestClass:
def test_deepsegmenter(self):
"""here is my test code
https://docs.pytest.org/en/stable/getting-started.html#create-your-first-test
"""
# no test now
assert True
|
"""
RISC-V disassemble helper
(c) 2019 The Bonfire Project
License: See LICENSE
"""
abi_regnames = ( "zero","ra","sp","gp","tp","t0","t1","t2","s0","s1","a0","a1","a2","a3","a4","a5", \
"a6","a7","s2","s3","s4","s5","s6","s7","s8","s9","s10","s11","t3","t4","t5","t6")
def abi_name(x):
return ab... |
class Record():
def __init__(self, record_id, parent_id):
self.record_id = record_id
self.parent_id = parent_id
class Node():
def __init__(self, node_id):
self.node_id = node_id
self.children = []
def BuildTree(records):
root = None
records.sort(key=lambda x: x.record... |
def restrict_level(mobs, level):
for mob, priority in mobs:
if level < mob.level:
continue
yield (mob, priority)
def restrict_terrain(mobs, terrain):
for mob, priority in mobs:
if terrain not in mob.terrains:
continue
yield (mob, priority)
def restri... |
# noinspection PyBroadException
def computegrade(score):
try:
score = float(input("Enter the score"))
if score >= 0.9:
print("Grade A")
elif score >= 0.8:
print("Grade B")
elif score >= 0.7:
print("Grade C")
elif score >= 0.6:
p... |
""" LOL! I need = (One; Javascript) ~please . bin/djet.lang:print
:Note! 13; Street, Lulin10, Sofia; Boril B. Boyanov; (13 = Streetno); ...
([&1] -> Small Addreess) ~please Nigga, Im :l33t{wracker, hacker, physici\
an & physicist} """
|
# __init__.py
# Copyright 2021 Roger Marsh
# Licence: See LICENCE (BSD licence)
"""Access Berkeley DB database of chess games using berkeleydb package.
This interface can be used if the berkeleydb package is installed.
berkeleydb is available as a source package, from PyPI for example.
Follow the instructions to bu... |
'''
На вход программе подается два целых числа. Напишите программу, которая выводит разницу их произведения с их суммой.
Sample Input 1:
3
4
Sample Output 1:
5
Sample Input 2:
10
15
Sample Output 2:
125
'''
n1, n2 = int(input()), int(input())
print(n1 * n2 - (n1 + n2))
|
"""Shared modules for template-based document generation.
This is how the file generation from a yWriter project is generally done:
The write method runs through all chapters, scenes, and world building
elements, such as characters, locations ans items, and fills templates.
The package's README file contains ... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
cases = int(input())
for case in range(cases):
k,p = [int(x) for x in input().split(' ')]
print(k,int(p+(p*(p+1))/2))
|
test_cases = int(input().strip())
def get_days_of_month(month):
if month == 2:
return 28
if month in [1, 3, 5, 7, 8, 10, 12]:
return 31
return 30
for i in range(1, test_cases + 1):
month1, day1, month2, day2 = map(int, input().strip().split())
if month1 == month2:
print(... |
#
# PySNMP MIB module CISCO-DOT11-QOS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DOT11-QOS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:38:30 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... |
def fibonacci(n):
a = 1
b = 1
while b <= n:
yield b
a, b = b, a + b
print("Numbers:", list(fibonacci(40)))
print("Sum:", sum(filter(lambda x: x % 2 == 0, fibonacci(4e6)))) |
class NeureCtr:
def __init__(self, content_label):
self._uuid = content_label
self._relevants = {}
@property
def uuid(self):
return self._uuid
@property
def relevants(self):
return self._relevants
@relevants.setter
def relevants(self, value):
if valu... |
def boxplot(x_data, y_data, base_color="#539caf", median_color="#297083", x_label="", y_label="", title=""):
_, ax = plt.subplots()
# Draw boxplots, specifying desired style
ax.boxplot(y_data
# patch_artist must be True to control box fill
, patch_artist = True
... |
# -*- coding: utf-8 -*-
def get_lam_list(self, is_int_to_ext=True):
"""Returns the ordered list of lamination of the machine
Parameters
----------
self : MachineUD
MachineUD object
is_int_to_ext : bool
true to order the list from the inner lamination to the extrenal one
Retur... |
def lambda_handler(event, context):
# TODO implement
return {
'statusCode': 200,
'body': 'Hello from Lambda!'
}
|
#
# PySNMP MIB module WLSX-SYSTEMEXT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WLSX-SYSTEMEXT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:30:06 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... |
with open('input', 'r') as f:
lengths = [ord(x) for x in f.read()] + [17, 31, 73, 47, 23]
inp = [x for x in range(0, 256)]
curr_position = 0
skip_size = 0
for i in range(64):
for length in lengths:
start_sublist = []
if curr_position + length >= len(inp):
start_sublist = inp[0:curr_... |
products = {'gucci boots': 10000, 'channel': 20000, 'adidas boots': 8000,
'nike sport-suit': 23000, 'gucci sport-suit': 24000,
'Lonsdale suit': 8000, 'nike boots': 9000,
'dior chest': 10000, 'raben waist': 15000,
'wedding dress': 500000}
user = 'user'
password = 'user123... |
def l1_norm(lst):
"""
Calculates the l1 norm of a list of numbers
"""
return sum([abs(x) for x in lst])
def l2_norm(lst):
"""
Calculates the l2 norm of a list of numbers
"""
return sum([x*x for x in lst])
def linf_norm(lst):
"""
Calculates the l_infinity norm of a list of n... |
'''
Textos podem conter mensagens ocultas. Neste problema a mensagem oculta em um texto é composto pelas primeiras letras de cada palavra do texto, na ordem em que aparecem.
É dado um texto composto apenas por letras minúsculas ou espaços. Pode haver mais de um espaço entre as palavras. O texto pode iniciar ou termina... |
#!/usr/bin/env python
__author__ = "bt3"
class Queue(object):
def __init__(self):
self.in_stack = []
self.out_stack = []
def _transfer(self):
while self.in_stack:
self.out_stack.append(self.in_stack.pop())
def enqueue(self, item):
return self.in_stack.append... |
print("----------------------------------------------")
print(" Even/Odd Number Identifier")
print("----------------------------------------------")
play_again = 'Y'
while play_again == 'Y':
user_num = input("Enter any whole number: ")
user_int = int(user_num)
if user_int % 2 == 0:
print("... |
# 1. Exemplo de um trecho de codigo sem o uso da interupcao de repeticoes.
num = soma = 0
while num != 90:
num = int(input("Digite um numero: "))
soma += num
soma -= 90
print(f"A soma dos valores e' igual a {soma}.")
print("FIM!")
# 2. Com a interupcao de repeticoes while.
n = s = 0
while True:
n = int(inp... |
# coding=utf-8
b1 = bytes()
print(b1)
b2 = b'hello'
print(b2)
b3 = bytes('我爱Python', encoding='utf-8')
print(b3)
st3 = b3.decode("utf-8")
print(st3)
|
M_PI = 3.14159265358979323846
EPSILON = 1.0e-38
MAX_TRANSIENTS = 4
BASE_N = 44 # The base number of segments of tract. |
#!/usr/bin/env python3
# Create a function named remove_middle which has three parameters named
# lst, start, and end. The function should return a list where all elements
# in lst with an index between start and end(inclusive) have been removed.
def remove_middle(lst, start, end):
return lst[:start] + lst[end+1:]
... |
user_input = input("Type a two digit number: ")
first_digit = user_input[0]
second_digit = user_input[1]
print(int(first_digit) + int(second_digit)) |
__program__ = "config"
__version__ = "0.1.0"
__author__ = "Darcy Jones"
__date__ = "30 December 2014"
__author_email__ = "darcy.ab.jones@gmail.com"
__license__ = """
##############################################################################
Copyright (C) 2014 Darcy Jones
This program is free software: yo... |
"""
Python makes performing file I/O simple. Take a look
at how to read and write to files here:
https://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files
"""
# Open up the "foo.txt" file (which already exists) for reading
# Print all the contents of the file, then close the file
# YOUR CODE HER... |
"""
List of variables common to every workflow, that can change the result in multiple workflows
"""
# Table Names
COMPANY_TABLE = "companies"
COMPANY_USERS_TABLE = "company_users"
SURVEYS_REPLIES_TABLE = "survey_replies"
COMPANIES_TABLE = 'companies'
SURVEYS_QUESTIONS_TABLE = 'survey_questions'
SURVEYS_ITERATIONS_TAB... |
def steps(number):
'''
The Collatz Conjecture or 3x+1 problem.
Given a number n, return the number of steps required to reach 1.
:param number:
:return:
'''
# The Collatz Conjecture is only concerned with strictly positive integers,
# so your solution should raise a ValueError with a me... |
class Word:
def __init__(self):
self.hanzi = ''
self.pinyin = ''
self.english = ''
self.strokes = []
self.mnemonics = ''
self.audio = ''
self.notes = ''
def __str__(self):
format_str = '{} ({}) - {}\n'
return format_str.format(self.hanzi, ... |
########################################
# QUESTION
########################################
# The goal of this exercise is to convert a string to a new string where each character in the new string is "(" if that character appears only once in the original string, or ")" if that character appears more than once in th... |
x = "zabavan"
print("Python je " + x)
#string concatenation primjer:
x_conc = "Python je "
y_conc = "zabavan"
spojeno = x_conc + y_conc #U ovom slučaju varijablom 'spojeno' spajamo x_conc i y_conc
print(spojeno) |
try:
None < 0
def NoneAndDictComparable(v):
return v
except TypeError:
# comparator to allow comparisons against None and dict
# comparisons (these were allowed in Python 2, but aren't allowed
# in Python 3 any more)
class NoneAndDictComparable(object):
def __init__(self, value)... |
"""Function class."""
def hello(name='persona', lastname='exposito'):
"""Function that return 'Hello World'.
name: string,
lastname: string,
return:string
"""
if name != 'persona':
return f'¿Como estas {name}?'
return f'Hola {name} {lastname}'
print(hello(lastname=5, name=True)) |
# pylint: disable=W0613, C0111, C0103, C0301
"""
The software package.
version: 4.1
ExtronLibraray version: 3.1r5
ControlScript version: 3.1.8
GlobalScripter version: 2.1.0.116
Release date: 13.11.2018
Author: Roni Starc (roni.starc@gmail.com)
ChangeLog:
v2.0 - Fixed some mistakes, updated GS v2.8.r3, a... |
class Transect:
def __init__(self, name="Transect", files=[]):
self.name = name
self.files = files
@property
def numFiles(self):
return len(self.files)
@property
def firstLastText(self):
first = self.files[0]
last = self.files[-1]
return f"{first.nam... |
def fib(n):
if n == 0 or n == 1:
return 1
else:
answer = fib(n-1) + fib(n-2)
return answer
def memoise(f):
memo = {}
def g(n):
if n in memo:
return memo[n]
else:
answer = f(n)
memo[n] = answer
return answer
re... |
def get_start_button(user_id):
_hero = db.get_hero(user_id)
set_hand(user_id, start_game_hand)
button = [['👤Герой','🏕B приключeниe'],['🏛Город'],['⚙️Профиль', '👥Гильдия']]
return button
def start_game(user_id):
text = get_hero(user_id)
button = get_start_button(user_id)
send_message(user... |
f = open('input.txt')
time = int(f.readline()[:-1])
busses = [[int(bus), i] for i, bus in enumerate(f.readline()[:-1].split(',')) if bus != 'x']
product = 1
for bus in busses:
product *= bus[0]
res = 0
for bus in busses:
l = product / bus[0] % bus[0]
k = 1
tmp = l
while l % bus[0] != 1:
... |
filepath = '/Users/royce/Dropbox/Documents/Memorize/web/blank.txt'
with open(filepath, 'r') as f:
card_count = 0
card = ""
do_skip = False
template = """@Tags: {}
{}
{}
"""
for line in f:
in_html5 = 'Not supported in HTML5' not in line
if line.strip(' ') != "\n":
... |
#
# PySNMP MIB module ALCATEL-IND1-IPX-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALCATEL-IND1-IPX-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:18:07 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... |
def importEXPH(fdata):
ENCHVM = dict()
MOTORI = dict()
cline = 3
while cline < len(fdata):
coduhe = fdata[cline][0:5].strip()
nome = fdata[cline][5:18].strip()
if fdata[cline][17:43].strip():
# Enchimento de Volume Morto
iniench = fdata[cline][17:26].strip... |
with open('Chal08.txt','r') as f:
sum = 0
for i in f.readlines():
i = i.strip().split(' | ')
output = i[1].split()
for i in output:
if len(i) == 2 or len(i) == 4 or len(i) == 3 or len(i) == 7:
sum += 1
print(sum)
|
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 1 19:39:48 2019
@author: amukher3
"""
def remove_smallest(numbers):
a=numbers[:]
if a ==[]:
return a
else:
a.remove(min(a))
return a
|
class Solution(object):
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
if not prices:
return 0
ans = 0
pre = prices[0]
for i in range(1, len(prices)):
pre = min(pre, prices[i])
a... |
#!/usr/bin/python
# This file is used as a global config file while PCBmodE is running.
# DO NOT EDIT THIS FILE
cfg = {} # PCBmodE configuration
brd = {} # board data
stl = {} # style data
pth = {} # path database
msg = {} # message database
stk = {} # stackup data
|
# -*- coding: utf-8 -*-
"""
[memo.py]
Memory Use Illustration Plugin
[Author]
Abdur-Rahmaan Janhangeer, pythonmembers.club
[About]
responds to .memo, demo of a basic memory plugin
[Commands]
>>> .memo add <key> <value>
>>> .memo rem <key>
>>> .memo fetch <key>
"""
class Plugin:
def __init__(self):
pass... |
# coding: utf-8
a_tuple = ('crazyit', 20, 5.6, 'fkit', -17)
# 访问从第2个到倒数第4个(不包含)所有元素
print(a_tuple[1: 3]) # (20, 5.6)
# 访问从倒数第3个到倒数第1个(不包含)所有元素
print(a_tuple[-3: -1]) # (5.6, 'fkit')
# 访问从第2个到倒数第2个(不包含)所有元素
print(a_tuple[1: -2]) # (20, 5.6)
# 访问从倒数第3个到第5个(不包含)所有元素
print(a_tuple[-3: 4]) # (5.6, 'fkit')
b_tuple = (... |
"""Blacklist particular articles from doing particular activities"""
def publication_email_article_do_not_send_list():
"""
Return list of do not send article DOI id
"""
do_not_send_list = [
"00003", "00005", "00007", "00011", "00012", "00013", "00031", "00036", "00047", "00048",
"00049... |
class JSONDL(object):
def __init__(self, jsondl_url=None, jsondl_data=None):
pass
def __attrMethod(self, method):
class MethodCaller(object):
#TODO: This implementation is horrible improve both code and apijson
def __init__(self, ssp_instance, method):
... |
#Algoritmos Computacionais e Estruturas de Dados
#Lista de exercício função e recursão
#Prof.: Laercio Brito
#Dia: 16/12/2021
#Turma 2BINFO
#Alunos:
#Dora Tezulino Santos
#Guilherme de Almeida Torrão
#Mauro Campos Pahoor
#Victor Kauã Martins Nunes
#Victor Pinheiro Palmeira
#Lucas Lima
#Questão 1
def ler_bin(binario,v... |
# -*- coding: utf-8 -*-
translations = {
# Days
'days': {
0: 'søndag',
1: 'mandag',
2: 'tirsdag',
3: 'onsdag',
4: 'torsdag',
5: 'fredag',
6: 'lørdag'
},
'days_abbrev': {
0: 'søn',
1: 'man',
2: 'tir',
3: 'ons',
... |
f = open("input", "r").read()
f = f[:-1] # remove trailing char
floor = 0
position = 1
entered_basement = False
for i in f:
if i == '(':
floor = floor + 1
else:
floor = floor - 1
if (floor < 0) and (entered_basement == False):
print('entering basement on move ' + str(position))
... |
########################################################################################################################
########################################################################################################################
##############################################################################... |
'''
Strange substraction
Input
The first line of the input contains two integer numbers 𝑛
and 𝑘 (2≤𝑛≤109, 1≤𝑘≤50) — the number from which Tanya will subtract and the number of subtractions correspondingly.
Output
Print one integer number — the result of the decreasing 𝑛 by one 𝑘 times.
It is guaranteed... |
def generate_instance_identity_document(instance):
return {
"instanceId": instance.id,
}
|
# iterating over a list
print('-- list --')
a = [1,2,3,4,5]
for x in a:
print(x)
# iterating over a tuple
print('-- tuple --')
a = ('cats','dogs','squirrels')
for x in a:
print(x)
# iterating over a dictionary
# sort order in python is undefined, so need to sort the results
# explictly before comparing output... |
def _get_combined_method(method_list):
def new_func(*args, **kwargs):
[m(*args, **kwargs) for m in method_list]
return new_func
def component_method(func):
""" method decorator """
func._is_component_method = True
return func
class Component(object):
""" data descriptor """
_is_com... |
# Se define la clase "piso" con 4 atributos
class piso():
numero = 0
escalera = ''
ventanas = 0
cuartos = 0
# Se le da la funcion "timbre" a cada piso
def timbre(self):
print("ding dong")
# __init__ se usa para "llenar" los 4 atributos preestablecidos
def __init__(s... |
'''
Blockchain Backup version.
Copyright 2020-2022 DeNova
Last modified: 2022-02-01
'''
CURRENT_VERSION = '1.3.5'
|
#Desenvolva um programa que leia as duas nota de um aluno, calcule e mostre a sua média.
n1 = float(input('Primeira nota: '))
n2 = float(input('Segunda nota: '))
m = (n1 + n2) / 2
print('O calculo entre as notas {} e {}, a média é {}'.format(n1,n2,m)) |
for i in range(1, 5):
print(" "*(4-i), end="")
for j in range(1, 2*i):
print("*", end="")
print()
for i in range(1, 4):
print(" "*(i), end="")
for j in range(7-2*i):
print("*", end="")
print()
|
class Lint:
def __init__(self, file):
pass
|
def sort(keys):
_sort(keys, 0, len(keys)-1, 0)
def _sort(keys, lo, hi, start):
if hi <= lo:
return
lt = lo
gt = hi
v = get_r(keys[lt], start)
i = lt + 1
while i <= gt:
c = get_r(keys[i], start)
if c < v:
keys[lt], keys[i] = keys[i], keys[lt]
... |
#!/usr/bin/python
#coding = utf-8
class average:
"""
This is the base class of average. Inherit from this class will make
attribute into the average version.
"""
def __init__(self,numberOfSamplesNum):
self.numberOfSamples = numberOfSamplesNum
def setNumberOfSamples(self,numberOfSamples... |
c = get_config()
# Add users here that are allowed admin access to JupyterHub.
c.Authenticator.admin_users = ["instructor1"]
# Add users here that are allowed to login to JupyterHub.
c.Authenticator.whitelist = [
"instructor1", "instructor2", "student1", "student2", "student3"
]
|
# -*- coding: utf-8 -*-
HOST = '0.0.0.0'
PORT = 4999
DEBUG = 'true'
APP_NAME = 'DingDing'
DOMAIN = 'https://oapi.dingtalk.com/'
|
class Movie:
def __init__(self, movie_id, category, title, genres, year, minutes, language, actors, director, imdb):
self.id = movie_id
self.category = category
self.title = title
self.genres = genres
self.year = year
self.minutes = minutes
self.language = lan... |
#!/usr/bin/env python3
operations = {
'a': lambda a, b : a+b,
's': lambda a, b : a-b,
'm': lambda a, b : a*b,
'd': lambda a, b : a/b,
}
data = [
['a', 4, 5],
['d', 0, 3],
['m', 4, 8],
['s', 1, 4],
]
[el.append(operations[el[0]](el[1], el[2])) for el in... |
# -*- coding: utf-8 -*-
__version__ = '3.0.0'
__description__ = 'Password generator to generate a password based\
on the specified pattern.'
__author__ = 'rgb-24bit'
__author_email__ = 'rgb-24bit@foxmail.com'
__license__ = 'MIT'
__copyright__ = 'Copyright 2018 - 2019 rgb-24bit'
|
class SRTF():
processes = []
map_ordered_by_entry = {}
total_time = 0
count_processes = 0
wait_list = []
actual_process = None
def __init__(self, *procesos):
self.processes = procesos
self.map_ordered_by_entry.clear()
for proceso in self.processes:
self.... |
class C2:
pass
class C3:
pass
class C1(C2, C3):
print("passing")
class C1(C2, C3):
"""
If a class wants to guarantee that an attribute like name is always set in its instances,
it more typically will fill out the attribute at construction time, like this:
"""
def __init__(self, who): # Set name when constructe... |
def post_register_types(root_module):
root_module.add_include('"ns3/propagation-module.h"')
|
class Cache(dict):
def __init__(self):
self['test_key'] = 'test_value'
|
Classes = ['GFI1-1', 'O622-8', 'GFI1-2', 'XGI2', 'E1-63', 'fake', 'O2500-4',
'O9953', 'unrecognizable', 'O622-4', 'GFI2', 'others', '10GFEC', 'empty',
'GFI2-R', 'O155-8', 'GFI1-3', 'O2500']
serial = list(range(len(Classes)))
# Classes = dict(zip(Classes, serial))
# print(Classes)
tranfer = ['GFI1-1', 'O622155-8', 'GF... |
olha_eu_aqui = """Hey!!!
Oie, eu sou uma docString!!!!!!!
também funciona como string
"""
print(olha_eu_aqui) |
def friends(n):
arr = [0 for i in range(n + 1)]
i = 0
while n+1 != 0:
if i <= 2:
arr[i] = i
else:
arr[i] = arr[i - 1] + (i - 1) * arr[i - 2]
i += 1
n -= 1
return arr[n]
if __name__ == '__main__':
## n = 1
## n... |
'''https://leetcode.com/problems/n-queens/'''
class Solution:
def solveNQueens(self, n: int) -> List[List[str]]:
board = [['.' for _ in range(n)] for _ in range(n)]
ans = []
def placeQ(row, col):
board[row][col] = 'Q'
def removeQ(row, col):
board... |
# Review:
# Create a function called greet().
# Write 3 print statements inside the function.
# Call the greet() function and run your code.
name = input("What's your name? ")
location = input("Where are you from? ")
def greet(name, location):
print(f"Hello Mr.{name}")
print(f"{location} is a nice place!")
... |
#Valor do Pagamento
print('============ LOJAS TABAJARA ===========')
preco = float(input('Valor das compras: R$'))
print(' ')
print('FORMAS DE PAGAMENTO')
print('[ 1 ] À VISTA DINHEIRO/CHEQUE')
print('[ 2 ] À VISTA CARTÃO')
print('[ 3 ] 2x NO CARTÃO')
print('[ 4 ] 3x ou mais NO CARTÃO')
print(' ')
desconto_10 = prec... |
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use ... |
# Basic Structure for Stack using Linked List
class Node:
def __init__(self,data):
self.data = data
self.next = None
class Stack:
def __init__(self):
self.head = None
def is_empty(self):
if self.head == None:
return True
else:
return False
... |
nomePres1 = "CANDIDATO-1"
nomePres2 = "CANDIDATO-2"
nomePres3 = "CANDIDATO-3"
nomePres4 = "CANDIDATO-4"
nomePres5 = "CANDIDATO-5"
votoPres1 = 0
votoPres2 = 0
votoPres3 = 0
votoPres4 = 0
votoPres5 = 0
print("\n\n+----------- Urna Eletrônica 1.0 -----------+")
print("| ... |
# -*- coding: utf-8 -*-
info = {
"%%spellout-prefixed": {
"0": "ERROR;",
"1": "vien;",
"2": "div;",
"3": "trīs;",
"4": "četr;",
"5": "piec;",
"6": "seš;",
"7": "septiņ;",
"8": "astoņ;",
"9": "deviņ;",
"(10, 'inf')": "ERROR;"
... |
# Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
#
# WSO2 Inc. licenses this file to you under the Apache License,
# Version 2.0 (the "License"); you may not use this file except
# in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/... |
class Node(object):
def __init__(self, *contents):
self.contents = contents
def __repr__(self):
return "<{0} {1}>".format(self.__class__.__name__,
', '.join(map(repr, self.contents)))
def __eq__(self, other):
same_class = (isinstance(other, self.__... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.