首页 > 解决方案 > 如何修复 WingIDE for python 3 上的制表符和空格不一致?

问题描述

我遇到了这段代码的问题,它本身并不是任何实际的代码,而是导致我出现问题的间距。这个文件是这样的,当我运行它时,它说“在缩进中不一致使用制表符和空格(2,第 11 行) ”所以就在 def is_less_than 之后。我不知道这意味着什么,并且知道如何解决它,任何帮助将不胜感激。谢谢。

    class Student():
    def __init__(self, id, name, mark):
        '''Initialize the object properties'''
        self.id = id
        self.name = name
        self.mark = mark

    def __str__(self):
        '''Informal string representation of Student'''
        return ' - {}, {}, {}'.format(self.id, self.name, self.mark)

    def is_less_than(self, another_student):
    ''' 
    Checks if the mark of the student is less than the mark of another 
    Student object
    Input: another_student (Student)
        Returns: boolean
    '''
        # TODO - remove the pass and complete the function
        pass

    def recursive_merge_sort(data):  
        '''
        Uses MergeSort to sort the list of data in INCREASING order
        Returns: the sorted list of Students  
        '''
        # TODO - remove the pass and complete the function
        # Hint: modify your merge sort from exercise 1
        pass

标签: python

解决方案


推荐阅读