0

why is the program picking only option 1

import sys import random ans = True while ans: question = input("Aks the magic 8 ball a question: (press enter to quit)") answer = random.randint(1,8) if question == "": sys.exit() elif ans == 1: print("It is certain") elif ans == 2: print("Outlook good") elif ans == 3: print("You may rely on it") elif ans == 4: print("Ask again later") elif ans == 5: print("Concentrate and ask again later") elif ans == 6: print("Reply hazy, try again") elif ans == 7: print("My reply is no") elif ans == 8: print("My sources say no")

11th May 2020, 10:21 AM
Gidraph Waburi
Gidraph Waburi - avatar
2 Answers
0
Code is okay, it seems you are struggling with input system on Sololearn https://code.sololearn.com/WhiNb9BkJUVC/?ref=app
11th May 2020, 10:24 AM
Raj Chhatrala
Raj Chhatrala - avatar
0
Thanks Rick, thats right, am stuck there, kindly advice how i can go around to solve the problem.
11th May 2020, 3:02 PM
Gidraph Waburi
Gidraph Waburi - avatar