Created
March 10, 2015 20:29
-
-
Save alexandre/e8cb0a71246181fb479f to your computer and use it in GitHub Desktop.
Tentando usar Python para criar um pseudo código sobre simétrico, assimétrico, transitivo e conexo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Lendo o livro Introdução a filosofia matemática...no capitulo que fala sobre a definição de ordem... | |
| """ | |
| def sim_assim_trans_con(x, y, z=None, A=[]): | |
| """Exemplo de um pseudo código com um exemplo para | |
| difenciar elementos simétricos, assimétricos, transitivos e conexos. | |
| Serve como exemplo de como substituir if/else por avaliação de expressões | |
| booleanas. | |
| :x: ? | |
| :y: ? | |
| :z: ? | |
| :A: conjunto | |
| :returns: 'simétrico'||'assimétrico'||'transitivo'||'conexo'. | |
| """ | |
| return (not z and (x == y and y == x and 'simétrico') | |
| or | |
| (x == y and y != x and 'assimétrico') | |
| or | |
| (z and x > y and y > z and x > z and 'transitivo') | |
| or | |
| (x in A and (isinstance(x, list) and A not in x and 'conexo'))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment