Professional Documents
Culture Documents
COLLEGE
SESSION: 2018-19
GROUP MEMBERS:(1+2)
1
INDEX
1.Acknowledgment………………………………………3
2.Introduction……………………………………………..4
3.Concept …………………………………………………….5
4.Implementation…………………………………………6
5.Result ………………………………………………………..10
6.References…………………………………………………11
7.Declaration…………………………………………………12
2
Acknowledgement
Introduction
3
What is Python?
Python is an interpreted, object-oriented, high-level programming
language with dynamic semantics. Its high-level built in data structures,
combined with dynamic typing and dynamic binding, make it very
attractive for Rapid Application Development, as well as for use as a
scripting or glue language to connect existing components together.
Python's simple, easy to learn syntax emphasizes readability and
therefore reduces the cost of program maintenance. Python supports
modules and packages, which encourages program modularity and code
reuse. The Python interpreter and the extensive standard library are
available in source or binary form without charge for all major platforms,
and can be freely distributed.
Concept
4
In this game we have to enter color of the word that appears on the
screen and hence the score increases by one, the total time to play this
game is 30 seconds. Colors used in this game are Red, Blue, Green,
Pink, Black, Yellow, Orange, White, Purple and Brown. Interface will
display name of different colors in different colors. We have to
identify the color and choose the correct color name to win the game.
Implementation (code)
import tkinter
5
import random
colours = ['Red','Blue','Green','Pink','Black',
'Yellow','Orange','White','Purple','Brown']
score = 0
timeleft = 30
def startGame(event):
if timeleft == 30:
countdown()
def nextColour():
global score
global timeleft
if timeleft > 0:
6
score += 1
random.shuffle(colours)
# change the colour to type, by changing the text _and_ the colour to a
random colour value
label.config(fg = str(colours[1]), text = str(colours[0]))
def countdown():
global timeleft
if timeleft > 0:
timeleft -= 1
root.title("COLORGAME")
root.geometry("400x200")
timeLabel.pack()
RESULTS
9
10
References
youtube
Wikipedia.com
geeksforgeeks
w3schools
Google
11
Declaration
12