Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. When trying to print a string without having two quotation marks (an opening and a closing), Python will output a syntax error indicating "EOL while scanning string literal." Meaning, it could not identify and parse out the text in the argument. That is, without the starting quotation, and ending quotation marks, the interpreter is unable to determine where (or what) the actual text is. Subsequently, when using functions with string arguments, it is necessary to envelop the string parameter within quotation marks so as to specifically indicate the text.
  2.  
  3. Now when omitting both quotation marks, the interpreter will try to evaluate the text argument between the parenthesis as a variable, and not as a text string. Should there be a matching name of a variable (with an assigned statement), the interpreter will pass the value of the variable as an argument; thus, printing the value of the variable.
  4.  
  5. However, should there not be an existing variable, as the example code shows below:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement