Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python, please tell me how to do this task. Proces5 The Process function has two parameters, Name and Score. Those parameters will be passed the

image text in transcribed

image text in transcribed

Python, please tell me how to do this task.

Proces5 The Process function has two parameters, Name and Score. Those parameters will be passed the name and the score for a particular student. For example, if the function is called as Process ("Fred", 78) then Name will contain the string "Fred" and Score will contain the integer 78. The Process function initializes a string S to the empty string, and then builds up and returns S as the value of the function, where S will contain the following items, in this order: 1 Student's name, padded on the right to 10 characters (columns 1... 10), 2: Student's score, converted to a string, and padded on the left to 3 characters (columns 3 Student's grade, padded on the left to 2 characters (columns 14...15), 4: one extra blank (column 16), 5 the correct number of vertical bar characters (columns 17...17+Score-1) This function starts to build the string s by calling PadLeft, PadRight, and GetGrade with the appropriate actual parameters. This function then also requires the use of a loop to add to the string the correct number of vertical bar characters, for this assignment I want you to use a counter loop (a variable with a while-loop, and not a for-loop) Finish the function by writing code in the gray area to do all of this. The Process function must not contain any print statements. It returns its result as the value of the function; printing happens in the Main function. Test your function by calling Process from the >command line prompt as Process("Fred", 78), which would return as the value of S the following string: Fred Similarly, manually test Process ("Sam, 23) and Process ("Mary", 100) to verify that your function works correctly. Common problems include "off-by-one" errors, where the number of vertical bars might be one too few or one too many-check this! def PadRight (S,N) while (len (S) 80: else: else: print ("B") if Score > 70: print ("C") if Score 60: else: else: print ("D") print ("F") return def Process (Name, Score)<>

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

Web Database Development Step By Step

Authors: Jim Buyens

1st Edition

0735609667, 978-0735609662

More Books

Students also viewed these Databases questions