prblm = input("Input the Blackout math problem: ")
#I'm using 2//4=5
OP = ['+', '-', '*', '/']
def validate():
"""Checks to see if a string is valid"""
for c in prblm:
if c in OP and c+1 in OP:
print('a')
运行时里显示:检查两个consectutive字符是一个列表
TypeError: Can't convert 'int' object to str implicitly
应该打印出“一个”
如何修复功能的工作或我该怎么办检查两个连续的字符是否在列表中?
如果你找到一个解决问题的方法,只是将它张贴作为一个答案,不将其粘贴在你原来的问题 – 2015-04-07 21:53:08