content
stringlengths
7
1.05M
# Copyright 2020 Adobe. All rights reserved. # This file is licensed to you 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 ...
def changecode(): file1=input("Enter your file name1") file2=input("Enter your file name2") with open(file1,"r") as a: data_a = a.read() with open(file2,"r") as b: data_b = b.read() with open(file1,"w") as a: a.write(data_b) with open(file2,"w") as b: b....
""" 1119. Remove Vowels from a String Easy Given a string S, remove the vowels 'a', 'e', 'i', 'o', and 'u' from it, and return the new string. Example 1: Input: "leetcodeisacommunityforcoders" Output: "ltcdscmmntyfrcdrs" Example 2: Input: "aeiou" Output: "" Note: S consists of lowercase English letters only...
ll=range(5, 20, 5) for i in ll: print(i) print (ll) x = 'Python' for i in range(len(x)) : print(x[i])
# Function returns nth element of Padovan sequence def padovan(n): p = 0 if n > 2: p = padovan(n-2) + padovan(n-3) return p else: p = 1 return p def main(): while True: n = int(input("Enter a number: ")) if n >= 0: break print("In...
li = [] for x in range (21): li.append(x) print(li) del(li[4]) print(li)
CHANGE_PW = { 'tags': ['회원가입 이후'], 'description': '비밀번호 변경', 'parameters': [ { 'name': 'Authorization', 'description': 'JWT Token', 'in': 'header', 'type': 'str' }, { 'name': 'pw', 'description': '변경할 비밀번호', ...
routes = { '{"command": "stats"}' : {"STATUS":[{"STATUS":"S","When":1553711204,"Code":70,"Msg":"BMMiner stats","Description":"bmminer 1.0.0"}],"STATS":[{"BMMiner":"2.0.0","Miner":"16.8.1.3","CompileTime":"Fri Nov 17 17:37:49 CST 2017","Type":"Antminer S9"},{"STATS":0,"ID":"BC50","Elapsed":248,"Calls":0,"Wait":0.00000...
""" 问题描述: 大家一定玩过“推箱子”这个经典的游戏。具体规则就是在一个N*M的地图上, 有1个玩家、1个箱子、1个目的地以及若干障碍,其余是空地。玩家可以往上下左右4个方 向移动,但是不能移动出地图或者移动到障碍里去。如果往这个方向移动推到了箱子,箱子 也会按这个方向移动一格,当然,箱子也不能被推出地图或推到障碍里。当箱子被推到目的 地以后,游戏目标达成。现在告诉你游戏开始是初始的地图布局,请你求出玩家最少需要移 动多少步才能够将游戏目标达成。 输入描述: 每个测试输入包含1个测试用例 第一行输入两个数字N,M表示地图的大小。其中0<N,M<=8。 接下来有N行,每行包含M个字符表示该行地图。其中 . 表示空地、X表示玩家、...
class DatabaseNotConnectedException(Exception): """This exception is raised when collection is accessed however database is not connected. """ def __init__(self, message: str): self.message = message super().__init__(self.message)
def folder_to_dict(folder): return { 'id': folder.folder_id, 'name': folder.name, 'class': folder.folder_class, 'total_count': folder.total_count, 'child_folder_count': folder.child_folder_count, 'unread_count': folder.unread_count } def item_to_dict(item, inclu...
# MVT设计模式,model-view-template # model负责和数据库交互来获取model数据 # view相当于MVC中的Controller负责处理网络请求http response # template相当于MVC中的View负责封装html,css,js等内置模板引擎 # 具体流程:客户端发出网页请求 --> View接受网络请求 --> 找mdel去数据库找数据 -->找回的model数据返回给view # --> view可以直接返回无修饰的model原始数据给客户端 --> 或者找template去美化数据,添加css,html等,动态生成一个html文件返回给View # --> View将动态生成...
# 可以模拟魔方逆时针旋转的方法,一直做取出第一行的操作 # 输出并删除第一行后,再进行一次逆时针旋转 # 旋转思路 class Solution: # matrix类型为二维列表,需要返回列表 def printMatrix(self, matrix): result = [] while matrix: result.extend(matrix.pop(0)) # result 是一个列表 if not matrix or not matrix[0]: # len([[]]) = 1 break ...
# Copyright 2018 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. config_type='sweetberry' # the names j2, j3, and j4 are the white banks on sweetberry # Note that here the bank name in the mux position is optional # as...
def leia_int(msg): while True: try: n = int(input(msg)) except (ValueError, TypeError): print('\33[31m * ERRO: Digite um número válido.\33[m') continue else: return n def linha(tam=40, car='-'): print(car * tam) def cabecalho(txt): ...
# Project Euler Problem 4 # Pranav Mital # function to check if a number is a palindrome def isPalindrome(n): flag = 0 str_n = str(n) for i in range((len(str_n)//2)): if str_n[i] != str_n[len(str_n)-1-i]: flag += 1 if flag != 0: return False else: return True #...
T = 2000 # Set T to 200 periods sim_seq_long = log_sequential.simulate(0.5, 0, T) sHist_long = sim_seq_long[-3] sim_bel_long = log_bellman.simulate(0.5, 0, T, sHist_long) titles = ['Consumption', 'Labor Supply', 'Government Debt', 'Tax Rate', 'Government Spending', 'Output'] # Government spending paths...
def f(var=(""" str """,1)): pass anothervar=1
class PyFileBuilder: def __init__(self, name): self._import_line = None self._file_funcs = [] self.name = name def add_imports(self, *modules_names): import_list = [] for module in modules_names: import_list.append("import " + module) if len(import...
# Design and implement a TwoSum class. It should support the following operations: add and find. # add - Add the number to an internal data structure. # find - Find if there exists any pair of numbers which sum is equal to the value. # Example 1: # add(1); add(3); add(5); # find(4) -> true # find(7) -> false # Exampl...
# Create a program such that when given a non-negative number input, output whether or not if the number is 2 away from a multiple of 10. # input num = int(input('Enter a positive number: ')) # processing & output if (num + 2) % 10 == 0: print(num, 'is 2 away from a multiple of 10.') elif (num - 2) % 10 == 0: ...
#URL:https://www.hackerrank.com/challenges/balanced-brackets/problem?h_r=profile def check_close(top, ch): if ch =="(" and top ==")": return True if ch =="[" and top =="]": return True if ch =="{" and top =="}": return True return False def isBalanced(s): stack=[] for ...
class Solution: """ @param path: the original path @return: the simplified path @ 用 stack ['', 'a', '.', '..', '..', 'c', ''] """ def simplifyPath(self, path): # write your code here path = path.split('/') stack = [] for i in path: if i == '..': ...
def tickets(disabled,users): ''' cheks if disabeld or not ''' a = input("are you disabled or not: ") if a == 'disabled': disabled = 200 return disabled elif a == 'not': users = 500 return users tickets(200,500)
#Python Program to take the temperature in Celsius and convert it to Fahrenheit. while 1: try: #a=Celsius= float(input("Enter the temperature in Celcius: ")) print("----------------------------------------------------------------------") print("* ...
class Solution: # 1st solution, Lagrange's four square theorem # O(sqart(n)) time | O(1) space def numSquares(self, n: int) -> int: if int(sqrt(n))**2 == n: return 1 for j in range(int(sqrt(n)) + 1): if int(sqrt(n - j*j))**2 == n - j*j: return 2 while n % 4 =...
# # PySNMP MIB module CISCO-ATM-SWITCH-FR-RM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ATM-SWITCH-FR-RM-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:33:34 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version ...
# Credentials for your Twitter bot account # 1. Sign into Twitter or create new account # 2. Make sure your mobile number is listed at twitter.com/settings/devices # 3. Head to apps.twitter.com and select Keys and Access Tokens CONSUMER_KEY = '6gTma2ITYHEh7MZMRJaflnxK7' CONSUMER_SECRET = 'a20hHEbN1qudaR6RAdMCHtPKdOjp...
numbers=list(range(1,21,2)) for i in range(len(numbers)): print(numbers[i])
#for c in range(2, 52, 2): #print(c, end=' ') #print('Acabo') for c in range(1, 11): print(c +c)
class Table: def __init__(self, table): self._table = table @property def name(self): return self._table.__name__ @property def thead(self): all_fields = self._table._meta.fields return [ field.verbose_name for field in all_fields if field.verbose_name !...
class DataProcessor(object): """Base class for data converters for sequence classification data sets.""" def get_train_examples(self, data_dir): """Gets a collection of `InputExample`s for the train set.""" raise NotImplementedError() def get_dev_examples(self, data_dir): """Gets a collection of `In...
''' while em python utilizado para realizar ações enquanto uma condição for verdadeira. requisitos: Entender condições e operadores ''' # while condicao: # enquanto essa condição for verdadeira faça oq ta dentro do codigo # pass # while True: # loop infinito. executa infinitamente até achar a expressão falsa (...
class AmazonAnsible: """Main class to generate Ansible playbooks from Amazon Args: debug (bool, optional): debug option. Defaults to False. from_file (str, optional): Optional file with all data. Defaults to ''. """ class AmazonAnsibleCalculation: """Class to generate all Ansible play...
""" Given an array of size n where all elements are distinct and in range from 0 to n-1, change contents of arr[] so that arr[i] = j is changed to arr[j] = i. """ def rearrange(arr: list) -> list: """ Simplest approach would be to create and fill a temp array. But it would require extra space. In case...
# http://hg.openjdk.java.net/jdk6/jdk6/jdk/raw-file/tip/src/share/demo/jvmti/hprof/manual.html path = "/Users/huangjinfu/Downloads/hpr/h1j.hprof" TYPE_LEN = { 2: 4, # object 4: 1, # boolean 5: 2, # char 6: 4, # float 7: 8, # double 8: 1, # byte 9: 2, # short 10: 4, # int 11:...
in_data = { u'deliveryOrder': { u'warehouseCode': u'OTHER', u'deliveryOrderCode': u'3600120100000', u'receiverInfo': { u'detailAddress': u'\u5927\u5382\u680818\u53f7101', u'city': u'\u4e94\u8fde', u'province': u'\u5c71\u4e1c', u'area': u'\u592...
pkgname = "firmware-ipw2100" pkgver = "1.3" pkgrel = 0 pkgdesc = "Firmware for the Intel PRO/Wireless 2100 wifi cards" maintainer = "q66 <q66@chimera-linux.org>" license = "custom:ipw2100" url = "http://ipw2100.sourceforge.net" source = f"http://firmware.openbsd.org/firmware-dist/ipw2100-fw-{pkgver}.tgz" sha256 = "e110...
'''Generates a javascript string to display flot graphs. Please read README_flot_grapher.txt Eliane Stampfer: eliane.stampfer@gmail.com April 2009''' class FlotGraph(object): #constructor. Accepts an array of data, a title, an array of toggle-able data, and the #width and height of the graph. All of these valu...
def merge(seq, first, mid, last): (left, right) = (seq[first: mid], seq[mid: last]) (l, r, curr) = (0, 0, first) (left_size, right_size) = (len(left), len(right)) while l != left_size and r != right_size: if left[l] < right[r]: seq[curr] = left[l] l += 1 else: ...
#!/usr/bin/python # -*- coding: utf-8 -*- class Decode: def __init__(self, length, K, n, weight): self.K = K self.length = length self.n = n self.weight = weight self.solution = [False for i in range(0, n + 1)] def Search(self): ...
lines = [] with open('input.txt','r') as INPUT: lines = INPUT.readlines() M = int(lines[0]) stack = [None]*M stack_head = -1 with open('output.txt', 'w') as OUTPUT: for op in lines[1:]: if op.startswith('+'): stack_head += 1 stack[stack_head] = op[2:] eli...
class BaseScraper: pass
class Board: def __init__(self, n): # Размер игры . . . self.n = n # Создаем списковое представление пустой доски self.pieces = [None] * self.n for i in range(self.n): self.pieces[i] = [0] * self.n # Добавляем возможность использования оператора взятия индекс...
# -*- coding: utf-8 -*- """ Created on Sun Jun 14 17:12:03 2020 @author: kanukuma """ def popularNFeatures(numFeatures, topFeatures, possibleFeatures, numFeatureRequests, featureRequests): ngramsList = [] resultList = [] for featureRequest in featureRequests: ngramsList.append( fe...
def is_sequence(x): """ Returns whether x is a sequence (tuple, list). :param x: a value to check :returns: (boolean) """ return (not hasattr(x, 'strip') and hasattr(x, '__getitem__') or hasattr(x, '__iter__'))
k = int(input()) s = input() prevlen = 0 ans = 0 for i in range(k, len(s)): if s[i] == s[i - k]: prevlen += 1 ans += prevlen else: prevlen = 0 print(ans)
########################################################################## # Gene prediction pipeline # # $Id: AGP.py 2781 2009-09-10 11:33:14Z andreas $ # # Copyright (C) 2005 Andreas Heger # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public...
# Equality checks should behave the same way as assignment # Variable equality check bar == {'a': 1, 'b':2} bar == { 'a': 1, 'b': 2, } # Function equality check foo() == { 'a': 1, 'b': 2, 'c': 3, } foo(1, 2, 3) == { 'a': 1, 'b': 2, 'c': 3, }
class Solution: def largestRectangleArea(self, heights: List[int]) -> int: heights.append(0) # here to make sure stack pop off stack = [-1] ans = 0 for i in range(len(heights)): while heights[i] < heights[stack[-1]]: h = heights[stack.pop()] ...
a, b, c, d, e, f, g, h = range(8) # 邻接集 N1 = [ {b, c, d, e, f}, {c, e}, {d}, {e}, {f}, {c, g, h}, {f, h}, {f, g} ] # 邻接列表 N2 = [ [b, c, d, e, f], [c, e], [d], [e], [f], [c, g, h], [f, h], [f, g] ] # 加权邻接字典 N3 = [ {b: 2, c: 1, d: 3, e: 9, f: 4}, ...
class TicTacToe: def __init__(self): self.cells = [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '] self.matrix = [self.cells[0:3], self.cells[3:6], self.cells[6:9]] # Vertical lines list, to be divided in 3 inner lists: self.v_lines = [] # Diagonal lines: self.d1_line = ...
#coding=utf-8 ''' Created on 2015-9-24 @author: Devuser ''' class CITestingTaskPropertyNavBar(object): ''' classdocs ''' def __init__(self,request,**args): self.request=request self.ci_task=args['ci_task'] if args['property_nav_action'] == 'history': self.result_ac...
class Solution : def letterCombinations(self, digits) : def dfs(index, path) : if len(path) == len(digits) : # 한개가 붙는 경우는 마지막 밖에 없으니까 for 문이 의미없이 돌다가 끝남 result.append(path) return for i in range(index, len(digits)) : ...
print('='*8,'Dicionário de Palavras','='*8) d = {} d['Fato'] = '''Acontecimento acabado; evento, ocorrência: a fiscalização das barracas \nilegais é agora um fato. \nCoisa cuja realidade pode ser comprovada; verdade, realidade: "contra fatos não há \nargumentos". \n[Jurídico] O que foi finalizado e não pode ser mudado...
msg = str(input('Digite uma mensagem')) n = 0 n = len(msg) def escreva(): print('-'*n) print(msg) print('-'*n) escreva()
class UVWarpModifier: axis_u = None axis_v = None bone_from = None bone_to = None center = None object_from = None object_to = None uv_layer = None vertex_group = None
# # Copyright Cloudlab URV 2020 # # 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 writin...
class NotAllowed(Exception): """when change class.id""" class DatabaseException(Exception): """Database error""" class ColumnTypeUnknown(Exception): """Variable type unknown""" class NoFieldException(Exception): """Class has no variables""" class WhereUsageException(Exception...
#オリジナル画像と要素画像の画素値を比較し、最も近い色の要素タイルを選んでいく。 class CompareColors(): def __init__(self, original, material): self.original = original self.material = material def compare(self): #オリジナル画像の分割数を取得する original_num = len(self.original) #素材画像が何枚あるか取得する mate...
''' Vasya the Hipster red blue socks simple one ''' socks = list(map(int, input().split(' '))) socks.sort() diff = socks[0] left = socks[1]-socks[0] same = left//2 #output format s = str(diff) + ' ' + str(same) print(s)
def fun(a, b, c, d): return a + b + c + d def inc(a): return a + 1 def add(a, b): return a + b
x_arr = [] y_arr = [] for _ in range(3): x, y = map(int, input().split()) x_arr.append(x) y_arr.append(y) for i in range(3): if x_arr.count(x_arr[i]) == 1: x4 = x_arr[i] if y_arr.count(y_arr[i]) == 1: y4 = y_arr[i] print(f'{x4} {y4}')
# Methods of Tuple in Python: # Declaring tuple tuple = (3, 4, 6, 8, 10, 1, 67) # Code for printing the length of a tuple tuple2 = ('Apple', 'Bannana', 'Kiwi') print('length of tuple2 :', len(tuple2)) # Deleting the tuple del tuple2 # Printing tuple till 2 index excluding 2 print('tuple[0:2]:', tuple[0:2]) # Disp...
encoded_bytes=bytes.fromhex("664B564276757A7274796D477A4D4C7A545057456D47575971566F75585A694F4F454B677771647053544E5452654C6F434C544F6E702E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2E2...
def solve(data): result = 0 # Iterates through each value of the list and sums it to the result for number in data: result += number # Returns result (total sum) return result
A = int(input()) B = int(input()) PROD = A*B print("PROD = " + str(PROD))
def get_metadata(accessions, metadata_database): #Quirk - metadata accession has .1 as a part of the accession id accessions_fixed = [] for accession in accessions: accessions_fixed.append(accession+'.1') accessions_data = metadata_database.loc[metadata_database['acc'].isin(accessions_fixed)] ...
def clean_dict(json): """ Remove keys with the value None from the dictionary """ for key, value in list(json.items()): if value is None: del json[key] elif isinstance(value, dict): clean_dict(value) return json
def towerOfHanoi(n, source, auxiliary, destination): if n == 0: return 0 # Move n-1 from source to auxiliary using destination stepCnt1 = towerOfHanoi(n-1, source, destination, auxiliary) # Move nth disc from source to destination print(f"{n} {source} -> {destination}") # move n-1 fro...
# Manas Dash # 24th July 2020 # the usage of set and max function # which number is repeated most number of time numbers = [1, 3, 4, 6, 3, 7, 3, 8, 6, 5, 9, 5, 3, 6, 3, 2, 3] max_repeated = max(set(numbers), key=numbers.count) print(f"The number {max_repeated} is repeated maximum number of time in the given list") ...
class ZileanBackuper(object): def __init__(self): self._machines = None self._linked_databases = None @classmethod def backup_linked_databases(cls): pass @classmethod def backup_database(cls, db): pass
# Copyright 2020 The Private Cardinality Estimation Framework Authors # # 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 b...
def test_content_create(api_client_authenticated): response = api_client_authenticated.post( "/content/", json={ "title": "hello test", "text": "this is just a test", "published": True, "tags": ["test", "hello"], }, ) assert response.st...
[ [0.26982777, 0.20175242, 0.10614473, 0.17290444, 0.22056401], [0.18268971, 0.2363915, 0.26958793, 0.29282782, 0.36225248], [0.31735855, 0.30254544, 0.28661105, 0.33136132, 0.40489719], [0.0, 0.0, 0.0, 0.0, 0.0], [0.15203597, 0.32214688, 0.40445594, 0.45318467, 0.44650059], [0.20070068, 0.31904...
t=int(input()) for k in range(t): n=int(input()) a=list(map(int,input().strip().split())) stack=[] res={} for i in a: res[i]=-1 for j in a: if len(stack)==0: stack.append(j) else: while len(stack)>0 and stack[-1]<j: res[stack.pop()]...
print(int('3') + 3) print(float('3.2') + 3.5) print(str(3) + '2')
# Copyright 2019 Eficent Business and IT Consulting Services # Copyright 2017-2018 Tecnativa - Pedro M. Baeza # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Purchase Stock Picking Return Invoicing", "summary": "Add an option to refund returned pickings", "version": "12.0.1.0.1",...
def get_regr_coeffs(X, y): n = X.shape[0] p = n*(X**2).sum() - X.sum()**2 a = ( n*(X*y).sum() - X.sum()*y.sum() ) / p b = ( y.sum()*(X**2).sum() - X.sum()*(X*y).sum() ) / p return a,b
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def sumOfLeftLeaves(self, root: TreeNode) -> int: if root is None: return 0 layer = [root] res = 0 whil...
# Binary Search Tree (BST) Implementation class BSTNode: def __init__(selfNode, nodeData): # Node Structure selfNode.nodeData = nodeData selfNode.left = None selfNode.right = None selfNode.parent = None # Insertion Operation def insert(selfNode, node): if selfNode.nod...
class Stack: def __init__(self,size=None,limit=1000): self.top_item = [] self.size = 0 self.limit = limit def peek(self): if not self.is_empty(): return self.value[-1] else: print("Stack is empty") def push(self,value): #print("Current...
ultimo=10 fila=list(range(1,ultimo+1))#Função Sequenciadora de 1 para ultimo +1 fila2=list(range(1,ultimo+1)) while True:# Sempre dará verdadeiro em loop e só sairá no break print(f"Existem{len(fila)} clientes na fila\n") print(f"Existem{len(fila2)} clientes na fila\n") print(f"Fila atual: {fila}\n") ...
with open("part1.txt", "r") as file: checksum = 0 for row in file: large, small = 0, 9999 for entry in row.split("\t"): entry = int(entry) if entry > large: large = entry if entry < small: small = entry checksum += larg...
# BUILD FILE SYNTAX: SKYLARK SE_VERSION = '3.141.59-atlassian-1'
# Python translation of QuadTree from Risk.Platform.Standard class QuadTree(object): # in decimal degrees dist from centroid to edge def __init__(self, latDim, longDim, minLatCentroid, minLongCentroid, baseSize): self.__longDim = longDim self.__latDim = latDim self.__minLong = minLongCent...
class FtpStyleUriParser(UriParser): """ A customizable parser based on the File Transfer Protocol (FTP) scheme. FtpStyleUriParser() """ def ZZZ(self): """hardcoded/mock instance of the class""" return FtpStyleUriParser() instance=ZZZ() """hardcoded/returns an instance of the class"""
""" Tuple""" names = ("rogers","Joan", "Doreen", "Liz", "Peter" ) print(names) string_tuple = " ".join(str(name) for name in names) print(string_tuple)
def length(t1, n): t2=t1*n l=len(t2) print("Tuple {} has length: {}", t2, l) length(('1',(5,3)),2) #Tuple {} length: ('1',(5,3)'1',(5,3)) 4 #note: here .format is missing def length(t1, n): t2=t1*n l=len(t2) print("Tuple {} has length: {}". format(t2, l)) length(('1',(5,3)),2) ...
def repeat(character: str, counter: int) -> str: """Repeat returns character repeated `counter` times.""" word = "" for counter in range(counter): word += character return word
__author__ = 'Igor Davydenko <playpauseandstop@gmail.com>' __description__ = 'Flask-Dropbox test project' __license__ = 'BSD License' __version__ = '0.3'
n1 = float(input('Digite a primeira nota: ')) n2 = float(input('Digite a segunda nota: ')) media = (n1 + n2) / 2 if media < 5: print('REPROVADO') elif 5 <= media < 7: print('RECUPERAÇÃO') else: print('APROVADO') print('Média: {}'.format(media))
# -*- coding: utf-8 -*- # @Date : 18-4-16 下午8:07 # @Author : hetao # @Email : 18570367466@163.com # 正在使用的环境 0: 开发环境, 1: 测试环境, 2: 生产环境 ENVIRONMENT = 0 # =========================================================== # 本地调试 # =========================================================== # mongodb DATABASE_HOST = '192...
# @dependency 001-main/002-createrepository.py SHA1 = "66f25ae79dcc5e200b136388771b5924a1b5ae56" with repository.workcopy() as work: REMOTE_URL = instance.repository_url("alice") work.run(["checkout", "-b", "008-branch", SHA1]) work.run(["rebase", "--force-rebase", "HEAD~5"]) work.run(["push", REMOTE...
# ---------------------------------------------------------------------------- # CLASSES: nightly # # Test Case: h5part.py # # Programmer: Gunther Weber # Date: January, 2009 # # Modifications: # Mark C. Miller, Wed Jan 21 09:36:13 PST 2009 # Took Gunther's original code and integrated it with test ...
# 题意:输入一个矩阵,按照从外向里以顺时针的顺序依次打印出每一个数字。即蛇形输出 # 题解1:模拟法,主要考虑各种边界情况。。degbug。。 # 题解2: 用python的特性,重复:输出第一行,删掉第一行(加入result),翻转。 matrix是由list中list组成,pop(0)输出第一行,然后将matrix按行zip起来倒序,就等于将矩阵向左翻转90度,再pop删掉,重复操作即可。 class Solution: def spiralOrder(self, matrix): # inputs: matrix: List[List[int]] # outputs: List[i...
def artist(): return "The Hardkiss" def genre(): return "Pop" def year(): return 2014 def restrictedContent(): return False def forGeneralAudiences(): return True
class TestErrors: """Errors""" pass
######## # autora: danielle8farias@gmail.com # repositório: https://github.com/danielle8farias # Descrição: Funções para: # ler e criar um cabeçalho; # criar um rodapé; # criar linha; # ler e validar resposta se deseja continuar # validar recebimento de uma string form...
#Exercício Python 010: Crie um programa que leia quanto dinheiro uma pessoa tem na carteira e mostre quantos dólares ela pode comprar. real = float(input('Digite seu dinheiro em BRL: ')) dolar = real * 0.19 print('Com R${:.2f} você pode comprar U${:.2f}'.format(real, dolar))