class Student:
def __init__(self, first, last, age, major):
self.first = first
self.last = last
self.age = age
self.major = major
self.courses = []
def profile(self):
print("Student name", self.first, ' ', self.last)
print("Student age:", self.age)
print(f"Major: {self.major}")
def enrol(self, course):
self.courses.append(course)
print("enrolled ", self.first," in", course)
def show_courses(self):
print(f"{self.first + '' + self.last} is taking the following courses")
for course in self.courses:
print(course)
s = Student('Sally', 'Harris', 20, 'Biology') # how do I get user input?
s.enrol('Biochemistry I')
s.enrol('Literature')
s.enrol('Mathematics')
s.show_courses()
Basically, I want to ask the user what the first
, last
, age
, and major
of 's'
are.
I only know how to input that data in the parameters parenthesis. Is there any way I could code a user input line for that data?