Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to print the word "in"

I am currently working on a Intro to Pandas and Jupyter activity and I ran into an issue. I am trying to print the following string: ___ was published by ___ in ___.
The following code keeps on changing "in" to a iteration (correct me if that’s the wrong terminology). How can I get it to print the word "in"?

print("row[0] + "was published by" + row[8] + "in" + row[9] + ".")

SyntaxError: unterminated string literal (detected at line 8)

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You have unbalanced double quotes:

Try:

print(row[0] + "was published by" + row[8] + "in" + row[9] + ".") 

or use f-string:

print(f"{row[0]} was published by {row[8]} in {row[9]}.")
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading