ATHARVA PWP Report
ATHARVA PWP Report
SANGLI
SUBJECT: PYTHON
TITLE:
SNAKE-WATER-GUN GAME
SUBMITTED BY:
To ensure user input validation and prevent invalid entries using exception
handling.
The game consists of three choices: Snake (0), Water (1), and Gun (2).
A function was created to compare the choices of the user and the
computer.
import random
if comp == user:
return 0 # Draw
elif (user, comp) in win_combinations:
return 1
else:
return -1
comp = random.randint(0, 2)
if score == 0:
print("It's a draw!")
elif score == 1:
print("You win!")
else:
print("You lose!")
except ValueError as e:
print(e)
OUTPUTS OF MICRO-PROJECT
SKILLS DEVELOPED
Programming Skills
Gained practical experience in Python programming.
Applied loops (while), conditional statements (if-else), and functions (def)
effectively.
Implemented randomization using the random module for generating
computer choices.
Used exception handling (try-except) to prevent crashes and handle user
input errors.
APPLICATIONS OF MICROPROJECT
Game Development
Logic-Based Simulations
The game can be converted into a GUI-based version using Tkinter or Pygame for
better user experience.
Multiplayer Mode
AI can be added to learn from previous games and make intelligent moves.
The game can be converted into a fully functional mobile application for Android and
iOS.
Can integrate speech recognition to allow voice commands for user input.
Can be developed into an online game where players can compete with each other
over the internet.
CONCLUSION