Help with Python print() function

M
by mike
Jan 05, 2024 57 views 2 replies

I'm having trouble understanding how the print() function works. Sometimes I see print('Hello') and sometimes print("Hello"). What's the difference?

J
jane
1 posts
Jan 05, 2024 11:00
#1

Great question! In Python, you can use both single quotes (') and double quotes (") for strings. They work exactly the same way. The choice often comes down to personal preference or what's inside the string. For example, if your string contains an apostrophe, you might use double quotes: print("It's a beautiful day")

M
mike
2 posts
Jan 05, 2024 12:00
#2

Thank you so much! That makes perfect sense. I was overthinking it.

You must be logged in to post a reply.

Login to Reply

Thread Info

Category Python Help
Created Jan 05, 2024
Replies 2
Views 57

Related Threads

No related threads found.