content stringlengths 7 1.05M |
|---|
class Configuracoes:
"""Armazena as configuracoes do jogo estrela."""
def __init__(self):
"""Inicializa as configuracoes do jogo."""
# Configuracoes de tela
self.tela_largura = 1200
self.tela_altura = 600
self.cor_fundo = (46, 46, 46)
|
"""Project Euler problem 9"""
def calculate(perimeter):
"""Returns the product a*b*c of a Pythagorean triplet for which a + b + c == perimeter"""
for a in range(1, perimeter):
if a > perimeter:
break
for b in range(1, perimeter):
if a + b > perimeter:
br... |
__author__ = "Jeremy Lainé"
__email__ = "jeremy.laine@m4x.org"
__license__ = "BSD"
__summary__ = "Python wrapper for the ls-qpack QPACK library"
__title__ = "pylsqpack"
__uri__ = "https://github.com/aiortc/pylsqpack"
__version__ = "0.3.5"
|
## Copyright 2020 Google LLC
##
## 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
##
## https://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in ... |
#=========================================================================================
class Job():
"""Represent job to-do in schedule"""
def __init__(self, aItineraryName, aItineraryColor, aTaskNumber, aItineraryNumber, aMachineName, aDuration):
self.itinerary = aItineraryName
self.machine... |
def palin(n,m):
if n<l//2:
if arr[n]==arr[m]:
return palin(n+1,m-1)
else:
return False
else:
return True
try:
arr= []
print(" Enter the array inputs and type 'stop' when you are done\n" )
while True:
arr.append(int(input()))
except:# if th... |
""" What are Python Packages?
Packages are just folders(directories) that contain modules.
They contain a special python file named:__init__.py
The __init__.py file can be empty. The file tells Python that the directory of folder contains a python package which can be imported like a module.
Packag... |
'''
Created on 1 dec. 2021
@author: laurentmichel
'''
class TableIterator(object):
'''
Simple wrapper iterating over table rows
'''
def __init__(self,
name,
data_table):
"""
Constructor
:param name: table name : not really used
:param ... |
# Celery配置文件
# 3.1指定中间人,消息队列,任务队列,容器,使用redis
broker_url = "redis://192.168.152.12/10"
|
__version__ = "v0.6.1-1"
__author__ = "Kanelis Elias"
__email__ = "hkanelhs@yahoo.gr"
__license__ = "MIT"
|
## https://leetcode.com/problems/count-and-say/
## this problem seems hard at first, but that's mostly
## because it's incredibly poorly described. went to
## wikipedia and it makes sense. for ease, I went ahead
## and hard-coded in the first 5; after that, we generate
## from the previous one.
## generating the ... |
soma = 0
for n in range(1, 500, 2):
if n % 3 == 0:
soma = soma + n
print(soma)
|
# Times Tables
# Ask the user to input the number they would like the times tables for
tTable = int(input("What number would you like to see the times table for? "))
# Loop through 12 times
for number in range(12):
print("{0} times {1} equals {2}" .format(number+1, tTable, (number+1) * tTable))
input()
|
expected_output = {
"GigabitEthernet3/8/0/38": {
"auto_negotiate": True,
"counters": {
"normal": {
"in_broadcast_pkts": 1093,
"in_mac_pause_frames": 0,
"in_multicast_pkts": 18864,
"in_octets": 0,
"in_pkts": 7... |
"""
Write an iterative implementation of a binary search function.
"""
def binary_search(haystack, needle):
first = 0
last = len(haystack) - 1
found = False
while first <= last and not found:
mid = (first + last) // 2
print('haystack is {}, mid is {}, first is {}, last is {}'.format(
... |
"""These keypoint formats are taken from https://github.com/CMU-Perceptual-
Computing-Lab/openpose/blob/master/src/openpose/pose/poseParameters.cpp."""
OPENPOSE_135_KEYPOINTS = [
'nose',
'left_eye',
'right_eye',
'left_ear',
'right_ear',
'left_shoulder',
'right_shoulder',
'left_elbow',
... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
__all__ = ['SE_Block',
]
'''see: Squeeze-and-Excitation Networks'''
def SE_Block(sym, data, num_out, name):
if type(num_out) ... |
__title__ = "access-client"
__version__ = "0.0.1"
__summary__ = "Client for accessai solutions"
__uri__ = "http://accessai.co"
__author__ = "ConvexHull Technology"
__email__ = "support@accessai.co"
__license__ = "Apache 2.0"
__release__ = True
|
'''
Write code to remove duplicates from an unsorted linked list.
FOLLOW UP
How would you solve this problem if a temporary buffer is not allowed?
'''
class Node(object):
def __init__(self, data=None, next_node=None):
self.data = data
self.next_node = next_node
def get_data(self):
ret... |
# @lc app=leetcode id=2139 lang=python3
#
# [2139] Minimum Moves to Reach Target Score
#
# https://leetcode.com/problems/minimum-moves-to-reach-target-score/
# @lc code=start
class Solution:
def minMoves(self, target: int, maxDoubles: int) -> int:
steps = 0
while maxDoubles > 0 and... |
# Truncatable primes
def prime_test_list(numbers):
return all(prime_test(elem) for elem in numbers)
def prime_test(num):
try:
if num == 2:
return True
if num == 0 or num == 1 or num % 2 == 0:
return False
for i in range(3, int(num**(1/2))+1, 2):... |
class RunnerMixin(object):
def add_artifacts(self, artifacts):
url = self._url('/runner/artifacts')
data = [{'filename': d} for d in artifacts]
return self._result(self.post(url, json={
'artifacts': data
}))
def add_logs(self, logs):
url = self._url('/runner... |
# -*- encoding: utf-8 -*-
"""
@File : __init__.py.py
@Time : 2020/2/29 11:57 AM
@Author : zhengjiani
@Email : 936089353@qq.com
@Software: PyCharm
"""
|
def load(h):
return ({'abbr': 'a', 'code': 1, 'title': '70 332.5 40 10'},
{'abbr': 'b', 'code': 2, 'title': '72.5 0 50 45'},
{'abbr': 'c', 'code': 3, 'title': '57.5 345 32.5 17.5'},
{'abbr': 'd', 'code': 4, 'title': '57.5 2.5 32.5 42.5'},
{'abbr': 'e', 'code': 5, 'tit... |
def inv_lr_scheduler(param_lr, optimizer, iter_num, gamma=10,
power=0.75, init_lr=0.001,weight_decay=0.0005,
max_iter=10000):
#10000
"""Decay learning rate by a factor of 0.1 every lr_decay_epoch epochs."""
#max_iter = 10000
gamma = 10.0
lr = init_lr * (1 +... |
"""A module with errors used in the qtools3 package."""
class XlsformError(Exception):
pass
class ConvertError(Exception):
pass
class XformError(Exception):
pass
class QxmleditError(Exception):
pass
|
description = 'Devices for the first detector assembly'
pvpref = 'SQ:ZEBRA:mcu3:'
excludes = ['wagen2']
devices = dict(
nu = device('nicos_ess.devices.epics.motor.EpicsMotor',
description = 'Detector tilt',
motorpv = pvpref + 'A4T',
errormsgpv = pvpref + 'A4T-MsgTxt',
precision = ... |
class Person:
def __init__(self, fname, lname):
self.firstname = fname
self.lastname = lname
def printname(self):
print(self.firstname, self.lastname)
#Use the Person class to create an object, and then execute the printname method:
x = Person("John", "Doe")
x.printname()
|
name = "Maedeh Ashouri"
for i in name:
print(i) |
# Copyright (c) 2017-2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
__all__ = ["ConfigError", "ConfigWarning"]
class ConfigError(ValueError):
pass
class ConfigWarning(Warning):
pass
|
# coding: utf-8
# In[3]:
class RuleClass:
attributes = []
attributes_value = []
attributes_cover = []
decision_cover =[]
false_cover =[]
Decision = ''
def __cmp__(self, other):
if self.strength > other.strength:
return 1
elif self.strength < other.strength:
... |
'''
Module for parsing spatial and temporal premises.
Created on 16.07.2018
@author: Christian Breu <breuch@web.de>, Julia Mertesdorf <julia.mertesdorf@gmail.com>
'''
# Global variable enabling function-prints. Mainly used for debugging purposes.
PRINT_PARSING = False # global variable for whether to print ... |
def convert_lambda_to_def(string):
args=string[string.index("lambda ")+7:string.index(":")]
name=string[:string.index(" ")]
cal=string[string.index(":")+2:]
return f"def {name}({args}):\n return {cal}" |
# -*- coding: utf-8 -*-
class SigfoxBaseException(BaseException):
pass
class SigfoxConnectionError(SigfoxBaseException):
pass
class SigfoxBadStatusError(SigfoxBaseException):
pass
class SigfoxResponseError(SigfoxBaseException):
pass
class SigfoxTooManyRequestsError(SigfoxBaseException):
pass... |
#63 Escreva um programa que leia um número N inteiro qualquer e mostre na tela os N primeiros elementos de uma Sequência de Fibonacci.
termos = int(input('Quantos termos você quer mostrar? '))
termo1 = 0
termo2 = termo3 = 1
atual = termos
while termos > 0:
if termos == 2:
print(f'{termo1} → {termo2}', end=... |
#To find factorial of number
num = int(input('N='))
factorial = 1
if num<0:
print('Number is not accepted')
elif num==0:
print(1)
else:
for i in range(1,num+1):
factorial = factorial * i
print(factorial)
|
income = float(input())
gross_pay = income
taxes_owed = income * .12
net_pay = gross_pay - taxes_owed
print(gross_pay)
print(taxes_owed)
print(net_pay) |
'''Plotting utility functions'''
def remove_top_right_borders(ax):
'''Remove top and right borders from Matplotlib axis'''
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
ax.xaxis.set_ticks_position('bottom')
ax.yaxis.set_ticks_position('left')
|
first_wire = ['R8', 'U5', 'L5', 'D3']
second_wire = ['U7', 'R6', 'D4', 'L4']
def wire_path(wire):
path = {}
x = 0
y = 0
count = 0
dirs = {"R": 1,
"L": -1,
"U": 1,
"D": -1}
for i in wire:
dir = i[0]
mov = int(i[1:])
for _ in range(mov... |
class Solution:
def calculate(self, s: str) -> int:
stack = [1]
sign = 1
res = 0
i = 0
while i < len(s):
if s[i].isdigit():
val = 0
while i < len(s) and s[i].isdigit():
val = val * 10 + int(s[i])
... |
class Astronaut:
def __init__(self, name, age=30, agency='NASA'):
self.name = name
self.agency = agency
self.age = age
jose = Astronaut(name='José Jiménez')
ivan = Astronaut(name='Иван Иванович', agency='Roscosmos')
jose.agency # NASA
ivan.agency # Roscosmos
|
class Calculator:
def __init__(self, ss, am, fsp, sc, isp, bc, cgtr):
self.ss = ss
self.am = int(am)
self.fsp = float(fsp)
self.sc = float(sc)
self.isp = float(isp)
self.bc = float(bc)
self.cgtr = float(cgtr)
def get_pc(self):
pc = self.am * self.... |
'''
Faça um Programa que peça as quatro notas de 10 alunos, calcule e
armazene num vetor a média de cada aluno,
imprima o número de alunos com média maior ou igual a 7.0.
'''
medias = []
for x in range(1, 11):
soma, media = 0, 0
for y in range(1, 5):
n = float(input(f'Digite sua {y}ª notado {x}º Aluno... |
"""igcollect - Library Entry Point
Copyright (c) 2018 InnoGames GmbH
"""
|
# -*- coding: utf-8 -*-
"""The Windows Registry definitions."""
KEY_PATH_SEPARATOR = '\\'
# The Registry value types.
REG_NONE = 0
REG_SZ = 1
REG_EXPAND_SZ = 2
REG_BINARY = 3
REG_DWORD = 4
REG_DWORD_LITTLE_ENDIAN = 4
REG_DWORD_LE = REG_DWORD_LITTLE_ENDIAN
REG_DWORD_BIG_ENDIAN = 5
REG_DWORD_BE = REG_DWORD_BIG_ENDIAN
R... |
# V0
# V1
# https://blog.csdn.net/fuxuemingzhu/article/details/79343638
# IDEA : DFS
class Solution(object):
def combinationSum2(self, candidates, target):
"""
:type candidates: List[int]
:type target: int
:rtype: List[List[int]]
"""
candidates.sort()
prin... |
'''
https://leetcode.com/problems/maximum-length-of-pair-chain/solution/
You are given n pairs of numbers. In every pair, the first number is always smaller than the second number.
Now, we define a pair (c, d) can follow another pair (a, b) if and only if b < c. Chain of pairs can be formed in this fashion.
Given a ... |
class Error(Exception):
"""Base class for exceptions in this module."""
pass
class RobotError(Error):
"""Exception raised for robot detection (solvable).
Attributes:
message -- explanation of the error
"""
def __init__(self):
self.message = "Robot Check Detected."
class AQErr... |
lilly_dict = {"name": "Lilly",
"age": 18,
"pets": False,
"hair_color": 'Black'}
class Person(object):
def __init__(self, name, age, pets, hair_color):
self.name = name
self.age = age
self.pets = pets
self.hair_color = hair_color
self.hungry = True
... |
"""
Exercise 13 - Inventory Management
"""
def create_inventory (items):
"""
:param items: list - list of items to create an inventory from.
:return: dict - the inventory dictionary.
"""
return add_items ({}, items)
def add_items (inventory, items):
"""
:param inventory: dict - dictio... |
startMsg = 'counting...'
endMsg = 'launched !'
count = 10
print (startMsg)
while count >= 0 :
print (count)
count -= 1
print (endMsg) |
# 1. 两数之和
class Solution:
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
# n=len(nums)
# for i in range(n):
# result=target-nums[i]
# for j in range(i+1,n):
# if result=... |
def multiple_letter_count(string):
return {letter: string.count(letter) for letter in string}
print(multiple_letter_count('awesome'))
|
animals = ['bear', 'python', 'peacock', 'kangaroo', 'whale', 'platypus']
print("The animal at 1. ", animals[1])
print("The third (3rd) animal. ", animals[3-1])#This is the n - 1 trick
print("The first (1st) animal. ", animals[0])
print("The animal at 3. ", animals[3])
print("The fifth (5th) animal. ", animals[4])
print... |
"""
Created on 八月 03 2017
@author: dev.erxuan@gmail.com
"""
# -*- coding: utf-8 -*-
# 已知数组python列表a = [99,66,25,10,3],并且是已经排序过的。现在要求,将a数组的元素逆向排序
a = [99,66,25,10,3]
if __name__ == "__main__":
N = len(a)
print(a)
print(len(a)/2)
for i in range(len(a)//2):
a[i],a[N-i-1] = a[N-i-1],a[i]
print(... |
"""
Pattern matching with mapping—requires Python ≥ 3.10
# tag::DICT_MATCH_TEST[]
>>> b1 = dict(api=1, author='Douglas Hofstadter',
... type='book', title='Gödel, Escher, Bach')
>>> get_creators(b1)
['Douglas Hofstadter']
>>> from collections import OrderedDict
>>> b2 = OrderedDict(api=2, type='book',
... ... |
"""Faça um programa que leia um número qualquer e mostre o seu fatorial.
Exemplo: 5! = 5 x 4 x 3 x 2 x 1 = 120"""
n = int(input('Digite um número para calcular seu fatorial: '))
c = n
f = 1
while c > 0:
print('{}'.format(c), end='')
print(' x ' if c > 1 else ' = ', end= '')
f = f * c
c-= 1
print('{}'.fo... |
__author__ = "Douglas Lassance"
__copyright__ = "2020, Douglas Lassance"
__email__ = "douglassance@gmail.com"
__license__ = "MIT"
__version__ = "0.1.0.dev5"
|
# Copyright (c) 2019 The DAML Authors. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load("//bazel_tools:pkg.bzl", "pkg_tar")
# taken from rules_proto:
# https://github.com/stackb/rules_proto/blob/f5d6eea6a4528bef3c1d3a44d486b51a214d61c2/compile.bzl#L369-L393
def get_plugin_runfiles(tool, plugin_runfiles... |
'''
Unit Test Cases for JSON2HTML
Description - python wrapper for converting JSON to HTML Table format
(c) 2013 Varun Malhotra. MIT License
'''
__author__ = 'Varun Malhotra'
__version__ = '1.1.1'
__license__ = 'MIT'
|
# bubble_sort
# Bubble_sort uses the technique of comparing and swapping
def bubble_sort(lst):
for passnum in range(len(lst) - 1, 0, -1):
for i in range(passnum):
if lst[i] > lst[i + 1]:
temp = lst[i]
lst[i] = lst[i + 1]
lst[i + 1] = temp
lst = ... |
def tip(total, percentage):
tip = (total * percentage) / 100
return tip
print(tip(24, 13))
|
""""""
"""
# Floyd's Tortoise and Hare
[Reference : wiki](https://en.wikipedia.org/wiki/Cycle_detection)
## Description
Floyd's cycle-finding algorithm is a pointer algorithm that uses only two pointers, which move through the sequence at
different speeds. It is also called the "tortoise and the hare algorithm"
Che... |
class Solution:
def validPalindrome(self, s: str) -> bool:
return self.isValidPalindrome(s, False)
def isValidPalindrome(self, s: str, did_delete: bool) -> bool:
curr_left = 0
curr_right = len(s) - 1
while curr_left < curr_right:
# If left and right char... |
# -*- coding: utf-8 -*-
SPELLINGS_MAP={
"accessorise":"accessorize",
"accessorised":"accessorized",
"accessorises":"accessorizes",
"accessorising":"accessorizing",
"acclimatisation":"acclimatization",
"acclimatise":"acclimatize",
"acclimatised":"acclimatized",
"acclimatises":"acclimatizes",
"acclimatising":"acclimatiz... |
n = int(input())
while n != -1:
prev_time = 0
total = 0
for _ in range(n):
(speed, time) = map(int, input().split(" "))
total += (time - prev_time) * speed
prev_time = time
print(total, "miles")
n = int(input())
|
"""
URL: https://codeforces.com/problemset/problem/753/A
Author: Safiul Kabir [safiulanik at gmail.com]
Tags: dp, greedy, math, *1000
"""
n = int(input())
count = 0
a = []
summ = 0
for i in range(1, n + 1):
summ += i
if summ > n:
break
count += 1
a.append(i)
if summ > n:
a[-1] += n - summ +... |
"""Given a linked list, return the node where the cycle begins. If there is no cycle, return null.
Note: Do not modify the linked list.
Follow up:
Can you solve it without using extra space?
"""
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
def detect_cycle(h... |
class Node:
_fields = []
def __init__(self, *args):
for key, value in zip(self._fields, args):
setattr(self, key, value)
def __repl__(self):
return self.__str__()
# literals...
class Bool(Node):
_fields = ["value"]
def __str__(self):
string = "Boolean=" + s... |
def enum(**enums):
return type('Enum', (), enums)
control = enum(CHOICE_BOX = 0,
TEXT_BOX = 1,
COMBO_BOX = 2,
INT_CTRL = 3,
FLOAT_CTRL = 4,
DIR_COMBO_BOX = 5,
CHECKLIST_BOX = 6,
LISTBOX_COMBO = 7,
... |
'''
At CodingNinjas, we love to play with marbles. We have many marble games, but the most popular one is “Target Marbles”. Now, our marbles are unique. Each marble has a number on it.
In Target Marbles, the player is given a number in the starting and this number is called target. The player is also given N number of ... |
"""
Given a binary tree, return the zigzag level order traversal of its nodes'
values. (ie, from left to right, then right to left for the next level and
alternate between).
For example:
Given binary tree {3,9,20,#,#,15,7},
3
/ \
9 20
/ \
15 7
return its zigzag level order traversal as:
[
[3],
... |
'''
lanhuage: python
Descripttion:
version: beta
Author: xiaoshuyui
Date: 2020-09-15 13:53:11
LastEditors: xiaoshuyui
LastEditTime: 2020-09-22 11:20:14
'''
__version__ = '0.0.0'
__appname__ = 'show and search'
|
def contains_magic_number(list1, magic_number):
for i in list1:
if i == magic_number:
print("This list contains the magic number")
# if not add break , will run more meaningless loop
break
else:
print("This list does NOT contain the magic number")
if... |
def dfs_inorder(tree):
if tree is None: return None
out = []
dfs_inorder(tree.left)
out.append(tree.value)
print(tree.value)
dfs_inorder(tree.right)
return out
def dfs_preorder(tree):
if tree is None: return None
out = []
out.append(tree.value)
print(tree.value)
dfs_... |
def round_down(num, digits: int):
a = float(num)
if digits < 0:
b = 10 ** int(abs(digits))
answer = int(a * b) / b
else:
b = 10 ** int(digits)
answer = int(a / b) * b
assert not(not(-0.01 < num < 0.01) and answer == 0)
return answer
|
INPUT = {
2647: [
list("#....#####"),
list(".##......#"),
list("##......##"),
list(".....#..#."),
list(".........#"),
list(".....#..##"),
list("#.#....#.."),
list("#......#.#"),
list("#....##..#"),
list("...##....."),
],
1283: [... |
def solve(s):
if s==s[::-1]:
return 1
else:
return 0
s=str(input())
print(solve(s))
|
print('=' * 50)
print('AVALIADOR DE MÉDIA'.center(50, '-'))
print('=' * 50)
# Recebendo os valores e calculando a média
nota1 = float(input('Primeira nota do aluno: '))
nota2 = float(input('Segunda nota do aluno: '))
media = (nota1 + nota2) / 2
print(f'A média do aluno é: {media}')
# Mensagem de acordo com cada re... |
"""Effects"""
class FxName:
"""FX name"""
def __init__(self, name):
self.name = name
BITCRUSHER = FxName('bitcrusher')
COMPRESSOR = FxName('compressor')
ECHO = FxName('echo')
FLANGER = FxName('flanger')
KRUSH = FxName('krush')
LPF = FxName('lpf')
PAN = FxName('pan')
PANSLICER = FxName('panslicer')
R... |
# Copyright (c) 2017-2017 Cisco Systems, Inc.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... |
message = [ 'e', 'k', 'a', 'c', ' ',
'd', 'n', 'u', 'o', 'p', ' ',
'l', 'a', 'e', 't', 's']
def reversed_words(message):
cur_pos = 0
end_pos = len(message)
current_word_start = cur_pos
while cur_pos < end_pos:
if message[cur_pos] == ' ':
message[current_word... |
def bubble_sort(arry):
n = len(arry) #获得数组的长度
for i in range(n):
for j in range(1,n-i):
if arry[j-1] > arry[j] : #如果前者比后者大
arry[j-1],arry[j] = arry[j],arry[j-1] #则交换两者
return arry
|
class EquationClass:
def __init__(self):
pass
def calculation(self):
...
def info(self):
...
|
class BufferFile:
def __init__(self, write):
self.write = write
def readline(self): pass
def writelines(self, l): map(self.append, l)
def flush(self): pass
def isatty(self): return 1
|
# Class could be designed to be used in cooperative multiple inheritance
# so `super()` could be resolved to some non-object class that is able to receive passed arguments.
class Shape(object):
def __init__(self, shapename, **kwds):
self.shapename = shapename
# in case of ColoredShape the call below wil... |
# Space Walk
# by Sean McManus
# www.sean.co.uk / www.nostarch.com
WIDTH = 800
HEIGHT = 600
player_x = 500
player_y = 550
def draw():
screen.blit(images.backdrop, (0, 0))
|
def countPaths(maze, rows, cols):
if (maze[0][0] == -1):
return 0
# Initializing the leftmost column
for i in range(rows):
if (maze[i][0] == 0):
maze[i][0] = 1
# If we encounter a blocked cell in
# leftmost row, there is no way of
# visiting any cell directly below it.
else:
break
# Si... |
idade = 20
salario = 490.00
nome = 'Mirella'
verdadeiro = True
falso = False
print('='*50, '\n'*2)
print('\n')
print('Calypso mania')
print('Exalta mania')
print('\tMirella Ohana Bardini','\tApelido: Mi ')
print('Blumenau/SC')
print('HBSIS', '\n'*2)
print(idade)
print('\n'*1)
print(salario)
print('\n'*1)
print(... |
n,s,t=map(int,input().split())
w=c=0
for i in range(n):
w+=int(input())
c+=s<=w<=t
print(c) |
'''
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
'''
# find the factors of num using modulus operator
num = 600851475143
div = 2
highestFactor = 1
while num > 1:
if(num%div==0):
num = num/div
highestFactor = div
else:
di... |
# Problem Statement: https://www.hackerrank.com/challenges/map-and-lambda-expression/problem
cube = lambda x: x**3
def fibonacci(n):
fib = [0, 1]
for i in range(2, n):
fib.append(fib[i - 1] + fib[i - 2])
return fib[0:n] |
def multiply_by(a, b=2, c=1):
return a * b + c
print(multiply_by(3, 47, 0)) # Call function using custom values for all parameters
print(multiply_by(3, 47)) # Call function using default value for c parameter
print(multiply_by(3, c=47)) # Call function using default value for b parameter
print(multiply_by(3)) ... |
############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
# accordance with the co... |
# -*- coding: utf-8 -*-
# @Time : 2018/8/13 16:45
# @Author : Dylan
# @File : config.py
# @Email : wenyili@buaa.edu.cn
class Config():
train_imgs_path = "images/train/images"
train_labels_path = "images/train/label"
merge_path = ""
aug_merge_path = "deform/deform_norm2"
aug_train_path = "de... |
tile_colors = {}
for _ in range(400):
path = input()
i = 0
pos_north = 0.0
pos_east = 0.0
while i < len(path):
if path[i] == 'e':
pos_east += 1.0
i += 1
elif path[i] == 'w':
pos_east -= 1.0
i += 1
elif path[i] == 'n' and path... |
# Copyright 2018 Inap.
#
# 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 writing, softwa... |
function_classes = {}
class RegisteringMetaclass(type):
def __new__(*args): # pylint: disable=no-method-argument
cls = type.__new__(*args)
if cls.name:
function_classes[cls.name] = cls
return cls
class Function(metaclass=RegisteringMetaclass):
name = None
min_args =... |
load("@bazel_skylib//lib:shell.bzl", "shell")
load("//:golink.bzl", "gen_copy_files_script")
def go_proto_link_impl(ctx, **kwargs):
print("Copying generated files for proto library %s" % ctx.attr.dep[OutputGroupInfo])
return gen_copy_files_script(ctx, ctx.attr.dep[OutputGroupInfo].go_generated_srcs.to_list())
... |
# -*- coding: utf-8 -*-
"""Responses.
responses serve both testing purpose aswell as dynamic docstring replacement.
"""
responses = {
"_v3_HistoricalPositions": {
"url": "/openapi/hist/v3/positions/{ClientKey}",
"params": {
'FromDate': '2019-03-01',
'ToDate': '2019-03-10'
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.