Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need help with python Write a python program for the following problems: 1. Write a function that takes a list of strings as a parameter.

need help with python

Write a python program for the following problems:

1. 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 assignment. 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

2. Write a function call search that takes a word (string) as a parameter. The function then searches the movie titles in the file movies.txt (attached here) and reports any matches with the given word. The function should also display the number of matches.

Here is an example. (Again don't use this. You use your own search word.)

search("war")

30. 91% Star Wars: The Last Jedi (2017) 462

38. 98% Snow White and the Seven Dwarfs (1937) 50

52. 93% Star Wars: Episode VII - The Force Awakens (2015) 430

71. 94% War for the Planet of the Apes (2017) 346

99. 91% Captain America: Civil War (2016) 406

There were 5 matches

3. Finish this program by writing a constructor in order for it to run with no errors

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()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Creating A Database In Filemaker Pro Visual QuickProject Guide

Authors: Steven A. Schwartz

1st Edition

0321321219, 978-0321321213

More Books

Students also viewed these Databases questions

Question

Describe the guidelines for appropriate use of the direct plan.

Answered: 1 week ago

Question

3. What are potential solutions?

Answered: 1 week ago

Question

Which team solution is more likely to be pursued and why?

Answered: 1 week ago