Skip to content

Instantly share code, notes, and snippets.

@secemp9
Created December 1, 2022 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save secemp9/af4a5e433f957907ea0298a087bb3987 to your computer and use it in GitHub Desktop.
Save secemp9/af4a5e433f957907ea0298a087bb3987 to your computer and use it in GitHub Desktop.
Example of a class (3.8)
class ClassTester:
def __init__(self):
self.to_modify = "hello"
def msg(self):
print(self.to_modify)
# do something with the to_modify function beside printing, since it's just an example
Tester = ClassTester()
Tester.msg()
Tester.to_modify = 20
Tester.msg()
Tester.to_modify = 30
Tester.msg()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment