content stringlengths 7 1.05M |
|---|
n = int(input())
count = 0
for i in range(n):
one_word = list(input())
count_arr = [0 for _ in range(26)]
pre = ""
for c in one_word:
idx = ord(c) - 97
cur = c
if (count_arr[idx] == 0) or (pre == cur):
count_arr[idx] += 1
pre = c
if sum(count_arr) == len(o... |
p=21888242871839275222246405745257275088696311157297823662689037894645226208583
print("over 253 bit")
for i in range (10):
print(i, (p * i) >> 253)
def maxarg(x):
return x // p
print("maxarg")
for i in range(16):
print(i, maxarg(i << 253))
x=0x2c130429c1d4802eb8703197d038ebd5109f96aee333bd027963094f5bb33ad
y =... |
num1 = num2 = res = 0
def cn():
global canal
canal = "CBF cursos"
cn() # Função deve ser chamada pois é apartir dela que variável canal surgiu.
# Variável canal é chamada, expressando no console o valor que recebeu.
print(canal)
|
"""
Configuration for development - change these with caution!
"""
REGION_DIMS = (512, 512)
DEFAULT_FILTRATION_STATUS = None
DEFAULT_FILTRATION_CACHE_FILEPATH = "filtration_cache.h5"
DEFULAT_FILTRATION_CACHE_TITLE = "filtration_cache"
DATASET_FILTRATION_PREPROCESSING_MULTIPROCESSING = False
FILTRATION_CACHE_A... |
# This problem was recently asked by AirBNB:
# You are given a singly linked list and an integer k. Return the linked list, removing the k-th last element from the list.
# Try to do it in a single pass and using constant space.
class Node:
def __init__(self, val, next=None):
self.val = val
self.n... |
a=int(input())
if(a%2==0):
if(a>=2 and a<5):
print ("Not Weird")
elif(a<=20):
print("Weird")
else:
print("Not Weird")
else:
print("Weird")
|
# test builtin object()
# creation
object()
# printing
print(repr(object())[:7])
|
class Solution:
def findSpecialInteger(self, arr: List[int]) -> int:
n = len(arr) // 4
c = 0
prev = -1
for e in arr:
if e == prev:
c += 1
else:
c = 1
prev = e
if c > n:
return e
|
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not u... |
'''
Data list contains all users info. Each user's info must be a list.
First Element: 0 (int)
Second Element: name (str)
Third Element: username (str)
Fourth Element: toph link (str)
Fifth Element: dimik link (str)
Sixth Element: uri link (str)
Note: If any user does not have an account leave ... |
students = []
references = []
benefits = []
MODE_SPECIFIC = '1. SPECIFIC'
MODE_HOSTEL = '2. HOSTEL'
MODE_MCDM = '3. MCDM'
MODE_REMAIN = '4. REMAIN'
|
nome = input("Informe Seu Nome: ").lower()
print("É um prazer te conhecer ",nome)
print("Senta o dedo nessa porra")
#essa parte está fora do exercício, aprendi q da para manipular um nome deixando a primeira letra maiúscula.
pl = nome[0:1].upper()
print(pl+ nome[1:]) |
#!/usr/bin/python3
'''Day 6 of the 2017 advent of code'''
def redistribute(memory):
'''helper to redistribute the memory'''
size = len(memory)
max_index = 0
max_value = memory[0] #always assumed to be memory
#find max and index of max
for i in range(size):
if memory[i] > max_value:
... |
secret_password = "marty"
def apasswordcheker(password_checkers):
if password == "marty":
print("You figured out the secret password")
def password_check(passwd):
SpecialSym =['$', '@', '#', '%']
val = True
if len(passwd) < 6:
print('length should be at least 6')
... |
#Faça um programa que leia algo pelo teclado e mostre na tela o seu tipo primitivo e todas as informações possíveis sobre ele
var = input('Digite algo: ')
print('O tipo primitivo desse valor é', type(var))
print('Só tem espaços? ', var.isspace())
print('É um número ', var.isnumeric())
print('É alfabetico', var.isalpha(... |
def levenshtein_dis(wordA, wordB):
wordA = wordA.lower() # making the wordA lower case
wordB = wordB.lower() # making the wordB lower case
# get the length of the words and defining the variables
length_A = len(wordA)
length_B = len(wordB)
max_len = 0
diff = 0
distances = []
dist... |
#
# PySNMP MIB module SHIVA-ETHER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SHIVA-ETHER-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:54:57 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... |
def set_search_path(sender, **kwargs):
conn = kwargs.get('connection')
if conn is not None:
cursor = conn.cursor()
cursor.execute("SET search_path=saleor")
|
def debug_report_progress(repo_ctx, msg):
if repo_ctx.attr.debug:
print(msg)
repo_ctx.report_progress(msg)
for i in range(25000000):
x = 1
|
print('---- Loja Super Baratão ----')
acima_mil = total = 0
barato = None
nome_protudo = ''
while True:
nome = str(input('Nome do Produto: ')).strip()
preco = float(input('Insira o Preço: R$ '))
total += preco
if preco >= 1000:
acima_mil += 1
if barato == None:
barato = preco
nome_protu... |
# -*- coding: utf-8 -*-
def get_normals(self, indices=[]):
"""Return the array of the normals coordinates.
Parameters
----------
self : MeshVTK
a MeshVTK object
indices : list
list of the points to extract (optional)
Returns
-------
normals: ndarray
Normals co... |
print('='*10, 'Desafio 15', '='*10)
dias = int(input('Quantos dias o carro ficou alugado?'))
km = float(input('Quantos quilometros foram rodados?'))
pago1 = dias * 60
pago2 = km * 0.15
pago = pago1 + pago2
print('O total a pagar é R$ {:.2f}.'.format(pago)) |
"""
Time Complexity: O(1)
Space Complexity: O(1)
"""
for number in [2, 3, 5, 7, 11, 13, 19, 23, 29]:
print(number)
|
def respond(code=200, payload={}, messages=[]):
return {
'status': 'ok' if int(code/100) == 2 else 'error',
'code': code,
'messages': messages,
'payload': payload,
}, code
|
class Puzzle:
def __init__(self, grid):
self.grid = grid
self.empty_cells = []
def check_full(self):
"""
Checks if grid is full.
:return: True if full, otherwise False
"""
for row in range(0, 9):
for col in range(0, 9):
... |
default_app_config = 'business.staff_accounts.apps.UserManagementConfig'
"""
This APP is for management of users
Functions:-
Adding staff Users and giving them initial details
-Department
-Staff Type
-Departmental,General Managers have predefined roles depending on the departments they can... |
# finding least positive number
# Given an array of integers, find the first missing positive integer in linear time and constant space. In other words,
# find the lowest positive integer that does not exist in the array. The array can contain duplicates and negative numbers as well.
# code contributed by devanshi katy... |
# Aula 7 - Operadores Aritméticos
# -*- coding: utf-8 -*-
# -*- coding: cp1252 -*
'''
nome = input('Qual o seu nome? ')
print(f'Prazer em conhecer voce, {nome}')
print('='*20)
'''
n1 = int(input('Digite um numero: '))
n2 = int(input('Digite outro numero: '))
a = n1 + n2
s = n1 - n2
m = n1 * n2
d = n1 / n2
di = n1 /... |
def login_required(func):
def not_logged_in(self, **kwargs):
self.send_login_required({'signin_required': 'you need to sign in'})
return
def check_user(self, **kwargs):
user = self.connection.user
if not user:
return not_logged_in(self, **kwargs)
return func(... |
# C.O.R.S.
cors_origins = [
"http://localhost",
"http://localhost:8080",
"http://localhost:3000",
# Production Client on Vercel
"https://twitter-clone.programmertutor.com",
"https://www.twitter-clone.programmertutor.com",
"https://twitter.dericfagnan.com",
"https://www.twitter.dericfagna... |
"""
Created on Saturday, November 02, 2019 11:00:46 IST
@author: Saurabh Ghanekar
"""
ip = input("Enter ip adddress: ")
firstq1 = ""
flag = 0
for i in range(len(ip)):
if ip[i] == ".":
firstqs = ip[:i + 1]
break
for i in range(len(ip)):
if ip[i] == ".":
firsths = ip[:i + 1]
f... |
class Job:
def __init__(self, title, link, date, job_id):
'''
This class holds job information and attributes
'''
self.title = title
self.link = link
self.date = date
self.job_id = job_id
self.applied = False
self.old = False
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
fabrik_cli
------------
:copyright: (c) 2015-2016 by Fröjd Interactive AB
:license: MIT, see LICENSE for more details.
"""
__title__ = "fabrik_cli"
__version__ = "2.0.1"
__build__ = 201
__license__ = "MIT"
__copyright__ = "Copyright 2015-2016 Fröjd Interactive AB"
|
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "f9af1484",
"metadata": {},
"outputs": [],
"source": [
"# ---------------------- STEP 2: Climate APP\n",
"\n",
"from flask import Flask, json, jsonify\n",
"import datetime as dt\n",
"\n",
"import sqlalchemy\n... |
livro_predileto = "O diario do subsolo."
def favorite_book(titulo):
print(f'Meu livro predileto é "{livro_predileto}"')
favorite_book(livro_predileto)
|
# Add your import statements here
# Add any utility functions here
def rel_docs(query_id,qrels):
j=[item['id'] for item in qrels if item['query_num']==str(query_id)]
return j
def rel_score_as_dict_for_query(query_id,qrels):
docs_score_dict={int(item['id']):int(item['position']) for item in qrels if int(it... |
class MockData:
def __init__(self):
self.data = [
'ATGCAT',
'ATGGGT',
'ATGAAT',
]
def get_row(self, i):
return self.sequences[i] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class PodiumUser(object):
"""
Object that represents a particular User.
**Attributes:**
**user_id** (int): User id
**uri** (string): URI for the User.
**username** (string): The User's username.
**description** ... |
def devanagari_characters():
dic = [
# space:
(' ', ' '),
# comma:
#(',', ' , '),
# initial vowels:
('A','अ'),
('Ā','आ'),
('I', 'इ'),
('Ī','ई'),
('U', 'उ'),
('Ū', 'ऊ'),
('Ṛ', 'ऋ'),
('Ṝ', 'ॠ'),
('E', 'ए'),
('O', 'ओ'),
('Đ', 'ऐ'),
('Ő', 'औ'),
... |
class Arc(object):
"""
Python representation of a constraint arc
"""
def __init__(self, left, right):
"""
Since the arc is a directed edge, the left and right components
of the arc are initalized where the arc travels from left to right.
"""
self.left = left
... |
#
# PySNMP MIB module ONEACCESS-DOT11-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ONEACCESS-DOT11-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:25:00 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... |
class Decipher:
def __init__(self, data='', password=''):
self.data = data
self.password = password
self.result = False
def decipher_password(self):
# For authentication(Deciphering your password)..
helper = self.data.split('*/*/')
count, separator, compare, help... |
class Error(Exception):
pass
class ResourceNotFoundError(Error):
pass
class ResourceAlreadyExistsError(Error):
pass
class DatabaseCommitFailedError(Error):
pass
|
N = int(input())
t = N % 360
if t == 90 or t == 270:
print('Yes')
else:
print('No')
|
#!/usr/bin/python3
# Demo of a dictionary comprehension
d={i:chr(i) for i in range(ord('a'),ord('z')+1)}
for k,v in d.items():
print(k,':',v)
|
"""
Write a Python script to generate and print a dictionary that contains a number (between 1 and n) in the form (x, x*x).
Sample Dictionary ( n = 5) :
Expected Output : {1: 1, 2: 4, 3: 9, 4: 16, 5: 25}
"""
n=int(input("Input a number "))
d = dict()
for x in range(1,n+1):
d[x]=x*x
print(d) |
#!/usr/bin/python3
class GuiService():
def readSettingsFile(self,wert):
settingsFile = open("Settings","r")
file = settingsFile.read()
fileList = file.split("\n")
for element in fileList:
if wert in element:
x = element.split(":")
return x... |
carbohydrate_min_length = 3
carbohydrate_chain_length_including_start_C = 3
def is_glycan(a_category):
for _ in a_category["types"]:
if "Glycan" in _:
return True
return False
def add_carbohydrate_output(output, type_, mass, num_c_atoms, num_o_atoms, atom_list, full_atom_dic):
output... |
class MicroRaidenException(Exception):
"""Base exception for uRaiden"""
pass
class InvalidBalanceAmount(MicroRaidenException):
"""Raised if the payment contains lesser balance than the previous one."""
pass
class InvalidBalanceProof(MicroRaidenException):
"""Balance proof data do not make sense.... |
class Error(Exception):
"""Base class for other exceptions"""
pass
class TopicOrServiceNameDoesNotExistError(Error):
"""The topic or service name passed does not exist in the source destination dictionary."""
pass
|
n = int(input("Enter a number you want to check:"))
def digisum(n):
return sum([int(s) for s in str(n)])
def getfactors(n):
k=2
result=[]
while k ** 2 <= n:
while n%k==0:
result.append(k)
n = n // k
k = k +1
if n > 1:
result.append(n)
return resu... |
def obok(n, kost):
szesc = [[[k * n**2 + j * n + i + 1 for i in range(n)] for j in range(n)] for k in range(n)]
p = 0
r = 0
m = 0
for a in range(n):
for b in range(n):
for c in range(n):
if szesc[a][b][c] == kost:
p=a
... |
def getAbsMax(list, roundTo=None):
"""
`list` - the list/array to find the absolute maximum
`roundTo` - the number of digits to round the result to.
returns the absolute maximum of a list.
"""
x = max(max(list), abs(min(list)))
if roundTo:
x = round(x, roundTo)
return x
|
########
##
## Class to represent a bot in an IPD tournament
##
########
class BotPlayer(object):
"""
This class should be inherited from by bots who define their
own getNextMove method. That is how bots have their own strategy.
self.name is the name of the strategy employed
self.description is an... |
class OrderNotFound(Exception):
def __init__(self, message='Order tidak ditemukan!'):
self.message = message
super().__init__(self.message)
pass
|
class Solution:
def addDigits(self, num: int) -> int:
while num > 9:
num = sum(int(ch) for ch in str(num))
return num
|
value = ''
for i in range(1, 10001):
value = value + str(i) + ' '
value = value.replace('0', ' ')
values = value.split(' ')
total = 0;
for num in values:
if num.lstrip().rstrip().strip() == '':
continue
total += int(num)
print ('Total: ' + str(total))
|
class Stack:
def __init__(self):
self.data = []
def pop(self):
if self.is_empty():
return None
val = self.data[len(self.data)-1]
self.data = self.data[:len(self.data)-1]
return val
def peek(self):
if self.is_empty():
return None
... |
class Solution:
def numSteps(self, s: str) -> int:
i = int(s, 2)
st = 0
while i != 1:
if i % 2 == 0:
i = i//2
else:
i += 1
st += 1
return st
class Solution2:
def numSteps(self, s: str) -> int:
"""
... |
"""The result library."""
class Result:
"""
Construct Result objects.
Result is the basic answer for services that encapsulates the outcome of the service in a clear
and consistent pattern across services. It was added after creating some services, so there are
a few of them that do not make use ... |
idademedia = float(0)
homemvelho = 0
nomehomem = ''
mulheresnovas = 0
for p in range(1, 5):
print('-' * 5, ' {}ª PESSOA '.format(p), '-' * 5)
# PEGA O NOME
nome = str(input('Nome: ')).strip()
#PEGA A IDADE
idade = int(input('Idade: '))
idademedia += idade
# PEGAR O SEXO
sexo = str(input(... |
class Solution:
def shortestWordDistance(self, words, word1, word2):
i1 = i2 = -1
res, same = float("inf"), word1 == word2
for i, w in enumerate(words):
if w == word1:
if same: i2 = i1
i1 = i
if i2 >= 0: res = min(res, i1 - i2)
... |
class LogSystem:
def __init__(self):
"""Design.
"""
self.d = {}
self.g = {'Year': 4, 'Month': 7, 'Day': 10, 'Hour': 13, 'Minute': 16, 'Second': 19}
def put(self, id: int, timestamp: str) -> None:
self.d[timestamp] = id
def retrieve(self, start: str, end: s... |
if __name__ == '__main__':
n = int(input())
arr = map(int, input().split(' '))
arr = sorted(list(arr))
arr.reverse()
biggest = arr[0]
for i in arr:
if i != biggest:
print(i)
break
|
class Test():
pass
test = Test()
print(test.__new__)
|
i = input('carteira em reais: ')
d = float(i)/3.27
print('carteira em dollar: ',d) |
# GUI Application automation and testing library
# Copyright (C) 2006 Mark Mc Mahon
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at you... |
class News:
'''
news class to define news Objects
'''
def __init__(self, id, name, description, url, category, language, country):
self.id =id
self.name = name
self.description= description
self.url =url
self.category=category
self.language = language
... |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed 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/LICENSE-2.0
#
# Unless required by applicable law or ... |
class Solution:
# 1st solution, TLE
def shortestPath(self, grid: List[List[int]], k: int) -> int:
ans = [float("inf")]
self.bfs(grid, 0, 0, 0, k, ans)
return ans[0] if ans[0] != float("inf") else -1
def bfs(self, grid, i, j, steps, k, ans):
if k < 0:
return
... |
def is_palindrome(line: str) -> bool:
# Здесь реализация вашего решения
pass
print(is_palindrome(input().strip()))
|
class Solution:
def customSortString(self, S: str, T: str) -> str:
char_map = {}
for el in S:
char_map[el] = 0
for el in T:
if el in char_map:
char_map[el] = char_map[el] + 1
else:
char_map[el] = 1
output_str = ""
... |
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def taskflow_repository():
maybe(
http_archive,
name = "taskflow",
urls = [
"https://github.com/taskflow/taskflow/archive/refs/tags/v3.2.0.zip",
... |
line = input()
abbr = line[0]
for i in range(len(line)):
if line[i] == "-":
abbr += line[i+1]
print(abbr)
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed May 6 11:24:11 2020
provides formatting for COVID-19 Notebook
@author: seanlucas
"""
def html_catalog(catalog):
metadata = catalog.get_metadata()
dataproduct_rows = ''
for dataproduct in metadata['dataProducts']:
dataproduct_rows ... |
class BinaryTree:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
def nodeDepths(root, depth=0):
if root is None:
return 0
return (depth + nodeDepths(root.left, depth + 1)
+ nodeDepths(root.right, depth + 1))
|
def sqrt(x):
y = 1.0
while abs(y*y - x) > 1e-6 :
print(y)
y=(y+x/y)/2
return y
if __name__=='__main__':
print(sqrt(99))
|
# encoding:utf-8
# 默认都是从小到大排序
# 1 选择排序比冒泡好,交换次数少
def select_sort(lists):
for i in range(0, len(lists)):
min = i # 不同之处
for j in range(i + 1, len(lists)):
if lists[j] < lists[min]:
min = j
lists[min], lists[i] = lists[i], lists[min] # 这儿才交换
return lists
# ... |
a1 = str(input('Digite o nome completo de uma pessoa : '))
a3 = a1.strip().lower().find('silva')
if a3 < 0:
print('O nome {} nao possui a palavra Silva'.format(a1))
else:
print('O nome {} possui a palavra Silva'.format(a1))
# ou
nom = str(input('digite o nome : ')).strip()
print('seu nome tem silva? {}'.format(... |
#===============================================
#RESOLUTION KEYWORDS
#===============================================
oref = 0 #over refine factor - should typically be set to 0
n_ref = 32 #when n_particles > n_ref, octree refines further
zoom_box_len = 100 #kpc; so the box will be +/- zoom_box_len from the center
bbo... |
#
# PySNMP MIB module CISCO-VLAN-BRIDGING-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-VLAN-BRIDGING-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:18:48 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... |
# Error Handling
def inp(a):
while True:
try:
n = int(input(a))
except ValueError:
print('Please enter a number only !!')
else:
return n
print(inp("Enter a number: "))
try:
while x:
print("Hello\n")
raise NameError
except NameError as e... |
class Diff:
def __init__(self):
self.user = None
self.date = None
self.note = None
self.fields = {}
def diff_historical_object(original_historical_object, changed_historical_object):
"""
Performs a diff between two historical objects to determine which fields have changed.
... |
high = 0
for x in range(100,1000):
for y in range(100,1000):
if str(x*y) == str(x*y)[::-1] and x*y>high:
high = x*y
print(high)
|
# %% [504. Base 7](https://leetcode.com/problems/base-7/)
class Solution:
def convertToBase7(self, num: int) -> str:
sign, num = "-" * (num < 0), abs(num)
res = []
while num:
res.append(str(num % 7))
num //= 7
return sign + "".join(res[::-1] or ["0"])
|
print('=========== SUCESSOR E ANTECESSOR ===========')
n = int(input('Digite um numero: '))
sucessor = n + 1
antecessor = n - 1
print(f'O número escolhido é {n}\nSeu sucessor é {sucessor}\nE seu antecessor é {antecessor}')
|
label_6000 = [
"健全",
"女の子1人",
"ソロ",
"長い髪",
"高解像度",
"おっぱい",
"赤面",
"スマイル",
"ショートヘア",
"ビューアを見て",
"口を開けてる",
"複数の女の子",
"青い目",
"ブロンドの髪",
"茶髪",
"東方",
"スカート",
"帽子",
"ニーソックス",
"大きな胸",
"黒髪",
"赤い目",
"悪いID",
"卑猥かも?",
"女の子2人",
"悪... |
class ModelConfig(object):
def __init__(self, max_epochs, batch_size,
learning_rate, per_series_lr_multip, gradient_eps, gradient_clipping_threshold,
lr_scheduler_step_size, noise_std,
level_variability_penalty, tau, c_state_penalty,
state_hsize, dilation... |
'''
class Solution {
public ListNode swapNodes(ListNode head, int k) {
int listLength = 0;
ListNode currentNode = head;
// find the length of linked list
while (currentNode != null) {
listLength++;
currentNode = currentNode.next;
}
// set the f... |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def is_balanced(self, root):
"""
:type root: TreeNode
:rtype: bool
"""
def check... |
#9.28 6:23AM
def reverse_sub_list(head, p, q):
# TODO: Write your code here
# to capture the apart
pre_p, post_q = head, head
# to capture the range
p_node, q_node = head, head
# to track others
pointer = head
oneStep = pointer.next
while oneStep is not None:
if oneStep.value == p:
pre_p = ... |
class MotorControllerCANStatus():
"""CTRE TalonSRX/VictorSPX motor controller CAN bus status frame decoder
The base arbitration ID for the TalonSRX is 0x02040000 and 0x01040000 for
the VictorSPX. The arbitration device ID is a 6-bit value between 0x00 and
0x3F. The arbitration status ID's are as foll... |
"""
Given a non-empty, singly linked list with head node head, return a middle node of linked list.
If there are two middle nodes, return the second middle node.
Input: [1,2,3,4,5]
Output: Node 3 from this list (Serialization: [3,4,5])
The returned node has value 3. (The judge's serialization of this node is [3,4,5]... |
#
# PySNMP MIB module ADTRAN-ATLAS-MODULE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ADTRAN-ATLAS-MODULE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:14:30 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... |
"""
Given an unsorted list of integers, sort those integers using the Bubble Sort algorithm.
Return the number of swaps required to sort the list.
Bubble Sort is a simple sorting algorithm that works as follows:
1. Start at the beginning of the list, and traverse through each element.
2. For each element, if the elem... |
# https://www.codewars.com/kata/555eded1ad94b00403000071/train/python
def series_sum(n):
if n == 0:
return "0.00"
if n == 1:
return "1.00"
sum = 1
floor = 4
for _ in range(n-1):
sum += (1/floor)
floor += 3
return '%.2f' % round(sum,2)
|
# magicblast_alignment.py
#
# Author: Jan Piotr Buchmann <jan.buchmann@sydney.edu.au>
# Description:
#
# Version: 0.0
class MappingAlignment:
class Read:
def __init__(self, name, start, stop, strand, qlen):
self.name = name
self.length = int(qlen)
self.sra_rowid = name.split('.')[1]
... |
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
class CiTarget:
version: str
name: str
snapshot: bool
def __init__(self, version: str, name: str, snapshot: b... |
'''
Exercise 1:
1. Write a recursive function print_all(numbers) that prints all the
elements of list of integers, one per line (use no while loops or for loops).
The parameters numbers to the function is a list of int.
2. Same problem as the last one but prints out the elements in reverse order.
'''
#printing all in... |
class Generations(object):
def __init__(self):
self.age = self.next_age = 0
self.neighbors = [None] * 8
self.live_count = 0
def count_live_neighbors(self):
self.live_count = 0
for n in self.neighbors:
if n.age == 1:
self.live_count += 1
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.