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
  • Python: Write a program that lets the user enter a string and displays the letter that...

    Python: Write a program that lets the user enter a string and displays the letter that appears most frequently in the string, ignore spaces, punctuation, and Upper vs Lower case. Create a list to hold letters based on the length of the user input Convert all letters to the same case Use a loop to check for each letter in the alphabet Have a variable to hold the largest number of times a letter appears, and replace the value when...

  • For this assignment, you will create a command-line version of the game Hangman. For this assignment...

    For this assignment, you will create a command-line version of the game Hangman. For this assignment you will research on StringBuilder Class (Use this link) and use it in your code. Please finish the program in Java Language Your game should have a list of at least ten phrases of your choosing (appropriate to all audiences please!) The game chooses a random phrase from the list. This is the phrase the player tries to guess. (10) ● The phrase is...

  • URGENT submission 2/22/10:15 am :this is the third time im posting this question Hello need some...

    URGENT submission 2/22/10:15 am :this is the third time im posting this question Hello need some help doing this Question in JAVA The program should loop 3 times per player NO ARRAYS • The secret word or phrase (a String, which may include embedded white spaces and punctuation characters) • The disguised word, in which each unknown alphabetic letter in the secret word is replaced with a question mark (?). When an unknown letter is guessed correctly, it will replace...

  • 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...

  • 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...

  • 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...

  • **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...

  • Background: The first step towards helping someone 'decode' a message is often to count how many...

    Background: The first step towards helping someone 'decode' a message is often to count how many times each letter of the alphabet appears in the message. Then divide each count by the total number of letters to compute the relative 'frequency'.   From these frequencies, it may be easier to recognize which letters are assigned to the vowels. For your own reference, here is a table of standard letter frequencies from typical English text. (You do NOT need to display this...

  • 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 write code using Python. Rubric Assignment Solution Total: 100 pts Program successfully retrieves and validates...

    Please write code using Python. Rubric Assignment Solution Total: 100 pts Program successfully retrieves and validates user input 15 pts Morse Code Function Created 10 pts Function Uses Parameters to get input message 15 pts Function successfully converts passed message to Morse Code and returns the Morse Code equivalent of message 45 pts Program calls Morse Code function and outputs the result of the function (i.e. the actual Morse Code) 15 pts Main Function Requirement Part 2 MUST have a...

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