Skip to content

Commit 9772c1a

Browse files
author
ash
committed
day 4 done
1 parent 64ecdee commit 9772c1a

File tree

8 files changed

+45
-5
lines changed

8 files changed

+45
-5
lines changed

Day 4/Banker Roulette/task-info.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ files:
66
- name: solution.py
77
visible: true
88
learner_created: false
9-
status: Unchecked
9+
status: Solved
1010
record: -1
1111
post_submission_on_open: true

Day 4/Banker Roulette/task.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1+
import random
12
friends = ["Alice", "Bob", "Charlie", "David", "Emanuel"]
3+
num = random.randint(0,4)
4+
print(friends[num])

Day 4/IndexError/task-info.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ files:
66
- name: solution.py
77
visible: true
88
learner_created: false
9-
status: Unchecked
9+
status: Solved
1010
record: -1
1111
post_submission_on_open: true

Day 4/Lists/task-info.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ files:
66
- name: solution.py
77
visible: true
88
learner_created: false
9-
status: Unchecked
9+
status: Solved
1010
record: -1
1111
post_submission_on_open: true

Day 4/Random Module/task-info.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ files:
66
- name: solution.py
77
visible: true
88
learner_created: false
9-
status: Unchecked
9+
status: Solved
1010
record: -1
1111
post_submission_on_open: true

Day 4/Random Module/task.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
import random
3+
4+
num = random.randint(0,1)
5+
if num == 1:
6+
print('Heads')
7+
else:
8+
print('Tails')

Day 4/Rock Paper Scissors/task-info.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ files:
66
- name: solution.py
77
visible: true
88
learner_created: false
9-
status: Unchecked
9+
status: Solved
1010
record: -1
1111
post_submission_on_open: true

Day 4/Rock Paper Scissors/task.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import random
12
rock = '''
23
_______
34
---' ____)
@@ -24,3 +25,31 @@
2425
(____)
2526
---.__(___)
2627
'''
28+
comp = [rock,paper,scissors]
29+
user = input('Enter your choice R for Rock, P for paper, S for scissors: ')
30+
31+
R = rock
32+
P = paper
33+
S = scissors
34+
35+
cw = 'Computer Wins!'
36+
yw = 'You Win!'
37+
d = 'It\'s a draw!'
38+
39+
if user == 'P':
40+
print(f'You chose {P}')
41+
elif user == 'R':
42+
print(f'You chose {R}')
43+
elif user == 'S':
44+
print(f'You chose {S}')
45+
else:
46+
print('You cose an invalid option')
47+
48+
comp_choice = random.choice(comp)
49+
print(f'computer chose {comp_choice}')
50+
if user == 'R' and comp_choice == comp[0] or user == 'P' and comp_choice == comp[1] or user =='S' and comp_choice == comp[2]:
51+
print(d)
52+
elif user =='R' and comp_choice == comp[1] or user == 'P' and comp_choice == comp[2] or user == 'S' and comp_choice == comp[0]:
53+
print(cw)
54+
else:
55+
print(yw)

0 commit comments

Comments
 (0)