Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/09_dictionaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
# value is -130 and change its name to "not a real place"
# Note: It's okay to access the dictionary using bracket notation on the
# waypoints list.
print(waypoints[0]["lon"])
# print(waypoints[0]["lon"])

waypoints[0]["lon"] = -130
waypoints[0]["name"] = "a place"
waypoints[0]["name"] = "not a real place"

print (waypoints[0].values())
# YOUR CODE HERE
Expand Down
57 changes: 57 additions & 0 deletions src/RPS.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# RPS game
import random

moves = ["r","p","s"]
wins = 0
losses = 0
ties = 0

while True:
cmd = input("~~~~~~")

cpu_move = random.choice(moves)
print(f"Cpu picks {cpu_move}")
if cmd == "r":
if cpu_move == "r":
print("You tie!")
ties += 1

elif cpu_move == "p":
print("You lost!")
losses += 1

elif cpu_move == "s":
print("You Win!")
wins += 1

elif cmd == "p":
if cpu_move == "r":
print("You Win!")
wins += 1

elif cpu_move == "p":
print("You tie!")
ties += 1

elif cpu_move == "s":
print("You lost!")
losses +=1

elif cmd == "s":
if cpu_move == "r":
print("You lost!")
losses += 1

elif cpu_move == "p":
print("You Win!")
wins += 1

elif cpu_move == "s":
print("You tie!")
ties += 1
elif cmd == "q":
print("bye")
break
else:
print("Input r,p,s, or q")
print(f"Wins: {wins}, Losses: {losses}, Ties {ties}")