Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Somehow code does not work in PYTHON. Please help with question. Exercises Unless specified otherwise, use IPython sessions for each exercise. 3.1 (Validating User Input)
Somehow code does not work in PYTHON. Please help with question.
Exercises Unless specified otherwise, use IPython sessions for each exercise. 3.1 (Validating User Input) Modify the script of Fig. 3.3 to validate its inputs. For any input, if the value entered is other than 1 or 2, keep looping until the user enters a correct 112 Control Statements and Program Development value. Use one counter to keep track of the number of passes, then calculate the number of failures after all the user's inputs have been received. 1 2 3 4 5 7 #f1903_03.py using nested control statements to analyze examination results. initialize variables passes = 0 number of passes failures - 0 number of failures 8 process 10 students 9 for student in range(10): 10 + get one exam result result = int(input('Enter result (1=pass, 2-fail): ')) 12 13 if result -- 1: 14 passes - passes + 1 15 else: failures = failures + 1 17 16 Fig. 3.3 Analysis of examination results. (Part 1 of 2.) 100 Control Statements and Program Development 18 + termination phase 19 print('Passed:', passes) 20 print("Failed:', failures) 21 22 if passes > 8: print('Bonus to instructor') 23 Enter result (l=pass, 2=fail): 1 Enter result (1=pass, 2-fail): 2 Enter result (lepass, 2-fail): 2 Enter result (1-pass, 2-fail): 1 Enter result (l-pass, 2-fail): 1 Enter result (1=pass, 2-fail): 1 Enter result (1=pass, 2=fail): 2 Enter result (1=pass, 2=fail): 1 Enter result (1=pass, 2-fail): 1 Enter result (l-pass, 2-fail): 2 Passed: 6 Failed: 4Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started