Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program in Python to read scores for a test and valid scores are integer values from 0 to 100. You will NOT

Write a program in Python to read scores for a test and valid scores are integer values from 0 to 100. You Have a Word document and show your source code there and Label at the top that this is for question 1. Please 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 Hence, if the value for dayNumber is 10, then you should have this error message output (shown below) and the

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.

Step by Step Solution

3.45 Rating (145 Votes )

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

Introduction To Statistics And Data Analysis

Authors: Roxy Peck, Chris Olsen, Jay L. Devore

3rd Edition

0495118737, 9780495118732

More Books

Students also viewed these Programming questions