diff --git a/week4/ex1.py b/week4/ex1.py index 337eeb3..195bd01 100644 --- a/week4/ex1.py +++ b/week4/ex1.py @@ -25,6 +25,8 @@ def main(): SEPREATE_VAR_WORD_DULL, SEPREATE_VAR_WORD_BOY, end=SEPREATE_VAR_WORD_DOT) + + print("\n") print('pls ignore the following line if youre using windows\' default cmd prompt e.g. cmd.exe. using bash to make it display properly.') @@ -41,6 +43,8 @@ def main(): SEPREATE_VAR_WORD_BOY, end=SEPREATE_VAR_WORD_DOT) + print("\n") + print('==End Of Ex1==') return 0 diff --git a/week5/ex1.py b/week5/ex1.py new file mode 100644 index 0000000..021f9c3 --- /dev/null +++ b/week5/ex1.py @@ -0,0 +1,13 @@ + + +def main(): + print('==Exercise 1==') + sample_tuple = (100, 200, 300) + + print(f"This is a tuple {sample_tuple}") + + print('==End Of Ex1==') + return 0 + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/week5/ex2.py b/week5/ex2.py new file mode 100644 index 0000000..8e7c1c1 --- /dev/null +++ b/week5/ex2.py @@ -0,0 +1,12 @@ +def main(): + print('==Exercise 2==') + + tuple_output = (1,2.0,'c',[4],{"value":5}) + + print(f"tuple: {tuple_output}") + + print('==End Of Ex2==') + return 0 + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/week5/ex3.py b/week5/ex3.py new file mode 100644 index 0000000..0ba3902 --- /dev/null +++ b/week5/ex3.py @@ -0,0 +1,9 @@ +def main(): + print('==Exercise 3==') + t = (1,2,3,4,5,6,7,8,9,10) + print(f'tuple:{t}\n3rd number of tuple:{t[2]}') + print('==End Of Ex3==') + return 0 + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/week5/ex4.py b/week5/ex4.py new file mode 100644 index 0000000..71c7eb0 --- /dev/null +++ b/week5/ex4.py @@ -0,0 +1,17 @@ +def main(): + print('==Exercise 4==') + + # Create a tuple containing a sequence of numbers + tuplex = (4, 6, 2, 8, 3, 1) + # Print the contents of the 'tuplex' tuple + print(tuplex) + + t_o = (*tuplex,999) + + print(f"Modified tuple: {t_o}") + + print('==End Of Ex4==') + return 0 + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/week5/ex5.py b/week5/ex5.py new file mode 100644 index 0000000..75b90e6 --- /dev/null +++ b/week5/ex5.py @@ -0,0 +1,15 @@ +def main(): + d1 = {0: 10, 1: 20} + print('==Exercise 5==') + + print(f"Before: {d1}") + + d1[2] = 30 + + print(f"After: {d1}") + + print('==End Of Ex5==') + return 0 + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/week5/ex6.py b/week5/ex6.py new file mode 100644 index 0000000..eb9c969 --- /dev/null +++ b/week5/ex6.py @@ -0,0 +1,12 @@ +def main(): + d1 = {'a': 100, 'b': 200} + d2 = {'x': 300, 'y': 200} + + print('==Exercise 6==') + d_o = {**d1,**d2} + print(f"Merged dict: {d_o}") + print('==End Of Ex6==') + return 0 + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/week5/run_all.py b/week5/run_all.py new file mode 100644 index 0000000..229d7ed --- /dev/null +++ b/week5/run_all.py @@ -0,0 +1,7 @@ +import ex1,ex2,ex3,ex4,ex5,ex6 +ex1.main() +ex2.main() +ex3.main() +ex4.main() +ex5.main() +ex6.main() \ No newline at end of file