Question

Programming Practice 8.3: Most Frequent Character 15 pts Not Submitted Due Mar 15, 2020 at 11:59 PM Submission Types Website
Lesson Objective(s): • Use the .upper function • Use loops with strings • Use lists with strings Lesson: Write a program that
• Use parallel lists -- one to hold the letters in the phrase, another to hold the counts of how many times that character ap
Assignment Requirements: Use appropriate variables, functions, and comments. Upload your .py file to Git Hub and submit the l
• Narwhals Narwhals swimming in the ocean F(S):
this is python do it in pycharm
0 0
Add a comment Improve this question Transcribed image text
Answer #1
print("Please enter a phrase: ",end="") s = input() # to take input st = s.upper() # to convert all string in upper case str=st.split(" ") # it splits the string where space is present s="" # creating an empty string list=[] # creating an empty list for a in str: #this loop concat all string from the str in a single string s s=s+a for b in s: # this loop use to store each character of the string in the list list.append(b) countList=[] # creating an empty list for x in s: # this loop is used to store count of the each element in the countList y=s.count(x) countList.append(y) max=0 # create a integer type variable to find the maximum value in the countList for d in countList: if(d>max): max=d countindex=-1 l=[] # creating an empty list to store index value for h in countList: countindex+=1 if(h==max): # if max value is present in countList then it appends index value of the list in l l.append(list[countindex]) res = [] for f in l: if f not in res: # this is used to remove the duplicate element from the l and stored in res res.append(f) res.sort() res.append("appeared") res.append(max) # max is maximum frequency of the character res.append("times.") print("The most common letter(s):") for z in range(len(res)): print(res[z],end=" ") 

Please enter a phrase: Narwhals Narwhals swimming in the ocean The most common letter(s): AN appeared 5 times. Process finish

Add a comment
Know the answer?
Add Answer to:
this is python do it in pycharm Programming Practice 8.3: Most Frequent Character 15 pts Not...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Problem Statement In genetics, most large animals have two copies of every gene, one from each...

    Problem Statement In genetics, most large animals have two copies of every gene, one from each parent. In the simplest genetic model, each of the genes takes on one of two forms, usually represented by an uppercase and lowercase letter of the same value ('A' and 'a', for example). The pair of genes typically contributes to the external qualities of the animal in one of two ways. If both genes are uppercase, they contribute in one way, while if both...

  • C programming (not c++) This programs input is a series of words. All words consist of...

    C programming (not c++) This programs input is a series of words. All words consist of only lowercase letters(a-z), no uppercase letters or digits or punctuation or other special symbols. The program reads until end-of-file, and then prints out the lowercase letters that were not seen in the input. Enter your input: the quick brown fox jumps over the lazy old dog Missing letters: enter your input: roll tide missing letters: a b c f g h j k m...

  • Number 3-7 (15 pts) Dedare a character array of sine 10. Wite a loop to naice...

    Number 3-7 (15 pts) Dedare a character array of sine 10. Wite a loop to naice the aay with consecutive letters staring at the letter Ty (10 pts) Dedlare a two-dimensional int atmay of sine 4 Brow mn and ntialge the s element of every row to 6 and the remaining elements to0 at the ame time of declaration Use as short statement wherever possible The fllowing problems are assigned for lecture 23 Functions Do them after the lecture (15...

  • Please help with this Intro to programming in C assignment! Intro to Programming in C-Large Program...

    Please help with this Intro to programming in C assignment! Intro to Programming in C-Large Program 3 - Hangman Game Assignment purpose: User defined functions, character arrays, c style string member functions Write an interactive program that will allow a user to play the game of Hangman. You will need to: e You will use four character arrays: o one for the word to be guessed (solution) o one for the word in progress (starword) o one for all of...

  • I need eclipse code for : Write a program that analyzes text written in the console...

    I need eclipse code for : Write a program that analyzes text written in the console by counting the number of times each of the 26 letters in the alphabet occurs. Uppercase and lowercase letters should be counted together (for example, both ‘A’ and ‘a’ should count as an A). Any characters that are not letters should be ignored. You must prompt the user to enter the text to be analyzed. Then, for any letter that appeared at least once...

  • Intro to Programming in C – Large Program 1 – Character/ Number converter Assignment Purpose: To...

    Intro to Programming in C – Large Program 1 – Character/ Number converter Assignment Purpose: To compile, build, and execute an interactive program with a simple loop, conditions, user defined functions and library functions from stdio.h and ctype.h. You will write a program that will convert characters to integers and integers to characters General Requirements • In your program you will change each letter entered by the user to both uppercase AND lowercase– o Use the function toupper in #include...

  • WE ARE USING PYTHON TO COMPLETE THIS ASSIGNMENT :) THANK YOU! In this programming assignment, you...

    WE ARE USING PYTHON TO COMPLETE THIS ASSIGNMENT :) THANK YOU! In this programming assignment, you will write functions to encrypt and decrypt messages using simple substitution ciphers. Your solution MUST include: a function called encode that takes two parameters: key, a 26-character long string that identifies the ciphertext mapping for each letter of the alphabet, in order; plaintext, a string of unspecified length that represents the message to be encoded. encode will return a string representing the ciphertext. a...

  • **DO IT AS PYTHON PLEASE** The Trifid Cipher General Problem Description The Trifid cipher (not to be confused with the...

    **DO IT AS PYTHON PLEASE** The Trifid Cipher General Problem Description The Trifid cipher (not to be confused with the creatures from the classic science-fiction film "The Day of the Triffids") is an algorithm that enciphers a plaintext message by encoding each letter as a three-digit number and then breaking up and rearranging the digits from each letter's encoded form. For this assignment, you will create a set of Python functions that can encode messages using this cipher (these functions...

  • Do in Python please provide screenshots aswell. Here are the requirements for your game: 1. The...

    Do in Python please provide screenshots aswell. Here are the requirements for your game: 1. The computer must select a word at random from the list of avail- able words that was provided in words.txt. The functions for loading the word list and selecting a random word have already been provided for you in ps3 hangman.py. 2. The game must be interactive; the flow of the game should go as follows: • At the start of the game, let the...

  • Write the Java code for the class WordCruncher. Include the following members:

    **IN JAVAAssignment 10.1 [95 points]The WordCruncher classWrite the Java code for the class WordCruncher. Include the following members:A default constructor that sets the instance variable 'word' to the string "default".A parameterized constructor that accepts one String object as a parameter and stores it in the instance variable. The String must consist only of letters: no whitespace, digits, or punctuation. If the String parameter does not consist only of letters, set the instance variable to "default" instead. (This restriction will make...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT