content stringlengths 7 1.05M |
|---|
''' Crie um programa que leia a idade e o sexo de várias pessoas. A cada pessoa cadastrada, o programa deverá perguntar se o usuário quer ou não continuar. No final, mostre:
A) quantas pessoas tem mais de 18 anos.
B) quantos homens foram cadastrados.
C) quantas mulheres tem menos de 20 anos. '''
print(f' === Cadastro... |
POSITION = "position"
FORCE = "force"
TOTAL_ENERGY = "total_energy"
PER_ATOM_ENERGY = "per_atom_energy"
CELL = "cell"
NATOMS = "natoms"
PER_FRAME_ATTRS = "per_frame_attrs"
METADATA_ATTRS = "metadata_attrs"
FIXED_ATTRS = "fixed_attrs"
DIM = "dimension"
SPECIES = "species"
STRESS = "stress"
VELOCITY = "velocity"
|
# the following line reads the list from the input; do not modify it, please
numbers = [int(num) for num in input().split()]
print(numbers[16:3:-1]) # the line with an error
|
# Copyright 2013 The Swarming Authors. All rights reserved.
# Use of this source code is governed by the Apache v2.0 license that can be
# found in the LICENSE file.
"""Configures includes (appstats and components.auth).
https://developers.google.com/appengine/docs/python/tools/appengineconfig
"""
appstats_CALC_RPC_... |
userReply = input("Do you need to ship a package? (Enter yes or no) ")
if userReply == "yes":
print("We can help you ship that package!")
else:
print("Please come back when you need to ship a package. Thank you.")
userReply = input("Would you like to buy stamps, buy an envelope, or make a copy? (Enter... |
"""
'||
|| ... ... ... .. .. ..
||' || || || || || ||
|| | || || || || ||
'|...' '|..'|. .|| || ||.
Created by Dylan Araps
"""
__version__ = "0.1.3"
|
"""Default input parameters used in command line inface."""
mode = 'normal'
size = 1
fps = 20
cmap = 'hot'
output = ''
pixel_num = -1 |
a = 'Tell mme somehting , I will give you feed back'
a += '\n(Enter quit to leave)'
message = ''
while message !='quit':
message = input(a)
if message == 'quit':
break
else:
print(message) |
class InvalidEventType(Exception):
def __init__(self, event_type_passed):
self._event_type_value = type(event_type_passed)
def __str__(self):
return f"An invalid event type: {self._event_type_value} was passed. An event type must be a string!"
|
"""
ind the total area covered by two rectilinear rectangles in a 2D plane.
Each rectangle is defined by its bottom left corner and top right corner as shown in the figure.
Rectangle Area
Assume that the total area is never beyond the maximum possible value of int.
"""
__author__ = 'Daniel'
class Solution:
def ... |
class PdbNotFoundError(LookupError):
"""PDB query returned a 404 Not Found"""
def __init__(self, tag, pk):
msg = f"pdb missing {tag}/{pk}"
super().__init__(msg)
|
def subset(A, B):
return A.issubset(B)
if __name__ == '__main__':
no_T = int(input()) # no. of test cases
for i in range(no_T):
no_A = int(input()) # no. of elements in A
A = set(map(int, input().split())) # elements of A
no_B = int(input()) # no. of elements in B
B = se... |
# Time: O(n)
# Space: O(1)
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
def __repr__(self):
if self:
return "{} -> {}".format(self.val, repr(self.next))
class Solution(object):
# @param head, a ListNode
# @return nothi... |
# PIGEONHOLE SORT
# This is a non-comparison based sorting algorithm that works for
# arrays where number of elements and the range of possible key values are approximately the
# same. To perform this sort, we need to make some holes. The number of holes needed is decided
# by the range of numbers. In each hole, items... |
#!/usr/bin/env python
"""
CREATED AT: 2021/7/24
Des:
https://leetcode.com/problems/check-if-all-characters-have-equal-number-of-occurrences
https://leetcode.com/contest/biweekly-contest-57/problems/check-if-all-characters-have-equal-number-of-occurrences/
GITHUB: https://github.com/Jiezhi/myleetcode
"""
class Solutio... |
#!/usr/bin/env python3
if __name__ == "__main__":
with open("./seedpool.txt", "r") as inf, open("./seedpool.h", "w") as ouf:
ouf.write("#ifndef SEED_POOL_H_\n#define SEED_POOL_H_\n\n"
"#include <vector>\n\nnamespace pbsutil {\n")
ouf.write("std::vector<uint> loadSeedPool() {\n"
... |
with open('./PrimeraMuestraSceneFrame.map') as f:
content = f.readlines()
with open('./PrimeraMuestraSceneFrame2.map', 'w') as f2:
first = True;
for line in content:
l = line.split(' ');
f2.write(str(int(l[0])+450)+" "+l[1]+"\n");
|
class UnionFind:
"""An implementation of union find data structure.
It uses union by rank with path compression.
"""
def __init__(self, count):
self._elements = list(range(count))
self._count = count
self._rank = [0] * count
def __len__(self):
return self._count
... |
#!/usr/bin/env python
# Software License Agreement (MIT License)
#
# Copyright (c) 2020, tri_star
# All rights reserved.
#
# 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... |
class TestMySQLCLi:
def test_create_mysql_client_command(self, return_bck_obj):
result = '/usr/bin/mysql --defaults-file= -uroot --password=12345 --socket=/var/run/mysqld/mysqld.sock -e "select 1"'
sql = "select 1"
assert return_bck_obj.mysql_cli.create_mysql_client_command(sql) == result
... |
# API contants
FAN_MODE_AWAY = 'away'
FAN_MODE_LOW = 'low'
FAN_MODE_MEDIUM = 'medium'
FAN_MODE_HIGH = 'high'
# Commands
CMD_FAN_MODE_AWAY = b'\x84\x15\x01\x01\x00\x00\x00\x00\x01\x00\x00\x00\x00'
CMD_FAN_MODE_LOW = b'\x84\x15\x01\x01\x00\x00\x00\x00\x01\x00\x00\x00\x01'
CMD_FAN_MO... |
# OpenWeatherMap API Key
api_key = "KEY HERE PLEASE"
# Google API Key
g_key = "KEY HERE PLEASE"
|
"""
Function Basics I - No Input
"""
# Write a and call a function called "rand_list" that generates a list of 5 random numbers between 1 and 500. Print out that list.
|
# 读取Properties配置文件
class Properties:
def __init__(self, file=None, separator="=", ignore_case=False):
self.properties = {}
self.lines = None
self.separator = separator
self.ignore_case = ignore_case
if file is not None:
with open(file) as f:
self... |
#
# PySNMP MIB module DGS-6600-ID-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DGS-6600-ID-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:30:02 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... |
"""LevelNet configuration information.
"""
#: String with host which is serving FIB-B data
NETWORK_HOST = '192.168.15.39'
#: Integer with port number on NETWORK_HOST serving FIS-B data
NETWORK_PORT = 3333
#: If ``True``, print errors to sys.stderr. Otherwise errors are silent.
PRINT_ERRORS = False
|
class Solution(object):
def numDecodings(self, s):
"""
:type s: str
:rtype: int
"""
# A..Z 1..26
mod = 10 ** 9 + 7
e0, e1, e2 = 1, 0, 0
for c in s:
if c == '*':
f0 = 9 * e0 + 9 * e1 + 6 * e2
f1 = f2 = e0
... |
"""
Copyright (C) 2020 Shandong University
This program is licensed under the GNU General Public License 3.0
(https://www.gnu.org/licenses/gpl-3.0.html).
Any derivative work obtained under this license must be licensed
under the GNU General Public License as published by the Free
Software F... |
__all__ = ["directory"]
def package_name() -> str:
return "timer-for-python"
def package_install_name() -> str:
return "timer-for-python"
|
"""
Title: Klees Algorithm
Description:
Given starting and ending positions of segments on a line, the
task is to take the union of all given segments and find length
covered by these segments.
Examples:
Input : segments[] = {{2, 5}, {4, 8}, {9, 12}}
Output : 9
segment 1 = {2, 5}
segment 2 =... |
{
"targets": [
{
"target_name": "storm-replay",
"sources": [
"src/storm-replay.cpp",
"src/StormLib/src/adpcm/adpcm.cpp",
"src/StormLib/src/huffman/huff.cpp",
"src/StormLib/src/sparse/sparse.cpp",
"src/StormLib/src/FileStream.cpp",
"src/StormLib/src/SBas... |
#!/usr/bin/env python
tableData = [['apples', 'oranges', 'cherries', 'banana'],
['Alice', 'Bob', 'Carol', 'David'],
['dogs', 'cats', 'moose', 'goose']]
widthTable = [0] * len(tableData)
def getMaxWidth():
for i in range(len(tableData)):
maxLen = -1
for j in range(len(tabl... |
# coding: utf-8
n = int(input())
if n%2==1:
print(-1)
else:
print(' '.join([str(i+1) if i%2==1 else str(i-1) for i in range(1,n+1)]))
|
class DrawSVG:
def __init__(self, width: str, height: str) -> None:
"""
仮のコード
:param width: svg画像の横幅
:param height: svg画像の高さ
"""
self.width = width
self.height = height
def svgStart1(self) -> str:
"""
svg描画開始
:return base1 + base2:... |
a, b = map(int,input().split())
while a > 0 and b > 0:
if a > b:
a, b = b, a
seq = ' '.join(str(c) for c in range(a, b+1))
print("{} Sum={}".format(seq, sum(range(a,b+1))))
a, b = map(int, input().split())
|
# cmatrix 数据雨
# s1 火车
# cowsay hello 牛说你好
# chr()将整形转换成该编码对应的字符串(一个字符)
# ord()将字符串(一个字符)转换成对应的编码(整数)
# format可以任何类型
# id(x)查看内存地址
# is与== is快 每个字符对应一个内存地址
# in时判断在容器中(可迭代对象)有没有这个东西
# 能被for循环的叫可迭代对象
# +=自加
#切片是一个前闭后开的区间
#[satrt:end:step]
#[开始:结束:间隔]
#命名变量要见名思意
#一到一百相加的和:
# def sum():
# sum = 0... |
# Day 0: Weighted Mean
# Enter your code here. Read input from STDIN. Print output to STDOUT
__author__ = "Sanju Sci"
__email__ = "sanju.sci9@gmail.com"
__copyright__ = "Copyright 2019"
class Day0(object):
def __init__(self):
pass
def mean(self, values: list, n) -> int:
result = 0
... |
bedroom_choices = {
'1': 1,
'2': 2,
'3': 3,
'4': 4,
'5': 5,
'6': 6,
'7': 7,
'8': 8,
'9': 9,
'10': 10
}
price_choices = {
'10000': "kshs10,000",
'25000': "kshs25,000",
'50000': "kshs50,000",
'75000': "kshs75,000",
'100000': "kshs100,000",
'150000': "kshs15... |
print('====== DESAFIO 54 ======')
biggerAge = 0
smallerAge = 0
for yearBirth in range(0, 7):
age = int(input('Digite a sua idade: '))
if age >= 21:
biggerAge += 1
else:
smallerAge += 1
print(f'{smallerAge} Pessoas ainda não atingiram a maior idade')
print(f'{biggerAge} Pessoas já atingiram a... |
"""
332. Reconstruct Itinerary
Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order. All of the tickets belong to a man who departs from JFK. Thus, the itinerary must begin with JFK.
Note:
If there are multiple valid itineraries, you sho... |
emotions = {
0: 'angry',
1: 'calm',
2 : 'fearful',
3 : 'happy',
4 : 'sad'
} |
currencies = {
"AUD": "Australian dollar",
"BGN": "Bulgarian lev",
"BRL": "Brazilian real",
"CAD": "Canadian dollar",
"CHF": "Swiss franc",
"CNY": "Chinese yuan",
"CZK": "Czech koruna",
"DKK": "Danish krone",
"EUR": "Euro",
"GBP": "British pound",
"HKD": "Hong Kong dollar",
... |
gsr_samples_number = 10 #Wait 10 samples of GSR to filter average
gsr_samples_delay = 0.02 #Time between samples equals to 20ms
gsr_channel = 1 #ADS1115 Channel for the GSR sensor
GAIN = 1 #ADS1115 Gain for values between +/- 4.096V
#-------------------------------GRSensor()----------------------------------------#
#... |
"""OpenGL debugging utility functions/classes
This package provides various debugging mechanisms
for use particularly with more involved OpenGL
projects.
""" |
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
"""
- not stable
- input is mutable
- Intuition:
... |
#!/usr/bin/env python
# encoding: utf-8
"""Implements a container for parsed snippets."""
class SnippetDictionary(object):
"""See module docstring."""
def __init__(self):
self._snippets = []
self._cleared = {}
self._clear_priority = float("-inf")
def add_snippet(self, snippet):
... |
num = [[], []]
valor = 0
for c in range(1, 8):
valor = int(input('Digite o {}º valor: '.format(c)))
if valor % 2 == 0:
num[0].append(valor)
else:
num[1].append(valor)
print('=' * 50)
num[0].sort()
num[1].sort()
print('Os valores pares digitados foram: {}'.format(num[0]))
print('Os valores í... |
n1=int(input('digite um número: '))
n2=int(input('digite mais um número: '))
s=(n1+n2)
print('a soma dos números é: ',s)
print('a soma vale {}'.format(s))
|
#
class Direction (object):
'''
A list of direction types, as used in Busiest Travel Period
.. code-block:: python
from amadeus import Direction
client.travel.analytics.air_traffic.busiest_period.get(
cityCode = 'MAD',
period = '2017',
direction = Dire... |
num1 = 15
num2 = 20
sum = num1 + num2
print("sum of {0} and {1} is {2}".format(num1,num2,sum)) |
def exchange(a, i, j):
temp = a[i]
a[i] = a[j]
a[j] = temp
class MinPQ(object):
s = None
N = 0
compare = None
def __init__(self, compare=None):
self.s = [0] * 10
self.N = 0
if compare is None:
compare = lambda x, y: x - y
self.compare = compare
... |
#coding:utf-8
# 拨号间隔
ADSL_CYCLE = 100
# 拨号出错重试间隔
ADSL_ERROR_CYCLE = 5
# ADSL命令
ADSL_BASH = 'adsl-stop;adsl-start'
# 代理运行端口
PROXY_PORT = 8888
# 客户端唯一标识
CLIENT_NAME = 'ads11'
# 拨号网卡
ADSL_IFNAME = 'ppp0'
# Redis数据库ip
REDIS_HOST = 'localhost'
# Redis数据库密码,如无则填None
REDIS_PASSWORD = None
# ... |
# Generated from 'Lists.h'
def FOUR_CHAR_CODE(x): return x
listNotifyNothing = FOUR_CHAR_CODE('nada')
listNotifyClick = FOUR_CHAR_CODE('clik')
listNotifyDoubleClick = FOUR_CHAR_CODE('dblc')
listNotifyPreClick = FOUR_CHAR_CODE('pclk')
lDrawingModeOffBit = 3
lDoVAutoscrollBit = 1
lDoHAutoscrollBit = 0
lDrawingModeOff =... |
"""
Module Docstring
Docstrings: http://www.python.org/dev/peps/pep-0257/
"""
__author__ = 'ButenkoMS <gtalk@butenkoms.space>'
MESSAGE_SIZE_LEN = 4
class ThereIsNoMessages(Exception):
pass
def get_message(data: bytes)->tuple:
'''
Retrieves message from bytes data
:param data: input data
:retu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# created by Lipson on 19-12-2.
# email to LipsonChan@yahoo.com
#
class Config(object):
DEBUG = True
TESTTING = False
DB_URI = 'mysql+pymysql://xxx:xxxx@127.0.0.1:3306/flask_test'
|
my_kustomization = {
'commonLabels': {
'app': 'hello',
},
'resources': [
'deployment:my_deployment',
'service:my_service',
'configMap:my_config_map',
],
}
|
# This macro uses the native genrule which is a lot shorter
def archive2(name, files, out):
native.genrule(
name = name,
outs = [out],
srcs = files,
cmd = "zip $(OUTS) $(SRCS)",
)
|
#!/usr/bin/env python3
#this program will write
#Thura Dwe He/Him/His
print("Thura Dwe He/Him/His") # print out Thura Dwe He/Him/His
|
#
# This file contains the Python code from Program 14.17 of
# "Data Structures and Algorithms
# with Object-Oriented Design Patterns in Python"
# by Bruno R. Preiss.
#
# Copyright (c) 2003 by Bruno R. Preiss, P.Eng. All rights reserved.
#
# http://www.brpreiss.com/books/opus7/programs/pgm14_17.txt
#
def pi(trials):
... |
###############################################################################
# This module exposes LITMUS APIs
#
__all__ = ["config", "litmus_mixing"]
name = "litmus"
|
'''
167. Two Sum II - Input array is sorted
Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.
The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2.... |
input = """
1 2 0 0
1 3 0 0
1 4 0 0
1 5 0 0
1 6 0 0
1 7 0 0
1 8 0 0
1 9 0 0
1 10 0 0
1 11 0 0
1 12 0 0
1 13 0 0
1 14 0 0
1 15 0 0
1 16 0 0
1 17 0 0
1 18 0 0
1 19 0 0
1 20 0 0
1 21 0 0
1 22 0 0
1 23 0 0
1 24 0 0
1 25 0 0
1 26 0 0
1 27 0 0
1 28 0 0
1 29 0 0
1 30 0 0
1 31 0 0
1 32 0 0
1 33 0 0
1 34 0 0
1 35 0 0
1 36 0 0
1... |
class ArgumentTypeError(Exception):
"""Exception raised for errant argument types."""
def __init__(self, value):
self.value = value
self.message = "Provided argument(s) inavlid. Expected: main.py <int> <float>"
super().__init__(self.message)
class IterationRangeError(Exception):
"""... |
num = int(input())
partner_one = input().split()
partner_two = input().split()
if len(partner_one) != len(set(partner_one)) or len(partner_two) != len(set(partner_two)):
exit('bad')
d = {partner_one[q]:partner_two[q] for q in range(num)}
for q in range(num):
if d[partner_two[q]] != partner_one[q]... |
# coding: utf-8
a = 2
b = 3
c = 2.3
d = a + b
print(d) # 5
print(a+b) # 5
print(a+c) # 4.3
print (b/a) # 1.5
print(b//a) # ! 1 floor division
print (a*c) # 4.6
print (a ** b ) # ! 8 power
print (17 % 3) # Modulus 17 = 3*5+2
|
"""
String literals used within CanvasSync
"""
# general
DISPLAY_NAME = u'display_name'
ID = u'id'
NAME = u'name'
TITLE = u'title'
UPDATED_AT = u'updated_at'
# history
HISTORY_ID = u'id'
HISTORY_MODIFIED_AT = u'modified_at'
HISTORY_PATH = u'path'
HISTORY_TYPE = u'type'
# special folder names
FOLDER_ASSIGNMENTS = u"A... |
def insertionSort(A):
valueIndex = 0
value = 0
for i in range(1, len(A)):
valueIndex = i
value = A[i]
while valueIndex > 0 and A[valueIndex - 1] > value:
A[valueIndex] = A[valueIndex - 1];
valueIndex = valueIndex - 1;
A[valueIndex] = value
return ... |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2016+ Buro Petr van Blokland + Claudia Mens
# www.pagebot.io
#
# P A G E B O T
#
# Licensed under MIT conditions
#
# Supporting DrawBot, www.drawbot.com
# ... |
"""Hackerrank Problem: https://www.hackerrank.com/challenges/ginorts/problem
You are given a string S.
S contains alphanumeric characters only.
Your task is to sort the string S in the following manner:
- All sorted lowercase letters are ahead of uppercase letters.
- All sorted uppercase letters are ahead of digits.... |
"""Provides a generic and slightly-smarter minimal cover algorithm."""
def minimal_cover(
elements_set, subsets, max_subsets=None, heuristic="default", selected=(), depth=0
):
"""Generic method to find minimal subset covers.
Parameters
----------
elements_set
The set of all elements to cove... |
#!/usr/bin/env python
#
# This code is part of the interface classifier tool distribution
# and governed by its license. Please see the LICENSE file that should
# have been included as part of this package.
#
"""
Interface classification methods developed by the Bonvin Lab.
"""
|
__version__ = "1.1.17"
__version_info__ = VersionInfo._from_version_string(__version__)
__title__ = "django-materializecss-form"
__description__ = "A simple Django form template tag to work with Materializecss"
__url__ = "https://github.com/kalwalkden/django-materializecss-form"
__uri__ = "https://github.com/kalwalk... |
name = input('Please enter your name >')
print('type(name):' , type(name))
print('your name is ' + name.upper())
|
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 12 20:05:14 2021
@author: qizhe
"""
class Solution:
def isNumber(self, s: str) -> bool:
"""
读题
1、没看出有什么难度,不知道在考啥?
2、要分状态,状态中判断出错
3、比如,句首状态可以是 + - 0 . ;句中状态可以是 0 e . ; 句末状态 ……
测试
1、改了一堆bug,这题再也别看了
... |
class iron_ore_mining():
SCRIPT_NAME = "IRON ORE MINING SCRIPT 0.2v";
BUTTON = [
];
CHATBOX = [
];
FUNCTION = [
];
INTERFACE = [
];
ITEM = [
".\\resources\\item\\inventor\\iron_ore.png",
".\\resources\\item\\inventor\\uncut_sapphire... |
n = int(input())
a = list(map(int, input().split()))
stack = []
stack.extend([(each,) for each in range(len(a))])
diff = {} # {node: value}
while stack:
node = stack.pop()
if len(node) > 1:
value = abs(a[node[-2]]-a[node[-1]])
diff.update({node: diff.get(node[:-1], 0) + value})
for index ... |
# program r1_15.py
# Pętla while - wersja prosta
a = 0
while a < 5:
a += 1
print(f"Aktualne a={a}")
# Koniec pętli
print(f"Ostatecznie a wynosi {a}")
|
def binary_search(arr, elem):
lo = 0
hi = len(arr) - 1
res = -1
while lo <= hi:
mid = (lo + hi) // 2
if arr[mid] == elem:
res = mid
return res
if arr[mid] > elem:
hi = mid - 1
else:
lo = mid + 1
return res
arr = [1, ... |
# The Solution here assumes that all elements in the input list are distinct
def rotated_array_search(input_list, number):
"""
Find the index by searching in a rotated sorted array
Args:
input_list(array), number(int): Input array to search and the target
Returns:
int: Index or -1... |
class WordFrequencies(object):
def __init__(self, ddi_frequencies, random_articles_frequencies):
self.ddi_frequencies = ddi_frequencies
self.random_articles_frequencies = random_articles_frequencies
|
# Вывести квадраты чисел от 1 до 10
for i in range(1, 11):
print(f"Квадрат числа {i}: ", i ** 2)
# Вывести квадраты чисел от 10 до 1
for i in range(1, 11):
b = (11 - i)
print(f"Квадрат числа {b}: ", b ** 2)
# Выполнить все задания через While
# 1. Найти максимальное число в списке, но не больше 100
ls... |
a, b = map(int, input().split())
result = 0
if a > b:
result += a
a -= 1
else:
result += b
b -= 1
if a > b:
result += a
else:
result += b
print(result)
|
# these functions are called in main.py
print("This is a calculator powered by TMath Module by Trevlin Morris")
print("Avaliable commands are:\nDiv\nMult\nAdd\nSub\nRound\nCompare")
def Div():
A = float(input())
B = float(input())
C = A / B
print(C)
def Mult():
A = float(input())
B = float(input... |
# setup.py needs to import this without worrying about required packages being
# installed. So if you add imports here, you may need to do something like:
# https://github.com/mitsuhiko/click/blob/da080dd2de1a116fc5789ffdc1ec6ffb864f2044/setup.py#L1-L11
__version__ = '0.8.0'
|
# -*- coding: utf-8 -*-
def factorial(number):
if number == 0:
return 1
return number * factorial(number - 1)
if __name__ == '__main__':
numero = int(input('\nFactorial de : '))
result = factorial(numero)
print(result)
|
# Example - Rewrite star gazing show
# print menu function
def print_menu():
print("------------------------------------------------")
print(" Welcome to Science Park! ")
print()
print("Admission Charges: Adult $35, Child $20 ")
print("Stargazing Show: $10/person ... |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 25 14:33:06 2017
@author: James Jiang
"""
with open('Data.txt') as f:
for line in f:
string = line
all_instructions = string.split(', ')
x_position = 0
y_position = 0
direction = 'north'
def turn_left(string):
if string == 'north':
retu... |
def base_tech_tree():
return Tech('Agriculture', 'agriculture', 0, 1.0,
[
Tech('Stone Working', 'material', 400, 1.1,
[
Tech('Copper', 'material', 1600, 1.5,
[
... |
class Solution:
"""
@param A: an integer ratated sorted array and duplicates are allowed
@param target: An integer
@return: a boolean
"""
def search(self, A, target):
# write your code here
if A is None or len(A) == 0:
return False
start, end = 0, len(A) - 1
... |
# we identified: Phrag, MrFlesh, thetimeisnow, MyaloMark, mexicodoug
author_list = ["MrFlesh","oddmanout","Phrag","NoMoreNicksLeft","permaculture",
"aletoledo","thetimeisnow","MyaloMark","mexicodoug","rainman_104","mutatron",
"otakucode","cuteman","donh","nixonrichard","garyp714","Stormflux","seeker135",
"dirtymoney","... |
# python3
def anticlockwise_area(x1, y1, x2, y2, x3, y3):
return (x2-x1)*(y3-y1) - (x3-x1)*(y2-y1)
def solve(Ax, Ay, Bx, By, P):
n = len(P)
for i in range(n):
px, py = P[i]
area = anticlockwise_area(Ax, Ay, Bx, By, px, py)
if area > 0:
print("LEFT")
elif area < ... |
def est_paire(n):
if n%2 == 0:
print(str(n)+" est pair")
else:
print(str(n)+" n'est pas pair")
a=[2,4,3,7]
for i in range(4):
est_paire(a[i]) |
"""This test the homepage"""
def test_request_main_menu_links(client):
"""This makes the index page"""
response = client.get("/")
assert response.status_code == 200
assert b'href="/about"' in response.data
assert b'href="/welcome"' in response.data
assert b'href="/login"' in response.data
a... |
style = """<style>
.container {
position: relative;
width: 50%;
}
.image {
opacity: 1;
display: block;
width: 100%;
height: auto;
transition: .5s ease;
backface-visibility: hidden;
}
.middle {
... |
modulename = "RocketLeague"
sd_structure = {
"activated": True
}
|
A, B = map(int, input().split())
if 1 <= A <= 9 and 1 <= B <= 9:
print(A * B)
else:
print(-1)
|
def last_neuron(self):
labels = list(set(self.y.flatten('F')))
try:
last_neuron = self.y.shape[1]
except IndexError:
if len(labels) == 2 and max(labels) == 1:
last_neuron = 1
elif len(labels) == 2 and max(labels) > 1:
last_neuron = 3
elif len(labels)... |
#!/usr/bin/env python
# Define a filename.
filename = "input.txt"
def count_depth_changes(depths):
depth_counts = {}
depth_counts["increased"] = 0
depth_counts["decreased"] = 0
depth_counts["no_change"] = 0
for index, depth in enumerate(depths):
if index == 0:
continue
... |
if __name__ == '__main__':
with open('chapter.txt') as f:
chapter = f.readlines()
chapter_set = set(chapter)
with open('byterun/pyvm2.py') as g:
source = g.readlines()
source_set = set(source)
zero_missing = True
for line in source:
if line and line not in chapter_set:
if zero_missing:
print("Mi... |
class NotFound(Exception):
pass
class PlayerNotFound(NotFound):
""" Raised When Player Is Not Found"""
class GamePassNotFound(NotFound):
""" Raised When GamePass Is Not Found"""
class GroupNotFound(NotFound):
""" Raised When Group Is Not Found"""
class BundleNotFound(NotFound):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.