Skip to content

Commit c2ccdea

Browse files
Advanced Concepts
1 parent 3f241ed commit c2ccdea

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

22- Advanced Concepts/01.py

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# import module
2+
import unittest
3+
4+
# class creation
5+
class MyTestCase (unittest.TestCase):
6+
7+
def test_one (self):
8+
self.assertIn(10, [5, 7, 8, 10], "10 should be present")
9+
10+
def test_two (self):
11+
self.assertIs(type(10), int, "The Type Of 10 Is Int")
12+
13+
def test_three (self):
14+
self.assertTrue(100, "Number 100 Return True")
15+
16+
def test_four (self):
17+
self.assertFalse([], "Empty List [] Return False")
18+
19+
def test_five (self):
20+
self.assertGreaterEqual(100, 90, "Number 100 should be greater than or Or Equal 90")
21+
22+
23+
if __name__ == "__main__":
24+
25+
unittest.main()

22- Advanced Concepts/02.py

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# import modules
2+
import string
3+
import random
4+
5+
# store characters in lists
6+
s1 = list(string.ascii_lowercase)
7+
s2 = list(string.digits)
8+
9+
# shuffle lists
10+
random.shuffle(s1)
11+
random.shuffle(s2)
12+
13+
14+
result = []
15+
16+
for x in range(7):
17+
18+
result.append(s1[x])
19+
result.append(s2[x])
20+
21+
random.shuffle(result)
22+
23+
result.insert(4, "-")
24+
result.insert(9, "-")
25+
26+
output = "".join(result)
27+
28+
print(output)
29+
# p04d-8fj6-71yr3e
30+
# 5qo6-r4s8-1xpc30

0 commit comments

Comments
 (0)