Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 7.py
- import time
- """
- funções
- """
- def tabelaDeSimbolos(
- pCodigoDeParagem=128, # representa o código de paragem
- pOrdemAscendente=True
- ):
- bCautela = type(pCodigoDeParagem)==int
- if(not bCautela):
- return False
- # o corpo da function chama-se a "implementação"
- momentoDeInicio = time.time()
- codigo: int = 0
- bDevoContinuar: bool = True
- CODIGO_DE_PARAGEM = pCodigoDeParagem
- while (bDevoContinuar):
- simbolo = chr(codigo)
- linha: str = f"{codigo} : {simbolo}"
- print(linha)
- codigo += 1
- bDevoContinuar = codigo < CODIGO_DE_PARAGEM
- # while
- momentoDeFim = time.time()
- duracao = momentoDeFim-momentoDeInicio
- return duracao
- # def tabelaDeSimbolos
- def tabelaDoMaiorParaMenor(
- pCodigoDePartida=127
- ):
- codigo: int = pCodigoDePartida
- bDevoContinuar: bool = True
- while (bDevoContinuar):
- simbolo = chr(codigo)
- linha: str = f"{codigo} : {simbolo}"
- print(linha)
- codigo -= 1
- bDevoContinuar = codigo >= 0
- # while
- # def tabelaDoMaiorParaMenor
- tabelaDoMaiorParaMenor()
Advertisement
Add Comment
Please, Sign In to add comment