elizeub

Programa Verifica se número é par ou ímpar em python

Jul 20th, 2021
2,448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.50 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. #  ParOuImpar.py
  5. #  
  6. #  Copyright 2021 Elizeu Barbosa Abreu <[email protected]>
  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.  
  26. print('{:_^45}'.format('É PAR OU ÍMPAR?'))
  27. print('Este aplicativo verifica se um número digitado é par ou ímpar...\n')
  28.  
  29.  
  30.  
  31. def parouimpar():  
  32.    
  33.     c = True
  34.     while c:
  35.         print('{:_>45}'.format(''))
  36.         num = int(input('Entre com um número inteiro: '))
  37.        
  38.         for n in range(4):
  39.             a = n * 33                             
  40.             print('processando {}%'.format(a))
  41.             sleep(2)
  42.            
  43.         print('aguarde...')
  44.         sleep(3)
  45.         print('{:_>45}'.format(''))
  46.        
  47.                    
  48.        
  49.         if num%2 == 0:
  50.            
  51.             print('O número {} é par...'.format(num))
  52.            
  53.        
  54.         else:
  55.            
  56.             print('O número {} é ímpar...'.format(num))     
  57.        
  58.    
  59. parouimpar()
  60.  
Advertisement
Add Comment
Please, Sign In to add comment