diff --git a/3.9/dict_ior1.py b/3.9/dict_ior1.py new file mode 100644 index 0000000..768220b --- /dev/null +++ b/3.9/dict_ior1.py @@ -0,0 +1,6 @@ +x = {"key1": "value1 from x", "key2": "value2 from x"} +y = {"key2": "value2 from y", "key3": "value3 from y"} +print(x | y) +# {'key1': 'value1 from x', 'key2': 'value2 from y', 'key3': 'value3 from y'} +print(y | x) +# {'key2': 'value2 from x', 'key3': 'value3 from y', 'key1': 'value1 from x'} diff --git a/3.9/dict_ior2.py b/3.9/dict_ior2.py new file mode 100644 index 0000000..894539a --- /dev/null +++ b/3.9/dict_ior2.py @@ -0,0 +1,6 @@ +x = {"key1": "value1 from x", "key2": "value2 from x"} +y = {"key2": "value2 from y", "key3": "value3 from y"} +x |= y + +print(x) +print(y) diff --git a/3.9/hints.py b/3.9/hints.py new file mode 100644 index 0000000..2a682d3 --- /dev/null +++ b/3.9/hints.py @@ -0,0 +1,9 @@ +from typing import List # WHY?) + + +def print_all(names: list[str]) -> None: + for name in names: + print("Hello", name) + + +print_all(['Flyaps', 'Google', 'Apple']) diff --git a/3.9/str_methods.py b/3.9/str_methods.py new file mode 100644 index 0000000..562c6b1 --- /dev/null +++ b/3.9/str_methods.py @@ -0,0 +1,13 @@ +string = '12|34|56' + +string = string.removeprefix('34') # No effect +print(string) # 12|34|56 + +string = string.removeprefix('12') +print(string) # |34| + +string = string.removesuffix('56') +print(string) # |34| + +string = string.removesuffix('34') # No effect +print(string) # |34|