The question on my assignment is as follows:
Write a function that takes, as an argument, a string, identified by the variable
aString. If the string only contains digits 0 and 1, return the string formed by concatenating the argument with the string "is a binary string." Otherwise, return a string indicating the length of the argument, as specified in the examples that follow. Name this functionAmIBinary(aString).
I am having trouble figuring out how to form a loop which searches through a string and determines whether or not the string is a binary string. I understand how to get the length of a string, I just don't understand how to figure out if it is a binary string.
re.match("[01]+",test_string)forloop. Something likefor char in aString:. You should also take some time to go through the python tutorial