from random import randint from os import system, name import re def throw(count): count = int(count) new_throw = [] for dice in range(count): new_throw.append(str(randint(1, 6))) return new_throw def show_throw(throw): pretty_list = ", ".join(throw) pretty_list += "\n" for i in range(1, len(throw) + 1): pretty_list += "^ " pretty_list += "\n" for i in range(1, len(throw) + 1): pretty_list += f"{i} " return pretty_list def clear(): if name == 'nt': _ = system('cls') else: _ = system('clear') def evaluate(inp, count): inp = str(inp) if re.search("^\d+$", inp): count = len(inp) return count def game(count): new_throw = throw(count) clear() print(show_throw(new_throw)) inp = input("Vyberte, kterými kostkami chcete hodit znovu (např. 135):") count = evaluate(inp, count) game(count) def main(): print("Vítejte ve hře v kostky!") input("Prosím, stiskněte enter pro první hod:") count = 6 game(count) if __name__ == "__main__": main()