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 can I put two strings in one print function?

I want to put two strings and one var in one print function is it possible for example:
print(‘Your Name is’ +name ‘I like it!’)

>Solution :

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

Yes, that is called string concatenation. You can add combine strings with variables like this:

print("My name is " + first_name + "." + greeting)

Or you could format it like this:

print(f"My name is {first_name}. {greeting}")
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