تطبيق التقديم على المنح
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')
تطبيق التقديم على المنح
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')
تأكد من الشروط لديك, لأن الشرط age == 25 يعني أنه فقط الناس الذي لديهم عمر 25 بالضبط سيظهر لهم “you are too old”
المفترض أن تقبل الشروط عمر 26 أو 27 أو 28… أي أعمار أخرى فوق 25
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')
مرحباً أحمد, قمت بالتعديل على الكومنت خاصتك لإصلاح شكل الأكواد, استعمل ` (حرف الذال) بدلاً من ’ (علامة التنصيص).
بالنسبة للأكواد, عمل رائع… بإمكانك الانتقال للمهمة التالية
تطبيق التقديم على المنح
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')
عمل رائع يا فوزي… انتقل للمهمة التالية
الحل
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')
عمل رائع يا أمينة انتقلي للمهمة التالية
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.')
عمل جيد يا محمد… بدلاً من تكرار if ما رأيك باستعمال elif ؟
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.')
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.')
Works pretty well
Though mostly age is an integer value, it’s weird to have age like 18.5 (unless verbally )
You can move on to the next task
Thanks a lot Yaser!
it makes sense for sure.
You’re welcome
السلام عليكم … الزر الذي يجب الضغط عليه ليُصبح الكود مُنسقا غير موجود لدي في الكيبورد …هل هناك طريقة أخرى لتنسيق الكود في الرد وشكراً
هذا حلي للمُهمة:
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’)
عمل جيد
الشروط التي كتبتها هي فقط للناس التي عمرها 15 بالضبط او 15 بالضبط او 15 بالضبط… يجب ان تستعمل اكبر من او اصغر لتحديد الشروط.
بالنسبة للكيبورد، هل هو فرنسي؟
نعم لدي كيبورد فرنسي
نعم, عمل رائع بالفعل
هل بإمكانك تجربة الطريقة المذكورة هنا (للكيبورد الفرنسي):
مشاركة حلول: عمل تطبيق للتقديم على المنح scholarship program
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’)
شكراً جزيلاً أخي الكريم …