Discuss / Python / Pycharm可以定位到出错的代码

Pycharm可以定位到出错的代码

Topic source

Nil_大黄

#1 Created at ... [Delete] [Delete and Lock User]

File "/liaoxf/test_student.py", line 44, in test_invalid

    s1.get_grade()

def get_grade(self):
    if self.score < 0 or self.score > 100:
        raise ValueError        
        return -1    
    if self.score >= 80:
        return 'A'
    if self.score >= 60:
        return 'B'
    return 'C'

  • 1

Reply