Advertisement
elizeub

par ou impar python

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