Answered step by step
Verified Expert Solution
Link Copied!

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)

image text in transcribedimage text in transcribed

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: 4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Marketing Database Analytics

Authors: Andrew D. Banasiewicz

1st Edition

0415657881, 978-0415657884

More Books

Students also viewed these Databases questions

Question

Discuss all branches of science

Answered: 1 week ago