en
string
translation
string
target_lang
string
domain
string
complexity
string
Close the file once our work is done.
أغلق الملف بمجرد الانتهاء من عملنا.
ar
technical
simple
Also, if the file object is re-assigned to some other file, the previous file is automatically closed.
أيضًا، إذا أعيد تعيين كائن الملف إلى ملف آخر، فسيتم إغلاق الملف السابق تلقائيًا.
ar
technical
moderate
The advantage of using with clause is that any file that is opened using this clause is closed automatically, once the control comes outside the with clause.
تتمثل ميزة استخدام عبارة with في أن أي ملف يتم فتحه باستخدام هذه العبارة يتم إغلاقه تلقائيًا، بمجرد خروج التحكم خارج عبارة with.
ar
technical
complex
In case the user forgets to close the file explicitly or if an exception occurs, the file is closed automatically.
في حالة نسيان المستخدم إغلاق الملف بشكل صريح أو في حالة حدوث استثناء، يتم إغلاق الملف تلقائيًا.
ar
technical
moderate
For writing to a file, we first need to open it in write or append mode.
لكتابة ملف، نحتاج أولاً إلى فتحه في وضع الكتابة أو الإلحاق.
ar
technical
simple
If we open an existing file in write mode, the previous data will be erased, and the file object will be positioned at the beginning of the file.
إذا فتحنا ملفًا موجودًا في وضع الكتابة، فسيتم مسح البيانات السابقة، وسيتم وضع كائن الملف في بداية الملف.
ar
technical
moderate
On the other hand, in append mode, new data will be added at the end of the previous data as the file object is at the end of the file.
من ناحية أخرى، في وضع الإلحاق، ستتم إضافة بيانات جديدة في نهاية البيانات السابقة حيث يوجد كائن الملف في نهاية الملف.
ar
technical
moderate
write() method takes a string as an argument and writes it to the text file.
تأخذ طريقة write() سلسلة كحجة وتكتبها في الملف النصي.
ar
technical
simple
It returns the number of characters being written on single execution of the write() method.
إنه يُرجع عدد الأحرف التي يتم كتابتها في تنفيذ واحد لطريقة write().
ar
technical
moderate
Also, we need to add a newline character (\n) at the end of every sentence to mark the end of line.
أيضًا، نحتاج إلى إضافة حرف سطر جديد (\n) في نهاية كل جملة لتمييز نهاية السطر.
ar
technical
moderate
If numeric data are to be written to a text file, the data need to be converted into string before writing to the file.
إذا كان سيتم كتابة بيانات رقمية في ملف نصي، فيجب تحويل البيانات إلى سلسلة قبل الكتابة في الملف.
ar
technical
moderate
This method is used to write multiple strings to a file.
تُستخدم هذه الطريقة لكتابة سلاسل متعددة في ملف.
ar
technical
simple
We need to pass an iterable object like lists, tuple, etc. containing strings to the writelines() method.
نحتاج إلى تمرير كائن قابل للتكرار مثل القوائم، والصفحات، وما إلى ذلك التي تحتوي على سلاسل إلى طريقة writelines().
ar
technical
moderate
We can write a program to read the contents of a file.
يمكننا كتابة برنامج لقراءة محتويات ملف.
ar
technical
simple
Before reading a file, we must make sure that the file is opened in “r”, “r+”, “w+” or “a+” mode.
قبل قراءة ملف، يجب أن نتأكد من فتح الملف في وضع “r” أو “r+” أو “w+” أو “a+”.
ar
technical
moderate
This method is used to read a specified number of bytes of data from a data file.
تُستخدم هذه الطريقة لقراءة عدد محدد من بايتات البيانات من ملف بيانات.
ar
technical
simple
If no argument or a negative number is specified in read(), the entire file content is read.
إذا لم يتم تحديد أي وسيطة أو رقم سالب في read()، فسيتم قراءة محتوى الملف بأكمله.
ar
technical
moderate
This method reads one complete line from a file where each line terminates with a newline (\n) character.
تقرأ هذه الطريقة سطرًا كاملاً واحدًا من ملف حيث ينتهي كل سطر بحرف سطر جديد (\n).
ar
technical
moderate
To read the entire file line by line using the readline(), we can use a loop.
لقراءة الملف بأكمله سطرًا سطرًا باستخدام readline()، يمكننا استخدام حلقة.
ar
technical
moderate
The method reads all the lines and returns the lines along with newline as a list of strings.
تقرأ الطريقة جميع الأسطر وتُرجع الأسطر جنبًا إلى جنب مع سطر جديد كقائمة من السلاسل.
ar
technical
moderate
Queue is an arrangement in which new objects/items always get added at one end, usually called the REAR, and objects/items always get removed from the other end, usually called the FRONT of the queue.
الطابور هو ترتيب تضاف فيه دائمًا كائنات/عناصر جديدة في أحد الأطراف، ويُسمى عادةً الخلف، وتُزال الكائنات/العناصر دائمًا من الطرف الآخر، ويُسمى عادةً الأمام من الطابور.
ar
technical
moderate
The concept of queue has many applications in real-life.
مفهوم الطابور له تطبيقات عديدة في الحياة الواقعية.
ar
general
simple
If a train ticket is in the waiting list (such as W/L1), it means the ticket is in a queue of tickets waiting to get confirmed.
إذا كانت تذكرة القطار في قائمة الانتظار (مثل W/L1)، فهذا يعني أن التذكرة في طابور من التذاكر التي تنتظر التأكيد.
ar
news
moderate
Sometimes on calling a customer service centre, the Interactive Voice Response System (IVRS) tells us to wait till a support person is available.
في بعض الأحيان عند الاتصال بمركز خدمة العملاء، يخبرنا نظام الاستجابة الصوتية التفاعلية (IVRS) بالانتظار حتى يتوفر شخص دعم.
ar
technical
moderate
Imagine there is a single-lane one-way road, then the vehicle that entered first will exit first, following the concept of queue.
تخيل وجود طريق أحادي الاتجاه بمسار واحد، ثم ستخرج السيارة التي دخلت أولاً أولاً، باتباع مفهوم الطابور.
ar
general
moderate
Likewise, vehicles in a highway toll tax booth are served following the principle of FIFO.
وبالمثل، يتم تقديم المركبات في كشك ضريبة المرور على الطرق السريعة باتباع مبدأ FIFO.
ar
technical
moderate
Suppose there is a web-server hosting a web-site to declare result(s).
لنفترض أن هناك خادم ويب يستضيف موقع ويب للإعلان عن النتائج.
ar
technical
moderate
This server can handle a maximum of 50 concurrent requests to view result(s).
يمكن لهذا الخادم التعامل مع 50 طلبًا متزامنًا كحد أقصى لعرض النتائج.
ar
technical
moderate
So, to serve thousands of user requests, a Queue would be the most appropriate data structure to use.
لذلك، لخدمة آلاف طلبات المستخدمين، سيكون الطابور هو هيكل البيانات الأنسب للاستخدام.
ar
technical
moderate
Some Operating Systems (OS) are required to handle multiple tasks called - jobs, seeking to use the processor.
تُطلب بعض أنظمة التشغيل (OS) للتعامل مع مهام متعددة تسمى - الوظائف، التي تسعى إلى استخدام المعالج.
ar
technical
complex
But we know that a processor can handle only one task at a time.
لكننا نعلم أن المعالج لا يمكنه التعامل إلا مع مهمة واحدة في كل مرة.
ar
technical
simple
Therefore, in a multitasking operating system, jobs are lined up (queued) and then given access to the processor according to some order.
لذلك، في نظام تشغيل متعدد المهام، يتم اصطفاف الوظائف (في قائمة انتظار) ثم يتم منحها الوصول إلى المعالج وفقًا لترتيب ما.
ar
technical
complex
The simplest way is to give access to the processor on a FIFO basis, that is according to the order in which the jobs arrive with a request for the processor.
أبسط طريقة هي منح الوصول إلى المعالج على أساس FIFO، أي وفقًا للترتيب الذي تصل به الوظائف مع طلب للمعالج.
ar
technical
complex
When we send print commands from multiple files from the same computer or from different computers using a shared printer.
عندما نرسل أوامر طباعة من ملفات متعددة من نفس الكمبيوتر أو من أجهزة كمبيوتر مختلفة باستخدام طابعة مشتركة.
ar
technical
moderate
The OS puts these print requests in a queue and sends them to the printer one by one on a FIFO basis.
يضع نظام التشغيل طلبات الطباعة هذه في قائمة انتظار ويرسلها إلى الطابعة واحدًا تلو الآخر على أساس FIFO.
ar
technical
moderate
ENQUEUE: is used to insert a new element to the queue at the rear end.
ENQUEUE: تُستخدم لإدخال عنصر جديد في الطابور في الطرف الخلفي.
ar
technical
simple
We can insert elements in the queue till there is space in the queue for adding more elements.
يمكننا إدخال العناصر في الطابور حتى تتوفر مساحة في الطابور لإضافة المزيد من العناصر.
ar
technical
moderate
Inserting elements beyond capacity of the queue will result in an exception - known as Overflow.
سيؤدي إدخال العناصر بما يتجاوز سعة الطابور إلى حدوث استثناء - يُعرف باسم تجاوز السعة.
ar
technical
moderate
DEQUEUE: is used to remove one element at a time from the front of the queue.
DEQUEUE: تُستخدم لإزالة عنصر واحد في كل مرة من مقدمة الطابور.
ar
technical
simple
We can delete elements from a queue until it is empty, trying to delete an element from an empty queue will result in exception - known as Underflow.
يمكننا حذف العناصر من الطابور حتى يصبح فارغًا، ومحاولة حذف عنصر من طابور فارغ ستؤدي إلى حدوث استثناء - يُعرف باسم نقص السعة.
ar
technical
moderate
The binary search algorithm is efficient for sorted lists.
خوارزمية البحث الثنائي فعالة للقوائم المرتبة.
ar
technical
moderate
Linear search examines each element sequentially.
البحث الخطي يفحص كل عنصر على التوالي.
ar
technical
simple
Hashing provides a fast way to locate data.
يوفر التجزئة طريقة سريعة لتحديد موقع البيانات.
ar
technical
moderate
Collision resolution is important in hash tables.
حل التعارض مهم في جداول التجزئة.
ar
technical
moderate
The program uses a linear search to find a specific number.
يستخدم البرنامج بحثًا خطيًا للعثور على رقم معين.
ar
technical
moderate
Binary search requires the list to be sorted.
يتطلب البحث الثنائي فرز القائمة.
ar
technical
simple
The hash function calculates the index.
تحسب دالة التجزئة الفهرس.
ar
technical
simple
We will now discuss the algorithm.
سوف نناقش الآن الخوارزمية.
ar
technical
simple
The key is not found in the list.
المفتاح غير موجود في القائمة.
ar
technical
simple
The algorithm's efficiency is a key factor.
كفاءة الخوارزمية هي عامل رئيسي.
ar
technical
moderate
Let's consider a practical example.
دعنا نفكر في مثال عملي.
ar
technical
simple
The program takes input from the user.
يأخذ البرنامج مدخلات من المستخدم.
ar
technical
simple
The output shows the search results.
تُظهر المخرجات نتائج البحث.
ar
technical
simple
The list contains several elements.
تحتوي القائمة على عدة عناصر.
ar
technical
simple
The middle element is compared with the key.
يتم مقارنة العنصر الأوسط بالمفتاح.
ar
technical
moderate
The search area is reduced in each iteration.
يتم تقليل منطقة البحث في كل تكرار.
ar
technical
moderate
The hash table has a fixed size.
جدول التجزئة له حجم ثابت.
ar
technical
simple
The algorithm is implemented in Python.
يتم تنفيذ الخوارزمية في بايثون.
ar
technical
simple
The program handles different cases.
يتعامل البرنامج مع حالات مختلفة.
ar
technical
simple
The code is easy to understand.
الكود سهل الفهم.
ar
technical
simple
Sorting is an important area of study in computer science.
الفرز مجال دراسي مهم في علوم الكمبيوتر.
ar
technical
moderate
In this chapter, we will learn about three sorting methods and implement them using Python.
في هذا الفصل، سنتعلم عن ثلاث طرق فرز وننفذها باستخدام لغة بايثون.
ar
technical
moderate
Bubble sort is discussed in section 5.2, followed by discussion on selection sort and insertion sort in section 5.3 and 5.4, respectively.
تمت مناقشة فرز الفقاعات في القسم 5.2، يليه نقاش حول فرز الاختيار وفرز الإدخال في القسمين 5.3 و 5.4 على التوالي.
ar
technical
moderate
Bubble sort sorts a given list of elements by repeatedly comparing the adjacent elements and swapping them if they are unordered.
يقوم فرز الفقاعات بفرز قائمة معينة من العناصر عن طريق مقارنة العناصر المتجاورة بشكل متكرر وتبديلها إذا كانت غير مرتبة.
ar
technical
complex
Swapping two elements means changing their positions with each other.
تبديل عنصرين يعني تغيير مواقعهما مع بعضهما البعض.
ar
technical
simple
In algorithm, every iteration through each element of a list is called a pass.
في الخوارزمية، تسمى كل تكرار عبر كل عنصر من القائمة تمريرة.
ar
technical
moderate
For a list with n elements, the bubble sort makes a total of n – 1 passes to sort the list.
بالنسبة لقائمة تحتوي على n من العناصر، يقوم فرز الفقاعات بإجراء ما مجموعه n - 1 تمريرة لفرز القائمة.
ar
technical
moderate
In each pass, the required pairs of adjacent elements of the list will be compared.
في كل تمريرة، ستتم مقارنة الأزواج المطلوبة من العناصر المتجاورة في القائمة.
ar
technical
moderate
In order to arrange elements in ascending order, the largest element is identified after each pass and placed at the correct position in the list.
من أجل ترتيب العناصر بترتيب تصاعدي، يتم تحديد أكبر عنصر بعد كل تمريرة ووضعه في الموضع الصحيح في القائمة.
ar
technical
complex
This can be considered as the largest element being ‘bubbled up’.
يمكن اعتبار هذا على أنه 'تصاعد' أكبر عنصر.
ar
technical
moderate
Hence the name Bubble sort.
ومن هنا جاء اسم فرز الفقاعات.
ar
technical
simple
This sorted element is not considered in the remaining passes and thus the list of elements gets reduced in successive passes.
لا يتم أخذ هذا العنصر الذي تم فرزه في الاعتبار في التمريرات المتبقية، وبالتالي يتم تقليل قائمة العناصر في التمريرات المتتالية.
ar
technical
complex
Figure 5.1 demonstrates the working of the bubble sort method to arrange a list in ascending order.
يوضح الشكل 5.1 طريقة عمل طريقة فرز الفقاعات لترتيب قائمة بترتيب تصاعدي.
ar
technical
moderate
Let us consider a list having 6 elements as numList = [8, 7, 13, 1, -9, 4].
دعنا نفكر في قائمة تحتوي على 6 عناصر مثل numList = [8, 7, 13, 1, -9, 4].
ar
technical
simple
To begin sorting, the element at index 0 is compared with the element at index 1.
لبدء الفرز، تتم مقارنة العنصر الموجود في الفهرس 0 بالعنصر الموجود في الفهرس 1.
ar
technical
moderate
If the first element is bigger, it is swapped with the second.
إذا كان العنصر الأول أكبر، فإنه يتم تبديله بالعنصر الثاني.
ar
technical
simple
Else, no change is done.
وإلا، لا يتم إجراء أي تغيير.
ar
technical
simple
Can you identify other examples where sorting plays an important role in computers?
هل يمكنك تحديد أمثلة أخرى حيث يلعب الفرز دورًا مهمًا في أجهزة الكمبيوتر؟
ar
technical
moderate
If there is no swapping in any pass, it means the list is already sorted, hence the sorting operation needs to be stopped.
إذا لم يكن هناك تبديل في أي تمريرة، فهذا يعني أن القائمة قد تم فرزها بالفعل، وبالتالي يجب إيقاف عملية الفرز.
ar
technical
complex
Can you think of making any improvement in the Algorithm 5.1 so that it stops when the list becomes sorted?
هل يمكنك التفكير في إجراء أي تحسين على الخوارزمية 5.1 بحيث تتوقف عندما يتم فرز القائمة؟
ar
technical
complex
Each tuple (row) in a relation (table) corresponds to data of a real world entity.
كل صف (سطر) في علاقة (جدول) يتوافق مع بيانات كيان من العالم الحقيقي.
ar
technical
moderate
A database that is modeled on relational data model concept is called Relational Database.
يُسمى نظام قواعد البيانات الذي يعتمد على مفهوم نموذج البيانات العلائقية قاعدة بيانات علائقية.
ar
technical
moderate
ATTRIBUTE: Characteristic or parameters for which data are to be stored in a relation.
السمة: خاصية أو معلمات يجب تخزين البيانات من أجلها في علاقة.
ar
technical
moderate
Each row of data in a relation (table) is called a tuple.
يُسمى كل صف من البيانات في علاقة (جدول) صفًا.
ar
technical
simple
It is a set of values from which an attribute can take a value in each row.
إنها مجموعة من القيم التي يمكن للسمة أن تأخذ قيمة منها في كل صف.
ar
technical
moderate
The number of attributes in a relation is called the Degree of the relation.
يُسمى عدد السمات في العلاقة درجة العلاقة.
ar
technical
moderate
The number of tuples in a relation is called the Cardinality of the relation.
يُسمى عدد الصفوف في العلاقة عدد العلاقة.
ar
technical
moderate
Each attribute in a relation has a unique name.
لكل سمة في العلاقة اسم فريد.
ar
technical
simple
Sequence of attributes in a relation is immaterial.
تسلسل السمات في العلاقة غير مهم.
ar
technical
simple
Each tuple in a relation is distinct.
كل صف في العلاقة متميز.
ar
technical
simple
Sequence of tuples in a relation is immaterial.
تسلسل الصفوف في العلاقة غير مهم.
ar
technical
simple
All data values in an attribute must be from the same domain (same data type).
يجب أن تكون جميع قيم البيانات في السمة من نفس المجال (نفس نوع البيانات).
ar
technical
moderate
Each data value associated with an attribute must be atomic.
يجب أن تكون كل قيمة بيانات مرتبطة بسمة ذرية.
ar
technical
moderate
No attribute can have many data values in one tuple.
لا يمكن لسمة واحدة أن تحتوي على العديد من قيم البيانات في صف واحد.
ar
technical
moderate
A special value “NULL” is used to represent values that are unknown or non-applicable.
تُستخدم القيمة الخاصة “NULL” لتمثيل القيم غير المعروفة أو غير القابلة للتطبيق.
ar
technical
moderate
The tuples within a relation must be distinct.
يجب أن تكون الصفوف داخل العلاقة متميزة.
ar
technical
moderate
A relation can have one or more attributes that takes distinct values.
يمكن أن تحتوي العلاقة على سمة واحدة أو أكثر تأخذ قيمًا مميزة.
ar
technical
moderate
Such attributes are called candidate keys as each of them are candidates for the primary key.
تُسمى هذه السمات مفاتيح مرشحة لأن كل منها مرشح للمفتاح الأساسي.
ar
technical
complex
Out of one or more candidate keys, the attribute chosen by the database designer to uniquely identify the tuples in a relation is called the primary key.
من بين مفتاح مرشح واحد أو أكثر، تُسمى السمة التي يختارها مصمم قاعدة البيانات لتعريف الصفوف في العلاقة بشكل فريد المفتاح الأساسي.
ar
technical
complex
A foreign key is used to represent the relationship between two relations.
يُستخدم المفتاح الخارجي لتمثيل العلاقة بين علاقتين.
ar
technical
moderate