Answers for "Using Variables with Multiple Instances of a Python Class"

0

Using Variables with Multiple Instances of a Python Class

class CoffeeOrder:
	def __init__(self, coffee_name, price):
		self.coffee_name = coffee_name
		self.price = price

lucas_order = CoffeeOrder("Espresso", 2.10)
print(lucas_order.coffee_name)
print(lucas_order.price)

paulina_order = CoffeeOrder("Latte", 2.75)
print(paulina_order.coffee_name)
print(paulina_order.price)
Posted by: Guest on July-09-2021

Code answers related to "Using Variables with Multiple Instances of a Python Class"

Browse Popular Code Answers by Language