DEV Community

loading...
Cover image for My First Python Game

My First Python Game

Jai Irkal
Computer Science Engineering Student @ SDMCET
Updated on ・1 min read

Hello coders and developers!
This is the first game I have made a Stone-Paper-Scissors-Game 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

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...




Discussion (0)