content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
data1 = {
'board': {
'snakes': [
{'body': [
{'x': 5, 'y': 5},
{'x': 5, 'y': 6},
{'x': 4, 'y': 6},
{'x': 3, 'y': 6},
{'x': 3, 'y': 5},
{'x': 3, 'y': 4},
{'x': 4, 'y': 4},
... | data1 = {'board': {'snakes': [{'body': [{'x': 5, 'y': 5}, {'x': 5, 'y': 6}, {'x': 4, 'y': 6}, {'x': 3, 'y': 6}, {'x': 3, 'y': 5}, {'x': 3, 'y': 4}, {'x': 4, 'y': 4}, {'x': 5, 'y': 4}, {'x': 6, 'y': 4}, {'x': 7, 'y': 4}], 'health': 100, 'id': 'testsnake', 'length': 10, 'name': 'testsnake', 'object': 'snake'}], 'height':... |
# python 3.6
def camel2pothole(string):
rst = "".join(["_" + s.lower() if s == s.upper() or s.isdigit() else s for s in string])
return rst
print(camel2pothole("codingDojang"))
print(camel2pothole("numGoat30")) | def camel2pothole(string):
rst = ''.join(['_' + s.lower() if s == s.upper() or s.isdigit() else s for s in string])
return rst
print(camel2pothole('codingDojang'))
print(camel2pothole('numGoat30')) |
browsers = [
{
'id': 'chrome',
'name': 'Chrome'
},
{
'id': 'chromium',
'name': 'Chromium'
},
{
'id': 'firefox',
'name': 'Firefox'
},
{
'id': 'safari',
'name': 'Safari'
},
{
'id': 'msie',
'name': 'Internet Explorer'
},
{
'id': 'mse... | browsers = [{'id': 'chrome', 'name': 'Chrome'}, {'id': 'chromium', 'name': 'Chromium'}, {'id': 'firefox', 'name': 'Firefox'}, {'id': 'safari', 'name': 'Safari'}, {'id': 'msie', 'name': 'Internet Explorer'}, {'id': 'msedge', 'name': 'Microsoft Edge'}, {'id': 'opera', 'name': 'Opera'}, {'id': 'yandexbrowser', 'name': 'Ya... |
N, K, S = [int(n) for n in input().split()]
ans = []
for i in range(N-K):
ans.append(S+1 if S<10**9 else 1)
for j in range(K):
ans.append(S)
print(" ".join([str(n) for n in ans]))
| (n, k, s) = [int(n) for n in input().split()]
ans = []
for i in range(N - K):
ans.append(S + 1 if S < 10 ** 9 else 1)
for j in range(K):
ans.append(S)
print(' '.join([str(n) for n in ans])) |
#Binary Tree Level Order BFS&DFS
class Solution(object):
def levelOrder(self, root):
if not root:
return []
result = []
queue = collections.deque()
queue.append(root)
#visited = set(root)
while queue:
level_size = len(queue)
cur... | class Solution(object):
def level_order(self, root):
if not root:
return []
result = []
queue = collections.deque()
queue.append(root)
while queue:
level_size = len(queue)
current_level = []
for _ in range(level_size):
... |
# Python Learning Lessons
some_var = int(input("Give me a number, any number: "))
if some_var > 10:
print("The number is bigger than tenerooonie.")
elif some_var < 10:
print("The numbah is smaller than 10.")
elif some_var == 10:
("YO. The numbah is TEN!")
some_name = str(input("Hey, what's your name... | some_var = int(input('Give me a number, any number: '))
if some_var > 10:
print('The number is bigger than tenerooonie.')
elif some_var < 10:
print('The numbah is smaller than 10.')
elif some_var == 10:
'YO. The numbah is TEN!'
some_name = str(input("Hey, what's your name, kid: "))
print('Pleasure to meet y... |
class SubClass():
def __init__(self):
self.message = 'init - SubFile - mtulio.example.sub Class'
def returnMessage(self):
return self.message
def subMessageHelloWorld():
return 'init - SubFile - mtulio.example.sub Method'
| class Subclass:
def __init__(self):
self.message = 'init - SubFile - mtulio.example.sub Class'
def return_message(self):
return self.message
def sub_message_hello_world():
return 'init - SubFile - mtulio.example.sub Method' |
"""
Discussion:
To better appreciate what is happening here, you should go back to the previous
interactive demo. Set the w = 5 and I_ext = 0.5.
You will find that there are three fixed points of the system for these values of
w and I_ext. Now, choose the initial value in this demo and see in which direction
the syst... | """
Discussion:
To better appreciate what is happening here, you should go back to the previous
interactive demo. Set the w = 5 and I_ext = 0.5.
You will find that there are three fixed points of the system for these values of
w and I_ext. Now, choose the initial value in this demo and see in which direction
the syst... |
# coding=utf-8
# *** WARNING: this file was generated by crd2pulumi. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
SNAKE_TO_CAMEL_CASE_TABLE = {
"api_version": "apiVersion",
"attacher_node_selector": "attacherNodeSelector",
"driver_registrar": "driverRegistrar",
"... | snake_to_camel_case_table = {'api_version': 'apiVersion', 'attacher_node_selector': 'attacherNodeSelector', 'driver_registrar': 'driverRegistrar', 'gui_host': 'guiHost', 'gui_port': 'guiPort', 'image_pull_secrets': 'imagePullSecrets', 'inode_limit': 'inodeLimit', 'k8s_node': 'k8sNode', 'node_mapping': 'nodeMapping', 'p... |
STATS = [
{
"num_node_expansions": NaN,
"plan_length": 35,
"search_time": 7.93,
"total_time": 7.93
},
{
"num_node_expansions": NaN,
"plan_length": 34,
"search_time": 9.72,
"total_time": 9.72
},
{
"num_node_expansions": NaN,
... | stats = [{'num_node_expansions': NaN, 'plan_length': 35, 'search_time': 7.93, 'total_time': 7.93}, {'num_node_expansions': NaN, 'plan_length': 34, 'search_time': 9.72, 'total_time': 9.72}, {'num_node_expansions': NaN, 'plan_length': 40, 'search_time': 15.54, 'total_time': 15.54}, {'num_node_expansions': NaN, 'plan_leng... |
"""
Build a Triangle
"""
# Use a while loop to print a 5-level triangle of stars that looks like this:
"""
*
**
***
****
*****
"""
| """
Build a Triangle
"""
'\n*\n**\n***\n****\n*****\n' |
def a():
pass
# This is commented
# out
| def a():
pass |
"""
Main entrypoint
---------------
Just-in-time injections awaitable from asyncio coroutines
Author: Chris Lee
Email: chrisklee93@gmail.com
"""
def main():
pass
if __name__ == "__main__":
main()
| """
Main entrypoint
---------------
Just-in-time injections awaitable from asyncio coroutines
Author: Chris Lee
Email: chrisklee93@gmail.com
"""
def main():
pass
if __name__ == '__main__':
main() |
def makeArrayConsecutive2(statues):
'''Ratiorg got statues of different sizes as a present from CodeMaster
for his birthday, each statue having an non-negative integer size.
Since he likes to make things perfect, he wants to arrange them from
smallest to largest so that each statue will be ... | def make_array_consecutive2(statues):
"""Ratiorg got statues of different sizes as a present from CodeMaster
for his birthday, each statue having an non-negative integer size.
Since he likes to make things perfect, he wants to arrange them from
smallest to largest so that each statue will b... |
def is_list(v):
return isinstance(v, list)
def is_list_of_type(v, t):
return is_list(v) and all(isinstance(e, t) for e in v)
def flatten_indices(indices):
# indices could be nested nested list, we convert them to nested list
# if indices is not a list, then there is something wrong
if not is_list(indi... | def is_list(v):
return isinstance(v, list)
def is_list_of_type(v, t):
return is_list(v) and all((isinstance(e, t) for e in v))
def flatten_indices(indices):
if not is_list(indices):
raise value_error('indices is not a list')
if is_list_of_type(indices, int):
return indices
flat_ind... |
s1 = "HELLO BEGINNERS"
print(s1.casefold()) # -- CF1
s2 = "Hello Beginners"
print(s2.casefold()) # -- CF2
if s1.casefold() == s2.casefold(): # -- CF3
print("Both the strings are same after conversion")
else:
print("Both the strings are different after conversion ")
| s1 = 'HELLO BEGINNERS'
print(s1.casefold())
s2 = 'Hello Beginners'
print(s2.casefold())
if s1.casefold() == s2.casefold():
print('Both the strings are same after conversion')
else:
print('Both the strings are different after conversion ') |
n = list(map(int, input("[>] Enter numbers: ").split()))
n.sort()
for i in range(3):
for j in range(3):
print(f"{n[i]} + {n[j]} = {n[i] + n[j]}", end="\t")
print()
| n = list(map(int, input('[>] Enter numbers: ').split()))
n.sort()
for i in range(3):
for j in range(3):
print(f'{n[i]} + {n[j]} = {n[i] + n[j]}', end='\t')
print() |
class Solution:
def sortColors(self, nums: List[int]) -> None:
# If 2, put it at the tail
# if 0, put it at the head and move idx to next
# If 1, move idx to next
idx = 0
for _ in range(len(nums)):
if nums[idx] == 2:
nums.append(nums.pop(i... | class Solution:
def sort_colors(self, nums: List[int]) -> None:
idx = 0
for _ in range(len(nums)):
if nums[idx] == 2:
nums.append(nums.pop(idx))
continue
elif nums[idx] == 0:
nums.insert(0, nums.pop(idx))
idx += 1 |
{
'targets': [
{
'conditions': [
[ 'OS != "linux"', {
'target_name': 'procps_only_supported_on_linux',
} ],
[ 'OS == "linux"', {
'target_name': 'procps',
'sources': [
'src/procps.cc'
, 'src/proc.cc'
, 'src/diskstat... | {'targets': [{'conditions': [['OS != "linux"', {'target_name': 'procps_only_supported_on_linux'}], ['OS == "linux"', {'target_name': 'procps', 'sources': ['src/procps.cc', 'src/proc.cc', 'src/diskstat.cc', 'src/partitionstat.cc', 'src/slabcache.cc', 'deps/procps/proc/alloc.c', 'deps/procps/proc/devname.c', 'deps/procps... |
#!/usr/bin/env python3
def read_value():
"""Reads a single line as an integer."""
return int(input())
def read_row(width):
"""Reads one row of integers interpreted as booleans."""
row = [int(field) != 0 for field in input().split()]
if len(row) != width:
raise ValueError('wrong row width... | def read_value():
"""Reads a single line as an integer."""
return int(input())
def read_row(width):
"""Reads one row of integers interpreted as booleans."""
row = [int(field) != 0 for field in input().split()]
if len(row) != width:
raise value_error('wrong row width')
return row
def re... |
ROMAN = 'IVXLCDM'
def get_list_from_number(number):
return [int(num) for num in str(number)]
def get_roman_from_base(base_indexes, magnitude):
roman = ""
for i in base_indexes:
roman += ROMAN[i + magnitude*2]
return roman
def convert_number_to_base_indexes(number):
# Convert a number to a... | roman = 'IVXLCDM'
def get_list_from_number(number):
return [int(num) for num in str(number)]
def get_roman_from_base(base_indexes, magnitude):
roman = ''
for i in base_indexes:
roman += ROMAN[i + magnitude * 2]
return roman
def convert_number_to_base_indexes(number):
base_indexes = ['', '... |
# SPDX-FileCopyrightText: 2020 - Sebastian Ritter <bastie@users.noreply.github.com>
# SPDX-License-Identifier: Apache-2.0
'''
## *J*ust *a* *v*ampire *A*PI ##
As same as bloodhound let us reimplement the Java API.
This is similar to long time ago
[JavAPI](https://github.com/RealBastie/JavApi) project.
###... | """
## *J*ust *a* *v*ampire *A*PI ##
As same as bloodhound let us reimplement the Java API.
This is similar to long time ago
[JavAPI](https://github.com/RealBastie/JavApi) project.
### The Idea ###
Too many good programming languages are looking for developers hype.
Maybe You believe to coding in all i... |
class Meal:
def __init__(self,id,name,photo_url,details,price):
self.id = id
self.name = name
self.photo_url = photo_url
self.details = details
self.price = price
meal_list = []
orders_list = []
class Customer:
def get_all(self):
return meal_list
def get_me... | class Meal:
def __init__(self, id, name, photo_url, details, price):
self.id = id
self.name = name
self.photo_url = photo_url
self.details = details
self.price = price
meal_list = []
orders_list = []
class Customer:
def get_all(self):
return meal_list
def ... |
self.description = "Sysupgrade with a sync package having higher epoch"
sp = pmpkg("dummy", "1:1.0-1")
self.addpkg2db("sync", sp)
lp = pmpkg("dummy", "1.1-1")
self.addpkg2db("local", lp)
self.args = "-Su"
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_VERSION=dummy|1:1.0-1")
| self.description = 'Sysupgrade with a sync package having higher epoch'
sp = pmpkg('dummy', '1:1.0-1')
self.addpkg2db('sync', sp)
lp = pmpkg('dummy', '1.1-1')
self.addpkg2db('local', lp)
self.args = '-Su'
self.addrule('PACMAN_RETCODE=0')
self.addrule('PKG_VERSION=dummy|1:1.0-1') |
attacks_listing = {}
listing_by_name = {}
def register(attack_type):
if attack_type.base_attack:
if attack_type.base_attack in attacks_listing:
raise Exception("Attack already registered for this base_object_type.")
elif attack_type.name in listing_by_name:
raise Exception(... | attacks_listing = {}
listing_by_name = {}
def register(attack_type):
if attack_type.base_attack:
if attack_type.base_attack in attacks_listing:
raise exception('Attack already registered for this base_object_type.')
elif attack_type.name in listing_by_name:
raise exception('... |
# MIT License
#
# Copyright (c) 2019 Eduardo E. Betanzos Morales
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy,... | class Module:
def __init__(self, name: str, exportsPackages=None, requiresModules=None):
self.__name = name
self.__exports_packages = exportsPackages
self.__requires_modules = requiresModules
@classmethod
def from_json(cls, data):
return cls(**data)
def get_name(self):... |
# Copyright 2014 PDFium 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': 'bigint',
'type': 'static_library',
'sources': [
'bigint/BigInteger.hh',
'bigint/BigInteger... | {'targets': [{'target_name': 'bigint', 'type': 'static_library', 'sources': ['bigint/BigInteger.hh', 'bigint/BigIntegerLibrary.hh', 'bigint/BigIntegerUtils.hh', 'bigint/BigUnsigned.hh', 'bigint/NumberlikeArray.hh', 'bigint/BigUnsignedInABase.hh', 'bigint/BigInteger.cc', 'bigint/BigIntegerUtils.cc', 'bigint/BigUnsigned.... |
CERTIFICATION_SERVICES_TABLE_ID = 'cas'
INTERMEDIATE_CA_TAB_XPATH = '//a[@href="#intermediate_cas_tab"]'
INTERMEDIATE_CA_ADD_BTN_ID = 'intermediate_ca_add'
INTERMEDIATE_CA_CERT_UPLOAD_INPUT_ID = 'ca_cert_file'
INTERMEDIATE_CA_OCSP_TAB_XPATH = '//a[@href="#intermediate_ca_ocsp_responders_tab"]'
INTERMEDIATE_CA_OCSP... | certification_services_table_id = 'cas'
intermediate_ca_tab_xpath = '//a[@href="#intermediate_cas_tab"]'
intermediate_ca_add_btn_id = 'intermediate_ca_add'
intermediate_ca_cert_upload_input_id = 'ca_cert_file'
intermediate_ca_ocsp_tab_xpath = '//a[@href="#intermediate_ca_ocsp_responders_tab"]'
intermediate_ca_ocsp_add_... |
# coding=utf-8
"""
This package provides a custom session for TheTVDB.
"""
| """
This package provides a custom session for TheTVDB.
""" |
#!/usr/bin/env python3
def max_profit_with_k_transactions(prices, k):
pass
print(max_profit_with_k_transactions([5, 11, 3, 50, 60, 90], 2))
| def max_profit_with_k_transactions(prices, k):
pass
print(max_profit_with_k_transactions([5, 11, 3, 50, 60, 90], 2)) |
class Solution:
def findLUSlength(self, words):
def isSubsequence(s, t):
t = iter(t)
return all(c in t for c in s)
words.sort(key = lambda x:-len(x))
for i, word in enumerate(words):
if all(not isSubsequence(word, words[j]) for j in range(len(words)) if ... | class Solution:
def find_lu_slength(self, words):
def is_subsequence(s, t):
t = iter(t)
return all((c in t for c in s))
words.sort(key=lambda x: -len(x))
for (i, word) in enumerate(words):
if all((not is_subsequence(word, words[j]) for j in range(len(wor... |
class Query:
def __init__(self, the_query, filename=None):
self.data = None
self.the_query = the_query
def set_data(self, data):
self.data = data
def __repr__(self):
return self.the_query
class LocalMP3Query(Query):
def __init__(self, filename, url, author_name):
... | class Query:
def __init__(self, the_query, filename=None):
self.data = None
self.the_query = the_query
def set_data(self, data):
self.data = data
def __repr__(self):
return self.the_query
class Localmp3Query(Query):
def __init__(self, filename, url, author_name):
... |
class Rect:
def __init__(self, id: int, x: int, y: int, w: int, h: int):
self.id = id
self.pos = (x,y)
self.size = (w,h)
def getX(self):
return self.pos[0]
def getY(self):
return self.pos[1]
def getEndX(self):
return self.getX() + self.getW()
def getEn... | class Rect:
def __init__(self, id: int, x: int, y: int, w: int, h: int):
self.id = id
self.pos = (x, y)
self.size = (w, h)
def get_x(self):
return self.pos[0]
def get_y(self):
return self.pos[1]
def get_end_x(self):
return self.getX() + self.getW()
... |
# Databricks notebook source
# MAGIC %run /Shared/churn-model/utils
# COMMAND ----------
seed = 2022
target = 'Churn'
drop_columns = [target, 'CodigoCliente']
# Get the Train Dataset
dataset = get_dataset('/dbfs/Dataset/Customer')
# Preprocessing Features
dataset, numeric_columns = preprocessing(dataset)
# Split ... | seed = 2022
target = 'Churn'
drop_columns = [target, 'CodigoCliente']
dataset = get_dataset('/dbfs/Dataset/Customer')
(dataset, numeric_columns) = preprocessing(dataset)
(train_dataset, test_dataset) = split_dataset(dataset, seed)
params = {'early_stopping_rounds': 50, 'learning_rate': 0.226, 'max_depth': 64, 'maximize... |
#
# @lc app=leetcode.cn id=747 lang=python3
#
# [747] min-cost-climbing-stairs
#
None
# @lc code=end | None |
"""
The difference between: "==" and "is" operators
This can be a bit confusing!!
Note that "==" operator distinguishes whether
two operands have the same value and that
"is" operator distinguishes whether two operands
refer to the same object!
"""
a = [1, 2, 3]
b = [1, 2, 3]
# we have two lists that have the same v... | """
The difference between: "==" and "is" operators
This can be a bit confusing!!
Note that "==" operator distinguishes whether
two operands have the same value and that
"is" operator distinguishes whether two operands
refer to the same object!
"""
a = [1, 2, 3]
b = [1, 2, 3]
print(f'"a is b" is {a is b}')
print(f'"a... |
"""Perform DOI activation task."""
class HSTaskRouter(object):
"""Perform DOI activation task."""
def route_for_task(self, task, args=None, kwargs=None):
"""Return exchange, exchange_type, and routing_key."""
if task == 'hs_core.tasks.check_doi_activation':
return {
... | """Perform DOI activation task."""
class Hstaskrouter(object):
"""Perform DOI activation task."""
def route_for_task(self, task, args=None, kwargs=None):
"""Return exchange, exchange_type, and routing_key."""
if task == 'hs_core.tasks.check_doi_activation':
return {'exchange': 'def... |
class Note:
def __init__(self, number=0, name='', alt_name='', frequency=0, velocity=1):
self.number = number
self.name = name
self.alt_name = alt_name
self.frequency = frequency
self.velocity = velocity
| class Note:
def __init__(self, number=0, name='', alt_name='', frequency=0, velocity=1):
self.number = number
self.name = name
self.alt_name = alt_name
self.frequency = frequency
self.velocity = velocity |
#!/usr/bin/env python
# Copyright (c) 2015 Nelson Tran
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, ... | mouse_cmd = 224
mouse_calibrate = 225
mouse_press = 226
mouse_release = 227
mouse_click = 228
mouse_fast_click = 229
mouse_move = 230
mouse_bezier = 231
mouse_left = 234
mouse_right = 235
mouse_middle = 236
mouse_buttons = [MOUSE_LEFT, MOUSE_MIDDLE, MOUSE_RIGHT]
keyboard_cmd = 240
keyboard_press = 241
keyboard_release ... |
def minion_game(string):
# your code goes here
vowels = ['A', 'E', 'I', 'O', 'U']
kevin = 0
stuart = 0
for i in range(len(string)):
if s[i] in vowels:
kevin = kevin + (len(s)-i)
else:
stuart = stuart + (len(s)-i)
if stuart > kevin:
... | def minion_game(string):
vowels = ['A', 'E', 'I', 'O', 'U']
kevin = 0
stuart = 0
for i in range(len(string)):
if s[i] in vowels:
kevin = kevin + (len(s) - i)
else:
stuart = stuart + (len(s) - i)
if stuart > kevin:
print('Stuart ' + str(stuart))
eli... |
# https://www.hackerrank.com/challenges/find-second-maximum-number-in-a-list
N = int(input())
line_of_numbers = input().split(' ')
# Extract numbers from input line and add them to list
A = []
for i in range(N):
A.append(int(line_of_numbers[i]))
# Sort list and get largest value from it
A.sort()
max_number =... | n = int(input())
line_of_numbers = input().split(' ')
a = []
for i in range(N):
A.append(int(line_of_numbers[i]))
A.sort()
max_number = A[-1]
while A[-1] == max_number:
A.pop()
print(A[-1]) |
# The kth Factor of n
'''
Given two positive integers n and k.
A factor of an integer n is defined as an integer i where n % i == 0.
Consider a list of all factors of n sorted in ascending order, return the kth factor in this list or return -1 if n has less than k factors.
Example 1:
Input: n = 12, k = 3
Output... | """
Given two positive integers n and k.
A factor of an integer n is defined as an integer i where n % i == 0.
Consider a list of all factors of n sorted in ascending order, return the kth factor in this list or return -1 if n has less than k factors.
Example 1:
Input: n = 12, k = 3
Output: 3
Explanation: Factor... |
LOGIN_REQUIRED = 'Es Necesario iniciar Sesion!'
USER_CREATED = 'Usuario Creado Exitosamente!'
LOGOUT = 'Cerraste Sesion!'
ERRO_USER_PASSWORD = 'Usuario o Contrasena Invalidos!'
LOGIN = 'Usuario Autenticado Exitosamente!'
TASK_CREATED = 'Tarea creada Exitosamente!'
TASK_UPDATED = 'Tarea Actualizada!'
TASK_DELETE ... | login_required = 'Es Necesario iniciar Sesion!'
user_created = 'Usuario Creado Exitosamente!'
logout = 'Cerraste Sesion!'
erro_user_password = 'Usuario o Contrasena Invalidos!'
login = 'Usuario Autenticado Exitosamente!'
task_created = 'Tarea creada Exitosamente!'
task_updated = 'Tarea Actualizada!'
task_delete = 'Tare... |
def left_join(d1, d2):
results = []
for key in d1:
if key in d2:
results.append([key, d1[key], d2[key]])
else:
results.append([key, d1[key], None])
return results | def left_join(d1, d2):
results = []
for key in d1:
if key in d2:
results.append([key, d1[key], d2[key]])
else:
results.append([key, d1[key], None])
return results |
listagem = ('APRENDER', 'PROGRAMAR',
'LINGUAGEM', 'PYTHON',
'CURSO', 'GRATIS',
'ESTUDAR', 'PRATICAR',
'TRABALHAR', 'MERCADO',
'PROGRAMADOR', 'FUTURO')
for pos in listagem:
print(f'\nNa palavra {pos} temos ', end=' ')
for letra in pos:
if letra.... | listagem = ('APRENDER', 'PROGRAMAR', 'LINGUAGEM', 'PYTHON', 'CURSO', 'GRATIS', 'ESTUDAR', 'PRATICAR', 'TRABALHAR', 'MERCADO', 'PROGRAMADOR', 'FUTURO')
for pos in listagem:
print(f'\nNa palavra {pos} temos ', end=' ')
for letra in pos:
if letra.upper() in 'AEIOU':
print(letra, end=' ') |
# In Python, the names of classes follow the CapWords
# convention. Let's convert the input phrase accordingly by
# capitilizing all words and spelling them without underscores in-
# between.
# The input format:
# A word or phrase, with words separated by underscores, like
# function and variable names in Python.
# ... | word = input()
print(word.title() if word.find('_') == -1 else word.title().replace('_', ''))
print(''.join([x.capitalize() for x in input().lower().split('_')])) |
pow_of_5th = {i:i**5 for i in range(10)}
def get_5th_pow_of(n):
return pow_of_5th[n]
def get_sum_of_5th_pow_of(n):
sum = 0
for digit in str(n):
sum += get_5th_pow_of(int(digit))
return sum
if __name__ == "__main__":
numb = set()
ceil = ((pow_of_5th[9]) * 9)+1 # Verify this ceil
for n in range(2, ce... | pow_of_5th = {i: i ** 5 for i in range(10)}
def get_5th_pow_of(n):
return pow_of_5th[n]
def get_sum_of_5th_pow_of(n):
sum = 0
for digit in str(n):
sum += get_5th_pow_of(int(digit))
return sum
if __name__ == '__main__':
numb = set()
ceil = pow_of_5th[9] * 9 + 1
for n in range(2, cei... |
CONSUMER_API_KEY = ""
CONSUMER_API_SECRET = ""
ACCESS_TOKEN = ""
ACCESS_KEY = ""
| consumer_api_key = ''
consumer_api_secret = ''
access_token = ''
access_key = '' |
def emergency_stop(driver):
driver.setSteeringAngle(0.0)
driver.setCruisingSpeed(0)
def stop(driver, frame=30):
driver.setSteeringAngle(0.0)
driver.setCruisingSpeed(0)
def print_all_devices(r):
print('---------------------------------------')
for i in range(r.getNumberOfDevices()):
... | def emergency_stop(driver):
driver.setSteeringAngle(0.0)
driver.setCruisingSpeed(0)
def stop(driver, frame=30):
driver.setSteeringAngle(0.0)
driver.setCruisingSpeed(0)
def print_all_devices(r):
print('---------------------------------------')
for i in range(r.getNumberOfDevices()):
pri... |
file = open("input01.txt").read().splitlines()
file = [int(x) for x in file]
"""Part One"""
counter = 0
for i in range(1, len(file)):
if file[i] - file[i-1] > 0:
counter += 1
print(counter)
"""Part Two"""
temp = []
for i in range(len(file)-2):
temp.append(sum(file[i:i+3]))
counter = 0
for i in range(1... | file = open('input01.txt').read().splitlines()
file = [int(x) for x in file]
'Part One'
counter = 0
for i in range(1, len(file)):
if file[i] - file[i - 1] > 0:
counter += 1
print(counter)
'Part Two'
temp = []
for i in range(len(file) - 2):
temp.append(sum(file[i:i + 3]))
counter = 0
for i in range(1, le... |
"""Placeholder for MicroPython framebuf module"""
MONO_VLSB = 0
MONO_HLSB = 0
MONO_HMSB = 0
RGB565 = 0
GS4_HMSB = 0
class FrameBuffer():
def __init__(self, buffer, width, height, format, stride=None):
pass
| """Placeholder for MicroPython framebuf module"""
mono_vlsb = 0
mono_hlsb = 0
mono_hmsb = 0
rgb565 = 0
gs4_hmsb = 0
class Framebuffer:
def __init__(self, buffer, width, height, format, stride=None):
pass |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# @Script: solution.py
# @Author: Pradip Patil
# @Contact: @pradip__patil
# @Created: 2018-02-12 23:58:20
# @Last Modified By: Pradip Patil
# @Last Modified: 2018-02-13 00:15:16
# @Description: https://www.hackerrank.com/challenges/find-second-maximum-number-in-a-list/prob... | if __name__ == '__main__':
n = int(input())
print(sorted(set([int(i) for i in input().split()]))[-2]) |
class Base(object):
TYPE_ATTRIBUTES = ("_entity_type", "workflow_type")
@staticmethod
def _get_camelcase(attribute):
if attribute in Base.TYPE_ATTRIBUTES:
return "type"
tmp = attribute.split("_")
return tmp[0] + "".join([w.title() for w in tmp[1:]])
@staticmethod
... | class Base(object):
type_attributes = ('_entity_type', 'workflow_type')
@staticmethod
def _get_camelcase(attribute):
if attribute in Base.TYPE_ATTRIBUTES:
return 'type'
tmp = attribute.split('_')
return tmp[0] + ''.join([w.title() for w in tmp[1:]])
@staticmethod
... |
n = int(input())
while n:
p = str(input())
print("gzuz")
n = n - 1
| n = int(input())
while n:
p = str(input())
print('gzuz')
n = n - 1 |
group_name = [
'DA',
'DG',
'DC',
'DT',
'DI'
]
| group_name = ['DA', 'DG', 'DC', 'DT', 'DI'] |
LESSONS = [
{
"Move cursor left": ["h"],
"Move cursor right": ["l"],
"Move cursor down": ["j"],
"Move cursor up": ["k"],
"Close file": [":q"],
"Close file, don't save changes": [":q!"],
"Save changes to file": [":w"],
"Save changes and close file": [":... | lessons = [{'Move cursor left': ['h'], 'Move cursor right': ['l'], 'Move cursor down': ['j'], 'Move cursor up': ['k'], 'Close file': [':q'], "Close file, don't save changes": [':q!'], 'Save changes to file': [':w'], 'Save changes and close file': [':wq', ':x', 'ZZ'], 'Delete character at cursor': ['x'], 'Insert at curs... |
class Car:
"""
Car models a car w/ tires and an engine
"""
def __init__(self, engine, tires):
self.engine = engine
self.tires = tires
def description(self):
print(f"A car with a {self.engine} engine, and {self.tires} tires")
def wheel_circumference(self):
if le... | class Car:
"""
Car models a car w/ tires and an engine
"""
def __init__(self, engine, tires):
self.engine = engine
self.tires = tires
def description(self):
print(f'A car with a {self.engine} engine, and {self.tires} tires')
def wheel_circumference(self):
if le... |
def centuryFromYear(year):
if ((year > 0) and (year <= 2005)):
str_year = str(year) # converts integer input to string type with 'str()'
len_year = len(str_year) # finds length of new 'str_year'
century_arr = []
century = 0
# iterates through 'str_year'...
for digit... | def century_from_year(year):
if year > 0 and year <= 2005:
str_year = str(year)
len_year = len(str_year)
century_arr = []
century = 0
for digit in range(len_year):
century_arr.append(str_year[digit])
if len_year == 1:
century += 1
if le... |
def get_roles(client: object) -> list:
"""Get information about the roles in Blackbaud.
Documentation:
https://docs.blackbaud.com/on-api-docs/api/constituents/role/get-listall
Args:
client (object): The ON API client object.
Returns:
List of dictionaries.
"""
url = '/r... | def get_roles(client: object) -> list:
"""Get information about the roles in Blackbaud.
Documentation:
https://docs.blackbaud.com/on-api-docs/api/constituents/role/get-listall
Args:
client (object): The ON API client object.
Returns:
List of dictionaries.
"""
url = '/r... |
#
# PySNMP MIB module CISCO-DMN-DSG-SDI-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DMN-DSG-SDI-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:37:52 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection) ... |
#
# TrafficLight.py
# Taco --- SPH Innovation Challenge
#
# Created by Mat, Kon and Len on 2017-03-11.
# Copyright 2016 Researchnix. All rights reserved.
#
class TrafficLight:
# State is a 2D array with the values 0 and 1 associating red and green
# to the path from one incoming street to another outgoi... | class Trafficlight:
state = {}
def __init__(self, incoming, outgoing):
for o in outgoing:
self.state[o.ID] = {}
for i in incoming:
self.state[o.ID][i.ID] = True
def set_state(self):
pass
def path_allowed(self, i, o):
return self.state[o]... |
mins = []
maxes = []
letters = []
passwords = []
with open("day2_input", "r") as f:
for line in f:
first, second = line.split(':')
first = first.split('-')
mins.append(int(first[0]))
maxes.append(int(first[1].split(' ')[0]))
letters.append(first[1].split(' ')[1])
pas... | mins = []
maxes = []
letters = []
passwords = []
with open('day2_input', 'r') as f:
for line in f:
(first, second) = line.split(':')
first = first.split('-')
mins.append(int(first[0]))
maxes.append(int(first[1].split(' ')[0]))
letters.append(first[1].split(' ')[1])
pa... |
#
# PySNMP MIB module PDN-UPLINK-TAGGING-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PDN-UPLINK-TAGGING-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:39:49 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, value_size_constraint, value_range_constraint, single_value_constraint) ... |
class Chromosome:
def __init__(self, gene):
self.gene = gene
| class Chromosome:
def __init__(self, gene):
self.gene = gene |
"""
Runtime: 800 ms, faster than 31.40% of Python3 online submissions for Two Sum.
Memory Usage: 14.9 MB, less than 11.62% of Python3 online submissions for Two Sum.
https://leetcode.com/problems/two-sum
"""
def twoSum(nums, target):
# nums is a list of given numbers
# target is our goal
for... | """
Runtime: 800 ms, faster than 31.40% of Python3 online submissions for Two Sum.
Memory Usage: 14.9 MB, less than 11.62% of Python3 online submissions for Two Sum.
https://leetcode.com/problems/two-sum
"""
def two_sum(nums, target):
for i in range(len(nums)):
cn = nums[i]
lf = target - cn
... |
#
# PySNMP MIB module FDRY-RADIUS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FDRY-RADIUS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:59:41 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, value_range_constraint, constraints_union, constraints_intersection) ... |
input = """
% Enforce that <MUST_BE_TRUE,a> is in the queue before <TRUE,a>
:- x.
:- y.
x :- not a.
a :- not y.
% A rule with w and y in the head, such that they are not optimised away.
w v y v z.
% If <MUST_BE_TRUE,a> is in the queue before <TRUE,a>, the undefPosBody counter
% in this constraint should be decrement... | input = '\n% Enforce that <MUST_BE_TRUE,a> is in the queue before <TRUE,a>\n:- x.\n:- y.\n\nx :- not a.\na :- not y.\n\n% A rule with w and y in the head, such that they are not optimised away.\nw v y v z.\n\n% If <MUST_BE_TRUE,a> is in the queue before <TRUE,a>, the undefPosBody counter\n% in this constraint should be... |
expected_output = {
"ap_name": {
"b25a-13-cap10": {
"ap_mac": "3c41.0fee.5094",
"site_tag_name": "default-site-tag-fabric",
"policy_tag_name": "PT_Fabri_B25_B25-1_fe778",
"rf_tag_name": "Standard",
"misconfigured": "No",
"tag_source": "... | expected_output = {'ap_name': {'b25a-13-cap10': {'ap_mac': '3c41.0fee.5094', 'site_tag_name': 'default-site-tag-fabric', 'policy_tag_name': 'PT_Fabri_B25_B25-1_fe778', 'rf_tag_name': 'Standard', 'misconfigured': 'No', 'tag_source': 'Static'}, 'b25b-12-cap01': {'ap_mac': '3c41.0fee.5884', 'site_tag_name': 'default-site-... |
epoch = 100
train_result = "/home/yetaoyu/zc/Classification/patch_train_results"
train_dataset_dir = "/home/yetaoyu/zc/Classification/patch_data"
test_data_dir = "/home/yetaoyu/zc/Classification/patch_data"
test_result_dir = "/home/yetaoyu/zc/Classification/patch_test_results"
model_weight_path = "/home/yetaoyu/zc/Clas... | epoch = 100
train_result = '/home/yetaoyu/zc/Classification/patch_train_results'
train_dataset_dir = '/home/yetaoyu/zc/Classification/patch_data'
test_data_dir = '/home/yetaoyu/zc/Classification/patch_data'
test_result_dir = '/home/yetaoyu/zc/Classification/patch_test_results'
model_weight_path = '/home/yetaoyu/zc/Clas... |
bunsyou = "I am a"
gengo = "cat"
if len(gengo) > 3:
print(gengo)
elif bunsyou[-1] == gengo[1]:
print(bunsyou)
else:
print(bunsyou + " " + gengo)
| bunsyou = 'I am a'
gengo = 'cat'
if len(gengo) > 3:
print(gengo)
elif bunsyou[-1] == gengo[1]:
print(bunsyou)
else:
print(bunsyou + ' ' + gengo) |
# Space: O(n)
# Time: O(n!)
class Solution:
def permuteUnique(self, nums):
def backtracking(nums_list, temp_list, res, visited):
if len(nums_list) == len(temp_list):
res.append(temp_list[:])
for i, num in enumerate(nums_list):
if visited[i]: contin... | class Solution:
def permute_unique(self, nums):
def backtracking(nums_list, temp_list, res, visited):
if len(nums_list) == len(temp_list):
res.append(temp_list[:])
for (i, num) in enumerate(nums_list):
if visited[i]:
continue
... |
#
# PySNMP MIB module HH3C-NVGRE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-NVGRE-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:16:01 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, single_value_constraint, constraints_intersection, constraints_union) ... |
def isPrime(n):
if n<=3 :
return True
for i in range(2, n):
if n%i==0:
return False
return True
a,b = map(int, input().split())
flag = True
if not isPrime(a) or not isPrime(b):
flag = False
print("NO")
else :
for i in range(a+1,b):
if isPrime(i):
... | def is_prime(n):
if n <= 3:
return True
for i in range(2, n):
if n % i == 0:
return False
return True
(a, b) = map(int, input().split())
flag = True
if not is_prime(a) or not is_prime(b):
flag = False
print('NO')
else:
for i in range(a + 1, b):
if is_prime(i):... |
def binary_search_recursive(array, element, start, end):
if start > end:
return -1
mid = (start + end) // 2
if element < array[mid]:
return binary_search_recursive(array, element, start, mid - 1)
else:
return binary_search_recursive(array, element, mid + 1, end)
element = 1... | def binary_search_recursive(array, element, start, end):
if start > end:
return -1
mid = (start + end) // 2
if element < array[mid]:
return binary_search_recursive(array, element, start, mid - 1)
else:
return binary_search_recursive(array, element, mid + 1, end)
element = 18
arra... |
_base_ = './faster_rcnn_r50_fpn_1x_voc0712_cocofmt.py'
model = dict(
rpn_head=dict(loss_bbox=dict(type='MSELoss', loss_weight=1.0)),
roi_head=dict(
bbox_head=dict(
loss_bbox=dict(type='MSELoss', loss_weight=1.0))))
optimizer_config = dict(
_delete_=True, grad_clip=dict(max_norm=35, norm... | _base_ = './faster_rcnn_r50_fpn_1x_voc0712_cocofmt.py'
model = dict(rpn_head=dict(loss_bbox=dict(type='MSELoss', loss_weight=1.0)), roi_head=dict(bbox_head=dict(loss_bbox=dict(type='MSELoss', loss_weight=1.0))))
optimizer_config = dict(_delete_=True, grad_clip=dict(max_norm=35, norm_type=2))
work_dir = './work_dirs/voc... |
no_of_labels=4
no_of_iterations = 10
graph = {
'a': {('b', 1), ('e', 4),('c',2)},
'b': {('a',1),('c', 3), ('d',3),('e',4)},
'c': {('a',2),('d',1),('b',3)},
'd': {('b',3),('e',1), ('c',1)},
'e': {('d',1),('a',4),('b',4)}
} | no_of_labels = 4
no_of_iterations = 10
graph = {'a': {('b', 1), ('e', 4), ('c', 2)}, 'b': {('a', 1), ('c', 3), ('d', 3), ('e', 4)}, 'c': {('a', 2), ('d', 1), ('b', 3)}, 'd': {('b', 3), ('e', 1), ('c', 1)}, 'e': {('d', 1), ('a', 4), ('b', 4)}} |
# Read one line of data
file = open('myfile.txt', 'r')
line_of_data = file.readline()
print(line_of_data, end='')
file.close()
| file = open('myfile.txt', 'r')
line_of_data = file.readline()
print(line_of_data, end='')
file.close() |
#
# PySNMP MIB module Nortel-Magellan-Passport-VnetEtsiQsigMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-VnetEtsiQsigMIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:19:14 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davw... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_constraint, constraints_intersection, value_size_constraint, constraints_union) ... |
# -*- coding: utf-8 -*-
# (N.B : the site root is also related to the nginx conf!)
SITE_ROOT = "__YNH_APP_WEBPATH__"
DEBUG = False
TEMPLATE_DEBUG = False
| site_root = '__YNH_APP_WEBPATH__'
debug = False
template_debug = False |
#VERSION: 1.0
INFO = {"initwin":("init_window","Window initializer(only for Windows)")}
RLTS = {"cls":("iccode","os","json"),"funcs":("echo","get_args","edit_userconf"),"vars":("BLOCK","ECHO","OS")}
def init_window(cmd):
global ECHO
opts = get_args(cmd)
for i in opts:
if i in ("-h,--help"):
echo(1,"""Window i... | info = {'initwin': ('init_window', 'Window initializer(only for Windows)')}
rlts = {'cls': ('iccode', 'os', 'json'), 'funcs': ('echo', 'get_args', 'edit_userconf'), 'vars': ('BLOCK', 'ECHO', 'OS')}
def init_window(cmd):
global ECHO
opts = get_args(cmd)
for i in opts:
if i in '-h,--help':
... |
class TestarosaPyError(Exception):
...
class AnotherError(TestarosaPyError):
...
| class Testarosapyerror(Exception):
...
class Anothererror(TestarosaPyError):
... |
def upper_case_first_param(func):
def wrapper(text):
return func(text.upper())
return wrapper
@upper_case_first_param
def recibed_a_msg(name: str) -> str:
return f"{name}, you has received a message."
@upper_case_first_param
def uppercase(msg: str) -> str:
return msg
if __name__ == "__mai... | def upper_case_first_param(func):
def wrapper(text):
return func(text.upper())
return wrapper
@upper_case_first_param
def recibed_a_msg(name: str) -> str:
return f'{name}, you has received a message.'
@upper_case_first_param
def uppercase(msg: str) -> str:
return msg
if __name__ == '__main__'... |
"""
This file analyzes a game state and determines the next (group of) cells to mark grey or blue.
The output file for this will be "${GAMESTATE_FILENAME}_soln".
The data output will consist of:
1. An array of cells to mark as blue
2. An array of cells to mark as grey
3. An array of data structures to mark ... | """
This file analyzes a game state and determines the next (group of) cells to mark grey or blue.
The output file for this will be "${GAMESTATE_FILENAME}_soln".
The data output will consist of:
1. An array of cells to mark as blue
2. An array of cells to mark as grey
3. An array of data structures to mark ... |
class FlagRegion:
def __init__(self, name, format, icon, mode):
self.name = name
self.format = format
self.icon = icon
self.mode = mode
| class Flagregion:
def __init__(self, name, format, icon, mode):
self.name = name
self.format = format
self.icon = icon
self.mode = mode |
class Status(object):
'''Object to represent row in status table
Attributes:
conn: database connection, usually sqlite3 connection object
name: name of pipeline job running
display_name: pretty formatted display name for pipeline
last_ran: UNIX timestamp (number) for last comple... | class Status(object):
"""Object to represent row in status table
Attributes:
conn: database connection, usually sqlite3 connection object
name: name of pipeline job running
display_name: pretty formatted display name for pipeline
last_ran: UNIX timestamp (number) for last comple... |
"""
9. Palindrome Number
https://leetcode.com/problems/palindrome-number/description/
"""
class Solution:
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
if x < 0:
return False
if x % 10 == x:
return True
before, after ... | """
9. Palindrome Number
https://leetcode.com/problems/palindrome-number/description/
"""
class Solution:
def is_palindrome(self, x):
"""
:type x: int
:rtype: bool
"""
if x < 0:
return False
if x % 10 == x:
return True
(before, after)... |
# clean = open("../data/fics_2017_HvC.pgn", "w+")
# with open("../data/fics_2017_HvC_raw.pgn") as raw:
# for i, line in enumerate(raw):
# if (i % 1000): print(i)
# if "\r\n" in line:
# clean.write(line.replace("\r\n", "\n"))
# else:
# clean.write("\n\n")
# clean.... | def write_eof(src):
with open(src, 'a') as f:
f.write('EOF\n')
write_eof('../data/fics_2017_HvC.pgn')
write_eof('../data/games.pgn') |
ABSATER = 'ABSATER'
ATTRIB = 'ATTRIB'
INVATR = 'INVATR'
OBJECT = 'OBJECT'
RDSET = 'RDSET'
RSET = 'RSET'
SET = 'SET'
ComponentRole = {
'000': ABSATER,
'001': ATTRIB,
'010': INVATR,
'011': OBJECT,
'100': 'reserved',
'101': RDSET,
'110': RSET,
'111': SET
}
"""
- An EFLR begins with a Se... | absater = 'ABSATER'
attrib = 'ATTRIB'
invatr = 'INVATR'
object = 'OBJECT'
rdset = 'RDSET'
rset = 'RSET'
set = 'SET'
component_role = {'000': ABSATER, '001': ATTRIB, '010': INVATR, '011': OBJECT, '100': 'reserved', '101': RDSET, '110': RSET, '111': SET}
'\n- An EFLR begins with a Set components. Type in Set is mandato... |
# Multiple Choice
# Return the answer to the multiple choice question in the handout.
# If you think option c is the correct answer,
# return 'c'
def question_1():
# [Image] The first hidden layer has 4 filters of kernel-width 2 and stride 2;
# the second layer has 3 filters of kernel-width 8 and stride 2; th... | def question_1():
return 'b'
def question_2():
return 'd'
def question_3():
return 'b'
def question_4():
return 'a'
def question_5():
return 'a' |
"""
entrada
cantidad invertida-->float-->c
tasa de intereses-->float-->t
salida
intereses-->float-->i
ganancia total-->float-->total
"""
c=float(input("Escriba la cantidad invertida:"))
t=float(input("Escriba la tasa de interes:"))
i=(c*t)/100
if (i>100.000):
print("Los intereses son:"+str(i))
total=c + t
print("el... | """
entrada
cantidad invertida-->float-->c
tasa de intereses-->float-->t
salida
intereses-->float-->i
ganancia total-->float-->total
"""
c = float(input('Escriba la cantidad invertida:'))
t = float(input('Escriba la tasa de interes:'))
i = c * t / 100
if i > 100.0:
print('Los intereses son:' + str(i))
total = c + t... |
class WorkflowNotFound(Exception):
pass
class WorkflowSyntaxError(Exception):
pass
| class Workflownotfound(Exception):
pass
class Workflowsyntaxerror(Exception):
pass |
# Copyright 2021 Tianmian Tech. 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 la... | class Federationwrapped(object):
"""
A wrapper, wraps _DSource as Table
"""
def __init__(self, session_id, dsource_cls, table_cls):
self.dsource_cls = dsource_cls
self.table_cls = table_cls
self.session_id = session_id
def unboxed(self, obj):
if hasattr(obj, '_fcs')... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 CERN.
#
# CDS-ILS is free software; you can redistribute it and/or modify it under
# the terms of the MIT License; see LICENSE file for more details.
"""CDS-ILS CDS Importer ignored fields."""
CDS_IGNORE_FIELDS = {
"003",
"005",
"020__q",
"020__c",
"0... | """CDS-ILS CDS Importer ignored fields."""
cds_ignore_fields = {'003', '005', '020__q', '020__c', '020__b', '020__C', '0248_a', '0248_p', '041__h', '035__z', '037__c', '050__b', '050_4b', '082002', '082042', '0820_2', '082__2', '084__a', '084__2', '100__9', '111__d', '111__f', '145__a', '246__i', '269__a', '269__b', '2... |
#
# PySNMP MIB module ALVARION-BANDWIDTH-CONTROL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALVARION-BANDWIDTH-CONTROL-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:21:58 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ... | (alvarion_mgmt_v2,) = mibBuilder.importSymbols('ALVARION-SMI', 'alvarionMgmtV2')
(alvarion_priority_queue,) = mibBuilder.importSymbols('ALVARION-TC', 'AlvarionPriorityQueue')
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mib... |
# Solution by PauloBA
def sum_of_minimums(numbers):
ans = 0
for i in numbers:
i.sort()
ans = ans + i[0]
return ans | def sum_of_minimums(numbers):
ans = 0
for i in numbers:
i.sort()
ans = ans + i[0]
return ans |
"""
[2017-08-11] Challenge #326 [Hard] Multifaceted alphabet blocks
https://www.reddit.com/r/dailyprogrammer/comments/6t0zua/20170811_challenge_326_hard_multifaceted_alphabet/
# Description
You are constructing a set of N alphabet blocks. The first block has 1 face. The second block has 2 faces, and so on up
to the N... | """
[2017-08-11] Challenge #326 [Hard] Multifaceted alphabet blocks
https://www.reddit.com/r/dailyprogrammer/comments/6t0zua/20170811_challenge_326_hard_multifaceted_alphabet/
# Description
You are constructing a set of N alphabet blocks. The first block has 1 face. The second block has 2 faces, and so on up
to the N... |
s=str(input()) # Number n in binary format
s='0'+s # Trailing zero will make the code run for '11111' etc. without changes
first1=-1
seqend=-1
if s[-1]=='0':
'''
If s ends with '0', the next biggest number will be '1' followed by the
number of '0's + one extra '0' followed by the number of '1's. For ex:
... | s = str(input())
s = '0' + s
first1 = -1
seqend = -1
if s[-1] == '0':
"\n If s ends with '0', the next biggest number will be '1' followed by the\n number of '0's + one extra '0' followed by the number of '1's. For ex:\n\n if s = 111000\n answer = 1000011\n "
for i in range(len(s)):
if ... |
# The rand7() API is already defined for you.
# def rand7():
# @return a random integer in the range 1 to 7
# Don't know why the following solution doesn't work on 100000 calls case.
class Solution:
def rand10(self):
"""
:rtype: int
"""
a, b = rand7() - 1, rand7() - 1
num = ... | class Solution:
def rand10(self):
"""
:rtype: int
"""
(a, b) = (rand7() - 1, rand7() - 1)
num = a * 7 + b
if num >= 40:
self.rand10()
return num % 10 + 1
class Solution:
def rand10(self):
"""
:rtype: int
"""
a... |
n = int(input())
case = 0
l = []
for i in range(n):
item = int(input())
l.append(item)
for i in l:
for j in range(1, i+1):
x = j
y = i - j
lx = [int(a) for a in str(x)]
ly = [int(b) for b in str(y)]
if((4 in lx) or (4 in ly)):
con... | n = int(input())
case = 0
l = []
for i in range(n):
item = int(input())
l.append(item)
for i in l:
for j in range(1, i + 1):
x = j
y = i - j
lx = [int(a) for a in str(x)]
ly = [int(b) for b in str(y)]
if 4 in lx or 4 in ly:
continue
else:
... |
# If Expression
# if expr:
if True:
print("it is true")
else:
print("it is false")
if False:
print("it is false")
print("print intented next line")
else:
print("it is not false")
if bool("python"):
print("it is python")
else:
print("it is not python")
h = 50
if h > 50:
print("h is n... | if True:
print('it is true')
else:
print('it is false')
if False:
print('it is false')
print('print intented next line')
else:
print('it is not false')
if bool('python'):
print('it is python')
else:
print('it is not python')
h = 50
if h > 50:
print('h is not greater than 50')
else:
p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.