Last active
October 20, 2022 05:59
-
-
Save hoangtuan151/a9116405f1e2955d8aca8ef2d1e3d5c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Student: | |
def __init__(self, name) -> None: | |
self.Name = name | |
def __str__(self) -> str: | |
return f"Student({self.Name})" | |
def change_student(s: Student): | |
s.Name = "AAA" | |
s = Student("New name") | |
s.Name = "BBB" | |
print(f"function: {s}") | |
def main(): | |
a = Student("john") | |
print(f"main: {a}") | |
change_student(a) | |
print(f"main: {a}") | |
====== OUTPUT ====== | |
main: Student(john) | |
function: Student(BBB) | |
main: Student(AAA) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment