elizeub

Taximetro Maluco em Python

Jul 21st, 2021 (edited)
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.22 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. #  Taximetro.py
  5. #  
  6. #  Copyright 2021 Elizeu Barbosa Abreu <elizeubcorreios@gmail.com>
  7. #  
  8. #  This program is free software; you can redistribute it and/or modify
  9. #  it under the terms of the GNU General Public License as published by
  10. #  the Free Software Foundation; either version 2 of the License, or
  11. #  (at your option) any later version.
  12. #  
  13. #  This program is distributed in the hope that it will be useful,
  14. #  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. #  GNU General Public License for more details.
  17. #  
  18. #  You should have received a copy of the GNU General Public License
  19. #  along with this program; if not, write to the Free Software
  20. #  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  21. #  MA 02110-1301, USA.
  22. #  
  23. #  
  24. from time import sleep
  25. import os
  26. from random import choice
  27.  
  28. def cls():
  29.     os.system('clear')
  30.  
  31. def taximetro():
  32.     tabela1 = ['0.9', '0.8', '0.7', '0.8', '0.7']
  33.     preco_maior = choice(tabela1)
  34.     preco_maior = float(preco_maior)
  35.    
  36.     tabela2 = ['0.65', '0.55', '0.45', '0.35', '0.25']
  37.     preco_menor = choice(tabela2)
  38.     preco_menor = float(preco_menor)
  39.    
  40.    
  41.     print('{:^45}'.format('TAXIMETRO MALUCO'))
  42.     print('\nESTE APP CALCULA O PREÇO DA CORRIDA...')
  43.     sleep(2)
  44.     cls()
  45.    
  46.     print('{:^45}'.format('TAXIMETRO MALUCO'))
  47.     print('\nACESSANDO NOSSOS SERVIDORES...')
  48.     sleep(2)
  49.     cls()  
  50.    
  51.     print('{:^45}'.format('TAXIMETRO MALUCO'))
  52.     print('\nVERIFICANDO PREÇO POR KM PERCORRIDO...')
  53.     sleep(2)
  54.     cls()
  55.    
  56.     print('{:^45}'.format('TAXIMETRO MALUCO'))
  57.     print('{:+>45}'.format(''))
  58.     print('{:^45}'.format('TABELA DE PREÇO:'))
  59.     print('Até 200KM: R${:.2f}'.format(preco_maior))
  60.     print('Acima de 200KM: R${:.2f}'.format(preco_menor))
  61.     print('{:+>45}'.format(''))
  62.    
  63.     distancia = float(input('\n\033[1;32;40mQual a distância da corrida?\33[m '))
  64.     if distancia <= 200:
  65.        
  66.         print('\nO preço da corrida é de \033[1;30;43mR${:.2f}\033[m'.format(distancia * preco_maior))
  67.     else:
  68.        
  69.         print('\nO preço da corrida é de \033[1;30;43mR${:.2f}\033[m'.format(distancia * preco_menor))
  70.     print('{:+>45}'.format(''))
  71.    
  72.     sleep(5)
  73.     cls()
  74.    
  75. c = True
  76. while c:
  77.     taximetro()
  78.  
Add Comment
Please, Sign In to add comment