Advertisement
elizeub

Radar Eletrônico em Python

Jul 19th, 2021
1,218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.37 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. #  RadarEletronico.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.  
  25. # Bibliotecas importadas
  26. from time import sleep
  27. from random import choice
  28.  
  29. # Imprimir Título
  30. print('\n' * 2)
  31. print('{:_^40}'.format('RADAR ELETRÔNICO'))
  32.  
  33. # Declaração da função radar()
  34. def radar():
  35.    
  36.     # o policial rodoviario está trabalhando rsrsrs
  37.     prf_trabalhando = True
  38.     while prf_trabalhando:
  39.         print('\n' * 2)
  40.         print('VEÍCULO PASSANDO...')
  41.         sleep(1)
  42.         velocidade = float(input('A que velocidade o veículo passou? '))
  43.         placa = str(input('Placa do veículo: ')).upper()
  44.        
  45.         # Sorteio dos nomes através do choice
  46.         lista_nome = ['joão', 'jonas', 'pedro', 'sebastião', 'josé', 'tereza', 'maria', 'joana']
  47.         nome = choice(lista_nome).upper()
  48.         lista_sobrenome = ['da silva', 'de souza', 'de paula', 'santos']
  49.         sobrenome = choice(lista_sobrenome).upper()
  50.        
  51.        
  52.         print('CHECANDO A VELOCIDADE...')
  53.         sleep(1)
  54.         print('CHECANDO A PLACA {}...'.format(placa))
  55.         sleep(2)
  56.         print('PROCESSANDO...')
  57.         sleep(3)
  58.        
  59.         # A velocidade da via é de 80km/h
  60.         if velocidade <= 80:           
  61.             print('VEÍCULO SEM DENÚNCIA DE ROUBO...\nSEM MULTAS...\nBOA VIAGEM!!!')
  62.         else:
  63.            
  64.             # Multa de R$7.00 por km excedente
  65.             multa = 7 * (velocidade - 80)
  66.             print('O VEÍCULO ESTÁ ACIMA DA VELOCIDADE...')
  67.             print('IMPRIMINDO MULTA...')
  68.             sleep(2)
  69.             print('SR(A). {} {},\n MULTA DE R${:2.2f} NA PLACA {} POR EXCESSO DE VELOCIDADE...\nO VALOR PODE SER PAGO EM QUALQUER BANCO OU CASA LOTÉRICA...'.format(nome, sobrenome, multa, placa))
  70.  
  71. # Excução da função radar()
  72. radar()  
  73.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement