From 80d368e4c5ee78309338c29d2b272c063c5d20ce Mon Sep 17 00:00:00 2001 From: Ionel Andrei Cataon Date: Tue, 27 Jan 2026 20:06:30 +0200 Subject: [PATCH] Python lessons --- Python_module_1/First_01.py | 4 ---- Python_module_1/README.md | 0 Python_module_1/python_001.py | 15 +++++++++++++++ Python_module_1/python_002.py | 5 +++++ Python_module_1/python_003.py | 22 ++++++++++++++++++++++ Python_module_1/python_004.py | 12 ++++++++++++ Python_module_1/python_005.py | 7 +++++++ Python_module_1/python_006.py | 7 +++++++ Python_module_1/python_007.py | 6 ++++++ Python_module_1/python_008.py | 18 ++++++++++++++++++ 10 files changed, 92 insertions(+), 4 deletions(-) delete mode 100644 Python_module_1/First_01.py create mode 100644 Python_module_1/README.md create mode 100644 Python_module_1/python_001.py create mode 100644 Python_module_1/python_002.py create mode 100644 Python_module_1/python_003.py create mode 100644 Python_module_1/python_004.py create mode 100644 Python_module_1/python_005.py create mode 100644 Python_module_1/python_006.py create mode 100644 Python_module_1/python_007.py create mode 100644 Python_module_1/python_008.py diff --git a/Python_module_1/First_01.py b/Python_module_1/First_01.py deleted file mode 100644 index 0b3d2dd..0000000 --- a/Python_module_1/First_01.py +++ /dev/null @@ -1,4 +0,0 @@ -#!/home/andrei/it_school/bin/python3 -print("Hello, World! From It_school") -print("This is the first Python module. Va saluta Don'Python!") -print('hello world ' * 3) diff --git a/Python_module_1/README.md b/Python_module_1/README.md new file mode 100644 index 0000000..e69de29 diff --git a/Python_module_1/python_001.py b/Python_module_1/python_001.py new file mode 100644 index 0000000..7769b93 --- /dev/null +++ b/Python_module_1/python_001.py @@ -0,0 +1,15 @@ +#!/home/andrei/it_school/bin/python3 + +# declaram variabile +numar = 25 +numar_2 = 30 +suma = numar + numar_2 + +print("Hello, World! From It_school") +print("This is the first Python module. Va saluta Don'Python!") +print('hello world ' * 3) +print("variabila numar are valoarea:", numar) +print("variabila numar_2 are valoarea:", numar_2) +print("suma celor doua numere este:") +print(suma) +print("Afisam si varianta veche: suma celor doua numere este", suma) \ No newline at end of file diff --git a/Python_module_1/python_002.py b/Python_module_1/python_002.py new file mode 100644 index 0000000..3f337f1 --- /dev/null +++ b/Python_module_1/python_002.py @@ -0,0 +1,5 @@ +#!/home/andrei/it_school/bin/python3 + +varsta = input("Introduceti varsta dumneavoastra: ") +nume = input("Introduceti numele dumneavoastra: ") +print("Salut,", nume + "!", "Ai", varsta, "ani.") \ No newline at end of file diff --git a/Python_module_1/python_003.py b/Python_module_1/python_003.py new file mode 100644 index 0000000..c9a30a9 --- /dev/null +++ b/Python_module_1/python_003.py @@ -0,0 +1,22 @@ +#!/home/andrei/it_school/bin/python3 + +text = "De aici incepe si aici se termina!!" +print(text) +print(text[0]) +print(text[1]) +print(text[2]) +print(text[-1]) +print(text[-2]) +print(text[5:11]) + +x = "It School" +y = "Python" +print(x + y) + +print(len(text)) +print(find := text.find("incepe")) +print(replace := text.replace("si", "&")) +print(text.upper()) +print(text.lower()) +print(text.capitalize()) +print(text.count("i")) \ No newline at end of file diff --git a/Python_module_1/python_004.py b/Python_module_1/python_004.py new file mode 100644 index 0000000..459d0da --- /dev/null +++ b/Python_module_1/python_004.py @@ -0,0 +1,12 @@ +#!/home/andrei/it_school/bin/python3 + +ListaNume = ["Ion", "Gigel", "Dorel", "Maria", "Ionut"] +print("Punem nume:", ListaNume [4]) +print("Numarul de nume din lista este:", len(ListaNume)) +print(ListaNume.count("Ion")) +ListaNume.insert(-1, ("Ion")) +print("Afisam lista de unme:", ListaNume) +ListaNume.reverse() +print("Afisam lista inversata:", ListaNume) +ListaNume.sort() +print("Afisam lista sortata:", ListaNume) \ No newline at end of file diff --git a/Python_module_1/python_005.py b/Python_module_1/python_005.py new file mode 100644 index 0000000..b3a63fe --- /dev/null +++ b/Python_module_1/python_005.py @@ -0,0 +1,7 @@ +#!/home/andrei/it_school/bin/python3 + +x = int(input("Introduceti un numar x: ")) +if x > 5: + print("x este mai mare decat 5") +else: + print("x nu este mai mare decat 5") \ No newline at end of file diff --git a/Python_module_1/python_006.py b/Python_module_1/python_006.py new file mode 100644 index 0000000..a88c426 --- /dev/null +++ b/Python_module_1/python_006.py @@ -0,0 +1,7 @@ +#!/home/andrei/it_school/bin/python3 + +x = int(input("Introduceti o varsta: ")) +if ((x >= 0) and (x <= 18)): + print("Nu poti vota.") +else: + print("Poti vota.") \ No newline at end of file diff --git a/Python_module_1/python_007.py b/Python_module_1/python_007.py new file mode 100644 index 0000000..5aac31a --- /dev/null +++ b/Python_module_1/python_007.py @@ -0,0 +1,6 @@ +#!/home/andrei/it_school/bin/python3 + +i = 1 +while i <= 10: + print("Valoarea lui i este:", i) + i += 1 \ No newline at end of file diff --git a/Python_module_1/python_008.py b/Python_module_1/python_008.py new file mode 100644 index 0000000..f2d98bf --- /dev/null +++ b/Python_module_1/python_008.py @@ -0,0 +1,18 @@ +#!/home/andrei/it_school/bin/python3 + +x = 0 +while x < 10: + if x == 5: + print("Am ajuns la 5, iesim din bucla.") + break + print("Valoarea lui x este:", x) + x += 1 + +y = 0 +while y < 10: + y += 1 + if y == 2: + print("Sărim peste valoarea 2.") + continue + print("Valoarea lui y este:", y) +print("Am iesit din bucla.") \ No newline at end of file