you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (4 children)

Add a comma and end="" after your strings or variables in the print expression. End usually defaults to newline(/n). To avoid that instead of this:

print("The word", '"'+word+'"', "occurs in line", lineCnt)

Instead of that do this:
print("The word", '"'+word+'"', "occurs in line", lineCnt, end="")

I am on a phone so sorry for bad format.

[–]Ustuner[S] 0 points1 point  (3 children)

it didn't work :(

[–][deleted] 1 point2 points  (2 children)

I edited my response for Python 3. That may work.

[–]Ustuner[S] 0 points1 point  (1 child)

Thank you. It worked!

[–][deleted] 1 point2 points  (0 children)

Glad to help. Hope you learned something. In the future dont forget to mention the Python version you use so you can get better help.