content stringlengths 7 1.05M |
|---|
def check_difference():
pass
def update_benchmark():
pass
|
async def source(update, context):
source_code = "https://github.com/Open-Source-eUdeC/UdeCursos-bot"
await context.bot.send_message(
chat_id=update.effective_chat.id,
text=(
"*UdeCursos bot v2.0*\n\n"
f"Código fuente: [GitHub]({source_code})"
),
parse_mod... |
# while True:
# # ejecuta esto
# print("Hola")
real = 7
print("Entre un numero entre el 1 y el 10")
guess = int(input())
# =/=
while guess != real:
print("Ese no es el numero")
print("Entre un numero entre el 1 y el 10")
guess = int(input())
# el resto
print("Yay! Lo sacastes!")
|
class Foo:
def bar(self):
return "a"
if __name__ == "__main__":
f = Foo()
b = f.bar()
print(b) |
'''
Speed: 95.97%
Memory: 24.96%
Time complexity: O(n)
Space complexity: O(n)
'''
class Solution(object):
def longestValidParentheses(self, s):
ans=0
stack=[-1]
for i in range(len(s)):
if(s[i]=='('):
stack.append(i)
else:
stack.pop()
... |
def greet():
print("Hi")
def greet_again(message):
print(message)
def greet_again_with_type(message):
print(type(message))
print(message)
greet()
greet_again("Hello Again")
greet_again_with_type("One Last Time")
greet_again_with_type(1234)
# multiple types
def multiple_types(x):
if x < 0:
... |
n = input('Digite algo: ')
print('O tipo primitivo da variável é: ', type(n))
print('O que foi digitado é alfa numérico? ', n.isalnum())
print('O que foi digitado é alfabético? ', n.isalpha())
print('O que foi digitado é um decimal? ', n.isdecimal())
print('O que foi digitado é minúsculo? ', n.islower())
print('O que f... |
# Authentication & API Keys
# Many APIs require an API key. Just as a real-world key allows you to access something, an API key grants you access to a particular API. Moreover, an API key identifies you to the API, which helps the API provider keep track of how their service is used and prevent unauthorized or maliciou... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 18 08:40:11 2020
@author: krishan
"""
def funny_division2(anumber):
try:
if anumber == 13:
raise ValueError("13 is an unlucky number")
return 100 / anumber
except (ZeroDivisionError, TypeError):
return "E... |
# -*- coding:utf-8 -*-
"""
@version: v1.0
@author: xuelong.liu
@license: Apache Licence
@contact: xuelong.liu@yulore.com
@software: PyCharm
@file: base_request_param.py
@time: 12/21/16 6:48 PM
"""
class RequestParam(object):
"""
请求相关
"""
# URL
START_URL = "https://www.hn.10086.cn/service/static... |
class BackupUnit(object):
def __init__(self, name, password=None, email=None):
"""
BackupUnit class initializer.
:param name: A name of that resource (only alphanumeric characters are acceptable)"
:type name: ``str``
:param password: The password associated ... |
class Solution:
def findDuplicate(self, nums: List[int]) -> int:
p1, p2 = nums[0], nums[nums[0]]
while nums[p1] != nums[p2]:
p1 = nums[p1]
p2 = nums[nums[p2]]
p2 = 0
while nums[p1] != nums[p2]:
p1 = nums[p1]
p2 = nums[p2]
return... |
class A:
def a(self):
return 'a'
class B(A, object):
def b(self):
return 'b'
class Inherit(A):
def a(self):
return 'c'
|
"""
A
/ |
B C
'B, C'
"""
class CategoryTree:
def __init__(self):
self.root = {}
self.all_categories = []
def add_category(self, category, parent):
if category in self.all_categories:
raise KeyError(f"{category} exists")
if parent is None:
self.r... |
def sum_of_squares(n):
return sum(i ** 2 for i in range(1, n+1))
def square_of_sum(n):
return sum(range(1, n+1)) ** 2
|
Credits = [
('Bootstrap', 'https://getbootstrap.com', 'The Bootstrap team', 'MIT'),
('Bottle', 'http://bottlepy.org', 'Marcel Hellkamp', 'MIT'),
('Cheroot', 'https://github.com/cherrypy/cheroot', 'CherryPy Team', 'BSD 3-Clause "New" or "Revised" License'),
('Click', 'https://github.com/pallets/click', '... |
def repleace_pattern(t,s,r):
assert len(t) > 0
assert len(s) > 0
assert len(r) > 0
assert len(t) >= len(s)
n = len(t)
m = len(s)
k = len(r)
idx = -1
for i in range(0, n):
if t[i] == s[0]:
pattern = True
for j in range(1,m):
... |
# Copyright 2017 Mycroft AI Inc.
#
# 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 agreed to in writin... |
# 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 isCousins(self, root: TreeNode, x: int, y: int) -> bool:
x_depth = None
x_parent = None... |
#
# Copyright (C) 2009 Mendix. All rights reserved.
#
SUCCESS = 0
# Starting the Mendix Runtime can fail in both a temporary or permanent way.
# Some of the errors can be fixed with some help of the user.
#
# The default m2ee cli program will only handle a few of these cases, by
# providing additional hints or intera... |
#Escreva um programa que leia um valor em metros e o exiba convertido em centimetros e milimetros.
n = float(input('\033[32mDigite o numero:\033[m'))
print('O número digitado é \033[33m{0:.0f}m\033[m.\n'
'Ele apresentado em centimetros fica \033[33m{0:.2f}cm\033[m.\n'
'Apresentado em milímetros fica \033[33... |
def count_words(sentence):
sentence = sentence.lower()
words = {}
shit = ',\n:!&@$%^&._'
for s in shit:
sentence = sentence.replace(s, ' ')
for w in sentence.split():
if w.endswith('\''):
w = w[:-1]
if w.startswith('\''):
w = w[1:]
words... |
ID = {"Worldwide":0,
"AF": 1,
"AL": 2,
"DZ": 3,
"AD": 5,
"AO": 6,
"AI": 7,
"AG": 9,
"AR": 10,
"AM": 11,
"AW": 12,
"AT": 14,
"AZ": 15,
"BS": 16,
"BH": 17,
"BD": 18,
"BB": 19,
"BY": 20,
"BZ": 22,
"BJ": 23,
... |
# RiveScript-Python
#
# This code is released under the MIT License.
# See the "LICENSE" file for more information.
#
# https://www.rivescript.com/
def get_topic_triggers(rs, topic, thats, depth=0, inheritance=0, inherited=False):
"""Recursively scan a topic and return a list of all triggers.
Arguments:
... |
'''
What is a Mother Vertex?
A mother vertex in a graph G = (V,E) is a vertex v such that all other vertices in G can be reached by a path from v.
How to find mother vertex?
Case 1:- Undirected Connected Graph : In this case, all the vertices are mother vertices as we can reach to all the other nodes in the graph... |
# In Search for the Lost Memory [Explorer Thief] (3526)
# To be replaced with GMS's exact dialogue.
# Following dialogue has been edited from DeepL on JMS's dialogue transcript (no KMS footage anywhere):
# https://kaengouraiu2.blog.fc2.com/blog-entry-46.html
recoveredMemory = 7081
darkLord = 1052001
sm.setSpeakerID(... |
class WebException(Exception):
pass
class ParserException(Exception):
"""
解析异常
"""
pass
class ApiException(Exception):
"""
api异常
"""
pass
class WsException(Exception):
"""
轮询异常
"""
pass
class SsoException(Exception):
"""
sso异... |
def f():
print('f from module 2')
if __name__ == '__main__':
print('Module 2') |
def contains_word(first_word, second_word, bibliographic_entry):
contains_first_word = first_word in bibliographic_entry
contains_second_word = second_word in bibliographic_entry
if contains_first_word and contains_second_word:
return 2
elif contains_first_word or contains_second_word:
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
VALID_HISTORY_FIELDS = [
'datetime', 'open', 'close', 'high', 'low', 'total_turnover', 'volume',
'acc_net_value', 'discount_rate', 'unit_net_value',
'limit_up', 'limit_down', 'open_interest', 'basis_spread', 'settlement', 'prev_settlement'
]
VALID_GET_PRICE_FI... |
"""loads the nasm library, used by TF."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
tf_http_archive(
name = "nasm",
urls = [
"https://storage.googleapis.com/mirror.tensorflow.org/www.nasm.us/pub/nasm/releasebuilds/2.13.03/nasm-2.13.03.tar.bz2",
"http://p... |
# unicode digit emojis
# digits from '0' to '9'
zero_digit_code = zd = 48
# excluded digits
excl_digits = [2, 4, 5, 7]
# unicode digit keycap
udkc = '\U0000fe0f\U000020e3'
hours_0_9 = [chr(i) + udkc for i in range(zd, zd + 10)
if i - zd not in excl_digits]
# number '10' emoji
hours_0_9.append('\U0001f51f')
# ... |
n1 = int(input('Digite um valor: '))
n2 = int(input('Digite outro valor: '))
print('A soma é: {}!' .format(n1+n2))
print('A subtração entre {} e {} é {}!' .format(n1, n2, n1-n2))
print('A multiplicação desses valores é {}!' .format(n1 * n2))
print('A divisão entre {} e {} é {:.3}' .format(n1, n2, n1/n2))
print('A divis... |
class Solution:
def __init__(self):
self.res = []
self.path = []
def arr_to_num(self, arr):
s = ""
for x in arr:
s += str(x)
return int(s)
def find_position(self, nums):
for i in range(len(self.res)):
if self.res[i] == nums:
... |
class Solution:
def maximalSquare(self, matrix: List[List[str]]) -> int:
if not matrix: return 0
m, n = len(matrix), len(matrix[0])
dp = [[0]*n for _ in range(m)]
res = 0
for i in range(m):
dp[i][0] = int(matrix[i][0])
for j in range(n):
dp[0][... |
class term(object):
# Dados de cadastro das usinas termeletrica (presentes no TERM.DAT)
Codigo = None
Nome = None
Potencia = None
FCMax = None
TEIF = None
IP = None
GTMin = None
# Dados Adicionais Especificados no arquivo de configuracao termica (CONFT)
Sist = None
Status = ... |
"""
GPA Calculator
"""
# Write a function called "simple_gpa" to find GPA when student enters a letter grade as a string. Assign the result to a variable called "gpa".
"""
Use these conversions:
A+ --> 4.0
A --> 4.0
A- --> 3.7
B+ --> 3.3
B --> 3.0
B- --> 2.7
C+ --> 2.3
C --> 2.0
C- --> 1.7
D+ --> 1.3
D --> 1.0
D- -->... |
# This is a simple program to find the last three digits of 11 raised to any given number.
# The main algorithm that does the work is on line 10
def trim_num(num):
if len(str(num)) > 3: # no need to trim if the number is 3 or less digits long
return str(num)[(len(str(num)) - 3):] # trims the number
ret... |
class KunaError(Exception):
pass
class AuthenticationError(KunaError):
"""Raised when authentication fails."""
pass
class UnauthorizedError(KunaError):
"""Raised when an API call fails as unauthorized (401)."""
pass
|
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
### CONTROLS (non-tunable) ###
# general
TYPE_OF_RUN = test_episodes # train, test, test_episodes, render
NUM_EPISODES_TO_TEST = 1000
MIN_FINAL_REWARD_FOR_SUCCESS = 1.0
LOAD_MODEL_FROM = models/gru_flat_babyai.pth
SAVE_MODELS_TO = None
# wo... |
"""runghc support"""
load(":private/context.bzl", "render_env")
load(":private/packages.bzl", "expose_packages", "pkg_info_to_compile_flags")
load(
":private/path_utils.bzl",
"link_libraries",
"ln",
"target_unique_name",
)
load(
":private/set.bzl",
"set",
)
load(":providers.bzl", "get_ghci_extr... |
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 19 20:00:00 2019
@author: Emilia Chojak
@e-mail: emilia.chojak@gmail.com
"""
tax_dict = {
'Pan troglodytes' : 'Hominoidea', 'Pongo abelii' : 'Hominoidea',
'Hominoidea' : 'Simiiformes', 'Simiiformes' : 'Haplorrhini',
'Tarsius tarsier' : 'Tarsiiformes', 'Haplorrhini' : 'Pr... |
ezan = {
'name': 'ezan',
'age': 18,
'hair': 'brown',
'cool': True ,
}
print(ezan)
class Person(object): #use class to make object
def __init__(
self, name, age ,hair, color, hungry) : #initialize
#first object inside of a class is self
self.name = 'ezan'
self.age = 18
... |
# 62. 不同路径
# 组合数,杨辉三角
yanghui = [[0 for i in range(202)] for j in range(202)]
def comb(n, k):
if yanghui[n][k] == 0:
yanghui[n][k] = (comb(n-1, k-1) + comb(n-1, k))
return yanghui[n][k]
class Solution:
def uniquePaths(self, m: int, n: int) -> int:
for i in range(202):
yanghui... |
# # Simple Tuple
# fruits = ('Apple', 'Orange', 'Mango')
# # Using Constructor
# fruits = tuple(('Apple', 'Orange', 'Mango'))
# # Getting a Single Value
# print(fruits[1])
# Trying to change based on position
# fruits[1] = 'Grape'
# Tuples with one value should have trailing comma
# fruits = ('Apple')
# fruits = ('... |
"""Collections of library function names.
"""
class Library:
"""Base class for a collection of library function names.
"""
@staticmethod
def get(libname, _cache={}):
if libname in _cache:
return _cache[libname]
if libname == 'stdlib':
r = Stdlib()
elif ... |
"""HERE are the base Points for all valid Tonnetze Systems.
A period of all 12 notes divided by mod 3, mod 4 (always stable)
"""
# x = 4, y = 3
NotePointsT345 = {
0: (0, 0),
1: (1, 3),
2: (2, 2),
3: (0, 1),
4: (1, 0),
5: (2, 3),
6: (0, 2),
7: (1, 1),
8: (2, 0),
9: (0, 3),
1... |
class RequirementsNotMetError(Exception):
"""For SQL INSERT, missing table attributes."""
def __init__(self, message):
super().__init__(message)
class AuthenticationError(Exception):
"""Generic authentication error."""
def __init__(self, message):
super().__init__(message)
|
## -*- encoding: utf-8 -*-
"""
This file (./domaines_doctest.sage) was *autogenerated* from ./domaines.tex,
with sagetex.sty version 2011/05/27 v2.3.1.
It contains the contents of all the sageexample environments from this file.
You should be able to doctest this file with:
sage -t ./domaines_doctest.sage
It is always ... |
description = 'Mezei spin flipper using TTI power supply'
group = 'optional'
tango_base = 'tango://miractrl.mira.frm2:10000/mira/'
devices = dict(
dct1 = device('nicos.devices.entangle.PowerSupply',
description = 'current in first channel of supply (flipper current)',
tangodevice = tango_base + 't... |
class Stack:
def __init__(self):
self.stack = []
self.minMaxStack = []
# O(1) time | O(1) space
def peek(self):
if (len(self.stack)):
return self.stack[-1]
return None
# O(1) time | O(1) space
def pop(self):
if (len(self.stack)):
sel... |
BIG_CONSTANT = "YES"
def group_by(xs, grouper):
groups = {}
for x in xs:
group = grouper(x)
if group not in groups:
groups[group] = []
groups[group].append(x)
return groups
print(group_by([1, 2, 3, 4, 5, 6], lambda x: "even" if x % 2 == 0 else "odd"))
|
NOTES = {
'notes': [
{'date': '2014-05-22T00:00:00Z', 'note': 'Second Note'},
{'date': '2014-05-21T14:02:45Z', 'note': 'First Note'}
]
}
SUBJECT = {
"subject": ['HB1-3840', 'H']
}
OWNER = {
"owner": "Owner"
}
EDITORIAL = {
"editor_group": "editorgroup",
"editor": "associate"
}... |
def fatorial(n):
f = 1
while n != 0:
f *= n
n -= 1
return f
def dobro(n):
n *= 2
return n
def triplo(n):
n *= 3
return n
|
#!/usr/bin/python3
# If F(a) is any function that can be defined as composition of bitwise XORs, ANDs and left shifts
# Then the dynac system x_(n+1) = F(x_n) is Turing complete
# Proof by simulation (rule110)
a = 1
while a:
print(bin(a))
a = a ^ (a << 1) ^ (a & (a << 1)) ^ (a & (a << 1) & (a << 2))
|
__author__ = "Daniel Winklehner"
__doc__ = "Find out if a number is a power of two"
def power_of_two(number):
"""
Function that checks if the input value (data) is a power of 2
(i.e. 2, 4, 8, 16, 32, ...)
"""
res = 0
while res == 0:
res = number % 2
number /= 2.0
prin... |
class Libro:
def __init__(self, titulo, autor):
"""..."""
self.titulo = titulo
self.autor = autor
def obtener_titulo(self):
"""..."""
return str(self.titulo)
def obtener_autor(self):
"""..."""
return str(self.autor)
class Biblioteca:
def... |
load("//tools/bzl:maven_jar.bzl", "maven_jar")
def external_plugin_deps(omit_commons_codec = True):
JACKSON_VERS = "2.10.2"
maven_jar(
name = "scribejava-core",
artifact = "com.github.scribejava:scribejava-core:6.9.0",
sha1 = "ed761f450d8382f75787e8fee9ae52e7ec768747",
)
maven_j... |
# Este programa muestra la suma de dos variables, de tipo int y float
print("Este programa muestra la suma de dos variables, de tipo int y float")
print("También muestra que la variable que realiza la operación es de tipo float")
numero1 = 7
numero2 = 3.1416
sumadeambos = numero1 + numero2
print("El resultado d... |
def load(h):
return ({'abbr': 0, 'code': 0, 'title': 'There is no appended list'},
{'abbr': 1,
'code': 1,
'title': 'Numbers define number of points corresponding to full coordinate '
'circles (i.e. parallels), coordinate values on each circle are '
... |
class InvalidSideException(Exception):
"""Invalid side"""
class NotSupportedException(Exception):
"""Not supported by dummy wallet"""
class InvalidProductException(Exception):
"""Invalid product type"""
class OutOfBoundsException(Exception):
"""Attempt to access memory outside buffer bounds"""
|
hensu_int = 17 #数字
hensu_float = 1.7 #小数点(浮動小数点)
hensu_str = "HelloWorld" #文字列
hensu_bool = True #真偽
hensu_list = [] #リスト
hensu_tuple = () #タプル
hensu_dict = {} #辞書(ディクト)型
print(type(hensu_int))
print(type(hensu_float))
print(type(hensu_str))
print(type(hensu_bool))
print(type(hensu_list))
print(type(hensu_tuple))
prin... |
# Desarrolle un un programa que reciba la fecha de nacimiento
# de una persona, y como salida, indique el nombre del signo del
# zodiaco correspondiente, ademas de su edad
def zodiaco(DD, MM):
if (((DD >= 22) and (MM == 11)) or ((DD <=21) and (MM == 12))):
return("Sagitario")
if (((DD >= 22) and (MM ==... |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode:
seen = set()
curr = headA
while curr:
seen.add(curr)
... |
"""
Insertion Sort
Approach: Loop
Complexity: O(n2)
"""
def sort_insertion(input_arr):
print("""""""""""""""""""""""""")
print("input " + str(input_arr))
print("""""""""""""""""""""""""")
ln = len(input_arr)
i = 1 # Assuming first element is sorted
while i < ln: # n times
c = inpu... |
""" fixtures that return an sql statement with a list of values to be inserted."""
def load_language():
""" return the sql and values of the insert queuery."""
sql = """
INSERT INTO Spanglish_Test.Language
(
`name`, `iso-639-1`
)
VALUES (%s, %s)
... |
# Copyright 2020 Plezentek, Inc. All rights reserved
#
# 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... |
root = {
"general" : {
"display_viewer" : False,
#The visible GPUS will be restricted to the numbers listed here. The pytorch (cuda:0) numeration will start at 0
#This is a trick to get everything onto the wanted gpus because just setting cuda:4 in the function calls will
#not work... |
i=input("Enter a string: ")
list = i.split()
list.sort()
for i in list:
print(i,end=' ')
|
def test_one_plus_one_is_two():
assert 1 + 1 == 2 #o assert espera que algo seja verdadeiro, se for falso o teste quebrou
def test_negative_1_plus_1_is_3():
assert 1 + 1 == 3
|
values = []
for i in range(9):
values.append(int(input('')))
max_value = 0
location = 0
for i in range(9):
if values[i] > max_value:
max_value = values[i]
location = i+1
print(max_value)
print(location) |
"""Test whether putative triangles, specified as triples of side lengths,
in fact are possible."""
def load_triangles(filename):
"""Load triangles from filename."""
triangles = []
with open(filename) as f:
for line in f:
if line.strip():
triangles.append(tuple([int(side) ... |
"""{{ cookiecutter.project_name }} - {{ cookiecutter.project_short_description }}"""
__version__ = "{{ cookiecutter.project_version }}"
__author__ = """{{ cookiecutter.author_name }}"""
__email__ = "{{ cookiecutter.author_email }}"
prog_name = "{{ cookiecutter.project_hyphen }}"
|
class BitcoinGoldMainNet(object):
"""Bitcoin Gold MainNet version bytes. """
NAME = "Bitcoin Gold Main Net"
COIN = "BTG"
SCRIPT_ADDRESS = 0x17 # int(0x17) = 23
PUBKEY_ADDRESS = 0x26 # int(0x26) = 38 # Used to create payment addresses
SECRET_KEY = 0x80 # int(0x80) = 128 # Used for WIF fo... |
# OpenWeatherMap API Key
weather_api_key = "MyOpenWeatherMapAPIKey"
# Google API Key
g_key = "MyGoogleKey" |
def attack():
pass
def defend():
pass
def pass_turn():
pass
def use_ability_One(kit):
pass
def use_ability_Two(kit):
pass
def end_Of_Battle():
pass |
ano = int(input('Digite o ano: '))
if (ano%4) == 0:
print ('Ele é bissexto')
else:
print ('Ele não é bissexto') |
mail_settings = {
"MAIL_SERVER": 'smtp.gmail.com',
"MAIL_PORT": 465,
"MAIL_USE_TLS": False,
"MAIL_USE_SSL": True,
"MAIL_USERNAME": 'c003.teste.jp@gmail.com',
"MAIL_PASSWORD": 'C003.teste'
} |
# {team} -> Name of team
# {name} -> Name of person who supports team
teamMatchStarted: list[str] = [
"{team} are shit",
"{team} cunts",
"Dirty {team}",
"Dirty {team}, dirty {name}",
]
drawing: list[str] = [
"{team} level, this is a shit match",
"Boring old {team}",
"Happy with how it's go... |
class Solution:
def maxArea(self, height) -> int:
left=0
right=len(height)-1
res=min(height[left],height[right])*(right-left)
while right>left:
res=max(res,(right-left)*min(height[right],height[left]))
if height[left]<height[right]:
left+=1
... |
# Copyright (c) 2021, Omid Erfanmanesh, All rights reserved.
class RuntimeMode:
TRAIN = 0
TUNING = 1
CROSS_VAL = 2
FEATURE_IMPORTANCE = 3
|
#
# Example file for HelloWorld
#
def main():
print("Hello World")
name = input("What is your name? ")
print("Nice to meet you,", name)
if __name__ == "__main__":
main()
|
"""Node class module for Binary Tree."""
class Node(object):
"""The Node class."""
def __init__(self, value):
"""Initialization of node object."""
self.value = value
self.left = None
self.right = None
def __str__(self):
"""Return a string representation of the nod... |
class DispatchConfig:
def __init__(self, raw_config):
self.registered_commands = {}
for package in raw_config["handlers"]:
for command in package["commands"]:
self.registered_commands[command] = {
"class": package["class"],
"fullpat... |
"""
This program visualizes nested for loops by printing number 0 through 3
and then 0 through 3 for the nested loop.
"""
for i in range(4):
print("Outer for loop: " + str(i))
for j in range(4):
print(" Inner for loop: " + str(j)) |
"""Queue implementation using circularly linked list for storage."""
class CircularQueue:
"""Queue implementation using circularly linked list for storage."""
class _Node:
"""Lightweight, nonpublic class for storing a singly linked node."""
__slots__ = '_element', '_next'
def __init__... |
"set operations for multiple sequences"
def intersect(*args):
res = []
for x in args[0]: # scan the first list
for other in args[1:]: # for all other arguments
if x not in other: break # this item in each one?
else:
res.append(x) #... |
msg_dict = {
'resource_not_found':
'The resource you specified was not found',
'invalid_gender':
"The gender you specified is invalid!!",
'many_invalid_fields':
'Some errors occured while validating some fields. Please check and try again',
'unique':
'The {} you inputted already exists',... |
'''
- Leetcode problem: 23
- Difficulty: Hard
- Brief problem description:
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
Example:
Input:
[
1->4->5,
1->3->4,
2->6
]
Output: 1->1->2->3->4->4->5->6
- Solution Summary:
- Used Resources:
--- Bo Zhou
'''
# ... |
# Written by Ivan Sapozhkov and Denis Chagin <denis.chagin@emlid.com>
#
# Copyright (c) 2016, Emlid Limited
# All rights reserved.
#
# Redistribution and use in source and binary forms,
# with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code ... |
"""
Check for Office file types
ViperMonkey is a specialized engine to parse, analyze and interpret Microsoft
VBA macros (Visual Basic for Applications), mainly for malware analysis.
Author: Philippe Lagadec - http://www.decalage.info
License: BSD, see source code or documentation
Project Repository:
https://github.... |
# Given a singly linked list, determine if it is a palindrome.
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def isPalindrome(self, head: ListNode) -> bool:
fast = slow = head
# find t... |
"""
Rocky is a CLI based provisioning and management tool for CloudCIX Cloud software.
Rocky is designed to operate in an out of band (OOB) network, serarated from other CloudCIX networks.
Rocky's purpose is to facilitate monitoring, testing, debug and recovery
"""
__version__ = '0.3.5'
|
with open("inputday3.txt") as f:
data = [x for x in f.read().split()]
gamma = ""
epsilon = ""
for b in range(0, len(data[0])):
one = 0
zero = 0
for c in range(0, len(data)):
if data[c][b] == '0':
zero += 1
else:
one += 1
if zero > one:
... |
power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate... |
"""Fizzbuzz for loop variant 3"""
for x in range(1, 101):
OUTPUT = ""
if x % 3 == 0:
OUTPUT += "Fizz"
if x % 5 == 0:
OUTPUT += "Buzz"
print(OUTPUT or x)
|
# type: ignore
__all__ = [
"readDatastoreImage",
"datastore",
]
def readDatastoreImage(*args):
raise NotImplementedError("readDatastoreImage")
def datastore(*args):
raise NotImplementedError("datastore")
|
"""
Given scores of N athletes, find their relative ranks and the people with the top
three highest scores, who will be awarded medals: "Gold Medal", "Silver Medal" and
"Bronze Medal".
Example 1:
Input: [5, 4, 3, 2, 1]
Output: ["Gold Medal", "Silver Medal", "Bronze Medal", "4", "5"]
Explanation: The fir... |
"""!
@brief Collection of examples devoted to containers.
@authors Andrei Novikov (pyclustering@yandex.ru)
@date 2014-2020
@copyright BSD-3-Clause
""" |
# THIS FILE IS GENERATED FROM SCIPY SETUP.PY
short_version = '1.5.4'
version = '1.5.4'
full_version = '1.5.4'
git_revision = '19acfed431060aafaa963f7e530c95e70cd4b85c'
release = True
if not release:
version = full_version
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.