python-structural: command-line program
41
lines of code.
This simple command-line program in python shows how you can build a simple a command-line program in python using structural concepts such as attributes, classes and methods.
On the terminal, type the following command to run the program:
python3 rock-paper-scissors.py
Result is
...
➢ python3 rock-paper-scissors.py
Your name? Ravi
Type [ Rock ] / [ Paper ] / [ Scissors ] or Q to quit: rock
Ravi picked rock.
Computer picked paper.
You lost!
Type [ Rock ] / [ Paper ] / [ Scissors ] or Q to quit: q
You won 0 times.
The computer won 1 times.
Goodbye
- game logic
- While
- If Else
- Tuple list
- import random
This code is open source. So feel free to use, modify, share, download as per your need. I do not take risk or responsibility for your errors or any commercial damage.