Skip to content

Instantly share code, notes, and snippets.

@Pythonian
Created May 28, 2022 13:35
Show Gist options
  • Save Pythonian/619858b91d660755a93468c697724e35 to your computer and use it in GitHub Desktop.
Save Pythonian/619858b91d660755a93468c697724e35 to your computer and use it in GitHub Desktop.
class Student:
def __init__(self, name: str, age: int, tracks: list, score: float):
self.name = name
self.age = age
self.tracks = tracks
self.score = score
def change_name(self, name):
print(name)
def change_age(self, age):
print(age)
def add_track(self, tracks):
print(tracks)
def get_score(self):
score = 23.4
print(score)
def __str__(self):
return f"Name: {self.name}, Age: {self.age}, Tracks: {self.tracks}, Score: {self.score}"
if __name__ == '__main__':
bob = Student(name="Bob", age=26, tracks=["FE","BE"], score=20.90)
print(bob.__str__())
bob.change_name("Frank")
bob.change_age(34)
bob.add_track("UI/UX")
bob.get_score()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment