اذهب إلى المحتوى
  • 0

لقد قمت بعمل مشروع استحضرت فيه بعض ما تعلمت في بعض أساسيات لغة بايثون. هل بإمكانكم مراجعته وتقديم بعض النصائح لتعديله بشكل أفضل.

Allati Mohamed

السؤال

المشروع عبارة عن آلة حاسبة لاحتياجات الشخص اليومية من السعرات الحرارية حسب نشاطه البدني.

اقتباس

print("WELCOME TO CALORIE CALCULATOR! \n")

weight = float(input("Enter your body weight (Kg): \n"))

height = float(input("Enter your height (Cm): \n"))

age = int(input("Enter your age (Years): \n"))

sex = input("Enter your sex (male or female): \n")

if sex.upper() == "male" or sex.lower() == "male":

    BMR = (10 * weight) + (6.25 * height) - (5 * age) + 5

    print(f"Your BMR value is {BMR}")

elif sex.upper() == "female" or sex.lower() == "female":

    BMR = (10 * weight) + (6.25 * height) - (5 * age) - 161

    print(f"Your BMR value is {BMR}")

else:

    print("Error! Please Enter Your Sex!!! \n")

effort = input("Are you anthletic? \n")

num = int(input("How many days do you exercise? \n"))

if effort.lower() == "yes":

    num > 0 and num <= 7

    workout = input("What is nature of your physical activity? (normal or hard) \n")

    if num >= 1 and num <= 3:

        if workout.lower() == "normal":

            print(f"Your daily calorie needs are: {BMR * 1.375} \n")

        elif workout.lower() == "hard":

            print(f"Your daily calorie needs are: {BMR * 1.55} \n")

        else:

            print(end= " ")                  

    elif num >= 4 and num <= 5:

        if workout.upper() == "normal" or workout.lower() == "normal":

            print(f"Your daily calorie needs are: {BMR * 1.55} \n")

        elif workout.lower() == "hard":

            print(f"Your daily calorie needs are: {BMR * 1.725} \n")

        else:

            print(end= " ")          

    elif num >= 6 and num <= 7:

        if workout.upper() == "normal" or workout.lower() == "normal":

            print(f"Your daily calorie needs are: {BMR * 1.725} \n")

        elif workout.lower() == "hard":

            print(f"Your daily calorie needs are: {BMR * 1.9} \n")

        else:

            print(end= " ")

    else:

        print(end= " ")        

elif effort.upper() == "no" or effort.lower() == "no":

    print(f"Your daily calorie needs are: {BMR * 1.2} \n")

else:

    print(end= " ")    

goal = input("""Choose your goal:

             ...Weight gain (Enter 1)...

             ...Weight loss (Enter 2)...\n""")

if goal.lower() == "1":

    print("""You should eat more than your daily caloric needs and balance your healthy eating.

        Good luck!""")

elif goal.lower() == "2":

    print("""You should eat less than your daily calorie needs by following a healthy and balanced diet.

        Good luck!""")    

else:

    print(end= " ")

 

 

رابط هذا التعليق
شارك على الشبكات الإجتماعية

Recommended Posts

انضم إلى النقاش

يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.

زائر
أجب على هذا السؤال...

×   لقد أضفت محتوى بخط أو تنسيق مختلف.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   جرى استعادة المحتوى السابق..   امسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

  • إعلانات

  • تابعنا على



×
×
  • أضف...