0% found this document useful (0 votes)
4 views18 pages

C.S Project-1

The document outlines a gaming cafe system where users register and pay to access computers for gaming, featuring a structured logout process with warnings. It also provides an overview of Python programming, its uses, advantages, and disadvantages, along with a sample code for the gaming cafe system. Additionally, it discusses the future scope of Python in various fields such as AI, data science, and web development, concluding with its versatility and community support.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views18 pages

C.S Project-1

The document outlines a gaming cafe system where users register and pay to access computers for gaming, featuring a structured logout process with warnings. It also provides an overview of Python programming, its uses, advantages, and disadvantages, along with a sample code for the gaming cafe system. Additionally, it discusses the future scope of Python in various fields such as AI, data science, and web development, concluding with its versatility and community support.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

CONTENTS

Sr.No TOPICS
1 INTRODUCTION
2 THEORY
3 USES OF PYTHON
4 ADVANTAGES & DISADVANTAGES

5 TOPIC
6 CODE
7 OUTPUT
8 FUTURE SCOPE OF PYTHON
9 CONCLUSION
10 BIBLIOGRAPHY
Introduction
In the gaming cafe scenario, customers are required to register
by creating an account using their name, mobile number, and a
4-digit password as authentication. A nominal fee of 60 rupees
grants access to one of the 30 computers for an hour of play. As
the hour elapses, the system automatically logs the user out from
the computer with intervals of warnings displayed at 5, 3, and 1
minute markers, ensuring a smooth transition. Furthermore, the
system efficiently clears all cache upon logging the user out to
maintain privacy and system performance integrity. This
structured process not only manages user access effectively but
also enhances the overall gaming experience at the cafe. Whether
it is facilitating secure access or optimizing system utilization, the
operational framework ensures seamless user interactions and
system maintenance in the dynamic gaming environment.

Basic Code Contents:


Write a code about a gaming cafe

​ • signing up - email,username,password(4digit) - store user details in server using


dictionary, and making sure each username is unique
• signing in by matching user details by looking it up on server/dictionary​
• payment - 1 minute = 1 rupee on timer - timer related​
• Termination - after timer ends, pc purges login info for privacy - time warning on
minute 1 3 and 5 for warning the customer of logout
WHAT IS PYTHON PROGRAMMING
Python is a high level programming language developed by Guido
Van Rossum in 1991.
It is an easy to learn object oriented programming(OPP) language.
Python has two modes on which it runs:
Interactive mode-Its is very useful for testing code
Script mode-It is useful when you want to save all the commands in a ​
program file and run at once.
It is made up of character sets, tokens, expressions, statements
etc.

Brief Explanation of what python is made of:


Character Set:It is a set of valid characters that a language can
recognize.(Python supports the Unicode standard).
Tokens:The smallest individual unit in a program is known as a
Token.

Expressions:It is any legal combination of symbols that represents


a value.
Comments:Comments are the additional readable information
which is read by the programmers but ignored by the python
interpreter.

Functions:A function is a code that has a name and it can be


reused by specifying its name in the program where needed.
Block and Indentation:A group of statements is part of another
statements or functionare called block.

Python does not use any symbol for it rather it uses indentation.
Uses of Python
Web Development: Frameworks like Django and Flask make web
development a breeze.
Data Analysis: Libraries like Pandas and NumPy are perfect for
crunching numbers.
Machine Learning: TensorFlow and scikit-learn are popular for
building models.
Automation: Great for writing scripts to automate repetitive
tasks.
Game Development: Libraries like Pygame can help you build your
own games.
Desktop Applications: Tkinter and PyQt can be used for creating
GUI applications.
Network Programming: Useful for building networked applications
like servers and clients.
Scientific Computing: SciPy and other libraries make it a go-to for
research.
Advantages and Disadvantages of Python:
1)Advantage of Python:
*Easy to use/ user friendly ​ *Interpreted Language​
*Cross Platform Language *Free and Open Source​ ​ ​
*Variety of Usage

2)Disadvantages of Python:
*Not the fastest Language ​ *Lesser Libraries than Java et
*Not Strong on Type binding *Not Easily Convertible/slow
Topic

-ok write a code about a gaming cafe where you have to make
account with name and mobile number and 4 digit pas pay 60
rupees to play for one hour on any of the 30 computers once one
hour ends the system logs the person out of the computer they
logged in by issue warnings displayed at 5 3 1 min left when shut
down log the person out and clear all cache in system

Hardware and software


-Server with all accounts and time remaining and things stored
there
-30 computers as shown each connected to the server for
identification verification
-And a override computer used by admin/owner that has complete
access to server name list and passwords

In this code here one hour is represented by one minute, because


when you import time it will count an hour in real time.. Consider
one min = one second in code


CODE

import time
class GamingCafe:
def __init__(self):
self.user_accounts = {}
def signup(self):
while True:
phone = input("Enter your phone
number (10 digits): ")
if len(phone) != 10 or not
phone.isdigit():
print("Invalid phone number.
Please enter a 10-digit phone number.")
else:
break
if phone in self.user_accounts:
print("This phone number is already
registered. Please login.")
return
while True:
username = input("Enter your
username: ")
if any(account["username"] ==
username for account in
self.user_accounts.values()):
print("This username is already
taken. Please choose a different username.")
else:
break
while True:
password = input("Enter a 4-digit
passcode: ")
if len(password) != 4 or not
password.isdigit():
print("Passcode must be a
4-digit number.")
else:
break
self.user_accounts[phone] = {"username":
username, "password": password}
print(f"Account created successfully for
{username}!")
def login(self):
username = input("Enter your username:
")
password = input("Enter your passcode:
")
user_found = False
for phone, account in
self.user_accounts.items():
if account["username"] == username
and account["password"] == password:
user_found = True
break
if not user_found:
print("Incorrect username or
passcode.")
return
print(f"Welcome {username}! Starting
your session.")
self.start_session()
def start_session(self):
session_time = 60
warnings = [5, 3, 1]
for time_left in range(session_time, 0,
-1):
if time_left in warnings:
print(f"Warning: {time_left}
second(s) left!")
time.sleep(1)
print("Your session has ended. Please
login again if you'd like to play more.")
if __name__ == "__main__":
cafe = GamingCafe()
while True:
print("\n1. Login")
print("2. Signup")
print("3. Exit")
choice = input("Enter your choice: ")
if choice == "1":
cafe.login()
elif choice == "2":
cafe.signup()
elif choice == "3":
print("Thank you for visiting the
gaming cafe!")
break
else:
print("Invalid choice. Please try
again.")

-
-Here we also used a def organizer provided my
our sources which is placed in front of some
variables for easy understanding
OUTPUT
1. Login
2. Signup
3. Exit
Enter your choice: 2
Enter your phone number (10 digits): 1111111111
Enter your username: 3
Enter a 4-digit passcode: 1111
Account created successfully for !

1. Login
2. Signup
3. Exit
Enter your choice: 1
Enter your username: 3
Enter your passcode: 1111
Welcome 3 ! Starting your session.
Warning: 5 second(s) left!
Warning: 3 second(s) left!​
Warning: 1 second(s) left!
Your session has ended. Please login again if you'd like to play
more.

1. Login
2. Signup
3. Exit

1. Login
2. Signup
3. Exit
Enter your choice: 1
Enter your username: 3
Enter your passcode: 4444
Incorrect username or passcode.
Future Scope of Python
Here are some areas where Python is expected to continue to
grow and thrive:

1.​Artificial Intelligence and Machine Learning: Python's


libraries like TensorFlow, Keras, and PyTorch are widely used
in AI and ML. As these fields grow, so will Python's
importance.
2.​Data Science and Analytics: With tools like Pandas, NumPy,
and Matplotlib, Python has become a staple in data analysis
and visualization. The demand for data scientists is expected
to keep growing, boosting Python's usage.
3.​Web Development: Frameworks like Django and Flask are
popular for web development. With the continuous growth of
the internet, the need for web developers proficient in
Python remains strong.
4.​Automation and Scripting: Python's simplicity makes it ideal
for writing automation scripts. As businesses look to
streamline operations, Python's role in automation will
continue to be significant.
5.​Cybersecurity: Python is used in developing security tools,
penetration testing, and automating security tasks. With the
increasing focus on cybersecurity, Python's role in this field
is expected to grow.
CONCLUSION

Python is an exceptionally versatile and powerful


programming language that has become a
cornerstone in the world of technology and software
development. Its simplicity and readability make it
accessible to beginners, while its extensive libraries
and frameworks provide advanced capabilities for
experienced developers. From web development and
data analysis to machine learning and automation,
Python's applications span a vast array of fields,
proving its adaptability and utility. The active
Python community and comprehensive documentation
further enhance its appeal, fostering an environment
of continuous learning and innovation. Whether
you're building a web application, analyzing data,
developing AI models, or automating tasks, Python
offers the tools and resources to bring your ideas
to life.
Bibliography:

1)​ Python Official Documentation:

https://www.python.org

https://www.programiz.com/online-compiler/9CcsAR9sCphGA

2)​BOOKS

Computer science with python (Sumita Arora)

3)TUTORIAL AND IDEAS

​ Codecademy. (n.d.). Learn Python 3. Retrieved from

​ https://www.codecademy.com/learn/learn-python-3

​ Pygame Community. (n.d.). Pygame Documentation. Retrieved from

​ https://www.pygame.org/docs/

4) Coding
syntax sheet :
https://indico.global/event/6155/attachments/25456/43759/beginners_python_c
heat_sheet_pcc_all.pdf

Logical error and syntax identifier/helper : chatgpt.com (def organizer)

Team - Shaurya,Nikhilesh,Mihir And Abhishek.

You might also like