ROCK, PAPER, SCISSORS ✂
Picture this, it’s 2024 and you are still playing rock paper scissors using your hands. Too corny? Okay let's think of a better headline like maybe"2024! The age where we play rock paper scissors on our computers". I know I know there is an easier way to play rock paper scissors but come on now, is this not impressive to show your friends instead? This is a fun project to do if you are just starting out in Python and need to get your hands dirty.
What you need to know?
Basic python knowledge which in this case is: How to print and how to use a bunch of else and elif statements, no seriously that is it! In case you have no idea how to do this ,I got you boo💋! You can find a tutorial about else and elif statements here.
Our first line of the code is to import getpass, in case you do not have it you can install it using pip in your terminal.
The purpose of getpass is to prevent each player from viewing their opponent's input .We then use a bunch of elif statements coupled with print statements to make the logic part of the game i.e. if player one inputs a rock and player two inputs paper, who wins and so on and so forth.
Now because I am just cool like that😎, my print statements are, well, you know, awesome! This should not limit you however, you can structure your statements however you see best as long as the logic makes sense.
A very fun and interactive way of teaching n learning
ReplyDeleteAmazing work!