unit 1 python.docx - If you are trying to print a string what happens if you leave out one of the quotation marks or both and why A Missing one

unit 1 python.docx - If you are trying to print a string...

This preview shows page 1 - 2 out of 2 pages.

If you are trying to print a string, what happens if you leave out one of the quotation marks or both and why? A: Missing one quotation mark: Shows the error EOL. This error happens while python is reading the string. Literally "EOL" stands for "End of Line". An EOL error means that Python hit the end of a line while going through a string and in this case couldn't find the quotation mark. >>> print ('String) File "<stdin>", line 1 print ('String) ^ SyntaxError: EOL while scanning string literal Without quotation marks: Shows the error NameError: name 'String' is not defined. This error happens because the interpreter looks for the variable not defined 'String'. print (String) Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'String' is not defined You can use a minus sign to make a negative number like -2. What happens for each of the following and
Image of page 1
Image of page 2

You've reached the end of your free preview.

Want to read both pages?

  • Winter '17

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture