أرقام

تعرف على قدرات Python للبيانات الرقمية، بما في ذلك الأعداد الصحيحة والأعداد العشرية والأعداد المركبة.

سنغطي ما يلي...

Numerical data manipulation

Python is among the most powerful languages for manipulating numerical data. It is equipped with support for several types of numbers, along with utilities for performing computations on them. It has a rich ecosystem that consists of an active developer community and a vast collection of third-party libraries for specific scientific and mathematical domains like machine learning and data science. Also, Python’s simple and intuitive syntax makes it easy to work with numerical data. It allows developers to focus on the problem at hand rather than getting bogged down by language syntax and verbosity.

There are three main types of numbers in Python:

Press + to interact

الأعداد الصحيحة

يتألف نوع البيانات الصحيح من أعداد صحيحة، منها الموجب والسالب والصفر. وهو يدعم مجموعة واسعة من العمليات الحسابية والتحويلات، مما يُمكّننا من إجراء مهام برمجية متنوعة. إليك بعض الأمثلة على الأعداد الصحيحة:

Press + to interact
print(10)
print(-3000)
num = 123456789
print(num)
num = -16000
print(num)

توضيح

وهنا شرح الكود:

  • السطر 1: يطبع العدد الصحيح 10 في وحدة التحكم، وهو عدد صحيح موجب.

  • السطر 2: يطبع العدد الصحيح -3000 في وحدة التحكم، وهو عدد صحيح سلبي.

  • السطر 4: يقوم بتعيين العدد الصحيح 123456789 إلى متغير ...