you must return the value you get from the function to main and not just print.
print may give you, the user the correct visual output but it does not return it to the machine.
so instead of print(generate_hashtag('Do We have A Hashtag')[0]) remove the print and inside your function write return "hashtag var name"
Test.assert_equals(generate_hashtag('Do We have A Hashtag')[0], '#', 'Expeted a Hashtag (#) at the beginning.')
Can someone explain what is the significance of the [0] in that test case?
This is the error that I'm getting:
Traceback (most recent call last):
File "train.py", line 12, in
print(generate_hashtag('Do We have A Hashtag')[0])
TypeError: 'NoneType' object is not subscriptable
you must return the value you get from the function to main and not just print.
print may give you, the user the correct visual output but it does not return it to the machine.
so instead of print(generate_hashtag('Do We have A Hashtag')[0]) remove the print and inside your function write return "hashtag var name"
Same here,tested all strings visibile in the initial tests on my pc,the output is ok but I keep getting that error when I try to run it here :(
I am getting the same error for no reason in my local machine it runs fine.
The description clearly says that
-1
is expected in such cases, and the previous responses have already clarified this too. Closing.according to the instructions if there's no other possible bigger number the return should be -1
the answer should be -1 because there is no bigger number than 84 possible with the two digits 8 & 4
One of the test cases reads as this:
Test.assert_equals(generate_hashtag('Do We have A Hashtag')[0], '#', 'Expeted a Hashtag (#) at the beginning.')
Can someone explain what is the significance of the [0] in that test case?
This is the error that I'm getting:
Traceback (most recent call last):
File "train.py", line 12, in
print(generate_hashtag('Do We have A Hashtag')[0])
TypeError: 'NoneType' object is not subscriptable
This comment is hidden because it contains spoiler information about the solution
'Looks like you've solved it'
A very well constructed kata for beginners imo!
https://github.com/codewars/codewars.com/wiki/Troubleshooting-your-solution#when-i-print-my-answer-it-looks-exactly-the-same-as-the-expected-output-yet-tests-fail
This comment is hidden because it contains spoiler information about the solution