Skip to content

raf-4/Verify-Random

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation


English

Code Explanation

This code is simple, it generates a random number then asks the user to input this number. Afterwards, the code checks if the entered number matches the generated random number or not.

Code Details

  1. The necessary libraries are imported: time, os, random, sys.
  2. A random number between 1000 and 9999 is generated using random.randint.
  3. The random number is displayed to the user with instructions to input the number.
  4. After the user inputs the number, the code verifies if it matches the random number.
  5. "ok" is printed if the number matches the random number, otherwise "error" is printed.

Usage

  1. Run the program by executing the code file using Python.
  2. Follow the prompts displayed in the user interface to input the number and determine if it matches the random number.

العربية

شرح الكود

هذا الكود بسيط ويقوم بإنشاء رقم عشوائي ثم يطلب من المستخدم إدخال هذا الرقم. بعد ذلك، يتحقق الكود مما إذا كان الرقم المدخل مطابقاً للرقم العشوائي المنشأ أم لا.

تفاصيل الكود

  1. يتم استيراد المكتبات اللازمة: time, os, random, sys.
  2. يتم إنشاء رقم عشوائي بين 1000 و 9999 باستخدام random.randint.
  3. يتم عرض الرقم العشوائي للمستخدم مع توجيهه لإدخال الرقم.
  4. بعد إدخال المستخدم للرقم، يتم التحقق مما إذا كان مطابقاً للرقم العشوائي أم لا.
  5. يتم طباعة "ok" إذا كان الرقم مطابقاً للرقم العشوائي، وإلا يتم طباعة "error".

الاستخدام

  1. قم بتشغيل البرنامج عن طريق تنفيذ ملف الكود باستخدام Python.
  2. اتبع الرسائل التي تظهر في واجهة المستخدم لإدخال الرقم
  3. ومعرفة إذا كان مطابقاً للرقم العشوائي.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages