Ddiddwa
Ddiddwa
A PROJECT REPORT ON
0
Certificate
……………………………………….. ………………………………………..
(Signature of student) (Signature of Teacher)
……………………………………….. ………………………………………..
(Signature of Principal) (Signature of External)
Place: Chennai
Date of submission: 14-Oct-2024
1
Acknowledgement
2
Table of contents
S. No Description Page No
1 Introduction 04
3 Proposed system 08
6 Flowchart 16
7 Source code 17
8 Output screens 20
10 Requirements 23
11 Bibliography 24
3
Introduction
Example:
1. Jumbled word: erwta
Correct word: water
2. Jumbled word: mehtatasmei
Correct word: mathematics
3. Jumbled word: keseg
Correct word: geeks
4
This is a one player game, at first program picks a random word
from the given database of words using choice () method of
random module. After shuffling the characters of picked word
using sample method of random module and shows the jumbled
word on the screen. Current player should give the answer, if it
gives the corrected answer after rearranging the characters then
player’s score is incremented by one otherwise not. After
quitting the game, winner is decided on the basis of scores.
If the user enters the right answer, then the user will be
rewarded by 100 points.
If the user does not give the right answer, then the user will
get the hint of the first letter of the original word.
And if the user enters the right answer, then the user will
be rewarded by 50 points.
If the user does not give the right answer even after getting
the hint of the first letter of the original word, then the user
will get the hint of the last letter of the original word.
And if the user enters the right answer, then the user will
be rewarded with 25 points.
If the user does not give the right answer even after getting
the hint of the last letter of the original word, he/she will
lose the game.
Hence the game will be over.
5
Advantages of the game:-
6
Objective of the project
7
Proposed system
8
The working of the game is given below:
9
System development life
cycle (SDLC)
10
The system development life cycle is a project management
technique that divides complex projects into a smaller and more
easily managed segments or phases. Segmenting projects allow
managers to verify the successful completion of project phases
before allocating resources to subsequent phases.
11
phases may be divided differently depending on the
organization.
12
Modules used and their
purposes
A. random ():
For integers, there is a uniform selection from a range. For a
sequence, there is a uniform selection of a random element. The
syntax for using this function is ‘random.random()’.
B. randrange ():
This returns a randomly selected element from the range created
by the start, stop and step arguments. The value of start is 0 by
default. Similarly the value of step is 1 by default. The syntax for
using this function is ‘random.randrange()’
13
C. shuffle ():
This function randomly reorders the element in a list. It takes a
sequence and returns the sequence in a random order. The
syntax for using this function is ‘randomly.shuffle()’
2. String module:-
3. MySql.connector module:-
14
A. cursor ():
A database cursor is a useful control structure of database
connectivity. Normally when we connect to a database from within
a script/program, the query gets sent to the server, where it gets
executed, and the set of records retrieved as per query is sent over the
connection. The syntax for using this function is ‘conn.cursor ()’
B. connect ():
After we have installed python MySql connector, we can write
python scripts using mysql.connector library that can connect to
MySql databases from within python.
Next we need to establish connection to a MySql database using
connect () function of mysql.connector package.
The Connect () function of mysql.connector establishes
connection to a MySql database and requires four parameters,
which are:
<connection-object>=mysql.connector.connect(
Host=<host-name>,
User=<username>,
Passwd=<password>,
[.database=<database>])
The syntax for using this function is :-
‘mysql.connector.connect()’
15
C. Execute ():
This method is used to execute an SQL statement. Once we have
created a cursor, we can execute SQL query using execute ()
function with cursor object.
The syntax for using this method is ‘cursor.execute ()’
For example,
If we want to view all the records of table data which is a table in
the database test to which we established connection, we can
execute SQL query ‘select’ *from data* by writing:
‘cursor.execute (‘select’ *from data*)
16
Flowchart
17
Source code
import random
import mysql.connector
conn=mysql.connector.connect(host='localhost', port= 3306 ,user='root',
password='hala17084madrid2008&&', database='demo')
cur=conn.cursor()
print("Hello User!!")
print("Welcome to the world of JUMBLE WORDs")
print("Let us start our game...")
point=0
x=True
while x:
qno=random.randrange(1,10)
sql='select*from jumbleword where wno='+str(qno)
cur.execute(sql)
for i in cur:
word=i[1]
orig=word
word=list(word)
random.shuffle(word)
wordj="".join(word)
print("Your jumbled word is here : " + wordj)
ans=input('Enter your word : ')
if ans==orig:
point=point+100
print('Your answer is correct')
cont=input('Do you want to continue (y/n)?: ')
if cont.capitalize() == 'Y':
continue
else:
break
else:
print('The word start with', orig[0])
ans=input('Enter your word : ')
if ans==orig:
point=point+50
18
print('Your answer is correct')
else:
print('The word end with', orig[-1])
ans=input('Enter your word : ')
if ans==orig:
point=point+25
print('Your answer is correct')
else:
break
print('GAME OVER')
x=False
print(' Your score is', point)
print(' I hope u enjoyed this game, comeback soon')
19
Input # 1: Database creation
10 sample rows of 2 columns (word number and word) was created in
database named “jumbleword”.
20
Output screens
Screen 1: When the answer is correct in the first attempt.
Screen 2: When the user does not get the right answer, then
the user is given hint of the first letter of the original word and
the game continues until the user says no.
Screen 3: When the user does not give the right answer even
after getting the hint, then the user will get hint of the last letter
of the original word.
21
Screen 4: When the user does not give right answer despite
two hints given, then the game gets over with last points
achieved.
22
Limitations and future scope
Limitations:-
Future scope:-
23
Requirements
Hardware required:-
Software required:-
24
Bibliography
1. www.wikipedia.com
2. www.slideshare.net
3. www.geeksforgeeks.org
4. www.google.com
5. Computer Science with Python by Sumita
Arora class XII (book)
25