content stringlengths 7 1.05M |
|---|
# A list of applications to be added to INSTALLED_APPS.
ADD_INSTALLED_APPS = ['starlingx_dashboard']
FEATURE = ['starlingx_dashboard']
ADD_HEADER_SECTIONS = \
['starlingx_dashboard.dashboards.admin.active_alarms.views.BannerView', ]
ADD_SCSS_FILES = ['dashboard/scss/styles.scss',
'dashboard/scs... |
#
# Generated by generate.py
#
class VMCompilerInfo:
def getWordList(self):
return ["@","c@","!","c!",">r","r>",";","[literal]","[bzero]","[halt]","[nop]","+","nand","2/","0=","[temp]","[codebase]","[dictionary]","cursor!","screen!","keyboard@","blockread@","[stackreset]","blockwrite!","0","1","2","-1","dup","dr... |
# stack class (implemented in doubly-liunked list)
class Node(object):
# initialize node object
def __init__(self, value=0):
self.value = value
self.next = None
self.previous = None
# handle printing
def __str__(self):
return(f"{self.value}")
class Queue(object):
... |
# Given an array of ints, return True if one of the first 4 elements in the
# array is a 9. The array length may be less than 4.
# array_front9([1, 2, 9, 3, 4]) --> True
# array_front9([1, 2, 3, 4, 9]) --> False
# array_front9([1, 2, 3, 4, 5]) --> False
def array_front9(nums):
return 9 in nums[:4]
print(array_fro... |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... |
def stage(ctx):
return {
"parent": "Tarball",
"triggers": {
"parent": True
},
"parameters": [],
"configs": [],
"jobs": [{
"name": "pytest agent",
"steps": [{
"tool": "shell",
"cmd": "sudo apt update &... |
# Copyright 2019 The Bazel Authors. 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... |
def startUP():
pass
def carmDown():
pass
|
cod_clientes = []
altura_clientes = []
peso_clientes = []
n_cliente = 1
codigo = True
while codigo != 0:
print("\nCliente n° ", n_cliente)
codigo = int(input("Digite o código: "))
if codigo == 0:
break
else:
altura = float(input("Digite a altura: "))
peso = float(input("Digite o... |
"""
object_adventure.py
A text adventure with objects you can pick up and put down.
"""
# data setup
rooms = {
'empty': {'name': 'an empty room',
'east': 'bedroom', 'north': 'temple',
'contents': [],
'text': 'The stone floors and walls are cold and damp.'},
'temple': {'name': 'a sma... |
#global field?
gname='tristan in GGGGGG!!!'
class c(object):
cname='tristan in CCCCCCC!!!!'
def f(self):
fname='tristan in FFFFFF!!!'
print(fname)
print(self.cname)
print(gname)
def f2(self,test):
fname=test
print(fname)
|
# Xs and Os, Nobody Knows
# Create a function that takes a string, checks if it has the same number of "x"s and "o"s and returns either True or False.
# Return a boolean value (True or False).
# The string can contain any character.
# When no x and no o are in the string, return True.
def XO(txt):
return len(list(fi... |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def middleNode(self, head: ListNode) -> ListNode:
slowptr = head
fastptr = head
while(fastptr and fastptr.next):
fastptr = fastptr.next.n... |
# config.py
# AWS IoT endpoint settings
HOST_NAME = "<URL>-ats.iot.us-east-1.amazonaws.com"
HOST_PORT = 8883
# Thing certs & keys
PRIVATE_KEY = "/home/pi/certs9000/private.pem.key"
DEVICE_CERT = "/home/pi/certs9000/certificate.pem.crt"
ROOT_CERT = "/home/pi/certs9000/root-CA.crt"
# Message settings
TOPIC_SENSOR = "$... |
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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 applicab... |
"""
14) Leia um ângulo em graus e apresente-o convertido em radianos. A fórmula de conversão é: R = G * r / 180, sendo G o ângulo em graus e R em radianos e r = 3.14.
"""
angulo_graus = float(input('Digite o ângulo em graus: \n'))
print(f'O ângulo {angulo_graus}º é: {angulo_graus * 3.14 / 180} radianos')
|
def fiboarray(n):
fibo = [0,1]
for i in range (2,n):
fibo.append(fibo[i-1] + fibo[i-2])
return fibo
def fiboarray_extended(a,b):
max_fibo = fiboarray(max(abs(a),abs(b))+1)
output = []
for i in range (a,b):
if (i < 0):
output.append(-int(pow(-1,i)) * max_fibo[-i... |
expected_output = {
"instance_id": {
4097: {"lisp": 0},
4099: {"lisp": 0},
4100: {"lisp": 0},
8188: {
"lisp": 0,
"site_name": {
"site_uci": {
"any-mac": {
"last_register": "never",
... |
'''
Given two strings A and B of lowercase letters, return true if and only if we can swap two letters in A so that the result equals B.
Example 1:
Input: A = "ab", B = "ba"
Output: true
Example 2:
Input: A = "ab", B = "ab"
Output: false
Example 3:
Input: A = "aa", B = "aa"
Output: true
Example 4:
Input: A = "a... |
class Solution:
def twoSum(self, nums: list[int], target: int) -> list[int]:
"""Find indices of the terms.
Given an array of integers nums and an integer target, return indices
of the two numbers such that they add up to target.
"""
my_dict = {}
result = []
f... |
class SOFATrace:
data = []
name = []
title = []
color = []
x_field = []
y_field = []
highlight = None
|
"""
2475 : 검증수
URL : https://www.acmicpc.net/problem/2475
Input :
0 4 2 5 6
Output :
1
"""
numbers = map(int, input().split(' '))
answer = 0
for number in numbers:
answer += (number ** 2)
print(answer % 10)
|
num = int(input())
def input_lines(number):
lines = set()
for _ in range(number):
lines.add(input())
return lines
def print_data(names):
for name in names:
print(name)
names = input_lines(num)
print_data(names) |
"""
Column aliasing.
"""
class ColumnAlias:
"""
Descriptor to reference a column by a well known alias.
"""
def __init__(self, name):
self.name = name
def __get__(self, cls, owner):
return getattr(cls or owner, self.name)
def __set__(self, cls, value):
return setatt... |
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def partition(self, head, x):
"""
:type head: ListNode
:type x: int
:rtype: ListNode
"""
less = ListNode(-1)
... |
lista = []
for c in range(1,6):
peso = float(input(f'Peso da {c}º pessoa: '))
lista += [peso]
print(f'O maior peso da lista foi {max(lista):.1f}')
print(f'O menor peso da lista foi {min(lista):.1f}') |
class BaseColumnsProvider(object):
ROW_ID = 'row_id'
def get_columns_list_with_types(self):
dtypes_list = list()
dtypes_list.append((BaseColumnsProvider.ROW_ID, 'int32'))
return dtypes_list
|
# Copyright (c) Open-MMLab. All rights reserved.
__version__ = '0.18.0'
short_version = __version__
|
def maxProfit(prices):
profit = 0
for i in range(len(prices)-1):
if prices[i] < prices[i+1]:
profit += (prices[i+1] - prices[i])
return profit
|
# Using the print function
# Simple usage
print("London")
print(100)
print(20.20)
# print with Variables
first_name = "John"
last_name = "Papa"
print(first_name, last_name, 1, 2, "Hello")
# Using +
print(first_name + last_name)
print(first_name + ", " +last_name)
# Inserting new line character & tab
print("Apples")... |
'''
Este fichero de configuración puede usarse para sobrecargar la variable ENABLE_DEBUG
y establecerla a True (para activar el modo depuración)
'''
OUTPUT_LOGS_TO_STDOUT = True
OUTPUT_PONY_LOGS_TO_STDOUT = True
LOG_LEVEL = 'DEBUG' |
class LRUCache:
"""
Our LRUCache class keeps track of the max number of nodes it
can hold, the current number of nodes it is holding, a doubly-
linked list that holds the key-value entries in the correct
order, as well as a storage dict that provides fast access
to every node stored in the cach... |
class Solution:
def reverse(self, x):
"""
:type x: int
:rtype: int
"""
sign = -1 if x < 0 else 1
temp_str = str(abs(x))
if len(temp_str) <= 1:
return sign*int(temp_str)
temp_str = temp_str[::-1]
while(temp_str[0] == '0'):
... |
Text1 = "#"
Text2 = '''
\nadd_core = MSW
owner = MSW
controller = MSW
culture = minesweeper_culture
religion = animism
hre = no
base_tax = 0
base_production = 0
base_manpower = 0
trade_goods = copper\n'''
Text3 = "capital = \""
Text4 = '''"
is_city = yes'''
for i in range (5000, 5100):
stri = str(i)
out = Text1 + s... |
# file.py
def create_name():
return "new_file.txt"
def create_time():
return "today"
|
#%% File
def write(text):
with open("./myFile.txt", "w") as file:
file.write(text)
def append(text):
with open("./myFile.txt", "a") as file:
file.write(text)
def readDirty():
file = open("./myFile.txt", "r")
content = file.readlines()
file.close()
return content
def read():
... |
def main():
while True:
# input
n = int(input())
if n:
xyrs = [[*map(int, input().split())] for _ in range(n)]
else:
return
# compute
# output
if __name__ == '__main__':
main()
|
'Check if string is of format a.(b+c)*'
print("Enter z to terminate.\n")
string = ""
while string != "z":
string = input("Enter the string to be checked: ")
count = 0
if string[0] == "a":
for i in range(1, len(string)):
if string[i] == "b" or string[i] == "c":
count += 1... |
# -*- coding: utf-8 -*-
# Copyright (c) 2017-18 Richard Hull and contributors
# See LICENSE.rst for details.
class mutable_string(object):
def __init__(self, value):
assert value.__class__ is str
self.target = value
def __getattr__(self, attr):
return self.target.__getattribute__(att... |
def psychologist():
print('Please tell me your problems')
while True:
answer = (yield)
if answer is not None:
if answer.endswith('?'):
print("Don't ask yourself too much questions")
elif 'good' in answer:
print("Ahh that's good, go on")
... |
def get_db_uri(dbinfo):
engine = dbinfo.get("ENGINE")
driver = dbinfo.get("DRIVER")
user = dbinfo.get("USER")
password = dbinfo.get("PASSWORD")
host = dbinfo.get("HOST")
port = dbinfo.get("PORT")
name = dbinfo.get("NAME")
return "{}+{}://{}:{}@{}:{}/{}".format(engine, driver, user, pass... |
include_gcode_from("/home/michael/Documents/Cross1.ngc")
send_gcode_lines()
i = -2
include_gcode_from("/home/michael/Documents/CrossOutline.ngc",False)
comment("BEGINNING CrossOutline")
while i > -11:
move(0,0)
i -= 2
print("i is: {}".format(i))
if i < -11:
i = -11
setv("#1",i)
send_gco... |
test = { 'name': 'q2a',
'points': 2,
'suites': [ { 'cases': [ {'code': '>>> # This test makes sure that fav_emojis has exactly 5 key-value pairs.;\n>>> len(fav_emojis) == 5\nTrue', 'hidden': False, 'locked': False},
{ 'code': '>>> # This test makes sure that fav_emoj... |
class Floor:
def __init__(self, pos, height):
self.pos = pos
self.height = height
self.velocity = np.array([0,0,0])
self.actor = None |
# -*- coding: utf-8 -*-
"""
* Project: udacity-fsnd-p4-conference-app
* Author name: Iraquitan Cordeiro Filho
* Author login: iraquitan
* File: settings
* Date: 3/23/16
* Time: 12:16 AM
"""
# Replace the following lines with client IDs obtained from the APIs
# Console or Cloud Console.
WEB_CLIENT_ID = 'your-web-c... |
primeiro_termo = int(input('Digite o primeiro termo de uma P.A: '))
razao = int(input('Digite a razão dessa P.A: '))
termo = primeiro_termo
cont = 1
while cont <= 10:
print(f'{termo} → ', end='')
termo += razao
cont += 1
print('FIM') |
print()
print('=' * 40)
temp = int(input('Temp em ºC: '))
conv = ((temp/5) * 9) + 32
print()
print(f'{temp}ºC = {conv}ºF')
print()
print('=' * 40)
print()
|
class pluginClass:
"""~~复读机~~
用法 re <次数>"""
registCommand = "re",
listenPlainMessage = False
listenChatAction = False
async def onCommandMessageReceivedListener(self, client, event, command, args):
if event.reply_to_msg_id:
await client.delete_messages(event.chat_id, event.m... |
'''
acts as a model class for freq_ingest table. all the values are set and
get using the setter and getter.
'''
class Freq_Ingest(object):
'''
acts as a model class for freq_ingest table. all the values are set and
get using the setter and getter.
'''
def __init__(self, team_name=None, ... |
def quote_me():
quotes = ["Fighting with him was like trying to solve a crossword and realizing there's no right answer. - Taylor Swift",
"I get up, go and get a coffee, and go do the crossword... and that's my idea of a perfect morning. - Laura Marling",
"But I'm really enjoying my retirement. I get to sl... |
#eleghei an leipei kapoio symvolo >,<,=
def check_if__miss_symbol (filename):
#filename='LP02.LTX'
keeptheprevious_number_in_string=None
counter_of_line=0
i=0
with open(filename, "r") as f:
data = f.readlines()
for line in data:
... |
class Player:
def __init__(self, name: str, hp: int, mp: int):
self.name = name
self.hp = hp
self.mp = mp
self.skills = {}
self.guild = 'Unaffiliated'
def add_skill(self, skill_name, mana_cost):
if skill_name in self.skills.keys():
return 'S... |
class Compartment:
"""
A tuberculosis model compartment.
"""
SUSCEPTIBLE = "susceptible"
EARLY_LATENT = "early_latent"
LATE_LATENT = "late_latent"
INFECTIOUS = "infectious"
DETECTED = "detected"
ON_TREATMENT = "on_treatment"
RECOVERED = "recovered"
|
"""
Copyright (c) 2018-2019 Intel Corporation
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 i... |
class Solution(object):
def minDominoRotations(self, A, B):
"""
:type A: List[int]
:type B: List[int]
:rtype: int
"""
# check there are enough same values
if len(A) != len(B):
return -1
countA = [0] * 7
countB = [0] * 7
same... |
class TaskInstanceConfig(object):
def __init__(self, task_config):
self.cpu = task_config.cpu
self.memory = task_config.memory
self.disk = task_config.disk
self.gpu = task_config.gpu
self.gpu_memory = task_config.gpu_memory
self.duration = task_config.duration
... |
class Source:
'''
source class to define how news sources look
'''
def __init__(self,id,name,language,country):
self.id=id
self.name=name
self.language=language
self.country=country
|
class ModelMeta(type):
def __new__(cls, name, bases, attrs):
print(cls, name, bases, attrs)
if "app_label" not in attrs:
raise RuntimeError(f"{name} 클래스에 app_label 을 정의해주세요!")
return type.__new__(cls, name, bases, attrs)
class ModelBase(metaclass=ModelMeta):
app_label = ""
... |
# Added at : 2016.8.3
# Author : 7sDream
# Usage : Target point(contain point and image pixel info).
__all__ = ['Target']
class Target(object):
def __init__(self, y, x, fill, contrast, point):
self._y = y
self._x = x
self._fill = fill
self._contrast = contrast
self._p... |
"""Defines a rule for runtime test targets."""
load("//tools:defs.bzl", "go_test", "loopback")
def runtime_test(
name,
lang,
image_repo = "gcr.io/gvisor-presubmit",
image_name = None,
blacklist_file = None,
shard_count = 50,
size = "enormous"):
"""Generates ... |
_base_ = [
'../../_base_/models/r50.py',
'../../_base_/datasets/imagenet_sz224_4xbs64.py',
'../../_base_/default_runtime.py',
]
# model settings
model = dict(backbone=dict(norm_cfg=dict(type='SyncBN')))
# dataset settings
data = dict(
train=dict(
data_source=dict(
list_file='data/m... |
def generate_dict_vpn_ip_nexthops(nexthops):
"""
This function generates the block of configurtion for the VPN IP
nexthops that will be used in CLI template to generate VPN Feature
Template
"""
vipValue = []
for nexthop in nexthops:
vipValue.append(
{
"add... |
def twoCitySchedCost(costs):
result={'A':[],'B':[]}
costs.sort(key = lambda x: x[0]-x[1])
print(costs)
n=len(costs)//2
total = 0
for cost in costs[:n]:
total+=cost[0]
for cost in costs[n:]:
total+=cost[1]
return total
if __name__ =='__main__':
costs = ... |
guests_count = int(input())
budget = int(input())
covert_price = guests_count * 20
if covert_price < budget:
money_left = budget - covert_price
fireworks_money = money_left * 0.4
donation_money = money_left - fireworks_money
print(f"Yes! {fireworks_money:.0f} lv are for fireworks and {donation_money:.0... |
# this defines the CPU execution details
EXCEPTION_STACK = [ ]
def e_size():
'''get the size of the stack'''
return len(EXCEPTION_STACK)
def e_empty():
'''test whether the stack is empty'''
return not len(EXCEPTION_STACK)
def e_clear():
'''clear the stack'''
del EXCEPTION_STACK[:]
return... |
"""Internal API endpoint constant library.
_______ __ _______ __ __ __
| _ .----.-----.--.--.--.--| | _ | |_.----|__| |--.-----.
|. 1___| _| _ | | | | _ | 1___| _| _| | <| -__|
|. |___|__| |_____|________|_____|____ |____|__| |__|__|__|_____|
|: 1 | ... |
# Copyright 2015 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': 'alert_overlay',
'dependencies': [
'../../compiled_resources2.gyp:cr',
'../../compiled_resou... |
def compare(elem1, elem2):
JS("""
if (!elem1 && !elem2) {
return true;
} else if (!elem1 || !elem2) {
return false;
}
if (!elem1.isSameNode) {
return (elem1 == elem2);
}
return (elem1.isSameNode(elem2));
""")
def eventGetButton(evt):
JS("""
var button = evt.button... |
def string_strip(stringvalue: str):
return "".join(stringvalue.split())
def string_mask(stringvalue: str):
for char in stringvalue:
print(ord(char), end=' | ')
|
reuse = False
weight_prefix = "model_"
FLIPXY = tf.constant([
[ 1., 0., 0., 0., 0.],
[ 0.,-1., 0., 0., 0.],
[ 0., 0.,-1., 0., 0.],
[ 0., 0., 0., 1., 0.],
[ 0., 0., 0., 0., 1.]] )
models_to_combine = [5, 8, 9, 11]
num_models = len(models_to_combine)
with tf.variable_scope("ENSA... |
names = [
'andy',
'sue',
'fred',
'jim',
'carol'
]
assert names[0] == 'andy'
assert names[4] == 'carol'
assert names[-1] == 'carol'
assert names[-2] == 'jim'
assert names[0:2] == ['andy', 'sue']
assert names[1:2] == ['sue']
assert names[3:] == ['jim', 'carol']
assert names[-2:] == ['jim', 'c... |
# A def vai imprimir a forca para cada erro e caso erre 6x tmb imprime a msg "Lamento! Perdeu!"
def forca(x=0):
if x==0:
print("------------")
print("| |")
print("| ")
print("| ")
print("| ")
print("| ")
print("| ")
print("|")
eli... |
class DotBakError(Exception):
"""Generic errors."""
pass
|
# Copyright 2010-2021, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and ... |
__all__ = [
"dictutils",
"forwarder",
"main",
"rulecollection",
"ruleengine",
"ruleitem",
"ruleset",
"template",
"templateprocessor",
"transform",
"utils"
] |
# -*- coding: utf-8 -*-
# pygada_runtime's package version information
__version_major__ = "0.4"
__version__ = "{}a".format(__version_major__)
__version_long__ = "{}a".format(__version_major__)
__status__ = "Alpha"
__author__ = "Jeremy Morosi"
__author_email__ = "jeremymorosi@hotmail.com"
__url__ = "https://github.com... |
#
# Copyright (c) 2022 Pim van Pelt
#
# 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 writi... |
# for c in range(1, 10):
# print(c)
# print('FIM')
# c = 1
# while c < 10:
# print(c)
# c += 1
# print('FIM')
n = 1
par = impar = 0
while n != 0:
n = int(input('Digite um valor: '))
if n != 0:
if n % 2 == 0:
par += 1
else:
impar += 1
print('Você digitou {} nú... |
# -*- coding: utf-8 -*-
# Simple Bot (SimpBot)
# Copyright 2016-2017, Ismael Lugo (kwargs)
class channel:
def __init__(self, channel_name):
self.channel_name = channel_name
self.maxstatus = False
self.users = []
self.list = {}
def __iter__(self):
return iter(self.user... |
#SOLUÇÃO DO GUANABARÁ APERFEIÇOADA
num = [[], [], []]
for c in range(1, 8):
n = (int(input(f'Informe o {c}º valor: ')))
num[2].append(n)
if n % 2 == 0:
num[0].append(n)
else:
num[1].append(n)
num[0].sort()
num[1].sort()
num[2].sort()
print(f'Os valores encontrados foram {num[2]}')
print(... |
"""
Created at 10/2021
By Wellington Fidelis
"""
# Calculadora em Python
def calculateResult(operation):
firstNumber = float(input('Digite o 1º número: '))
secondNumber = float(input('Digite o 2º número: '))
if (operation == '+'):
result = firstNumber + secondNumber
elif (operation == '-'):
result... |
# -*- coding:utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Lic... |
# iam configuration
# HARDCODED !! CHANGE THIS !!
trainset_file = '/media/ncsr/bee4cbda-e313-4acf-9bc8-817a69ad98ae/IAM/set_split/trainset.txt'
testset_file = '/media/ncsr/bee4cbda-e313-4acf-9bc8-817a69ad98ae/IAM/set_split/testset.txt'
line_file = '/media/ncsr/bee4cbda-e313-4acf-9bc8-817a69ad98ae/IAM/ascii/lines.txt... |
# Time: O(m * n)
# Space: O(m + n)
class Solution(object):
# @param dungeon, a list of lists of integers
# @return a integer
def calculateMinimumHP(self, dungeon):
DP = [float("inf") for _ in dungeon[0]]
DP[-1] = 1
for i in reversed(xrange(len(dungeon))):
DP... |
# Find the kth largest element in an unsorted array. This will be the kth
# largest element in sorted order, not the kth distinct element.
def kthLargestElement(nums, k):
nums.sort()
return nums[-k]
|
# (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
CHECK_NAME = 'scylla'
NAMESPACE = 'scylla.'
# fmt: off
INSTANCE_METRIC_GROUP_MAP = {
'scylla.alien': [
'scylla.alien.receive_batch_queue_length',
'scylla.alien.total_received_messages'... |
'''
Напишите программу определения слова палиндрома
(это слова, которые одинаково читаются в обоих направлениях,
например, анна, abba и т.п.). Слово вводится с клавиатуры.
'''
str01 = 'а роза упала на лапу азора'
# убираем пробелы
str02 = str01.replace(' ', '')
str03 = str02[::-1]
if str02 == str03:
print('y')
else... |
# -*- coding: utf-8 -*-
restricted_characters = [
'<',
'>',
'&'
]
available_languages = [
'ru',
'en',
'uz'
]
available_attachments = [
'audio',
'photo',
'voice',
'sticker',
'document',
'video',
'video_note',
'location',
'contact',
'text'
]
available_at... |
# VIOLET: We do not have 'traceback' module
# import traceback
a = 2
b = 2 + 4 if a < 5 else 'boe'
assert b == 6
c = 2 + 4 if a > 5 else 'boe'
assert c == 'boe'
d = lambda x, y: x > y
assert d(5, 4)
e = lambda x: 1 if x else 0
assert e(True) == 1
assert e(False) == 0
try:
a = "aaaa" + \
"bbbb"
1/0
except ZeroDi... |
#credit: freecodecamp Youtube Channel
class Question:
def __init__ (self, prompt, answer):
self.prompt = prompt
self.answer = answer
|
# Copyright 2017 The Bazel Authors. 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... |
"""Exceptions for WLED."""
class WLEDError(Exception):
"""Generic WLED exception."""
pass
class WLEDConnectionError(WLEDError):
"""WLED connection exception."""
pass
|
class Solution:
def maximum69Number (self, num: int) -> int:
num = [n for n in str(num)]
for i, n in enumerate(num):
if n == '6':
num[i] = '9'
break
return int(''.join(num))
|
"""
The database package of the Python Discord API.
This package contains the ORM models, migrations, and
other functionality related to database interop.
"""
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 26 20:46:03 2018
@author: daniel
Given an array of integers, find the first missing positive integer in linear
time and constant space. In other words, find the lowest positive integer that
does not exist in the array. The array can contain duplica... |
# -*- coding: utf-8 -*-
"""
Editor: Zhao Xinlu
School: BUPT
Date: 2018-04-04
算法思想:翻转二叉树
"""
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def invertTree(self, root):
"""... |
# good example of using map
# from kata here
# https://www.codewars.com/kata/beginner-lost-without-a-map
def maps(a):
return list(map(lambda x: x * 2, a))
|
class Solution:
def flipEquiv(self, root1, root2):
"""
:type root1: TreeNode
:type root2: TreeNode
:rtype: bool
"""
if not root1 and not root2:
return True
if root1 and root2 and root1.val == root2.val:
ans1 = self.flipEquiv(root1.left... |
h,w,*hw = open(0).read().split()
h=int(h)
w=int(w)
e=h+w-1
a=sum([l.count('#') for l in hw])
if e==a:
print('Possible')
else:
print('Impossible')
|
nome = str(input('Digite o seu nome completo:')).strip()
print(f'Seu nome em maiúscula é {nome.upper()}')
print(f'Seu nome em minúscula é {nome.lower()}')
print(f'Seu nome tem ao todo {len(nome) - nome.count(" ")} letras.')
f = nome.split()
print(f[0])
g = len(f[0])
print(f"Seu primeiro nome tem {(g)} letras")
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.