Question: python Detailed description Note: The function should not write to stdout i.e. do not use print(). The contents of the returned str are as follows:
python




Detailed description Note: The function should not write to stdout i.e. do not use print(). The contents of the returned str are as follows: 1. First line shows the Continent's name 2. For each entry in the Continent's stats dictionary: 1. Add a line showing the country's name, followed by the separator": "(1 colon, 1 whitespace), and the number of Covid-19 cases 3. The penultimate (second-to-last) line is a divider consisting a series of dashes (-) 4. The last line shows "Total cases", followed by the separator ": "(1 colon, 1 space) and the continent's total number of cases The formatting of the retumed str is as follows: 1. The colons should be aligned i.e. the colons should be in the same position in each line 2. The countries' names should be right-justified 3. The grades should be formatted to one decimal place and right- justified 4. On the final line, "Total cases" is right justified 5. On the final line, the total number of cases is formatted to one decimal place and right-justified 6. All lines, except the first line, should have the same length (including whitespaces) 7. The penultimate (second-to-last) line should be the same length as all other lines, excluding the first line. 8. Do not insert any unnecessary whitespace 9. Your str must include newlines where appropriate. CLUE: Use nested curly brackets with a variable in it to set the minimum number of characters of a string with a variable. [lecture note: StringFormat-Part2] Given: numl = 123 num2 = 53 str1, str2 and str3 will be identical. w1 = 6 # column width W2 = 4 # column width str1 = "!{0: print(get_covid_report(na)) Example usage 3 output North America Dominican Republic: 0.2 Canada: 0.9 Mexico: 2.1 Total cases: 3.2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
