Last active
January 22, 2022 15:18
-
-
Save temmyzeus/f9246c4fa376b0618cf8fd57bc4f7576 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 Item: | |
# this is a class variable | |
percent_off = 0.1 | |
def __init__(self, item_name, price): | |
self.item_name = item_name | |
self.price = price | |
burger = Item(item_name='burger', price=2.55) | |
# print out the percent_off | |
print('Orignal Percentage Off:', burger.percent_off) | |
# Altering the percent_off (class_variable) | |
burger.percent_off = 0.7 | |
# print out the percent_off after the altering | |
print('Edited Percentage Off:', burger.percent_off) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment