Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
July 28, 2021 05:17 pm GMT

Stone-Paper-Scissor-Game

Hello coders and developers!
This is the first game I have made using Python. I have not used any library like PyGame. I have developed it using the random module in the Python Standard Library.

Python Standard Library

Python Standard Library is a set of modules which are included with every Python installation.
One of them used in this game is random module.

Random Module

Important functions in the random module are randint() and choice().
In this game I have used the choice() function.
1. randint() ---> This function returns any random integer within the given arguments.
2. choice() ---> This function returns a random value from a tuple or a list.

Talking about my game, it takes a user input for stone paper or scissors and the computer chooses a random value i.e. stone paper or scissors. You know the rest rules I think
So this was the simple logic I used.

The link for all the files is here. I have also converted the game into a module so that it looks clean

Happy Coding!

GitHub logo JaiIrkal / Stone-Paper-Scissors-Game

Stone paper scissors game using Python

Stone-Paper-Scissors-Game

Stone paper scissors game using Python

A simple stone paper scissors game like we used to play when we all were kids.Simple Python is being used using the random module from Standard Python Library.

I have also converted the game into module for simple use...





Original Link: https://dev.to/irkal_jai/stone-paper-scissor-game-546k

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To