60 683
Assignments Done
97,8%
Successfully Done
In April 2018

Answer to Question #51430 in Python for seid

Question #51430
1.Write a program, to print the following on the screen:
What percent are you aiming for in this Python module?
and then read in an answer string on the next line. It must then calculate what exam percent is required to reach this target if the user gets 90% for the Python assignments. The final mark target is calculated as 0.7*examPercent + 0.3*assignmentPercent (see Course Outline). Your last output line must be:
If you get 90% for the assignments then you will need <whatever>% for the exam



2.Write a program, that extends question 2.py to handle the requirement that the exam percent in a module must be a minimum of 40%, otherwise the module is failed.
Expert's answer
'''Written for Python 2.7.2.'''
print 'What percent are you aiming for in this Python module?'
while True:
    try:
        target = int(raw_input(''))
    except:
        continue
    if (target >= 0) and (target <= 100):
            break
    else:
        print 'Enter correct percentage!'
        continue
exam = int((target - 0.3*90)/0.7)
print 'If you get 90% for the assignments then you will need {0}% for the exam'.format(exam)


===================================================================================
'''Written for Python 2.7.2.'''
print 'What percent are you aiming for in this Python module?'
while True:
    try:
        target = int(raw_input(''))
    except:
        continue
    if (target >= 0) and (target <= 100):
        exam = int((target - 0.3*90)/0.7)
        if exam <40:
            print 'You will receive only {0}% for exam. Try harder otherwise you will fail the module.'.format(exam)
            continue
        else:
            print 'If you get 90% for the assignments then you will need {0}% for the exam'.format(exam)
        break
    else:
        print 'Enter correct percentage!'
        continue

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions