+ 2
help with zip code coach improvement
Hi, i passed the tests but this answer doesnt feel good...ideas? Thanks! This is for the "code coach" zip code problem zip = input() if zip.isdigit and len(zip) == 5 and ' ' not in zip: print("true") else: print("false")
5 Respostas
+ 3
if zip.isdigit()
+ 3
You forgot ().
+ 2
isdigit is a method. You need to call this method, then it will check if the string contains only digits.
If you just write...
if 'word'.isdigit:
...
... then you basically only ask:
Does the method isdigit exist? (It does.)
0
what do u mean sir?
0
oh, it still passed without it, what will the () do, and what did not having them do? Thanks!!
i thought the parenth was only to specify if it was a certain dig