Write a program in Python to read scores for a test and valid scores are integer...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program in Python to read scores for a test and valid scores are integer values from 0 to 100. You will NOT need a function to read the score value in this program. Once you read this value for score, pass that value to a function called findGrade () and this function will return a string of either 'PASS' or 'FAIL' If score is from 50 to 100 then it is a 'PASS' else it is a 'FAIL' grade. Then for the output, print the score together with the grade. Such as: 98 PASS 49 FAIL 110 PASS Output shown above are for THREE different runs of your program. But note that a score of 110 is an invalid score and hence should display an error message such as: 110 Invalid score. The error message of "Invalid score" should be displayed and then the function findGrade () is NOT called. In other words, the function findGrade () is ONLY called if the score is valid. Hence, add statement after reading the scores to validate the value entered to be in the range from 0 to 100 and only then, the findGrade () function will be called and only then you will print the score and the grade. Otherwise, display the score and an error message. Lastly, add a function called print Info() that will accept the score and grade value and print these two values with some text to make the output meaninful. That means, if the score is valid, call the findGrade () function and also the printInfo() function. Otherwise, display an error message. Have a Word document and show your source code there and Label at the top that this is for question 1. Please make sure that I can read the code. Show FOUR different outputs of your program and it MUST be shown separately from the source code. Source code to be shown ONLY ONCE. One score for a PASS grade, one score for a FAIL grade, one invalid score greater than 100 and one invalid score less than 0. 2 Assume the days of the week are numbered 0, 1,2,3,4,5,6 from Sunday to Saturday. Write a Python program with a function called get DayName () which if it is given the day number, and it returns the day name (a string). 21 dayNumber = 2 22 dayName = get DayName (day Number) 23 The value for dayNumber is set in line #21 and this value should be read from the keyboard to make your program more general. Meaning that you can test different values for dayNumber without changing your code all the time. The function getDayName() is called in line #22 and it should return the string "Tuesday" for the value of 2 for dayNumber as set in line #21. Hint: You should use nested-if-else in your getDayName () function. Or a switch statement. You should print the value of dayName in line #23 and make sure each value of dayNumber from 0 to to 6 passed to the function getDayName (), it does return the correct string for the day name. Now, if you pass an invalid value for the dayNumber such as 10 to the get DayName () function, your get DayName () function will return an incorrect value. Hence, add a statement in your 'main' function to validate the input such that the function getDayName () will only be called if the values for dayNumber are from 0 to 6. These are the valid values. Otherwise, display an error message and do NOT call the get DayName () function. Hence, if the value for dayNumber is 10, then you should have this error message output (shown below) and the get DayName () function is NOT called. 10 is an Invalid value for dayNumber. Shoud be from 0 to 6 Lastly, add a function called printInfo() that will accept the dayNumber and dayName value and print these two values with some text to make the output meaninful. Using the same file from Question #1, in a new page put a Label at the top that this is for question 2. Then show source code for your answer. Please make sure that I can read the code. Show FOUR different outputs of your program and it MUST be shown separately from the source code. Show source code ONLY ONCE. One output for Saturday, one output for Sunday, one output for invalid value of 10 and one output for invalid value of -3 SUBMIT JUST ONE FILE that has ALL your work. Best if it is a pdf file. Write a program in Python to read scores for a test and valid scores are integer values from 0 to 100. You will NOT need a function to read the score value in this program. Once you read this value for score, pass that value to a function called findGrade () and this function will return a string of either 'PASS' or 'FAIL' If score is from 50 to 100 then it is a 'PASS' else it is a 'FAIL' grade. Then for the output, print the score together with the grade. Such as: 98 PASS 49 FAIL 110 PASS Output shown above are for THREE different runs of your program. But note that a score of 110 is an invalid score and hence should display an error message such as: 110 Invalid score. The error message of "Invalid score" should be displayed and then the function findGrade () is NOT called. In other words, the function findGrade () is ONLY called if the score is valid. Hence, add statement after reading the scores to validate the value entered to be in the range from 0 to 100 and only then, the findGrade () function will be called and only then you will print the score and the grade. Otherwise, display the score and an error message. Lastly, add a function called print Info() that will accept the score and grade value and print these two values with some text to make the output meaninful. That means, if the score is valid, call the findGrade () function and also the printInfo() function. Otherwise, display an error message. Have a Word document and show your source code there and Label at the top that this is for question 1. Please make sure that I can read the code. Show FOUR different outputs of your program and it MUST be shown separately from the source code. Source code to be shown ONLY ONCE. One score for a PASS grade, one score for a FAIL grade, one invalid score greater than 100 and one invalid score less than 0. 2 Assume the days of the week are numbered 0,1,2,3,4,5,6 from Sunday to Saturday. Write a Python program with a function called getDayName () which if it is given the day number, and it returns the day name (a string). 21 dayNumber = 2 22 dayName = get DayName (day Number) 23 The value for dayNumber is set in line #21 and this value should be read from the keyboard to make your program more general. Meaning that you can test different values for dayNumber without changing your code all the time. The function getDayName() is called in line #22 and it should return the string "Tuesday" for the value of 2 for dayNumber as set in line #21. Hint: You should use nested-if-else in your getDayName () function. Or a switch statement. You should print the value of dayName in line #23 and make sure each value of dayNumber from 0 to to 6 passed to the function getDayName (), it does return the correct string for the day name. Now, if you pass an invalid value for the dayNumber such as 10 to the get DayName () function, your getDayName () function will return an incorrect value. Hence, add a statement in your 'main' function to validate the input such that the function getDayName () will only be called if the values for dayNumber are from 0 to 6. These are the valid values. Otherwise, display an error message and do NOT call the get DayName() function. Hence, if the value for dayNumber is 10, then you should have this error message output (shown below) and the get DayName () function is NOT called. 10 is an Invalid value for dayNumber. Shoud be from 0 to 6 Lastly, add a function called print Info() that will accept the dayNumber and dayName value and print these two values with some text to make the output meaninful. Using the same file from Question #1, in a new page put a Label at the top that this is for question 2. Then show source code for your answer. Please make sure that I can read the code. Show FOUR different outputs of your program and it MUST be shown separately from the source code. Show source code ONLY ONCE. One output for Saturday, one output for Sunday, one output for invalid value of 10 and one output for invalid value of -3 SUBMIT JUST ONE FILE that has ALL your work. Best if it is a pdf file. Write a program in Python to read scores for a test and valid scores are integer values from 0 to 100. You will NOT need a function to read the score value in this program. Once you read this value for score, pass that value to a function called findGrade () and this function will return a string of either 'PASS' or 'FAIL' If score is from 50 to 100 then it is a 'PASS' else it is a 'FAIL' grade. Then for the output, print the score together with the grade. Such as: 98 PASS 49 FAIL 110 PASS Output shown above are for THREE different runs of your program. But note that a score of 110 is an invalid score and hence should display an error message such as: 110 Invalid score. The error message of "Invalid score" should be displayed and then the function findGrade () is NOT called. In other words, the function findGrade () is ONLY called if the score is valid. Hence, add statement after reading the scores to validate the value entered to be in the range from 0 to 100 and only then, the findGrade () function will be called and only then you will print the score and the grade. Otherwise, display the score and an error message. Lastly, add a function called print Info() that will accept the score and grade value and print these two values with some text to make the output meaninful. That means, if the score is valid, call the findGrade () function and also the printInfo() function. Otherwise, display an error message. Have a Word document and show your source code there and Label at the top that this is for question 1. Please make sure that I can read the code. Show FOUR different outputs of your program and it MUST be shown separately from the source code. Source code to be shown ONLY ONCE. One score for a PASS grade, one score for a FAIL grade, one invalid score greater than 100 and one invalid score less than 0. 2 Assume the days of the week are numbered 0, 1,2,3,4,5,6 from Sunday to Saturday. Write a Python program with a function called get DayName () which if it is given the day number, and it returns the day name (a string). 21 dayNumber = 2 22 dayName = get DayName (day Number) 23 The value for dayNumber is set in line #21 and this value should be read from the keyboard to make your program more general. Meaning that you can test different values for dayNumber without changing your code all the time. The function getDayName() is called in line #22 and it should return the string "Tuesday" for the value of 2 for dayNumber as set in line #21. Hint: You should use nested-if-else in your getDayName () function. Or a switch statement. You should print the value of dayName in line #23 and make sure each value of dayNumber from 0 to to 6 passed to the function getDayName (), it does return the correct string for the day name. Now, if you pass an invalid value for the dayNumber such as 10 to the get DayName () function, your get DayName () function will return an incorrect value. Hence, add a statement in your 'main' function to validate the input such that the function getDayName () will only be called if the values for dayNumber are from 0 to 6. These are the valid values. Otherwise, display an error message and do NOT call the get DayName () function. Hence, if the value for dayNumber is 10, then you should have this error message output (shown below) and the get DayName () function is NOT called. 10 is an Invalid value for dayNumber. Shoud be from 0 to 6 Lastly, add a function called printInfo() that will accept the dayNumber and dayName value and print these two values with some text to make the output meaninful. Using the same file from Question #1, in a new page put a Label at the top that this is for question 2. Then show source code for your answer. Please make sure that I can read the code. Show FOUR different outputs of your program and it MUST be shown separately from the source code. Show source code ONLY ONCE. One output for Saturday, one output for Sunday, one output for invalid value of 10 and one output for invalid value of -3 SUBMIT JUST ONE FILE that has ALL your work. Best if it is a pdf file. Write a program in Python to read scores for a test and valid scores are integer values from 0 to 100. You will NOT need a function to read the score value in this program. Once you read this value for score, pass that value to a function called findGrade () and this function will return a string of either 'PASS' or 'FAIL' If score is from 50 to 100 then it is a 'PASS' else it is a 'FAIL' grade. Then for the output, print the score together with the grade. Such as: 98 PASS 49 FAIL 110 PASS Output shown above are for THREE different runs of your program. But note that a score of 110 is an invalid score and hence should display an error message such as: 110 Invalid score. The error message of "Invalid score" should be displayed and then the function findGrade () is NOT called. In other words, the function findGrade () is ONLY called if the score is valid. Hence, add statement after reading the scores to validate the value entered to be in the range from 0 to 100 and only then, the findGrade () function will be called and only then you will print the score and the grade. Otherwise, display the score and an error message. Lastly, add a function called print Info() that will accept the score and grade value and print these two values with some text to make the output meaninful. That means, if the score is valid, call the findGrade () function and also the printInfo() function. Otherwise, display an error message. Have a Word document and show your source code there and Label at the top that this is for question 1. Please make sure that I can read the code. Show FOUR different outputs of your program and it MUST be shown separately from the source code. Source code to be shown ONLY ONCE. One score for a PASS grade, one score for a FAIL grade, one invalid score greater than 100 and one invalid score less than 0. 2 Assume the days of the week are numbered 0,1,2,3,4,5,6 from Sunday to Saturday. Write a Python program with a function called getDayName () which if it is given the day number, and it returns the day name (a string). 21 dayNumber = 2 22 dayName = get DayName (day Number) 23 The value for dayNumber is set in line #21 and this value should be read from the keyboard to make your program more general. Meaning that you can test different values for dayNumber without changing your code all the time. The function getDayName() is called in line #22 and it should return the string "Tuesday" for the value of 2 for dayNumber as set in line #21. Hint: You should use nested-if-else in your getDayName () function. Or a switch statement. You should print the value of dayName in line #23 and make sure each value of dayNumber from 0 to to 6 passed to the function getDayName (), it does return the correct string for the day name. Now, if you pass an invalid value for the dayNumber such as 10 to the get DayName () function, your getDayName () function will return an incorrect value. Hence, add a statement in your 'main' function to validate the input such that the function getDayName () will only be called if the values for dayNumber are from 0 to 6. These are the valid values. Otherwise, display an error message and do NOT call the get DayName() function. Hence, if the value for dayNumber is 10, then you should have this error message output (shown below) and the get DayName () function is NOT called. 10 is an Invalid value for dayNumber. Shoud be from 0 to 6 Lastly, add a function called print Info() that will accept the dayNumber and dayName value and print these two values with some text to make the output meaninful. Using the same file from Question #1, in a new page put a Label at the top that this is for question 2. Then show source code for your answer. Please make sure that I can read the code. Show FOUR different outputs of your program and it MUST be shown separately from the source code. Show source code ONLY ONCE. One output for Saturday, one output for Sunday, one output for invalid value of 10 and one output for invalid value of -3 SUBMIT JUST ONE FILE that has ALL your work. Best if it is a pdf file.
Expert Answer:
Related Book For
Introduction To Statistics And Data Analysis
ISBN: 9780495118732
3rd Edition
Authors: Roxy Peck, Chris Olsen, Jay L. Devore
Posted Date:
Students also viewed these programming questions
-
2. Consider a helicopter rotor in a wind tunnel. The rotor is spinning and the wind is turned on. The equation for the rotor flapping was derived in class for this situation. Note that = - +C/2 =...
-
What functions are there in the mazeAsn4 module: print_maze(maze) Description: This function displays the maze. The accessible cells are labelled G i.e. green, the blocked cells are labelled R i.e....
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
Problem 5-47 Amortizing Loans and Inflation (LO3) Suppose you take out a $108,000, 20-year mortgage loan to buy a condo. The interest rate on the loan is 5%. To keep things simple, we will assume you...
-
Complete the derivation for the burnout height Hbo in Example 9.13. Use the numbers for the Saturn V rocket in Example 9.12 and use Equations 9.167 and 9.168 to determine the height and speed at...
-
The WS Music Club was formed on 1 June 208. The following information was provided for the year ended 31 May 209: Additional information: 1. The club has 240 members. The annual subscription is $50....
-
Use equation (17.2) to establish the following distributional relationships that are helpful for calculating quantiles. a. Assume that \(y_{0}=\alpha_{1} F / \alpha_{2}\), where \(F\) has an...
-
On November 1, 2007, Columbo Company adopted a stock option plan that granted options to key executives to purchase 30,000 shares of the companys $10 par value common stock. The options were granted...
-
1. Point our the major impacts of inflation 2. Discuss the different types of unemployment?
-
GoGo Juice is a combination gas station and convenience store located at a busy intersection. Recently a national chain opened a similar store only a block away; consequently, sales have decreased...
-
1. choose two national health care systems, new zealand and ireland compare and contrast the two systems on the following variables: how is each system financed? what percentage of gdp is spent on...
-
Resource acquisition and customer satisfaction are important when an organization is viewed as a(n) ____________. (a) bureaucracy (b) closed system (c) open system (d) pyramid
-
Explain how accountability operates in the relationship between (a) a team leader and her team members, and (b) the same team leader and her boss.
-
The Sarbanes-Oxley Act of 2002 makes it easier for corporate executives to ____________. (a) protect themselves from shareholder lawsuits (b) sue employees who commit illegal acts (c) be tried and...
-
The highest level in Maslows hierarchy includes ____________ needs. (a) safety (b) esteem (c) self-actualization (d) physiological
-
The management function of ____________ is being performed when a retail manager measures daily sales in the womens apparel department and compares them with daily sales targets. (a) planning (b)...
-
d. Solve for the short-run cost-minimizing demands for labor and energy. Show all steps in your work. e. Solve for the short-run variable cost function. Show all steps in the derivation. f. Find the...
-
2. Assume a person bends forward to lift a load "with his back" as shown in Figure P12.42a. The person's spine piv- ots mainly at the fifth lumbar vertebra, with the principal supporting force...
-
High productivity and carbohydrate storage ability of the Jerusalem artichoke make it a promising agricultural crop. The article Leaf Gas Exchange and TuberYield in Jerusalem Artichoke Cultivars...
-
The coloration of male guppies may affect the mating preference of the female guppy. To test this hypothesis, scientists first identified two types of guppies, Yarra and Paria, that display different...
-
The recipe calls for four fresh eggs for each quiche. A Salt Lake County Health Department inspector paid a visit recently and pointed out that research by the Food and Drug Administration indicates...
-
Explain how the financial manager might use industry norms in the design of the companys financing mix.
-
You have developed the following income statement for Sing-Tel Corporation. It represents the most recent years operations, which ended yesterday. Your supervisor in the controllers office has just...
-
Financial data for three corporations are displayed here. MEASURE FIRM FIRM FIRM INDUSTRY A B C NORM Debt ratio 21% 24% 39% 21% Times interest 7.5 10.2 7.0 9.1 times earned times times times...
Study smarter with the SolutionInn App