# Pythone topic

#1

In the workspace to your right, there is the outline of a function called grade_converter().

The purpose of this function is to take a number grade (1-100), defined by the variable grade, and to return the appropriate letter grade (A, B, C, D, or F).

Your task is to complete the function by creating appropriate if and elif statements that will compare the input grade with a number and then return a letter grade.

i can’t underestend above notice,phrhaps, i am either new in pyhthone or my english knowleg poor,
anybody here help to me…

#2
``````>>> marks = [60, 70, 80, 90, 101]
>>> def cap(a):
return filter(lambda x: x > a, marks)

'F'
'D'
'C'
'B'
'A'
'A'
>>>
``````

This is not the solution that is expected by the exercise. It is a parallel. If-elif-else dynamics can play out in other ways.

``````>>> def get_letter_grade(n):
return grades[len(filter(lambda x: x > n, marks))-1]

'F'
'D'
'C'
'B'
'A'
'A'
>>>
``````

#3

you are good persone and knowlegable persone’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’'
thank mr.

#4

Using `if/elif/else` what have you written for this? Is this an exercise on Codecademy or a homework assignment?

#5

it is exercise…i loves python

#7
``````def get_letter_grade(n):
return 'ABCDF'[len(filter(lambda x: x > n, [60, 70, 80, 90, 101])) - 1]
``````

When there is no outcome from the list, `-1` is the outcome. Python slices the string from the right and finds `F`.

String of symbols versus list of gradients.

#8

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.