content stringlengths 7 1.05M |
|---|
# This program gets a numberic test score from the
# user and displays the corresponding letter grade.
# Named constants to represent the grade thresholds
A_SCORE = 90
B_SCORE = 80
C_SCORE = 70
D_SCORE = 60
# Get a test score from the user.
score = int(input('Enter your test score: '))
# Determine th... |
{
'target_defaults': {
'variables': {
'deps': [
'libbrillo-<(libbase_ver)',
'libchrome-<(libbase_ver)',
'libndp',
'libshill-client',
'protobuf-lite',
],
},
},
'targets': [
{
'target_name': 'protos',
'type': 'static_library',
'variab... |
class ApplicationException(Exception):
def __init__(self, java_exception):
self.java_exception = java_exception
def message(self):
return self.java_exception.getMessage()
|
EXPECTED_TABULATED_HTML = """
<table>
<thead>
<tr>
<th>category</th>
<th>date</th>
<th>downloads</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left">2.6</td>
<td align="left">2018-08-15</td>
<td align="right">51</t... |
# def t1():
# l = []
# for i in range(10000):
# l = l + [i]
# def t2():
# l = []
# for i in range(10000):
# l.append(i)
# def t3():
# l = [i for i in range(10000)]
# def t4():
# l = list(range(10000))
#
# from timeit import Timer
#
# timer1 = Timer("t1()", "from __main__ import t1")
# prin... |
#!/usr/bin/env python3
class ProjectNameException(Exception):
pass
class MissingEnv(ProjectNameException):
pass
class CreateDirectoryException(ProjectNameException):
pass
class ConfigError(ProjectNameException):
pass
|
# Задача 4. Вариант 28.
# Напишите программу, которая выводит имя,
# под которым скрывается Эмиль Эрзог.
# Дополнительно необходимо вывести область интересов указанной личности,
# место рождения, годы рождения и смерти (если человек умер),
# вычислить возраст на данный момент (или момент смерти).
# Для хранения всех не... |
# Here go your api methods.
def get_prod_list():
prod_list = db(db.products).select(
db.products.id,
db.products.name,
db.products.description,
db.products.price,
orderby=~db.products.price
).as_list()
return response.json(dict(prod_list=prod_list))
def get_rev... |
########
# BASE #
########
# Registration
NICK = 'NICK'
PASS = 'PASS'
QUIT = 'QUIT'
USER = 'USER' # Sent when registering a new user.
# Channel ops
INVITE = 'INVITE'
JOIN = 'JOIN'
KICK = 'KICK'
LIST = 'LIST'
MODE = 'MODE'
NAMES = 'NAMES'
PART = 'PART'
TOPIC = 'TOPIC'
# Server ops
ADMIN = 'ADMIN'
CONNECT = 'CONNECT'... |
# -*- coding: utf-8 -*-
if __name__ == '__main__':
Plant = lambda x: x + 2
FFC = lambda x: 1.1 * x + 1.9
FBC = lambda y: 0.9*y - 1.8
x = 5
x_ = x
y = Plant(x)
for k in range(100):
ypre = FFC(x_)
x_ = FFC(ypre)
x_ = (x + x_) / 2
print(y, ypre)
|
"""
Chaos 'probes' module.
This module contains *probes* that collect state from an indy-node pool.
By design, chaostoolkit runs an experiment if and only if 'steady state' is met.
Steady state is composed of one or more '*probes*'. *Probes* gather and return
system state data. An experiment defines a 'tolerance' (pr... |
def gcdIter(a, b):
'''
a, b: positive integers
returns: a positive integer, the greatest common divisor of a & b.
'''
# Your code here
gcd = 1
if a > b:
for i in range(b, 0, -1):
if a % i == 0 and b % i == 0:
gcd = i
break
else:
... |
#English alphabet to be used in
#decipher/encipher calculations.
Alpha=['a','b','c','d','e','f','g',
'h','i','j','k','l','m','n',
'o','p','q','r','s','t','u',
'v','w','x','y','z']
def v_cipher(mode, text):
if(mode == "encipher"):
plainTxt = text
cipher... |
class Match:
def __init__(self, first_team, second_team, first_team_score, second_team_score):
self.first_team = first_team
self.second_team = second_team
self.first_team_score = first_team_score
self.second_team_score = second_team_score
self.commentary = []
def __repr_... |
def millis_interval(start, end):
diff = end - start
millis = diff.days * 24 * 60 * 60 * 1000
millis += diff.seconds * 1000
millis += diff.microseconds / 1000
return int(round(millis))
|
langversion = 1
langname = "Français"
##updater
# text construct: "Version "+version+available+changelog
#example: Version 3 available, click here to download, or for changelog click here
available = "disponibles, cliquez pour télécharger"
changelog = ", ou pour la liste des changements cliquez ici"
##world gen
world... |
class Node(object):
"""docstring for Node"""
def __init__(self, value):
self.value = value
self.edges = []
class Edge(object):
"""docstring for Edge"""
def __init__(self, value, node_from, node_to):
self.value = value
self.node_from = node_from
self.node_to = no... |
'''
Stepik001146PyBeginсh11p04st05TASK04_20210204_lists_methods.py
Без дубликатов
На вход программе подается натуральное число nn, а затем nn строк. Напишите программу, которая выводит только уникальные строки, в том же порядке, в котором они были введены.
Формат входных данных
На вход программе подаются натуральное ... |
'''
module for calculating
factorials of large
numbers efficiently
'''
def factorial(n: int):
'''
Calculating factorial using
prime decomposition
'''
prime = [True] * (n + 1)
result = 1
for i in range (2, n + 1):
if (prime[i]):
j = 2 * i
while (j <= ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 6 16:29:07 2017
@author: Young
"""
# Placeholder |
class Solution:
def frequencySort(self, s: str) -> str:
freq_dict = dict()
output = ""
for x in s:
if x in freq_dict:
freq_dict[x] += 1
else:
freq_dict[x] = 1
refined_freq = sorted(freq_dict.items(), key=operator.itemg... |
class Solution:
def minMeetingRooms(self, intervals: List[List[int]]) -> int:
time = []
for i in intervals:
time.append((i[0], 1))
time.append((i[1], 0))
time.sort()
count = maxCount = 0
for t in time:
if t[1] == 1:
count +=... |
class Company(object):
def __init__(self, name, title, start_date):
self.name = name
self.title = title
self.start_date = start_date
def getName(self):
return self.name
def getTitle(self):
return self.title
def getStartDate(self):
return self.start_dat... |
class FastSort2():
def __init__(self, elems = []):
self._elems = elems
def FS2(self, low, high):
if low >= high:
return
i = low
pivot = self._elems[low]
for m in range(low + 1, high + 1):
if self._elems[m] < pivot:
i += ... |
descriptor = ' {:<30} {}'
message_help_required_tagname = descriptor.format('', 'required: provide a tag to scrape')
message_help_required_login_username = descriptor.format('', 'required: add a login username')
message_help_required_login_password = descriptor.format('', 'required: add a login password')
message_help... |
#
# PySNMP MIB module Juniper-TSM-CONF (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-TSM-CONF
# Produced by pysmi-0.3.4 at Mon Apr 29 19:53:51 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... |
def ready_jobs_dict_to_key(ready_jobs_list_dict):
ready_jobs_list_key = (
"ready_jobs"
+ "_cpu_credits_"
+ str(ready_jobs_list_dict["cpu_credits"])
+ "_gpu_credits_"
+ str(ready_jobs_list_dict["gpu_credits"])
)
return ready_jobs_list_key
|
{'application':{'type':'Application',
'name':'Template',
'backgrounds': [
{'type':'Background',
'name':'standaloneBuilder',
'title':u'PythonCard standaloneBuilder',
'size':(800, 610),
'statusBar':1,
'menubar': {'type':'MenuBar',
'menus': [
... |
class Error(Exception):
def __init__(self, typ, start_pos, end_pos, details) -> None:
self.typ = typ
self.details = details
self.start_pos = start_pos
self.end_pos = end_pos
def __repr__(self) -> str:
return f"{self.typ} : {self.details} ({self.start_pos.idx}, {self.... |
class PathAnalyzerStore:
"""
Maps extensions to analyzers. To be used for storing the analyzers that should be used for specific extensions in a
directory.
"""
####################################################################################################################
# Constructor.
... |
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def insert(head, x):
new_node = ListNode(x)
if head is None:
head = new_node
return
last_node = head
while last_node.next:
last_node = last_node.next
last_node.next = new_node
d... |
class Client():
def __init__(self, player):
#self.clientSocket
pass
def connect(self):
pass
def sending(self):
pass
def getting(self):
pass
def serverHandling(self):
pass |
"""
Monthly Backups
Description:
This script is run weekly on Sunday at 2 AM and generates weekly backups.
On Rojo we keep weekly backups going back 1 month,
we keep monthly backups going back 6 months,
and we put older backups into cold storage.
Directory Stucture:
junkinthetrunk/
backups/
... |
# -*- coding: utf-8 -*-
# Scrapy settings for state_scrapper project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# https://docs.scrapy.org/en/latest/topics/settings.html
# https://docs.scrapy.org/en/lat... |
__author__ = 'Robbert Harms'
__date__ = "2015-05-04"
__maintainer__ = "Robbert Harms"
__email__ = "robbert.harms@maastrichtuniversity.nl"
class ScannerSettingsParser(object):
def get_value(self, key):
"""Read a value for a given key for all sessions in settings file.
The settings file is suppose... |
# -*- coding: utf-8 -*-
CATEGORIES = (
(u'dania-miesne', u'Dania mięsne'),
(u'dania-rybne', u'Dania rybne'),
(u'dania-wegetarianskie', u'Dania wegetariańskie'),
(u'inne', u'Inne'),
(u'kolacje', u'Kolacje'),
(u'przekaski', u'Przekąski'),
(u'salatki-surowki', u'Sałatki i surówki'),
(u'sniadania', u'Śniad... |
n = int(input())
a = sorted(list(map(int, input().split(" "))))
while len(a) > 0:
print(len(a))
a = sorted(list(filter(lambda x: x > 0, map(lambda x: x - a[0], a))))
|
config = dict(
agent=dict(),
algo=dict(),
env=dict(
game="pong",
num_img_obs=1,
),
model=dict(),
optim=dict(),
runner=dict(
n_steps=5e6,
# log_interval_steps=1e5,
),
sampler=dict(
batch_T=20,
batch_B=32,
max_decorrelation_steps=... |
class Solution:
def findGoodStrings(self, n, s1, s2, evil):
M = 10 ** 9 + 7
m = len(evil)
memo = {}
# KMP
dfa = self.failure(evil)
def dfs(i, x, bound):
if x == m:
return 0
if i == n:
return 1
... |
"""
RANGE:
3 parameters [start,stop,step]
Code to print the odd integers in the specified range
from 5 to -10 by assigning negative step value
"""
start = 5
stop = -10
step = -2
print("Odd numbers from 5 to -10 are: ")
for num in range(start,stop,step):
print(num)
'''
OUTPUT:
Odd numbers from 5 to ... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 23 00:20:58 2016
@author: DrCollins
The merging procedure is an essential part of “Merge Sort”
(which is considered in one of the next problems).
Given: A positive integer n ≤ 10**5
and a sorted array A[1..n] of integers from −10**5 to 10**5,
a positive int... |
# 给定一个正整数 rows,生成rows行杨辉三角
# C(rows,cols) = C(rows-1,cols-1) + C(rows-1,cols)
rows = 8
triangle = []
for i in range(rows):
tmp = [1] * (i + 1)
triangle.append(tmp)
for j in range(1, i):
triangle[i][j] = triangle[i - 1][j - 1] + triangle[i - 1][j]
for row in triangle:
print(row) |
#!/usr/bin/env python
xlist = [1, 3, 5, 7, 1]
ylist = [1, 1, 1, 1, 2]
totaltrees = 1
with open('input.txt', 'r', encoding='utf-8') as input:
all_lines = input.readlines()
for i in range(5):
x = xlist[i]
y = ylist[i]
trees = 0
posx = 0
posy = 0
iterations = 1
for line in all_lines:
... |
class PriorityQueue:
def __init__(self, arr: list = [], is_min=True):
self.arr = arr
self.minmax = min if is_min else max
self.heapify()
@staticmethod
def children(i):
return (2 * i + 1, 2 * i + 2)
@staticmethod
def parent(i):
return (i - 1) // 2
@stati... |
# Written by Pavel Jahoda
#This class is used for evaluating and processing the results of the simulations
class Evaluation: #TODO, implement evaluation class
def __init__(self):
pass
def processResults(self,n_of_blocked_calls, n_of_dropped_calls, n_of_calls, n_of_channels_reverved):
p... |
def fetching_episode(episode_name, stream_page):
tag = "[ FETCHING ]"
print(tag, episode_name, stream_page)
def fetched_episode(episode_name, stream_url, success):
tag = "[ SUCCESS ] " if success else "[ FAILED ] "
print(tag, episode_name, stream_url, end="\n\n")
def fetching_list(anime_url):
pri... |
# definition
class OriginalException(Exception):
pass
|
menu = ['deathnote', 'netflix', 'teaching']
# for i in range(len(menu)):
# print(i + 1,'. ',menu[i],sep='')
for index, item in enumerate(menu):
print(index + 1,'. ',item,sep='')
# for item in menu:
# print(item)
|
class landShift():
def __init__(self):
self.shiftList = []
self.unwarpPts = []
def addPos(self, shift):
self.shiftList.append(shift)
if len(self.shiftList)>10:
self.shiftList = self.shiftList[1:]
def getVelocity(self):
if len(self.shiftList):
... |
"""
Desafio 053
Problema: Crie um programa que leia uma frase qualquer
e diga se ela é um palíndromo, desconsiderando
os espaços.
Ex: apos a sopa
a sacada da casa
a torre da derrota
o lobo ama o bolo
anotaram a data da maratona
Res... |
# Caio Beraldi Ribeiro
class contiguity_list:
def __init__(self, size):
self.node = [0] * size
self.begin = 0
self.end = -1
self.size = size
def show_list(self):
aux = self.begin
if (aux == - 1):
print("contiguity_list inexistente")
els... |
def swap_case(s):
returnString = ""
for character in s:
if character.islower():
returnString += character.upper()
else:
returnString += character.lower()
return returnString
|
def no_teen_sum(a, b, c):
def fix_teen(n):
if n ==15 or n==16:
return n
if 13<=n<=19:
return 0
else:
return n
sum = fix_teen(a)+ fix_teen(b)+ fix_teen(c)
return sum
def round_sum(a, b, c):
def round10(num):
if num%10<5:
... |
'''
This code is written by bidongqinxian
'''
def quick_sort(lst):
if not lst:
return []
base = lst[0]
left = quick_sort([x for x in lst[1: ] if x < base])
right = quick_sort([x for x in lst[1: ] if x >= base])
return left + [base] + right
|
K, N, F = map(int, input().split())
A = list(map(int, input().split()))
t = K * N - sum(A)
if t < 0:
print(-1)
else:
print(t)
|
_base_ = [
'../_base_/datasets/coco_detection.py',
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
]
# model settings
model = dict(
type='FCOS',
pretrained='open-mmlab://detectron/resnet50_caffe',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
LANGUAGE_EN_NAMES_MAP = {
'de': 'German',
'en': 'English',
'es': 'Spanish',
'fr': 'French',
'id': 'Indonesian',
'it': 'Italian',
'jp': 'Japanese',
'kr': 'Korean',
'pt': 'Portuguese',
'ru': 'Russian',
'tl': 'Tagalog',
'vi': '... |
#!/usr/bin/python
print("How you doing man???")
|
"""
Django settings for ribbon.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
# Application definition
INSTALLED_APPS = ('rest_framework', )
|
# ========================
# Information
# ========================
# Direct Link: https://www.hackerrank.com/challenges/write-a-function/problem
# Difficulty: Medium
# Max Score: 10
# Language: Python
# ========================
# Solution
# ========================
def is_leap(YEAR):
'''Checking w... |
# Name: config.py
# Description: defines configurations for the various components of audio extraction and processing
class AudioConfig:
# The format to store audio in
AUDIO_FORMAT = 'mp3'
# Prefix to save audio features to
FEATURE_DESTINATION = '/features/'
# Checkpoint frequency in number of tra... |
t = '''DrawBot is a powerful, free application for MacOSX that invites you to write simple Python scripts to generate two-dimensional graphics. The builtin graphics primitives support rectangles, ovals, (bezier) paths, polygons, text objects and transparency.
Education
DrawBot is an ideal tool to teach the basics of p... |
class Solution:
def merge(self, intervals: List[List[int]]) -> List[List[int]]:
intervals.sort(key=lambda x: x[0])
res = []
for i in range(0, len(intervals)):
if not res or res[-1][1] < intervals[i][0]:
res.append(intervals[i])
else:
re... |
# -*- coding: utf-8 -*-
# Source: https://leetcode.com/problems/search-in-rotated-sorted-array/
def search(nums, left, right, target):
if left > right:
return -1
mid = int((left + right) / 2)
if nums[mid] == target:
return mid
# left --- target --- mid --- right
if nums[mid] <= nu... |
'''Use an IF statement inside a FOR loop to select only positive numbers.'''
def printAllPositive(numberList):
'''Print only the positive numbers in numberList.'''
for num in numberList:
if num > 0:
print(num)
printAllPositive([3, -5, 2, -1, 0, 7])
|
# The tests rely on a lot of absolute paths so this file
# configures all of that
music_folder = u'/home/rudi/music'
o_path = u'/home/rudi/throwaway/ACDC_-_Back_In_Black-sample-64kbps.ogg'
watch_path = u'/home/rudi/throwaway/watch/',
real_path1 = u'/home/rudi/throwaway/watch/unknown/unknown/ACDC_-_Back_In_Black-sample... |
# python3
def max_ammount(W, weights):
values = [[0 for _ in weights + [0]] for _ in range(W + 1)]
for w in range(1, W + 1):
for i, wi in enumerate(weights):
values[w][i + 1] = max([
values[w][i],
values[w - wi][i] + wi if w - wi >= 0 else 0
])
... |
abcd = (1 + 2 + 3 + 4 +
5 + 6)
aaaa = (8188107138941 <=
90)
bbbb = (123 ** 456 &
780)
cccc = (123 ** 456
& 780
| 89 /
8)
|
# -*- coding: utf-8 -*-
# auto raise exception
def auto_raise(exception, silent):
if not silent:
raise exception
class APIError(Exception):
""" Common API Error """
class APINetworkError(APIError):
""" Failed to load API request """
class APIJSONParesError(APIError):
""" Failed to parse ... |
def temperature_format(value):
return round(int(value) * 0.1, 1)
class OkofenDefinition:
def __init__(self, name=None):
self.domain = name
self.__datas = {}
def set(self, target, value):
self.__datas[target] = value
def get(self, target):
if target in self.__datas:
... |
def findMin(a, n):
su = 0
su = sum(a)
dp = [[0 for i in range(su + 1)]
for j in range(n + 1)]
for i in range(n + 1):
dp[i][0] = True
for j in range(1, su + 1):
dp[0][j] = False
for i in range(1, n + 1):
for j in range(1, su + 1):
dp[i][j] = dp[i ... |
class AboutDialog:
def __init__(self, builder):
self._win = builder.get_object('dialog_about', target=self, include_children=True)
def run(self):
result = self._win.run()
self._win.hide()
return result |
def extractChichipephCom(item):
'''
Parser for 'chichipeph.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('the former wife', 'The Former Wife of Invisible Wealthy Man', ... |
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 27 19:10:13 2021
@author: ALEX BACK
lARGEST PALINDROME PRODUCT
A palindromic number reads the same both ways. The largest palindrome made
from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-d... |
"""
Not sure how to scientifically prove this.
In order to turn all the 1 to 0, every row need to have "the same pattern". Or it is imposible.
This same pattern is means they are 1. identical 2. entirely different.
For example 101 and 101, 101 and 010.
110011 and 110011. 110011 and 001100.
Time: O(N), N is the number ... |
#
# PySNMP MIB module PDN-IFEXT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PDN-IFEXT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:30:00 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... |
galera = list()
dado = list()
totmai=totmen=0
for c in range(0,3): ## pede 3 elementos
dado.append(str(input('Nome : '))) ##adiciona dentro de dado
dado.append(int(input('Idade: ')))## adiciona dentro de dado
galera.append(dado[:]) ##coloca o conteudo de dado dentro da galera
dado.clear() ##limpa... |
class BinarySearch:
def __init__(self):
pass
def search(self, array, item):
# return self.recursively_search(array, item, 0, len(array)-1)
return self.interactive_search(array, item, 0, len(array)-1)
def recursively_search(self, array, item, left, right):
if(left > right):
... |
num = cont = soma = 0
while True:
num = int(input('Digite o valor [para sair digite 999]: '))
if num == 999:
break
soma += num
cont += 1
print('Foram digitados {} números e a soma deles é {}'.format(cont, soma))
|
class Solution:
def makeGood(self, s: str) -> str:
ans = []
for ch in s:
if ans and ans[-1].lower() == ch.lower() and ans[-1] != ch:
ans.pop()
else:
ans.append(ch)
return ''.join(ans)
|
# 小中大
def st190301():
n = int(input())
numbers=list(map(int,input().split()))
if numbers[0]>numbers[n-1]:
max=numbers[0]
min=numbers[n-1]
else:
max=numbers[n-1]
min=numbers[0]
print(max,end=' ')
if n%2==0:
zhong=(numbers[n//2-1]+numbers[n//2])
if z... |
#-----------------------------------------------------------------------------
# Runtime: 28ms
# Memory Usage:
# Link:
#-----------------------------------------------------------------------------
class Solution:
def spiralOrder(self, matrix: [[int]]) -> [int]:
row_length = len(matrix)
if row_le... |
def load(h):
return ({'abbr': 0, 'code': 0, 'title': 'Reserved'},
{'abbr': 'surf',
'code': 1,
'title': 'Surface',
'units': 'of the Earth, which includes sea surface'},
{'abbr': 'bcld', 'code': 2, 'title': 'Cloud base level'},
{'abbr': 'tcld'... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def __init__(self):
... |
inpt1 = int(input('enter base: '))
inpt2 = int(input('enter height: '))
inpt3 = int(input('enter hypotenus: '))
def get_area(base, height):
return 0.5 * base * height
def get_per(base, height, hypo):
return base + height + hypo
print("area of the triangle is: ")
print(get_area(inpt1, inpt2))
print()
print('t... |
def __getattr__():
pass
class C1:
def __str__(self):
return ''
def foo(self):
'''
>>> class Good():
... def __str__(self):
... return 1
'''
pass
class C2:
if True:
def __str__(self):
return ''
class C... |
print('=' * 12 + 'Desafio 82' + '=' * 12)
lista = []
pares = []
impares = []
while True:
var = int(input('Digite um valor: '))
lista.append(var)
resp = input('Deseja continuar [S/N]? ').upper().strip()
if resp[0] == 'N':
break;
for numero in lista:
if numero % 2 == 0:
pares.append(nu... |
class Config(object):
DEBUG = False
TESTING = False
SECRET_KEY = 'AAABBBBAAAA'
SQLALCHEMY_DATABASE_URI = 'sqlite:////tmp/test.db'
class ProductionConfig(Config):
DATABASE_URI = 'mysql://user@localhost/foo'
class DevelopmentConfig(Config):
DEBUG = True
class TestingConfig(Config):
TESTING... |
#
# @lc app=leetcode.cn id=115 lang=python3
#
# [115] 不同的子序列
#
# https://leetcode-cn.com/problems/distinct-subsequences/description/
#
# algorithms
# Hard (49.80%)
# Likes: 306
# Dislikes: 0
# Total Accepted: 23.4K
# Total Submissions: 46.8K
# Testcase Example: '"rabbbit"\n"rabbit"'
#
# 给定一个字符串 s 和一个字符串 t ,计算在 s... |
#!/usr/bin/python3
'''
Finds the coincidence index for the piece of text
Does not format the text so make sure to pass in a formatted one
'''
def findCoincidenceIndex(text: str, shift: int):
shiftedText = text[:-(shift)]
text = text[shift:]
shiftedLen = len(shiftedText)
similarCount = 0
for i in ra... |
"""
Relief Visualization Toolbox – python library
Contains functions for computing the visualizations.
Credits:
Žiga Kokalj (ziga.kokalj@zrc-sazu.si)
Krištof Oštir (kristof.ostir@fgg.uni-lj.si)
Klemen Zakšek
Klemen Čotar
Maja Somrak
Žiga Maroh
Copyright:
2010-2020 Research Centre of the S... |
# Default
domainFile = "domains.txt"
assets = "./assets/"
targets = assets + "targets/"
subdomains = assets + "subdomains/"
domains = assets + "domains/"
takeover = assets + "takeover/"
dto = assets = "dto/"
# Target Information
targetFields = {
"Domain" : "",
"Analysis" : {
"Subdomain" : "",
"... |
"""
Recipes available to data with tags ['GSAOI', 'IMAGE']
Default is "reduce_nostack".
"""
recipe_tags = {'GSAOI', 'IMAGE'}
def reduce_nostack(p):
"""
This recipe reduce GSAOI up to but NOT including alignment and stacking.
It will attempt to do flat correction if a processed calibration is
available.... |
class Aluno:
def __init__(self, nome, nota1, nota2):
self.nome = nome
self.nota1 = nota1
self.nota2 = nota2
self.media = self.media
def media(self):
self.media = (self.nota1 + self.nota2) / 2
return self.media
def mostra(self):
print('Nome: ', self.n... |
"""Error classes for authentise_services"""
class ResourceError(Exception):
"""arbitrary error whenever a call to a authentise resource doesnt go according to plan"""
pass
class ResourceStillProcessing(Exception):
"""most authentise resources have a status property to tell the user what state its in
... |
count = int(input())
matrix = []
for i in range(count):
matrix.append(list(map(int, input().split())))
# matrix = [list(map(int, input().split())) for i in range(n)]
roads = 0
for row in range(len(matrix)):
for col in range(row, len(matrix)):
roads += matrix[row][col]
print(roads)
|
# BUILD FILE SYNTAX: SKYLARK
SE_VERSION = '3.9.1'
ASSEMBLY_VERSION = '3.9.1.0'
|
#
# PySNMP MIB module STN-SESSION-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/STN-SESSION-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:11:40 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... |
class NonNegativeInteger:
def __get__(self, instance, owner):
# 기본 동작 그대로 이용한다면 굳이 __get__()을 구현하지 않아도 된다.
return instance.__dict__[self.name]
def __set__(self, instance, value):
if isinstance(value, int) and value >= 0:
instance.__dict__[self.name] = value
else:
... |
msg = "No Smoking here"
print(len(msg))
msg.count('o')
msg.count('s',3,5)
msg.count('n')
msg.count('N')
msg.count('O',7)
msg.count('o',7)
msg.count('o',1,7)
msg.count('o',7,15) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.