├── LES1 ├── .vscode │ └── launch.json └── app.py ├── LES10 └── app.py ├── LES11 └── app.py ├── LES12 └── app.py ├── LES13 └── app.py ├── LES14 └── app.py ├── LES15 └── app.py ├── LES16 └── app.py ├── LES17 ├── app-part1.py └── app-part2.py ├── LES18 └── app.py ├── LES19 └── app.py ├── LES2 └── app2.py ├── LES20 └── app.py ├── LES21 └── app.py ├── LES22 └── app.py ├── LES23 └── app.py ├── LES24 └── app.py ├── LES25 └── app.py ├── LES26 └── app.py ├── LES27 ├── __pycache__ │ └── file2.cpython-39.pyc ├── app.py └── file2.py ├── LES28 ├── __pycache__ │ └── file2.cpython-39.pyc ├── app.py └── file2.py ├── LES29 └── app.py ├── LES3 └── app.py ├── LES30 └── app.py ├── LES31 └── app.py ├── LES32 └── app.py ├── LES33 └── app.py ├── LES34 └── app.py ├── LES35 └── app.py ├── LES36 └── app.py ├── LES37 └── app.py ├── LES38 ├── app.py └── files │ └── text.txt ├── LES39 ├── app.py ├── text.txt └── text2.txt ├── LES4 └── app2.py ├── LES40 41 └── app.py ├── LES42 └── App.py ├── LES5 └── app.py ├── LES6 └── app.py ├── LES7 └── app.py ├── LES8 └── app.py └── LES9 └── app.py /LES1/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Python: Current File", 9 | "type": "python", 10 | "request": "launch", 11 | "program": "${file}", 12 | "console": "internalConsole" 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /LES1/app.py: -------------------------------------------------------------------------------- 1 | print("مهندس شيار") -------------------------------------------------------------------------------- /LES10/app.py: -------------------------------------------------------------------------------- 1 | coder = "Shiyar" 2 | text = "coder 1" 3 | 4 | print(" coder Shiyar ".isnumeric()) 5 | # isalnum() إرجاع صح إذا كانت جميع الأحرف في السلسلة أبجدية رقمية 6 | # isalpha() إرجاع صح إذا كانت جميع الأحرف في السلسلة بالأبجدية 7 | # isdecimal() إرجاع صح إذا كانت جميع الأحرف في السلسلة عبارة عن أرقام عشرية 8 | # isdigit() إرجاع صح إذا كانت جميع الأحرف في السلسلة أرقامًا 9 | # isidentifier() إرجاع صح إذا كانت السلسلة عبارة عن معرف 10 | # islower() إرجاع صح إذا كانت جميع الأحرف في السلسلة صغيرة 11 | # isnumeric() إرجاع صح إذا كانت كافة الأحرف في السلسلة رقمية 12 | # isspace() إرجاع صح إذا كانت جميع الأحرف في السلسلة مسافات بيضاء 13 | # istitle() إرجاع صح إذا كانت السلسلة تتبع قواعد العنوان 14 | # isupper() إرجاع صح إذا كانت كافة الأحرف في السلسلة أحرف كبيرة 15 | 16 | # isalnum() Returns True if all characters in the string are alphanumeric 17 | # isalpha() Returns True if all characters in the string are in the alphabet 18 | # isdecimal() Returns True if all characters in the string are decimals 19 | # isdigit() Returns True if all characters in the string are digits 20 | # isidentifier() Returns True if the string is an identifier 21 | # islower() Returns True if all characters in the string are lower case 22 | # isnumeric() Returns True if all characters in the string are numeric 23 | # isspace() Returns True if all characters in the string are whitespaces 24 | # istitle() Returns True if the string follows the rules of a title 25 | # isupper() Returns True if all characters in the string are upper case 26 | -------------------------------------------------------------------------------- /LES11/app.py: -------------------------------------------------------------------------------- 1 | 2 | number1= 20 3 | number2 = 10 4 | 5 | print(number1 is not 15) 6 | 7 | 8 | 9 | # Python Comparison Operators 10 | # ----------------------------------------------------------------- 11 | # Operator Name ترجمة 12 | # --------------------------------------------------------------- 13 | # == Equal يساوي 14 | # != Not equal لا يتساوى 15 | # > Greater than اكبر من 16 | # < Less than اصغر من 17 | # >= Greater than or equal to اكبر من او يساوي 18 | # <= Less than or equal to اصغر من او يساوي 19 | 20 | 21 | # Python Identity Operators 22 | # ----------------------------------------------------------------- 23 | # Operator Description ترجمة 24 | # --------------------------------------------------------------- 25 | # is Equal يكون | يساوي 26 | # is not Not equal لا يكون | لا يتساوى 27 | 28 | 29 | -------------------------------------------------------------------------------- /LES12/app.py: -------------------------------------------------------------------------------- 1 | name = "Shiyar" 2 | languages = {"js","html","css"} 3 | result = "js" in languages and "java" not in languages and name == "shiyar" 4 | print(result) 5 | 6 | # age = 21 7 | print(not(20<10)) 8 | # print(name == "Shiyar" and age!=20 and (age<18 or age>30 or age==21) ) 9 | 10 | 11 | 12 | # Python Logical Operators 13 | # ------------------------------------------------------------------------------------ 14 | # Operator ترجمة 15 | # ------------------------------------------------------------------------------------ 16 | # and و 17 | # or او 18 | # not عكس نتيجة - Reverse the result, returns False if the result is true 19 | # ------------------------------------------------------------------------------------ 20 | # Python Membership Operators 21 | # ------------------------------------------------------------------------------------ 22 | # Operator معنى 23 | # ------------------------------------------------------------------------------------ 24 | # in موجود في 25 | # : يقوم بإعادة صح إن كانت القيمة محددة موجودة في متغير الذي تحددها 26 | # not in غير موجود في 27 | # : يقوم بإعادة صح إن كانت القيمة محددة غير موجودة في متغير الذي تحددها 28 | 29 | 30 | 31 | # Python Comparison Operators 32 | # ----------------------------------------------------------------- 33 | # Operator Name ترجمة 34 | # --------------------------------------------------------------- 35 | # == Equal يساوي 36 | # != Not equal لا يتساوى 37 | # > Greater than اكبر من 38 | # < Less than اصغر من 39 | # >= Greater than or equal to اكبر من او يساوي 40 | # <= Less than or equal to اصغر من او يساوي 41 | 42 | 43 | # Python Identity Operators 44 | # ----------------------------------------------------------------- 45 | # Operator Description ترجمة 46 | # --------------------------------------------------------------- 47 | # is Equal يكون | يساوي 48 | # is not Not equal لا يكون | لا يتساوى -------------------------------------------------------------------------------- /LES13/app.py: -------------------------------------------------------------------------------- 1 | student_points = "Coder Shiyar" 2 | 3 | if student_points>=90 : 4 | print("علامات الطلاب ممتاز") 5 | elif student_points >=80 : 6 | print("علامات الطلاب جيد") 7 | elif student_points >=60 : 8 | print("علامات الطلاب متوسط") 9 | elif student_points <60 : 10 | print("علامات الطلاب ضعيف") 11 | 12 | # text = "Coder Shiyar" 13 | # if text == "Coder Shiyar" : 14 | # print("تحقق الشرط") 15 | # elif text == "Coder Shiyar": 16 | # print("تحقق الشرط الثاني") 17 | # else: 18 | # print("لم يتحقق الشرط") 19 | # if 20 | # elif 21 | # else 22 | 23 | 24 | # == Equal يساوي 25 | # != Not equal لا يتساوى 26 | # > Greater than اكبر من 27 | # < Less than اصغر من 28 | # >= Greater than or equal to اكبر من او يساوي 29 | # <= Less than or equal to اصغر من او يساوي 30 | 31 | # and و 32 | # or او 33 | # is Equal يكون | يساوي 34 | # is not Not equal لا يكون | لا يتساوى 35 | 36 | # not عكس نتيجة - Reverse the result, returns False if the result is true 37 | # in موجود في 38 | # : يقوم بإعادة صح إن كانت القيمة محددة موجودة في متغير الذي تحددها 39 | # not in غير موجود في 40 | # : يقوم بإعادة صح إن كانت القيمة محددة غير موجودة في متغير الذي تحددها 41 | -------------------------------------------------------------------------------- /LES14/app.py: -------------------------------------------------------------------------------- 1 | text = "Python" + " in Arabic" + " With Coder Shiyar " 2 | text += " On YouTube" 3 | print(text) 4 | # Python Arithmetic Operators - معاملات بايثون الحسابية 5 | # ---------------------------------------------------------------------------------------------------- 6 | # Operator Name ترجمة 7 | # + Addition جمع 8 | # - Subtraction طرح 9 | # * Multiplication ضرب 10 | # / Division قسمة 11 | # % Modulus يقوم بإعادة لك الباقي 12 | # ** Exponentiation الأس 13 | # // Floor division تقريب النتيجة إلى أقرب عدد صحيح 14 | # ---------------------------------------------------------------------------------------------------- 15 | # Python Assignment Operators - عوامل التعيين في بايثون 16 | # ---------------------------------------------------------------------------------------------------- 17 | # = 18 | # += 19 | # -= 20 | # *= 21 | # /= 22 | # %= 23 | # //= 24 | # **= 25 | -------------------------------------------------------------------------------- /LES15/app.py: -------------------------------------------------------------------------------- 1 | # int() تحويل البيانات إلى بيانات من نوع ارقام كاملة الذي لا يحتوي على فاصلة 2 | # float() تحويل البيانات إلى بيانات من نوع ارقام الذي يحتوي على فاصلة 3 | # str() لتحويل البيانات إلى بيانات من نوع النصي 4 | # type() يستخدم لكي تتمكن من معرفة نوع البيانات لقيمة الذي تحددها 5 | 6 | # number1 = 20 7 | # result = str(number1) + str(21) 8 | 9 | text = "2022" 10 | print(int(text) ) -------------------------------------------------------------------------------- /LES16/app.py: -------------------------------------------------------------------------------- 1 | colors = ["red","green","yellow"] 2 | list1 = ["Coder Shiyar",21,True,2500.10] 3 | print(list1[-3]) -------------------------------------------------------------------------------- /LES17/app-part1.py: -------------------------------------------------------------------------------- 1 | languages = ["Arabic","Kurdish","Dutch","English"] 2 | 3 | # languages.insert(1,"German") 4 | #languages.remove("Arabic") 5 | # languages.pop(1) 6 | 7 | #del languages 8 | languages.clear() 9 | 10 | print(languages) 11 | # 1: Change Item Value - تعديل على قيمة مخزنة ضمن لائحة 12 | 13 | # 2: Add List Items - إضافة بيانات || قيم جديدة إلى لائحة 14 | # insert() append() 15 | 16 | # 3: Remove List Items - حذف قيم || بيانات من لائحة 17 | # remove() pop() del clear() 18 | 19 | # 4: Extend List - دمج اكثر من لائحة مع بعضهم 20 | # extend() || + 21 | 22 | # 5: Python - Sort Lists - ترتيب بيانات المتواجدة ضمن لائحة 23 | # sort() reverse() sort(reverse = True) 24 | 25 | -------------------------------------------------------------------------------- /LES17/app-part2.py: -------------------------------------------------------------------------------- 1 | languages = ["Arabic","Kurdish","Dutch","English"] 2 | list2 = ["German","Afghans"] 3 | languages.extend(list2) 4 | # languages.sort(reverse=True) 5 | languages.reverse() 6 | print(languages) 7 | # 1: Change Item Value - تعديل على قيمة مخزنة ضمن لائحة 8 | 9 | # 2: Add List Items - إضافة بيانات || قيم جديدة إلى لائحة 10 | # insert() append() 11 | 12 | # 3: Remove List Items - حذف قيم || بيانات من لائحة 13 | # remove() pop() del clear() 14 | 15 | # 4: Extend List - دمج اكثر من لائحة مع بعضهم 16 | # extend() || + 17 | 18 | # 5: Python - Sort Lists - ترتيب بيانات المتواجدة ضمن لائحة 19 | # sort() reverse() sort(reverse = True) 20 | 21 | -------------------------------------------------------------------------------- /LES18/app.py: -------------------------------------------------------------------------------- 1 | list1 = ("Coder Shiyar",21,"Python") 2 | list1[0] = "Shiyar" 3 | print(list1[0] ) -------------------------------------------------------------------------------- /LES19/app.py: -------------------------------------------------------------------------------- 1 | # python sets 2 | 3 | set1 = {"html","css","bootstrap","css"} 4 | set2 = {"JavaScript","PHP","SQL"} 5 | #set1.add("JavaScript") 6 | #set1.remove("css") 7 | #set1.pop() 8 | # set1.update(set2) 9 | set1.clear() 10 | print(set1) -------------------------------------------------------------------------------- /LES2/app2.py: -------------------------------------------------------------------------------- 1 | print("Coder Shiyar") -------------------------------------------------------------------------------- /LES20/app.py: -------------------------------------------------------------------------------- 1 | data = {"name":"Coder Shiyar" , 2 | "age" : 21 , 3 | "languages" : ["English","Dutch","Kurdish","Arabic"] 4 | } 5 | # data.po-p("languages") 6 | data.popitem() 7 | # del data 8 | 9 | data.clear() 10 | 11 | print(data) 12 | 13 | 14 | # data.values() 15 | # data.keys() 16 | # data["name"] = "Coder Shiyar2" 17 | # data.update({"name":"Coder Shiyar 2"}) 18 | # data["color"] = "red" 19 | # data.update({"color":"اللون الاحمر"}) -------------------------------------------------------------------------------- /LES21/app.py: -------------------------------------------------------------------------------- 1 | counter = 0 2 | text = "codershiyar" 3 | 4 | while counter < 10: 5 | 6 | print(counter) 7 | counter += 1 8 | else: 9 | print("اكتمل تكرار تنفيذ اوامر") 10 | 11 | -------------------------------------------------------------------------------- /LES22/app.py: -------------------------------------------------------------------------------- 1 | counter = 0 2 | text = "codershiyar" 3 | 4 | while counter < 10: 5 | counter += 1 6 | if counter ==5 or counter ==8: 7 | break 8 | print(counter) 9 | 10 | else: 11 | print("اكتمل تكرار تنفيذ اوامر") 12 | 13 | -------------------------------------------------------------------------------- /LES23/app.py: -------------------------------------------------------------------------------- 1 | languages = {"html","css","js","bootstrap"} 2 | 3 | # counter =1 4 | # for language in languages: 5 | # print(str(counter) +" : "+language) 6 | # counter+=1 7 | i =1 8 | json = {"name": "Coder Shiyar" , "age" : 21 ,"country":"Netherlands" } 9 | for data in json : 10 | if data == "age": 11 | break 12 | print(str(i) +" : "+ str(json[data])) 13 | i+=1 14 | else: 15 | print("اكتمل من عرض بيانات ضمن فور لوب") -------------------------------------------------------------------------------- /LES24/app.py: -------------------------------------------------------------------------------- 1 | 2 | # def printMessage(name,message): 3 | # print("Hi " + name + " " + message) 4 | 5 | # printMessage("Coder Shiyar","welcome to python course") 6 | 7 | # def printMessage(**langauges): 8 | # for lang in langauges: 9 | # print(langauges[lang] ); 10 | 11 | # printMessage(name1= "html",name2="css") 12 | 13 | def printMessage(*langauges): 14 | count = 1 15 | for lang in langauges: 16 | print(str(count) + " " + lang); 17 | count += 1 18 | printMessage("html","css","javascript") -------------------------------------------------------------------------------- /LES25/app.py: -------------------------------------------------------------------------------- 1 | 2 | # def printMessage(name,message): 3 | # print("Hi " + name + " " + message) 4 | 5 | # printMessage("Coder Shiyar","welcome to python course") 6 | 7 | # def printMessage(**langauges): 8 | # for lang in langauges: 9 | # print(langauges[lang] ); 10 | 11 | # printMessage(name1= "html",name2="css") 12 | 13 | def printMessage(*langauges): 14 | count = 1 15 | for lang in langauges: 16 | print(str(count) + " " + lang); 17 | count += 1 18 | printMessage("html","css","javascript") -------------------------------------------------------------------------------- /LES26/app.py: -------------------------------------------------------------------------------- 1 | 2 | # def printMessage(name,message): 3 | # print("Hi " + name + " " + message) 4 | 5 | # printMessage("Coder Shiyar","welcome to python course") 6 | 7 | # def printMessage(**langauges): 8 | # for lang in langauges: 9 | # print(langauges[lang] ); 10 | 11 | # printMessage(name1= "html",name2="css") 12 | 13 | def printMessage(*langauges): 14 | count = 1 15 | for lang in langauges: 16 | print(str(count) + " " + lang); 17 | count += 1 18 | printMessage("html","css","javascript") -------------------------------------------------------------------------------- /LES27/__pycache__/file2.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codershiyar/python/9c1e12de1189b0b955bc6fb678aa8079fc2874af/LES27/__pycache__/file2.cpython-39.pyc -------------------------------------------------------------------------------- /LES27/app.py: -------------------------------------------------------------------------------- 1 | import file2 as app2 2 | 3 | print(app2.name) 4 | 5 | app2.printhallo() 6 | 7 | # Pyhton Modules - وحدات بايثون 8 | # ----------------------------------- 9 | # ستتعلم اثناء هذا الدرس كيفية ربط 10 | # ملفات بايثون ببعضهم 11 | # او بالاختصار كيفية استرداد 12 | # اوامر بايثون من ملف بايثون اخر 13 | # ----------------------------------- 14 | # import - استيراد 15 | # ----------------------------------- 16 | # الأمر إمبورت يتم استخدامها لاسترداد 17 | # اوامر بايثون من ملف بايثون اخر 18 | # او لأسترداد اوامر من مكاتب بايثون 19 | # الجاهزة لأستخدام تلك اوامر في 20 | # ملف بايثون خاص بك عندما ترغب بذلك -------------------------------------------------------------------------------- /LES27/file2.py: -------------------------------------------------------------------------------- 1 | name = "Coder Shiyar" 2 | def printhallo(): 3 | print("تم استدعاء الوظيفة") -------------------------------------------------------------------------------- /LES28/__pycache__/file2.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codershiyar/python/9c1e12de1189b0b955bc6fb678aa8079fc2874af/LES28/__pycache__/file2.cpython-39.pyc -------------------------------------------------------------------------------- /LES28/app.py: -------------------------------------------------------------------------------- 1 | from file2 import name 2 | from file2 import printhallo 3 | import file2 4 | 5 | print(file2.name) 6 | printhallo() 7 | 8 | print(name) 9 | 10 | # ----------------------------------- 11 | # from - من 12 | # ----------------------------------- 13 | # import - استيراد 14 | # ----------------------------------- 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | # Pyhton Modules - وحدات بايثون 30 | # ----------------------------------- 31 | # ستتعلم اثناء هذا الدرس كيفية ربط 32 | # ملفات بايثون ببعضهم 33 | # او بالاختصار كيفية استرداد 34 | # اوامر بايثون من ملف بايثون اخر 35 | # ----------------------------------- 36 | # import - استيراد 37 | # ----------------------------------- 38 | # الأمر إمبورت يتم استخدامها لاسترداد 39 | # اوامر بايثون من ملف بايثون اخر 40 | # او لأسترداد اوامر من مكاتب بايثون 41 | # الجاهزة لأستخدام تلك اوامر في 42 | # ملف بايثون خاص بك عندما ترغب بذلك -------------------------------------------------------------------------------- /LES28/file2.py: -------------------------------------------------------------------------------- 1 | name = "Coder Shiyar" 2 | def printhallo(): 3 | print("تم استدعاء الوظيفة") -------------------------------------------------------------------------------- /LES29/app.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | 3 | datetime = datetime.datetime.now() 4 | hour = datetime.strftime("%H:%M:%S") 5 | print(hour) 6 | #---------------------------- 7 | # strftime() - 8 | #---------------------------- 9 | # datetime - 10 | #---------------------------- 11 | 12 | # %H Hour 00-23 17 13 | # %I Hour 00-12 05 14 | # %p AM/PM PM 15 | # %M Minute 00-59 41 16 | # %S Second 00-59 08 17 | # %c Local version of date and time Mon Dec 31 17:41:00 2018 18 | # %X Local version of time 17:41:00 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /LES3/app.py: -------------------------------------------------------------------------------- 1 | print(10*"Coder Shiyar ") 2 | print("Python \nin Arabic") 3 | print("Test 1",end=" ") 4 | print("Test 2") 5 | print('Learn Python \'\'') 6 | 7 | print("test1","test2","test3","tes4" ,sep=" -- ") -------------------------------------------------------------------------------- /LES30/app.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | date = datetime.datetime.now() 3 | datetoday = date.strftime("%Y-%m-%d") 4 | print (datetoday ) 5 | 6 | # ------------------------------------------------------------------ 7 | # %a Weekday, short version Wed 8 | # %A Weekday, full version Wednesday 9 | # %w Weekday as a number 0-6, 0 is Sunday 3 10 | # %d Day of month 01-31 31 11 | # %b Month name, short version Dec 12 | # %B Month name, full version December 13 | # %m Month as a number 01-12 12 14 | # %y Year, short version, without century 18 15 | # %Y Year, full version 2018 16 | # ------------------------------------------------------------------ 17 | # %j Day number of year 001-366 365 18 | # %U Week number of year, Sunday as the first day of week, 00-53 52 19 | # %W Week number of year, Monday as the first day of week, 00-53 52 20 | # %G ISO 8601 year 2018 21 | # %u ISO 8601 weekday (1-7) 1 22 | # %V ISO 8601 weeknumber (01-53) 01 23 | # %f Microsecond 000000-999999 548513 24 | 25 | 26 | # %H Hour 00-23 17 27 | # %I Hour 00-12 05 28 | # %p AM/PM PM 29 | # %M Minute 00-59 41 30 | # %S Second 00-59 08 31 | # %c Local version of date and time Mon Dec 31 17:41:00 2018 32 | # %X Local version of time 17:41:00 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /LES31/app.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | numbers = [20,21,10,27] 4 | result = math.isclose(1.2,1.2000) 5 | print(result ) 6 | 7 | # Python Math - الرياضيات في البايثون 8 | #-------------------------------------------------------------------------- 9 | # min() لإيجاد لإيجاد العدد الأصغر من بين مجموعة اعداد تحدده 10 | # max() لإيجاد العدد الأكبر من بين مجموعة اعداد تحدده 11 | # abs() لإيجاد قيمة المطلقة للعدد الذي تحدده 12 | # pow(number1,number2) لإيجاد ناتج للعدد الذي تحدده مع قوة اس 13 | # math.sqrt() لإيجاد جزر التربيعي 14 | # math.ceil() يقرب العدد للأعلى إلى اقرب عدد صحيح 15 | # math.floor() يقرب العدد للأسفل إلى اقرب عدد صحيح 16 | # math.remainder() يقوم بجلب الباقي عندما تقسم عددين مع بعضهم 17 | # math.isclose(n1,n2) يستخدم لمعرفة ان كان العددين قريبين من بعضهم او لا 18 | #-------------------------------------------------------------------------- 19 | # The math.pi constant, returns the value of PI (3.14...): 20 | # The min() and max() functions can be used to find the lowest 21 | # or highest value in an iterable: 22 | # The abs() function returns the absolute (positive) value of the specified number: 23 | # The pow(x, y) function returns the value of x to the power of y (xy). 24 | # Python has also a built-in module called math, which extends the list of mathematical functions. 25 | # To use it, you must import the math module: 26 | # The math.sqrt() method for example, returns the square root of a number: 27 | # The math.pi constant, returns the value of PI (3.14...): 28 | # The math.remainder() method returns the remainder of x with respect to y. 29 | # The math.isclose() method checks whether two values are close to each other, or not. Returns True if the values are close, otherwise False. 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /LES32/app.py: -------------------------------------------------------------------------------- 1 | number1 = input("Enter number 1 :") 2 | number2 = input("Enter number 2 :") 3 | print(int(number1) + int(number2) ) 4 | 5 | # username = input("enter your username ") 6 | # print("username is :" + username) 7 | # --------------------------------------------------------- 8 | # # Python allows for user input. 9 | # تسمح لغة بايثون بإستخدام حقول للكتابة البيانات 10 | # --------------------------------------------------------- 11 | # That means we are able to ask the user for input. 12 | # هذا يعني أننا قادرون على مطالبة المستخدم بالإدخال. 13 | # --------------------------------------------------------- 14 | 15 | -------------------------------------------------------------------------------- /LES33/app.py: -------------------------------------------------------------------------------- 1 | # try تتيح لك تجربة جزء من اكوادك الذي تختارها لتحقق أن كان هناك بها خطا او لا 2 | # except تتيح لك معالجة الخطأ في حال حدوثها مثل تنفيذ اوامر اخرى في حال حدث خطا ما 3 | # finally تتيح لك تنفيذ التعليمات البرمجية ، بغض النظر عن نتيجة المحاولة- تري و اكسبت 4 | # else يمكنك استخدامها لتنفيذ التعليمات البرمجية الذي تحدده ليتم تنفيذها في حالة عدم ظهور أخطاء 5 | 6 | 7 | try: 8 | print(name) 9 | except: 10 | print("لم يتمكن من ايجاد المتغير الذي قمنا بتحديده") 11 | else: 12 | print("لم يتواجد اي اخطا") 13 | # finally: 14 | # print("تم تنفيذ اوامر ضمن حقل finally") 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | # The try block lets you test a block of code for errors. 27 | # -------------------------------------------------------------------------------------------------- 28 | # The except block lets you handle the error. 29 | # -------------------------------------------------------------------------------------------------- 30 | # The finally block lets you execute code, regardless of the result of the try- and except blocks. 31 | # -------------------------------------------------------------------------------------------------- 32 | # You can use the else keyword to define a block of code to be executed if no errors were raised: 33 | 34 | -------------------------------------------------------------------------------- /LES34/app.py: -------------------------------------------------------------------------------- 1 | import json 2 | # json.dumps() يمكنك استخدامها لتحويل بيانات من نوع اوبجكت ديكجوناري إلى بيانات بصيغة جي سون 3 | # json.loads() يتم استخدامها لتحويل البيانات مكتوبة بصيغة جي سون إلى بيانات بصيغة اوبجكت ديكجوناري 4 | 5 | data = { 6 | "name":"Shiyar", 7 | "age": 21 , 8 | "isMarried":False 9 | } 10 | 11 | data_json = '{"name": "Shiyar", "age": 21, "isMarried": false}' 12 | data_json = json.loads(data_json) 13 | print(data_json["name"]) 14 | # print(type( json.loads(data_json)) ) 15 | 16 | 17 | 18 | # If you have a JSON string, you can parse it by using the json.loads() method. 19 | # If you have a Python object, you can convert it into a JSON 20 | # string by using the json.dumps() method. 21 | 22 | 23 | -------------------------------------------------------------------------------- /LES35/app.py: -------------------------------------------------------------------------------- 1 | class App: 2 | name = "Coder Shiyar" 3 | version = 10 4 | text 5 | def __init__(self,course,text): 6 | self.course = course 7 | self.text = text 8 | 9 | app = App("Python","انا احب بايثون") 10 | 11 | 12 | print(app.name) 13 | 14 | -------------------------------------------------------------------------------- /LES36/app.py: -------------------------------------------------------------------------------- 1 | class App: 2 | course = "Python" 3 | def getName(): 4 | return "Coder Shiyar" 5 | 6 | def print_message(): 7 | print("تم استدعاء الميتود") 8 | def calculator(number1 , number2): 9 | App.print_message() 10 | print("Course name : " + App.course) 11 | result = number1 + number2 12 | return result 13 | 14 | print("Result of 20 + 10 = " + str(App.calculator(20,10)) ) 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /LES37/app.py: -------------------------------------------------------------------------------- 1 | class App: 2 | course = "Python" 3 | def getName(): 4 | return "Coder Shiyar" 5 | 6 | def print_message(): 7 | print("تم استدعاء الميتود") 8 | def calculator(number1 , number2): 9 | App.print_message() 10 | print("Course name : " + App.course) 11 | result = number1 + number2 12 | return result 13 | 14 | print("Result of 20 + 10 = " + str(App.calculator(20,10)) ) 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /LES38/app.py: -------------------------------------------------------------------------------- 1 | # Python File Open - طريقة فتح ملف بواسطة بايثون او قرائته 2 | # ================================================================ 3 | # open("","r") يستخدم لفتح ملف حرف ار يعني فتح ملف بحالة قراءة 4 | # ================================================================ 5 | # read() يستخدم لقراءة كامل محتوى الملف 6 | # ================================================================ 7 | # read(2) بدل العدد 2 يمكنك وضع بنفس طول احرف الذي ترغب بقرائته 8 | # readline() يمكنك استخدامها لقراءة سطر من بيانات 9 | # close() يستخدم لاغلاق الملف المفتوح 10 | # ================================================================ 11 | # mode . لمعرفة باي حالة تم فتح الملف المحدد 12 | # closed لتحقق من ان كان ملف تم اغلاقه او لا 13 | # name لجلب اسم الملف 14 | 15 | file = open("files/text.txt","r") 16 | print(file.readline()) 17 | print(file.readline()) 18 | file.close() 19 | print(file.name) 20 | # print(file.read(40)) 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /LES38/files/text.txt: -------------------------------------------------------------------------------- 1 | Coder Shiyar 2 | Python -------------------------------------------------------------------------------- /LES39/app.py: -------------------------------------------------------------------------------- 1 | # Python File Write - كيفية كتابة او تعديل على ملفات في بايثون 2 | # ========================================================================================================= 3 | # حرف ا يستخدم لإضافة مزيد من محتوى الى نهاية قيمةالذي يملكه الملف المحدد 4 | # "a" - Append - will append to the end of the file 5 | # ========================================================================================================= 6 | # يستخدم لوضع قيمة الذي تحدده بدل القيمة الذي يملكه الملف المحدد 7 | # "w" - Write - will overwrite any existing content 8 | 9 | # will create a file if the specified file does not exist - سيُنشئ ملفًا إذا كان الملف المحدد غير موجود 10 | # ========================================================================================================= 11 | # حرف اكس اذا استخدمته سيتم إنشاء ملف ، وإرجاع خطأ إذا كان الملف موجودًا 12 | # "x" - Create - will create a file, returns an error if the file exist 13 | 14 | # will create a file if the specified file does not exist - سيُنشئ ملفًا إذا كان الملف المحدد غير موجود 15 | # # ========================================================================================================= 16 | # write() يستخدم لانشاء او تعديل على ملف المحدد 17 | 18 | # file = open("text.txt","a") 19 | # text = input("قم بكتابة النص الذي ترغب بإضافته في النهاية ") 20 | # file.write(text) 21 | # file.close() 22 | 23 | file = open("text2.txt","x") 24 | file.write("Coder Shiyar Python") 25 | file.close() 26 | 27 | -------------------------------------------------------------------------------- /LES39/text.txt: -------------------------------------------------------------------------------- 1 | Coder Shiyar Python -------------------------------------------------------------------------------- /LES39/text2.txt: -------------------------------------------------------------------------------- 1 | Coder Shiyar Python -------------------------------------------------------------------------------- /LES4/app2.py: -------------------------------------------------------------------------------- 1 | #"هذا هو ملف بايثون" 2 | print("Coder Shiyar") #طريقة طبع البيانات على شاشة بواسطة بايثون 3 | """ 4 | print("Coder Shiyar") 5 | print("Coder Shiyar") 6 | print("Coder Shiyar") 7 | print("Coder Shiyar") 8 | print("Coder Shiyar") 9 | print("Coder Shiyar") 10 | print("Coder Shiyar") 11 | """ -------------------------------------------------------------------------------- /LES40 41/app.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | # Python Delete File - شرح كيفية حذف الملفات بواسطة بايثون 4 | # -------------------------------------------------------------------- 5 | # os مكتبة التالية يتيح لنا امكانية لحذف الملفات بواسطة بايثون 6 | # os.remove() To delete a file يستخدم لحذف ملف الذي تحدده 7 | # os.rmdir() To delete an empty folder يستخدم لحذف مجلد الذي تحدده 8 | # Note: You can only remove empty folders. 9 | # -------------------------------------------------------------------- 10 | # shutil يتيح لنا حذف مجلد كامل حتى ان كان المجلد المحدد غير خالي 11 | # shutil.rmtree('/folder_name', ignore_errors=True) 12 | 13 | # if os.path.exists("app.html"): 14 | # os.remove("app.html") 15 | # print("تم حذف الملف بنجاح") 16 | # else: 17 | # print("لم يتم ايجاد الملف المحدد") 18 | # os.rmdir("files") 19 | shutil.rmtree("files", ignore_errors=True) 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | # import os 40 | # if os.path.exists("demofile.txt"): 41 | # os.remove("demofile.txt") 42 | # else: 43 | # print("The file does not exist") 44 | 45 | # import shutil 46 | # shutil.rmtree('/folder_name', ignore_errors=True) 47 | -------------------------------------------------------------------------------- /LES42/App.py: -------------------------------------------------------------------------------- 1 | # String format() & f"" - شرح طريقة تعامل مع نصوص بشكل افضل 2 | # -------------------------------------------------------------------- 3 | name= "Coder Shiyar" 4 | job="Software Engineer" 5 | salary= 3000 6 | # text="Good morning {0}. {0} is {1}. His salary is {2:.2f}".format(name,job,salary+(salary*0.10)) 7 | # print(text) 8 | text2=f"Good morning {name}. {name} is {job}. His salary is {salary+(salary*0.10):.2f}" 9 | print(text2) -------------------------------------------------------------------------------- /LES5/app.py: -------------------------------------------------------------------------------- 1 | 2 | name = 'Coder Shiyar' 3 | age = 20.50 4 | isMarried = False 5 | print(name ,age,isMarried) -------------------------------------------------------------------------------- /LES6/app.py: -------------------------------------------------------------------------------- 1 | # -name = 10 2 | # 1name = 10 3 | # @name = 10 4 | # name 1 = 10 5 | # name-1 = 10 6 | # name____ = 10 7 | 8 | # متغير يمكنه ان يملك اسم قصير مثل اسم عبارة عن حرف واحد او اكثر 9 | # A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume). 10 | 11 | # Rules for Python variables: قوانين لإنشاء متغيرات في البايثون 12 | # A variable name must start with a letter or the underscore character _ اسم متغير يجب ان يبدا بحرف او علامة ناقص على السطر 13 | # A variable name cannot start with a number - اسم متغير لا يمكنه بدء ب رقم 14 | 15 | # _ اسم متغير يمكنه ان يحتوي فقط على ارقام واحرف انجليزية و علامة ناقص الذي ينكتب على السطر 16 | # A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ ) 17 | 18 | # احرف الصغيرة والكبيرة في الاسم متغيرات حساسة ,يوجد فرق بين حرف كبير وحرف صغير 19 | # Variable names are case-sensitive (age, Age and AGE are three different variables) 20 | # اسماء اوامر بايثون لايمكنك استخدماها كا اسم متغير 21 | # Python keywords are not allowed to use as variable name 22 | 23 | # Here is a list of the Python keywords. Enter any keyword to get more help. 24 | 25 | # False class from or 26 | # None continue global pass 27 | # True def if raise 28 | # and del import return 29 | # as elif in try 30 | # assert else is while 31 | # async except lambda with 32 | # await finally nonlocal yield 33 | # break for not 34 | 35 | 36 | -------------------------------------------------------------------------------- /LES7/app.py: -------------------------------------------------------------------------------- 1 | name , age , country = "Coder Shiyar" ,21,"Netherlands" 2 | # name = "Coder Shiyar" age = 21 country = "Netherlands" 3 | #number1 = number2 = number3 = 20 4 | 5 | name = "Coder Shiyar" 6 | name = "nothing" 7 | 8 | value1,value2,value3 = ["java","python","javascript","html"] 9 | print(value2 ) -------------------------------------------------------------------------------- /LES8/app.py: -------------------------------------------------------------------------------- 1 | text = "Learn Python with Shiyar " 2 | print(len(text)) 3 | 4 | # Method Description 5 | 6 | # replace() تُرجع النص حيث يتم استبدال قيمة محددة بقيمة محددة 7 | # len() يقوم بإعادة طول النص المحدد 8 | 9 | # swapcase() حالات المقايضة ، تصبح الأحرف الصغيرة كبيرة والعكس صحيح 10 | # title() تحويل الحرف الأول من كل كلمة إلى أحرف كبيرة 11 | # capitalize() تحويل اول حرف إلى حرف كبير 12 | # upper() يحول النص إلى أحرف كبيرة 13 | 14 | # casefold() تحويل نص إلى احرف صغيرة 15 | # lower() يحول سلسلة إلى أحرف صغيرة 16 | 17 | # count() إعادة عدد مرات مكررة جزء نص الذي تحدده في نص الذي تحدده للبحث بها 18 | # endswith() للتحقق ان كان النص ينتهي بجزء نص الذي تحدده او لا 19 | # startswith() إرجاع صحيح إذا بدأت النص بالقيمة المحددة 20 | # find() يبحث في النص عن قيمة محددة ويعيد الموضع الذي تم العثور عليه فيه 21 | # index() يبحث في النص عن قيمة محددة ويعيد الموضع الذي تم العثور عليه فيه 22 | # join() Joins the elements of an iterable to the end of the string 23 | # rfind() يبحث في النص عن قيمة محددة ويعيد الموضع الأخير حيث تم العثور عليه 24 | # rindex() يبحث في النص عن قيمة محددة ويعيد الموضع الأخير حيث تم العثور عليه 25 | 26 | 27 | # strip() تُرجع نسخة مقتطعة من النص 28 | # lstrip() تُرجع نسخة مقطوعة إلى اليسار من النص 29 | # rstrip() تُرجع نسخة مقطوعة إلى اليمين من النص 30 | 31 | 32 | 33 | 34 | # Method Description 35 | # capitalize() Converts the first character to upper case 36 | # casefold() Converts string into lower case 37 | # center() Returns a centered string 38 | # count() Returns the number of times a specified value occurs in a string 39 | # encode() Returns an encoded version of the string 40 | # endswith() Returns true if the string ends with the specified value 41 | # expandtabs() Sets the tab size of the string 42 | # find() Searches the string for a specified value and returns the position of where it was found 43 | # format() Formats specified values in a string 44 | # format_map() Formats specified values in a string 45 | # index() Searches the string for a specified value and returns the position of where it was found 46 | # join() Joins the elements of an iterable to the end of the string 47 | # ljust() Returns a left justified version of the string 48 | # lower() Converts a string into lower case 49 | # lstrip() Returns a left trim version of the string 50 | # maketrans() Returns a translation table to be used in translations 51 | # partition() Returns a tuple where the string is parted into three parts 52 | # replace() Returns a string where a specified value is replaced with a specified value 53 | # rfind() Searches the string for a specified value and returns the last position of where it was found 54 | # rindex() Searches the string for a specified value and returns the last position of where it was found 55 | # rjust() Returns a right justified version of the string 56 | # rpartition() Returns a tuple where the string is parted into three parts 57 | # rsplit() Splits the string at the specified separator, and returns a list 58 | # rstrip() Returns a right trim version of the string 59 | # split() Splits the string at the specified separator, and returns a list 60 | # splitlines() Splits the string at line breaks and returns a list 61 | # startswith() Returns true if the string starts with the specified value 62 | # strip() Returns a trimmed version of the string 63 | # swapcase() Swaps cases, lower case becomes upper case and vice versa 64 | # title() Converts the first character of each word to upper case 65 | # translate() Returns a translated string 66 | # upper() Converts a string into upper case 67 | # zfill() Fills the string with a specified number of 0 values at the beginning 68 | 69 | 70 | -------------------------------------------------------------------------------- /LES9/app.py: -------------------------------------------------------------------------------- 1 | text = "Learn Python with Shiyar " 2 | print(len(text)) 3 | 4 | # Method Description 5 | 6 | # replace() تُرجع النص حيث يتم استبدال قيمة محددة بقيمة محددة 7 | # len() يقوم بإعادة طول النص المحدد 8 | 9 | # swapcase() حالات المقايضة ، تصبح الأحرف الصغيرة كبيرة والعكس صحيح 10 | # title() تحويل الحرف الأول من كل كلمة إلى أحرف كبيرة 11 | # capitalize() تحويل اول حرف إلى حرف كبير 12 | # upper() يحول النص إلى أحرف كبيرة 13 | 14 | # casefold() تحويل نص إلى احرف صغيرة 15 | # lower() يحول سلسلة إلى أحرف صغيرة 16 | 17 | # count() إعادة عدد مرات مكررة جزء نص الذي تحدده في نص الذي تحدده للبحث بها 18 | # endswith() للتحقق ان كان النص ينتهي بجزء نص الذي تحدده او لا 19 | # startswith() إرجاع صحيح إذا بدأت النص بالقيمة المحددة 20 | # find() يبحث في النص عن قيمة محددة ويعيد الموضع الذي تم العثور عليه فيه 21 | # index() يبحث في النص عن قيمة محددة ويعيد الموضع الذي تم العثور عليه فيه 22 | # join() Joins the elements of an iterable to the end of the string 23 | # rfind() يبحث في النص عن قيمة محددة ويعيد الموضع الأخير حيث تم العثور عليه 24 | # rindex() يبحث في النص عن قيمة محددة ويعيد الموضع الأخير حيث تم العثور عليه 25 | 26 | 27 | # strip() تُرجع نسخة مقتطعة من النص 28 | # lstrip() تُرجع نسخة مقطوعة إلى اليسار من النص 29 | # rstrip() تُرجع نسخة مقطوعة إلى اليمين من النص 30 | 31 | 32 | 33 | 34 | # Method Description 35 | # capitalize() Converts the first character to upper case 36 | # casefold() Converts string into lower case 37 | # center() Returns a centered string 38 | # count() Returns the number of times a specified value occurs in a string 39 | # encode() Returns an encoded version of the string 40 | # endswith() Returns true if the string ends with the specified value 41 | # expandtabs() Sets the tab size of the string 42 | # find() Searches the string for a specified value and returns the position of where it was found 43 | # format() Formats specified values in a string 44 | # format_map() Formats specified values in a string 45 | # index() Searches the string for a specified value and returns the position of where it was found 46 | # join() Joins the elements of an iterable to the end of the string 47 | # ljust() Returns a left justified version of the string 48 | # lower() Converts a string into lower case 49 | # lstrip() Returns a left trim version of the string 50 | # maketrans() Returns a translation table to be used in translations 51 | # partition() Returns a tuple where the string is parted into three parts 52 | # replace() Returns a string where a specified value is replaced with a specified value 53 | # rfind() Searches the string for a specified value and returns the last position of where it was found 54 | # rindex() Searches the string for a specified value and returns the last position of where it was found 55 | # rjust() Returns a right justified version of the string 56 | # rpartition() Returns a tuple where the string is parted into three parts 57 | # rsplit() Splits the string at the specified separator, and returns a list 58 | # rstrip() Returns a right trim version of the string 59 | # split() Splits the string at the specified separator, and returns a list 60 | # splitlines() Splits the string at line breaks and returns a list 61 | # startswith() Returns true if the string starts with the specified value 62 | # strip() Returns a trimmed version of the string 63 | # swapcase() Swaps cases, lower case becomes upper case and vice versa 64 | # title() Converts the first character of each word to upper case 65 | # translate() Returns a translated string 66 | # upper() Converts a string into upper case 67 | # zfill() Fills the string with a specified number of 0 values at the beginning 68 | 69 | 70 | --------------------------------------------------------------------------------