Ad
Code
Diff
  • poopFarter=lambda p:["💩","💨"][not bool(p)]
        
    • poopFarter=lambda p:"💩"if p else"💨"
    • poopFarter=lambda p:["💩","💨"][not bool(p)]
Code
Diff
  • class Student:
        def __init__(self, first_name, last_name, grades=None):
            self.first_name = first_name
            self.last_name = last_name
            self.grades = [] if grades is None else grades
    
        @property
        def full_name(self):
            return f'{self.first_name} {self.last_name}'
    
        @property
        def email(self):
            return f'{self.first_name[0]}{self.last_name}@codewars.com'
    
        @property
        def grade_average(self):
            if len(self.grades) <= 0:
                return 'Grades: None'
            else:
                return sum(self.grades) / len(self.grades)
    
        def assess(self):
            grades = [[i for i in range(65)], [i for i in range(65, 70)], [i for i in range(70, 80)], [i for i in range(80, 90)], [i for i in range(90, 101)]]
            mark = ['F', 'D', 'C', 'B', 'A']
            for i in range(5):
                if int(self.grade_average) in grades[i]:
                    return mark[i]
    • class Student:
    • def __init__(self, first_name, last_name, grades=None):
    • self.first_name = first_name
    • self.last_name = last_name
    • self.grades = [] if grades is None else grades
    • @property
    • def full_name(self):
    • return f'{self.first_name} {self.last_name}'
    • @property
    • def email(self):
    • return f'{self.first_name[0]}{self.last_name}@codewars.com'
    • @property
    • def grade_average(self):
    • if len(self.grades) <= 0:
    • return 'Grades: None'
    • else:
    • return sum(self.grades) / len(self.grades)
    • def assess(self):
    • if self.grade_average < 65:
    • return "F"
    • if 65 <= self.grade_average < 70:
    • return "D"
    • if 70 <= self.grade_average < 80:
    • return "C"
    • if 80 <= self.grade_average < 90:
    • return "B"
    • if self.grade_average >= 90:
    • return "A"
    • grades = [[i for i in range(65)], [i for i in range(65, 70)], [i for i in range(70, 80)], [i for i in range(80, 90)], [i for i in range(90, 101)]]
    • mark = ['F', 'D', 'C', 'B', 'A']
    • for i in range(5):
    • if int(self.grade_average) in grades[i]:
    • return mark[i]
Code
Diff
  • is_even = lambda x: not (x % 2)
    
    • def is_even(x):
    • return divmod(x,2)[1] == 0
    • is_even = lambda x: not (x % 2)