0% found this document useful (0 votes)
16 views2 pages

Python (19 11 24) Review

Uploaded by

nandhus3860kvk
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)
16 views2 pages

Python (19 11 24) Review

Uploaded by

nandhus3860kvk
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/ 2

SNAKE,WATER AND GUN GAME

PYTHON ASSIGNMENT
DONE BY:NANDHU S(PROV/MCA/7/24/024)
Report: Snake, Water, and Gun Game Implementation

GITHUB:

Overview

This Python script implements a simple version of the **Snake, Water, and
Gun** game, a variation of "Rock, Paper, Scissors." The user competes
against the computer in a randomized match, following specific rules to
determine the winner.

How It Works

1. Game Setup

- Numeric values are assigned to the game items:

- Snake = `-1`, **Water** = `0`, Gun = `1`.

- The user inputs one of the options, which is converted to lowercase and
mapped to its respective value.

- Invalid inputs prompt the user to choose a valid option.

2. Computer Choice

- The computer randomly selects an item using `random.randint(-1, 2)`,


which generates a number between `-1` and `1`.

3. Comparison Logic

- Choices are compared using these rules:

- Snake (`-1`) beats Water (`0`).

- Water (`0`) beats Gun (`1`).

- Gun (`1`) beats Snake (`-1`).

- A tie results in a re-prompt for the user to play again.

4. Outcome

- Based on the comparison:

- The user wins: `"U won"`.

- The user loses: `"U loose"`.

- A tie: `"Both are same"`.


SNAKE,WATER AND GUN GAME
PYTHON ASSIGNMENT
DONE BY:NANDHU S(PROV/MCA/7/24/024)

You might also like