am_dot_com

FP 2022-10-24

Oct 24th, 2022 (edited)
321
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 1 0
  1. # 7.py
  2.  
  3. import time
  4.  
  5. """
  6. funções
  7. """
  8.  
  9. def tabelaDeSimbolos(
  10. pCodigoDeParagem=128, # representa o código de paragem
  11. pOrdemAscendente=True
  12. ):
  13. bCautela = type(pCodigoDeParagem)==int
  14. if(not bCautela):
  15. return False
  16.  
  17. # o corpo da function chama-se a "implementação"
  18. momentoDeInicio = time.time()
  19. codigo: int = 0
  20. bDevoContinuar: bool = True
  21. CODIGO_DE_PARAGEM = pCodigoDeParagem
  22. while (bDevoContinuar):
  23. simbolo = chr(codigo)
  24. linha: str = f"{codigo} : {simbolo}"
  25. print(linha)
  26. codigo += 1
  27. bDevoContinuar = codigo < CODIGO_DE_PARAGEM
  28. # while
  29. momentoDeFim = time.time()
  30. duracao = momentoDeFim-momentoDeInicio
  31. return duracao
  32. # def tabelaDeSimbolos
  33.  
  34. def tabelaDoMaiorParaMenor(
  35. pCodigoDePartida=127
  36. ):
  37. codigo: int = pCodigoDePartida
  38. bDevoContinuar: bool = True
  39. while (bDevoContinuar):
  40. simbolo = chr(codigo)
  41. linha: str = f"{codigo} : {simbolo}"
  42. print(linha)
  43. codigo -= 1
  44. bDevoContinuar = codigo >= 0
  45. # while
  46. # def tabelaDoMaiorParaMenor
  47.  
  48. tabelaDoMaiorParaMenor()
Advertisement
Add Comment
Please, Sign In to add comment