-
-
Notifications
You must be signed in to change notification settings - Fork 123
Description
Please check the current issues
I didn't find it.
What Page were you on
Please copy/paste the URL from your address bar.
https://py3.umsi.education/ns/books/published/fopp/TransformingSequences/FStrings.html
Describe the bug
The final multiple choice question on the page does not display the correct answer. All four answers as displayed are incorrect.
s = "I saw the movie, Mary Poppins Returns, and I thought it was great."
all the expressions
r_count = s.count("r")
all_case_r_count = s.lower().count("r")
r_precentage = all_case_r_count/len(s) * 100
use mostly variables inside f-strings or format()
first_str = f"The number of r characters: {r_count}."
second_str = "The percentage of r characters (upper or lower case): {:.2f}%.".format(r_precentage)
display
print( first_str + " " + second_str)
This code should print: "The number of r characters: 3. The percentage of r characters (upper or lower case): 6.06%."
However, that is not one of the multiple choice answers available.
A Screenshot is worth a thousand words
