content stringlengths 7 1.05M |
|---|
#
# PySNMP MIB module A3COM-HUAWEI-LPBKDT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM-HUAWEI-LPBKDT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 16:50:56 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... |
"""TODO: package docstring."""
def hello():
"""Say hello."""
print("Hello world!")
|
__title__ = 'https'
__author__ = 'Gloryness'
__license__ = 'MIT License'
|
class BoundedQueue:
# Constructor, which creates a new empty queue:
def __init__(self, capacity):
assert isinstance(capacity, int), ('Error: Type error: %s' % (type(capacity)))
assert capacity >= 0, ('Error: Illegal capacity: %d' % (capacity))
self.__items = []
self.__capacity ... |
def answer(question):
words = question \
.rstrip("?") \
.replace("plus", "+") \
.replace("minus", "-") \
.replace("multiplied by", '*') \
.replace("divided by", "/") \
.replace("raised to the", "^") \
.split()
for i in range(len(words) - 2):
if wo... |
def sorted_nosize_search(listy, num):
# Adapted to work with a Python sorted
# array and handle the index error exception
exp_backoff = index = 0
limit = False
while not limit:
try:
temp = listy[index]
if temp > num:
limit = True
else:
... |
# -*- coding: utf-8 -*-
"""
Package of optimizers.
"""
|
class Solution:
def singleNumber(self, nums: List[int]) -> int:
counts = {}
for num in nums:
if num in counts:
counts[num] += 1
else:
counts[num] = 1
if counts[num] == 3:
counts.pop(num)
return list(counts.ke... |
#
# PySNMP MIB module CXIoHardware-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CXIoHardware-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:17:22 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 -*-
# ISO 693-1 language codes from pycountry
Iso2Language = {
u'aa': u'Afar',
u'ab': u'Abkhazian',
u'af': u'Afrikaans',
u'ak': u'Akan',
u'sq': u'Albanian',
u'am': u'Amharic',
u'ar': u'Arabic',
u'an': u'Aragonese',
u'hy': u'Armenian',
u'as': u'Assamese',
u... |
"""
headers:
Set-Cookie:
description: Session cookie
schema:
type: string
example: SESSIONID=abcde12345; Path=/
"\0Set-Cookie":
description: CSRF token
schema:
type: string
example: CSRFTOKEN=fghijk678910; Path=/; HttpOnly
"""
|
#
# PySNMP MIB module PPPOE-MGMT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PPPOE-MGMT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:41:53 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... |
'''
digital media index:
0 - digital media id
1 - owner_id
2 - name
3 - description
4 - file_path
5 - thumbnail_path
6 - category_id
7 - media_type_id
8 - price
9 - approved
'''
##############################################
# Search logic #
######... |
def solve(*args):
min_number = min(args[0])
max_number = max(args[0])
summary = sum(args[0])
print(f'The minimum number is {min_number}')
print(f'The maximum number is {max_number}')
print(f'The sum number is: {summary}')
solve(list(map(int, input().split())))
|
w, h = 4, 100
list_of_gedung = [[0 for x in range(w)] for y in range(h)]
def createVertex(upperbackleft_x, upperbackleft_y, upperbackleft_z, upperbackright_x, upperbackright_y, upperbackright_z, upperfrontleft_x, upperfrontleft_y, upperfrontleft_z, upperfrontright_x, upperfrontright_y, upperfrontright_z, underbackleft... |
## @file
# Module to gather dependency information for ASKAP packages
#
# @copyright (c) 2006 CSIRO
# Australia Telescope National Facility (ATNF)
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# PO Box 76, Epping NSW 1710, Australia
# atnf-enquiries@csiro.au
#
# This file is part of the ASKAP ... |
## Sum of odd numbers
## 7 kyu
## https://www.codewars.com/kata/55fd2d567d94ac3bc9000064
def row_sum_odd_numbers(n):
total = 0
row_sum= 0
for i in range(n-1,0, -1):
total += i
starting_odd = total * 2 + 1
for i in range(1,n+1):
row_sum += starting_odd
starti... |
# Copyright 2017 The Bazel Authors. 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 o... |
#
# PySNMP MIB module RFC1253-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RFC1253-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:00: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 2019, 0... |
# -*- coding: utf-8 -*-
#+---------------------------------------------------------------------------+
#| This file is subject to the terms and conditions defined in file |
#| 'LICENSE.txt', which is part of this source code package. |
#| ... |
# MIT OC - CS600 - Introduction to Computer Science and Programming
# Problem Set 1: 3 Simple Problems - Problem 1 Min Payment
# Name: Luke Young
# Collaborators: None
# Time Spent: 01:00 (hr:min)
# 2018 04 21 00:20
# Program: Finding remaining balance after minimum payment
#
# Write a program that does the followin... |
# -*- coding: utf-8 -*-
"""
plugin
~~~~
plugin manager and plugin api
:copyright: (c) 2017 by Baidu, Inc.
:license: Apache, see LICENSE for more details.
""" |
getInvoiceTopLevelItems = [
{
'categoryCode': 'sov_sec_ip_addresses_priv',
'createDate': '2018-04-04T23:15:20-06:00',
'description': '64 Portable Private IP Addresses',
'id': 724951323,
'oneTimeAfterTaxAmount': '0',
'recurringAfterTaxAmount': '0',
'hostName': ... |
#!/usr/bin/env python3
#this program will write out my full name and preferred pronouns
print("Fabian Arias, he/him/his") #print out Fabian Arias, he/him/his
|
class DSF_SIC_Map(object):
"""docstring for SIC_Map"""
def __init__(self, dsffile = 'crsp/dsf.csv', sicfile = 'sic_codes.txt'):
self.dsf = pd.read_csv("dsf.csv", dtype = {'CUSIP': np.str, 'PRC': np.float}, na_values = {'PRC': '-'})
self.sic = pd.read_table(sicfile, header = 1)
self.sic.c... |
class Serial:
def __init__(self, port=None, baudrate=None, timeout=None):
pass
def reset_output_buffer(self):
pass
def reset_input_buffer(self):
pass
def writable(self):
return True
def write(self, bytes):
pass
def flush(self):
pass
def r... |
"""
Python2-specific versions of various functions used by stomp.py
"""
NULL = '\x00'
def input_prompt(prompt):
"""
Get user input
:rtype: str
"""
return raw_input(prompt)
def decode(byte_data, encoding=''):
"""
Decode the byte data to a string - in the case of this Py2 version, we can... |
"""CIS 122 Winter 2018 Week 1 Problem set #1-3
Author: Jamie Thayer
Credit: Just me, Jamie Thayer. Referenced https://docs.python.org/3/library/ to check function names
Description: Introduction to programming Week-1 problem set. Use of Python numeric data types and
operations to solve a variety of small problems."""
... |
def is_even(x):
if (x % 2 == 0):
return True
return False
print([x for x in range(100) if is_even(x)]) |
# terrascript/data/AdrienneCohea/nomadutility.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:22:45 UTC)
__all__ = []
|
n1 = float(input('Digite a P1: '))
n2 = float(input('Digite a P2: '))
M = (n1+n2)/2
if M > 7:
print(f'Aluno APROVADO com média {M}')
elif 5 >= M or M < 6.75:
print(f'Aluno em RECUPERAÇÃO com média {M}')
else:
print(f'Aluno REPROVADO com média {M}')
|
# Este es el ejercicio del grupo tercero c
# del dia 13 de septiembre de 2021
# esta linea coloca un mensaje en la consola
print("Este programa hace operaciones basicas")
num1 = 130
numero_2 = 345
suma = num1 + numero_2 # la resta se hace con el simbolo '-'
multip = num1 * numero_2 # la dicision se hace con una '/'
p... |
score = input('Please enter your score.')
score_float = float(score)
if (score_float >= 0.9 and score_float < 1.0) :
grade = 'A'
elif (score_float >= 0.8 and score_float < 1.0) :
grade = 'B'
elif (score_float >= 0.7 and score_float < 1.0) :
grade = 'C'
elif (score_float >= 0.6 and score_float < 1.0) :
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
assert any(list(map(lambda x: x > 4, range(8))))
assert any(map(lambda x: x > 4, range(8)))
assert not any(list(map(lambda x: x < 0, range(8))))
assert not any((map(lambda x: x < 0, range(8))))
|
class User:
'''
This class generates new user instances
'''
def __init__(self, fullname, email, username, password):
self.fullname = fullname
self.email = email
self.username = username
self.password = password
user_list = []
def save_user(self):
'''
... |
"""
Datos de entrada
precio_final-->pf-->int
precio_publico-->pp-->int
Datos de salida
descuento-->d-->float
"""
#Entradas
pf=int(input("Ingrese el precio final: "))
pp=int(input("Ingrese el precio al público: "))
#Caja negra
r=((pp-pf)/pp)*100
#Salidas
print(f"El porcentaje de descuento fue de: {r}%") |
class Solution(object):
def numDistinct(self, s, t):
"""
:type s: str
:type t: str
:rtype: int
"""
dp = [[0 for j in range(len(t) + 1)] for i in range(len(s) + 1)]
for i in range(len(s) + 1):
dp[i][0] = 1
for i in range(1, len(s) + 1)... |
class VehicleDevice:
def __init__(self, data, controller):
self._id = data['id']
self._vehicle_id = data['vehicle_id']
self._vin = data['vin']
self._state = data['state']
self._controller = controller
self.should_poll = True
def _name(self):
return 'Tesla... |
#=======================================================================================
# Open a domain template.
#=======================================================================================
selectCustomTemplate("wls/wlserver/common/templates/wls/wls.jar")
loadTemplates()
setOption('NodeManagerType','Man... |
def create_matrix(rows, columns):
result = []
for r in range(rows):
row = ["" for c in range(columns)]
result.append(row)
return result
def print_result(matrix):
for el in matrix:
print("".join(el))
rows, columns = map(int, input().split())
snake = input()
matrix = create_matri... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
"""
Problem 11.
Assume that two variables, varA and varB, are assigned values,
either numbers or strings. Write a piece of Python code that
prints out one of the following messages:
* "string involved" if either varA or varB are strings
* "bigger" if varA is larger than varB
* "equal" if varA is equal to varB... |
cars = 100.00 #number of cars available for the day
space_in_a_car = 4.00 #amount of space in a cars
drivers = 30.00 #number of available drivers
passengers = 90.00 #number of available passengers
cars_not_driven = cars - drivers #calculation for cars that are not used
cars_driven = drivers #calculation for cars that a... |
"""ll are a list which are linked
starts at head and ends at tail
Look up: O(n)
Insert: O(n)
Delete: O(n)
Append: O(1)
Prepend: 0(1)
"""
# * define class node which will act as a blue print for each node
class Node():
def __init__(self, data): # we pass the data we want tthe node to hold
self.data = ... |
class Solution:
def findMaximumXOR(self, nums: List[int]) -> int:
ans = mask = 0
for x in range(32)[::-1]:
mask += 1 << x
prefixSet = set([n & mask for n in nums])
temp = ans | 1 << x
for prefix in prefixSet:
if temp ^ prefix in prefixS... |
#
# PySNMP MIB module OMNI-gx2CM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/OMNI-gx2CM-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:23:48 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... |
# -*- coding: utf-8 -*-
# Copyright 2021 Cohesity Inc.
class OracleDBConfigRedoLogGroupConf(object):
"""Implementation of the 'OracleDBConfig_RedoLogGroupConf' model.
GROUP1 : {DST1/CH1.log, DST2/CH1.log}
GROUP2 : {DST1/CH2.log, DST2/CH2.log}
GROUP3 : {DST1/CH3.log, DST2/CH3.log}
Attributes:
... |
str = input().strip()
n = int(input())
def check(s):
if s=='a'or s=='e' or s=='i' or s=='o' or s=='u':
return True
return False
def non_vowels(str,n):
i,index =0,0
start = 0
res = 0
non_vowels = 0
disturb_flag = True
while index<len(str):
if disturb_flag:
if not check(str[index]):
non_vowels +=... |
low = int(input())
high = int(input())
x = int(input())
#first from bottom
num = low
while num <=high:
tverrsum = sum([int(i) for i in str(num)])
if tverrsum == x:
print(num)
break
num+=1
#first from top
num = high
while num >= low:
tverrsum = sum([int(i) for i in str(num)])
if tver... |
PLAYGROUND = """
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8/>
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, minimal-ui">
<title>GraphQL Playground</title>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/graphql-playground-react@1.7.8/build/s... |
print("Python Program to print the sum and average of natural numbers!")
limit = int(input("Enter the limit of numbers:"))
sumOfNumbers = (limit * (limit + 1)) / 2
averageOfNumbers = sumOfNumbers / limit
print("The sum of", limit, "natural numbers is", sumOfNumbers)
print("The Average of", limit, "natural number is", a... |
instructions = [['addi', '$v0', '$zero', '0'], ['lw', '$t9', '0', '$a0'], ['addi', '$v0', '$v0', '1'], ['sw', '$t9', '$0', '$a1'], ['addi', '$a0', '$a0', '4'], ['addi', '$a1', '$a1', '4']]
MIPS_FORMAT = {
'Mnemonic': ['add','addi','addiu','addu','and','andi','beq','blez','bne','bgtz','div','divu','j','jal','jr'... |
"""This module was written by Gerd Woetzel:
http://mail.python.org/pipermail/python-list/2005-January/261304.html
This module is derived from Modules/rotormodule.c and translated
into Python. I have appended the Copyright by Lance Ellinghouse
below. The rotor module has been removed from the Python 2.4
... |
_base_ = [
'../_base_/datasets/s3dis_seg-3d-13class.py',
'../_base_/models/pointnet2_msg.py',
'../_base_/schedules/seg_cosine_50e.py', '../_base_/default_runtime.py'
]
# data settings
data = dict(samples_per_gpu=16)
evaluation = dict(interval=2)
# model settings
model = dict(
backbone=dict(in_channels... |
string = str (input())
string_copy = string
new_string = string.replace(string[0],string[-1])
new_string = string_copy.replace(string_copy[-1],string_copy[0])
print(new_string)
|
#!/usr/bin/env python
"""
_WMCore_
Core libraries for Workload Management Packages
"""
__version__ = '1.5.5.pre5'
__all__ = []
|
"""
Draft Material.
Cannabis Data Science Meetup Group
Copyright (c) 2022 Cannlytics
Authors: Keegan Skeate <keegan@cannlytics.com>
Created: 1/11/2022
Updated: 1/19/2022
License: MIT License <https://opensource.org/licenses/MIT>
"""
# # Define lab datasets.
# lab_datasets = ['LabResults_0', 'LabResults_1', 'LabResul... |
class SetupForm(QtWidgets.QWidget):
global model
model = SetupInformation()
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setObjectName("setupDialog")
# self.resize(1754, 3000)
self.model = model |
"""
COLOURS
"""
C_TEAL = 0, 128, 128
C_RED = 255, 0, 0
C_PINK = 255, 100, 100
C_GREEN = 0, 255, 0
C_BLUE = 0, 0, 255
C_WHITE = 255, 255, 255
C_BLACK = 0, 0, 0
C_GOLD = 255, 195, 0
"""
Questions and Answers
"""
QNA_PATH = 'QnA.txt'
with open(QNA_PATH) as f:
data = f.read().split('\n')
getting_... |
"""
Copyright (C) 2017 Espressive Inc
"""
|
def request(flow):
real_github_token = 'REPLACE_ME!'
auth_header = flow.request.headers.get('Authorization')
if auth_header:
flow.request.headers['Authorization'] = auth_header.replace('__GITHUB_TOKEN_PLACEHOLDER__', real_github_token)
def response(flow):
recording_proxy = 'http://host.docker.... |
class TokenMeta:
"""This class holds some meta data about a token from the text held by a Doc object.
This allows to create a Token object when needed.
"""
def __init__(self, text: str, space_after: bool):
"""Initializes a TokenMeta object
Args:
text (str): The token's text... |
TimesTable = int(input("Please Choose A Times Table To Be Quizzed On;\n1)One Times Tables\n2)Two Times Tables\n3)Three Times Tables\n4)Four Times Tables\n5)Five Times Tables\n6)Six Times Tables\n7)Seven Times Tables\n8)Eight Times Tables\n9)Nine Times Tables\n10)Ten Times Tables\n11)Eleven Times Tables\n12)Twelve Times... |
with open('text.txt', 'r', encoding='utf-8') as n:
line = n.readlines()
for index, value in enumerate(line, 1):
num = len(value.split())
print(f'Строка - {index}, число слов - {num}') |
nums = (input("")).split()
n = int(nums[0])
m = int(nums[1])
l= int(nums[2])
list1 = []
for i in range(n):
request = (input("")).split()
request[1] = float(request[1])
request[2] = int(request[2])
request[3] = int(request[3])
request.append(i)
list1.append(request)
l... |
"""
Settings,
As for the database, look for ../sql_orm/database.py
"""
#DEBUG/TEST MODE: This allows HTTP connection instead of HTTPS
TEST_MODE = True
API_PORT = 8000
# These are used only if the TEST_MODE is disabled
SSL_CERT_LOCATION = "path"
SSL_KEY_LOCATION = "path"
SSL_CA_LOCATION = "path"
# JWT access setting... |
capitals = ["Amsterdam", "Andorra la Vella", "Athens", "Berlin", "Bratislava", "Brussels", "Dublin", "Helsinki",
"Lisbon", "Ljubljana", "Luxembourg", "Madrid", "Monaco", "Nicosia", "Paris", "Riga", "Rome", "San Marino",
"Tallinn", "Valletta", "Vatican City", "Vienna", "Vilnius"]
# len_cities = l... |
CONFIG = {
'http': {
'port': 3000
},
'authentication': {
'salt_rounds': 12,
'secret': '!!! CHANGE ME !!!',
'issuer': 'example.com',
'token_expiry': '24h',
'admin_primary_email': 'admin@localhost',
'admin_default_password': 'admin'
},
'authoriza... |
#!/usr/bin/env python
# encoding: utf-8
"""
unique_path_ii.py
Created by Shengwei on 2014-07-28.
"""
# https://oj.leetcode.com/problems/unique-paths-ii/
# tags: medium, matrix, path, dp
"""
Follow up for "Unique Paths":
Now consider if some obstacles are added to the grids. How many unique paths would there be?
An... |
class FilePath:
regex = '[0-9]{4}'
def to_python(self, value):
return int(value)
|
# Time: O(n)
# Space: O(1)
class Solution(object):
def sumZero(self, n):
"""
:type n: int
:rtype: List[int]
"""
return [i for i in range(-(n//2), n//2+1) if not (i == 0 and n%2 == 0)]
|
test = {'name': 'q7',
'points': 8,
'suites': [{'cases': [{'code': '>>> t = Tree (1 , [ Tree (2) , Tree (1 , [ '
'Tree (2 , [ Tree (3 , [ Tree (0)])])])])\n'
'\n'
'>>> longest_seq( t) # 1 -> 2 -> 3\n'
... |
#Desafio 51 com while
print('\033[1;32m{:=^20}'.format('PA'))
v = int(input('VALOR BASE DA PROGRESSÃO: '))
r = int(input('VALOR DA RAZÃO DA PROGRESSÃO: '))
s = v
decimo = v + (10 - 1) * r
while v != decimo + r:
print('{}'.format(v), end = ' -> ')
v += r
print('END') |
x = [input() for x in range(10)]
m = 0
m_index = 0
for i in range(0,10,2):
if int(x[i]) > m:
m = int(x[i])
m_index = i
print(f"a maioe nota foi de {x[m_index+1]} com {x[m_index]} pontos") |
""" Auteur = Frédéric Castel
Date : Avril 2020
Projet : MOOC Python 3 - France Université Numérique
Objectif:
Écrire une fonction signature qui reçoit un paramètre identite. Ce paramètre est un couple (tuple de deux composantes)
dont la première composante représente un nom et la seconde un prénom.
... |
"""
There are two sorted arrays nums1 and nums2 of size m and n respectively.
Find the median of the two sorted arrays.
The overall run time complexity should be O(log (m+n)).
You may assume nums1 and nums2 cannot be both empty.
Example 1:
nums1 = [1, 3]
nums2 = [2]
The median is 2.... |
class Commands:
def __init__(self, arguments_commandline: list):
commands_allowed = ['compile', 'clean']
if len(arguments_commandline) > 1:
command = arguments_commandline[1]
if not command in commands_allowed:
raise Exception("You give an invalid command")... |
## Definición de la clase Nota
class Nota():
def __init__(self, cedula, nombre, nota):
self.cedula = cedula
self.nombre = nombre
self.nota = nota
## Métodos get y set correspondientes
def get_nota(self):
return self.nota
def set_nota(self, nota):
self.nota = ... |
"""
Base information for using R in BuildPacks.
Keeping this in r.py would lead to cyclic imports.
"""
# Via https://rstudio.com/products/rstudio/download-server/debian-ubuntu/
RSTUDIO_URL = "https://download2.rstudio.org/server/bionic/amd64/rstudio-server-1.2.5001-amd64.deb"
# This is MD5, because that is what RStud... |
def _map_int(*args):
"""Convert each element to an int"""
return list(map(_int, _flatten(args)))
|
class MyClass(object):
"""This is a test class."""
# Python has no real concept of private elements.
"""Default class initializer"""
# Every method, included in the class definition passes the object in question as its first parameter.
# The word 'self' is used for this parameter (usage of self... |
class ResourceVersionStatus(Enum,IComparable,IFormattable,IConvertible):
"""
An enum indicating whether a resource is current or out of date.
enum ResourceVersionStatus,values: Current (0),OutOfDate (1),Unknown (2)
"""
def __eq__(self,*args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <... |
size(200, 400)
path = BezierPath()
path.polygon((80, 28), (50, 146), (146, 152), (172, 78))
with savedState():
clipPath(path)
scale(200/512)
image("../images/drawbot.png", (0, 0))
translate(0, 200)
with savedState():
scale(200/512)
image("../images/drawbot.png", (0, 0))
|
with open("input.txt", "r") as input_file:
lines = input_file.readlines()
reports = [int(line, 2) for line in lines]
counts = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
for report in reports:
i = 0
num_of_bits = len(counts)
while i < num_of_bits:
counts[num_of_bits-1-i] += report >> i & 1
... |
'''
Determine whether an integer is a palindrome. Do this without extra space.
Could negative integers be palindromes? (ie, -1)
If you are thinking of converting the integer to string, note the restriction of using extra space.
You could also try reversing an integer. However, if you have solved the problem "Reverse... |
class Template:
model_owner = "model_owner"
detail_view = "detail_view"
detail_view_u = "detail_view_u"
detail_view_d = "detail_view_d"
detail_view_ud = "detail_view_ud"
all_objects_view = "all_objects_view"
filter_objects_view = "filter_objects_view"
user_register_view = "user_register_... |
#Write a function called num_factors. num_factors should
#have one parameter, an integer. num_factors should count
#how many factors the number has and return that count as
#an integer
#
#A number is a factor of another number if it divides
#evenly into that number. For example, 3 is a factor of 6,
#but 4 is not... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def apply_fn_to_list_items_in_dict(dictionary, fn, **kwargs):
"""
Given a dictionary with items that are lists, applies the given function to each
item in each list and return an updated version of the dictionary.
:param dictionary: the dictionary to... |
#
# Created on Sat Apr 25 2020
#
# Title: Leetcode - Jump Game
#
# Author: Vatsal Mistry
# Web: mistryvatsal.github.io
#
# Approach will be to traverse array in reverse, maintain last_optimum_pos
# and check whether last_optimum_pos is at the 0 index
class Solution:
def canJump(self, nums):
N = len(nums)... |
while True:
n = int(input())
if n == 0:
break
ans = 0
for i in range(n):
flag = True
s = input()
for j in range(len(s)):
if s[j] == ' ' and ans <= j:
flag = False
ans = j
break
if flag and ans < len(s):
... |
"""
Calculating the factors of an integer
- a number that evenly divides a larger number
"""
#
# def is_factor(a, b):
# if b % a == 0:
# return True
# else:
# return False
#
#
# print(is_factor(2, 1))
"""
Find the factors of an integer
"""
#
#
# def factors(n):
#
# for i in ran... |
# Shopping Options
# https://aonecode.com/amazon-online-assessment-shopping-options
def getNumberOfOptions(priceOfJeans, priceOfShoes, priceOfSkirts, priceOfTops, dollars):
if not priceOfJeans or not priceOfShoes or not priceOfSkirts or not priceOfTops:
return 0
js = []
for i in range(len(priceO... |
"""
core functionality
"""
def another_func(a, b):
"""
just a test
Parameters
----------
a : int
an input
b : float
another input
See also
--------
{{ cookiecutter.project_slug }}.{{ cookiecutter.project_slug }}.a_function
"""
pass
|
n=int(input('digite um número para saber o seu dobro,triplo e a sua raiz quadrada:'))
do=(n*2)
tri=(n+3)
ra=(n**(1/2))
print('Seu numero foi {} \n o dobro é {} \n o triplo é {} \n e a raiz é {}'.format(n, do, tri, ra)) |
_base_ = [
'_base_/datasets/cxr14_bs16.py',
'_base_/models/resnet50_cxr14.py',
'_base_/schedules/cxr14_bs16_ep20.py',
'_base_/default_runtime.py'
] |
#encoding:utf-8
# Write here subreddit name. Like this one for /r/BigAnimeTiddies.
subreddit = 'BigAnimeTiddies'
# This is for your public telegram channel.
t_channel = '@r_BigAnimeTiddies'
def send_post(submission, r2t):
return r2t.send_simple(submission)
|
def rest():
i01.setHeadSpeed(1.0,1.0)
i01.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
i01.setArmSpeed("right", 1.0, 1.0, 1.0, 1.0)
#atach
i01.head.neck.attach()
i01.head.rothead.attach()
i01.rightHand.attach()
i01.rightArm.shoulder.attach()
i01.rightArm.omoplate.attach()
i01.rightArm.bicep.a... |
"""
Implementation of a binary Min Heap, represented by an array.
"""
class MinHeap():
def __init__(self):
self.array = []
self.root = None
self.size = 0
def parent(heap, i):
"""
Returns the index of the parent of a given node.
"""
if i == 0:
return 0
return he... |
#!/usr/bin/python3
for i in range(-10,-100,-30):
print(i)
print(i) |
def test_index(client):
r = client.get("/")
assert r.status_code == 200
def test_paper_page(client):
r = client.get("/paper/1812.35598")
assert r.status_code == 200 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.