content stringlengths 7 1.05M |
|---|
# https://leetcode.com/problems/next-greater-node-in-linked-list/discuss/265508/JavaC%2B%2BPython-Next-Greater-Element
class Solution:
def nextLargerNodes(self, head):
res, stack = [], []
while head:
while stack and stack[-1][1] < head.val:
res[stack.pop()[0]] = head.val
... |
message = "Hello Python world!"
print(message)
message = "Hello Python Crash Course world!"
print(message)
mesage = "Hello Python Crash Course reader!"
print(mesage)
|
#!/usr/share/app/anaconda3/bin/python3
# encoding: utf-8
"""
@version: v1.0
@author: pu_yongjun
@license: Apache Licence
@contact: pu_yongjun@cdv.com
@site:
@software: PyCharm
@file: __init__.py.py
@time: 2018/7/30 下午7:07
""" |
class NHomogeneousBatchLoss:
def __init__(self, loss, *args, **kwargs):
"""
Apply loss on list of Non-Homogeneous tensors
"""
self.loss = loss(**kwargs)
def __call__(self, output, target):
"""
output: must be a list of torch tensors [1 x ? x spatial]
ta... |
n = int(input())
l = list(map(int, input().split()))
flag = 0
for i in range(1,max(l)+1):
for j in range(n):
if i>l[j]:
l[j] = 0
for j in range(n-1):
if l[j] == l[j+1]==0 or l[n-1]==0 or l[0] == 0:
flag = 1
break
if flag == 1:
break
if n==1:
pr... |
# NPTEL WEEK 3 PROGRAMMING ASSIGNMENT
def ascending(l):
if len(l)==0:
return(True)
for i in range(len(l)-1,0,-1):
if l[i]<l[i-1]:
return(False)
return(True)
#print(ascending([2,3,4,5,1]))
#print(ascending([1,2,3,4,5,5]))
def valley(l):
if len(l)<3:
r... |
def single_number(arr):
arr.sort()
idx = 0
while idx < len(arr):
try:
if arr[idx] != arr[idx + 1]:
return arr[idx]
except IndexError:
return arr[idx]
idx += 2
|
"""Parse plate-reader and fit ClopHensor titrations."""
__version__ = "0.3.3" # importlib.metadata.version(__name__)
|
# interp.py
'''
Interpreter Project
===================
This is an interpreter than can run wabbit programs directly from the
generated IR code.
To run a program use::
bash % python3 -m wabbit.interp someprogram.wb
'''
|
cityFile = open("Lecture5_NumpyMatplotScipy/ornek.txt")
cityArr = cityFile.read().split("\n")
cityDict = {}
for line in cityArr:
info = line.split(",")
cityName = info[0]
day = int(info[1])
rainfall = float(info[2])
if cityName in cityDict.keys():
days = cityDict[cityName]
days[... |
def print_keyword_args(**kwargs):
print('\n')
for key, value in kwargs.items():
print(f'{key} = {value}')
third = kwargs.get('third', None)
if third != None:
print('third arg =', third)
print_keyword_args(first='a')
print_keyword_args(first='b', second='c')
print_keyword_args(first='d', second='e',... |
class ShylockAsyncBackend:
@staticmethod
def _check():
raise NotImplementedError()
async def acquire(self, name: str, block: bool = True):
raise NotImplementedError()
async def release(self, name: str):
raise NotImplementedError()
class ShylockSyncBackend:
@s... |
class Solution:
# O(n) time | O(1) space
def minStartValue(self, nums: List[int]) -> int:
minSum, currentSum = nums[0], 0
for num in nums:
currentSum += num
minSum = min(minSum, currentSum)
if minSum < 0:
return abs(minSum) + 1
else:
... |
class TrieNode(object):
def __init__(self):
self.children = {}
self.is_word = False
class Trie(object):
def __init__(self):
self.root = TrieNode()
def insert(self, word):
curr = self.root
for letter in word:
if word in curr.children:
... |
foo = [25, 68, 'bar', 89.45, 789, 'spam', 0, 'last item']
print(foo[:3])
# difference?
print(foo[0:3])
print(foo[2:])
print(foo[1:-1]) |
# -*- coding: utf-8 -*-
config_page_name = {
'zh': {
'wikipedia': '',
}
}
|
class Result:
def __init__(self, id = None, success = None, message = None, url = None, data = None) -> None:
self.id = id
self.success = success
self.message = message
self.url = url
self.data = data
def to_json(self):
json_data = None
if (self.data and... |
def solution(arr):
size = 0
value = 0
for i in range(len(arr)):
if size == 0:
value = arr[i]
size += 1
else:
if value != arr[i] and size != 0:
size -= 1
else:
size += 1
leader = value
if arr.count(leader)... |
"""
The module provides utility methods for hash code calculation.
"""
HASH_SEED = 23
def calc_hashcode(seed_value: int, value: int) -> int:
"""
Calculates hash code of the value using seed value.
:param seed_value: Seed value (current hash code).
:param value: Value for which to calculate hash code.... |
class Solution(object):
def spiralOrder(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: List[int]
"""
if not matrix or not matrix[0]:
return []
len_mat_row = len(matrix)
len_mat_col = len(matrix[0])
j, k, m, n = 0, 0, 0, 0
... |
def memory(x):
x = [i for i in range(x)]
return -1
def time(x):
# recursive function to find xth fibonacci number
if x < 3:
return 1
return time(x-1) + time(x-2)
def error(x=None):
# error function
return "a" / 2
def return_check(*args, **kwagrs):
# args and kwargs function... |
class User:
user_budget = ""
travel_budget, food_budget, stay_budget = 500, 100, 400
travel_preference = False
stay_preference = False
food_preference = False
origin_city = ""
start_date = ""
return_date = ""
def __init__(self, origin_city, start_date, return_date, user_budget):
... |
#
# PySNMP MIB module HUAWEI-LswQos-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-LswQos-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:34:31 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... |
def test_check_userId1(client):
response = client.get('/check?userId=1')
assert "True" in response.json
def test_check_userId3(client):
response = client.get('/check?userId=3')
assert "False" in response.json
|
# Write your solution for 1.3 here!
mysum=0
i=0
while i <= 10000 :
i = i+1
mysum = mysum+ i
print (mysum) |
sexo= str(input('digite o sexo da pessoa \033[36m(M/F)\033[m: ')).upper().strip()[0]
while sexo not in 'MmfF':
sexo=str(input(' \033[32mdados inválidos, digite qual o sexo\033[m (M/F :')).strip().upper()
print(sexo)
|
config = {
"CLIENT_ID": "8",
"API_URL": "http://DOMAIN.COM",
"PERSONAL_ACCESS_TOKEN": "",
"BRIDGE_IP": "192.168.x.x",
}
|
"""
119. Edit Distance
https://www.lintcode.com/problem/edit-distance/description?_from=ladder&&fromId=106
九章算法强化班。经典DP题 (第二次写)
didn't sepcifiy direction/sequence, i can specify from left to right.
last step:
I can either add a char, delete or replace a character from word1->word2:
e.x. mart -> karma
add: a is added... |
load("//bazel/rules/cpp:main.bzl", "cpp_main")
load("//bazel/rules/unilang:unilang_to_java.bzl", "unilang_to_java")
load("//bazel/rules/code:code_to_java.bzl", "code_to_java")
load("//bazel/rules/move_file:move_file.bzl", "move_file")
load("//bazel/rules/move_file:move_file_java.bzl", "move_java_file")
def transfer_un... |
class Track:
count = 0
def __init__(self, track_id, centroid, bbox=None, class_id=None):
"""
Track
Parameters
----------
track_id : int
Track id.
centroid : tuple
Centroid of the track pixel coordinate (x, y).
bbox :... |
"""
Example of property documentation
>>> f = Foo()
>>> f.bar = 77
>>> f.bar
77
>>> Foo.bar.__doc__
'The bar attribute'
"""
# BEGIN DOC_PROPERTY
class Foo:
@property
def bar(self):
'''The bar attribute'''
return self.__dict__['bar']
@bar.setter
def bar(self, v... |
getinput = input()
def main():
# import pdb; pdb.set_trace()
res = []
split_input = list(str(getinput))
for i, _ in enumerate(split_input):
if i == len(split_input) - 1:
if split_input[i] == split_input[-1]:
res.append(int(split_input[i]))
else:
i... |
# Copyright 2022 MosaicML Composer authors
# SPDX-License-Identifier: Apache-2.0
"""Composer CLI."""
|
#
# PySNMP MIB module H3C-SUBNET-VLAN-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/H3C-SUBNET-VLAN-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:23:59 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... |
class User:
# create the class attributes
n_active = 0
users = []
# create the __init__ method
def __init__(self, active, user_name):
self.active = active
self.user_name = user_name
|
class DatabaseError(Exception):
pass
class GameError(Exception):
pass
|
# -*- coding: utf-8 -*-
"""
compat.py
~~~~~~~~~
Defines cross-platform functions and classes needed to achieve proper
functionality.
"""
pass
|
lst = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
def sequential__search(lst_, num):
for i in lst_:
if i == num:
print()
print(i)
return print()
print()
print(f"{num} does not exist in the given list")
print()
return False
sequential__search(lst, 10)
|
"""
Geological modelling classes and functions
"""
|
# -*- coding: utf-8 -*-
dummy_log = """commit 6b635e74901e6e4c264534c0f05dc0498e0f5eb6
Author: Vinayak Mehta <vmehta94@gmail.com>
Date: Tue Apr 14 15:45:38 2020 +0530
Latest commit
commit 9a05e2014694f1633a17ed84eab00f577d0a51f2
Author: Vinayak Mehta <vmehta94@gmail.com>
Date: Tue Apr 14 15:45:32 2020 +0530... |
def is_credit_card_valid(number):
length = len(number)
if length % 2 == 0:
return False
new_number = ''
rev = number[::-1]
for index in range(0,length):
if index % 2 == 0:
new_number += rev[index]
else:
new_number += (str)((int)(rev[index]) + (int)(rev[index]))
return sum(map(int, list(new_number... |
"""
Copyright (c) 2013-2015, Fionn Kelleher
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 conditions and the fol... |
"""
Templie exceptions
"""
class TemplieException(Exception):
def __init__(self, message):
super().__init__('ERROR: {}'.format(message))
class DslSyntaxError(TemplieException):
@classmethod
def get_error(cls, line):
return cls('invalid line: {}'.format(line.strip('\n')))
class Missing... |
"""Const for Velbus."""
DOMAIN = "velbus"
CONF_INTERFACE = "interface"
CONF_MEMO_TEXT = "memo_text"
SERVICE_SCAN = "scan"
SERVICE_SYNC = "sync_clock"
SERVICE_SET_MEMO_TEXT = "set_memo_text"
|
"""A test that verifies documenting a namespace of functions."""
def _min(integers):
"""Returns the minimum of given elements.
Args:
integers: A list of integers. Must not be empty.
Returns:
The minimum integer in the given list.
"""
_ignore = [integers]
return 42
def _assert_non... |
BNB_BASE_URL = "https://www.bnb.bg/Statistics/StExternalSector/StExchangeRates/StERForeignCurrencies/index.htm?"
BNB_DATE_FORMAT = "%d.%m.%Y"
BNB_SPLIT_BY_MONTHS = 3
BNB_CSV_HEADER_ROWS = 2
NAP_DIGIT_PRECISION = "0.01"
NAP_DATE_FORMAT = "%Y-%m-%d"
NAP_DIVIDEND_TAX = "0.05"
RECEIVED_DIVIDEND_ACTIVITY_TYPES = ["DIV", ... |
class Matcher:
def matches(self, arg):
pass
class Any(Matcher):
def __init__(self, wanted_type=None):
self.wanted_type = wanted_type
def matches(self, arg):
if self.wanted_type:
return isinstance(arg, self.wanted_type)
else:
return True
def __repr__(self):
re... |
print("The elementary reactions are:")
print(" Reaction 1: the birth of susceptible individuals with propensity b")
print(" Reaction 2: their death with propensity mu_S*S(t)")
print(" Reaction 3: their infection with propensity beta * S(t)*I(t)")
print(" Reaction 4: the death of infected individuals with propensity mu_... |
number = int(input('digite um número:'))
print(' Você digitou {}, seu antecessor é {} e seu sucessor é {}'.format(number, number-1, number+1))
|
def baz(x):
if x < 0:
baz(x)
else:
baz(x)
|
"""AyudaEnPython: https://www.facebook.com/groups/ayudapython
Dado una cadena de texto llamada "planetas" que contiene los planetas
del sistema solar que incluye la estrella Sol separados por el texto
'@plantea$' de la siguiente forma:
planetas = "Sol@plantea$Mercurio@plantea$Venus@plantea$Tierra" \
"@plantea$Mar... |
TABLES = {'Network': [['f_name', 'TEXT'],
['scenariodate', 'TEXT'],
['stopthresholdspeed', 'TEXT'],
['growth', 'TEXT'],
['defwidth', 'TEXT'],
['pedspeed', 'TEXT'],
['phf', 'TEXT'],
... |
class TxInfo:
def __init__(self, txid, timestamp, fee, fee_currency, wallet_address, exchange, url):
self.txid = txid
self.timestamp = timestamp
self.fee = fee
self.fee_currency = fee_currency
self.wallet_address = wallet_address
self.exchange = exchange
sel... |
'''https://practice.geeksforgeeks.org/problems/multiply-two-linked-lists/1
Multiply two linked lists
Easy Accuracy: 38.67% Submissions: 24824 Points: 2
Given elements as nodes of the two linked lists. The task is to multiply these two linked lists, say L1 and L2.
Note: The output could be large take modulo 109+7.
I... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def numComponents(self, head: ListNode, G: List[int]) -> int:
ans = 0
G_set = set(G)
cur = head
while cur:
... |
#Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Rock Paper Scissors!
#Problem level: 8 kyu
def rps(p1, p2):
if p1[0]=='r' and p2[0]=='s': return "Player 1 won!"
if p1[0]=='s' and p2[0]=='p': return "Player 1 won!"
if p1[0]=='p' and p2[0]=='r': return "Player 1 won!"
if p2[0]=='r' and p1[0]=... |
class ArgsTest:
def __init__(self, key:str=None, value:str=None,
max_age=None, expires=None, path:str=None, domain:str=None,
secure:bool=False, httponly:bool=False, sync_expires:bool=True,
comment:str=None, version:int=None): pass
class Sub(ArgsTest):
pass
|
def roll_new(name, gender):
pass
def describe(character):
pass |
# receive a integer than count the number of "1"s in it's binary form
#my :
def countBits(n):
i = 0
while n > 2:
if n % 2 == 1:
i = i + 1
n = (n-1)/2
else:
n = n/2
return (i + 1) if n != 0 else 0
|
#!/usr/bin/env python3
#https://codeforces.com/group/H9K9zY8tcT/contest/297264/problem/D
'''
#[print(*l) for l in gt]
#线下打表?
gt = [[i] for i in range(11)]
for i in range(2,11):
c = i
ii = i
while c<1e9:
ii *= i
c += ii
gt[i].append(c)
[print(l) for l in gt]
考虑一次while的解决方案
'''
q... |
# Faça um programa que leia o peso de cinco pessoas. No final mostre qual foi
# o maior e o menor peso.
maior = 0
menor = 0
for c in range(1, 6):
peso = int(input('Digite o peso da pessoa: '))
if c == 1:
maior = peso
menor = peso
else:
if peso > maior:
maior = peso
... |
# Escreva um programa que leia um número N inteiro qualquer e mostre na tela os N primeiros elementos de uma Sequência de Fibonacci.
# Ex: 0 - 1 - 1 - 2 - 3 - 5 - 8
print('='*50)
q = int(input("Quantos termos coçê quer mostrar?: "))
q -= 2
print('='*50)
x = 0
fn = 0
f = 1
print('~'*50)
print('{} => {} => '.format(fn,f)... |
# -*- coding: utf-8 -*-
class ImageSerializerMixin:
def build_absolute_image_url(self, url):
if not url.startswith('http'):
request = self.context.get('request')
return request.build_absolute_uri(url)
return url
|
__version__ = "0.1.9"
__license__ = "Apache 2.0 license"
__website__ = "https://oss.navio.online/navio-gitlab/"
__download_url__ = ('https://github.com/navio-online/navio-gitlab/archive'
'/{}.tar.gz'.format(__version__)),
|
SPACE_TOKEN = "\u241F"
def replace_space(text: str) -> str:
return text.replace(" ", SPACE_TOKEN)
def revert_space(text: list) -> str:
clean = (
" ".join("".join(text).replace(SPACE_TOKEN, " ").split())
.strip()
)
return clean
|
# -*- coding utf-8 -*-
"""
Created on Tue Nov 12 07:51:01 2019
Copyright 2019 Douglas Bowman dbowmans46@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including wi... |
def check(s):
(rule, password) = s.split(':')
(amount, letter) = rule.split(' ')
(lower, upper) = amount.split('-')
count = password.count(letter)
return count >= int(lower) and count <= int(upper)
def solve(in_file):
with open(in_file) as f:
passwords = f.readlines()
return sum(1 ... |
class DictionaryManipulator:
def __init__(self):
self.__dict = {}
with open("./en_US.dic", 'r') as content_file:
count = 0
for line in content_file.readlines():
words = line.split("/")
if len(words) > 1:
self.__dict[words[0... |
"""
logging
~~~~~~~
This module contains a class that wraps the log4j object instantiated
by the active SparkContext, enabling Log4j logging for PySpark using.
"""
class Log4j(object):
"""Wrapper class for Log4j JVM object.
:param spark: SparkSession object.
"""
def __init__(self,spark,key=None):
... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"load_dcm": "00_io.ipynb",
"load_h5": "00_io.ipynb",
"crop": "01_manipulate.ipynb",
"pad": "01_manipulate.ipynb",
"resample": "01_manipulate.ipynb",
"resample_by":... |
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:java.bzl", "java_import_external")
load(
"@nl_tulipsolutions_tecl//third_party/protoc-gen-validate:version.bzl",
com_envoyproxy_protoc_gen_validate_version = "version",
)
def repositories(
omi... |
#
# PySNMP MIB module SNR-ERD-4 (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SNR-ERD-4
# Produced by pysmi-0.3.4 at Mon Apr 29 21: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, 09:23... |
class Subtract:
def subtract(initial, remove):
if not(remove in initial):
return initial
index = initial.index(remove)
tracker = 0
removed = ''
while tracker < len(initial):
if not(tracker >= index and tracker < index + len(remove)):
removed += initial[tracker:tracker + 1]
tracker += 1
return ... |
fr=open('migrating.txt', 'r')
caseDict = {}
oldList = [
"Ball_LightningSphere1.bmp",
"Ball_LightningSphere2.bmp",
"Ball_LightningSphere3.bmp",
"Ball_Paper.bmp",
"Ball_Stone.bmp",
"Ball_Wood.bmp",
"Brick.bmp",
"Button01_deselect.tga",
"Button01_select.tga",
"Button01_special.tga"... |
class Net3(nn.Module):
def __init__(self, kernel=None, padding=0, stride=2):
super(Net3, self).__init__()
self.conv1 = nn.Conv2d(in_channels=1, out_channels=3, kernel_size=3,
padding=padding)
# first kernel - leading diagonal
kernel_1 = torch.Tensor([[[1, -1, -1],
... |
# Fonte https://www.thehuxley.com/problem/2253?locale=pt_BR
# TODO: Ordenar saidas de forma alfabetica, seguindo especificacoes do problema
tamanho_a, tamanho_b = input().split()
tamanho_a = int(tamanho_a)
tamanho_b = int(tamanho_b)
selecionados_a, selecionados_b = input().split()
selecionados_a = int(selecionados_a)
... |
#
# PySNMP MIB module ASCEND-CALL-LOGGING-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASCEND-CALL-LOGGING-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:26:02 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... |
#!/usr/bin/python3
## Solution 1:
def to_rna(dna_strand):
rna = []
for transcription in dna_strand:
if transcription == "G":
rna.append("C")
elif transcription == "C":
rna.append("G")
elif transcription == "T":
rna.append("A")
elif transcriptio... |
filepath = 'Prometheus_Unbound.txt'
with open(filepath) as fp:
line = fp.readline()
cnt = 1
while line:
print("Line {}: {}".format(cnt, line.strip()))
line = fp.readline()
cnt += 1
|
sum = 0
for i in range(1000):
if i%3==0 or i%5==0:
sum+=i
print(sum)
|
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 28 15:37:22 2020
@author: 766810
"""
# Creates a dictionary called 'score' which takes each letter in scrabble as keys and assigns their respective points as values
score = {"a": 1 , "b": 3 , "c": 3 , "d": 2 ,
"e": 1 , "f": 4 , "g": 2 , "h": 4 ,
... |
# Python3
# 有限制修改區域
def calcBonuses(bonuses, n):
it = iter(bonuses)
res = 0
try:
for _ in range(n):
res += next(it)
except StopIteration:
res = 0
return res
|
"""
Write a Python function to reverses a string if it's length is a multiple of 4.
"""
def reverse_string(str1):
if len(str1) % 4 == 0:
return "".join(reversed(str1))
return str1
print(reverse_string("Python"))
print(reverse_string("abcd")) |
# -*- coding: utf-8 -*-
"""
Package of employer interfaces and implementations.
"""
|
# https://www.codingame.com/training/easy/lumen
def get_neighbors(col, row, room_size):
if room_size == 1: return
if row > 0:
yield col, row - 1
if col > 0: yield col - 1, row - 1
if col < room_size - 1: yield col + 1, row - 1
if row < room_size - 1:
yield col, row + 1
... |
neighborhoods = [
"Andersonville",
"Archer Heights",
"Ashburn",
"Ashburn Estates",
"Austin",
"Avaondale",
"Belmont Central",
"Beverly",
"Beverly Woods",
"Brainerd",
"Bridgeport",
"Brighton Park",
"Bronceville",
"Bucktown",
"Burnside",
"Calumet Heights",
... |
largura = int(input('digite a largura: '))
altura = int(input('digite a altura: '))
resetalargura = largura
contador = largura
print((largura) * '#', end='')
while altura > 0:
while contador < largura and contador > 0:
print('#', end='')
contador -= 1
print('#')
altura -= 1
print((largu... |
"""
Use recursion to write a Python function for determining if a string S has more vowels than consonants.
"""
def remove_whitespace(string: str) -> str:
"""
This function replace whitespaces for void string -> ''
Input: string with (or without) whitespace
Output: string wi... |
def task_dis(size,task_list):
task_num=len(task_list)
task_dis_list=[]
for i in range(size):
task_dis_list.append([])
#print(str(task_dis_list))
for i in range(len(task_list)):
for j in range(size):
if i%size==j:
task_dis_list[j].append(task_list[i])
#for i in range(size):
# print("************"... |
'''
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10 001st prime number?
'''
p_no = 0
def is_prime(x):
if x >= 2:
for y in range(2,x):
if not( x % y ): #reverse the modulo operation
retu... |
class Pendulum():
"""
Pendulum class implements the parameters and differential equation for
a pendulum using the notation from Taylor. The class will now have the
solve_ode method removed...everything else will remain the same.
Parameters
----------
omega_0 : float
natural ... |
load("//third_party:repos/boost.bzl", "boost_repository")
load("//third_party:repos/grpc.bzl", "grpc_rules_repository")
load("//third_party:repos/gtest.bzl", "gtest_repository")
def dependencies(excludes = []):
ignores = native.existing_rules().keys() + excludes
if "com_github_nelhage_rules_boost" not in igno... |
class EncodingEnum:
BINARY_ENCODING = 0
BINARY_WITH_VARIABLE_LENGTH_STRINGS = 1
JSON_ENCODING = 2
JSON_COMPACT_ENCODING = 3
PROTOCOL_BUFFERS = 4
|
JS("""
__NULL_OBJECT__ = {}
__concat_tables_array = function(t1, t2)
for i=1,#t2 do
t1[ #t1+1 ] = t2[i]
end
return t1
end
__concat_tables = function(t1, t2)
for k,v in pairs(t2) do
t1[k] = v
end
return t1
end
function table.shallow_copy(t)
local t2 = {}
for k,v in pairs(t) do
t2[k] = v
end
return t2
... |
num = int(input('Digite um numero [999 para parar]: '))
soma = 0
tot = 0
while num != 999:
soma += num
tot += 1
num = int(input('Digite um numero [999 para parar] : '))
print(f'{soma} e {tot}') |
_base_ = [
'../../_base_/models/faster_rcnn_r50_fpn.py',
'../../_base_/datasets/waymo_detection_1280x1920.py',
'../../_base_/schedules/schedule_1x.py', '../../_base_/default_runtime.py'
]
# model
model = dict(
rpn_head=dict(
anchor_generator=dict(
type='AnchorGenerator',
... |
a = 5
b = 6
c = 7.5
result = multiply(a, b, c)
print(result)
|
# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project au... |
ch=input("Enter ch = ")
for i in range (0,len(ch)-1,2):
if(ch[i].isalpha()):
print((ch[i])*int(ch[i+1]),end="")
elif(ch[i+1].isalpha()):
print((ch[i+1])*int(ch[i]),end="")
|
class KalmanFilter:
def __init__(self, errorMeasurement, errorEstimate, q):
self.errorMeasurement = errorMeasurement
self.errorEstimate = errorEstimate
self.q = q #covariance error
self.lastEstimate = 25.0
self.currentEstimate = 25.0
def updateEstimate(se... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.