CS - Vishnu Project1)
CS - Vishnu Project1)
CS - Vishnu Project1)
New Delhi.
Submitted by
G.K.HITENDRA
V.K.SRI BALAJI
H.NIKHIL
CERTIFICATE
Place: BUJANGANOOR
Date :
ACKNOWLEDGEMENT
CRICKET GAME
It is a matter of great satisfaction and pleasure to present this project on CRICKET GAME, on the
very outset of this report, we would like to extend our sincere & heartfelt obligation towards all the
personages who have helped me in this endeavor. We also register our sense of gratitude to our
Correspondent Mr. R. Somasundram, for his active guidance, help, cooperation & immense
encouragement made this project successful.
We take this opportunity to owe my thanks to all my faculty members for their encouragement
and able guidance at every stage of this report. We wish to take this opportunity to thank our
Principal, Mr. I Sarlin, whose guidance and support has been an important factor for my
success in my entire academic period.
We also wish to thank our Project Guide Smt. S. Bhuvaneswari M.Sc., B.Ed.,
Department of Computer Science for sparing her precious time in putting together all the bits
and pieces. We brought in as raw data to her and her contribution towards the success of this
project is unmatched. We have to appreciate the guidance given by other supervisor as well as the
panels especially in our project presentation that has improved our presentation skills thanks to
their comment and advice.
We express my gratitude to all those who have directly or indirectly helped me to make this
project. We also wish to thank my parents who have always supported me and appreciated my
work wholeheartedly and been my inspiration
SOFTWARE AND HARDWARES REQUIRED:
1. Python IDLE
2. Microphone
3. A computer
4. Internet access
5. Window 7
Define a function innings that accepts the current batsman and the runs to chase as input
arguments. Ask the user to enter numbers within the range of one to six. According to the rules of
hand cricket, if both the user and the computer choose the same number, the current batsman is out.
Initialize a variable total to store the total runs scored by a batsman and set it to zero. Begin an
infinite while loop and call the input_num() function to store and validate the user’s input. Use the
random module's randint() function to choose a random number between one and six for the
computer.
Display the choices of both players, then check whether they are equal. If they are, display that
the batsman is out and return the total runs they scored in that innings Otherwise, check who is
batting and add the appropriate value to the total score, either pnum or cnum. Display the current
score of the batsman.
In the case of the second innings, you want to check if the batter has already beaten the score of their
opponent. To do so, check if the to_chase value is not empty and if the batsman’s score is greater. If
so, return their winning score.
Instructions:
import random
# Toss
else:
print("\nYou lost the toss")
if random_opt == 1:
c_opt = "bat"
print("Computer choose to",c_opt)
elif random_opt == 2:
c_opt = "ball"
print("Computer choose to",c_opt)
# First Innings
runs_1 = 0
wickets_1 = 0
balls_1 = 0
while wickets_1 != 2 and balls_1 != 12:
else:
print("Your choice: ",u_choice,"\nComputer's choice: ",c_choice)
if u_choice == c_choice:
wickets_1 += 1
else:
if u_opt == "bat" or c_opt == "ball":
Bat_first = "You"
Ball_first = "Computer"
runs_1 += u_choice
print("\nScore =",runs_1,"/",wickets_1)
balls_1 += 1
if balls_1 == 6:
print("End of Over 1")
else:
print("Your choice: ",u_choice,"\nComputer's choice: ",c_choice)
if u_choice == c_choice:
wickets_2 += 1
else:
if Bat_first == "Computer":
runs_2 += u_choice
Bat_second = "You"
print("\nScore =",runs_2,"/",wickets_2)
balls_2 += 1
if balls_2 == 6:
print("End of Over 1")
print("\nFinal Score:")
print("Runs =",runs_2)
print("wickets =",wickets_2)
# Result of Match
if Bat_first == "You":
print("\nCongratulations! You won the Match by",runs_1 - runs_2,"runs.")
else:
print("\nBetter luck next time! The Computer won the Match by",runs_1 - runs_2,"runs.")
if Bat_second == "You":
print("\nCongratulations! You won the Match by",2 - wickets_2,"wickets.")
else:
print("\nBetter luck next time! The Computer won the Match by",2 - wickets_2,"wickets.")
else:
print("The Match is a Tie.","\nNo one Wins.")
SOURCE CODE:
import random
import datetime
i=0
# Home Function
def Home():
ch=int(input("->"))
if ch == 1:
print(" ")
Booking()
elif ch == 2:
print(" ")
Rooms_Info()
elif ch == 3:
print(" ")
restaurant()
elif ch == 4:
print(" ")
Payment()
elif ch == 5:
print(" ")
Record()
else:
exit()
def date(c):
elif c[0]<29:
pass
else:
print("Invalid date\n")
name.pop(i)
phno.pop(i)
add.pop(i)
checkin.pop(i)
checkout.pop(i)
Booking()
else:
print("Invalid date\n")
name.pop(i)
phno.pop(i)
add.pop(i)
checkin.pop(i)
checkout.pop(i)
Booking()
else:
print("Invalid date\n")
name.pop(i)
phno.pop(i)
add.pop(i)
checkin.pop(i)
checkout.pop(i)
Booking()
else:
print("Invalid date\n")
name.pop(i)
phno.pop(i)
add.pop(i)
checkin.pop(i)
checkout.pop(i)
Booking()
# Booking function
def Booking():
else:
print("\tName, Phone no. & Address cannot be
empty..!!")
cii=str(input("Check-In: "))
checkin.append(cii)
cii=cii.split('/')
ci=cii
ci[0]=int(ci[0])
ci[1]=int(ci[1])
ci[2]=int(ci[2])
date(ci)
coo=str(input("Check-Out: "))
checkout.append(coo)
coo=coo.split('/')
co=coo
co[0]=int(co[0])
co[1]=int(co[1])
co[2]=int(co[2])
date(co)
d1 = datetime.datetime(ci[2],ci[1],ci[0])
d2 = datetime.datetime(co[2],co[1],co[0])
d = (d2-d1).days
day.append(d)
ch=int(input("->"))
rc.append(0)
p.append(0)
if p1 not in phno:
phno.append(p1)
elif p1 in phno:
for n in range(0,i):
if p1== phno[n]:
if p[n]==1:
phno.append(p1)
elif p1 in phno:
for n in range(0,i):
if p1== phno[n]:
if p[n]==0:
print("\tPhone no. already exists and
payment yet not done..!!")
name.pop(i)
add.pop(i)
checkin.pop(i)
checkout.pop(i)
Booking()
print("")
print("\t\t\t***ROOM BOOKED SUCCESSFULLY***\n")
print("Room No. - ",rn)
print("Customer Id - ",cid)
roomno.append(rn)
custid.append(cid)
i=i+1
n=int(input("0-BACK\n ->"))
if n==0:
Home()
else:
exit()
# ROOMS INFO
def Rooms_Info():
print(" ------ HOTEL ROOMS INFO ------")
print("")
print("STANDARD NON-AC")
print("---------------------------------------------------------------")
print("Room amenities include: 1 Double Bed, Television,
Telephone,")
print("Double-Door Cupboard, 1 Coffee table with 2 sofa,
Balcony and")
print("an attached washroom with hot/cold water.\n")
print("STANDARD NON-AC")
print("---------------------------------------------------------------")
print("Room amenities include: 1 Double Bed, Television,
Telephone,")
print("Double-Door Cupboard, 1 Coffee table with 2 sofa,
Balcony and")
print("an attached washroom with hot/cold water + Window/Split
AC.\n")
print("3-Bed NON-AC")
print("---------------------------------------------------------------")
print("Room amenities include: 1 Double Bed + 1 Single Bed,
Television,")
print("Telephone, a Triple-Door Cupboard, 1 Coffee table with 2
sofa, 1")
print("Side table, Balcony with an Accent table with 2 Chair and
an")
print("attached washroom with hot/cold water.\n")
print("3-Bed AC")
print("---------------------------------------------------------------")
print("Room amenities include: 1 Double Bed + 1 Single Bed,
Television,")
print("Telephone, a Triple-Door Cupboard, 1 Coffee table with 2
sofa, ")
print("1 Side table, Balcony with an Accent table with 2 Chair
and an")
print("attached washroom with hot/cold water + Window/Split
AC.\n\n")
print()
n=int(input("0-BACK\n ->"))
if n==0:
Home()
else:
exit()
# RESTAURANT FUNCTION
def restaurant():
ph=int(input("Customer Id: "))
global i
f=0
r=0
for n in range(0,i):
if custid[n]==ph and p[n]==0:
f=1
print("-------------------------------------------------------------------------")
print(" Hotel AnCasa")
print("-------------------------------------------------------------------------")
print(" Menu Card")
print("-------------------------------------------------------------------------")
print("\n BEVARAGES
26 Dal Fry................ 140.00")
print("---------------------------------- 27 Dal
Makhani............ 150.00")
print(" 1 Regular Tea............. 20.00 28 Dal
Tadka.............. 150.00")
print(" 2 Masala Tea.............. 25.00")
print(" 3 Coffee.................. 25.00 ROTI")
print(" 4 Cold Drink.............. 25.00
----------------------------------")
print(" 5 Bread Butter............ 30.00 29 Plain
Roti.............. 15.00")
print(" 6 Bread Jam............... 30.00 30 Butter
Roti............. 15.00")
print(" 7 Veg. Sandwich........... 50.00 31 Tandoori
Roti........... 20.00")
print(" 8 Veg. Toast Sandwich..... 50.00 32 Butter
Naan............. 20.00")
print(" 9 Cheese Toast Sandwich... 70.00")
print(" 10 Grilled Sandwich........ 70.00 RICE")
print("
----------------------------------")
print(" SOUPS 33
Plain Rice.............. 90.00")
print("---------------------------------- 34 Jeera
Rice.............. 90.00")
print(" 11 Tomato Soup............ 110.00 35 Veg
Pulao.............. 110.00")
print(" 12 Hot & Sour............. 110.00 36 Peas
Pulao............. 110.00")
print(" 13 Veg. Noodle Soup....... 110.00")
print(" 14 Sweet Corn............. 110.00 SOUTH
INDIAN")
print(" 15 Veg. Munchow........... 110.00
----------------------------------")
print(" 37
Plain Dosa............. 100.00")
print(" MAIN COURSE 38
Onion Dosa............. 110.00")
print("---------------------------------- 39 Masala
Dosa............ 130.00")
print(" 16 Shahi Paneer........... 110.00 40 Paneer
Dosa............ 130.00")
print(" 17 Kadai Paneer........... 110.00 41 Rice
Idli.............. 130.00")
print(" 18 Handi Paneer........... 120.00 42 Sambhar
Vada........... 140.00")
print(" 19 Palak Paneer........... 120.00")
print(" 20 Chilli Paneer.......... 140.00 ICE CREAM")
print(" 21 Matar Mushroom......... 140.00
----------------------------------")
print(" 22 Mix Veg................ 140.00 43
Vanilla................. 60.00")
print(" 23 Jeera Aloo............. 140.00 44
Strawberry.............. 60.00")
print(" 24 Malai Kofta............ 140.00 45
Pineapple............... 60.00")
print(" 25 Aloo Matar............. 140.00 46 Butter
Scotch........... 60.00")
print("Press 0 -to end ")
ch=1
while(ch!=0):
# PAYMENT FUNCTION
def Payment():
ph=str(input("Phone Number: "))
global i
f=0
for n in range(0,i):
if ph==phno[n] :
# checks if payment is
# not already done
if p[n]==0:
f=1
print(" Payment")
print(" --------------------------------")
print(" MODE OF PAYMENT")
else:
for j in range(n+1,i):
if ph==phno[j] :
if p[j]==0:
pass
else:
f=1
print("\n\tPayment has been
Made :)\n\n")
if f==0:
print("Invalid Customer Id")
n = int(input("0-BACK\n ->"))
if n == 0:
Home()
else:
exit()
# RECORD FUNCTION
def Record():
# checks if any record exists or not
if phno!=[]:
print(" *** HOTEL RECORD ***\n")
print("| Name | Phone No. | Address | Check-In |
Check-Out | Room Type | Price |")
print("-------------------------------------------------------------------------------
---------------------------------------")
for n in range(0,i):
print("|",name[n],"\t |",phno[n],"\t|",add[n],"\
t|",checkin[n],"\t|",checkout[n],"\t|",room[n],"\t|",price[n])
print("-------------------------------------------------------------------------------
---------------------------------------")
else:
print("No Records Found")
n = int(input("0-BACK\n ->"))
if n == 0:
Home()
else:
exit()
# Driver Code
Home()
Output:
Functions Created
Home()- Function to display the project’s main screen i.e. the
home page of the project or you can say the main menu for
selecting the desired operation to perform.
Date(str)- Function to validate date entered by the user/customer.
Booking()- Function for booking room in hotel by entering
user/customer details.
Room_Info()- Function to provide users/customers with hotel
rooms information(i.e. about room amenities).
Restaurant()- Function for room service which provides
user/customer with the restaurant’s menu card to order food at
the room.
Payment()- Function for payment of hotel room and restaurant
bill generation at the time of check-out.
Record()- Function for keeping records of customers stayed in
the hotel.
BIBLIOGRAPHY:
To develop this project many references were used:
1. Computer Science with Python by Sumitha Arora, Dhanpat Rai
Publications.
2. https://www.google.com
3. https://stackoverflow.com
4. www.geeksforgeeks.org
5. www.pypi.org
6. www.youtube.com