Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Kendriya Vidyalaya

I.I.T Chennai

Computer Science Group


Project
Year: 2023-24

Done by:Jaywanth Pranav(11239)

Vikhram(
Sai Siddharth(

XI-B

Abstract:
This Python Program is based upon a real life toy called
Magic 8 Ball. It is known for providing whimsical and
mysterious answers to yes-or-no questions. The core
functionality involves generating random responses from a
predefined set of classic Magic 8-Ball answers, ensuring a
dynamic and unpredictable outcome for each inquiry.

The user interacts with the program through a command-


line interface, prompting them to input their yes-or-no
question. Key features of the program include the use of
conditional statements to handle user input, a
randomization mechanism for answer selection, and a loop
structure to allow users to ask multiple questions in a
single session. Additionally, the program incorporates error
handling to gracefully manage unexpected inputs and
maintain a smooth user experience. A Python program
replicating the Magic 8-Ball experience, offering playful
responses to user queries through a command-line.

Source Code:
print("Welcome to Fortune teller")

print('Before we enter, This Python Program is not to hurt anyones intention


and it is purely intended for fun purpose, Please take it as a joke')

print('')

info=int(input('Do you want to know about this python program?\nEnter 1


for yes. Enter 2 for no: '))

print('')

if info==1:

print('This Python program is based on real life toy called Magic 8 Ball.')

print('')

print('Magic 8-Ball is a fortune-telling toy shaped like a black billiard ball


with the number 8 on it.')

print('')

print('The outer shell of the Magic 8-Ball is made of black plastic and is
spherical in shape.')

print('')

print('Inside the ball is a 20-sided die with various answers written on its
faces.')

print('')

print( 'To use the Magic 8-Ball, a person asks a yes-or-no question, shakes
the ball, and then looks through a clear window on the bottom to reveal one of
the 20 responses.')
print('')

print('The Magic 8-Ball was invented in the 1950s by Albert C. Carter,


whose mother was a professional clairvoyant. He and his mother, along with
his brother-in-law, created the novelty item.')

print('')

print('')

print('The 20 responses include classic phrases such as "Yes," "No," "Ask


again later," "Cannot predict now," and "Reply hazy, try again."')

print('')

print(' The Magic 8-Ball is meant for entertainment purposes only, and its
responses are random. It does not have any actual ability to predict the
future.')

print('')

print(' Over the years, there have been different variations of the Magic 8-
Ball, including themed versions for different movies, TV shows, and
occasions.')

print('')

elif info==2:

print('That was Insulting 🙃')

print('')

name0=input('Before we get into it,The name fortune teller or magic ball 8


seems to be very big.Can you name me as something else? ')

print('')

print(name0, 'seems cool')

print('')
name=input("Enter your name: ")

print('')

print("Hello", name)

print('')

luck=int(input("Wanna check you fortune? enter 1 for yes, enter 2 for no: "))

print('')

if luck==1:

print('Let us get started')

else:

print('Aww,that was cute but still we should check yours')

from random import randint

from time import sleep

while True:

print('')

print('press q for stopping the game')

print('')

question=input('Ask any question to '+name0+': ')

answer=randint(1,20)

if question!='q':

print("Ok my homie. Lemme think for a bit...")

print('')

sleep(3)
if question=="q":

print("Stopping the Game. Have a Nice Day 🤗")

print('Created by Jaywanth Pranav, S.Vikhram and Sai Siddarth')

sleep(5)

exit()

if answer==1:

print("It is certain. ✅")

elif answer==2:

print("It is decidedly so.🙌")

elif answer==3:

print("Without a doubt.👌")

elif answer==4:

print("Yes definitely.💯")

elif answer==5:

print("You may rely on it.🤝")

elif answer==6:

print("As I see it, yes.🌟")

elif answer==7:

print("Most likely.🤔")

elif answer==8:

print("Outlook good.🌟")

elif answer==9:
print("Yes.😊")

elif answer==10:

print("Signs point to yes.💫")

elif answer==11:

print("Reply hazy, try again.🌀")

elif answer==12:

print("Ask again later.🔄")

elif answer==13:

print("Better not tell you now.🤐")

elif answer==14:

print("Cannot predict now.🤷‍


")

elif answer==15:

print("Concentrate and ask again.🧠")

elif answer==16:

print("Don't count on it.🙅‍


")

elif answer==17:

print("My reply is no. 🚫")

elif answer==18:

print("My sources say no.📉")

elif answer==19:

print("Outlook not so good.😞")

elif answer==20:

print("Very doubtful.🤨")
Output:

You might also like