Created
March 26, 2019 12:40
-
-
Save vedgar/fa06bfb2c6fe5f2ba11b7e552a51bbe0 to your computer and use it in GitHub Desktop.
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
| ulaz = open('random.FASTA') | |
| ulaz = {linija.strip('>\n'): next(ulaz).strip() for linija in ulaz}.values() | |
| def podriječi(riječ): | |
| ukupna_duljina = len(riječ) | |
| for duljina in range(ukupna_duljina, 0, -1): | |
| for početak in range(ukupna_duljina - duljina + 1): | |
| yield riječ[početak : početak + duljina] | |
| def rješenje(ulaz): | |
| najkraća = min(ulaz, key=len) | |
| for test in podriječi(najkraća): | |
| if all(test in string for string in ulaz): | |
| return test | |
| print(rješenje(ulaz)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment