content stringlengths 7 1.05M |
|---|
#Maciej Sudol 303073
#Elektronika AGH 3 rok
# zadanie zrealizowane w formie ksiazki adresowej
# imie nazwisko i rok urodzenia powinny byc podane w jednej linii
# wcisnij q by wyjsc i wyswietlic listę
lines =list()
print('Wprowadz imię, nazwisko oraz datę urodzenia:')
line=input('podaj dane:')
while line !='q':
... |
definition = [
{
"project_name" : "Project1",
"end_points": [
{
"local_development": "http://localhost:8066/",
"local_team_development": "http://192.168.5.217:8066/"
}
],
"api_end_point_partial_path": "api/"
}
]
|
print('----- range(3) -----')
print(range(3))
for x in range(3): print(x)
print('----- range(3, 10) -----')
print(range(3, 10))
for x in range(3, 10): print(x)
print('----- range(-3) -----')
print(range(-3))
for x in range(-3): print(x)
print('----- range(0,-3) -----')
print(range(0,-3))
for x in range(0,-3): print(x)
... |
# leetcode
class Solution:
def reverse(self, x: int) -> int:
str_x = str(x)
if str_x[:1] == "-":
isNeg = True
str_x = str_x[1:]
else:
isNeg = False
str_x = str_x[::-1]
new_x = int(str_x)
if isNeg:
... |
# -*- coding: utf-8 -*-
class UnknownServiceEnvironmentNotConfiguredError(Exception):
"""
Raised when unknown service-environment is not configured for plugin.
"""
pass
|
n = input()
# Reading first list
list1 = list(map(int, input().split()))
# Reading second list then to set
set1 = set(list(map(int, input().split())))
set2 = set(list(map(int, input().split())))
count = 0
# Looping through elements in
for el in list1:
# checking the element existence Set
if el in set1:
... |
pairs = {1: "apple",
"orange": [2,3,5],
True:False,
None:"True",
}
print(pairs.get("orange"))
print(pairs.get(7))
print(pairs.get(12345, "not in dictionary")) |
main = [{'category': 'Transfer Limits',
'field': [{'name': 'tx_transfer_min',
'title': 'Minimum amount a user can transfer per transaction',
'note': 'Default is set to zero.'},
{'name': 'tx_transfer_max_day',
'title': 'Maximum total... |
# Author: Luke Hindman
# Date: Tue Oct 24 13:10:06 MDT 2017
# Description: In-class example for user input and lists
# Create an empty grocery list
groceryList = []
# Shopping list loop
done = False
while done == False:
# Prompt the user for an item to add to the list
item = input("Please enter an item or ... |
space = [[1 for _ in range(21)] for _ in range(21)]
for x in range(1,21):
for y in range(1,21):
space[x][y] = space[x-1][y] + space[x][y-1]
print(space[20][20])
|
#4.6
def computepay(h,r):
# ( 40 hours * normal rate ) + (( overtime hours ) * time-and-a-half rate)
if(h>40):
p = ( 40 * r ) + (( h - 40 ) * 1.5 * r)
return p
else:
p = h * r
return p
hours = float(input("Enter Hours: "))
rate = float(input("Enter Rate per hour: "))
pay = ... |
class CellCountMissingCellsException(Exception):
pass
class UnknownAtlasValue(Exception):
pass
def atlas_value_to_structure_id(atlas_value, structures_reference_df):
line = structures_reference_df[
structures_reference_df["id"] == atlas_value
]
if len(line) == 0:
raise UnknownAtl... |
x = 'abc'
x = "abc"
x = r'abc'
x = 'abc' \
'def'
x = ('abc'
'def')
x = 'ab"c'
x = "ab'c"
x = '''ab'c'''
|
class DefaultConfig (object) :
root_raw_train_data = 'path to be filled' # downloaded training data root
root_raw_eval_data = 'path to be filled' # downloaded evaluation/testing data root
root_dataset_file = './dataset/' # preprocessed dataset root
root_train_volume = './dataset/train/' # preprocessed... |
def main():
n = int(input())
a = list(map(int,input().split()))
count2 = 0
count4 = 0
for e in a:
if e%2 == 0:
count2 += 1
if e%4 == 0:
count4 += 1
if n == 3 and count4:
print("Yes")
return
if count2 == n:
print("Yes")
r... |
class Solution:
def canPartition(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
total_sum = sum(nums)
if total_sum % 2 == 1:
return False
half_sum = total_sum//2
dp = [[0 for col in range(half_sum+1)] for row in range(len(nums))]
... |
class Node:
def __init__(self, game, parent, action):
self.game = game
self.parent = parent
self.action = action
self.player = game.get_current_player()
self.score = game.get_score()
self.children = []
self.visits = 0
def is_leaf(self):
... |
def product(x, y):
ret = list()
for _x in x:
for _y in y:
ret.append((_x, _y))
return ret
print(product([1, 2, 3], ["a", "b"]))
|
# configuration
class Config:
DEBUG = True
# db
SQLALCHEMY_DATABASE_URI = 'mysql://root:root@localhost/djangoapp'
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
class VaultConfig(object):
def __init__(self):
self.method = None
self.address = None
self.username = None
self.namespace = None
self.studio = None
self.mount_point = None
self.connect = False
|
# -*- coding: utf-8 -*-
# Copyright: (c) 2020, Garfield Lee Freeman (@shinmog)
class ModuleDocFragment(object):
# Standard files documentation fragment
DOCUMENTATION = r'''
'''
FACTS = r'''
notes:
- As this is a facts module, check mode is not supported.
options:
search_type:
descripti... |
#!/usr/bin/env python3
class Canvas(object):
def __init__(self, width, height):
self.width = width
self.height = height
self._area = []
for _ in range(height):
self._area.append([c for c in ' ' * width])
def _inside_canvas(self, x, y):
return 0 < x <= self.... |
'''
Praveen Manimaran
CIS 41A Spring 2020
Exercise A
'''
height = 2.9
width = 7.1
height = height// 2
width = width// 2
area = height*width
print("height: ",height)
print("width: ",width)
print("area: ",area) |
class A:
def __new__(cls, *args, **kwargs):
if not hasattr(cls, "_jaexiste"):
cls._jaexiste = object.__new__(cls)
def cumprimento(*args, **kwargs):
print("Olá Terráqueo")
cls.cumprimento = cumprimento
cls.nome = "NATALIA"
return super().__new__(cls)... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
class Solution:
def longestPalindrome(self,s):
dp = [[False for _ in range(len(s))] for _ in range(len(s))]
l,r = 0,0
for head in range(len(s)-2,0,-1):
for tail in range(head,len(s)):
if s[head] == s[tail] and (tail-he... |
#!/usr/bin/env python3
def part1():
data = open('day8_input.txt').read().splitlines()
one = 2 # 2 segments light up to display 1
four = 4
seven = 3
eight = 7
output = [i.rpartition('|')[2].strip() for i in data]
counter = 0
for i in range(len(output)):
strings = output[i... |
valores = input().split()
x, y = valores
x = float(x)
y = float(y)
if(x == 0.0 and y == 0.0):
print('Origem')
if(x == 0.0 and y != 0.0):
print('Eixo Y')
if(x != 0.0 and y == 0.0):
print('Eixo X')
if(x > 0 and y > 0):
print('Q1')
if(x < 0 and y > 0):
print('Q2')
if(x < 0 and y < 0):
pr... |
#! python3
# Configuration file for cf-py-importer
globalSettings = {
# FQDN or IP address of the CyberFlood Controller. Do NOT prefix with https://
"cfControllerAddress": "your.cyberflood.controller",
"userName": "your@login",
"userPassword": "yourPassword"
}
|
#OPCODE_Init = b"0"
OPCODE_ActivateLayer0 = b"1"
OPCODE_ActivateLayer1 = b"2"
OPCODE_ActivateLayer2 = b"3"
OPCODE_ActivateLayer3 = b"4"
OPCODE_NextAI = b"5"
OPCODE_NewTournament = b"6"
OPCODE_Exit = b"7" |
'''
This is how you work out whether if a particular year is a leap year.
on every year that is evenly divisible by 4
**except** every year that is evenly divisible by 100
**unless** the year is also evenly divisible by 400
'''
# 🚨 Don't change the code below 👇
year = int(input("Which year do you want t... |
class InvalidProtocolMessage(Exception):
"""Invalid protocol message function name"""
class InvalidHandshake(Exception):
"""Handshake message from peer is invalid"""
class InvalidAck(Exception):
"""Handshake message from peer is invalid"""
class IncompatibleProtocolVersion(Exception):
"""Protocol ... |
"""
Florian Guillot & Julien Donche: Project 7
Topic modeling and keywords extractions for Holi.io
Jedha Full Stack, dsmf-paris-13
08-2021
FILE NAME :
topic_text.py
OBJECTIVE :
This function use a pretrained topic_modeling model to associate topics to a text
INPUTS:
- 'model' : a topic modeling model that w... |
lista = []
print('type s to exit\ndigite s para sair')
while 1:
num = input('N: ')
if num == 's': break
else: lista.append(int(num))
lista.reverse()
print('lista reversa', lista)
print('foram digitados', len(lista), ' numeros')
print('numero 5 foi digitado' if 5 in lista else 'sem 5')
#Exercício Python 0... |
greek_alp = {
"Alpha" : "Alp",
"Beta" : "Bet",
"Gamma" : "Gam",
"Delta" : "Del",
"Epsilon" : "Eps",
"Zeta" : "Zet",
"Eta" : "Eta",
"Theta" : "The",
"Iota" : "Iot",
"Kappa" : "Kap",
"Lambda" : "Lam",
"Mu" : "Mu ",
"Nu" : "Nu ",
"Xi" : "Xi ",
"Omicron" : "Omi",
"Pi" : "Pi ",
"Rho" : "Rho",
"Sigma" : "Si... |
data = ["React", "Angular", "Svelte", "Vue"]
# or
data = [
{"value": "React", "label": "React"},
{"value": "Angular", "label": "Angular"},
{"value": "Svelte", "label": "Svelte"},
{"value": "Vue", "label": "Vue"},
]
|
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long
"""Reduce integer values in coords attributes comma separated list of html 3.2 map area elements."""
ENCODING = "utf-8"
ENCODING_ERRORS_POLICY = "ignore"
def apply_scaling(reduction_factor:int, text_line: str):
"""Apply the scaling if... |
FONT = "Arial"
FONT_SIZE_TINY = 8
FONT_SIZE_SMALL = 11
FONT_SIZE_REGULAR = 14
FONT_SIZE_LARGE = 16
FONT_SIZE_EXTRA_LARGE = 20
FONT_WEIGHT_LIGHT = 100
FONT_WEIGHT_REGULAR = 600
FONT_WEIGHT_BOLD = 900
|
# Copyright (c) 2021 Qianyun, Inc. All rights reserved.
class ValidationError(Exception):
"""The validation exception"""
message = "ValidationError"
def __init__(self, message=None):
self.message = message or self.message
super(ValidationError, self).__init__(self.message)
class FusionC... |
person = ('Nana', 25, 'piza')
# unpack mikonim person ro
# chandta ro ba ham takhsis midim
name, age, food = person
print(name)
print(age)
print(food)
person2 = ["ali", 26, "eli"]
name, age, food = person2
print(name)
print(age)
print(food)
# dictionary order nadare o nmishe tekrari dasht
dic = {'banana', 'bluebe... |
# -*- coding: utf-8 -*-
def main():
n = int(input())
a_score, b_score = 0, 0
for i in range(n):
ai, bi = map(int, input().split())
if ai > bi:
a_score += ai + bi
elif ai < bi:
b_score += ai + bi
else:
a_score += ai
b_score +... |
UPWARDS = 1
UPDOWN = -1
FARAWAY = 1.0e39
SKYBOX_DISTANCE = 1.0e6
|
class Solution:
def checkStraightLine(self, coordinates: [[int]]) -> bool:
(x1, y1), (x2, y2) = coordinates[:2]
for i in range(2, len(coordinates)):
x, y = coordinates[i]
if (y2 - y1) * (x1 - x) != (y1 - y) * (x2 - x1):
return False
return True
|
#coding: utf-8
LEFT = 'left'
X = 'x'
RIGHT = 'right'
WIDTH = 'width'
MAX_WIDTH = 'max_width'
MIN_WIDTH = 'min_width'
INNER_WIDTH = 'inner_width'
CENTER = 'center'
TOP = 'top'
Y = 'y'
BOTTOM = 'bottom'
HEIGHT = 'height'
MAX_HEIGHT = 'max_height'
MIN_HEIGHT = 'min_height'
INNER_HEIGHT = 'inner_height'
MIDDLE = 'middle'
G... |
#!/usr/bin/python
#
"""
Virtual superclass for all devices
Homepage and documentation: http://dev.moorescloud.com/
Copyright (c) 2013, Mark Pesce.
License: MIT (see LICENSE for details)
"""
__author__ = 'Mark Pesce'
__version__ = '0.1a'
__license__ = 'MIT'
class Device:
def __init__(self, dev):
self.dev = dev
... |
class Solution:
def validPalindrome(self, s: str) -> bool:
l, r = 0, len(s) - 1
while l < r:
if s[l] != s[r]:
return self._validPalindrome(s, l + 1, r) or self._validPalindrome(s, l, r - 1)
l += 1
r -= 1
return True
... |
# 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 isValidBST(self, root: Optional[TreeNode]) -> bool:
ary = []
self.traverse(root, ary)
... |
# -*- coding: utf-8 -*-
"""
This module provides the utilities used by the requester.
"""
def make_host(headers, dst_ip):
if "Host" in headers:
return headers["Host"]
elif "host" in headers:
return headers["host"]
else:
return dst_ip
def make_request_url(host, port, uri):
if... |
def solution(N, P):
ans = []
for c in P:
ans.append('S' if c == 'E' else 'E')
return ''.join(ans)
def main():
T = int(input())
for t in range(T):
N, P = int(input()), input()
answer = solution(N, P)
print('Case #' + str(t+1) + ': ' + answer)
if __name__ == '__main... |
# https://codeforces.com/problemset/problem/1220/A
n, s = int(input()), input()
ones = s.count('n')
zeros = (n-(ones*3))//4
print(f"{'1 '*ones}{'0 '*zeros}") |
# Reverse Nodes in k-Group: https://leetcode.com/problems/reverse-nodes-in-k-group/
# Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
# k is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of k the... |
def test_get_building_block_id(case_data):
"""
Test :meth:`.BondInfo.get_building_block_id`.
Parameters
----------
case_data : :class:`.CaseData`
A test case. Holds the bond info to test and the building
block id it should be holding.
Returns
-------
None : :class:`None... |
#Faço um mini-sistema que utilize o Interactive Help do Python. O usuário vai digitar o comando e o manual vai aparecer.
#Quando o usuário digitar a palavra 'FIM', o programa se encerrará. OBS:Use cores.
c = ('\033[m', # 0 - sem cor
'\033[0:0:41m', # 1 - vermelho
'\033[0:0:42m', # 2 - verde
'\03... |
# @Title: 跳跃游戏 II (Jump Game II)
# @Author: KivenC
# @Date: 2019-03-01 09:07:22
# @Runtime: 80 ms
# @Memory: 14.5 MB
class Solution:
def jump(self, nums: List[int]) -> int:
if len(nums) < 2:
return 0
i, step, jump_point, max_dis = 0, 0, 0, nums[0]
while i < len(nums):
... |
class Solution:
def isAnagram(self, s: str, t: str) -> bool:
h = {}
for i in s:
h[i] = h.get(i, 0) + 1
for j in t:
if h.get(j, 0) == 0:
return False
else:
h[j] -= 1
for k in h:
if h[k] >= 1:
... |
#!/usr/bin/env python
# descriptors from http://www.winning-homebrew.com/beer-flavor-descriptors.html
aroma_basic = [
'malty', 'grainy', 'sweet',
'corn', 'hay', 'straw',
'cracker', 'bicuity',
'caramel', 'toast', 'roast',
'coffee', 'espresso', 'burnt',
'alcohol', 'tobacco', 'gunpowder',
'lea... |
def get_fact(i):
if i==1:
return 1
else:
return i*get_fact(i-1)
t=int(input())
for i in range(t):
x=int(input())
print(get_fact(x)) |
# /Users/dvs/Dropbox/Code/graphql-py/graphql/parsetab.py
# This file is automatically generated. Do not edit.
_tabversion = '3.5'
_lr_method = 'LALR'
_lr_signature = 'CDC982EBD105CCA216971D7DA325FA06'
_lr_action_items = {'BRACE_L':([0,8,10,11,21,23,24,25,26,27,28,29,30,31,32,33,36,37,50,51,52,58,59,61,67,68,70,... |
a = list(map(int, input().split()))
if sum(a) < 22:
print("win")
else:
print("bust")
|
# for holding settings for use later
class IndividualSetting:
settingkey = ""
settingvalue = ""
|
#!/usr/bin/env python3
class Evaluate:
def __init__(self):
self.formula = []
self.result = ''
self.error = False
def eval(self, expression):
if (self.percent(expression)):
return self.result
if (self.sum(expression)):
return self.result
... |
#!/usr/bin/python3
#https://practice.geeksforgeeks.org/problems/bit-difference/0
def sol(a, b):
"""
Take an XOR, so 1 will be set whereever there is bit diff.
Keep doing AND with the number to check if the last bit is set
"""
c = a^b
count=0
while c:
if c&1:
count+=1
... |
# https://leetcode.com/explore/learn/card/n-ary-tree/130/traversal/925/
# N-ary Tree Preorder Traversal
#
# Given an n-ary tree, return the preorder traversal of its nodes'
# values.
# Definition for a Node.
class Node(object):
def __init__(self, val, children):
self.val = val
self.children = ch... |
#定义一个输入输出的函数
def writefilecontent():
circel = True
responses = []
while circel:
print("请开始输入")
print("退出请输入Q或q")
f_name = input("请输入您的姓名:")
f_place = input("请输入您的出生地:")
responses.append(f_name + " " + f_place)
f_quit = input("是否还要继续:请输入是或否")
if f_qui... |
def covert(df, drop, rename, inflow_source):
print(df)
result = df.copy()
outflow = []
inflow = []
for _, row in df.iterrows():
if row.get(inflow_source) >= 0:
inflow.append(row.get(inflow_source))
outflow.append(0)
else:
inflow.append(0)
... |
#-*-python-*-
def guild_python_workspace():
native.new_http_archive(
name = "org_pyyaml",
build_file = "//third-party:pyyaml.BUILD",
urls = [
"https://pypi.python.org/packages/4a/85/db5a2df477072b2902b0eb892feb37d88ac635d36245a72a6a69b23b383a/PyYAML-3.12.tar.gz",
],
... |
#
# PySNMP MIB module ENGENIUS-CLIENT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ENGENIUS-CLIENT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:02:54 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... |
# Habibu-R-ahman
# 7th Jan, 2021
a = float(input())
salary = money = percentage = None
if a <= 400:
salary = a * 1.15
percentage = 15
elif a <= 800:
salary = a * 1.12
percentage = 12
elif a <= 1200:
salary = a * 1.10
percentage = 10
elif a <= 2000:
salary = a * 1.07
percentage = 7
else... |
# -*- coding: utf-8 -*-
"""Top-level package for Generador Ficheros Agencia Tributaria."""
__author__ = """Pau Rosello Van Schoor"""
__email__ = 'paurosello@gmail.com'
__version__ = '0.1.1'
|
def arbitage(plen):
lst1=list(permutations(lst,plen))
for j in [[0]+list(i)+[0] for i in lst1]:
val=1
length=len(j)
print([x+1 for x in j])
index=0
for k in j:
if index+1>=length:
break
print("index:{}, index+1:{},val:{}".format(j[i... |
class Http:
def __init__(self, session):
self.session = session
async def download(self, url: str):
async with self.session.get(url, timeout=10) as res:
if res.status == 200:
return await res.read()
else:
return None
async def get_hea... |
"""
LeetCode Problem: 78. Subsets
Link: https://leetcode.com/problems/subsets/
Language: Python
Written by: Mostofa Adib Shakib
Time Complexity: O(n*2^n)
Space Complexity: O(n*2^n)
"""
# Solution 1
class Solution:
def subsets(self, nums: List[int]) -> List[List[int]]:
def recursiveHelper(index, ... |
# Pretty lame athlete model
LT = 160
REST_HR = 50
MAX_HR = 175
|
class Solution(object):
def findNthDigit(self, n):
"""
:type n: int
:rtype: int
"""
index = 1
result = 0
digit_num = 9 * 10 ** (index - 1)
while n > digit_num * index:
n -= digit_num * index
result += digit_num
ind... |
# Inputs
# ------
#
# Let’s define some inputs for the run:
#
# - **dataroot** - the path to the root of the dataset folder. We will
# talk more about the dataset in the next section
# - **workers** - the number of worker threads for loading the data with
# the DataLoader
# - **batch_size** - the batch size ... |
class User:
def __init__(self, id, first_name, last_name, email, account_creation_date):
self.id = id
self.first_name = first_name
self.last_name = last_name
self.email = email
self.account_creation_date = account_creation_date |
# Copyright (C) 2007 Samuel Abels
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distri... |
frase = 'Curso em video Python'
print(frase[5::2])
print('''jfafj aj fjaljsfkjasj fkasjfkaj sfjsajfljslkjjf
a fsjdfjs flasjfkldjfdjsfjasjfjaskjfsjfk sdkf
sjfsd fskjfs asfjlkds fjsf sdjflksjfslfs
s fslfjklsdjfsjfjlsjfklsjkfksldfk dsjfsdf''')
|
BRANCHES = {
'AdditiveExpression' : {
"!" : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
"(" : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
"+" : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
... |
class Solution:
def minSteps(self, s: str, t: str) -> int:
res = 0
dic = {}
for _ in s:
if _ in dic:
dic[_] += 1
else:
dic[_] = 1
for _ in t:
if _ in dic:
dic[_] -= 1
if not dic[_]:
... |
# * Daily Coding Problem August 25 2020
# * [Easy] -- Google
# * In linear algebra, a Toeplitz matrix is one in which the elements on
# * any given diagonal from top left to bottom right are identical.
# * Write a program to determine whether a given input is a Toeplitz matrix.
def checkDiagonal(mat, i, j):
r... |
# Initialize sum
sum = 0
# Add 0.01, 0.02, ..., 0.99, 1 to sum
i = 0.01
while i <= 1.0:
sum += i
i = i + 0.01
# Display result
print("The sum is", sum) |
"""
1. For $V>-75$ mV, the derivative is negative.
2. For $V<-75$ mV, the derivative is positive.
3. For $V=-75$ mV, the derivative is equal to $0$ is and a stable point.
""" |
print('-' * 15)
medida = float(input('Digite uma distancia em metros:'))
centimetros = medida * 100
milimetros = medida * 1000
print('A media de {} corresponde a {:.0f} e {:.0f}'.format(medida, centimetros, milimetros)) |
def exponentiation(base, exponent):
if isinstance(base, str) or isinstance(exponent, str):
return "Trying to use strings in calculator"
solution = float(base) ** exponent
return solution
|
#!/usr/bin/env python
# -*- coding: utf-8
"""
Taxonomy Resolver
:copyright: (c) 2020-2021.
:license: Apache 2.0, see LICENSE for more details.
"""
ncbi_ranks = [
"class",
"cohort",
"family",
"forma",
"genus",
"infraclass",
"infraorder",
"kingdom",
"order",
"parvorder",
"ph... |
#Ler 6 numeros inteiros e mostre a soma dqls q são par
s = 0
for c in range(0, 6):
n = int(input('\033[1;34mNÚMERO A SER ANALISADO: '))
if n % 2 == 0:
s += n
print('A soma dos valores pares é {}'.format(s))
|
# Curbrock's Revenge (5501)
SABITRAMA = 1061005 # NPC ID
CURBROCKS_HIDEOUT_VER3 = 600050020 # MAP ID
CURBROCKS_ESCAPE_ROUTE_VER3 = 600050050 # MAP ID 3
sm.setSpeakerID(SABITRAMA)
if sm.getFieldID() == CURBROCKS_ESCAPE_ROUTE_VER3:
sm.sendSayOkay("Please leave before reaccepting this quest again.")
else:
sm.s... |
#
# PySNMP MIB module CISCOSB-SECSD-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCOSB-SECSD-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:06:01 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... |
#
# @lc app=leetcode id=680 lang=python3
#
# [680] Valid Palindrome II
#
# @lc code=start
class Solution:
def validPalindrome(self, s: str) -> bool:
l, r = 0, len(s) - 1
while l < r:
if s[l] != s[r]:
pre, las = s[l:r], s[l + 1:r + 1]
return pre[::-1] == p... |
# Space/Time O(n), O(nLogn)
class Solution:
def merge(self, intervals: List[List[int]]) -> List[List[int]]:
# Sort intervals
intervals.sort(key=lambda x:x[0])
# start merged list and go through intervals
merged = [intervals[0]]
for si, ei in inter... |
start_range = int(input())
stop_range = int(input())
for x in range(start_range, stop_range + 1):
print(f"{(chr(x))}", end=" ") |
def brackets(sequence: str) -> bool:
brackets_dict = {"]": "[", ")": "(", "}": "{", ">": "<"}
stack = []
for symbol in sequence:
if symbol in "[({<":
stack.append(symbol)
elif symbol in "])}>":
if brackets_dict[symbol] != stack.pop():
return False
... |
def merge(left, right):
m = []
i,j = 0,0
k = 0
while i < len(left) and j < len(right):
# print(left,right,left[i], right[j])
if left[i] <= right[j]:
m.append(left[i])
i+=1
else:
m.append(right[j])
j +=1
if i < len(le... |
boxes = """cvfueihajytpmrdkgsxfqplbxn
cbzueihajytnmrdkgtxfqplbwn
cvzucihajytomrdkgstfqplqwn
cvzueilajytomrdkgsxfqwnbwn
cvzueihajytomrdkgsgwqphbwn
wuzuerhajytomrdkgsxfqplbwn
cyzueifajybomrdkgsxfqplbwn
cvzueihajxtomrdkgpxfqplmwn
ivzfevhajytomrdkgsxfqplbwn
cvzueihajytomrdlgsxfqphbbn
uvzueihajjtomrdkgsxfqpobwn
cvzupihajyto... |
# T Y P E O F V E R B S
def pert_subjective_verbs(texts_tokens):
total_verbs = 0
total_subj_verbs = 0
return
def pert_report_verbs(text_tokens):
return
def pert_factive_verbs(text_tokens):
return
def pert_imperative_commands(text_tokens):
return |
"""
AnalysisPipeline operators
"""
class AnalysisOperation:
"""
An analysis task performed by an AnalysisPipeline.
This is an internal class that facilitates keeping track of a
function, arguments, and keyword arguments that together represent a
single operation in a pipeline.
Parameters
... |
"""
* Assignment: CSV Format WriteListDict
* Complexity: medium
* Lines of code: 7 lines
* Time: 8 min
English:
1. Define `result: str` with `DATA` converted to CSV format
2. Non-functional requirements:
a. Do not use `import` and any module
b. Quotechar: None
c. Quoting: never
d. D... |
load("@rules_python//python:defs.bzl", "py_test")
pycoverage_requirements = [
"//tools/pycoverage",
]
def pycoverage(name, deps):
if not name or not deps:
fail("Arguments 'name' and 'deps' are required")
py_test(
name = name,
main = "pycoverage_runner.py",
srcs = ["//tools... |
filename = "test2.txt"
tree = [None]*16
with open(filename) as f:
line = f.readline().strip().strip('[]')
for c in line:
if c == ',':
continue
for line in f:
n = line.strip().strip('[]')
print(n) |
class Solution:
def searchMatrix(self, matrix, target):
i, j, r = 0, len(matrix[0]) - 1, len(matrix)
while i < r and j >= 0:
if matrix[i][j] == target:
return True
elif matrix[i][j] > target:
j -= 1
elif matrix[i][j] < target:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.