If you are trying to print a string, what happens if you leave out one of the quotation marks or both and why?
You can use a minus sign to make a negative number like -2. What happens for each of the following and why?
>>> 2++2
>>> 2--2
>>> 2+-2
>>> 2-+2
In math notation, leading zeros are OK, as in 02. What happens if you try this in Python and why?
What happens if you have two values with no operator and a space in between them and why?
If you omit both quotations while outputting a string you get a name error. that is NameError: name is not defined. This is because the compiler will interprete the string as undefined word(s). If you omit one quotation, you get SyntaxError:EOL while scanning string literal error. This is because it will be hard to determine the end or the beginning of the string.
2++2
2-2
2+-2
2-+2
Comments
Leave a comment