مشاركة حلول: معالجة العديد من طلبات التقديم scholarships

عمل رائع يا أحمد، وطريقة رائعة في معرفة عدد المتقدمين بدل تحديدها مسبقاً :ok_hand:

1 Like

`
def apply():
age = input()
age = int(age)
if age < 18 :
print(‘You are too young’)
elif age > 22 :
print(‘You are too old’)
else :
print(‘Welcome to Egypt scholarship program’)
apply()
apply()
apply()
apply()
apply()

def apply():
    age = input()
    age = int(age)
    if age < 18 :
        print('You are too young')
    elif age > 22 :
        print('You are too old')
    else :
        print('Welcome to Egypt scholarship program')

number = 0
while number < 1000:
    apply()
    number += 1
1 Like

عمل رائع يا نور الدين :+1:

def apply():
    age = input('please your age:')
    # rest of code...
    age = int(age)
    if age < 18:
        print('You are too young')
    elif age <= 20:
        print('Welcome to Egypt scholarship program')
    else :
        print('You are too old')
   
apply()
apply()
apply()
apply()
apply()

#المهمة الاضافية

student = 0
while student < 1000:
    apply()
    studen += 1
1 Like

عمل ممتاز كما هو متوقع منك يا مصعب :+1:

1 Like

والله يا أستاذ @YaserAlnajjar مدحتني كتير
شكرا لك :heart_eyes: :heart_eyes: :heart_eyes:

1 Like

لو سمحت لشو بنستخدم try و expect ?

1 Like

تستعمل try و expect لاكتشاف الأخطاء أثناء تشغيل البرنامج

فبدلاً من التحقق من ان المستخدم أدخل قيمة عددية وليس حروف (لسحبها من الـ ATM)، فقط تجعل الكود يكتشف الخطأ بهذا الشكل:

try:
    request= input('Your request:')
    request=int(request)
except ValueError:
    print('Please enter ONLY numerical value')

لو كتبت أي حرف في هذا البرنامج حينما يطلب منك تدخل القيمة ستظهر الرسالة Please enter ONLY numerical value

1 Like

مشكور كثير بشمهندس ياسر عالإفادة :rose:

1 Like
def apply_sad():

       age = input("please enter your age:")
       age = int(age)

       if age < 18 :
           print("your a young not can join")

       elif age > 22 :
          print("can you join in college")

       else:
          print("please select your age")


apply_sad()
apply_sad()
apply_sad()
apply_sad()
apply_sad()

1 Like

عمل رائع يا ابراهيم :+1:

لكن بالنسبة للشروط فهي تسمح لمن هو أكبر من 22 سنة بالإنضمام للمنحة والمفترض أن تسمح لمن هو بين 18 و 22 (الطلاب الجامعيين).

1 Like

صحيح كلامك لكن للأسف ما عرفت أصيغ الشرط , و هي الي توصلتله بعد عدة محاولات :neutral_face:

1 Like

بإمكانك صياغة الشرط بهذا الشكل:

if age < 18:
     # العمر اصغر من 18 لا تسمح له بالدخول
elif age > 22:
     # العمر أكبر من 22 لا تسمح له بالدخول
else:
     # العمر بين 18 و 22 يعني أنه مسموح له

وتكتب بدل الاسطر العربية الرسائل المطلوبة باستعمال print

1 Like
def apply():
    age=int(input('age=' ))

    if age<18:
        print('you are too young')
    if age>22:
        print('you are too old')
    if 18<=age<=22:
        print('welcome to Egypt scholarship program')

apply()
apply()
apply()
apply()
apply()
3 Likes
def apply():
    
    i=0
    while i<1000:
        age = int(input('age='))
        if age<18:
            print('you are too young')

        if age>22:
            print('you are too old')

        if 18<=age<=22:
            print('welcome to Egypt scholarship program')
        i=i+1
        
apply()
3 Likes

عمل رائع يا خير الدين

1 Like

جميل جدا
بالتوفيق

1 Like

شكرا استاذ ياسر :rose:

1 Like
def apply():
 age = input()
 age = int(age)
 if age < 18 :
    print ('You are too young')
 elif age > 22 :
    print ('You are too old')
 else :
    print('Welcome to Egypt scholarship program')
i=1
while i<=`1000 :
    apply ()
    i=1+i
````
1 Like