P1 - naloga F.A.T¶
"""
https://ucilnica.fri.uni-lj.si/mod/assign/view.php?id=46140
"""
"""
Dodatna naloga
"""
print("\n\n > > Dodatna naloga")
from random import shuffle
from uuid import uuid4
besedilo = ["Ana", "Berta", "Cilka", "Dani"]
potekTmp = []
zacetkiTmp = []
for beseda in besedilo:
previousUuid = ""
for char in reversed(beseda):
uuid = uuid4()
potekTmp.append((char, uuid, previousUuid))
previousUuid = uuid
zacetkiTmp.append(previousUuid)
shuffle(potekTmp)
potek = []
for char, uuid, previousUuid in potekTmp:
# ref; https://stackoverflow.com/a/44448106/11276254
nextItemIndex = [x for x, y in enumerate(potekTmp) if y[1] == previousUuid]
nextItemIndex = nextItemIndex[0] if len(nextItemIndex) > 0 else -1
potek.append((nextItemIndex, char, ))
zacetki = []
for uuid in zacetkiTmp:
zacetki.append([x for x, y in enumerate(potekTmp) if y[1] == uuid][0])
print(zacetki)
print(potek)
"""
Osnovna naloga
"""
print("\n\n > > Osnovna naloga")
besedilo = []
zacetki = [3, 12, 11, 8]
potek = [(-1, 'a'), (15, 'n'), (10, 'a'), (1, 'A'), (9, 'l'), (4, 'i'), (-1, 'a'), (6, 't'), (2, 'D'), (0, 'k'), (16, 'n'), (5, 'C'), (14, 'B'), (7, 'r'), (13, 'e'), (-1, 'a'), (-1, 'i')]
def mkWord(index, str):
return str if index < 0 else mkWord(potek[index][0], str + potek[index][1])
for i in zacetki:
besedilo.append(mkWord(i, ""))
print(besedilo)
"""
The long-shlong
"""
print("\n\n > > The long-shlong")
zacetki = [119, 178, 321, 180, 17]
potek = [
(100, 'h'), (37, 'e'), (134, 'm'), (280, 'r'), (146, 'v'), (83, 'i'), (149, ' '), (80, 'i'),
(231, 'M'), (194, 'r'), (60, 's'), (40, 'o'), (237, 'k'), (6, 'i'), (92, 'a'), (170, 'e'),
(58, 'i'), (11, 'k'), (44, 'm'), (171, 'r'), (126, 'u'), (151, 'd'), (248, 'i'), (98, 'v'),
(168, 't'), (107, 'j'), (233, 'j'), (221, ' '), (65, 'a'), (257, 't'), (282, 'l'), (15, 'p'),
(184, 'v'), (84, ' '), (263, ' '), (117, 's'), (175, ' '), (19, ' '), (270, 'l'), (220, 'l'),
(46, 't'), (239, 'e'), (228, ' '), (71, 'v'), (268, 'a'), (104, 'i'), (271, ' '), (208, 'a'),
(308, 'a'), (72, 'e'), (223, ' '), (256, 'č'), (181, 'p'), (55, ' '), (261, 'o'), (47, 'v'),
(227, 'e'), (211, 'e'), (94, 'l'), (267, 'r'), (292, 't'), (190, 'r'), (251, 'g'), (197, 'i'),
(219, ' '), (309, ' '), (204, 'j'), (230, 'o'), (296, 'n'), (198, ','), (5, 'n'), (77, 'e'),
(105, 'p'), (173, 'G'), (153, 'a'), (166, 'a'), (177, 'l'), (125, 'm'), (289, 'o'), (272, 'š'),
(298, ' '), (185, 'v'), (209, 's'), (293, 'c'), (150, 'z'), (20, 'j'), (141, 'd'), (235, 't'),
(69, 'i'), (135, ' '), (301, 'č'), (130, ' '), (222, 'č'), (30, 'p'), (250, 'a'), (45, 'b'),
(201, 'o'), (320, 'a'), (312, ' '), (96, 'r'), (258, 'l'), (137, ' '), (87, 'o'), (290, 's'),
(28, 'l'), (214, 'r'), (13, 'm'), (191, 'i'), (286, 'm'), (64, 'o'), (0, ' '), (278, 'j'),
(93, ' '), (43, 'd'), (262, 'p'), (139, ' '), (73, '.'), (303, 'a'), (240, 'h'), (102, 'K'),
(158, ' '), (152, 'a'), (12, 'r'), (329, 'r'), (302, 'm'), (332, 'a'), (297, 'b'), (159, ' '),
(8, ' '), (226, 'e'), (129, 'j'), (313, 'r'), (70, 'č'), (327, ' '), (205, 'o'), (276, 'o'),
(38, 'e'), (316, 'b'), (75, 'p'), (167, 'r'), (306, 'j'), (283, 'r'), (265, 's'), (236, 'i'),
(122, 'a'), (50, 'k'), (22, 's'), (91, 'e'), (118, ' '), (97, 'z'), (113, ' '), (63, 'r'),
(323, 'v'), (144, 'd'), (109, 't'), (229, 't'), (311, 's'), (111, ' '), (32, 's'), (224, 'o'),
(34, 'o'), (101, 'e'), (7, 'l'), (25, 'n'), (241, 'e'), (172, 'u'), (288, 'd'), (51, 'e'),
(112, 'o'), (279, 't'), (42, 't'), (90, 'e'), (163, 'k'), (121, 'l'), (154, 's'), (199, 'p'),
(244, 'i'), (295, 'o'), (285, 'N'), (246, 'i'), (202, 'k'), (49, 'r'), (200, 'm'), (215, ' '),
(299, 'e'), (232, 'e'), (164, 'r'), (275, 'r'), (41, 'j'), (67, 'r'), (326, 'o'), (183, 'č'),
(243, 'l'), (131, 'p'), (252, 'o'), (318, 'j'), (48, 'k'), (213, 'n'), (-1, ' '), (56, 'r'),
(179, 'b'), (24, 's'), (59, 'e'), (147, 's'), (253, 'a'), (140, 'ž'), (305, 'r'), (242, 't'),
(68, 'r'), (266, 'o'), (143, ' '), (9, 'p'), (145, 'a'), (212, 'j'), (315, 'o'), (161, 'j'),
(106, 'i'), (99, 'p'), (176, 'k'), (31, 's'), (325, ' '), (186, 'p'), (33, 'e'), (85, 'l'),
(138, 'd'), (281, 'a'), (269, ' '), (189, 'p'), (322, 'z'), (210, 'a'), (287, 's'), (21, 'o'),
(76, 't'), (89, 'e'), (82, 'e'), (4, ' '), (249, 'n'), (162, 'o'), (182, 'u'), (95, ' '),
(14, 'l'), (3, 'p'), (120, 'o'), (195, ' '), (2, ' '), (81, 's'), (114, ' '), (23, 'o'),
(273, ' '), (203, ' '), (-1, ' '), (115, 'a'), (169, 's'), (307, 'l'), (193, ' '), (234, 'f'),
(133, ','), (108, 'i'), (132, 'a'), (124, ' '), (319, 'e'), (196, 'n'), (57, 'r'), (238, 'g'),
(324, 'a'), (192, 'i'), (128, 'r'), (317, ' '), (-1, '.'), (206, 'p'), (218, 'i'), (35, 'v'),
(304, 'a'), (136, 'v'), (328, 'j'), (174, 'o'), (103, 'b'), (-1, '.'), (254, 'e'), (127, 'o'),
(156, 'o'), (-1, '.'), (79, 'e'), (62, 'u'), (61, 'p'), (142, 'o'), (110, 'a'), (1, 't'),
(331, 'l'), (26, ' '), (66, 'i'), (245, ' '), (216, 'n'), (18, 'a'), (36, 'l'), (225, 'b'),
(10, 'o'), (294, 'i'), (78, 'j'), (16, 't'), (188, ' '), (277, 'i'), (300, 'u'), (264, 'k'),
(155, 's'), (284, 'e'), (157, 'e'), (291, 'a'), (88, 'm'), (123, 'p'), (148, 'e'), (310, 't'),
(165, 's'), (255, 'o'), (260, 'r'), (29, 's'), (39, 'i'), (160, 's'), (27, 'e'), (187, 'p'),
(54, 'p'), (274, 'N'), (53, ' '), (259, 'a'), (86, ' '), (314, 'p'), (207, 's'), (74, 'k'),
(330, 'e'), (217, 'e'), (247, 'g'), (116, 'i'), (52, ' ')]
besedilo2 = []
for i in zacetki:
besedilo2.append(mkWord(i, ""))
print(" ".join(besedilo2))
Zadnja posodobitev:
April 28, 2022