Select Page

Function : danube (s) Write a Python function named danube. The… Function : danube (s)Write a Python function named danube. The function takes as input a non-empty string s containing only upper case letters: ‘A’, ‘B’, ‘C’, ‘F’. Your function will only be tested with such strings. The letters represent the final grades of the students in a class.The function should print the following values rounded to 2 decimal places: the percentage of students who got A, B, C and F. The function should then print the average grade. A grade is average if at least 50% of the students received the same or higher grade AND at least 50% of the students received the same or lower grade. Note that there are always 1 or 2 averages. For example, in ‘ABABCCFF’, B and C are both averages. If there are two averages, enter the higher grade as the average. So, in the above example, you would report B as the average grade. Help: Use the following functions for strings:The count function which counts the number of characters in a string.The function round(number, digits) which rounds the number to the number of digits.Examples of 5 executions (5 displays of the danube function call):>>> danube(“AF”)50.0% of the students have A0.0% of the students have B0.0% of the students have C50.0% of the students have FThe average is A>>> danube(“ABABCC”)33.33% of the students have A33.33% of the students have B33.33% of the students have C0.0% of students have FThe average is B>>> danube(“AFCCBAABCF”)30.0% of students have A20.0% of students have B30.0% of students have C20.0% of students have FThe average is B>>>danube(“AFCCBAABCFC”)27.27% of students have A18.18% of students have B36.36% of students have C18.18% of students have FThe average is C>>>danube(“AAABBCCCFFFFFFF”)17.65% of students have A11.76% of students have B17.65% of students have C52.94% of the students have FThe average is FComputer ScienceEngineering & TechnologyPython Programming

Order your essay today and save 20% with the discount code ESSAYHELP