-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFinal Project Yousef.py
More file actions
78 lines (49 loc) · 2.48 KB
/
Copy pathFinal Project Yousef.py
File metadata and controls
78 lines (49 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#Yousef Osman
#COP 2500C
#Final Project: Knightro Rock paper scissors
#November 21st 2022
import random
choices = ['rock','paper','scissors']
def endgame():
print("Knightro has challenged you to rock paper scissors")
print("You must win to beat Knightro\n")
score = 0
computer_score = 0
play = True
while play != False:
if score == 3:
print("You beat Knightro Great work!")
end_game = input("\n Select 'Y to end the game: ")
if end_game == 'Y':
play = False
break
if computer_score == 3:
print("You lost to Knightro :c ! ")
end_game = input("\n Select 'Y to end the game: ")
if end_game.upper() == 'Y':
play = False
break
user_input = input("What would you like to choose? : rock, paper, Or scissors: ")
computer_input = random.choice(choices)
#outcomes of rock paper scissors
if user_input == computer_input:
print("You tied! here are the current scores: ", "Your score: ", score, "\nKnightros Score:", computer_score)
elif user_input == 'scissors' and computer_input == 'rock':
computer_score += 1
print("You lost! here are the current scores: ", "Your score: ", score, "\nKnightros Score:", computer_score)
elif user_input == 'rock' and computer_input == 'scissors':
score +=1
print("You won! here are the current scores: ", "Your score: ", score , "\nKnightros Score:", computer_score)
elif user_input == 'scissors' and computer_input == 'paper':
score +=1
print("You won! here are the current scores: ", "Your score: ", score , "\nKnightros Score:", computer_score)
elif user_input == 'paper' and computer_input == 'scissors':
computer_score += 1
print("You lost! here are the current scores: ", "Your score: ", score, "\nKnightros Score:", computer_score)
elif user_input == 'rock' and computer_input == 'paper':
computer_score += 1
print("You lost! here are the current scores: ", "Your score: ", score, "\nKnightros Score:", computer_score)
elif user_input == 'paper' and computer_input == 'rock':
score +=1
print("You won! here are the current scores: ", "Your score: ", score, "\nKnightros Score:", computer_score)
endgame()