In python what is wrong with this code? we have to make a class by the name of the student that has a first name, last n
Posted: Tue Jul 05, 2022 10:33 am
In python
what is wrong with this code?
we have to make a class by the name of the student that hasa first name, last name, a list of grades instance initialization afunction that calculates the GPA, and then we have to make anobject of class a pass value to it.
class Student: H def __init__(self, first_name, last_name, grades=[]): self.first_name self.last_name self.grades = grades • grades = ["A", "B", "C", "D", "F"], - def gpa_calculation(self, grades): - Student = first_name = last_name gpa = float(input("What is your GPA: ")) if gpa == 4.0 or gpa <= 3.8: print("A") elif gpa == 3.7 or gpa <= 3.5: print("B") elif gpa == 3.4 or gpa <= 3.0: print("C") elif gpa == 3.0 or gpa <= 2.8: print("D") else: print("YOU Failed") def get_student_status(self): print(self.first_name + " " + self.last_name + 02 A1 A2 V your Grade is: " + str(self.grades))
from student_status import Student s1 = Student ("John", "Big") print(s1.get_student_status())
what is wrong with this code?
we have to make a class by the name of the student that hasa first name, last name, a list of grades instance initialization afunction that calculates the GPA, and then we have to make anobject of class a pass value to it.
class Student: H def __init__(self, first_name, last_name, grades=[]): self.first_name self.last_name self.grades = grades • grades = ["A", "B", "C", "D", "F"], - def gpa_calculation(self, grades): - Student = first_name = last_name gpa = float(input("What is your GPA: ")) if gpa == 4.0 or gpa <= 3.8: print("A") elif gpa == 3.7 or gpa <= 3.5: print("B") elif gpa == 3.4 or gpa <= 3.0: print("C") elif gpa == 3.0 or gpa <= 2.8: print("D") else: print("YOU Failed") def get_student_status(self): print(self.first_name + " " + self.last_name + 02 A1 A2 V your Grade is: " + str(self.grades))
from student_status import Student s1 = Student ("John", "Big") print(s1.get_student_status())