content
stringlengths
7
1.05M
""" User configuration file. """ #------------------------------------------------------------------------------ # Change the values below according to your requirements. # RESOURCE = "stampede.tacc.utexas.edu" # The name of the remote machine. USERNAME = "tg802352" # Your username on the r...
API_DATA = b"Q0sJVEtPDWt7bmg2YnhtY344enZlMSRsPjxtaTI7P2Q0PTRhNWc=" API_DATA_OAUTH = b"eW91c3V3dn9mYjF2az48bzM7Pm4wZzdlZzpk" CURRENT_DB_VERSION = 3
##\param t_shape a string of the form: ",|,|,| ... ,|," #\return a string of the form ",;,|,;,|...|,;," def omg_generator(t_shape): """ Generates the shape of OMG from the corresponding T-shape Generates the LABEL_DESCR of OMG from the LABEL_DESCR of the corresponding T for multireference cases. ...
class Debuggable: def __init__(self, debug_text=None, show_class_name=True): self.show_class_name = show_class_name if debug_text is not None: self.debug_text = str(debug_text) @property def class_name(self): return self.__class__ # All child classes must implement ...
def Fibonacci(input_val): if input_val<0: pass elif input_val==1: return 0 elif input_val==2: return 1 else: return Fibonacci(input_val-1)+Fibonacci(input_val-2)
''' Resetting the index of a DataFrame After pivoting airquality_melt in the previous exercise, you didn't quite get back the original DataFrame. What you got back instead was a pandas DataFrame with a hierarchical index (also known as a MultiIndex). Hierarchical indexes are covered in depth in Manipulating DataFram...
# Write programs that read a line of input as a string and print # a.  Only the uppercase letters in the string. # b.  Every second letter of the string. # c.  The string, with all vowels replaced by an underscore. # d.  The number of digits in the string. # e.  The positions of all vowels in the st...
class Solution: def crackSafe(self, n: int, k: int) -> str: total = k ** n path = [0] * n seen = {tuple([0] * n)} def dfs(path): if len(seen) == total: return True else: last = path[-(n - 1):] if n > 1 else [] fo...
_base_ = 'mask_rcnn_r50_fpn_syncbn-all_rpn-2conv_lsj_100e_coco.py' # Use RepeatDataset to speed up training # change repeat time from 4 (for 100 epochs) to 2 (for 50 epochs) data = dict(train=dict(times=2))
a = float(input('Qual a sua nota em matematica?')) b = float(input('Qual a sua nota em portugues?')) media = (a + b) / 2 print(f"A sua média é {media :.1f}.") if media < 5.0: print('Você está reprovado.') elif 5.0 < media < 6.9: print('Você está em recuperação') elif media >= 7.0: print('Parabéns, aprovado!...
x1 = int(input('Informe um dos lados: ')) x2 = int(input('Informe outro lado: ')) x3 = int(input('Informe mais um lado: ')) if (x1 + x2) > x3: if (x1 + x3) > x2: if(x2 + x3) > x1: if (x1 == x2 == x3): print('Será formado um triangulo equilatero') elif (x1 == x2 or x1...
x=6 def sant(): print(x) sant() def sant_overwrite(): global x x+=5 print(x) sant_overwrite()
# Uses python3 def get_change(m): num_of_coins = 0 coins = [10, 5, 1] index = 0 while m > 0: coin = coins[index] count = m // coin num_of_coins += count m = m - (count*coin) index = index + 1 return num_of_coins if __name__ == '__main__': m = int(input(...
class Projeto: bd = None def __init__(self, nome, data, descricao, pesquisadores): self.nome = nome #Identificação self.data = data self.descricao = descricao self.pesquisadores = pesquisadores def adicionarParticipante(self, Pesquisador): pass
class Solution: def tester(self, A): A.append(5) if __name__=='__main__': nums1 = [1,2,3] Solution().tester(nums1) print(nums1)
toolname = 'skewt' sources = Split(""" Adiabats.cpp IsoMR.cpp IsoPleth.cpp IsoTherms.cpp IsoPress.cpp PAdiabats.cpp PresRect.cpp Rect.cpp SkewT.cpp SkewTAdapter.cpp SkewTMetFormulas.cpp SkewTRect.cpp SkewTtrace.cpp WindBarb.cpp WindBarbs.cpp SkewTAdapterS...
"""Init Revision ID: 8dac2ad15a8d Revises: Create Date: 2021-02-23 13:57:21.708647+00:00 """ # revision identifiers, used by Alembic. revision = "8dac2ad15a8d" down_revision = None branch_labels = None depends_on = None def upgrade(): pass def downgrade(): pass
#utils/misc.py def custom_show_toolbar(request): return False #return "1" == request.COOKIES.get('DebugToolbar', False)
class Solution: def reverse(self, x: int) -> int: max_ = 2 ** 31 - 1 min_ = -2 ** 31 if x < min_: return 0 if x > max_: return 0 list_ = [] negative_flag = 0 if x > 0 else 1 x = x if x > 0 else -x while x: list_.appe...
######################################################## # Copyright (c) 2015-2017 by European Commission. # # All Rights Reserved. # ######################################################## extends("BaseKPI.py") """ Loss Of Load (h) ------------------------ Indexed by * scope ...
n = int(input()) cnt = 0 for i in range(1, n+1): if n % i == 0: cnt += 1 print(cnt)
# defines an array of colors (R, G, B) # You can just look these up on the internet # Added new colors WHITE = (255, 255, 255) BLACK = (0, 0, 0) DARKGREY = (40, 40, 40) LIGHTGREY = (100, 100, 100) GREEN = (0, 255, 0) RED = (255, 0, 0) YELLOW = (255, 255, 0) # Here are the new colors I have added: GOLD = (255,215,0) PIN...
# Given an integer list where each number represents the number of hops you can # make, determine whether you can reach to the last index starting at index 0. def reachable(nums): index = 0 while index != len(nums) - 1: if nums[index] == 0: return False index += nums[inde...
a = int(input()) while a != 0: saida = [] for k in range(a): saida.append([1]*a) for i in range(1, int(a/2)+1): for j in range(i, a-i): for k in range(i, a-i): saida[j][k] = i+1 out = ' '.join(["%3s"]*a) for linha in saida: print(out%tuple(linha...
# Question 8 - Calculate power # Asmit De # 03/24/2017 # Enter number and exponent num = int(input('Enter a number 1: ')) exp = int(input('Enter a number 2: ')) # Initialize loop counter and result i = 1 result = 1 # Run loop exp times while i <= exp: # Calculate num raised to i result *= nu...
abc = 'with there words' sttuff = abc.split() print(sttuff) print(len(sttuff)) print(sttuff[0]) for w in sttuff: print(w)
def merge(L1: list, L2: list) -> list: """Merge sorted lists L1 and L2 into a new list and return that new list. >>> >>> merge([1, 3, 4, 6], [1, 2, 5, 7]) 1, 1, 2, 3, 4, 5, 6, 7] """ newL = [] i1 = 0 i2 = 0 # For each pair of items L1[i1] and L2[i2], copy the smaller into newL. whi...
""" This module tree mirrors the Linux /proc file system and provides access to it. """
path = r'D:\DATA' print(path) ''' a = 3 многострочный комментарий ''' print(len('213')) # 3 print('abc' + 'dfg') # concatenation print('test' * 4) # повторение, тоже что и 'test' + 'test' ... print('-' * 80) myjob = 'tester' for c in myjob: print(c, end='\t') print('\n') print('z' in myjob) print('t' in myjob) ...
## \file OutputFormat.py # \author Samuel J. Crawford, Brooks MacLachlan, and W. Spencer Smith # \brief Provides the function for writing outputs ## \brief Writes the output values to output.txt # \param s output message as a string # \param d_offset distance between the target position and the landing position: the of...
usuarios = ['william', 'igor', 'admin', 'iago', 'rafaela', 'kelly'] for usuario in usuarios: if usuario == 'admin': print(f'Olá admin, gostaria de ver um relatório de status?') else: print(f'Olá {usuario.title()}, obrigado por fazer login novamente.')
# -*- coding: utf-8 -*- """ Created on Fri Feb 26 12:26:30 2021 @author: Mark Skinner """ FONTNAME = {'Andika Afr': "AndikaAfr-R.ttf", \ 'Harmattan': "Harmattan-Regular.ttf", \ 'Scheherezade': "ScheherezadeNew-Regular.ttf", 'Ezra':'SILEOT.ttf'}
class ConfigurationError(Exception): pass class DiscordError(Exception): pass
class Outcome: def __init__(self, is_positive: bool, is_hard: bool): self.is_positive = is_positive self.is_hard = is_hard def __eq__(self, other): return other.is_positive == self.is_positive and other.is_hard == self.is_hard def __str__(self): return f"{'hard' if self.is...
#!/usr/bin/env python3 class Vertex: def __init__(self, val): self.val = val self.neighbors = [] class DiGraph: def __init__(self, n, edges): self.vertices = [Vertex(i) for i in range(n)] self.add_edges(edges) def add_edges(self, edges): for s, e in edges: ...
AUDIO = 'audio' VIDEO = 'video' FLOW = 'flow' ENCODERS = [AUDIO, VIDEO, FLOW] NO_SEPARATION = 'none' FREQ_MASK = 'unet_mask' SEPARATION = [NO_SEPARATION, FREQ_MASK] FFT_WINDOW = 25 * 0.001 # sec FFT_OVERLAP_R = 2 # number of window overlaps NUM_SEP_TRACKS_DEF = 32 CTX_FEATS_FCUNITS_DEF = [64, 128, 128...
def plot_img(state, img, caption="", title="Image"): vis = state["vis"] img = img / 2 + 0.5 # unnormalize vis.images(img.numpy(), padding=1, opts={"title": title, "caption": caption}, win="image-" + title, nrow=4)
test_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] min_num = 0 max_num = 0 for i in range(1, len(test_list)): if test_list[i] > test_list[max_num]: max_num = i if test_list[i] < test_list[min_num]: min_num = i test_list[min_num], test_list[max_num] = test_list[max_num], test_list[min_num] print(' '.joi...
# # PySNMP MIB module Fore-FileXfr-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Fore-FileXfr-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:03:28 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
# Order the input string by ASC (a -> z, 0 -> 9) with any string a = input("nhap vao chuoi: ") b = ''.join(sorted(str(a))) print("chuoi sau khi sap xep: " + str(b))
class Repository: def __init__(self, repository): self.client_args = self._get_client_args() pass def _get_client_args(self): pass def check_for_image(self, git_commit_ref): pass def client(self): if not hasattr(self, "_client"): self._client = Doc...
class BaseWidget: def on_key_down(self, *args, **kwargs): pass def on_key_up(self, *args, **kwargs): pass def on_mouse_down(self, *args, **kwargs): pass def on_mouse_up(self, *args, **kwargs): pass def on_mouse_motion(self, *args, **kwargs): pass def ...
""" """ def get_remote_address(request): """ :param: request: request object of sanic :return: the ip address of given request (or 127.0.0.1 if none found) """ return request.remote_addr or request.ip
class UserGroups(object): """ A class to manage all core functionalities for AirWatch Organization Groups. """ jheader = {"Content-Type": "application/json"} def __init__(self, client): self.client = client def search(self, **kwargs): """Returns the Users Groups matching the s...
#step 4: take and return input def Keyboard(): keyin = input("Command:") return (keyin) def Voice(): print("Work in progress") return 1
def maxLen(n, arr): # A hash map to map the sum until now to the first index where the sum was encountered # We stert with a sum=0 at the initial index position of -1 hash_map = {0:-1} summ = 0 max_count = 0 for i in range(n) : summ += arr[i] # If the sum is already present th...
class MemoizedRecursiveDynamicProgrammingSolver: #[memoization def __init__(self, createMap: "IForwardStateSpace -> IMap<State, R>"=lambda space: dict()): self.createMap = createMap def solve(self, space: "IBackwardsStateSpace", semiring: "ISemiRing<R>", w:"State,...
""" -------------------------------------------------------------------------------------------------------------------- Cодержит информацию о тегах, определителях и спецификаторах, названиях классов, а так же других данных, для формирования HTML-документа, и функции для получения готовых данных --- META_DET --- ROOT_...
class Solution(object): def canJump(self, nums): """ :type nums: List[int] :rtype: bool """ if len(nums) == 1: return True if nums[0] == 0: return False # find the max jump in nums maxNum = max(nums) # check 0s in nums # since only the 0s will block way to the end ...
# write a Python program to check whether variable is of integer or string var = "hello" try: print(int(var)) print(f'{var} is an integer') except ValueError: print(f'{var} is a string')
elements = [] #for i in range (0,98): # elements.append([]) # index 0 for lift, 1 for toilet, 2 for stairs #from 0 elements.append(["turn left and go straight 2 to 3 metres","turn right and go straight 4 to 5 metres","turn left and go straight 7 to 8 metres"]) #from 1 to 10 elements.append(["turn back and move 5 to ...
class Solution: def reverseBits(self, n: int) -> int: return self.__onePass(n) # return self.__twoPointers(n) # time complexity: O(n), space complexity: O(1) def __onePass(self, n: int) -> int: ans = 0 for i in range(32): bit = n >> i & 1 ans = ans <<...
# -*- coding: utf-8 -*- MEDIA_ROOT = '' MEDIA_URL = '' STATIC_ROOT = '' STATIC_URL = '/static/' STATICFILES_DIRS = () STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', )
#39-faça um programa que leia o ano de nascimento de um jovem e informe, de acordo com sua idade. # -se ele ainda vai se alistar ao serviço militar. # -se e a hora de se alistar. # -se ja passou do tempo do alistamento. # seu programa tambem devera mostrar o tempo que falta ou que passou do prazo. ano = int(input('dig...
n = input() a = sorted(map(int, input().strip().split())) d = [c2 - c1 for c1, c2 in zip(a, a[1:])] m = min(d) print(f"{m} {d.count(m)}")
x,y=map(int,input().split()) if(y<45 and x>0): print(x-1,y+15) elif(y>44): print(x,y-45) else: print(23,y+15)
#!/usr/bin/env python3.8 # ######################################## # # Python Tips, by Wolfgang Azevedo # https://github.com/wolfgang-azevedo/python-tips # # Function / Methods and Class # ######################################## # # class ShowDisclaimer: def __init__(self, message): #### Método construtor ...
words = { "giant", "robes", "harry", "stars", "albus", "james", "books", "wands", "knuts", "fangs", "ginny", "percy", "twins", "goyle", "draco", "snape", "filch", "hooch", "argus", "binns", "boils", "slugs", "patil", "pince"...
class CachedSingleton(object): """Provides caching singleton storage for data access decoration. Usage: class CachedSingletonClass(CachedSingleton): def _getitem(self, name): # implement data getting routine, such as db access CachedSingletonClass().attribute...
def install(job): service = job.service prefab = service.executor.prefab if 'redis' not in service.producers: raise j.exceptions.AYSNotFound("Can't find redis service in producers.") # configure redis connection for AYS redis = service.producers['redis'][0] # this line create the defau...
#!/usr/bin/env python3 class EmptyStackError(Exception): """Exception for operations when stack is empty.""" def __init__(self): super().__init__("Stack is empty.") class FullStackError(Exception): """Exception for operations when stack is full.""" def __init__(self): super().__init_...
class Solution: def search(self, reader, target): """ :type reader: ArrayReader :type target: int :rtype: int """
original_list = [2, 2, 2, 7, 23, 1, 44, 44, 3, 2, 10, 7, 4, 11] def remove_duplicates(numbers): unique_numbers = set() for number in numbers: if original_list.count(number) > 1: continue if number not in unique_numbers: yield number unique_numbers.add(number)...
# -*- coding: utf-8 -*- # # Copyright (C) 2020 CERN. # # Invenio-Files-Processor is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see LICENSE file for more # details. """Processors configuration.""" FILES_PROCESSOR_TIKA_SERVER_ENDPOINT = 'http://localhost:9998' FILES_PR...
# Pode ter mais que um except try: a = int(input('Digite:')) b = int(input('Digite:')) r = a / b except Exception as erro: print(f'Infelizmente tivemos um problema , foi {erro.__class__}') else: print(r) finally: print('Volte sempre! Muito obrigado')
class humidityTemp: """Declare an humidity and temperature object to interact with I2C SHT85 connected sensor""" def __init__(self, bus): self.bus = bus self.address = 0x44 self.datablock = 6 self.temperature = 0 self.relHumidity = 0 def read(self): """Read r...
def forward_index(): """ Called when the char '>' is found moves forward one index in the cell list """ pass def back_index(): """ Called when char '<' is found moves back one index in the cell list """ pass def plus_cell(): """ Called when the '+' char is found a...
''' Escreva um programa que peça o nome e a idade do usuário. Caso a idade do usuário seja maior ou igual a 18 anos apresente a seguinte mensagem: "Seja bem-vindo ao nosso site [nome]!"; caso contrário, apresente a seguinte mensagem: "Você não pode acessar nosso site [nome]''' nome = input('Digite seu nome: ').strip()....
# @Time : 2019/8/3 14:44 # @Author : shakespere # @FileName: Maximal Square.py ''' Input: 1 0 1 0 0 1 0 1 1 1 1 1 1 1 1 1 0 0 1 0 Output: 4 ''' class Solution(object): def maximalSquare(self, matrix): if not matrix: return 0 y = len(matrix) x = len(matrix[0]) dp =...
class Solution(object): def minimumSwap(self, s1, s2): """ :type s1: str :type s2: str :rtype: int """ def test_minimum_swap(): s = Solution() assert 1 == s.minimumSwap("xx", "yy") assert 2 == s.minimumSwap("xy", "yx") assert -1 == s.minimumSwap("xx", "xy") ...
s = "abcdcbea" #enter string here pal = 1 for i in range(0 , len(s)//2): if s[i] != s[-(i+1)]: pal = 0 if pal == 1:print("pal") else:print("not pal")
termos=int(input('quantidade de termos: ')) t1=0 t2=1 print('{}->{}'.format(t1,t2),end='-> ') contador=3 while contador<=termos: t3=t1+t2 print('{}'.format(t3),end='-> ') t1=t2 t2=t3 contador=contador+1
class MimeTypeNotSupported(Exception): """Mimetype is not supported from the package""" pass class MimeTypeNotDetectable(Exception): pass class ManipulatedFileError(Exception): pass
# -*- coding: utf-8 -*- COUNTRIES_LIST = [(u'Afghanistan', u'AF', u'AFG', 4, u'ISO 3166-2:AF'), (u'\xc5land Islands', u'AX', u'ALA', 248, u'ISO 3166-2:AX'), (u'Albania', u'AL', u'ALB', 8, u'ISO 3166-2:AL'), (u'Algeria', u'DZ', u'DZA', 12, u'ISO 3166-2:DZ'), (u'American Samoa', u'AS', u'ASM', 16, u'ISO 3166-2:AS'),...
#!/usr/bin/env python3.6 def create_user(first_name,last_name,contact,user_name,email,password): ''' Function to create a new user ''' new_user = User(first_name,last_name,contact,user_name,email,password) return new_user def save_users(user): ''' Function to save user ''' user.sav...
class User: 'Stores user information' def __init__(self, name, image, location, angellist_url, twitter_url, github_url, facebook_url, linkedin_url, what_ive_built, criteria, bio, blog_url, investor, skills): self.name = name self.image = image self.location = location self.angell...
""" Datos de salida hemoglobina-->hm-->float sexo-->sx-->string edad-->ed-->int Datos de entrada anemia-->anm-->string """ #Entrada hm=int(input("Ingrese el nivel de hemoglobina: ")) sx=int(input("Ingrese su sexo (1 para femenino y 2 para masculino): ")) ed=int(input("Ingrese su edad en meses: ")) #Caja negra anemia=""...
class TopologyClipError(Exception): """Raised when GeoPandas clip() fails because of topology errors""" pass class TensorShapeError(Exception): """Raised when tensor shapes do not match""" pass
# 669. 修剪二叉搜索树 # # 20200802 # huao # 以修剪小元素为例 # 如果根结点等于L,则将其左子树置为None # 如果大于L,那么对其左子树递归 # 如果小于L,那么根结点也要剪去,对其右子树递归 # 修剪大元素 类似 # Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def trimBST(self, ro...
# # Solution to Project Euler problem 116 # Copyright (c) Project Nayuki. All rights reserved. # # https://www.nayuki.io/page/project-euler-solutions # https://github.com/nayuki/Project-Euler-solutions # def compute(): LENGTH = 50 return str(sum(count_ways(LENGTH, i) for i in range(2, 5))) # How many ways can ...
# String Functions ? # Some of the most used functions to perform operations on or manipulate strings are: # String Fuctions : Examples story = '''once upon a time there was a Developer named Vasudev Jaiswal who uploaded python course with notes on github''' print(story[0:5]) # 1. len() function : It returns the...
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. HTML_TOP = ''' <!-- Copyright (c) 2012 The Chromium Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can...
print('to go on this trip you must be older than') print('18 but under 31 and provide your name') name = input('Type name here: ') age = int(input('Type age here: ')) if 18 <= age < 31: print(f'Well go get ready {name}, were leaving in an hour!') else: print(f'Sorry {name} you cant come this time.')
vehicles = [ { "Year": 2020, "Make": "Audi", "Model": "Q3", "Category": "SUV" }, { "Year": 2020, "Make": "Chevrolet", "Model": "Malibu", "Category": "Sedan" }, { "Year": 2020, "Make": "Cadillac", "Model": "Escalade ESV", "Category": "SUV" }, { "Year": 20...
#compiler for Farm programing language class infinitelist(object): #allows a list to be accessed infinitely, where indexes beyond it's length are reduced to match an index. def __init__(self, lst): self.lst = lst def __repr__(self): return str(self.lst) def __len__(self): return...
n = int(input()) # print("= [%d] samples" % n) for i in range(n): # print("== sample [%d/%d]" % (i + 1, n)) l = int(input()) # print("length [%d]" % l) h = 1 + (l >> 1) # print("half+1 [%d]" % h) s = input() # print("strips [%s]" % s) a = map(int, s.split()) if l % 2 == 0: ...
dados = list() lista = list() pesado = list() leve = list () maior = menor = 0 while True: dados.append(str(input('Nome: '))) dados.append(float(input('Peso : '))) if len(lista) == 0: maior = menor = dados[1] else: if dados[1] > maior: maior = dados[1] if dados[1] < m...
"""Exercício Python 67: Faça um programa que mostre a tabuada de vários números, um de cada vez, para cada valor digitado pelo usuário. O programa será interrompido quando o número solicitado for negativo.""" while True: num = int(input("Programa Tabuada!\nDigite um número: ")) if num < 0: break pr...
# Escreva um programa que leia dois numeros inteiros e compare-os mostrando # na tela uma mensagem # # - O primeiro valor é maior # - O segundo valor é maior # - Não existe valor maior, os dois são iguais numero_1 = int(input('Digite um numero: ')) numero_2 = int(input('Digite outro numero: ')) if numero_1 > numer...
server1 = 4 server2 = 4 server3 = 4 server4 = 4 server5 = 4 mode1 = 3 mode2 = 3 mode3 = 3 mode4 = 3 mode5 = 3 waittime = 240
def get_log_groups(logs_client): """ Generates every log group in the current AWS account. """ paginator = logs_client.get_paginator("describe_log_groups") for page in paginator.paginate(): yield from page["logGroups"] def get_log_streams(logs_client, *, log_group_name): """ Gener...
# + def iterateInner(distance, tour, length, cities, i): for j in range(i + 2, cities): newTour = twoOptSwap(i, j, tour) newLength = findTourLength(newTour, distance) if (newLength < length): curTour = newTour bestLength = newLength return curTour, bestLen...
houses = [int(x) for x in input().split("@")] command = input() index = 0 while command != "Love!": command = command.split(" ") order = command[0] length = int(command[1]) index += length if 0 <= index < len(houses): if houses[index] == 0: print(f"Place {index} already had V...
# -*- coding: utf-8 -*- # @Author: 何睿 # @Create Date: 2018-12-19 16:29:44 # @Last Modified by: 何睿 # @Last Modified time: 2018-12-19 16:43:47 class Solution: def simplifyPath(self, path): """ :type path: str :rtype: str """ if not path: retur...
# Name : Exercise7-1.py # Author : Ryan Carr # Date : 02/03/19 # Purpose : Open a file, convert all text to uppercase # and print result to screen # Text files are stored in the data folder one level up filename = '../data/mbox-short.txt' fh = open(filename,'r') for line in fh: print(line.strip()...
# 7. calculate the strength of the supports or resistances # 7.1 remove repeated values def lowest_highest_candle_price(dataframe, number_of_rows, candle_i, tolerance): lowest_candle_price = dataframe["low"][number_of_rows - candle_i] - tolerance highest_candle_price = dataframe["high"][number_of_rows - candl...
sh = input("Enter hours: ") su = input("Enter rate: ") try: #Dangerous zone, here you put the try to handle the error fh = float(sh) #Transform fh to a float value fr = float(su) #Transform fr to a float value except: print("Please enter a numeric value") quit() # print (fr, fh) if fh > 40 : #print(...
# ----------------------------------------------------------- # Copyright (c) 2021. Danil Smirnov # Write a program that finds the smallest and largest of the five numbers. # ----------------------------------------------------------- def my_min(sequence: list)-> int: lower = sequence[0] # need to start...
num = int(input("igite um número inteiro: ")) i=0 while num: i += num % 10 num //= 10 print(i)
# Exibir a mensagem "Alô mundo" na tela print("Alô Mundo") print("Linha 2") print("Linha 3") print("Linha 4") print("Nova linha") print("mais uma") print("linha 7") print("linha 8")