Skip to content

Commit d11f62d

Browse files
authored
Add files via upload
1 parent 8285903 commit d11f62d

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

codes_in_FEB2025/coin.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# a = ['H','T']
2+
# b = ['H','T']
3+
# c = ['H','T']
4+
# d = ['H','T']
5+
6+
# k = [(w,x,y,z) for w in a for x in b for y in c for z in d]
7+
# print(k)
8+
9+
import numpy as np
10+
11+
a = np.array([1,2,3,4])
12+
b = np.array([5,7,8,9])
13+
14+
d = [(x+y) for x in a for y in b]
15+
print(d)
16+
17+
e = d.count(8)
18+
print(e)

codes_in_FEB2025/dice.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import numpy as np
2+
3+
a = np.array([1,2,3,4,5,6])
4+
b = np.array([1,2,3,4,5,6])
5+
# c = np.array([1,2,3,4,5,6])
6+
7+
k = [(x,y) for x in a for y in b]
8+
print(k)
9+
# print(len(k))
10+
l = [(x+y) for x in a for y in b]
11+
print(l)
12+
m = l.count(6)
13+
print(m)
14+
15+
# g = len(k)
16+
prob1 = (m/len(k))
17+
18+
print(f'probability of getting sum equals 6 when two identical dices are rolled is:{prob1}')
19+
# d = [(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),(6,6,6)]
20+
21+
# e = set(d).intersection(k)
22+
# [int(1,2,3,4,5,6)]
23+
# print(e)
24+
# print(len(e))

0 commit comments

Comments
 (0)