已采纳回答 / 慕后端1274496
你的x是tuple,想输出ok,set里的元素也应该是tuple类型: weekdays = set([('MON', 'TUE', 'WEN', 'THU', 'FRI', 'SAT', 'SUN')]) x = 'MON', 'TUE', 'WEN', 'THU', 'FRI', 'SAT', 'SUN' if x in weekdays: print('input ok') else: print('input error')
2019-05-16
最新回答 / qq_慕神6366216
def average(*args): if len(args) == 0 : return 0.0 else: return sum(args)*1.0/len(args) print average()print average(1, 2)print average(1, 2, 2, 3, 4)
2019-05-15