content stringlengths 7 1.05M |
|---|
dic = {}
while True:
perg = str(input('Deseja fazer um comentário ? [S/N] ')).strip().upper()[0]
if perg == 'S':
dic['coment'] = str(input('Qual o seu comentário ? ')).strip().upper()
print('Obrigado pelo seu comentário')
elif perg == 'N':
print('Até mais !')
break
else:... |
def field_to_string(string):
return " ".join(string.split("_")).capitalize()
def parse_details(data):
if not data:
raise ValueError("data must not be null, empty, etc.")
if isinstance(data, dict):
items = list(data.items())
max_key_len = len(max(map(str, data.keys()), key=len)) + ... |
class LPGeneralException(Exception):
"""Raised when generic exceptions when using 'LPData' class"""
def __init__(self, msg):
self.msg = msg
class LPOptimizationFailedException(Exception):
"""Raised when optimization fails when using LPData class"""
pass
|
def make_singleton(class_):
def __new__(cls, *args, **kwargs):
raise Exception('class', cls.__name__, 'is a singleton')
class_.__new__ = __new__
|
def main():
a = int(input("Insira a idade do nadador: "))
if(a <= 5):
print("Categoria: Bebe")
elif(a > 5 and a <= 7):
print("Categoria: Infantil A")
elif(a >= 8 and a <= 10):
print("Categoria: Infantil B")
elif(a >= 11 and a <= 13):
print("Categoria: Juvenil... |
class Translation(object):
START_TEXT = """Hello Stranger,
Welcome To Valhalla.
"""
######################
HELP_USER = """**TF Does This Bot Do?**
**⁘ ¯\_(ツ)_/¯ Nothing. Ha Ha Ha**
**⁘ No,Seriously Tho (•_•)**
"""
DOWNLOAD_MSG = " **Downloading....**"
DOWNLOAD_FAIL_MSG = "**Failed T... |
#Contains an (x,y) point, usually in projected coords.
class Point:
def __init__(self, x:float, y:float):
self.x = x
self.y = y
def __repr__(self):
return "Point(%f,%f)" % (self.x, self.y)
def __str__(self):
return "(%f,%f)" % (self.x, self.y)
#Contains a (lat/lng) location, usually as +/- rat... |
class Node:
pass
class BinaryNode(Node):
def __init__(self, des, src1, src2):
self.des=des
self.src1=src1
self.src2=src2
class AdduNode(BinaryNode):
def __str__(self):
return f'addu {self.des}, {self.src1}, {self.src2}'
class MuloNode(BinaryNode):
def __str__(... |
n, m = map(int, input().split())
connected = []
seeds = []
for i in range(0, n):
connected.append([])
for i in range(0, m):
a, b = map(int, input().split())
if (b not in connected[a-1]):
connected[a-1].append(b)
if (a not in connected[b-1]):
connected[b-1].append(a)
print(connected)
# for each pasture
fo... |
class Rule:
def __init__(self, rule_id):
self.rule_id = rule_id
def __eq__(self, other):
return self.rule_id == other.rule_id
class RuleSet:
def __init__(self, **kwargs):
self.rules = {}
for k, v in kwargs.items():
self.rules[k] = Rule(v)
def __getattr__(s... |
class Solution(object):
def validPalindrome(self, s):
"""
:type s: str
:rtype: bool
"""
l, r = 0, len(s)-1
count = 0
def get_result(l,r,s,count,forward=True):
while l < r:
if s[l] == s[r]:
l += 1; r -= 1
... |
#! /usr/bin/python
# -*- coding: iso-8859-15 -*-
def sc(n):
if n > 1:
r = sc(n - 1) + n ** 3
else:
r = 1
return r
a = int(input("Desde: "))
b = int(input("Hasta: "))
for i in range(a, b+1):
if sc(i):
print ("Numero primo: ",i) |
sum(
1,
2, 3,
5,
)
sum(
1,
2, 3,
5)
|
class AccountError(Exception):
"""
Raised when the API can't locate any accounts for the user
"""
pass
|
class BackendError(Exception):
pass
class FieldError(Exception):
pass
|
def read_spreadsheet():
file_name = "Data/day2.txt"
file = open(file_name, "r")
spreadsheet = []
for line in file:
line = list(map(int, line.split()))
spreadsheet.append(line)
return spreadsheet
def checksum(spreadsheet):
total = 0
for row in... |
#!/usr/bin/env python3
# recherche empirique
aiguille = list()
for t in range(0, 43200):
h = t / 120
m = (t / 10) % 360
if abs(abs(h - m) - 90) < 0.05 or abs(abs(h - m) - 270) < 0.05:
if len(aiguille) > 0 and (t - aiguille[-1][0]) < 2:
del aiguille[-1]
hh, mm = int(h / 30), int(... |
"""
Given a string S, find the longest palindromic substring in S.
Substring of string S:
S[i...j] where 0 <= i <= j < len(S)
Palindrome string:
A string which reads the same backwards. More formally, S is palindrome if reverse(S) = S.
Incase of conflict, return the substring which occurs first ( with the least st... |
"""
Constants and methods used in testing
"""
class Colors():
WHITE = 'rgba(255, 255, 255, 1)'
RED_ERROR = 'rgba(220, 53, 69, 1)'
users = {
'valid_user': {'first_name':'Shinji',
'last_name': 'Ikari',
'user_name': 'sikari',
'address1': '123 Main St.',
... |
# Iterate through the array and maintain the min_so_far value. at each step profit = max(profit, arr[i]-min_so_far)
class Solution:
def maxProfit(self, prices: List[int]) -> int:
i = 0
max_profit = 0
min_so_far = 99999
for i in range(len(prices)):
max_profit = m... |
def f(xs):
ys = 'string'
for x in xs:
g(ys)
def g(x):
return x.lower()
|
def get_standard_config_dictionary(values):
run_dict = {}
run_dict['Configuration Name'] = values['standard_name_input']
run_dict['Model file'] = values['standard_model_input']
var_values = list(filter(''.__ne__, values['standard_value_input'].split('\n')))
run_dict['Parameter values'] = list(map(la... |
A, B, C = input() .split()
A = float(A)
B = float(B)
C = float(C)
triangulo = float(A * C /2)
circulo = float(3.14159 * C**2)
trapezio = float(((A + B) * C) /2)
quadrado = float(B * B)
retangulo = float(A * B)
print("TRIANGULO: %0.3f" %triangulo)
print("CIRCULO: %0.3f" %circulo)
print("TRAPEZIO: %0.3f" %trapezio)
print... |
__all__ = [
'TargetApiError',
'TargetApiParamsError',
'TargetApiBadRequestError',
'TargetApiUnauthorizedError',
'TargetApiNotFoundError',
'TargetApiMethodNotAllowedError',
'TargetApiServerError',
'TargetApiServiceUnavailableError',
'TargetApiParameterNotImplementedError',
'Target... |
PAD = 0
UNK = 1
EOS = 2
BOS = 3
PAD_WORD = '<blank>'
UNK_WORD = '<unk>'
EOS_WORD = '<eos>'
BOS_WORD = '<bos>' |
#!/usr/bin/env python3
class Solution(object):
def isNumber(self, s):
"""
:type s: str
:rtype: bool
"""
state = [{},
{'blank': 1, 'sign': 2, 'digit': 3, '.': 4},
{'digit': 3, '.': 4},
{'digit': 3, '.': 5, 'e': 6, 'blank': 9... |
class File:
def __init__(self, name: str, kind: str, content=None, base64=False):
self.content = content
self.name = name
self.type = kind
self.base64 = base64
def save(self, path):
with open(path, 'wb') as f:
f.write(self.content)
def open(self, path):
... |
# README! #
# You can add your own maps, just follow the format:
# mapX = ("Name shown to the user", PUT THE THREE QUOTATION MARKS (""") HERE
# MAP GOES HERE, you can use any characters, but you can only define the map's borders
# PUT THREE QUOTATION MARKS (""") HERE
# #################################### #
# You MUS... |
class Chain():
def __init__(self, val):
self.val = val
def add(self, b):
self.val += b
return self
def sub(self, b):
self.val -= b
return self
def mul(self, b):
self.val *= b
return self
print(Chain(5).add(5).sub(2).mul(10))
|
#passed Test Set 1 in py
# def romanToInt(s):
# translations = {
# "I": 1,
# "V": 5,
# "X": 10,
# "L": 50,
# "C": 100,
# "D": 500,
# "M": 1000
# }
# number = 0
# s = s.replace("IV", "IIII").replace("IX",... |
EQUAL_ROWS_DATAFRAME_NAME = \
'dataframe_of_equal_rows'
NON_EQUAL_ROWS_DATAFRAME_NAME = \
'dataframe_of_non_equal_rows'
|
# HEAD
# Augmented Assignment Operators
# DESCRIPTION
# Describes basic usage of all the augmented operators available
# RESOURCES
#
foo = 40
# Addition augmented operator
foo += 1
print(foo)
# Subtraction augmented operator
foo -= 1
print(foo)
# Multiplication augmented operator
foo *= 1
print(foo)
# Division au... |
def test_client_can_get_avatars(client):
resp = client.get('/api/avatars')
assert resp.status_code == 200
def test_client_gets_correct_avatars_fields(client):
resp = client.get('/api/avatars')
assert 'offset' in resp.json
assert resp.json['offset'] is None
assert 'total' in resp.json
asser... |
"""
Question:
Write a program that accepts a comma separated sequence of words as input and prints the words in a comma-separated sequence
after sorting them alphabetically.
Suppose the following input is supplied to the program:
without,hello,bag,world
Then, the output should be:
bag,hello,without,world
"""
enter_st... |
# 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 diameterOfBinaryTree(self, root: TreeNode) -> int:
def helper(root):
if root is None... |
data_in: str = str()
balance: float = float()
deposit: float = float()
while True:
data_in = input()
if data_in == 'NoMoreMoney':
break
deposit = float(data_in)
if deposit < 0:
print('Invalid operation!')
break
print(f'Increase: {deposit:.2f}')
balance +=... |
class Solution:
# # Track unsorted indexes using sets (Revisited), O(n*m) time, O(n) space
# def minDeletionSize(self, strs: List[str]) -> int:
# n, m = len(strs), len(strs[0])
# unsorted = set(range(n-1))
# res = 0
# for j in range(m):
# if any(strs[i][j] > strs[i+1]... |
# code
t = int(input())
for _ in range(t):
n = int(input())
temp = list(map(int, input().split()))
l = [temp[i:i+n] for i in range(0, len(temp), n)]
del temp
weight = 1
for i in range(n):
l.append(list(map(int, input().split(','))))
row = 0
col = 0
suml = 0
while True:
... |
num = int(input("Digite um número Natural: "))
#cont = 0
#list = []
list_div = []
for c in range(1, num + 1):
if num % c == 0:
#cont += 1
list_div.append(c)
#list.append(c)
print(list)
print('='*40)
print(f'{num} possui {len(list_div)} divisores!\n'
f'Os dividores de {num} são: {list_div}'... |
def Efrase(frase):
nums = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')
if frase.count('.') == 1 and frase[len(frase) - 1] != '.' or frase == '.':
return False
elif frase.count('.') > 1:
return False
for j in range(0, 10):
if nums[j] in frase:
return False
... |
#!/usr/bin/env python
outlinks_file = open('link_graph_ly.txt', 'r')
inlinks_file = open('link_graph_ly2.txt', 'w')
inlinks = {} # url -> list of inlinks in url
for line in outlinks_file.readlines():
urls = line.split()
if (len(urls)) < 1:
continue
url = urls[0]
inlinks[url] = []
outlinks_fi... |
'''
Analysing the letter 'A' in a phrase.
'''
phrase = str(input('Type any phrase: ')).strip().lower()
print('The letter A appears {} times in this phrase.'.format(phrase.count('a')))
print('The first letter A appeared on the {}º position.'.format(phrase.find('a')+1))
print('The last letter A appeared on the {}º posit... |
quiz = {
1 : {
"question" : " Who developed the Python language?\n\n\n",
"answer" : "Guido van Rossum"
},
2 : {
"question" : "In which year was the Python language developed?\n\n\n",
"answer" : "1989"
},
3 : {
"question" : "In which language is Pytho... |
def init(cfg):
data = {'_logLevel': 'WARN', '_moduleLogLevel': 'WARN'}
if cfg['_stage'] == 'dev':
data.update({
'_logLevel': 'DEBUG',
'_moduleLogLevel': 'WARN',
'_logFormat': '%(levelname)s: %(message)s'
})
return data
|
"""Common configs for plots"""
class Base():
font = {
'family': 'Times New Roman',
'size': 16,
}
class Legend(Base):
font = {**Base.font, 'weight': 'bold'}
class Tick(Base):
font = {**Base.font, 'size': 12}
|
"""read()"""
f = open("./test_file2", 'r', encoding = 'utf-8')
# read a file line-by-line using a for loop
for line in f:
print(line, end='')
# read individual lines of a file
f5 = f.readline()
f6 = f.readline()
f7 = f.readline()
print("f5\n", f5)
print("f6\n", f6)
print("f7\n", f7)
# list of remaining lines of... |
user1_input = int(input("Please enter number 1 : Rock or 2 : Scissors or 3 : Papers."))
user2_input = int(input("Please enter number 1 : Rock or 2 : Scissors or 3 : Papers."))
if user1_input == 1:
user1_input = 'Rock'
elif user1_input == 2:
user1_input = 'Scissors'
else:
user1_input = 'Papers'
if user2_... |
class AdvancedBoxScore:
def __init__(self, seconds_played, offensive_rating, defensive_rating,
teammate_assist_percentage, assist_to_turnover_ratio, assists_per_100_possessions,
offensive_rebound_percentage, defensive_rebound_percentage, turnovers_per_100_possessions,
... |
def solution(A):
# write your code in Python 3.6
disks = []
for i,v in enumerate(A):
disks.append((i-v,1))
disks.append((i+v,0))
disks.sort(key=lambda x: (x[0], not x[1]))
active = 0
intersections = 0
for i,isBegin in disks:
if isBegin:
intersections += ac... |
"""
Given an integer array, adjust each integers so that the difference of every adjcent integers are not greater than a
given number target.
If the array before adjustment is A, the array after adjustment is B, you should minimize the sum of |A[i]-B[i]|
Note
You can assume each number in the array is a positive inte... |
def repeatedString(s, n):
total = s.count("a") * int(n/len(s))
total += s[:n % len(s)].count("a")
return total
s = "aba"
n = 10
n = int(n)
repeatedString(s, n)
|
# ======================================================================
# Beverage Bandits
# Advent of Code 2018 Day 15 -- Eric Wastl -- https://adventofcode.com
#
# Python implementation by Dr. Dean Earl Wright III
# ======================================================================
# =========================... |
"""
here we produce visualization with excel
# one-time excel preparation
in cmder
xlwings addin install
open excel
enable Trust access to VBA
File > Options > Trust Center > Trust Center Settings > Macro Settings
# making the visualization workbook
in cmder
chdir this_directory
xlwings quickstart boo... |
"""
进程控制类
"""
"""
PCB
进程控制块
"""
class PCB(object):
def __init__(self, name, a_time, e_time, priority):
self.name = name # 进程名
self.u_time = 0 # 已经被调度的时间
self.a_time = a_time # 进程到来的时间
self.e_time = e_time # 预计需要被调度的时间
self.priority = pri... |
def Singleton(cls):
_instance = {}
def _singleton(*args, **kwargs):
if cls not in _instance:
_instance[cls] = cls(*args, *kwargs)
return _instance[cls]
return _singleton
@Singleton
class A(object):
def __init__(self, x):
self.x = x
if __name__ == '__main__':
... |
"""501. Find Mode in Binary Search Tree"""
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution(object):
def findMode(self, root):
"""
:t... |
def beau(vals, diff):
lookup = set(vals)
result = []
for x in vals:
if x - diff in lookup and x + diff in lookup:
result.append((x - diff, x, x + diff))
return result
n, d = map(int, input().split())
values = tuple(map(int, input().split()))
triplets = beau(values, d)
print... |
"""ex113 - Funcoes aprofundadas em Python"""
def leiaInt(msg):
while True:
try:
n = int(input(msg))
break
except (ValueError, TypeError):
print("\033[31mERRO: por favor, digite um numero inteiro valido.\033[m")
continue
return n
def leiaFloat(m... |
class matrix:
def __init__(self, data):
self.data = [data] if type(data[0]) != list else data
#if not all(list(map(lambda x: len(x) == len(self.data[0]), self.data))): raise ValueError("Matrix shape is not OK")
self.row = len(self.data)
self.col = len(self.data[0])
se... |
# In the Manager class of Self Check 11, override the getName method so that managers
# have a * before their name (such as *Lin, Sally ).
class Employee():
def __init__(self, name="", base_salary=0.0):
self._name = name
self._base_salary = base_salary
def set_name(self, new_name):
se... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# TextReplaceResult.py
# 2021, Lin Zhijun, https://github.com/toolgood/ToolGood.TextFilter.Api
# MIT Licensed
__all__ = ['ToolGood.TextFilter.TextReplaceResult']
class TextReplaceResult():
'返回码:0) 成功,1) 失败'
code=0
'返回码详情描述'
message=""
'请求标识'
reque... |
typenames = {"int": 4}
operations = {"+=", "-="}
class VarNameCreator:
state = 0
def __init__(self, state=0):
self.state = state
def char2latin(self, char):
x = ('%s' % hex(ord(char)))[2:]
#print(x, char)
ans = []
#print(x)
for el in x:
if '0' <= el <= '9':
ans.append(chr(ord(el) - ord('0') + ... |
#---------------------------------------
#Since : 2019/04/25
#Update: 2021/11/18
# -*- coding: utf-8 -*-
#---------------------------------------
class Parameters:
def __init__(self):
#Game setting
self.board_x = 8 # boad size
self.board_y = self.board_... |
print("Bienvenido al cajero automatico de este banco")
print()
usuario=int(input("Ingrese la cantidad de dinero que desea\n"))
cant500 = usuario // 500
resto500 = usuario % 500
cant200 = resto500 // 200
resto200 = resto500 % 200
cant100 = resto200 // 100
resto100 = resto200 % 100
print("cant de billetes de 500: ", ... |
def f(yan):
xan = yan*3
xan -= 2
fin1 = []
tant = [0,1]
for i in range(xan):
shet = i
shet2 = i+1
newr = tant[shet] + tant[shet2]
tant.append(int(newr))
#2part
for i in range(xan):
gav = tant.pop()
if (gav % 2 == 0):
fin1.append(gav)
... |
#Perde 10 minutos de vida por cigarro. Informar quantos dias de vida perdeu
q_d = int(input('Quantos cigarros por dia: '))
q_a = int(input('Fumante por quantos anos? '))
# Total de cigarros
t_c = (q_d * q_a) * 364
# Total de dias perdidos.
q_d = (t_c * 10) / 60 / 24
print(f'Você perdeu {q_d // 1:.0f} dias de vida fuman... |
"""
Follow up for H-Index: What if the citations array is sorted in ascending order? Could you optimize your algorithm?
"""
__author__ = 'Daniel'
class Solution(object):
def hIndex(self, A):
"""
Given sorted -> binary search
From linear search into bin search
:type A: List[int]
... |
_BEGIN = 0
BLACK=0
WHITE=1
GRAY=2
_END = 12 |
def swap(s,n):
res=bin(n)[2:]*(len(s)//len(bin(n)[2:])+1)
index=0
string=""
for i in range(len(s)):
if not s[i].isalpha():
string+=s[i]
continue
string+=s[i].swapcase() if res[index]=="1" else s[i]
index+=1
return string
|
class Solution:
def XXX(self, s: str) -> int:
blank_count = 0
start = 0
for index in range(len(s)):
if s[index] != " ":
if blank_count == 0:
continue
else:
blank_count = 0
start = index
... |
# class node to store data and next
class Node:
def __init__(self,data, next=None, prev=None):
self.data = data
self.next = next
self.prev = prev
# defining getter and setter for data, next and prev
def getData(self):
return self.data
def setData(self, data):
self.data = data
def... |
# Hello world
'''
We will use this file to write our first statement in Python
Pretty simple:
print('Hello world')
''' |
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
point = Point(3, 5)
print(f"The Point x value is {point.x}")
print(f"The Point y value is {point.y}")
|
# The Fibonacci Sequence
# The Fibonacci sequence begins with fibonacci(0) = 0 and fibonacci(1) = 1 as its respective first and second terms. After these first two elements, each subsequent element is equal to the sum of the previous two elements.
def fibonacci(n):
if n == 0 or n == 1:
return n
ret... |
# Início do programa
print("\n"*100)
print("Neste jogo você deve convencer Deus a não destruir Sodoma e Gomorra.")
print("No prompt 'Eu' Digite:")
print("--> Senhor, e se houver xyz justos na cidade?")
print("(Onde 'xyz' corresponde a um número entre 0 e 999)")
print("BOA SORTE!!!")
input("Tecle <ENTER> ")
# Início d... |
"""
category: Model Variations
name: Steady State Distrubtion
descr: Run repeated steady state calculations using random parameters (based on min/max parameter values)
menu: yes
icon: module.png
tool: no
"""
items = tc_allItems()
params = tc_getParameters(items)
params2 = fromTC(params)
avgvalues = params2[2][0]
minval... |
# -*- coding: utf-8 -*-
"""
eater.errors
~~~~~~~~~~~~
A place for errors that are raised by Eater.
"""
__all__ = [
'EaterError',
'EaterTimeoutError',
'EaterConnectError',
'EaterUnexpectedError',
'EaterUnexpectedResponseError'
]
class EaterError(Exception):
"""
Base Eater erro... |
class Cell:
def __init__(self, number):
self.number = number
def __add__(self, other):
return Cell(self.number + other.number)
def __sub__(self, other):
result = self.number - other.number
if result > 0:
return Cell(result)
else:
print('в пер... |
#
# PySNMP MIB module WWP-LEOS-PORT-STATS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WWP-LEOS-PORT-STATS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:31:30 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... |
"""
Makes a list of the files to be copied from source to destination.
Notes: Couldn't make this doctest work, so useful only as a visual test.
>>> from GDLC.GDLC import *
# Copy a list of files to the default directory:
>>> template_copy(dir='~/GDLC/source/GDLC_unpacked') # doctest:+ELLIPSIS
[PosixPath('.../mobi7/... |
def partition(arr, left, right):
pivot = arr[left]
low = left + 1
high = right
while low <= high:
while low <= right and pivot > arr[low]:
low += 1
while high > left and pivot < arr[high]:
high -= 1
if (low <= high):
arr[low], arr[high] = arr[... |
# Copyright (c) 2019 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
sieve = [0] * 300001
for i in range(6, 300000, 7):
sieve[i] = sieve[i+2] = 1
MSprimes = []
for i in range(6, 300000, 7):
if sieve[i] == 1:
MSprimes.append(i)
for j in range(2*i, 300000, i):
sieve[j] = 0
if sieve[i+2] == 1:
MSprimes.append(i+2)
for j in range(2*(i... |
N = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
print(sum(a[1::2][:N]))
|
if m > 1:
b = 'metros equivalem'
else:
b = 'metro equivale'
#https://pt.stackoverflow.com/q/413280/101
|
#
#
#
#
#
#
#
def modifyData():
file = open("data_origin.txt", 'r')
printFile = open("raw_data.txt",'w+')
while True:
text = file.readline()
res = text.split()
if not text:
break
if res[3] == '실행' or res[3] == '출력':... |
# Test of 3.5+ GET_YIELD_FROM_ITER
# Code is from https://stackoverflow.com/questions/41136410/python-yield-from-or-return-a-generator
def add(a, b):
return a + b
def sqrt(a):
return a ** 0.5
data1 = [*zip(range(1, 3))] # [(1,), (2,)]
job1 = (sqrt, data1)
def gen_factory(func, seq):
"""Generator facto... |
__version__ = '0.1.0'
def cli():
print("Hello from child CLI!")
|
input_data = '1901,12.3\n1902,45.6\n1903,78.9'
print('input data is:')
print(input_data)
as_lines = input_data.split('\n')
print('as lines:')
print(as_lines)
for line in as_lines:
fields = line.split(',')
year = int(fields[0])
value = float(fields[1])
print(year, ':', value)
|
def get_function_at(bv, addr):
""" Gets the function that contains a given address, even if that address
isn't the start of the function """
blocks = bv.get_basic_blocks_at(addr)
return blocks[0].function if (blocks is not None and len(blocks) > 0) else None
def find_mlil(func, addr):
return find_i... |
def _get_owner_from_details(details, default=None):
result = default
if details.get('owner_slackid') is not None:
return '<@{}>'.format(details.get('owner_slackid'))
elif details.get('owner_name') is not None:
return details.get('owner_name')
return result
command_car_usage = 'Lookup c... |
"""Project metadata.
"""
__title__ = 'yummly'
__summary__ = 'Python library for Yummly API: https://developer.yummly.com'
__url__ = 'https://github.com/dgilland/yummly.py'
__version__ = '0.5.0'
__install_requires__ = ['requests>=1.1.0']
__author__ = 'Derrick Gilland'
__email__ = 'dgilland@gmail.com'
__license__ = '... |
def findDecision(obj): #obj[0]: Passanger, obj[1]: Weather, obj[2]: Temperature, obj[3]: Time, obj[4]: Coupon, obj[5]: Coupon_validity, obj[6]: Gender, obj[7]: Age, obj[8]: Maritalstatus, obj[9]: Children, obj[10]: Education, obj[11]: Occupation, obj[12]: Income, obj[13]: Bar, obj[14]: Coffeehouse, obj[15]: Restaurantl... |
score = int(input())
if score >= 90:
print("A")
elif score >= 70:
print("B")
elif score >= 40:
print("C")
else:
print("D") |
{
"targets": [
{
"target_name": "addon",
"sources": ["./main_node.cpp", "./GhostServer/GhostServer/networkmanager.cpp"],
"libraries": ["-lsfml-network", "-lsfml-system", "-lpthread"],
}
]
}
|
print('''Type the phrases bellow to know our answer:
1. Hello
2. How are you?
3. Good bye''')
ps = (70 * '-') + '\nYou might have to try again if the phrases will be inserted differently.'
print(ps)
while True:
userInput = str(input('Please input the choosen phrase: ')).upper()
if userInput == 'HELLO':
... |
reference
hitbtc_markets = hitbtc.load_markets()
print(hitbtc.id, hitbtc_markets)
print(bitmex.id, bitmex.load_markets())
print(huobipro.id, huobipro.load_markets())
print(hitbtc.fetch_order_book(hitbtc.symbols[0]))
print(bitmex.fetch_ticker('BTC/USD'))
print(huobipro.fetch_trades('LTC/USDT'))
print(exmo.fetch_bala... |
#!/usr/bin/env python
# encoding: utf-8
"""
sort_list_to_binary_tree.py
Created by Shengwei on 2014-07-03.
"""
# https://oj.leetcode.com/problems/convert-sorted-list-to-binary-search-tree/
# tags: easy, tree, linked-list, sorted, convert, D&C
"""
Given a singly linked list where elements are sorted in ascending orde... |
"""
Tests for the PandaSpark module, you probably don't want to import this
directly.
"""
|
class Member:
def __init__(
self, name: str, linkedin_url: str = None, github_url: str = None
) -> None:
self.name = name
self.linkedin_url = linkedin_url
self.github_url = github_url
def sidebar_markdown(self):
markdown = f'<b style="display: inline-block; vertical... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.