Python Forum

Full Version: Help with test exercise
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey Im having a test and I cant get over one exercise.

Python - Write a program that shows words that contains "-" symbol in a text written by user. Test it for "czarno-biale"
what have you tried? Post your code in code tags and ask specific questions. If you get error, post full traceback in error tags.
we are glad to help, but we are not here to do your [home]work for you.
Okay I did it myself, thread can be closed. Sorry for problems.
That's easy! :)
>>> def contains_dash(words):
...   for word in words:
...     print(word)
...
>>> contains_dash('czarno-biale'.split())
czarno-biale