content stringlengths 7 1.05M |
|---|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: hussein
"""
if distance > 0.2:
with open('robot1.csv', 'a', newline='') as f:
fieldnames = ['Data_X', 'Data_Y', 'Label_X', 'Label_Y']
thewriter = csv.DictWriter(f, fieldnames=fieldnames... |
class Solution:
def generateParenthesis(self, n: int) -> List[str]:
res = []
self.helper(res, '', n, n)
return res
def helper(self, res, tempList, left, right):
if left > right:
return
if left == 0 and right == 0:
res.append(tempList)
... |
#!/usr/bin/python
#
#Stores the configuration information that will be used across entire project
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License... |
class Solution:
def validateStackSequences(self, pushed: List[int], popped: List[int]) -> bool:
output = []
push = 0
pop = 0
while push < len(pushed) or pop < len(popped):
if len(output) != 0 and pop < len(popped) and output[-1] == popped[pop]:
output.pop(... |
#!/usr/bin/env python
""" Convenience methods for list comparison & manipulation
Fast and useful, set/frozenset* only retain unique values,
duplicates are automatically removed.
lr_union union
merge values, remove duplicates
lr_diff difference
left elements, subtracting any in common w... |
PET_LEVELS = [
100,
110,
120,
130,
145,
160,
175,
190,
210,
230,
250,
275,
300,
330,
360,
400,
440,
490,
540,
600,
660,
730,
800,
880,
960,
1050,
1150,
1260,
1380,
1510,
1650,
1800,
1960,
... |
def sortarray(arr):
total_len = len(arr)
if total_len == 0 or total_len == 1:
return 0
sorted_array = sorted(arr)
ptr1 = 0
ptr2 = 0
counter = 0
idx = 0
while idx < total_len:
if sorted_array[ptr1] == arr[ptr2]:
ptr1 = ptr1 +1
counter = ... |
#!/usr/bin/env python3
class MyRange:
def __init__(self, start, end=None, step=1):
if step == 0:
raise
if end == None:
start, end = 0, start
self._start = start
self._end = end
self._step = step
self._pointer = start
def __getitem__(... |
N, K, S = map(int, input().split())
if S == 1:
const = S + 1
else:
const = S - 1
ans = []
for i in range(N):
if i < K:
ans.append(S)
else:
ans.append(const)
print(*ans)
|
def reverse_list(x):
"""Takes an list and returns the reverse of it.
If x is empty, return [].
>>> reverse_list([1, 2, 3, 4])
[4, 3, 2, 1]
>>> reverse_list([])
[]
"""
return x[::-1]
def sum_list(x):
"""Takes a list, and returns the sum of that list.
If x is empty lis... |
num = int(input('Digite um numero : '))
tot=0
for c in range(1,num + 1):
if num % c == 0 :
print(' {} '.format(c))
tot +=1
else:
print('{} '.format(c)) |
def nb_year(p0, percent, aug, p):
count = 0
while p0 < p:
pop = p0 + p0 * (percent/100) + aug
p0 = pop
###this is kinda gross...should have just done something like###
### p0 += p0 * percent/100 + aug ####
count += 1
return count
|
anapara=int(input("Anaparayı giriniz: "))
oran=int(input("Oran giriniz: "))
yıl=int(input("Yıl giriniz: "))
basit_faiz=(anapara*oran*yıl)/100
print("Faiz miktarı: ",basit_faiz)
print("{} yıl sonraki toplam para miktarı: {}₺".format(yıl,anapara+basit_faiz))
|
# //Escreva um programa que leia a velocidade de um carro. Se ele ultrapassar 80Km/h,
# mostre uma mensagem dizendo que ele foi multado. A multa vai custar R$7,00 por cada Km acima do limite.
print("-=-" * 15)
print(" RADAR ELETRONICO ")
vel = int(input('VELOCIDADE REGISTRADA: '))
multa... |
#Leia 2 valores inteiros X e Y. A seguir, calcule e mostre
#a soma dos números impares entre eles.
x = int(input())
y = int(input())
i = 0
if x < y:
x+= 1
while x < y:
if x % 2 != 0:
i += x
x += 1
if y < x:
y+= 1
while y < x:
if y % 2 != 0:
... |
# 흡입력은 전원이 켜져 있을 때, 흡입을 시작한다.
# 동시에 흡입력은 전원을 끈다고 해서 달라지진 않는다.
# 단, 전원이 켜지는 순간에 정지가 아니라 약,중,강 중 하나라면 바로 동작한다.
# 전원(Boolean형으로 표현할 것.) : 켜짐(True), 꺼짐(False)
# 흡입력상태(숫자형로 표현할 것.) : 정지(0), 약(1), 중(2), 강(3)
# 흡입력조절올리기 : 정지 -> 약 | 약 -> 중 | 중 -> 강, 약,중,강 일 경우"약으로 청소중", "중으로 청소중", "강으로 청소중" 이라고 출력하시오.
# 흡입력조절내리기 : 강 -> 중 | 중 -... |
###########################################################################
#
# Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/l... |
def factorial(n):
# return base case
if n == 1:
return 1
return n * factorial(n - 1)
def steps(n):
# step 0
if n == 0:
return [[0]]
# step 1
if n == 1:
return [[0, 1]]
n_1 = [a_list + [n] for a_list in steps(n-1)]
n_2 = [a_list + [n] for a_list in steps(n-... |
pkgname = "dash"
pkgver = "0.5.11.3"
pkgrel = 0
build_style = "gnu_configure"
pkgdesc = "POSIX-compliant Unix shell, much smaller than GNU bash"
maintainer = "q66 <daniel@octaforge.org>"
license = "BSD-3-Clause"
url = "http://gondor.apana.org.au/~herbert/dash"
sources = [f"http://gondor.apana.org.au/~herbert/dash/files... |
OCTICON_SYNC = """
<svg class="octicon octicon-sync" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M8 2.5a5.487 5.487 0 00-4.131 1.869l1.204 1.204A.25.25 0 014.896 6H1.25A.25.25 0 011 5.75V2.104a.25.25 0 01.427-.177l1.38 1.38A7.001 7.001 0 0114.95 7.16a.75.7... |
class Movie:
def __init__(self,name,genre,watched):
self.name= name
self.genre = genre
self.watched = watched
def __repr__(self):
return 'Movie : {} and Genre : {}'.format(self.name,self.genre )
def json(self):
return {
'name': self.name,
... |
f=0
for i in range(0,n):
st=str(a[i])
rev=st[::-1]
if(st==rev):
f=1
else:
f=0
if(f==0):
return 0
else:
return 1
|
class PresentationSettings():
def __init__(self, settings:dict = {}):
self.title = settings['title'] if 'title' in settings else 'Presentation'
self.theme = settings['theme'] if 'theme' in settings else 'black'
|
#
# PySNMP MIB module ZhoneProductRegistrations (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZhoneProductRegistrations
# Produced by pysmi-0.3.4 at Wed May 1 15:52:37 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.... |
class Solution:
def solve(self, nums):
# Write your code here
if len(nums) == 0:
return nums
s = nums[0]
flag = True
for i in range(1,len(nums)):
if flag:
k = nums[i]
nums[i] = s
if k < s:
... |
A, B, K = map(int, input().rstrip().split())
for n in range(A, B + 1):
if n < A + K or n > B - K:
print(n) |
f=input('digite a frase')
fse=f.replace(' ','')
ftm=fse.lower()
fi=ftm[::-1]
print(' {} invertida é {}'.format(f,fi))
if fi == ftm:
print('sim é palindromo')
else:
print('nao é palindromo') |
# Attributes in different classes are isolated, changing one class does not
# affected the other, the same way that changing an object does not modify
# another.
email = 'contact@redi-school.org'
class Student:
email = 'student@redi-school.org'
def __init__(self, name, birthday, courses):
# class p... |
"""
this is a regional comment
"""
#print("hello world") #this is a single line comment
#print(type("123"))
#print('hello world')
#print("It's our 2nd Python class")
my_str = 'hello world'
print(my_str)
my_str = 'second str'
print(my_str)
my_int = 2
my_float = 2.0
print(my_int + 3)
print(my_int ** 3)
print... |
class InvalidGroupError(Exception):
pass
class MaxInvalidIterationsError(Exception):
pass
|
# Author: Mengmeng Tang
# Date: March 2, 2021
# Course: CS 325
# Description: Portfolio Assignment - Sudoku Puzzle
# Requirement 3: Implement a program that allows the user to solve the puzzle.
def print_board(puzzle):
"""
Takes a sudoku puzzle as parameter
Print the board to the console
"""
# Co... |
friend_ages = {"Rolf": 25, "Anne": 37, "Charlie": 31, "Bob": 22}
for name in friend_ages:
print(name)
for age in friend_ages.values():
print(age)
for name, age in friend_ages.items():
print(f"{name} is {age} years old.")
|
__author__ = "Matthew Wardrop"
__author_email__ = "mpwardrop@gmail.com"
__version__ = "1.2.3"
__dependencies__ = []
|
# -*- coding: utf-8 -*-
"""Top-level package for svmplus."""
__author__ = """Niharika Gauraha"""
__email__ = 'niharika.gauraha@farmbio.uu.se'
__version__ = '1.0.0'
__all__ = ['svmplus']
|
"""
https://leetcode.com/problems/how-many-numbers-are-smaller-than-the-current-number/
Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it. That is, for each nums[i] you have to count the number of valid j's such that j != i and nums[j] < nums[i].
Return the answer in an ... |
# Average the numbers from 1 to n
n = int(input("Enter number:"))
avg = 0
for i in range(n + 1):
avg += i
avg = avg/n
print(avg) |
# import math
# from fractions import *
# from exceptions import *
# from point import *
# from line import *
# from ellipse import *
# from polygon import *
# from hyperbola import *
# from triangle import *
# from rectangle import *
# from graph import *
# from delaunay import *
class Se... |
# -*- coding:utf-8 -*-
PROXY_RAW_KEY = "proxy_raw"
PROXY_VALID_KEY = "proxy_valid"
|
"""
Faça um programa que calcule a diferença entre a soma dos quadrados dos primeiros 100 números naturais e o quadrado da
soma. Ex: A soma dos quadrados dos dez primeiros números naturais é,
1² + 2² + ... + 10² = 385
O quadrado da soma dos dez primeiros números naturais é,
... |
print("gabizinha", "lima", "teste")
# por padrão o espaço é adicionado
print("abcde", "aaaaaaaa", sep="-")
print("Joao e Maria", "teste", sep="####", end="######")
|
#
# PySNMP MIB module ALVARION-BANDWIDTH-CONTROL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALVARION-BANDWIDTH-CONTROL-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:06:10 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ... |
""""
+ adição
- subtração
* multiplicação
/ divisão
// divisão inteira
** potenciação
% resto da divisão
() alterar precedência
"""
print('Multiplicação * ', 10 * 10)
print('Adição + ', 10 + 10)
print('Subtração - ', 10 - 10)
print('Divisão / ', 10 / 10)
print('Divisão Inteira //', 10.5 / 10)
print('Potenciação **... |
# response topics from CTP
class RspTopics(object):
OnRspAuthenticate = "OnRspAuthenticate"
OnRspUserLogin = "OnRspUserLogin"
OnRspUserLogout = "OnRspUserLogout"
OnRspUserPasswordUpdate = "OnRspUserPasswordUpdate"
OnRspTradingAccountPasswordUpdate = "OnRspTradingAccountPasswordUpdate"
OnRspUserA... |
class Bat:
species = 'Baty'
def __init__(self, can_fly=True):
self.fly = can_fly
def say(self, msg):
msg = ".."
return msg
def sonar(self):
return "))..(("
if __name__ == '__main__':
b = Bat()
b.say('w')
b.sonar |
l, r = map(int, input().split())
while(l != 0 and r != 0):
print(l + r)
l, r = map(int, input().split()) |
# -*- coding: utf-8 -*-
igrok1 = 0
igrok2 = 0
win = 0
draw = 0
lose = 0
list_choises = ['Камень', 'Ножницы', 'Бумага']
def verify(igrok, num):
igrok = int(input())
while 1 < igrok > 3:
print("Введен некорректный номер")
print("(Камень - 1, Ножницы - 2, Бумага - 3) Игрок %s, введите ваш номер:" ... |
expected_output = {
"slot": {
"lc": {
"1": {
"16x400G Ethernet Module": {
"hardware": "3.1",
"mac_address": "bc-4a-56-ff-fa-5b to bc-4a-56-ff-fb-dd",
"model": "N9K-X9716D-GX",
"online_diag_status": "P... |
#
# PySNMP MIB module SNIA-SML-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SNIA-SML-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:08:07 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,... |
class Human(object):
def __init__(self, first_name, last_name, age, gender):
self.first_name = first_name
self.last_name = last_name
self.age = age
self.gender = gender
def as_dict(self):
return {
'first_name': self.first_name,
'last_name': self.... |
class Solution:
def countConsistentStrings(self, allowed: str, words: List[str]) -> int:
consistent_strings = 0
for word in words:
consistent = True
for c in word:
if c not in allowed:
consistent = False
break
... |
fonksiyon=[]
while True:
try:
max_derece = int(input("Lütfen fonksiyonun en büyük derecesini giriniz:"))
break
except:
print("Lütfen bir tam sayı giriniz.")
while True:
try:
min_derece=int(input("Lütfen fonksiyonun en düşük derecesini giriniz:"))
break
except:
... |
motorcycles = ['honda', 'yamaha','suzuki']
print(motorcycles)
#motorcycles[0] = 'ducati'
motorcycles.append('ducati')
print(motorcycles)
motorcycles = []
motorcycles.append('honda')
motorcycles.append('yamaha')
motorcycles.append('suzuki')
motorcycles.insert(0, 'ducati')
print(motorcycles)
del mo... |
# Requirements
# Python 3.6+
# Torch 1.8+
class BertClassifier(nn.Module):
def __init__(self, n):
super(BertClassifier, self).__init__()
self.bert = BertModel.from_pretrained('bert-base-cased')
self.drop = nn.Dropout(p=0.3)
self.out = nn.Linear(self.bert.config.hidden_size, n)
def forward(self, ... |
# type: ignore
def test_func():
assert True
|
# Модуль 2
def f2(a, b):
return a * b
def f3(a, b):
return a - b |
"""
Data format for jointed energy and reserve management problem
"""
ALPHA = 0
BETA = 1
IG = 2
PG = 3
RUG = 4
RDG = 5
|
# V0
# V1
# https://blog.csdn.net/fuxuemingzhu/article/details/79460546
class Solution(object):
def arrayNesting(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
visited = [False] * len(nums)
ans = 0
for i in range(len(nums)):
road = 0
... |
class PropertyNotHoldsException(Exception):
def __init__(self, property_text, last_proved_stacktrace):
self.last_proved_stacktrace = last_proved_stacktrace
message = "A property found not to hold:\n\t"
message += property_text
super().__init__(message)
class ModelNotFoundException(... |
def range(minimo,maximo,step):
lista=[]
while minimo<maximo:
lista+=[minimo] #lista.append(minimo)
minimo+=step
return lista
print(range(2,10,2))
print(range(100,1000,100)) |
ize_matrix = int(input())
matrix = []
all_commands = []
for s in range(size_matrix):
matrix.append([int(x) for x in input().split()])
coordinates = input().split(" ")
for x in coordinates:
all_commands.append(x)
while all_commands:
for command in all_commands:
spl = command.split(",")
r... |
def getting_input():
"""
Gets input from user and implements it into an 2 dim array
"""
print('Enter a table:')
return [list(map(int, list(input()))) for _ in range(9)]
|
class Type():
NONE = 0x0
NOCOLOR = 0x1
JAIL = 0x2
BHYVE = 0x4
EXIT = 0x8
CONNECTION_CLOSED = 0x10
|
# -*- coding:utf-8 -*-
# !/usr/bin/env python3
"""
"""
class AsyncIteratorWrapper:
def __init__(self, obj):
self._it = iter(obj)
def __aiter__(self):
return self
async def __anext__(self):
try:
value = next(self._it)
except StopIteration:
... |
"""
tentar criar um código para me ceder
coordenadas de forma espiral; ou um dado
intervalo bidimensional.
"""
def espiral(ponto):
""" dá um pares-ordenados(no formato tela,
não matemático) para um desenho formando
uma espiral nascendo de um ponto passado."""
y,x = ponto # par ordenado de tela, não-matemá... |
"""
This module implement a filter interface.
"""
class ImagineFilterInterface(object):
"""
Filter interface
"""
def apply(self, resource):
"""
Apply filter to resource
:param resource: Image
:return: Image
"""
raise NotImplementedError()
|
# coding=utf-8
"""
Music classroom network diagnostic tools config file.
Author: Yunchao Chen
Date: 2016-06-29
"""
# For Soft dog
SOFT_DOG_DATA_SIZE = 128
SOFT_DOG_LIBRARY = "win32dll.dll"
SOFT_DOG_DATA_HAS_PARSED = False
USE_FAKE_SOFT_DOG_DATA = True
FAKE_SOFT_DOG_DATA = "v1;HLG-C1;2;20160623;;19233099"
# For clas... |
### naive apporach
class Solution:
def moveZeroes(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
zeroNum = 0
i = 0
while nums:
if nums[i] == 0:
nums.pop(i)
zeroNum += 1
... |
print("==== PROGRAM HITUNG TOTAL HARGA PESANAN ====".center(50))
print("="*38)
print("*Menu*".center(37))
print("="*38)
print("1. Susu".rjust(8), "Rp.7.000".rjust(27))
print("2. Teh".rjust(7), "Rp.5.000".rjust(28))
print("3. Kopi".rjust(8), " Rp.5.000".rjust(27))
print("="*38, "\n")
banyak_jenis = int(input("banyak je... |
first_num = int(input())
second_num = int(input())
third_num = int(input())
for i in range (1, first_num + 1):
for j in range (1, second_num + 1):
for k in range (1, third_num + 1):
if i % 2 == 0 and j > 1 and k % 2 == 0:
for prime in range(2, j):
if (j % pri... |
a = int(input("Enter number a: "))
b = int(input("Enter number b: "))
i = a % b
j = b % a
print(i * j + 1)
|
class UserMessageError(Exception):
def __init__(self, response_code, user_msg=None, server_msg=None):
self.user_msg = user_msg or ""
self.server_msg = server_msg or self.user_msg
self.response_code = response_code
super().__init__()
class ClientError(UserMessageError):
def __in... |
# https://projecteuler.net/problem=5
def gcd(a, b):
if b == 0:
return a
return gcd(b, a%b)
print(gcd(1,6))
result = 1
for i in range(2, 21):
g = gcd(result, i)
result = result * (i/g)
print(i, g, result)
print(result)
|
#Calculadora basica que haga suma,resta,multiplicacion y division
def main() :
n = input('Ingresa los numeroes entre espacios: \n')
print("\t")
print("Estos son los numeros ingresados: ")
respuesta = input("\n Desea continuar? Y/N: ")
if respuesta == "Y":
print("Funciono")
... |
class TimeoutException(Exception):
"""Class to add a timeout attribute to an exception. If an exception is
raised specifically due to a rate-limits being exceeded, this class can
be used to add a timeout, indicated how long a task or application should
wait until retrying.
Attributes:
exce... |
def insertion_sort(lst):
for passes in range(1, len(lst)): # n-1 passes
current_val = lst[passes]
pos = passes
while pos > 0 and lst[pos-1] > current_val:
lst[pos] = lst[pos-1]
pos = pos-1
lst[pos] = current_val
return lst
arr = [2, 4, 42, 6, 22, 7]... |
class Util:
def __init__(self, node):
self._node = node
def createmultisig(self, nrequired, keys, address_type="legacy"): # 01
return self._node._rpc.call("createmultisig", nrequired, keys, address_type)
def deriveaddresses(self, descriptor, range=None): # 02
return self._node._r... |
# For singly Linked List
# class MySinglyLinkedList:
# def __init__(self):
# self.head = None
# self.size = 0
# # If the index is invalid, return -1
# def get(self, index: int) -> int:
# if index >= self.size or index < 0:
# return -1
# if self.h... |
widget = WidgetDefault()
widget.width = 101
widget.height = 101
widget.border = "None"
widget.background = "None"
commonDefaults["BarGraphWidget"] = widget
def generateBarGraphWidget(file, screen, bar, parentName):
name = bar.getName()
file.write(" %s = leBarGraphWidget_New();" % (name))
generateBase... |
"""
Faça um programa cadastro. Ele deve solicitar o nome, idade e sexo de 10 pessoas.
Ao final mostre, a média de idade de todos dos homens e das mulheres,
assim como a média geral. O nome do homem mais velho e da mulher mais nova.
Obrigatório utilizar estrutura FOR.
"""
soma_id_h = soma_id_m = quant_h = quant_m = mai... |
# -*- coding: utf-8 -*-
"""
bandwidth
This file was automatically generated by APIMATIC v3.0 (
https://www.apimatic.io ).
"""
class PriorityEnum(object):
"""Implementation of the 'Priority' enum.
The message's priority, currently for toll-free or short code SMS only.
Messages with a pr... |
#!/usr/bin/python35
fp = open('hello.txt')
print(fp.__next__())
print(next(fp))
fp.close()
|
GLOBAL_TRANSITIONS = "global_transitions"
TRANSITIONS = "transitions"
RESPONSE = "response"
PROCESSING = "processing"
GRAPH = "graph"
MISC = "misc"
|
# Faça um programa que leia um número inteiro
# e mostre na tela o seu antecessor e seu sucessor.
num = int(input('Digite um número: '))
ant = num - 1
suc = num + 1
print(f'O antecessor e o sucessor do número {num} são respectivamente {ant} e {suc}!') |
#!/usr/bin/env python3
#https://codeforces.com/contest/1399/problem/F
#不能固定一个,必须两边都能动!
#如何排序?
def f(ll):
n = len(ll)
ll.sort(key=lambda s:(s[1],-s[0]))
cl = [1]*n #max nubmer of taowa, inclding itself
for i in range(n):
l = ll[i][0]
for j in range(i):
if ll[j][0]>=l:
... |
# ATM simulator
flourish = ('=' * 40)
print(flourish)
print('{:^40}'.format('BANCO CEV'))
print(flourish)
withdrawal = int(input('Quanto você quer sacar? '))
total = withdrawal
bill = 50
total_bills = 0
while True:
if total >= bill:
total -= bill
total_bills += 1
else:
if total_bills > 0:
print(f'Total de... |
#################################################################################
# #
# Copyright 2018/08/16 Zachary Priddy (me@zpriddy.com) https://zpriddy.com #
# ... |
def merge_the_tools(string, k):
lens = len(string)
for i in range(0, lens, k):
lists = [j for j in string[i:i+k]]
print(''.join(sorted(set(lists), key=lists.index)))
s = input()
n = int(input())
merge_the_tools(s, n) |
def f(x, y):
"""
Args:
x (int): foo
Args:
y (int): bar
Examples:
first line
second line
third line
""" |
# Stepper mode select
STEPPER_m0 = 17
STEPPER_m1 = 27
STEPPER_m2 = 22
# First wheel GPIO Pin
WHEEL1_step = 21
WHEEL1_dir = 20
# Second wheel GPIO Pin
WHEEL2_step = 11
WHEEL2_dir = 10
# Third wheel GPIO Pin
WHEEL3_step = 7
WHEEL3_dir = 8
# Fourth wheel GPIO Pin
WHEEL4_step = 24
WHEEL4_dir = 23
CW = 1 ... |
def compute(a, b):
return a + b
def Test1():
a = -1
b = 1
assert compute(a, b) == -1
def testabc():
a = 0
b = -1
assert compute(a, b) == 0
def Test3():
a = 1
b = 10
assert compute(a, b) == 10
def Test4():
a = -1
b = -1
assert compute(a, b) == 1
|
URL_PROJECT_VIEW="http://tasks.hotosm.org/project/{project}"
URL_PROJECT_EDIT="http://tasks.hotosm.org/project/{project}/edit"
URL_PROJECT_TASKS="http://tasks.hotosm.org/project/{project}/tasks.json"
URL_CHANGESET_VIEW="http://www.openstreetmap.org/changeset/{changeset}"
URL_CHANGESET_API ="https://api.openstreetmap.o... |
def contains_cycle(first_node):
nodes_visited = set()
if not first_node or not first_node.next:
return False
current_node = first_node.next
while current_node.next:
if current_node.value in nodes_visited:
return True
else:
nodes_visited.add(current_node.... |
pessoas = {'nome': 'Gustavo', 'sexo ': 'M', 'idade' : 22}
print(pessoas)
print(pessoas['idade'])## 22
print(f' O {pessoas["nome"]} tem {pessoas["idade"]} anos.')## O Gustavo tem 22 anos.
print(pessoas.keys())## dict_keys(['nome', 'sexo ', 'idade'])
print(pessoas.values())##dict_values(['Gustavo', 'M', 22])
print(... |
CONF_Main = {
"environment": "lux_gym:lux-v0",
"setup": "rl",
"model_name": "actor_critic_sep_residual_six_actions",
"n_points": 40, # check tfrecords reading transformation merge_rl
}
CONF_Scrape = {
"lux_version": "3.1.0",
"scrape_type": "single",
"parallel_calls": 8,
"is_for_rl": Tr... |
# Transmission registers
TXB0CTRL = 0x30
TXB1CTRL = 0x40
TXB2CTRL = 0x50
TXRTSCTRL = 0x0D
TXB0SIDH = 0x31
TXB1SIDH = 0x41
TXB2SIDH = 0x51
TXB0SIDL = 0x32
TXB1SIDL = 0x42
TXB2SIDL = 0x52
TXB0EID8 = 0x33
TXB1EID8 = 0x43
TXB0EID8 = 0x53
TXB0EID0 = 0x34
TXB1EID0 = 0x44
TXB2EID0 = 0x54
TXB0DLC = 0x35
TXB1DLC = 0x45
T... |
class Solution:
def increasingTriplet(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
first = second = float('inf')
for n in nums:
if n <= first:
first = n
elif n <= second:
second = n
else:
... |
# Heroku PostgreSQL credentials, rename this file to config.py
HOST = "placeholder"
DB = "placeholder"
USER = "placeholder"
PASSWORD = "placeholder"
PORT = "5432"
|
def move(direction, distance):
global row
global col
if direction == 'up':
if row - distance >= 0 and \
field[row - distance][col] == '.':
field[row - distance][col] = 'p'
field[row][col] = '.'
row = row - distance
elif direction == 'down':
... |
# Every neuron has a unique connection to the previous neuron.
inputs = [3.1 , 2.5 , 5.4]
# Every input is going to have a unique weight
weights = [4.5 , 7.6 , 2.4]
# Every neuron is going to have a unique bias
bias = 3
# Now let's check the output from the neuron
output = inputs[0] * weights[0] + inputs[1] * weigh... |
class RebarCouplerError(Enum, IComparable, IFormattable, IConvertible):
"""
Error states for the Rebar Coupler
enum RebarCouplerError,values: BarSegementsAreNotParallel (6),BarSegmentsAreNotOnSameLine (7),BarSegmentSmallerThanEngagement (13),BarsNotTouching (3),CurvesOtherThanLine (12),DifferentLayout (... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.