0% found this document useful (0 votes)
23 views36 pages

Computer 2

The document is a practical file for a computer science project completed by a student at Kamal Model Senior Secondary School for the academic year 2024-2025. It includes acknowledgments to teachers and school authorities, as well as a Python implementation of a rolling dice game using the randint() function. The project aims to enhance understanding of programming concepts such as while loops, random modules, and conditional statements.

Uploaded by

mohit27112008
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views36 pages

Computer 2

The document is a practical file for a computer science project completed by a student at Kamal Model Senior Secondary School for the academic year 2024-2025. It includes acknowledgments to teachers and school authorities, as well as a Python implementation of a rolling dice game using the randint() function. The project aims to enhance understanding of programming concepts such as while loops, random modules, and conditional statements.

Uploaded by

mohit27112008
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 36

ame =

aSS =

su ject Lttbr--1\J
= - -

• Session= 2024-2025
I wish toe press rny deep sense of gratit
'H,l_

indebtness to our learned teacher Swapan Kap


Sir.PGTcom uter science.Karna!model Sr.Sec School
for his in aluable help.adviceand guidance inthe

preparation of this project.


I a also greatly indebted to our principal.
Vandana Tandon and school authorities for
providing rne with the facihties and requisite
laboratory conditions for making this practical
file.
I also extend rny thanks to a number of teachers rn
classmates and friends who helped rne to corn
this practical file successfully.
o certify that I Ak t of class
. Kamal model Senior Secondary
ool . has completed the Practical
i during the academic year
2024- 025towards partial
fulfillment of credit for the
computer science practical
evaluation of CJ;)S[ and submitted
the report. as compuled in
the fallowing paper. under
supervision.
1
Wra I W

/-tk l'U>, J- wrune, or .

...
rde, w t ULUiro::J.,,.

cjwjJo
,: ,, .
--- ':.) / / •
. .
,., t - ·
er,1j/owdrr-,c.onfso.

k Jr., .

...
\
,.J:e,,., l-c.a\ and t:k
er ,jvow4,c.onfs0 , ' lwer-

k J;. .

ru&li.PJ&li_
Type the string: Jai Shri Ram
Number of Vowels in Jai Shri is ..
Number of Ram
in Jai Shri Ram is 6
Number Consonants
UPPER in Jai Shri Ram4 is 3
Number of lower Case in Jai Shri Ram
-
is 7 _A

of case
t
r-cr, thr•
tt;
-

...
wrcr t .
ruit I
JoLlu1 :
w, J+ 'J 2l, + 'Jl,3 + ... + 'x,.,n
w rar:vn,, , /4ro
hew wor4 ar
1()
rd,,, ,,, r tL.t °,' ,,, ½

1¥ :J I f J= J<!rieK.

...
11

...
13
. .

?t
?t
?t G

re
?t Gf}
?t GP{
11 ' . .• ..·
,/'
/ /


. ..
wra tUJ r' ·,w

w{q;t/ -
15
r w ro {,;,,, -:;:: t /£1and
1 II ,

, u1£A 3;,. w 4st

...
0 axd
UJ dL
ft dL I Jee-ond.

...
11
w rel -tu; -u;; vk
w. JU

?J
cAe/4 vk rtlrv
ar 4, j; !J-, j; r4
rr otkru1 rinl an, error -

...
£Y.thon Gcnne Rolling The Dice
=

• In the roll the dice gqme. we throw q dice hqving


Six fqces. [qch fqce of the dice hqs q unique vqlue
from 1 to G. Renee. we get q rqndom number
between l to G. We cqn repeqtedly roll the dice to
obtqin different numbers from 1to G qS long qS we
wqnt. This is the
clqSSic "roll the dice" gqme

• To implement the rolling dice game in Python using


the randint() function. we will initialize two variables
min_value and max_value to the lowest and highest
number of dice i.e. land G respectively. Then. we will
use the randint() function to generate a random
integer from l to G.The randint() function takes
the
qJJd maximum value of a range as its
input
import random

X = "y"

• while x == "y":

no= random.randint(1,6)

if no== 1:
print("[---------]")
print("[ ]"}
print("[ 0 ]"}
print("[ ]"}
print("[---------]"}
if no== 2:
print("[---------]"}
print("[ 0 ]"}
print("[ ]"}
print("[ 0 ]"}
print("[----------]"}
if no== 3:
print("[---------]"}
print("[ ]"}
print("[O O OJ"}
print("[ ]"}
print("[---------]"}
if no== 4:
print("[---------]"}
print("[OI OJ"}
print("[ ]"}
print("[O OJ"}
print("[---------]"}
if no== 5:
print("[---------]"}
print("[O OJ"}
print("[ O ]"}
print("[O OJ"}
print("[---------]"}
if no== 6:
print("[---------]"}
print("[O O OJ"}
print("[ ]"}
print("[O O OJ"}
print("[---------]"}

again and n print("\n")


x=input("press y to roll
exit:")
to

Page2"
. +


+ •. • ..


• .. •

•.
•. . . . . . ••• Page 2,
I•:• •
• •••

In this article, we discussed two


approaches to implementing the rolling
dice game in python. You can make
changes to the variables used in the
program to customize the game. This will
help you learn more about the while loop,
the random module, and if-else statements

ogram a lot and learned


ets in python , Ithank my
Computer sir who gav:e me such a
amazing activity.
•• •
• •• •


• •
• •



• • Page 2'
••
•I •I
•I •

• Google
• Chat GPT
• Programiz
• C.S.J;>ook . .

'

• I

I

You might also like