SPINNING WHEEL
Reg No:1202017 Name : S.RAGHAV
A Project work submitted
TO
CENTRAL BOARD OF SECONDARY EDUCATION
INDIA
In partial fulfillment of the requirement for
Class – XII, 2023 – 24
1
VELAMMAL VIDYALAYA
MANGADU
CLASS – XII PROJECT
Reg No :
CERTIFICATE
This is to certify that RAGHAV.S of class XII-B, Reg No: 1202017 has
successfully completed the project work entitled “SPINNING WHEEL WITH
PYTHON” in the subject Computer science (083) and submitted to Central
Board of Secondary Education.
During the academic year: 2022-23
PRINCIPAL AHM
INTERNAL EXAMINER EXTERNAL EXAMINER
2
TABLE OF CONTENTS
S.NO DESCRIPTION PAGE NO
01 ACKNOWLEDGEMENT 4
02 INTRODUCTION 5
03 OBJECTIVES OF THE PROJECT 6
04 FLOW CHART 7
05 SOURCE CODE 8
06 OUTPUT 9
07 TESTING 10
08 HARDWARE AND SOFTWARE REQUIREMENTS 11
09 BIBLIOGRAPHY 11
3
ACKNOWLEDGEMENT
First and foremost my grateful thanks to almighty for his divine blessing and
grace in making this project successful and I thank my parents for giving me all
this life and opportunity. I acknowledge my sincere thanks to The Chairman and
The Correspondent of Velammal Educational Trust for providing me this
opportunity and necessary facilities for completing this study. My profound
gratitude and heartfelt thanks to Ms.Shamsunnisa begum , Principal, and respected
HM Ms.Sudarkodi Velammal Vidyalaya Mangadu. Ma’am, thank you for your
expertise, enthusiasm, and especially for your precious time and for the kind help
in all situations throughout the academic year.
It is a proud privilege to express my sincere gratitude to my guide Ms.Raj
kohila, Faculty of Computer Science for constant guidance for the entire study
duration. Always looking ahead with new ideas, guiding with patience and support
in all situations.
I gladly extend my sincere thanks to my class in-charge and all Faculty members
for their support. Last but not least, I would like to show my humble gratitude to
my family members and all my friends who were the back bone for me to complete
this study successfully.
Master- S.RAGHAV
Class: XII –B
Senior secondary compartment
4
ABSTRACT
The ‘Spinning wheel’ python project is a command line
interface game that uses the random module in python to
stimulate a spinning wheel game. This game can be played by
users of all ages.
The game starts by displaying a welcome message to the user.
It then enters into a infinite loop to keep the game running
until the user chooses to exit.
Once the game starts, the program uses random module to
generate a random integer between 1 to 8. this random integer
represents the section where the wheel has stopped. The
program looks up the corresponding prize in a dictionary of
prizes, where each prize is mapped to a number between 1 to 8.
After finding the gift corresponding to the section, the program
displays the gift to the user.it then prompts the user to choose
whether to continue playing or not. If the user chooses to exit
the game, it then breaks comes out of the infinite loop and
displays a thank you message.
The "Spinning Wheel" Python project is a fun way to
demonstrate the use of the random module in Python and how
it can be used to create simple games. It also shows how
dictionaries can be used to map values to specific outcomes
and making it easy to work.
5
OBJECTIVES
OF THE
PROJECT
The objective of the "Spinning Wheel" Python code is to create
a simple game that simulates a spinning wheel and provides
the user with a random gift based on where the wheel stops.
The code aims to achieve the following objectives:
1) Create a dictionary of prizes that is used to map
the gifts to specific numbers between 1 and 8.
2) Use the random module in Python to generate a
random integer between 1 and 8.
3) Look up the gift corresponding to the section
where the wheel stops.
4) Display the gift to the user and prompt them to
continue playing or to exit.
5) Provide a way for the user to exit the game when
they are done playing.
Overall the objective of the code is to create an entertaining
game that can be played on the command-line interface using
python to demonstrate how to use or how can dictionaries and
random module used to achieve this goal simple and easier.
6
FLOWCHART
7
SOURCE CODE
import random
a=1
print("hello and welcome mate!!!")
print("lets start the game!!!")
while bool(a):
prizes={1:"nothing", 2:"new phone", 3:"sports watch", 4:"$100",5:"boardgame",
6:"teddy bear", 7:"$10",8:"paint kit"}
s=random.randint(1,8)
print()
print("the wheel stops on",s)
if s==1:
print("you won nothing")
print("sorry mate, better luck next time")
else:
print("you have won a",prizes[s])
print("\n_>enter 0 to exit\n_>enter any other number to continue")
a=int(input("enter the number:"))
print("thank you for playing the game")
8
OUTPUT
9
TESTING
Test Case 1: Spin the wheel and win a gift
1. Run the program.
2. Verify that the program displays a random gift from the
dictionary of gifts.
3. Verify that the program prompts the user to either continue
playing or exit.
Test Case 2: Exit the game
1. Run the program.
2. When prompted to spin the wheel, enter 0 to exit the game.
3. Verify that the program displays a thank you message and
exits the program.
Test Case 3: Invalid input
1. Run the program.
2. When prompted to continue playing or exit, enter an invalid
input (e.g. a string).
3. Verify that the program displays an error message and
prompts the user to enter a valid input.
10
HARDWARE AND
SOFTWARE
REQUIREMENTS
Hardware Requirements:
1. A computer running any operating system that supports
Python
2. Keyboard for input
Software Requirements:
1. Python 3.x installed on your computer
2. Basic knowledge of Python syntax and command-line
interfaces.
BIBLIOGRAPHY
Here are some resources used to create this project :
1.Python documentation - https://docs.python.org/3/
2.Python random module documentation -
https://docs.python.org/3/library/random.html
3.Python input() function documentation -
https://docs.python.org/3/library/functions.html#input
4.Python dictionaries documentation -
https://docs.python.org/3/tutorial/datastructures.html#dictiona
ries
5.Python while loop documentation -
https://docs.python.org/3/reference/compound_stmts.html#the
-while-statement
11