Sep-02-2020, 02:27 AM
In [1]: print('Enter two integers, and I will tell you',
...: 'the relationships they satisfy.')
Enter two integers, and I will tell you the relationships they satisfy.
In [2]: print('Enter two integers, and I will tell you'
...: 'the relationships they satisfy.')
Enter two integers, and I will tell you the relationships they satisfy.
This is in ipython on anaconda and the example is out of the textbook Intro to Python. I am trying to teach myself so I did not put this in the homework section as I have no restrictions. The first thing I have learned about coding is every single thing matters. Even an errant comma.
Notice how In [1] there is a comma after you right before the line break. It is not included within the quotes so I figured it is important somehow. It does not show up in the printed statement. Now In[2] I omitted the comma in the code and it printed the same thing as the first example.
In [2] was just me experimenting because I thought it was odd the textbook did not explain the comma that was not part of the sentence. I did a google search regarding commas in python scripts but found nothing. I do not think I know enough about what I am doing to ask google the right questions yet. I found a website that talks about all the print functions but was not able to find an answer there either.
Thank you in advance.
...: 'the relationships they satisfy.')
Enter two integers, and I will tell you the relationships they satisfy.
In [2]: print('Enter two integers, and I will tell you'
...: 'the relationships they satisfy.')
Enter two integers, and I will tell you the relationships they satisfy.
This is in ipython on anaconda and the example is out of the textbook Intro to Python. I am trying to teach myself so I did not put this in the homework section as I have no restrictions. The first thing I have learned about coding is every single thing matters. Even an errant comma.
Notice how In [1] there is a comma after you right before the line break. It is not included within the quotes so I figured it is important somehow. It does not show up in the printed statement. Now In[2] I omitted the comma in the code and it printed the same thing as the first example.
In [2] was just me experimenting because I thought it was odd the textbook did not explain the comma that was not part of the sentence. I did a google search regarding commas in python scripts but found nothing. I do not think I know enough about what I am doing to ask google the right questions yet. I found a website that talks about all the print functions but was not able to find an answer there either.
Thank you in advance.