content stringlengths 7 1.05M |
|---|
def access_required():
pass
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Author : Fatih Kahraman
Mail : fatih.khrmn@hotmail.com
"""
class Book:
def __init__(self, page_count, author, book_type):
self.page_count = page_count
self.author = author
self.book_type = book_type
self.book_shape = ... |
class cacheFilesManagerInterface:
def __init__(self, cacheRootPath, resourcesRootPath):
super().__init__()
def createCacheFiles (self, fileInfo):
raise NotImplementedError()
def deleteCacheFiles (self, fileInfo):
raise NotImplementedError()
def getCacheFile (self, fileU... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
print('\033[33m-=-\033[m' * 20)
print('\033[33m************* Fatorial *************\033[m')
print('\033[33m-=-\033[m' * 20)
v = float(input('Insira um valor: '))
c = 1
f = 1
while c <= v:
f = f * c
c += 1
print('O fatorial de {} é {}' .format(v, f)) |
print('-='*20)
print('\033[1;35mAnalisador de Triângulos 2.0\033[m')
print('-='*20)
lado1 = float(input('Insira o tamanho do 1º lado: '))
lado2 = float(input('Insira o tamanho do 2º lado: '))
lado3 = float(input('Insira o tamanho do 3º lado: '))
if ((lado1 + lado2) > lado3) and ((lado1 + lado3) > lado2) and ((lado3 + ... |
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ /... |
#Command line program that performs various conversions
def errorMsg(ErrorCode):
#Assigning menu methods as values to dictionary keys
codes = {
1: MainMenu,
2: CurrencyConverter,
3: TemperatureConverter,
4: MassConverter,
5: LengthConverter
}
#Extracti... |
if __name__ == "__main__":
Motifs = [
"TCGGGGGTTTTT",
"CCGGTGACTTAC",
"ACGGGGATTTTC",
"TTGGGGACTTTT",
"AAGGGGACTTCC",
"TTGGGGACTTCC",
"TCGGGGATTCAT",
"TCGGGGATTCCT",
"TAGGGGAACTAC",
"TCGGGTATAACC",
]
|
fibs = {0: 0, 1: 1}
def fib(n):
if n in fibs: return fibs[n]
if n % 2 == 0:
fibs[n] = ((2 * fib((n / 2) - 1)) + fib(n / 2)) * fib(n / 2)
return fibs[n]
fibs[n] = (fib((n - 1) / 2) ** 2) + (fib((n+1) / 2) ** 2)
return fibs[n]
# limit 100000
|
t = int(input())
while t:
X, Y = map(int, input().split())
while X>0 and Y>0 :
if X>Y:
if X%Y==0:
X=Y
break
X = X%Y
else:
if Y%X==0:
Y=X
break
Y = Y%X
print(X+Y)
t =... |
"""
Problem Defination
LCS Problem Statement: Given two sequences, find the length of longest subsequence present in both of them.
A subsequence is a sequence that appears in the same relative order, but not necessarily contiguous. For example,
“abc”, “abg”, “bdf”, “aeg”, ‘”acefg”, .. etc are subsequences of “abcdef... |
a = int(input())
b = int(input())
r = 0
if a < b:
for x in range(a + 1, b):
if x % 2 != 0:
r += x
elif a >= b:
for x in range(a - 1, b, -1):
if x % 2 != 0:
r += x
print(r) |
def regionQuery(self,P,eps):
result = []
for d in self.dataSet:
if (((d[0]-P[0])**2 + (d[1] - P[1])**2)**0.5)<=eps:
result.append(d)
return result
def expandCluster(self,point,NeighbourPoints,C,eps,MinPts):
C.addPoint(point)
for p in NeighbourPoints:
if ... |
def main():
n = int(input())
x = sorted(map(int, input().split()))
q = int(input())
m = [int(input()) for _ in range(q)]
for coin in m:
l, r = -1, n
while l + 1 < r:
mid = (l + r) // 2
if x[mid] <= coin:
l = mid
else:
... |
"""A library for installing Python wheels.
"""
__version__ = "0.2.0.dev0"
|
with open("opcodes.txt") as f:
code = tuple([int(x) for x in f.read().strip().split(',')])
def op1(code, a, b, c, pos):
code[c] = a + b
return pos+4
def op2(code, a, b, c, pos):
code[c] = a * b
return pos+4
def op3(code, a, pos):
global sysID
code[a] = sysID
return pos+2
def op4(code, a, pos):
glo... |
#
# PySNMP MIB module MSERIES-PORT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MSERIES-PORT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:15:42 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... |
# -*- coding: utf-8 -*-
# @Author : LG
"""
执行用时:32 ms, 在所有 Python3 提交中击败了99.63% 的用户
内存消耗:13.8 MB, 在所有 Python3 提交中击败了12.97% 的用户
解题思路:
先将链表拆分为单个节点,并统计链长度
根据链表长度以及k,计算,每段的节点个数以及多余的节点数
按照计算结果连接链表
具体实现见代码注释
"""
class Solution:
def splitListToParts(self, root: ListNode, k: int) -> List[ListNode]:
... |
#
# Pelican_manager
#
__title__ = 'pelican_manager'
__description__ = 'easy way to management pelican blog.'
__url__ = 'https://github.com/xiaojieluo/pelican-manager'
__version__ = '0.2.1'
__build__ = 0x021801
__author__ = 'Xiaojie Luo'
__author_email__ = 'xiaojieluoff@gmail.com'
__license__ = 'Apache 2.0'
__copyright_... |
#!/usr/bin/env python
#pylint: skip-file
# This source code is licensed under the Apache license found in the
# LICENSE file in the root directory of this project.
class ScheduleInfoOutput(object):
def __init__(self):
"""
Attributes:
swaggerTypes (dict): The key is attribute name and t... |
class OpenAPISchemaError(Exception):
"""
Custom exception raised when package tests fail.
"""
pass
|
def addBlogsEntryL1(index_file):
blogTemplate = '''
<h1 style="color:#d45131"> My Latest Blogs✍️</h1>
<div align='left' class="div-blog">
<!-- BLOG-POST-LIST:START --><!-- BLOG-POST-LIST:END -->
</div>
'''
temp_file = index_file.replace('<!-- BLOG-ENTRY -->', blogTemplate)
return temp_fi... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# This file is part of ltlf2dfa.
#
# ltlf2dfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later v... |
# my_script.py
# enlarge function
def enlarge(n):
return n * 100
|
DEFINE = 'define'
BEGIN = 'begin'
SET = 'set!'
LAMBDA = 'lambda'
LET = 'let'
LET_STAR = 'let*'
LET_REC = 'letrec'
OPEN_PARANT = '('
CLOSE_PARANT = ')'
ADD = '+'
SUB = '-'
MULT = '*'
DIV = '/'
DOT = '.'
QUOTE = 'quote'
QUASIQUOTE = 'quasiquote'
UNQUOTE = 'unquote'
UNQUOTE_SPLICING = 'unquote-splicing'
APPLY = 'apply'
IF... |
"""
System configuration constants
"""
RANGE_MIN = 1
RANGE_MAX = 100000
ENTRY_SIZE = 3
MAX_INPUT_SIZE = 99
ERROR_MSG_INVALID_FILE_EXTENSION = "The provided file has an invalid format. Only text (.txt) files are accepted."
ERROR_MSG_EXCEEDED_MAX_INPUT_SIZE = "Number of entries bigger than the allowed maximum (%d)." %... |
"""Library for wally.
This library provides an API for budgeting.
"""
|
###################################
# File Name : compare_identity_analysis.py
###################################
#!/usr/bin/python3
def main():
print ("=== compare identity ===")
print (999 is 999)
x = 999; y = 999;
print (x is y)
z = 999;
print (x is z)
print (id(x))
print (id(y))
... |
#
# PySNMP MIB module FASTPATH-PFC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FASTPATH-PFC-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:12:20 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... |
# Copyright (c) 2014, Fundacion Dr. Manuel Sadosky
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of condit... |
def find_path(start, end, parents):
""" Constructs a path between two vertices, given the parents of all vertices. """
path, parent = [], end
while parent != parents[start]:
path.append(parent)
parent = parents[parent]
return path[::-1]
|
def resolve():
'''
code here
'''
num_S, num_c = [int(item) for item in input().split()]
delta = num_c - num_S *2
scc = 0
if num_S != 0:
if num_c // 2 <= num_S :
scc = num_c//2
else:
scc = num_S
scc += delta//4
else:
scc = num_... |
class Template(object):
def __init__(self, usages, snippets, blocks):
self.usages = usages
self.snippets = snippets
self.blocks = blocks
def accept(self, visitor):
visitor.visit_template(self)
class Text(object):
def __init__(self, text_token):
self._token = text... |
#take user inputs for Item code
itemCode = input("Item Code : ")
while itemCode != "1" and itemCode != "2" and itemCode != "3":
print("Invalid Input!! Try again")
itemCode = input("Item Code : ")
#take user inputs for quantity
quantity = input("Quantity : ")
quantity = float(quantity)
#take user inputs for c... |
"""API operation on tags."""
class TagOperator(object):
"""Task tag settings."""
def __init__(self, connect):
"""Initialize instance.
Args:
connect (rayvision_api.api.connect.Connect): The connect instance.
"""
self._connect = connect
def add_label(self, new... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Keyword
TOKEN_TYPE_IF = 0
TOKEN_TYPE_ELIF = 1
TOKEN_TYPE_ELSE = 2
TOKEN_TYPE_FOR = 3
TOKEN_TYPE_IN = 4
TOKEN_TYPE_WHILE = 5
TOKEN_TYPE_BREAK = 6
TOKEN_TYPE_NOT = 7
TOKEN_TYPE_AND = 8
TOKEN_TYPE_OR = 9
TOKEN_TYPE_RETURN = 10
TOKEN_TYPE_IMPORT = 11
TOKEN_TYPE_FUN = 12
TOK... |
###############################################################################
''''''
###############################################################################
# import unittest
def testfunc(a, b,
c,
d=4, # another comment
/,
e: int = 5,
# stuff
f=6,
... |
def main():
# input
N = int(input())
SPs = [input().split() for _ in range(N)]
SPs = list(map(lambda x: (x[1][0], int(x[1][1]), x[0]), enumerate(SPs))) # enumerate()を利用しているのでx[0]にはインデックスが格納されている
# compute
SPs.sort(key=lambda x: x[1], reverse=True)
SPs.sort(key=lambda x: x[0])
# output
... |
class Pessoa:
olhos = 2
def __init__(self,*filhos,nome=None,idade=27):
self.nome = nome
self.idade = idade
self.filhos = list(filhos)
def cumprimentar(self):
return f'Olá id{self}'
@staticmethod
def metodo_estatico():
return 42
@classmethod
def me... |
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
retlisthead, retlistpos = None, None
lv: int = 0
while l1 is not N... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def splitListToParts(self, root: ListNode, k: int) -> List[ListNode]:
Len = 0
tmp = root
while tmp:
Len+=1
... |
T = int(input())
for _ in range(T):
s = input()
n_1 = 0
for c in s:
if c == '1':
n_1 += 1
if n_1%2:
print('WIN')
else:
print('LOSE')
|
# -*- coding: utf-8 -*-
class AM232xError(Exception):
""" AM232x とのデータ送受信において、何らかのエラーが発生したことを示す Exception.
am232x モジュールが投げる例外の基底クラスとして利用する。
"""
class ReceiveAM232xDataError(AM232xError):
""" AM232x からデータを受信した際に、エラーが発生したことを示すエラーコードが含まれていたことを示す Exception.
"""
def __init__(self, error_code, chi... |
"""
问题描述:给定两个字符串str1和str2,再给定三个整数ic、dc和rc,分别代表插入、删除
和替换一个字符的代价,返回将str1编辑成str2的最小代价。
举例:
str1='abc', str2='adc', ic=5, dc=3, rc=2
从'abc'编辑成'adc',把'b'替换成'd'是代价最小的,所以返回2.
str1='abc',str2='adc',ic=5,dc=3,rc=100
从abc编辑成adc,先删除b,然后插入d代价是最小的,所以返回8
str1='abc',str2='abc',ic=5,dc=3,rc=2
不用编辑了,本来就是一样的字符串,所以返回0
"""
class Lowest... |
"""
存放常量
"""
# # 增加列调整因子
# 存储数据时使用因子调整为整数uint32,读取时使用因子倒数调整回原始数据
# 可简化代码及提高存取速度
# 防止数据溢出,尽量保持原有数据精度。
ADJUST_FACTOR = {'turnover':10000, # 换手率为百分比34.78 代表 34.78%
#'change_pct':10000, # _read_bcolz_data只处理uint32, change_pct为int32
'open':1000,
'high':1000,
... |
D = int(input("Saisir le nombre de kilomètres parcourus : "))
if D <= 5000:
F = D*0.536
else:
if D <= 20000:
F = 1180+D*0.30
else:
F = D*0.359
print("Vos frais kilométriques s'élèvent à ", F, "Euros HT")
money_request = int(input("saisir le montant demandé : "))
# division euclidienne "doub... |
def obrnut(tekst):
return tekst[::-1]
def da_li_je_palindrom(tekst):
return tekst == obrnut(tekst)
nesto = input("Ukucja tekst: ")
if(da_li_je_palindrom(nesto)):
print("Da, to je palindrom")
else:
print("Ne to nije palindrom")
|
def arrayPartition(nums):
nums.sort()
suma=0
for i in range(0,len(nums),2):
suma+=min(nums[i],nums[i+1])
return suma
nums = [1,4,3,2]
print(arrayPartition(nums)) |
# Write your solution here
def spruce(n):
row = "*"
print("a spruce!")
while n > 0:
print(" " * (n-1) + row + " " * (n-1))
row += "**"
n -= 1
l = int((len(row)-3)/2)
print(" " * l + "*" + " " * l)
# You can test your function by callil
if __name__ == "__main__":
spruce(5... |
"""
Copyright (c) 2021 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
# OSBS2 TBD
def get_inspect_for_image(image):
# util.get_inspect_for_image(image, registry, insecure=False, dockercfg_path=None)
# o... |
class Rule_Set:
def __init__(self):
"""Creates a single rule set for IP2 packets based on 10 fields.
Args:
- self: this index, the one to create. mandatory object reference.
Returns:
None.
"""
self.source_IP = {}
self.dest_IP = {}
... |
class Node:
def __init__(self,key):
self.left = None
self.right = None
self.val = key
def printInorder(root):
if root:
printInorder(root.left)
print(root.val),
printInorder(root.right)
def printPostorder(root):
if root:
... |
"""Example Sudoku problems and solutions."""
# keys of problems that are easy to solve by brute force
# used by the tests
TEST_KEYS = ['easy1', 'hard1', 'hard2', 'swordfish1']
# ##### Example Sudoku problems
# Notes:
# 1) 'swordfish1' requires the complicated swordfish manoeuver
# http://www.sudokuoftheday.com/p... |
# Containers e Iteração
# Acesso, Tamanho e Fatiamento
nome='Diogo'
# para acessar os itens(caracteres da string)
nome[0] # retorna o D
# len traz o comprimento da sequencia
len(nome)
# para acessar o último
# tem de colocar o -1 para poder trazer o ultimo,
# pois o indice começa de zero
nome(len(nome) - 1)
# n... |
with open("input.txt") as f:
p1 = []
f.readline()
line = f.readline()
while line != "\n":
p1.append(int(line.strip()))
line = f.readline()
f.readline()
p2 = []
line = f.readline()
while line != "":
p2.append(int(line.strip()))
line = f.readline()
game_his... |
nota1 = int(input("escriba la prmera nota de su alumno:"))
nota2 = int(input("escriba la segunda nota de su alumno:"))
nota3 = int(input("escriba la tercera nota de su alumno:"))
nota4 = int(input("escriba la cuarta nota de su alumno:"))
media = (nota1 + nota2 + nota3 + nota4) / 4
print(media)
sapo = True
while sapo ==... |
# Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param root, a tree node
# @return an integer
def minDepth(self, root):
if root is None:
return 0
#... |
# Python - 3.6.0
Test.describe('Basic tests')
Test.assert_equals(sequence_sum(2, 6, 2), 12)
Test.assert_equals(sequence_sum(1, 5, 1), 15)
Test.assert_equals(sequence_sum(1, 5, 3), 5)
Test.assert_equals(sequence_sum(0, 15, 3), 45)
Test.assert_equals(sequence_sum(16, 15, 3), 0)
Test.assert_equals(sequence_sum(2, 24, 22)... |
def test_atom_feed(app):
app.get("/stream.atom")
def test_rss_feed(app):
app.get("/stream.rss")
|
"""Constants for integration_blueprint."""
# Base component constants
NAME = "TuneBlade"
DOMAIN = "tuneblade"
DOMAIN_DATA = f"{DOMAIN}_data"
VERSION = "0.0.5"
ISSUE_URL = "https://github.com/spycle/tuneblade/issues"
# Icons
ICON = "mdi:cast-audio-variant"
# Device classes
MEDIA_PLAYER_DEVICE_CLASS = "speaker"
# Plat... |
age = 12
if age < 4:
print("Your admission cost is $0.")
elif age < 18:
print("Your admission cost is $25.")
else:
print("Your admission cost is $40.")
age = 12
if age < 4:
price = 0
elif age < 18:
price = 25
print(f"Your admission cost is ${price}.")
age = 12
if age < 4:
price = 0
elif ag... |
class Aluno:
def __init__(self, nome, email):
self.nome = nome
self.email = email
def show_infos(self):
print(f"Ola, me chamo {self.nome} meu email é: {self.email}")
aluno_1 = Aluno("Cleber", "cleber@gmail.com")
aluno_1.show_infos()
|
class Updated:
def __init__(self, payload):
self.tiers_added = payload['tiersAdded']
self.orb_count_diff = payload['orbCountDiff']
self.inventory_updates = payload['inventoryUpdates']
|
with open('arquivo.txt','r', encoding='utf-8') as arquivo:
#Lê todo conteúdo como uma string
conteudoTodo = arquivo.read()
#Lê o arquivo de linha em linha
umaLinha = arquivo.readline()
#Lê todas as linhas de um arquivo
todasLinhas = arquivo.readlines() |
#2XX Success
SUCESS_OK = 200
#4XX Error
ERROR_BAD_REQUEST = 400
ERROR_UNAUTHORIZED = 401
ERROR_FORBIDDEN = 403
ERROR_NOT_FOUND = 404
#5xx
ERROR_SERVER = 500
|
# desafio-005
num = int(input('Digite um número: '))
ante = num -1
sucess = num +1
print('O numero digitado é {} antecessor do numero é {} e o seu sucessor é {}'.format(num,ante,sucess))
|
s1 = "xyaabbbccccdefwwsadfhlgfdfhgskdghkdfzhgzjhgkdzhgfkxhgfkzhgkjfdhgizfghkzhgkzdhfgkz"
s2 = "xxxxyyyyabklmopqdfaiusfghskjghsjkdgbsdkgjbsdgbskdkfbnsdkhsgb"
# take 2 strings s1 and s2 including only letters from ato z.
# Return a new sorted string, the longest possible, containing distinct letters
def longest(s1, s2)... |
def fc(claim, s=None):
suffix = ('-'+s) if s else ''
return 'https://purl.imsglobal.org/spec/lti{0}/claim/{1}'.format(suffix, claim)
def fdlc(claim):
return fc(claim, s='dl')
def scope(scope, s=None):
suffix = ('-'+s) if s else ''
return 'https://purl.imsglobal.org/spec/lti{0}/scope/{1}'.format(su... |
# Given a string, use recursion to output a list of all the possible permutations of a string
# If a character is repeated, treat all versions as distinct
# Itertools does permutations
def permute(s):
out = []
# Base case is when there is only one letter
if len(s) < 2:
out = [s]
else:
# For every let... |
# from https://github.com/peteboyd/lammps_interface.git
ATOMIC_MASSES = {
"H": 1.00794,
"He": 4.002602,
"Li": 6.941,
"Be": 9.012182,
"B": 10.811,
"C": 12.0107,
"N": 14.0067,
"O": 15.9994,
"F": 18.9984032,
"Ne": 20.1797,
"Na": 22.98976928,
"Mg": 24.3050,
"Al": 26.9815... |
#
# pkpgcounter : a generic Page Description Language parser
#
# (c) 2003, 2004, 2005, 2006, 2007 Jerome Alet <alet@librelogiciel.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either vers... |
"""
Entradas ---
Salidas: todos los numeros enteros impares menores que 100, sin contar multiplos de 7
Numeros --> int --> A
"""
# Caja negra
A = 1
for i in range(50):
if (A%7) != 0:
print(A) # Salida
A += 2
else:
A += 2 |
#!/usr/bin/env python3
# DEKLARACE ZÁSTUPNÝCH PROMNĚNÝCH
NULA=0
JEDNA=1
DVA=2
# Konec deklarace
''' Třída Polynomial pro zpracování ruzných polynomů, dle zadání '''
class Polynomial:
''' Definife funkce __INIT__, uprava dat pro další operace/funkce '''
def __init__(self, *args, **arg): # Definitce funkce ... |
def func():
print('func')
def func2():
print('func2')
def func3():
print('func3')
__all__ = ['func2', 'func3'] |
class BaseArray(Element, IDisposable):
""" An abstract base class that represents an array within the Revit project. """
def Dispose(self):
""" Dispose(self: Element,A_0: bool) """
pass
def getBoundingBox(self, *args):
""" getBoundingBox(self: Element,view: View) -> Boundin... |
"""
Q701
Insert into a Binary Search Tree
Medium
Given the root node of a binary search tree (BST) and a value
to be inserted into the tree, insert the value into the BST.
Return the root node of the BST after the insertion. It is
guaranteed that the new value does not exist in the original
BST.
Note that there may e... |
__all__ = ('func', 'C')
def func():
pass
class C:
pass |
DBPEDIA_URI = "http://dbpedia.org/sparql"
# dsbox02.isi.edu
# ELASTICSEARCH_URI "http://kg2018a.isi.edu:9200/my_wiki_content_first/_search"
# SPARQL_URI = "http://dsbox02.isi.edu:8888/bigdata/namespace/wdq/sparql"
# IDENTIFIER_WIKIFIER = "http://minds03.isi.edu:4444/get_properties"
# DataMachines Nov 2019
ELASTICSEA... |
"""
Python Fundamentals 2
@author: Balint Szoke
@date: 2/11/2017
"""
"""---------------------------------------------------
REVIEW
---------------------------------------------------"""
# Assignment
x = 3.14
# Strings
s = 'this is a string'
type(s)
len(s)
# Lists
l = [1,... |
class Config(object):
c_dim = 5
c2_dim = 8
celeba_crop_size = 178
rafd_crop_size = 256
image_size = 128
g_conv_dim = 64
d_conv_dim = 64
g_repeat_num = 6
d_repeat_num = 6
lambda_cls = 1
lambda_rec = 10
lambda_gp = 10
dataset = 'CelebA'
batch_size = 16
num_iter... |
"""
This package contains exceptions that may be raised by the CHARMM components of
the OpenMM Application layer
This file is part of the OpenMM molecular simulation toolkit originating from
Simbios, the NIH National Center for Physics-Based Simulation of Biological
Structures at Stanford, funded under the NIH Roadmap... |
li = input().split()
dicti={}
for i in li:
if i not in dicti:
dicti[i]=1
else:
print(i) |
# N개의 정수가 주어질때, 각 정수 M에 대하여 1부터 M까지의 합의 제곱과 각각의 제곱의 합과의 차를 구하시오
# Given N integers, for each integer M, find the difference between the sum of squares of the first M natural numbers and the square of the sum.
for _ in range(int(input())):
n = int(input())
sum_of_squares = n*(n+1)*(2*n+1) // 6
square_of_sum... |
formatter = "{} {} {} {}" #this gives 4 empty slots in the formatter variable
print(formatter.format(1, 2, 3, 4)) #this fill the slots with 1234
print(formatter.format("one", "two", "three", "four")) #this fills the slots with one two three four
print(formatter.format(True, False, False, True)) #this fills the slots w... |
class LavadoraFacade(object):
def lavar(self):
self._lavar = Lavar()
self._lavar.subsistema_operation()
def enjuagar(self):
self._enjuagar = Enjuagar()
self._enjuagar.subsistema_operation()
def centrifugado(self):
self._centrifugado = Centrifugado()
self._cent... |
#Given an array of integers, find and print the maximum number of integers you
#can select from the array such that the absolute difference between any two of
#the chosen integers is less than or equal to . For example, if your array is ,
#you can create two subarrays meeting the criterion: and . The maxim... |
# Python lists can be used as Arrays in Python
# Creating an array
things = ['pen', 'car', 'books']
print(things)
# accessing the array element
print(things[0]) # prints the first element of the array things
# modifying the value of the array element
things[1] = 'pencil' # second element of things, gets changed to ... |
def isDivisibleBy(int, divisor):
return int % divisor == 0;
def doFizzBuzz():
for i in range(1, 101):
isDivisibleByThree = isDivisibleBy(i, 3)
isDivisibleByFive = isDivisibleBy(i, 5)
if (isDivisibleByThree and isDivisibleByFive):
print('fizzbuzz')
elif isDivisibleByThree:
print('fizz')
elif isD... |
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 21 15:38:43 2019
@author: Mijael
"""
vnclass_dict = {
'stop-55.4': ['causer', 'theme', 'location'],
'masquerade-29.6': ['agent', 'attribute', 'location'],
'masquerade-29.6-1': ['agent', 'attribute', 'location'],
'masquerade-29.6-2': ... |
__all__ = ["analyze_traffic",
"utils",
"manage_resolutions",
"url_regex_resolver",
"get_popular_urls",
"funnel_in_outs",
"funnel_stats",
"sankey_funnel",
"frequent_funnel",
"analyze_clicks",
"analyze_timing"]
|
#
# PySNMP MIB module CISCO-FCIP-MGMT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-FCIP-MGMT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:41:05 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... |
class unionFindSet:
def __init__(self, S):
self.S = {i: i for i in S}
self.size = {i: 1 for i in S}
def find(self, x):
if x != self.S[x]:
self.S[x] = self.find(self.S[x])
return self.S[x]
def union(self, a, b, key=lambda x: x):
x, y = sorted((self.find(a... |
"""
---For Bolinger Trade Strategy---
1. Goes to Tick Data in cassandra and check if we will get a fill on Mid level value or Not
2. If Yes then returns TRUE else returns FALSE
"""
def check_data(product,time_start,time_end,date1,session,mid_price,side):
query_fet... |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 9 15:15:50 2020
@author: Patrick
"""
"""Implementation of Fast Orthogonal Search"""
#==============================================
#candidates_generation.py
#==============================================
def CandidatePool_Generation(x_train, y_train, K, L):
Candid... |
"""
This package includes the internal APIs for PySpark about interoperability
between pandas, PySpark and PyArrow. This package should not be directly
imported and used.
"""
|
class Solution:
def combine(self, n, k):
"""
:type n: int
:type k: int
:rtype: List[List[int]]
"""
ret = []
curr = []
def generate(curr_pos):
if len(curr) == k:
ret.append(curr[:])
else:
for i in... |
registered = False
api_key = None
environment = None
log_404 = False
log_403 = False
log_405 = False
use_ssl = False |
pytest_plugins = [
"polygon.tests.fixtures",
"polygon.plugins.tests.fixtures",
"polygon.graphql.tests.fixtures",
]
|
ry = 0
def setup():
size(800, 800, P3D)
global obj, texture1
texture1 = loadImage("texture.jpg")
obj = loadShape("man.obj")
def draw():
global ry
background(0)
lights()
translate(width / 2, height / 2 + 200, -200)
rotateZ(PI)
rotateY(ry)
scale(25)
# Orange point ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.