Demo entry 6644668

sdad

   

Submitted by anonymous on Oct 05, 2017 at 21:24
Language: Python 3. Code size: 501 Bytes.

# Import the modules
import sys
import random

ans = True

while ans:
    question = raw_input("Ask the magic 8 ball a question: (press enter to quit) ")
    
    answers = random.randint(1,8)
    
    if question == "":
        sys.exit()
    
    elif answers == 1:
        print "It is certain"
    
    elif answers == 2:
        print "Outlook good"
    
    elif answers == 3:
        print "You may rely on it"
    
    elif answers == 4:
        print "Ask again later"

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).