Skip to content

Instantly share code, notes, and snippets.

@temmyzeus
Last active January 22, 2022 15:18
Show Gist options
  • Save temmyzeus/f9246c4fa376b0618cf8fd57bc4f7576 to your computer and use it in GitHub Desktop.
Save temmyzeus/f9246c4fa376b0618cf8fd57bc4f7576 to your computer and use it in GitHub Desktop.
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