Skip to content

Commit

Permalink
Added the first rock, paper, scissors session
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobwyke committed Aug 10, 2020
1 parent acfc934 commit 76cd01e
Show file tree
Hide file tree
Showing 12 changed files with 539 additions and 1 deletion.
Binary file added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# python-bites
Python Bites
A collection of Python lessons / demos / examples.
Binary file added rock-paper-scissors/.DS_Store
Binary file not shown.
9 changes: 9 additions & 0 deletions rock-paper-scissors/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Rock, Paper, Scissors

Introduction to Python session based on learning a game.

Session lasts for around 90 minutes.

## Content
- Slides for the session
- Final code for Rock, Paper, Scissors
1 change: 1 addition & 0 deletions rock-paper-scissors/code/1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("Welcome to Rock, Paper, Scissors")
4 changes: 4 additions & 0 deletions rock-paper-scissors/code/2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
print("Welcome to Rock, Paper, Scissors")

user_choice = input("What is your move? (rock, paper, scissors) ")
print("You picked " + user_choice)
11 changes: 11 additions & 0 deletions rock-paper-scissors/code/3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
print("Welcome to Rock, Paper, Scissors")

user_choice = input("What is your move? (rock, paper, scissors) ")
print("You picked " + user_choice)

if user_choice == "rock":
print("You picked rock")
elif user_choice == "paper":
print("You picked paper")
else:
print("You picked scissors")
16 changes: 16 additions & 0 deletions rock-paper-scissors/code/4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import random

print("Welcome to Rock, Paper, Scissors")

user_choice = input("What is your move? (rock, paper, scissors) ")
computer_choice = random.choice(["rock", "paper", "scissors"])

print("You picked " + user_choice)
print("The computer picked " + computer_choice)

if user_choice == "rock":
print("You picked rock")
elif user_choice == "paper":
print("You picked paper")
else:
print("You picked scissors")
31 changes: 31 additions & 0 deletions rock-paper-scissors/code/5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import random

print("Welcome to Rock, Paper, Scissors")

user_choice = input("What is your move? (rock, paper, scissors) ")
computer_choice = random.choice(["rock", "paper", "scissors"])

print("You picked " + user_choice)
print("The computer picked " + computer_choice)

if user_choice == "rock":
if computer_choice == "scissors":
print("You Win")
elif computer_choice == "paper":
print("You Lose")
else:
print("It's a draw")
elif user_choice == "paper":
if computer_choice == "rock":
print("You Win")
elif computer_choice == "scissors":
print("You Lose")
else:
print("It's a draw")
else:
if computer_choice == "paper":
print("You Win")
elif computer_choice == "rock":
print("You Lose")
else:
print("It's a draw")
Loading

0 comments on commit 76cd01e

Please sign in to comment.