Given a file like this: teams.txt
Your program should produce output like this:
The Bears have won 4 games
The Sharks have won 7 games
The Cats have won 9 games
The Hedgehogs have won 6 games
The Ants have won 2 games
The Aardvarks have won 11 games
Teams with names shorter than 5 letters: [‘Cats’, ‘Ants’]
The three teams with the most wins are: [‘Aardvarks’, ‘Cats’, ‘Sharks’]
Your mission will be to do the following:
Develop an algorithm to solve all remaining steps in this problem.
Use a list comprehension to load the data from a file named “teams.txt”. There’s a sample file on Canvas with the data shown above.
Print out the information read in from the file formatted as shown in the example.
Use a list comprehension to create a list of the names of teams with less than 5 letters in their name.
Use a list comprehension to create a list of the names of the three teams with the highest wins.
can you use this function to open file?words_list = [ w.split( ) for w in open( name , “r” ) ]
and use list in one function to do this problem?
like vowels=[word for word in words_list \ if len([let for let in word if let in “aeiou”])>=2]
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.Read more
Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.Read more
Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.Read more
Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.Read more
By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.Read more