content stringlengths 7 1.05M |
|---|
# -*- coding: utf-8 -*-
def print_logo():
"""
___ __ __ _ __
/ _ \___ ___/ / / / (_)__ / /_
/ , _/ -_) _ / / /__/ (_-</ __/
/_/|_|\__/\_,_/ /____/_/___/\__/
by Team Avengers
MIT LICENSE
"""
print(" ___ __ __ _ __ \n / _ \___ ___/ / / / (_)__ / /_\n / , _/ -_) _ / / ... |
class FizzBuzz(object):
def say(self, number):
if number % 3 == 0 and number % 5 == 0:
return 'FizzBuzz'
elif number % 3 == 0:
return 'Fizz'
elif number % 5 == 0:
return 'Buzz'
else:
return number
|
# -*- coding: utf-8 -*-
__title__ = 'amicleaner'
__version__ = '0.2.0'
__short_version__ = '.'.join(__version__.split('.')[:2])
__author__ = 'Guy Rodrigue Koffi'
__author_email__ = 'koffirodrigue@gmail.com'
__license__ = 'MIT'
|
#-*- coding: utf-8 -*-
spam = 65 # an integer declaration.
print(spam)
print(type(spam)) # this is a function call
eggs = 2
print(eggs)
print(type(eggs))
# Let's see the numeric operations
print(spam + eggs) # sum
print(spam - eggs) # difference
print(spam * eggs... |
#!/usr/bin/env python
# created by Bruce Yuan on 17-11-27
class ConstError(Exception):
def __init__(self, message):
self._message = str(message)
def __str__(self):
return self._message
__repr__ = __str__
|
banyakPerulangan = 10
i = 0
while (i < banyakPerulangan):
print('Hello World')
i += 1 |
class Solution:
def sortSentence(self, s: str) -> str:
s=s.split()
s.sort(key = lambda x: x[-1])
sent=""
for i in s:
sent += (i[:-1]+" ")
s=sent.strip()
return s |
a=10
b=20
print(b-a)
print("SUBTRACTED b-a")
|
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'camera',
'dependencies': [
'<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:load_time_data',... |
"""
PERIODS
"""
numPeriods = 180
"""
STOPS
"""
numStations = 13
station_names = (
"Hamburg Hbf", # 0
"Landwehr", # 1
"Hasselbrook", # 2
"Wansbeker Chaussee*", # 3
"Friedrichsberg*", # 4
"Barmbek*", # 5
"Alte Woehr (Stadtpark)", # 6
"Ruebenkamp (City Nord)", # 7
"Ohlsdorf*", # 8
"Kornweg", # 9
... |
print("Rock..Paper..Scissors..")
print("Type rock or paper or scissors")
player1 = input("player 1, Your move: ")
player2 = input("player 2, Your move: ")
if player1 == player2:
print("It's a draw!")
elif player1 == "rock":
if player2 == "scissors":
print("player1 wins!")
elif player2 == "paper":
print... |
ATTR_CODE = "auth_code"
CONF_MQTT_IN = "mqtt_in"
CONF_MQTT_OUT = "mqtt_out"
DATA_KEY = "media_player.hisense_tv"
DEFAULT_CLIENT_ID = "HomeAssistant"
DEFAULT_MQTT_PREFIX = "hisense"
DEFAULT_NAME = "Hisense TV"
DOMAIN = "hisense_tv"
|
class Solution:
def mergeAlternately(self, word1: str, word2: str) -> str:
first, second = len(word1), len(word2)
result = ""
for one, two in zip(word1, word2):
result += one + two
diff = first - second
if not diff:
return result
elif diff > 0... |
class Resource:
# 各种需要用到的页面
img_url = "http://210.42.121.241/servlet/GenImg" # 获取验证码的页面
login_url = "http://210.42.121.241/servlet/Login" # 登录页面
index_url = "http://210.42.121.241/stu/stu_index.jsp" # 登录之后的主页面,在这里获取令牌
gpa_url = "http://210.42.121.241/stu/stu_score_credit_statics.jsp" # 带日历的总分和成绩... |
matches = 0
for line in open('2/input.txt'):
acceptable_range, letter, password = line.split(" ")
low, high = acceptable_range.split("-")
count = password.count(letter[0])
if count in range(int(low), int(high)+1):
matches += 1
print(matches) |
class Solution:
def countNegatives(self, grid: List[List[int]]) -> int:
count = 0
for row in grid:
for c in row:
if c < 0: count += 1
return count |
class MyHashSet:
def __init__(self):
self.set = [False] * 1000001
def add(self, key: int) -> None:
self.set[key] = True
def remove(self, key: int) -> None:
self.set[key] = False
def contains(self, key: int) -> bool:
return self.set[key]
|
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
'''
import cachetools
from . import lang
enabled = True
maxsize = 1000
scriptures = {}
for each in lang.available:
scriptures[each] = cachetools.LRUCache(maxsize=maxsize)
''' |
class Solution:
def mySqrt(self, x: int) -> int:
low=0
high=x
middle= (low+high)//2
while(high>middle and middle>low):
square=middle*middle
if (square==x):
return int(middle)
if (square>x):
high=middle
el... |
palavra_secreta = 'teste'
digitadas = []
chances = 3
while True:
if chances <= 0:
print('Você perdeu!!!')
break
letra = input('Digite uma letra: ')
if len(letra) > 1 or letra.isnumeric():
print('Ahh isso não vale digite apenas uma letra!')
continue
digitadas.append(let... |
# -*- coding:utf-8 -*-
'''
File: templates.py
File Created: Tuesday, 12th February 2019
Author: Hongzoeng Ng (kenecho@hku.hk)
-----
Last Modified: Tuesday, 12th February 2019
Modified By: Hongzoeng Ng (kenecho@hku.hk>)
-----
Copyright @ 2018 KenEcho
'''
moving_average_code = """# Moving average strategy
start = '%s'
e... |
# 01_Faça um Programa que peça dois números e imprima o maior deles.
n1 = int(input('Digite primeiro número:'))
n2 = int(input('Digite segundo número:'))
if (n1 > n2):
print('O maior número digitado foi: ', n1)
else:
print('O menor número digitado foi: ', n2)
|
print("Podaj a:")
a = int(input())
print("Podaj b:")
b = int(input())
print("A") if a > b else print("=") if a == b else print("B")
|
def get_user_access_token():
"""Get the secret access token of the currently-logged-in Microsoft user, for use with the Microsoft REST API.
Requires this app to have its own Microsoft client ID and secret. """
pass
def get_user_email():
"""Get the email address of the currently-logged-in Microsoft use... |
class DB:
'''
Convience class for decibel scale. Other non-linear scales such as the richter scale could be handled similarly.
Usage:
dB = DB()
.
. (later)
.
gain = 15 * dB
'''
def __rmul__(self, val):
'''
Only allow multiplication from the right to avoid confus... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
""" GOST R 34.10-20** digital signature implementation
This module implements Weierstrass elliptic curves (class elliptic_curve),
and GOST R 34.10-20** digital signature: generation, verification, test
and various supplemental stuff
""" |
print("""This program will translate any string of text into "uwu" with
100 percent accuracy""")
text = input("Enter text to translate: ")
text = text.casefold()
text = text.replace("r", "w")
text = text.replace("l", "w")
text = text.replace("s", "th")
print("")
print("""translated: "{}" 乂❤‿❤乂""".format(text))
print("... |
class Solution:
def maxProfit(self, k: int, prices: List[int]) -> int:
n, res = len(prices), 0
if n < 2:
return 0
if k > n // 2:
for i in range(1, n):
if prices[i] > prices[i - 1]:
res += prices[i] - prices[i - 1]
return... |
def proper_divisors_sum(n):
return sum(a for a in xrange(1, n) if not n % a)
def amicable_numbers(a, b):
return proper_divisors_sum(a) == b and proper_divisors_sum(b) == a
# def amicable_numbers(a, b):
# # this works after multiple submissions to get lucky on random inputs
# return sum(c for c in xr... |
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 4 11:19:30 2021
@author: Easin
"""
in1 = input().split()
list1 = []
for elem in range(len(in1)):
list1.append(int(in1[elem]))
#print(list1)
maxm = max(list1)
list2=[]
for val in range(len(list1)):
if list1[val] != maxm:
out = maxm - lis... |
def save_to_file(data: list, filename: str):
"""Save to file."""
with open(f"{filename}", "w") as f:
for item_ in data:
f.write("%s\n" % item_)
|
print('-=-=- Pintando Parede -=-=-')
#considerando 2m2 d parede = 1 litro de tinta
largura = float(input('Largura da parede: '))
altura = float(input('Altura da parede: '))
print(f'Sua parede tem a dimensão de [{largura}x{altura}] e sua área é de {largura*altura}m2')
print(f'Para pintar essa parede, você precisará de... |
MESSAGE_TIMESPAN = 2000
SIMULATED_DATA = False
I2C_ADDRESS = 0x77
GPIO_PIN_ADDRESS = 24
BLINK_TIMESPAN = 1000
|
sal = float(input('Digite o Sálario: R$ '))
por = float(input('Digite o Aumento: % '))
ns = sal + (sal * por / 100)
print('O Salário de R$ {:.2f} com Aumento de {}%, ficará com R$ {:.2f}'.format(sal, por, ns))
|
"""Meta variables for SkLite"""
__title__ = "sklite"
__version__ = "0.0.2"
__description__ = "Use Scikit Learn models in Flutter"
__url__ = "https://github.com/axegon/sklite"
__author__ = "Alexander Ejbekov"
__author_email__ = "alexander@kialo.ai"
__license__ = "MIT"
__compat__ = "0.0.1"
|
pkgname = "evolution-data-server"
pkgver = "3.44.0"
pkgrel = 0
build_style = "cmake"
# TODO: libgdata
configure_args = [
"-DENABLE_GOOGLE=OFF", "-DWITH_LIBDB=OFF",
"-DSYSCONF_INSTALL_DIR=/etc", "-DENABLE_INTROSPECTION=ON",
"-DENABLE_VALA_BINDINGS=ON",
]
hostmakedepends = [
"cmake", "ninja", "pkgconf", "... |
budget = float(input())
name = "Hello, there!"
count = 0
diff_count = 0
fee = 0
while True:
name = input()
if name == "Stop":
print(f"You bought {count} products for {fee:.2f} leva.")
break
price = float(input())
diff_count += 1
if diff_count%3 == 0:
price = price / 2
if ... |
'''Taking the input of CIPHERTEXT from the user and removing UNWANTED CHARACTERS and/or WHITESPACES'''
Input = input("Enter ciphertext:")
Input = Input.upper()
NotRecog = '''`~1234567890!@#$%^&*()-_=+[{]}\|'";:.>/?,< '''
for i in Input:
if i in NotRecog:
Input = Input.replace(i,'')
'''Taking the input of K... |
class Geometric:
def Area(self, x, y):
return x * y
|
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
#
"""
Legal content, should offer a lot of fun to write, this is not used so far
"""
__version__ = '4.0'
content = {
'classified_headline':(
'Commercial Rentals', 'Business Opportunities', 'Bed & Breakfast', 'Year Round Rentals',
'Winter Ren... |
# Python 的元组与列表类似,不同之处在于元组的元素不能修改。
#
# 元组使用小括号,列表使用方括号。
#
# 元组创建很简单,只需要在括号中添加元素,并使用逗号隔开即可。
tup1 = ('Google', 'Runoob', 1997, 2000)
tup2 = (1, 2, 3, 4, 5 )
tup3 = "a", "b", "c", "d"
print(tup1)
print(tup2)
print(tup3)
print(tup1[2:])
#空元组
tup4 = ()
print(tup4)
#元组中只包含一个元素时,需要在元素后面添加逗号,否则括号会被当作运算符使用
tup5 = (5... |
def somar(a, b, c):
s = a + b + c
return s
def fatorial(n):
f = 1
for c in range(n, 0, -1):
f *= c
return f
# Programa Principal
n1 = int(input('Digite um número: '))
n2 = int(input('Digite outro número: '))
n3 = int(input('Digite o último número: '))
print('A soma dos números é {}'.form... |
# Solution to day 10 of AOC 2015, Elves Look, Elves Say
# https://adventofcode.com/2015/day/10
new_sequence = '1113222113'
for i in range(50):
print('i, len(new_sequence)', i, len(new_sequence))
sequence = new_sequence
run_digit = None
run_length = 0
new_sequence = ''
for head in sequence:
... |
# Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.
#
# Symbol Value
# I 1
# V 5
# X 10
# L 50
# C 100
# D 500
# M 1000
# For example, two is written as II in Roman numeral, just two one's added to... |
class Solution:
def mergeInBetween(self, list1: ListNode, a: int, b: int, list2: ListNode) -> ListNode:
head = list1
for i in range(a - 1):
list1 = list1.next
a_1 = list1
for i in range(b - a + 1):
list1 = list1.next
b_1 = list1.next
list1.next... |
# coding: utf-8
# # CS 196 Spring 2017 Homework 3
# # Table of Contents
# ---
# 1. [Count Cycles](#Count-Cycles)
# 2. [Zip Dictionary](#Zip-Dictionary)
# 3. [List Intersections](#List-Intersections)
# 4. [Find Duplicates](#Find-Duplicates)
# 5. [Sum of the Product of Key and Value](#Sum-of-the-Product-of-Key-and-Va... |
# problem3.py
# The prime factors of 13195 are 5, 7, 13 and 29.
# What is the largest prime factor of the number 600851475143 ?
number = 600851475143
divider = 2
while number != 1:
if number % divider == 0:
number = number / divider
print(divider)
else:
divider += 1
|
class Solution:
# Accumulator List (Accepted), O(n) time and space
def waysToMakeFair(self, nums: List[int]) -> int:
acc = []
is_even = True
n = len(nums)
for i in range(n):
even, odd = acc[i-1] if i > 0 else (0, 0)
if is_even:
even += nums... |
#!/usr/bin/python3
def list_division(my_list_1, my_list_2, list_length):
idx = 0
results = []
error = None
while list_division and idx < list_length:
try:
results.append(my_list_1[idx] / my_list_2[idx])
except ZeroDivisionError:
error = "division by 0"
... |
class Solution(object):
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
length = len(prices)
if length == 0:
return 0
max_profit, low = 0, prices[0]
for i in range(1, length):
if low > prices[i]:
... |
frutas = open('frutas.txt', 'r')
numeros= open('numeros.txt','r')
lista_frutas= [] #Llenar las lista con los datos del archivo frutas.txt
lista_numeros= []#Llenar las lista con los datos del archivo numeros.txt
for i in frutas:
lista_frutas.append(i)
frutas.close()
for i in numeros:
lista_numeros.append(i)
numero... |
# Section 6.2.5 snippets
country_capitals1 = {'Belgium': 'Brussels',
'Haiti': 'Port-au-Prince'}
country_capitals2 = {'Nepal': 'Kathmandu',
'Uruguay': 'Montevideo'}
country_capitals3 = {'Haiti': 'Port-au-Prince',
... |
class BitmexDataIterator():
def __init__(self,data):
self._data = data
self._index = 0
def __next__(self):
pass
class BitmexDataStructure():
"""
Data Object for Bitmex data manipulation
"""
def __init__(self,symbol,use_compression=False):
self._symbol = symbol... |
N = int(input())
Y = 0
for _ in range(N):
t = input().split()
x = float(t[0])
u = t[1]
if u == 'JPY':
Y += x
elif u == 'BTC':
Y += x * 380000.0
print(Y)
|
def reverse(x: int) -> int:
neg = x < 0
if neg:
x *= -1
result = 0
while x:
result = result * 10 + x % 10
x //= 10
return result if not neg else -1 * result
assert reverse(123) == 321
assert reverse(-123) == -321
|
class ParenthesizePropertyNameAttribute(Attribute,_Attribute):
"""
Indicates whether the name of the associated property is displayed with parentheses in the Properties window. This class cannot be inherited.
ParenthesizePropertyNameAttribute()
ParenthesizePropertyNameAttribute(needParenthesis: bool)
""... |
matriz = [[], [], []]
for i in range(0, 3):
matriz[0].append(int(input(f'Digite um valor para [{0}, {i}]: ')))
for i in range(0, 3):
matriz[1].append(int(input(f'Digite um valor para [{1}, {i}]: ')))
for i in range(0, 3):
matriz[2].append(int(input(f'Digite um valor para [{2}, {i}]: ')))
print(f'{matriz[0]}... |
r"""Psuedo-spectral implementations of some useful equations
In PsDNS, equations are represented as class objects that implement a
:meth:`rhs` method. The :meth:`rhs` method takes one argument,
*uhat*, which is the solution vector, normally in spectral space
expressed as a :class:`~psdns.bases.SpectralArray`, and it ... |
#!/usr/bin/env python
"""
Provides custom messages.
"""
ADD_RECORD_NOT_ALLOWED = 'Adding record is not allowed.'
SUCCESSFULL_RESPONSE_MESSAGE = 'You have successfully completed this operation.'
FAILED_RESPONSE_MESSAGE = 'Error: you have attempted wrong operation.'
VENDING_MACHINE_COINS_VALID_MESSAGE = f'users wit... |
class Solution:
def __init__(self):
self.map = {}
def cloneGraph(self, node):
if node is None:
return None
next = UndirectedGraphNode(node.label)
self.map[str(node.label)] = next
for tmp in node.neighbors:
if str(tmp.label) in self.map:
... |
#Metodo Format substitui as variáveis passadas
# \' aspas simples
# \"" aspas duplas
# \n quebra de linha
# \r retorno de carga = ENTER
# \t tabulação
# \b backspace apaga o caractere anterior
cidade = "Sao Paulo"
dia = 15
mes = "Setembro"
ano = 2021
canal = "CFB Cursos"
data = "{}, {} de {} de {} \n \"{}\"" #formato... |
"""
Package used by tests.
"""
C = 3
|
#!/usr/bin/env python3
"""
Copyright (c) 2017-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
"""
PREFIX = "__osc_"
OUTFILE_TABLE = "__osc_tbl_"
OUTFILE_EXCLUDE_ID = "__osc_ex_"
OUTFILE_INCLUDE_I... |
with open('input.txt') as f:
octopus = list(map(lambda line: list(map(int, line.strip())), f.readlines()))
def print_grid(grid):
for line in grid:
print(''.join(map(str, line)))
def update(grid):
flash_count = 0
# increase all
flashed = set()
to_updates = []
for row in range(len(grid)):
for col in range(l... |
#
# PySNMP MIB module CISCO-FIPS-STATS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-FIPS-STATS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:41:23 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... |
N = int(input())
a = list(map(int, input().split()))
s = float("inf")
for i in range(min(a), max(a) + 1):
t = 0
for j in a:
t += (j - i) ** 2
s = min(s, t)
print(s)
|
n_temperaturas = int(input("Quantidade de temperaturas que irá digitar: "))
temperaturas = []
n_temperatura = 1
for i in range(n_temperaturas):
print("Temperatura n° ", n_temperatura)
temperatura = temperaturas.append(float(input("Digite a temperatura: ")))
n_temperatura += 1
print("Maior temperatura = ", ... |
class LoginBase():
freeTimeExpires = -1
def __init__(self, cr):
self.cr = cr
def sendLoginMsg(self, loginName, password, createFlag):
pass
def getErrorCode(self):
return 0
def needToSetParentPassword(self):
return 0 |
class RequiredClass:
pass
def main():
required = RequiredClass()
print(required)
if __name__ == '__main__':
main()
|
def join_topic(part1: str, part2: str):
p1 = part1.rstrip('/')
p2 = part2.rstrip('/')
return p1 + '/' + p2
|
# encoding: utf-8
class DropShadowFilter(object):
def __init__(self, distance=4.0, angle=45.0, color=0, alpha=1.0,
blurX=4.0, blurY=4.0, strength=1.0, quality=1,
inner=False, knockout=False, hideObject=False):
self._type = 'DropShadowFilter'
self.dist... |
class Red_Black_Tree(object):
class __Node(object):
def __init__(self, key, value=None, color=None, parent=None, left=None, right=None):
self.key = key
self.value = value
self.color = color # black = 0 red = 1
self.parent = parent
self.left = le... |
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 12 13:38:30 2022
@author: mlols
"""
def hk_modes(hier_num):
"""
Generate modes in the HK hierarchy.
Parameters
----------
hier_num : int
Number in the HK hierarchy (hier_num = n means the nth model).
Returns
-------
p_modes : li... |
#!/usr/bin/env python3
class Solution:
def setZeroes(self, matrix):
nrow, ncol = len(matrix), len(matrix[0])
for i in range(nrow):
for j in range(ncol):
if matrix[i][j] == 0:
matrix[i][j] = 'X'
for k in range(ncol):
... |
""" Class description goes here. """
"""Exceptions classes used in dataclay."""
__author__ = 'Alex Barcelo <alex.barcelo@bsc.es>'
__copyright__ = '2015 Barcelona Supercomputing Center (BSC-CNS)'
|
# Parameters
BEHAVIORS = 'behaviors'
STIMULUS_ELEMENTS = 'stimulus_elements'
MECHANISM_NAME = 'mechanism'
START_V = 'start_v'
START_VSS = 'start_vss'
START_W = 'start_w'
ALPHA_V = 'alpha_v'
ALPHA_VSS = 'alpha_vss'
ALPHA_W = 'alpha_w'
BETA = 'beta'
MU = 'mu'
DISCOUNT = 'discount'
TRACE = 'trace'
BEHAVIOR_COST = 'behavio... |
nums_str = []
with open("dane/dane.txt") as f:
lines = []
for line in f:
sline = line.strip()
num = int(sline, 8)
num_str = str(num)
nums_str.append(num_str)
count = 0
for num_str in nums_str:
if num_str[0] == num_str[-1]:
count += 1
print(f"{count=}")
|
'''
Provides utility functions for encoding and decoding linestrings using the
Google encoded polyline algorithm.
'''
def encode_coords(coords):
'''
Encodes a polyline using Google's polyline algorithm
See http://code.google.com/apis/maps/documentation/polylinealgorithm.html
for more information.
... |
router = {"host":"192.168.56.1",
"port":"830",
"username":"cisco",
"password":"cisco123!",
"hostkey_verify":"False"
} |
"""
======================================
Classifier (:mod:`classifier` package)
======================================
This package provides supervised machine learning classifiers.
The decision forest module (:mod:`classifier.decision_forest`)
--------------------------------------------------------------
.. auto... |
class InstascrapeError(Exception):
"""Base exception class for all of the exceptions raised by Instascrape."""
class ExtractionError(InstascrapeError):
"""Raised when Instascrape fails to extract specified data from HTTP response."""
def __init__(self, message: str):
super().__init__("Failed to e... |
class Proxy:
def __init__(self, host, port):
self.host=host
self.port=port
self.succeed=0
self.fail=0
def markSucceed(self):
self.succeed +=1
def markFail(self):
self.fail +=1
def __str__(self):
return f'http://{self.host}:{self.port}'
|
lineitem_scheme = ["l_orderkey","l_partkey","l_suppkey","l_linenumber","l_quantity","l_extendedprice",
"l_discount","l_tax","l_returnflag","l_linestatus","l_shipdate","l_commitdate","l_receiptdate","l_shipinstruct",
"l_shipmode","l_comment", "null"]
order_scheme = ["o_orderkey", "o_custkey","o_orderstatus","o_totalpri... |
#!/usr/bin/env python3
# Daniel Nicolas Gisolfi
class UserCommand:
""" The users input that will be translated into a shell command """
def __init__(self, cmd:str, args:list):
self.command = cmd
self.args = args
|
# https://github.com/adamsaparudin/python-datascience
# if (kondisi)
# if ("adam" == "adam") # True / False
# Task 1
# FIZZBUZZ
# print FIZZ jika bisa dibagi 3,
# print BUZZ jika bisa dibagi 5,
# print FIZZBUZZ jika bisa dibagi 15,
# print angka nya sendiri jika tidak bisa dibagi 3 atau 5
# input 6
# FIZZ
# input... |
def parse_list_ranges(s,sep='-'):
r = []
x = s.split(',')
for y in x:
z = y.split(sep)
if len(z)==1:
r += [int(z[0])]
else:
r += range(int(z[0]),int(z[1])+1)
return list(r)
def parse_list_floats(s):
x = s.split(',')
return list(map(float, x))
|
class LayoutRuleFixedNumber(LayoutRule, IDisposable):
"""
This class indicate the layout rule of a Beam System is Fixed-Number.
LayoutRuleFixedNumber(numberOfLines: int)
"""
def Dispose(self):
""" Dispose(self: LayoutRuleFixedNumber,A_0: bool) """
pass
def ReleaseManage... |
def print_tree(mcts_obj, root_node):
fifo = []
for child_node in root_node.children:
q = 0
if mcts_obj.visits[child_node] > 0:
q = mcts_obj.Q[child_node] / mcts_obj.visits[child_node]
print(
child_node,
mcts_obj.Q[child_node],
mcts_obj.visi... |
class DataStructure(object):
def __init__(self):
self.name2id = {}
self.id2item = {}
def add_item(self, item_name, item_id, item):
self.name2id[item_name] = item_id
self.id2item[item_id] = item
def search_by_name(self, target_name):
target_id = self.name2id[target_n... |
# © https://sudipghimire.com.np
# %% [markdown]
"""
# Inheritance
- This concept is exactly similar to biological inheritance where child inherits the feature of parent.
- in inheritance, there exists a parent class and child classes which inherits parent's behaviors.
- The base class will be the parent class and the ... |
class Calendar:
def __init__(self, day, month, year):
print("Clase Base - Calendar")
self.day = day
self.month = month
self.year = year
def __str__(self):
return "{}-{}-{}".format(self.day,
self.month,
se... |
#My favorite song described
#Genre, Artists and Album
Genre = "Bollywood Romance"
Composer = "Amit Trivedi"
Lyricist = "Amitabh Bhattacharya"
Singer_male = "Arijit Singh"
Singer_female = "Nikhita Gandhi"
Album = "Kedarnath"
#YearReleased
YearReleased = 2018
#Duration
DurationInSeconds = 351
print("My favorit... |
#!/bin/python
#If player is X, I'm the first player.
#If player is O, I'm the second player.
player = raw_input()
#Read the board now. The board is a 3x3 array filled with X, O or _.
board = []
for i in xrange(0, 3):
board.append(raw_input())
#Proceed with processing and print 2 integers separated by a single ... |
#kullanıcıdan alınan bir sayının tek mi ya da çift mi olduğunu bulan kodu yazınız
sayi = int(input("Bir Sayı Giriniz : "))
if sayi%2==0:
print(" Sayısı Çift Sayıdır. ",sayi)
else:
print(" Sayısı Tek Sayıdır. ",sayi ) |
A = 1.0
N = 1.0
α = 0.33
β = 0.96
δ = 0.05
def r_to_w(r):
"""
Equilibrium wages associated with a given interest rate r.
"""
return A * (1 - α) * (A * α / (r + δ))**(α / (1 - α))
def rd(K):
"""
Inverse demand curve for capital. The interest rate associated with a
given demand for capital... |
DEFAULT_ENV_NAME = "CartPole-v1"
DEFAULT_ALGORITHM = "random"
DEFAULT_MAX_EPISODES = 1000
DEFAULT_LEARNING_RATE = 0.001
DEFAULT_GAMMA = 0.95
DEFAULT_UPDATE_FREQUENCY = 20
|
def initials(name):
parts = name.split(' ')
letters = ''
for part in parts:
letters += part[0]
return letters |
LISTA = [['add', ['adicionar'], 'added', 'added'], ['arise', ['erguer', 'levantar'], 'arose', 'arisen'],
['awake', ['acordar', 'despertar'], 'awoke', 'awoken'], ['answer', ['responder'], 'answered', 'answered'],
['ask', ['perguntar'], 'asked', 'asked'], ['be', ['ser', 'estar'], 'was-were', '... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.