So I'm working with some documents in which I count certain words, see what share they take up of their respective document, and see how these shares compare between different documents.
Here's the pseudo-code of what I'm doing:
if(share doc 1 < share doc 2): (share doc 1 / share doc 2)
else: (share doc 2 / share doc 1)
The result is printed as 0.7821... , or something like that.
Now, as an example, when I put in:
5+7, 8*3
The results print to (12, 24)
Is there a way of doing this with my if-else statements too? Something in the manner of:
[if(share doc 1 < share doc 2): (share doc 1 / share doc 2)
else: (share doc 2 / share doc 1)],
[if(share doc 3 < share doc 4): (share doc 3 / share doc 4)
else: (share doc 3 / share doc 4)], ...
Print: (0.7823, 0.5682, ...)
I've tried putting in parenthesis in different places, but only get the error "SyntaxError: invalid syntax" and it points to the 'if' at the beginning.
If you need more detail, let me know. Thank you!
Aucun commentaire:
Enregistrer un commentaire