about expression
Can you please elaborate why you use backslash and apostrophe mark
in front and end of data in the following code:
print('The sum of \'data\' is :',total)
HI Ayush,
Within the print string, from the first ' to the final ', if you wish to include another ' or a set of ', you need to use an ESCAPE character, which is \ (backslash). This is how the output shows The sum of 'data' is: not just The sum of data is:
Same process if you wanted to print Data's sum is: you would have to use 'Data\'s sum is:'
https://learn.365datascience.com/courses/introduction-to-python/strings/
Link above gives same details - from 2:40 in the video.....
Or Page 8 'Introduction to Python - Course Notes' with the video examples.
Hope this helps.
Regards,
Kev T.