Question

In: Computer Science

Students in an institute have their name, id, and total score (out of 100) recorded. You...

Students in an institute have their name, id, and total score (out of 100) recorded. You are required to write a Python class to represent the student. Your code should display “Pass” or “Fail”, where the pass-score is above 60. Write the constructor, and other required methods to complete your code. Test the class by creating two objects of the class, where one student fails and the other passes.

Solutions

Expert Solution

Thanks for the question, here is the simple class and test code

=========================================================================

class Student():
    def __init__(self, name, id, score):
        self.name = name
        self.id = id
        self.total_score = score

    def isPass(self):
        return self.total_score > 60

    def print_status(self):
        if self.isPass():
            print('Pass')
        else:
            print('Fail')

def main():
    paul = Student("Paul Hughes", 123, 78)
    patt = Student("Patrick Moe", 123, 59)

    paul.print_status()
    patt.print_status()

main()


Related Solutions

Create a view that will display the student id, name, event id, category, and score for...
Create a view that will display the student id, name, event id, category, and score for all events for students who scored a 70 or below on any test. Call this view atriskstudents. a. What code did you write for this view? Insert the snip of the contents of the view SQL code here: b. Using this view, display those students who earned a score of 65 or greater. Insert your snip here *********************************************************************************************************************************************************** *********************************************************************************************************************************************************** CREATE DATABASE Class; #-- Using...
The score of a course out of 100 in Winter of 10 students are 48, 92,...
The score of a course out of 100 in Winter of 10 students are 48, 92, 47, 44, 94, 18, 95, 67, 74, 64 a. Calculate Q1, Q3 and IQR of the data. b. Find the mean, median and standard deviation c. Determine whether the smallest value of this data set is an outlier. d. Comment the shape of the distribution.
Develop a program Grades.java that collects the user's (students) name, course name, and the score for...
Develop a program Grades.java that collects the user's (students) name, course name, and the score for three quizzes. You are supposed to read this data from the keyboard using the Scanner class. Calculate the total score and the average score. Further, using the grading scale below, based on the average score computed above, your program should calculate and output a letter grade. and the range boundaries should be configured properly (i.e.: exactly 90 and above is an A, and anything...
Q. The higher education department of Holmes Institute recorded data on the number of students enrolled...
Q. The higher education department of Holmes Institute recorded data on the number of students enrolled in the different study majors for the years 2018 and 2019. The data are stored in file STUDYMAJOR.xls. (given below) a) Use an appropriate graphical technique or chart to compare the number of enrolment in 2018 and 2019 of the different study major. Display the chart. b) Use an appropriate graphical technique or chart to display the percentage value of the number of enrolment...
Description Write a program that prints out your name, the course ID of this class, what...
Description Write a program that prints out your name, the course ID of this class, what programming/computer courses you've taken. Ask the user for two numbers. Show the sum of the two numbers, the difference, the product and the quotient. For the difference subtract the second number from the first, for the quotient, use the first number as the numerator(dividend) and the second as the denominator(divisor). Sample Output: My name is Jianan Liu, I'm in course CS36. I've taken: C...
A makeup test is given and the average (μX) score out of 100 was 85.0, with...
A makeup test is given and the average (μX) score out of 100 was 85.0, with a SD (σX) of 3.0. Assuming a normal distribution, find the dividing line (test scores) between the A's, B's, C's, D's, and E's. This time the highest 6% will be the A's, the next 16% B's, the next 26% C's, the next 36% D's.
A test is given and the average (μX) score out of 100 was only a 53.1,...
A test is given and the average (μX) score out of 100 was only a 53.1, with a SD (σX) of 8.9. Assuming the grades followed a normal distribution, use the Z table or Excel and formulas to find the dividing line (test scores) between the A's, B's, C's, D's, and E's. Starting from the top, the teacher will give the highest 15% A's, the next 10% B's, the next 30% C's, the next 25% D's, and the bottom 20%...
A makeup test is given and the average (μX) score out of 100 was 85.0, with...
A makeup test is given and the average (μX) score out of 100 was 85.0, with a SD (σX) of 3.0. Assuming a normal distribution, find the dividing line (test scores) between the A's, B's, C's, D's, and E's. This time the highest 6% will be the A's, the next 16% B's, the next 26% C's, the next 36% D's.
A test is given and the average (μX) score out of 100 was only a 53.1,...
A test is given and the average (μX) score out of 100 was only a 53.1, with a SD (σX) of 8.9. Assuming the grades followed a normal distribution, use the Z table or Excel and formulas to find the dividing line (test scores) between the A's, B's, C's, D's, and E's. Starting from the top, the teacher will give the highest 15% A's, the next 10% B's, the next 30% C's, the next 25% D's, and the bottom 20%...
ASSIGNMENT: Write a program to ask for the name and test score for 8 students, validate...
ASSIGNMENT: Write a program to ask for the name and test score for 8 students, validate that the test score is between 0.0 and 100.0 inclusive, and store the names and test scores in 2 parallel arrays. Then, calculate and display the average of the test scores. Finally, display all the students who have test scores above the average. Example Run #1: (bold type is what is entered by the user) Enter student name #1: George Enter the score for...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT