diff --git a/src/09_dictionaries.py b/src/09_dictionaries.py index e41ff32537..83ed8a6e17 100644 --- a/src/09_dictionaries.py +++ b/src/09_dictionaries.py @@ -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 diff --git a/src/RPS.py b/src/RPS.py new file mode 100644 index 0000000000..5c8c763bba --- /dev/null +++ b/src/RPS.py @@ -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}")