Write python programming inputs for following
Answers
Source code Inputs
class Student:
def getStudDetails(self):
self.sName = input("Enter Student Name : ")
self.sRoll = input("Enter Student's Enroll No.: ")
def showStudDetails(self):
print("\nSTUDENT DETAILS")
print("Student Name :", self.sName)
print("Student Enroll. No. :", self.sRoll)
class Academics(Student):
total = 0
def getMarks(self):
for x in range(5):
print("Enter marks for subject", (x+ 1), ":", end="")
self.marks = int(input())
self.total = self.total + self.marks
def getATotal(self):
self.showStudDetails()
return self.total
class Sports:
spName =""
grade = 0
def getSport(self):
self.spName = input("Enter Sport Name : ")
self.grade = input("Enter Sport Marks:")
def getSmarks(self):
return self.grade
def showSport(self):
print("Sport Name :", self.spName)
class Result(Academics, Sports):
def getResult(self):
self.getStudDetails()
self.getMarks()
self.getSport()
def showResult(self):
aTotal = int(self.getATotal())
sTotal = int (self.getSmarks())
per = (aTotal + sTotal)/6
print("Percentage :{:.2f}".format(per))
self.showSport()
r = Result()
r.getResult()
r.showResult()
More information
•>>Python is an interpreted, high-level and general-purpose programming language. Python's design philosophy emphasizes code readability with its notable use of significant whitespace. Its language constructs and object-oriented approach aim to help programmers write clear, logical code for small and large-scale projectsPython interpreters are available for many operating systems. A global community of programmers develops and maintains CPython, a free and open-source reference implementation. A non-profit organization, the Python Software Foundation, manages and directs resources for Python and CPython development. It currently ties with Java as the second most popular programming language in the world.
Answer:
Explanation: Source code Inputs
class Student:
def getStudDetails(self):
self.sName = input("Enter Student Name : ")
self.sRoll = input("Enter Student's Enroll No.: ")
def showStudDetails(self):
print("\nSTUDENT DETAILS")
print("Student Name :", self.sName)
print("Student Enroll. No. :", self.sRoll)
class Academics(Student):
total = 0
def getMarks(self):
for x in range(5):
print("Enter marks for subject", (x+ 1), ":", end="")
self.marks = int(input())
self.total = self.total + self.marks
def getATotal(self):
self.showStudDetails()
return self.total
class Sports:
spName =""
grade = 0
def getSport(self):
self.spName = input("Enter Sport Name : ")
self.grade = input("Enter Sport Marks:")
def getSmarks(self):
return self.grade
def showSport(self):
print("Sport Name :", self.spName)
class Result(Academics, Sports):
def getResult(self):
self.getStudDetails()
self.getMarks()
self.getSport()
def showResult(self):
aTotal = int(self.getATotal())
sTotal = int (self.getSmarks())
per = (aTotal + sTotal)/6
print("Percentage :{:.2f}".format(per))
self.showSport()
r = Result()
r.getResult()
r.showResult()