Sep-15-2018, 04:47 PM
Hey there, started learning today and i'm currently trying to make an '8 ball' from a challenge online.
I'm trying to make it so when the player says NOT to terminate the program, and keep the game going, it will return to the starting point.
Also, would love to get some advice on how to get the code more efficient and tidy for the future :)
I'm trying to make it so when the player says NOT to terminate the program, and keep the game going, it will return to the starting point.
Also, would love to get some advice on how to get the code more efficient and tidy for the future :)
import random import time list = ["It is certain", "It is decidedly so", "Without a doubt", "Yes definitely", "You may rely on it", "As I see it", " yes", "Most likely", "Outlook good", "Yes", "Signs point to yes", "Reply hazy try again", "Ask again later", "Better not tell you now", "Cannot predict now", "Concentrate and ask again", "Don't count on it", "My reply is no", "My sources say no", "Outlook not so good", "Very doubtful"] int = 1 def Interface(): print("Calculating..") time.sleep(3) return ("\n" + random.choice(list) + "\n") while True: if int == 1: print("Start a new game by and ask a question") user_input = input("> ") if user_input[-1] != "?": print("You should ask in a form of a question..") else: print(Interface()) int += 1 if int != 1: print("Finish the game? (Yes/No)") user_answer = input("> ") if (user_answer.lower() == "yes"): print("Goodbye") break; if (user_answer.lower() == "no"): int == 1