Menu

[solved]-Task 4 Len Find Count Len Workingstring Find Find Start Find Start End Count Count Start C Q39067198

Python

Task 4 len(), .find(), .count() - len(working_string) - .find(i) - .find(i, start) - .find(i, start, end) - .count(i)

Task 4 len(), .find(), .count() – len(working_string) – .find(“i”) – .find(“i”, start) – .find(“i”, start, end) – .count(“i”) – .count(“i”, start) – .count(“i”, start, end) Task 6 Program: Words after “G”/”g” Create a program inputs a phrase (like a famous quotation) and prints all of the words that start with h-z Sample input: enter a 1 sentence quote, non-alpha separate words: wheresoever you go, go with all your heart Sample output WHERESOEVER YOU WITH YOUR HEART split the words by building a placeholder variable: word loop each character in the input string check if character is a letter add a letter to word each loop until a non-alpha char is encountered if character is alpha I add character to word • non-alpha detected (space, punctuation, digit…) defines the end of a word and goes to else • else check if word is greater than “g” alphabetically o print word o set word = empty string or else o set word = empty string and build the next word Hint use lower() In [ ]: # [] create words after “G” # sample quote “Wheresoever you go, go with all your heart” – Confucius (551 BC – 479 BC) Show transcribed image text Task 4 len(), .find(), .count() – len(working_string) – .find(“i”) – .find(“i”, start) – .find(“i”, start, end) – .count(“i”) – .count(“i”, start) – .count(“i”, start, end) Task 6 Program: Words after “G”/”g” Create a program inputs a phrase (like a famous quotation) and prints all of the words that start with h-z Sample input: enter a 1 sentence quote, non-alpha separate words: wheresoever you go, go with all your heart Sample output WHERESOEVER YOU WITH YOUR HEART split the words by building a placeholder variable: word loop each character in the input string check if character is a letter add a letter to word each loop until a non-alpha char is encountered if character is alpha I add character to word • non-alpha detected (space, punctuation, digit…) defines the end of a word and goes to else • else check if word is greater than “g” alphabetically o print word o set word = empty string or else o set word = empty string and build the next word Hint use lower() In [ ]: # [] create words after “G” # sample quote “Wheresoever you go, go with all your heart” – Confucius (551 BC – 479 BC)

Expert Answer


Answer to Task 4 len(), .find(), .count() – len(working_string) – .find(“i”) – .find(“i”, start) – .find(“i”, start, end) – .count… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *