مشاركة حلول: عمل تطبيق للتقديم على المنح scholarship program

تطبيق التقديم على المنح

age = int(input())
if age == 15:
    print ('You are too young')
elif age == 25:
    print ('You are too old')
elif age==20:
    print ('Welcome to Egypt scholarship program')
2 Likes

تأكد من الشروط لديك, لأن الشرط age == 25 يعني أنه فقط الناس الذي لديهم عمر 25 بالضبط سيظهر لهم “you are too old” :smile:

المفترض أن تقبل الشروط عمر 26 أو 27 أو 28… أي أعمار أخرى فوق 25

1 Like
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')
2 Likes

مرحباً أحمد, قمت بالتعديل على الكومنت خاصتك لإصلاح شكل الأكواد, استعمل ` (حرف الذال) بدلاً من ’ (علامة التنصيص).

بالنسبة للأكواد, عمل رائع… بإمكانك الانتقال للمهمة التالية :wink:

1 Like

تطبيق التقديم على المنح

age = int(input())
if age <= 15:
    print ('You are too young')
elif age >= 25:
    print ('You are too old')
else:
    print ('Welcome to Egypt scholarship program')
2 Likes

عمل رائع يا فوزي… انتقل للمهمة التالية :wink:

1 Like

الحل

age =input()
age = int(age)

if age >= 18 and age <= 22:
    print('Welcome to Egypt scholarship program')
elif age <18:
    print('You are too young')
    
else:
    print('You are too old')   
2 Likes

عمل رائع يا أمينة انتقلي للمهمة التالية :+1:

1 Like
age = input()
age = int(age)

if 18 <= age <= 22:
    print('Welcome to Egypt scholarship program.')
    
if age < 18:
    print('You are too young.')
    
if age > 22:
    print('You are very old.')
2 Likes

عمل جيد يا محمد… بدلاً من تكرار if ما رأيك باستعمال elif ؟

1 Like

Thanks a lot Yaser for your reply,
So, How is this code?

age = input()
age = int(age)

if 18 <= age <= 22:
    print('Welcome to Egypt scholarship program.')
    
elif age < 18:
    print('You are too young.')
    
else:
    print('You are old.')
2 Likes

Some people may enter their age as 18.5 or 19.5, and I tried it then cam with an error.
So decided to replace “int” with “float” as per following code.
Please advice if there is a better way to do it.

age = input('Hello Scholarship candidate!' + ' ' + 'How old are you?')
age = float(age)

if 18 <= age <= 22:
    print('Welcome to Egypt scholarship program.')
    
elif age < 18:
    print('You are too young.')
    
else:
    print('You are old.')
3 Likes

Works pretty well :+1:

Though mostly age is an integer value, it’s weird to have age like 18.5 (unless verbally :smile:)

You can move on to the next task :wink:

3 Likes

Thanks a lot Yaser!
it makes sense for sure.

2 Likes

You’re welcome :blush:

1 Like

السلام عليكم … الزر الذي يجب الضغط عليه ليُصبح الكود مُنسقا غير موجود لدي في الكيبورد …هل هناك طريقة أخرى لتنسيق الكود في الرد وشكراً
هذا حلي للمُهمة:

age=input()
age=int(age)

if age==15:
print(‘You are too young’)
elif age==25:
print(‘You are too old’)
elif age==20:
print(‘Welcome to Egypt scholarship program’)
else:
print(‘Be sure that you entered a correct age … try again’)

2 Likes

عمل جيد :+1:

الشروط التي كتبتها هي فقط للناس التي عمرها 15 بالضبط او 15 بالضبط او 15 بالضبط… يجب ان تستعمل اكبر من او اصغر لتحديد الشروط.

بالنسبة للكيبورد، هل هو فرنسي؟

أه صحيح شكراً … كنت أتساءل عن الأعمار الأخرى… يبدو أني لم أفهم السؤال جيداً …أربكني المثال عن دولة مصر…أعتقد أني فهمت جيداً الآن
إذن أهكذا هو الحل:؟

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’)

نعم لدي كيبورد فرنسي

1 Like

نعم, عمل رائع بالفعل :+1:

هل بإمكانك تجربة الطريقة المذكورة هنا (للكيبورد الفرنسي):

مشاركة حلول: عمل تطبيق للتقديم على المنح scholarship program

1 Like
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’)

شكراً جزيلاً أخي الكريم :slight_smile:

1 Like