content stringlengths 7 1.05M |
|---|
#
# PySNMP MIB module CNT2-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CNT2-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:25:15 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:1... |
#flask
DEBUG = True
#session
SECRET_KEY="1145141919810"
#mysql
DIQLECT = "mysql"
DRIVER="pymysql"
USERNAME = "root"
PASSWORD = "root"
# PASSWORD = "7410188xw"
HOST = "127.0.0.1"
PORT = "3306"
DATABASE = "CSBIGHW"
SQLALCHEMY_DATABASE_URI = "{}+{}://{}:{}@{}:{}/{}?charset=utf8".format(DIQLECT,DRIVER,US... |
n1 = float(input('Digite o primeiro número:'))
n2 = float(input('Digite o segundo número:'))
n3 = float(input('Digite o terceiroo número:'))
if n1 > n2 and n1 > n3:
print('O maior número é {}'.format(n1))
elif n2 > n1 and n2 > n3:
print('O maior número é {}'.format(n2))
else:
print('O maior número é {}'.for... |
class EnergyAnalysisDetailModelOptions(object,IDisposable):
"""
Options that govern the calculations for the generation of the energy analysis detail model.
EnergyAnalysisDetailModelOptions()
"""
def Dispose(self):
""" Dispose(self: EnergyAnalysisDetailModelOptions) """
pass
def ReleaseUnmanage... |
def sum_double(a, b):
if a == b:
return (a+b)*2
else:
return a+b
|
"""
Создать список состоящий из отдельных единичных символов,
преобразовать список в строку, инвертировать строку и вывести на печать.
"""
my_spisok_list = ['m', 'y', '_', 's', 'p', 'i', 's', 'o', 'k']
my_spisok_str = "".join(my_spisok_list)
print(my_spisok_str)
|
class CoalescenceException(Exception):
def __init__(self, msg=''):
self.msg = msg
class NoSuchSourceException(CoalescenceException):
pass
class NotAnElementException(CoalescenceException):
pass
class NotAValueException(CoalescenceException):
pass
class NoValueException(CoalescenceExceptio... |
# Sequence Equation
# Find some y satisfying p(p(y)) = x for each x from 1 to n.
#
# https://www.hackerrank.com/challenges/permutation-equation/problem
#
def permutationEquation(p):
# Complete this function
n = len(p)
q = [0] * n
# p(p(𝓎)) = 𝓍 (au décalage de 1 près)
for i in range(0, n):
... |
"""Extra Ansible filters"""
def rules_ports(
firewall_rules, only_restricted=False, redirect=False, *_, **__):
"""
Return restricted ports (<1024) from firewall rules.
Args:
firewall_rules (list of dict): Firewall rules.
only_restricted (bool): If True, list only ports < 1024.
... |
# lextab.py. This file automatically created by PLY (version 3.4). Don't edit!
_tabversion = '3.4'
_lextokens = {'DO': 1, 'REMAINDER_ASSIGN': 1, 'RSHIFT': 1, 'SYNCHRONIZED': 1, 'GTEQ': 1, 'MINUS_ASSIGN': 1, 'OR_ASSIGN': 1, 'VOID': 1, 'STRING_LITERAL': 1, 'ABSTRACT': 1, 'CHAR': 1, 'LSHIFT_ASSIGN': 1, 'WHILE': 1, 'S... |
for i in range(0,21,2):
if(i==0):
i=i
elif(i==10 or i==20):
i=int(i/10)
else:
i/=10
for k in range(1,4):
print("I={} J={}".format(i, k+i)) |
n = int(input())
i = 1
while(i < n):
j = 1
while(j <= i):
print((i*2-1), end=" ")
j = j+1
i = i + 1
print()
|
class Solution(object):
def maxSubArray(self, nums):
if not nums:
return 0
best_sum = nums[0]
current_sum = 0
for x in nums:
current_sum = max(x, current_sum + x)
best_sum = max(best_sum, current_sum)
return best_sum
in_arrs = [
[2, 1... |
class Solution:
def moveZeroes(self, nums):
length = len(nums)
on_zero = run = 0
while True:
# find first zero in nums.
while nums[on_zero]:
on_zero = on_zero + 1
if on_zero == length:
return
# s... |
#
# PySNMP MIB module VMWARE-VMINFO-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/VMWARE-VMINFO-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:27:55 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... |
#!/usr/bin/env python3
"""
Kenzie assignment: Strings!
"""
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Instructions:
# Complete each function below by writing the code for it. main() is already
# set up to test all the functions with a fe... |
'''
Created on 18 Nov 2020
@author: ernesto
'''
class AnnotationURIs(object):
'''
This class manages the most common ontology annotations
'''
def __init__(self):
'''
Constructor
'''
#Main label of an entity typically only one, but there may be several ... |
# Reverse a singly linked list.
# Input: 1->2->3->4->5->NULL
# Output: 5->4->3->2->1->NULL
class Solution(object):
def reverseList(self, head):
"""
Iterative solution that involves changing the next reference for the following node to point at current node.
If empty list (i.e. head is Non... |
DATA_TYPES = {
'AutoField': 'int IDENTITY (1, 1)',
'BooleanField': 'bit',
'CharField': 'varchar(%(maxlength)s)',
'CommaSeparatedIntegerField': 'varchar(%(maxlength)s)',
'DateField': 'smalldatetime',
'DateTimeField': 'smalldatetime',
'DecimalField': 'nume... |
'''Define terminal escape sequences for color codes.
<ESC>[{attr1};...;{attrn}m
0 Reset all attributes
1 Bright
2 Dim
4 Underscore
5 Blink
7 Reverse
8 Hidden
Foreground Colours
------------------
30 Black
31 Red
32 Green
33 Yellow
34 Blue
35 Magenta
36 Cyan
37 White
Background Colours
------------------
40 Black
41... |
# SPDX-FileCopyrightText: 2021 Division of Intelligent Medical Systems, DKFZ
# SPDX-FileCopyrightText: 2021 Janek Groehl
# SPDX-License-Identifier: MIT
class StandardProperties:
"""
This class contains a listing of default parameters that can be used.
These values are sensible default values but are gener... |
JOINTS = {
"HipCenter": 0,
"RHip": 1,
"RKnee": 2,
"RFoot": 3,
"LHip": 4,
"LKnee": 5,
"LFoot": 6,
"Spine": 7,
"Thorax": 8,
"Neck/Nose": 9,
"Head": 10,
"LShoulder": 11,
"LElbow": 12,
"LWrist": 13,
"RShoulder": 14,
"RElbow": 15,
"RWrist": 16,
}
EDGES = (... |
#!/usr/bin/env python3
# The missing value is always in range 1...len(nums)+1
# linear space and time
def find_first_missing(nums):
seen = [False] * len(nums)
for n in nums:
if n >= 1 and n <= len(nums):
seen[n-1] = True
for i in range(len(nums)):
if not seen[i]:
... |
#!/usr/bin/python3
class MyError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
try:
raise MyError(2 * 2)
except MyError as err:
print('My Exception occurred, value: ', err.value)
|
"""Visit computation pure python version."""
START_EVENT = 1
END_EVENT = 0
def padd(p, q):
"""Add the probabilities."""
return 1.0 - (1.0 - p) * (1.0 - q)
def pmul(p, n):
"""Return the multiple of the given probabilty."""
return 1.0 - (1.0 - p) ** n
def compute_visit_output_py(
transmission_p... |
#!/usr/bin/env python3
# Strings are used to display message's on the screen or to convey instruction to users
test = 'This is a testing.'
print(test)
# Now say for example you want to print 'You're having it' if we write in single quotes then it will show us error
# test1 = 'You're having it' # uncomment the line to s... |
batch_size = 1
nb_train = 500
nb_epoch = 5
nb_videos_val = 100
# score_batch = 100
# -----
smooth_weight = 0.5
node = 16
input_t = 16 # 表示一次输入多少张图片
full_size = (448, 448)
input_shape = (112, 112)
small_output_shape = (int(input_shape[0] / 8), int(input_shape[1] / 8))
out_dims = (None, input_t) + small_output_shape +... |
class Laptop:
def getTime(self):
pass
def playWavFile(self, file):
pass
def wavWasPlayed(self, file):
pass
def resetWav(self, file):
pass
|
def rowapplymods(transactionrow):
value = transactionrow.prevalue
for mod in transactionrow.includes_mods:
value = mod.apply(transactionrow.amount, value)[0]
transactionrow.value = value
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@npm//@bazel/protractor:package.bzl", "npm_bazel_protractor_dependencies")
load("@npm//@bazel/karma:package.bzl", "npm_bazel_karma_dependencies")
load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories")
load("@io_bazel_r... |
lado = float(input('Digite um dos lados do quadrado: '))
area = lado * 4
dobro = area * 2
print(f'\nO dobro da área é {dobro}.')
|
pares = open('pares.txt', 'w')
impares = open('impares.txt', 'w')
for t in range(0, 1000):
if t % 2 == 0:
pares.write(f"{t}\n")
else:
impares.write(f"{t}\n")
pares.close()
impares.close() |
"""The ywcnvlib package - Link yw-cnv to the UNO API.
Modules:
yw_cnv_uno -- Provide a converter class for universal import and export.
ui_uno -- Provide a UNO user interface facade class.
uno_tools -- Provide Python wrappers for UNO widgets.
Copyright (c) 2022 Peter Triesberger
For further information see... |
"""Args defining output and networks"""
def add_args(parser):
parser.add_argument('--log_interval', type=int, default=100, metavar='N',
help='how many batches to wait before logging training status')
parser.add_argument('--input_size', type=int, default=16,
help... |
def luasSegitiga2(a,t):
luas = a * t / 2
print('Luas segitiga dengan alas ',alas,'dan tinggi ',tinggi,' adalah ',luas)
alas=10
tinggi=20
luasSegitiga2(alas,tinggi) |
def problem057():
"""
It is possible to show that the square root of two can be expressed as an
infinite continued fraction.
√ 2 = 1 + 1/(2 + 1/(2 + 1/(2 + ... ))) = 1.414213...
By expanding this for the first four iterations, we get:
1 + 1/2 = 3/2 = 1.5
1 + 1/... |
CONFIGURATION = "css"
WIDTH = 30
HEIGHT = 30
|
#!/usr/bin/env python
def solution(S):
stack = []
for char in S:
if char == ')':
if len(stack) > 0:
stack.pop()
else:
return 0
if char == '(':
stack.append(char)
if len(stack) != 0:
return 0
return 1
def te... |
'''
https://www.codingame.com/training/easy/equivalent-resistance-circuit-building
'''
# Dictionary that stores the value of each resistance name
ohms = {}
# Read the inputs
n = int(input())
for i in range(n):
inputs = input().split()
name = inputs[0]
value = int(inputs[1])
# Pop... |
class Error(Exception):
pass
class NotFound(Error):
pass
class Corruption(Error):
pass
class NotSupported(Error):
pass
class InvalidArgument(Error):
pass
class RocksIOError(Error):
pass
class MergeInProgress(Error):
pass
class Incomplete(Error):
pass
|
test = { 'name': 'q0_3',
'points': 1,
'suites': [ { 'cases': [{'code': '>>> np.all(flavor_ratings_sorted.take(0).column("Rating list") == [1, 2, 4, 5]) == True\nTrue', 'hidden': False, 'locked': False}],
'scored': True,
'setup': '',
'teardo... |
num_waves = 2
num_eqn = 4
num_aux = 2
# Conserved quantities
pressure = 0
x_velocity = 1
y_velocity = 2
z_velocity = 3
# Auxiliary variables
impedance = 0
sound_speed = 1
|
# reverse given string
# Sample output:
# string this reverse
def reverse_sentence(sentence):
words = sentence.split(" ")
reverse = ' '.join(reversed(words))
return reverse
sentence = "reverse this string"
print (reverse_sentence(sentence)) |
class HashTable(object):
def __init__(self,size):
self.size = size
self.slots = [None] * self.size
self.data = [None] * self.size
def put(self,key,data):
hashValue = self.hashFunc(key,len(self.slots))
if self.slots[hashValue] == ... |
class PriorityQueue(object):
def __init__(self):
self.qlist = []
def isEmpty(self):
return len(self) == 0
def __len__(self):
return len(self.qlist)
def enqueue(self, data, priority):
entry = _PriorityQEntry(data, priority)
self.qlist.append(entry)
de... |
if __name__ == '__main__':
n = int(input())
arr = map(int, input().split())
total = list()
[total.append(i) for i in arr if i not in total]
total.sort()
print(total[-2])
|
#!/usr/bin/python3
#https://codeforces.com/contest/1399/problem/C
#w1,w2,..wn.. 100
#n和w的范围非常小!
def f(l):
n = len(l)
bl = [0]* 51
sl = [0]*101
for i in l:
bl[i] += 1
for i in range(1,51):
for j in range(i,51):
sl[i+j] += min(bl[i],bl[j]) if i!=j else bl[i]//2
return... |
# #Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, find the duplicate one.
# #Note:
# #You must not modify the array (assume the array is read only).
# #You must use only... |
"""
We copy some functions from the Python 2.7.3 socket module.
http://hg.python.org/releasing/2.7.3/file/7bb96963d067/Lib/socket.py
"""
_GLOBAL_DEFAULT_TIMEOUT = object()
def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT,
source_address=None):
"""Connect to *address* and ret... |
"""
__author__ = "Patrick Doyle"
__license__ = "The Unlicense"
__email__ = "me@pcdoyle.com"
r/dailyprogrammer:
Get the day of the week from a date entered as "YYYY MM DD" (EX: 2017 10 30)
https://www.reddit.com/r/dailyprogrammer/comments/79npf9/20171030_challenge_338_easy_what_day_was_it_again/
To solve this ... |
# %% [markdown]
'''
Logistic Regression Classifier
Random forest Classifier
Decision Tree Classifier
PCA
Logistic Regression Classifier
Random forest Classifier
Decision Tree Classifier
Normalization
Modeling
With PCA
Without PCA
'''
all_metrics.append(["Logistic Regression", rou... |
# ldap/util.py
# Written by Jeff Kaleshi
def get_permissions(query):
permissions = []
for item in query:
permission = item[3:item.find(',')]
if permission != 'ACMPaid' and permission != 'ACMNotPaid':
permissions.append(permission)
return permissions
def get_paid_status(query):... |
NAME = 'Jane P. Roult'
# Communication Definitions
BAUDRATE = 115200
COMMAND_COMM_LOCATION = "/dev/robot/arduino" # For sending commands
SENSORS_COMM_LOCATION = "/dev/robot/sensors" # For receiving sensor telemetry
# Physical Definitions
WHEEL_BASE_MM = 153.0
# Blue Wheels with geared steppers:
STEPS_PER_CM = 132.... |
# Created by Artem Manchenkov
# artyom@manchenkoff.me
#
# Copyright © 2019
#
# Функции и аргументы
#
# Простая функция
def simple_action():
print('I am a simple function! Nothing interesting yet...')
simple_action() # вызывает выполнение функции
# Функция с аргументами
def say_hello(name: str):
print... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 16 09:07:36 2019
@author: Dell
"""
#to find th largest and second largest number on the list(sort and second last)
L=[]
s=int(input("How many numbers you want to add in the list? "))
for i in range(s):
x=int(input("Enter element of list: "))
L.append(... |
# -*- coding: utf-8 -*-
""" Module that keeps track of library management like version control, release dates etc. """
__version__ = '0.0.2'
__release_date__ = '2019-02-10'
|
def calculate( time, realtime ):
starting = time[6]
hhs = int(time[:2])
mms = int(time[3:5])
ending = time[15]
hhe = int(time[9:11])
mme = int(time[12:15])
if time[6]== 'A':
if time[15] == 'A':
if hhs!=12:
sum=0
sum = sum + (hh*60)+mm
... |
__author__ = 'DWI'
class TemplateActionReader(object):
def __init__(self, template_action_builder):
self.action_builder = template_action_builder
def read(self, file_name):
"""
Reads the given file and returns a template object
:param file_name: name of the template file
... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... |
"""
一条包含字母 A-Z 的消息通过以下方式进行了编码:
'A' -> 1
'B' -> 2
...
'Z' -> 26
给定一个只包含数字的非空字符串,请计算解码方法的总数。
示例 1:
输入: "12"
输出: 2
解释: 它可以解码为 "AB"(1 2)或者 "L"(12)。
示例 2:
输入: "226"
输出: 3
解释: 它可以解码为 "BZ" (2 26), "VF" (22 6), 或者 "BBF" (2 2 6) 。
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/decode-ways
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请... |
n = (int(input('Digite um número:')))
print('O seu dobro é {}, o seu triplo é {}, e sua raiz quadrada é {:.1f}.'.format(n*2, n*3, n**(1/2)))
|
print('hello', end = " ")
print('world', end = "*")
print('!')
"""
输出结果是:
hello world*!
""" |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def findLeaves(self, root: TreeNode) -> List[List[int]]:
if not root:
return []
... |
# -*- coding: utf-8 -*-
"""Test constants."""
# API test data are localized in
# `tests/api_data/dsm_[dsm_major_version]`
# Data constant names should be like :
# "DSM_[dsm_version]_[API_KEY]"
# if data failed, add "_FAILED"
SESSION_ID = "session_id"
SYNO_TOKEN = "Syñ0_T0k€ñ"
DEVICE_TOKEN = "Dév!cè_T0k€ñ"
UNIQUE_KEY ... |
sheep_size = [5,7,300,90,24,50,75]
print("Hello, my name is Duy Anh and these are my sheep sizes")
print(sheep_size)
biggest_sheep = max(sheep_size)
print()
print("Now my biggest sheep has size",biggest_sheep,"let's shear it")
|
input = """
true.
a | b :- true, 1 < 2.
:- a.
"""
output = """
true.
a | b :- true, 1 < 2.
:- a.
"""
|
# https://app.codesignal.com/arcade/code-arcade/loop-tunnel/7BFPq6TpsNjzgcpXy/
def leastFactorial(n):
# What's the highest factorial number that is bigger than n?
i, fact = (1, 1)
# Keep increasing a cumulative factorial until n can't no longer contain
# it. If n becomes 1, then n was a factorial, if n ... |
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
node = parent = None
def deleteNode(self, root: TreeNode, key: int) -> TreeNode:
# search for the node and its parent
self.findNodeAndParent(root, key)
if s... |
# Задача 10. Вариант 22.
# 1-50. Напишите программу "Генератор персонажей" для игры. Пользователю должно быть предоставлено 30 пунктов, которые можно распределить между четырьмя характеристиками: Сила, Здоровье, Мудрость и Ловкость. Надо сделать так, чтобы пользователь мог не только брать эти пункты из общего "пула", ... |
# Reads float and prints BRL money conversion to JPY
# In 2020/11/01 JP¥ 1.00 = R$ 0.060 :)
brl = float(input('Por favor, digite quanto dinheiro você tem na carteira: R$ '))
jpy = brl / 0.060
print('Com R$ {:.2f} você pode comprar ¥ {:.2f}.'.format(brl, jpy))
|
class ResponseFunctionInterface(object):
"""
This response function interface provides a unique interface for all possible ways
to calculate the value and gradient of a response.
The interface is designed to be used in e.g. optimization, where the value and gradient
of a response is required, howev... |
student = {
"firstName": "Prasad",
"lastName": "Honrao",
"age": 37
}
try:
#try to get wrong value from dictionary
last_name = student["last_name"]
except KeyError as error:
print("Exception thrown!")
print(error)
print("Done!") |
class Fibonacci(object):
"""Generate Fibonacci Numbers"""
def __init__(self, length, first=0, second=1):
"""Set length and initials for the series"""
if not isinstance(length, int):
raise TypeError("Expected length to be 'int' got '%s'" % (length.__class__.__name__, ))
if l... |
class BaseAbort(object):
def __init__(self, reason):
self.reason = reason
class PythonAbort(BaseAbort):
def __init__(self, reason, pycode, lineno):
super(PythonAbort, self).__init__(reason)
self.pycode = pycode
self.lineno = lineno
def visit(self, visitor):
return v... |
coco_file = 'yolo/darknet/coco.names'
yolo_cfg_file = 'yolo/darknet/yolov3-tiny.cfg'
yolo_weights_file = 'yolo/darknet/yolov3-tiny.weights'
img_size = (320,320)
conf_threshold = 0.5
nms_threshold = 0.3 |
with open("log.txt", "r") as f:
line = f.read()
count = int(line) + 1
with open("log.txt", "w") as f:
f.write(str(count))
|
s = str(input('Digite seu sexo [M/F]: ')).strip().upper()[0]
while s != 'M' and s != 'F':
s = str(input('Digite seu sexo [M/F]: ')).strip().upper()
if s == 'M':
print('Olá senhor.')
else:
print('Olá, senhora.')
|
__title__ = 'grabstats'
__description__ = 'Scrape NBA stats from Basketball-Reference'
__url__ = 'https://github.com/kndo/grabstats'
__version__ = '0.1.0'
__author__ = 'Khanh Do'
__author_email__ = 'dokhanh@gmail.com'
__license__ = 'MIT License'
|
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def middleNode(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
count = 0
tmp = head
while tmp is not None... |
n = 0
cont = 0
soma = 0
while n != 999:
n = int(input('Digite um numero,[Digite 999, para parar]: '))
if n != 999:
cont += 1
soma += n
print('Você digitou {} numeros a soma entre eles é igual a {}.'.format(cont, soma))
print('FIM')
|
class Heap():
"""
Min. Heap Class.
PARAMETERS
==========
arr: list
heap array
METHODS
=======
parent(n):
PARAMETERS
==========
n: int
index position of the child.
RETURNS
=======
int
parent index... |
# -*- coding: utf-8 -*-
""" ラベルを定義 """
NAME = "name"
MYNAME = "myname"
|
expected_output = {
"ping": {
"address": "2001:db8:223c:2c16::2",
"data-bytes": 56,
"result": [
{
"bytes": 16,
"from": "2001:db8:223c:2c16::2",
"hlim": 64,
"icmp-seq": 0,
"time": "973.514",
... |
#player class
#constructor: player = white or black
class Player:
def __init__(self, player, username):
self.player = player
self.username = username
def move(self, move):
return
def print(self):
print(self.player)
print(self.username)
if __name__ == "__main__"... |
"""
This class is an unmodified copy of one from a blog post written by Lennart Regebro at:
http://regebro.wordpress.com/2010/12/13/python-implementing-rich-comparison-the-correct-way/
No license terms were specified in the blog post.
It has been included as a minor convenience.
If we ever need to purge our code of ex... |
def joke():
return (u'Wenn ist das Nunst\u00fcck git und Slotermeyer? Ja! ... '
u'Beiherhund das Oder die Flipperwaldt gersput.')
|
""" 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 """
n = int(input('Entre com um número:'))
a = 0
b = 1
c = 0
count = 1
print('Sequencia de Fibonacci: ', end=' ')
while count <= n:
print(c, end=' ... |
class Solution:
key_map = {
"1": [""],
"2": ['a', 'b', 'c'],
"3": ['d', 'e', 'f'],
"4": ['g', 'h', 'i'],
"5": ['j', 'k', 'l'],
"6": ['m', 'n', 'o'],
"7": ['p', 'q', 'r', 's'],
"8": ['t', 'u', 'v'],
"9": ['w', 'x', 'y', 'z']
}
def lette... |
frase = str(input("Digite uma frase: ")).lower().strip()
print("A quantidade de letras A na frase é {}.".format(frase.count("a")))
print("A primeira letra a aparece na posição de número {}.".format(frase.find("a")+1))#para procurar a primeira posicao da letra a dentro da frase
print("A ultima letra a aparece na posição... |
class HashSetString:
_ARR_DEFAULT_LENGTH = 211
def __init__(self, arr_len=_ARR_DEFAULT_LENGTH):
self._arr = [None,] * arr_len
self._count = 0
def _hash_str_00(self, value):
hashv = 0
for c in value:
hashv = (hashv * 27 + ord(c)) % len(self._arr)
return ha... |
class Solution:
def validIPAddress(self, IP: str) -> str:
res = 'Neither'
if IP.count(".") == 3:
for value in IP.split("."):
temp_value = re.sub(r'[^0-9]', '', value)
if not temp_value or not str(int(temp_value)) == value or... |
# Escape the ' caracter
story_description = 'It\'s a touching story'
print(story_description)
# Escape the \ caracter
story_description = "It\\'s a touching story"
print(story_description)
# Break Line
story_description = 'It\'s a \n touching \n story'
|
class IAsyncResult:
""" Represents the status of an asynchronous operation. """
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
AsyncState=property(lambda self: object(),lambda sel... |
a = source()
b = k
if(a == w):
b = c
elif(a==y):
b = d
sink(b)
|
FORMER_TEAM_NAME_MAP = {
'AFC Bournemouth': 'AFC Bournemouth',
'Accrington FC': 'Accrington FC',
'Arsenal FC': 'Arsenal FC',
'Aston Villa': 'Aston Villa',
'Barnsley FC': 'Barnsley FC',
'Birmingham City': 'Birmingham City',
'Birmingham FC': 'Birmingham City',
'Blackburn Rovers': 'Blackbur... |
class RouteWithTooSmallCapacity(Exception):
pass
class RebalanceFailure(Exception):
pass
class NoRouteError(Exception):
pass
class DryRunException(Exception):
pass
class PaymentTimeOut(Exception):
pass
class TooExpensive(Exception):
pass |
"""Meta data for HTTPie options."""
FLAG_OPTIONS = [
('--body', 'Print only response body'),
('--check-status', 'Check HTTP status code'),
('--continue', 'Resume an interrupted download'),
('--debug', 'Print debug information'),
('--download', 'Download as a file'),
('--follow', 'Allow full red... |
QWORD = 8
DWORD = 4
WORD = 2
BYTE = 1
|
# -*- coding: utf-8 -*-
#
# IceCream - Never use print() to debug again
#
# Ansgar Grunseid
# grunseid.com
# grunseid@gmail.com
#
# License: MIT
#
__title__ = 'icecream'
__license__ = 'MIT'
__version__ = '2.1.1'
__author__ = 'Ansgar Grunseid'
__contact__ = 'grunseid@gmail.com'
__url__ = 'https://github.com/gruns/icec... |
all_datasets = {
'macdebug': 'macdebug',
'128leftonly': 'ords062',
'128w': 'ords064sc9',
'128valsame': 'ords064sc9',
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.