Project 3 INTRO TO APPLIED PROGRAMMING
Description
Unformatted Attachment Preview
Instructions
1. Match the item with its definition. Write your answer as a comment at
the beginning of your python file.
A. Class Attribute
B. Class Object
C. Instance Methods
D. Instance Attribute
E. Instance Object
1. A factory for creating new class instances.
2. Represents a single instance of a class.
3. Functions that are also class attributes.
4. A variable that exists in a single instance.
5. A variable shared with all instances of a class.
Write a python program for the following problems:
2. Make a class called Element with parameters & instance attributes of
name, symbol, and number. Next, create an object called hydrogen of this
class with the values Hydrogen, H, and 1.
3. Write a function that takes a list of strings as a parameter. The function
should print out a report with the following statistics.
The number of words in the list.
The longest word (just provide the first if there is more than one).
The average word length.
Here is an example. (Don’t use this list below in your project. If you do,
you will receive zero points for this problem.) Create your own list.
pets([“dog”, “hippopotamus”, “cat”, “mule”, “eagle”])
The number of words is 5
The longest word is hippopotamus
The average word length is 5.4
4. Finish this program by writing a constructor to run without errors. The
only item you add to this program is the constructor. Don’t add or erase
from the code that was given.
class PhonePlan:
def print_plan(self):
print(‘Mins:’, self.num_mins, end=’ ‘)
print(‘Messages:’, self.num_messages)
# Add constructor
# Your solution goes after this comment
my_plan = PhonePlan(200, 300)
dads_plan = PhonePlan()
print(‘My plan…’, end=’ ‘)
my_plan.print_plan()
print(‘Dad’s plan…’, end=’ ‘)
dads_plan.print_plan()
As asked, this project must output the correct answer for each problem to
receive no deduction.
Purchase answer to see full
attachment
1. Match the item with its definition. Write your answer as a comment at
the beginning of your python file.
A. Class Attribute
B. Class Object
C. Instance Methods
D. Instance Attribute
E. Instance Object
1. A factory for creating new class instances.
2. Represents a single instance of a class.
3. Functions that are also class attributes.
4. A variable that exists in a single instance.
5. A variable shared with all instances of a class.
Write a python program for the following problems:
2. Make a class called Element with parameters & instance attributes of
name, symbol, and number. Next, create an object called hydrogen of this
class with the values Hydrogen, H, and 1.
3. Write a function that takes a list of strings as a parameter. The function
should print out a report with the following statistics.
The number of words in the list.
The longest word (just provide the first if there is more than one).
The average word length.
Here is an example. (Don’t use this list below in your project. If you do,
you will receive zero points for this problem.) Create your own list.
pets([“dog”, “hippopotamus”, “cat”, “mule”, “eagle”])
The number of words is 5
The longest word is hippopotamus
The average word length is 5.4
4. Finish this program by writing a constructor to run without errors. The
only item you add to this program is the constructor. Don’t add or erase
from the code that was given.
class PhonePlan:
def print_plan(self):
print(‘Mins:’, self.num_mins, end=’ ‘)
print(‘Messages:’, self.num_messages)
# Add constructor
# Your solution goes after this comment
my_plan = PhonePlan(200, 300)
dads_plan = PhonePlan()
print(‘My plan…’, end=’ ‘)
my_plan.print_plan()
print(‘Dad’s plan…’, end=’ ‘)
dads_plan.print_plan()
As asked, this project must output the correct answer for each problem to
receive no deduction.
Purchase answer to see full
attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool’s honor code & terms of service.
Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."