Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In Python Visual Studios, why does this have so many errors when I separate it f

ID: 3881848 • Letter: I

Question

In Python Visual Studios, why does this have so many errors when I separate it from the main code and try to make a function out of it. It does not have errors in the main code. It had no errors before and now it has 28 or so??

1 from operator import eq 2 from operator import ge 3 from operator import le 4 5 def gainMuscle): 6 while True: overal!Goal= str(input('Do you desire to lose weight or gain muscle ? Please type n lose weight or gain muscle.")) 9 10 elif ea(overallGoal.lower)"gain muscle 12 13 14 15 16 17 18 19 20 21 while True: try: idealmaxBench 0 maxbackSquat 0 23 24 25 26 27 28 maxmilitaryPress-0 idea Imilitarypress = 0 maxdeadLift = 0 idealdeadLift0 while(maxBench >= idea ImaxBench): 30 31 32 34 35 36 37 38 39 40 maxBench = int (input("Please enter your current 1 rep max bench press in pounds. ")) idealmaxBench-int (input("Please enter your ideal 1 rep max bench press in pounds. ")) if le(idealmaxBench, maxBench): print("The goal ideal 1 rep weight must be more than the current weight you are capable of lifting.") 42 43 while(maxbackSquat >= idea!maxSquat): 45 46 47 48 49 50 51 52 53 maxbackSquat = int(input("Please enter your current 1 rep max back squat in pounds. ")) idealmaxSquat- int (input("Please enter your ideal 1 rep max back squat in pounds. ")) if le(idealmaxSquat, maxbackSquat): print("The goal ideal 1 rep weight must be more than the current weight you are capable of lifting.")

Explanation / Answer

Hi,

By seeing the code that is displayed through screenshot I can say that in your function "gainMuscle()", the use of "elif" is incorrect. You have got to use the "if" before you can type the "elif" in the code. Please try removing that line from your code and try again.
Remove below line and run the code-
elif eq(overallGoal.lower(),"gain muscle"):

I would suggest ypu to use the below "if" statement in place of "elif"-
if eq(overallGoal.lower(),"gain muscle"):

Regards,

Vinay Prakash Singh

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote