Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help creating a function called candy_info that returns a 'Candy' object created using a constructor. Here is some info: Question and Solution requirements:
I need help creating a function called candy_info that returns a 'Candy' object created using a constructor.
Here is some info:
Question and Solution requirements:
Class Code:
Test Code:
Thank you for your help and time!
Problem Overview Your task in this homework assignment is to write a function returns the Candy object. Solution Specifications Your solution to this problem must meet the following criteria. 1. You must define a function candy_info in the file candy_function .py that takes a three parameters. - a string for the name of the candy - an int for the number of grams of sugar - a float for the price of the candy 2. The function must return the Candy object. class Candy: def _init__ (self, name, sugar, price): self.name=nameself.sugar=sugarself.price=price import candy_function. \# test the function my_candy = candy function. candy_info("SUGAR DADDY MILK CARAMEL POPS", 24, 10.45) print(my_candy. name) print(my_candy.sugar) print(my_candy.price)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started