在自学嵌套if语句时遇到TypeError: ‘>=‘ not supported between instances of ‘str‘ and ‘int‘问题的分析
练习:小王=5小王='男'if小王=='男':print('男')if小王>=60:print('可以退休。')else:print('不可退休。')else:print('男60女55。')print(type(小王))输出的结果是:TypeError:'>='notsupportedbetweeninstancesof'str'and'int'分析原因,原来问题出在变量赋值上,“小王='男'”